Merge "Escape return path extra params to php mail()"
[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="#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="#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 !! end
1446
1447 !! test
1448 nowiki 3
1449 !! wikitext
1450 :There is not nowiki.
1451 :There is <nowiki>nowiki</nowiki>.
1452
1453 #There is not nowiki.
1454 #There is <nowiki>nowiki</nowiki>.
1455
1456 *There is not nowiki.
1457 *There is <nowiki>nowiki</nowiki>.
1458 !! html/php
1459 <dl><dd>There is not nowiki.</dd>
1460 <dd>There is nowiki.</dd></dl>
1461 <ol><li>There is not nowiki.</li>
1462 <li>There is nowiki.</li></ol>
1463 <ul><li>There is not nowiki.</li>
1464 <li>There is nowiki.</li></ul>
1465
1466 !! html/parsoid
1467 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1468 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1469
1470 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1471 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1472
1473 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1474 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1475 !! end
1476
1477 !! test
1478 Entities inside <nowiki>
1479 !! wikitext
1480 <nowiki>&lt;</nowiki>
1481 !! html
1482 <p>&lt;
1483 </p>
1484 !! end
1485
1486 !! test
1487 Entities inside template parameters
1488 !! wikitext
1489 {{echo|&ndash;}}
1490 !! html/php+tidy
1491 <p>–</p>
1492 !! html/parsoid
1493 <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>
1494 !! end
1495
1496 !! test
1497 Properly escape nowiki when combined with other wiki markup
1498 !! options
1499 parsoid=html2wt
1500 !! html/parsoid
1501 <p>* &lt;/nowiki&gt; tag</p>
1502 !! wikitext
1503 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1504 !! end
1505
1506 !! test
1507 T93824: Put escaped HTML tags inside nowiki
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1512 !! wikitext
1513 <nowiki><h2>foo</h2></nowiki>
1514 !! end
1515
1516 !! test
1517 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1522 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1523 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1524 !! wikitext
1525 This text: L'[[Foo]]
1526 This text: L<nowiki>''</nowiki>[[Foo]]
1527 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1528 !! end
1529
1530 # This test fails because wikitext whitespace is not normalized before comparing.
1531 !! test
1532 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1533 !! options
1534 parsoid=html2wt
1535 !! html/parsoid
1536 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1537 </p>
1538 !! wikitext
1539 This text : L<nowiki>''</nowiki>[[Foo]]
1540 !! end
1541
1542 # This test and the next one are html2wt only as they test that incorrect wikitext
1543 # passed in template arguments gets escaped or wrapped in nowikis where required.
1544 !! test
1545 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1546 !! options
1547 parsoid=html2wt
1548 !! html/parsoid
1549 <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>
1550 <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>
1551 !! wikitext
1552 {{echo|foo{{!}}bar}}
1553 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1554 !! end
1555
1556 !! test
1557 T53961: Output correct nowikis in template arguments
1558 !! options
1559 parsoid=html2wt
1560 !! html/parsoid
1561 <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>
1562 <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>
1563 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></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 | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></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 }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1566 !! wikitext
1567 {{echo|a [ b}}
1568 {{echo|<nowiki>a }} b</nowiki>}}
1569 {{echo|<nowiki>a [[ b</nowiki>}}
1570 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1571 {{echo|a <nowiki>}</nowiki>}}
1572 !! end
1573
1574 !! test
1575 Cases where "!!" needs nowiki protection
1576 !! options
1577 parsoid=html2wt
1578 !! html/parsoid
1579 <table>
1580 <tr><th>this needs protection !! here</th></tr>
1581 </table>
1582
1583 <table>
1584 <tr><th>this does not need
1585 protection !! here</th></tr>
1586 </table>
1587 !! wikitext
1588 {|
1589 !<nowiki>this needs protection !! here</nowiki>
1590 |}
1591
1592 {|
1593 !this does not need
1594 protection !! here
1595 |}
1596 !! end
1597
1598 ###
1599 ### Comments
1600 ###
1601 !! test
1602 Comments and Indent-Pre
1603 !! wikitext
1604 <!-- comment 1 --> asdf
1605
1606 <!-- comment 1 --> asdf
1607 <!-- comment 2 -->
1608
1609 <!-- comment 1 --> asdf
1610 <!-- comment 2 -->xyz
1611
1612 <!-- comment 1 --> asdf
1613 <!-- comment 2 --> xyz
1614 !! html
1615 <pre>asdf
1616 </pre>
1617 <pre>asdf
1618 </pre>
1619 <pre>asdf
1620 </pre>
1621 <p>xyz
1622 </p>
1623 <pre>asdf
1624 xyz
1625 </pre>
1626 !! end
1627
1628 !! test
1629 Comment test 2a
1630 !! wikitext
1631 asdf
1632 <!-- comment 1 -->
1633 jkl
1634 !! html
1635 <p>asdf
1636 jkl
1637 </p>
1638 !! end
1639
1640 !! test
1641 Comment test 2b
1642 !! wikitext
1643 asdf
1644 <!-- comment 1 -->
1645
1646 jkl
1647 !! html
1648 <p>asdf
1649 </p><p>jkl
1650 </p>
1651 !! end
1652
1653 !! test
1654 Comment test 3
1655 !! wikitext
1656 asdf
1657 <!-- comment 1 -->
1658 <!-- comment 2 -->
1659 jkl
1660 !! html
1661 <p>asdf
1662 jkl
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment test 4
1668 !! wikitext
1669 asdf<!-- comment 1 -->jkl
1670 !! html
1671 <p>asdfjkl
1672 </p>
1673 !! end
1674
1675 !! test
1676 Comment spacing
1677 !! wikitext
1678 a
1679 <!-- foo --> b <!-- bar -->
1680 c
1681 !! html
1682 <p>a
1683 </p>
1684 <pre> b
1685 </pre>
1686 <p>c
1687 </p>
1688 !! end
1689
1690 !! test
1691 Comment whitespace
1692 !! wikitext
1693 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1694 !! html
1695
1696 !! end
1697
1698 !! test
1699 Comment semantics and delimiters
1700 !! wikitext
1701 <!-- --><!----><!-----><!------>
1702 !! html/php
1703
1704 !! html/parsoid
1705 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1706 !! end
1707
1708 !! test
1709 Comment semantics and delimiters, redux
1710 !! wikitext
1711 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1712 -- foo -- funky huh? ... -->
1713 !! html/php
1714
1715 !! html/parsoid
1716 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1717 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1718 !! end
1719
1720 !! test
1721 Comment semantics and delimiters: directors cut
1722 !! wikitext
1723 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1724 everything starting with < followed by !-- until the first -- and > we see,
1725 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1726 -->-->
1727 !! html/php
1728 <p>--&gt;
1729 </p>
1730 !! html/parsoid
1731 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1732 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1733 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1734 --><p>--></p>
1735 !! end
1736
1737 !! test
1738 Comment semantics: nesting
1739 !! wikitext
1740 <!--<!-- no, we're not going to do anything fancy here -->-->
1741 !! html/php
1742 <p>--&gt;
1743 </p>
1744 !! html/parsoid
1745 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1746 !! end
1747
1748 # Parsoid closes the unclosed comment, even if it means a slight
1749 # round-trip diff.
1750 !! test
1751 Comment semantics: unclosed comment at end
1752 !! options
1753 parsoid=wt2html,html2html
1754 !! wikitext
1755 <!--This comment will run out to the end of the document
1756 !! html/php
1757
1758 !! html/parsoid
1759 <!--This comment will run out to the end of the document-->
1760 !! end
1761
1762 !! test
1763 Comment semantics: normalize comments to play nice with XML and browsers
1764 !! wikitext
1765 <!-- Browsers --!> think this is closed -->
1766 <!--> This would normally be text -->
1767 <!---> As would this -->
1768 <!-- XML doesn't like trailing dashes -------->
1769 <!-- Nor doubled hyphens -- anywhere in the data -->
1770 But this is not a comment.
1771 !! html/php
1772 <p>But this is not a comment.
1773 </p>
1774 !! html/parsoid
1775 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1776 <!--&#x3E; This would normally be text -->
1777 <!--&#x2D;&#x3E; As would this -->
1778 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1779 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1780 <p>But this is not a comment.</p>
1781 !! end
1782
1783 !! test
1784 Comment semantics: round-trip even text which contains encoded -->
1785 !! wikitext
1786 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1787 !! html/parsoid
1788 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1789 !! end
1790
1791 !! test
1792 Comment in template title
1793 !! wikitext
1794 {{f<!---->oo}}
1795 !! html
1796 <p>FOO
1797 </p>
1798 !! end
1799
1800 !! test
1801 Comment on its own line post-expand
1802 !! wikitext
1803 a
1804 {{blank}}<!---->
1805 b
1806 !! html
1807 <p>a
1808 </p><p>b
1809 </p>
1810 !! end
1811
1812 !! test
1813 Comment on its own line post-expand with non-significant whitespace
1814 !! wikitext
1815 a
1816 {{blank}} <!---->
1817 b
1818 !! html
1819 <p>a
1820 </p><p>b
1821 </p>
1822 !! end
1823
1824 !! test
1825 Multiple comments should still parse as SOL-transparent
1826 !! options
1827 parsoid=wt2html,wt2wt
1828 !! wikitext
1829 <!--c1-->*a
1830 <!--c2--><!--c3--><!--c4-->*b
1831 !! html/php
1832 <ul><li>a</li>
1833 <li>b</li></ul>
1834
1835 !! html/parsoid
1836 <!--c1--><ul>
1837 <li>a
1838 </li>
1839 <!--c2--><!--c3--><!--c4-->
1840 <li>b
1841 </li>
1842 </ul>
1843 !! end
1844
1845 ###
1846 ### paragraph wrapping tests
1847 ###
1848 !! test
1849 No block tags
1850 !! wikitext
1851 a
1852
1853 b
1854 !! html
1855 <p>a
1856 </p><p>b
1857 </p>
1858 !! end
1859
1860 !! test
1861 Block tag on one line (<div>)
1862 !! wikitext
1863 a <div>foo</div>
1864
1865 b
1866 !! html
1867 a <div>foo</div>
1868 <p>b
1869 </p>
1870 !! html+tidy
1871 <p>a</p>
1872 <div>foo</div>
1873 <p>b</p>
1874 !! end
1875
1876 !! test
1877 Block tag on one line (<blockquote>)
1878 !! wikitext
1879 a <blockquote>foo</blockquote>
1880
1881 b
1882 !! html
1883 a <blockquote>foo</blockquote>
1884 <p>b
1885 </p>
1886 !! html+tidy
1887 <p>a</p>
1888 <blockquote>
1889 <p>foo</p>
1890 </blockquote>
1891 <p>b</p>
1892 !! end
1893
1894 !! test
1895 Block tag on both lines (<div>)
1896 !! wikitext
1897 a <div>foo</div>
1898
1899 b <div>foo</div>
1900 !! html
1901 a <div>foo</div>
1902 b <div>foo</div>
1903
1904 !! html+tidy
1905 <p>a</p>
1906 <div>foo</div>
1907 <p>b</p>
1908 <div>foo</div>
1909 !! end
1910
1911 !! test
1912 Block tag on both lines (<blockquote>)
1913 !! wikitext
1914 a <blockquote>foo</blockquote>
1915
1916 b <blockquote>foo</blockquote>
1917 !! html
1918 a <blockquote>foo</blockquote>
1919 b <blockquote>foo</blockquote>
1920
1921 !! html+tidy
1922 <p>a</p>
1923 <blockquote>
1924 <p>foo</p>
1925 </blockquote>
1926 <p>b</p>
1927 <blockquote>
1928 <p>foo</p>
1929 </blockquote>
1930 !! end
1931
1932 !! test
1933 Multiple lines without block tags
1934 !! wikitext
1935 <div>foo</div> a
1936 b
1937 c
1938 d<!--foo--> e
1939 x <div>foo</div> z
1940 !! html
1941 <div>foo</div> a
1942 <p>b
1943 c
1944 d e
1945 </p>
1946 x <div>foo</div> z
1947
1948 !! html+tidy
1949 <div>foo</div>
1950 <p>a</p>
1951 <p>b c d e</p>
1952 <p>x</p>
1953 <div>foo</div>
1954 <p>z</p>
1955 !! end
1956
1957 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1958 # So, we have a separate section for Parsoid. We don't want
1959 # to mimic this stripping behavior in Parsoid. It affects
1960 # editing experience and also requires us to maintain additional
1961 # info for RT-ing.
1962 !! test
1963 Empty lines between lines with block tags
1964 !! wikitext
1965 <div></div>
1966
1967
1968 <div></div>a
1969
1970 b
1971 <div>a</div>b
1972
1973 <div>b</div>d
1974
1975
1976 <div>e</div>
1977 !! html
1978 <div></div>
1979 <p><br />
1980 </p>
1981 <div></div>a
1982 <p>b
1983 </p>
1984 <div>a</div>b
1985 <div>b</div>d
1986 <p><br />
1987 </p>
1988 <div>e</div>
1989
1990 !! html+tidy
1991 <p><br /></p>
1992 <p>a</p>
1993 <p>b</p>
1994 <div>a</div>
1995 <p>b</p>
1996 <div>b</div>
1997 <p>d</p>
1998 <p><br /></p>
1999 <div>e</div>
2000 !! html/parsoid
2001 <div data-parsoid='{"stx":"html"}'></div>
2002
2003 <p><br /></p>
2004 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2005
2006 <p>b</p>
2007 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2008
2009 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2010
2011 <p><br /></p>
2012 <div data-parsoid='{"stx":"html"}'>e</div>
2013 !! end
2014
2015 ## PHP parser emits output which is broken
2016 !! test
2017 Unclosed HTML p-tags should be handled properly
2018 !! wikitext
2019 <div><p>foo</div>
2020 a
2021
2022 b
2023 !! html/php+tidy
2024 <div>
2025 <p>foo</p>
2026 </div>
2027 <p>a</p>
2028 <p>b</p>
2029 !! html/parsoid
2030 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2031 <p>a</p>
2032 <p>b</p>
2033 !! end
2034
2035 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2036 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2037 ## them for now.
2038 !! test
2039 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2040 !! options
2041 parsoid=wt2html
2042 !! wikitext
2043 a [[Category:A1]] [[Category:A2]]
2044 [[Category:A3]]
2045 [[Category:A4]]
2046 !! html/parsoid
2047 <p>a</p>
2048 <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"/>
2049 !! end
2050
2051 !! test
2052 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2053 !! options
2054 parsoid=wt2html
2055 !! wikitext
2056 [[Category:A1]]a
2057 !! html/parsoid
2058 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2059 !! end
2060
2061 ###
2062 ### Preformatted text
2063 ###
2064 !! test
2065 Preformatted text
2066 !! wikitext
2067 This is some
2068 Preformatted text
2069 With ''italic''
2070 And '''bold'''
2071 And a [[Main Page|link]]
2072 !! html
2073 <pre>This is some
2074 Preformatted text
2075 With <i>italic</i>
2076 And <b>bold</b>
2077 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2078 </pre>
2079 !! end
2080
2081 !! test
2082 Tabs don't trigger preformatted text
2083 !! wikitext
2084 This is not
2085 preformatted text.
2086 This is preformatted text.
2087 So is this.
2088 !! html/php
2089 <p> This is not
2090 preformatted text.
2091 </p>
2092 <pre>This is preformatted text.
2093 So is this.
2094 </pre>
2095 !! html/parsoid
2096 <p> This is not
2097 preformatted text.</p>
2098 <pre>This is preformatted text.
2099 So is this.</pre>
2100 !! end
2101
2102 !! test
2103 Space before tab needs nowiki pre protection
2104 !! options
2105 parsoid=html2wt
2106 !! html/parsoid
2107 <p> a</p>
2108 !! wikitext
2109 <nowiki> </nowiki> a
2110 !! end
2111
2112 !! test
2113 Ident preformatting with inline content
2114 !! wikitext
2115 a
2116 ''b''
2117 !! html
2118 <pre>a
2119 <i>b</i>
2120 </pre>
2121 !! end
2122
2123 !! test
2124 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2125 !! wikitext
2126 <pre><nowiki>
2127 <b>
2128 <cite>
2129 <em>
2130 </nowiki></pre>
2131 !! html
2132 <pre>
2133 &lt;b&gt;
2134 &lt;cite&gt;
2135 &lt;em&gt;
2136 </pre>
2137
2138 !! end
2139
2140 !! test
2141 Regression with preformatted in <center>
2142 !! wikitext
2143 <center>
2144 Blah
2145 </center>
2146 !! html
2147 <center>
2148 <pre>Blah
2149 </pre>
2150 </center>
2151
2152 !! end
2153
2154 !! test
2155 Bug 52763: Preformatted in <blockquote>
2156 !! wikitext
2157 <blockquote>
2158 Blah
2159 {|
2160 |
2161 indented cell (no pre-wrapping!)
2162 |}
2163 </blockquote>
2164 !! html
2165 <blockquote>
2166 <p> Blah
2167 </p>
2168 <table>
2169 <tr>
2170 <td>
2171 <p> indented cell (no pre-wrapping!)
2172 </p>
2173 </td></tr></table>
2174 </blockquote>
2175
2176 !! end
2177
2178 !! test
2179 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2180 !! wikitext
2181 <blockquote>
2182 Foo
2183
2184 Bar
2185 </blockquote>
2186 !! html
2187 <blockquote>
2188 <p>Foo
2189 </p><p>Bar
2190 </p>
2191 </blockquote>
2192
2193 !! end
2194
2195 !! test
2196 Bug 15491: <ins>/<del> in blockquote
2197 !! wikitext
2198 <blockquote>
2199 Foo <del>bar</del> <ins>baz</ins> quux
2200 </blockquote>
2201 !! html
2202 <blockquote>
2203 <p>Foo <del>bar</del> <ins>baz</ins> quux
2204 </p>
2205 </blockquote>
2206
2207 !! end
2208
2209 # Note that the p-wrapping is newline sensitive, which could be
2210 # considered a bug: tidy will wrap only the 'Foo' in the example
2211 # below in a <p> tag. (see comment 23-25 of bug #6200)
2212 !! test
2213 Bug 15491: <ins>/<del> in blockquote (2)
2214 !! wikitext
2215 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2216 </blockquote>
2217 !! html
2218 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2219 </blockquote>
2220
2221 !! html+tidy
2222 <blockquote>
2223 <p>Foo</p>
2224 <del>bar</del> <ins>baz</ins> quux</blockquote>
2225 !! end
2226
2227 !! test
2228 <pre> with attributes (bug 3202)
2229 !! wikitext
2230 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2231 !! html
2232 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2233
2234 !! end
2235
2236 !! test
2237 <pre> with width attribute (bug 3202)
2238 !! wikitext
2239 <pre width="8">Narrow screen goodies</pre>
2240 !! html
2241 <pre width="8">Narrow screen goodies</pre>
2242
2243 !! end
2244
2245 !! test
2246 <pre> with forbidden attribute (bug 3202)
2247 !! wikitext
2248 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2249 !! html
2250 <pre width="8">Narrow screen goodies</pre>
2251
2252 !! end
2253
2254 !! test
2255 Entities inside <pre>
2256 !! wikitext
2257 <pre>&lt;</pre>
2258 !! html
2259 <pre>&lt;</pre>
2260
2261 !! end
2262
2263 !! test
2264 <pre> with forbidden attribute values (bug 3202)
2265 !! wikitext
2266 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2267 !! html
2268 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2269
2270 !! end
2271
2272 !! test
2273 <nowiki> inside <pre> (bug 13238)
2274 !! wikitext
2275 <pre>
2276 <nowiki>
2277 </pre>
2278 <pre>
2279 <nowiki></nowiki>
2280 </pre>
2281 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2282 !! html
2283 <pre>
2284 &lt;nowiki&gt;
2285 </pre>
2286 <pre>
2287
2288 </pre>
2289 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2290
2291 !! end
2292
2293 !! test
2294 <nowiki> inside of #tag:pre
2295 !! wikitext
2296 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2297 !! html/php
2298 <pre>Foo &#8594;bar</pre>
2299
2300 !! html/parsoid
2301 <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>
2302 !! end
2303
2304 !! test
2305 <nowiki> and <pre> preference (first one wins)
2306 !! wikitext
2307 <pre>
2308 <nowiki>
2309 </pre>
2310 </nowiki>
2311 </pre>
2312
2313 <nowiki>
2314 <pre>
2315 <nowiki>
2316 </pre>
2317 </nowiki>
2318 </pre>
2319
2320 !! html/php
2321 <pre>
2322 &lt;nowiki&gt;
2323 </pre>
2324 <p>&lt;/nowiki&gt;
2325 &lt;/pre&gt;
2326 </p><p>
2327 &lt;pre&gt;
2328 &lt;nowiki&gt;
2329 &lt;/pre&gt;
2330
2331 &lt;/pre&gt;
2332 </p>
2333 !! html/parsoid
2334 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2335 </pre>
2336 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2337 &lt;/pre></p>
2338
2339 <p><span typeof="mw:Nowiki">
2340 &lt;pre>
2341 &lt;nowiki>
2342 &lt;/pre>
2343 </span>
2344 &lt;/pre></p>
2345 !! end
2346
2347 !! test
2348 </pre> inside nowiki
2349 !! wikitext
2350 <nowiki></pre></nowiki>
2351 !! html
2352 <p>&lt;/pre&gt;
2353 </p>
2354 !! end
2355
2356 # Parsoid doesn't strip empty tags, like Tidy does.
2357 !! test
2358 Empty pre; pre inside other HTML tags (bug 54946)
2359 !! options
2360 parsoid=wt2html,wt2wt
2361 !! wikitext
2362 a
2363
2364 <div><pre>
2365 foo
2366 </pre></div>
2367 <pre></pre>
2368 !! html/php
2369 <p>a
2370 </p>
2371 <div><pre>
2372 foo
2373 </pre></div>
2374 <pre></pre>
2375
2376 !! html/php+tidy
2377 <p>a</p>
2378 <div>
2379 <pre>
2380 foo
2381 </pre></div>
2382 !! html/parsoid
2383 <p>a</p>
2384
2385 <div><pre>foo
2386 </pre></div>
2387 <pre></pre>
2388 !! end
2389
2390 !! test
2391 HTML pre followed by indent-pre
2392 !! wikitext
2393 <pre>foo</pre>
2394 bar
2395 !! html
2396 <pre>foo</pre>
2397 <pre>bar
2398 </pre>
2399 !! end
2400
2401 # Note that tidy removes the empty <p> tags from the start and end.
2402 # Parsoid does not, by design.
2403 !!test
2404 Block tag pre
2405 !! wikitext
2406 <p><pre>foo</pre></p>
2407 !! html/php+tidy
2408 <pre>
2409 foo
2410 </pre>
2411 !! html/parsoid
2412 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2413 !!end
2414
2415 !!test
2416 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2417 !! wikitext
2418 {{echo|}}
2419 !! html
2420
2421 !!end
2422
2423 !!test
2424 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2425 !! wikitext
2426 {{echo|
2427 foo}}
2428 !! html
2429 <p>foo
2430 </p>
2431 !!end
2432
2433 !! test
2434 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2435 !! wikitext
2436 {{echo|a
2437 b}}
2438 !! html
2439 <pre>a
2440 </pre>
2441 <p>b
2442 </p>
2443 !!end
2444
2445 !! test
2446 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2447 !! wikitext
2448 {{echo|a
2449 b
2450 c
2451 d
2452 e
2453 }}
2454 !! html
2455 <pre>a
2456 </pre>
2457 <p>b
2458 c
2459 </p>
2460 <pre>d
2461 </pre>
2462 <p>e
2463 </p>
2464 !!end
2465
2466 !!test
2467 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2468 !! wikitext
2469 {{echo| foo}}
2470
2471 {{echo| foo}}{{echo| bar}}
2472
2473 {{echo| foo}}
2474 {{echo| bar}}
2475
2476 {{echo|<!--cmt--> foo}}
2477
2478 <!--cmt-->{{echo| foo}}
2479
2480 {{echo|{{echo| }}bar}}
2481 !! html
2482 <pre>foo
2483 </pre>
2484 <pre>foo bar
2485 </pre>
2486 <pre>foo
2487 bar
2488 </pre>
2489 <pre>foo
2490 </pre>
2491 <pre>foo
2492 </pre>
2493 <pre>bar
2494 </pre>
2495 !!end
2496
2497 !! test
2498 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2499 !! wikitext
2500 {{echo| }}a
2501
2502 {{echo|
2503 }}a
2504
2505 {{echo|
2506 b}}
2507
2508 {{echo|a
2509 }}b
2510
2511 {{echo|a
2512 }} b
2513 !! html
2514 <pre>a
2515 </pre>
2516 <p><br />
2517 </p>
2518 <pre>a
2519 </pre>
2520 <p><br />
2521 </p>
2522 <pre>b
2523 </pre>
2524 <p>a
2525 </p>
2526 <pre>b
2527 </pre>
2528 <p>a
2529 </p>
2530 <pre>b
2531 </pre>
2532 !!end
2533
2534 !! test
2535 Pres with newline attributes
2536 !! wikitext
2537 <pre class="one
2538 two">hi</pre>
2539 !! html/php
2540 <pre class="one two">hi</pre>
2541
2542 !! html/parsoid
2543 <pre class="one
2544 two" data-parsoid='{"stx":"html"}'>hi</pre>
2545 !! end
2546
2547 !! test
2548 Things that look like <pre> tags aren't treated as such
2549 !! wikitext
2550 Barack Obama <President> of the United States
2551 <President></President>
2552 !! html
2553 <p>Barack Obama &lt;President&gt; of the United States
2554 &lt;President&gt;&lt;/President&gt;
2555 </p>
2556 !! end
2557
2558 !! test
2559 Handle broken pre-like tags (bug 64025)
2560 !! options
2561 parsoid=wt2html
2562 !! wikitext
2563 {{echo|<pre <pre>x</pre>}}
2564
2565 <table><pre </table>
2566 !! html/php
2567 <pre>x</pre>
2568 <table>&lt;pre </table>
2569
2570 !! html/php+tidy
2571 <pre>
2572 x
2573 </pre>
2574 <p>&lt;pre</p>
2575 !! html/parsoid
2576 <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>
2577
2578
2579 <p>&lt;pre </p>
2580
2581 <table></table>
2582 !! end
2583
2584 !! test
2585 Parsoid: handle pre with space after attribute
2586 !! options
2587 parsoid=wt2html
2588 !! wikitext
2589 <pre style="width:50%;" >{{echo|foo}}</pre>
2590 !! html/php
2591 <pre style="width:50%;">{{echo|foo}}</pre>
2592
2593 !! html/parsoid
2594 <pre style="width:50%;">{{echo|foo}}</pre>
2595 !! end
2596
2597 # TODO / maybe: fix wt2wt for this
2598 !! test
2599 Parsoid: Don't paragraph-wrap fosterable content
2600 !! options
2601 parsoid=wt2html
2602 !! wikitext
2603 {|
2604 <td></td>
2605 <td></td>
2606
2607
2608
2609 |}
2610 !! html
2611 <table>
2612
2613 <tbody>
2614 <tr>
2615 <td></td>
2616
2617 <td></td></tr>
2618
2619
2620
2621 </tbody></table>
2622 !! end
2623
2624 !! test
2625 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2626 !! options
2627 parsoid=wt2html
2628 !! wikitext
2629 {|
2630 <td>
2631 <td>
2632 </td>
2633
2634
2635
2636 |}
2637 !! html
2638 <table>
2639
2640 <tbody>
2641 <tr>
2642 <td></td>
2643
2644 <td>
2645 </td></tr>
2646
2647
2648
2649 </tbody></table>
2650 !! end
2651
2652
2653 #--------------------------------------------------------------------
2654 # Transclusion parameter whitespace stripping tests
2655 # Behavior is different for positional and named parameters
2656 #--------------------------------------------------------------------
2657 !! test
2658 Templates: Strip leading and trailing whitespace from named-param values
2659 !! wikitext
2660 {{echo|1= a }}
2661
2662 {{echo|1= {{echo|b}} }}
2663
2664 {{echo| 1 =
2665 c }}
2666
2667 {{echo| 1 =
2668 * d
2669 }}
2670 !! html
2671 <p>a
2672 </p><p>b
2673 </p><p>c
2674 </p>
2675 <ul><li> d</li></ul>
2676
2677 !! end
2678
2679 !! test
2680 Templates: Don't strip whitespace from positional-param values
2681 !! wikitext
2682 {{echo|a }}
2683
2684 {{echo|{{echo|b}} }}
2685
2686 {{echo| c
2687 }}
2688
2689 {{echo| {{echo|d}}
2690 }}
2691
2692 {{echo|
2693 e}}
2694
2695 {{echo|
2696 * f}}
2697
2698 {{echo|
2699 }}g
2700 !! html
2701 <p>a
2702 </p><p>b
2703 </p>
2704 <pre>c
2705 </pre>
2706 <p><br />
2707 </p>
2708 <pre>d
2709 </pre>
2710 <p><br />
2711 </p>
2712 <pre>e
2713 </pre>
2714 <p><br />
2715 </p>
2716 <ul><li> f</li></ul>
2717 <p><br />
2718 </p>
2719 <pre>g
2720 </pre>
2721 !! end
2722
2723 !! test
2724 Templates: Handle empty comment-and-ws-only lines correctly
2725 !! wikitext
2726 {{echo|foo
2727 <!--should be ignored-->
2728 <!--should be ignored as well-->
2729 bar}}
2730 !! html/php
2731 <p>foo
2732 bar
2733 </p>
2734 !! html/parsoid
2735 <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>
2736 !! end
2737
2738 !! test
2739 Templates: Handle comments in the target
2740 !! wikitext
2741 {{echo
2742 <!-- should be ignored -->
2743 |foo}}
2744
2745 {{echo
2746 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2747 |foo}}
2748
2749 {{echo<!-- should be ignored -->
2750 |foo}}
2751
2752 {{echo<!-- should be ignored -->|foo}}
2753
2754 {{<!-- should be ignored -->echo|foo}}
2755 !! html/php
2756 <p>foo
2757 </p><p>foo
2758 </p><p>foo
2759 </p><p>foo
2760 </p><p>foo
2761 </p>
2762 !! html/parsoid
2763 <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>
2764
2765 <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>
2766
2767 <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>
2768
2769 <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>
2770
2771 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2772 !!end
2773
2774 !! test
2775 Templates: Handle comments in parameter names (bug 67657)
2776 !! wikitext
2777 {{echo|1
2778 <!-- should be ignored -->
2779 =foo}}
2780
2781 {{echo|
2782 <!-- should be ignored -->
2783 1 = foo}}
2784
2785 {{echo|1<!-- should be ignored -->=foo}}
2786
2787 {{echo|<!-- should be ignored -->1=foo}}
2788 !! html/php
2789 <p>foo
2790 </p><p>foo
2791 </p><p>foo
2792 </p><p>foo
2793 </p>
2794 !! html/parsoid
2795 <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>
2796
2797 <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>
2798
2799 <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>
2800
2801 <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>
2802 !!end
2803
2804 !! test
2805 Templates: Other wikitext in parameter names (bug 67657)
2806 !! wikitext
2807 {{echo|''1''=foo}}
2808 !! html/php
2809 <p>{{{1}}}
2810 </p>
2811 !! html/parsoid
2812 <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>
2813 !!end
2814
2815 #--------------------------------------------------------------------
2816 # Transclusion parameter escaping tests
2817 #--------------------------------------------------------------------
2818 !! test
2819 Templates: Parsoid parameter escaping test 1
2820 !! wikitext
2821 {{echo|[foo]|{{echo|[bar]}}}}
2822 !! html/php+tidy
2823 <p>[foo]</p>
2824 !! html/parsoid
2825 <p about="#mwt1" typeof="mw:Transclusion"
2826 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2827 !! end
2828
2829 !! test
2830 Parsoid: Pipes in external links in template parameter
2831 !! wikitext
2832 {{echo|[{{echo|http://example.com}} link]}}
2833 !! html/php+tidy
2834 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2835 !! html/parsoid
2836 <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>
2837 !! end
2838
2839 !! test
2840 Parsoid: pipe in transclusion parameter
2841 !! wikitext
2842 {{echo|http://foo.com/a&#124;b}}
2843 !! html/php+tidy
2844 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2845 !! html/parsoid
2846 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2847 typeof="mw:Transclusion"
2848 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>
2849 !! end
2850
2851 !! test
2852 Parsoid: Pipe in external link target and content in template parameter
2853 !! options
2854 parsoid=html2wt,wt2wt
2855 !! wikitext
2856 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2857 !! html/php+tidy
2858 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2859 !! html/parsoid
2860 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2861 typeof="mw:Transclusion"
2862 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2863 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2864 !! end
2865
2866 !! test
2867 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2868 !! options
2869 parsoid
2870 !! wikitext
2871 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2872 !! html
2873 <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>
2874 !! end
2875
2876 !! test
2877 Templates: Don't escape already nowiki-escaped text in template parameters
2878 !! options
2879 parsoid=html2wt,wt2wt
2880 !! wikitext
2881 {{echo|foo<nowiki>|</nowiki>bar}}
2882 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2883 {{echo|<nowiki></nowiki>}}
2884 !! html/php+tidy
2885 <p>foo|bar &lt;div&gt;</p>
2886 !! html/parsoid
2887 <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>
2888 <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>
2889 <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>
2890 </p>
2891 !! end
2892
2893 ## Bug 52824
2894 !! test
2895 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2896 !! options
2897 parsoid=html2wt,wt2wt
2898 !! wikitext
2899 {{echo|{{echo|1=bar}}}}
2900 !! html/php+tidy
2901 <p>bar</p>
2902 !! html/parsoid
2903 <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>
2904 !! end
2905
2906 ## Bug 56733
2907 !! test
2908 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2909 !! wikitext
2910 {{echo|a : b}}
2911 !! html/php+tidy
2912 <p>a&#160;: b</p>
2913 !! html/parsoid
2914 <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>
2915 !! end
2916
2917 ## Bug T73412
2918 !! test
2919 Templates: Preserve blank parameter names
2920 !! wikitext
2921 {{echo|=foo}}
2922 !! html/php+tidy
2923 <p>{{{1}}}</p>
2924 !! html/parsoid
2925 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2926 !! end
2927
2928 !! test
2929 Templates: Preserve blank parameter names in other positions
2930 !! wikitext
2931 {{blank_param|bar|=foo}}
2932 !! html/php+tidy
2933 <p>bar foo</p>
2934 !! html/parsoid
2935 <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
2936 foo</p>
2937 !! end
2938
2939 ###
2940 ### Parsoid-centric tests for testing RT edge cases for pre
2941 ###
2942
2943 !!test
2944 1a. Indent-Pre and Comments
2945 !! wikitext
2946 a
2947 <!--a-->
2948 c
2949 !! html
2950 <pre>a
2951 </pre>
2952 <p>c
2953 </p>
2954 !!end
2955
2956 !!test
2957 1b. Indent-Pre and Comments
2958 !! wikitext
2959 a
2960 <!--a-->
2961 c
2962 !! html
2963 <pre>a
2964 </pre>
2965 <p>c
2966 </p>
2967 !!end
2968
2969 !!test
2970 1c. Indent-Pre and Comments
2971 !! wikitext
2972 <!--a--> a
2973
2974 <!--a--> a
2975 !! html
2976 <pre> a
2977 </pre>
2978 <pre> a
2979 </pre>
2980 !!end
2981
2982 !!test
2983 1d. Indent-Pre and Comments
2984 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2985 !! wikitext
2986 <!--a--> a
2987
2988 <!--b-->b
2989 !! html
2990 <pre>a
2991 </pre>
2992 <pre>b
2993 </pre>
2994 !!end
2995
2996 !!test
2997 2a. Indent-Pre and tables
2998 !! wikitext
2999 {|
3000 |-
3001 !h1!!h2
3002 |foo||bar
3003 |}
3004 !! html
3005 <table>
3006
3007 <tr>
3008 <th>h1</th>
3009 <th>h2
3010 </th>
3011 <td>foo</td>
3012 <td>bar
3013 </td></tr></table>
3014
3015 !!end
3016
3017 !!test
3018 2b. Indent-Pre and tables
3019 !! wikitext
3020 {|
3021 |-
3022 |foo
3023 |}
3024 !! html
3025 <table>
3026
3027 <tr>
3028 <td>foo
3029 </td></tr></table>
3030
3031 !!end
3032
3033 !!test
3034 2c. Indent-Pre and tables (bug 42252)
3035 !! wikitext
3036 {|
3037 |+ foo
3038 ! | bar
3039 |}
3040 !! html
3041 <table>
3042 <caption> foo
3043 </caption>
3044 <tr>
3045 <th> bar
3046 </th></tr></table>
3047
3048 !!end
3049
3050 !!test
3051 2d. Indent-Pre and tables
3052 !! wikitext
3053 a
3054 {|
3055 | b
3056 |}
3057 !! html/php
3058 <pre>a
3059 </pre>
3060 <table>
3061 <tr>
3062 <td> b
3063 </td></tr></table>
3064
3065 !! html/parsoid
3066 <pre>a</pre>
3067 <table>
3068 <tbody><tr><td> b</td></tr>
3069 </tbody></table>
3070 !!end
3071
3072 !!test
3073 2e. Indent-Pre and table-line syntax
3074 !! wikitext
3075 a
3076 | b
3077 | c
3078 !! html/php
3079 <pre>a
3080 | b
3081 | c
3082 </pre>
3083 !!end
3084
3085 !!test
3086 2f. Indent-pre started by table-line syntax
3087 !! wikitext
3088 a
3089 | b
3090 | c
3091 !! html/php
3092 <p>a
3093 </p>
3094 <pre>| b
3095 | c
3096 </pre>
3097 !! html/parsoid
3098 <p>a</p>
3099 <pre>
3100 | b
3101 | c</pre>
3102 !!end
3103
3104 !! test
3105 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3106 !! wikitext
3107 <table>
3108 <tr>
3109 <td>
3110 Text that should be rendered preformatted
3111 </td>
3112 </tr>
3113 </table>
3114 !! html
3115 <table>
3116 <tr>
3117 <td>
3118 <pre>Text that should be rendered preformatted
3119 </pre>
3120 </td>
3121 </tr>
3122 </table>
3123
3124 !! end
3125
3126 !!test
3127 3a. Indent-Pre and block tags (single-line html)
3128 !! wikitext
3129 a <p> foo </p>
3130 b <div> foo </div>
3131 c <blockquote> foo </blockquote>
3132 <span> foo </span>
3133 !! html
3134 a <p> foo </p>
3135 b <div> foo </div>
3136 c <blockquote> foo </blockquote>
3137 <pre><span> foo </span>
3138 </pre>
3139 !! html/parsoid
3140 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3141 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3142 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3143 <pre><span> foo </span>
3144 </pre>
3145 !! html+tidy
3146 <p>a</p>
3147 <p>foo</p>
3148 <p>b</p>
3149 <div>foo</div>
3150 <p>c</p>
3151 <blockquote>
3152 <p>foo</p>
3153 </blockquote>
3154 <pre>
3155 <span> foo </span>
3156 </pre>
3157 !! end
3158
3159 !!test
3160 3b. Indent-Pre and block tags (multi-line html)
3161 !! wikitext
3162 a <span>foo</span>
3163 b <div> foo </div>
3164 !! html
3165 <pre>a <span>foo</span>
3166 </pre>
3167 b <div> foo </div>
3168
3169 !! html/parsoid
3170 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3171 b <div data-parsoid='{"stx":"html"}'> foo </div>
3172 !! html+tidy
3173 <pre>
3174 a <span>foo</span>
3175 </pre>
3176 <p>b</p>
3177 <div>foo</div>
3178 !!end
3179
3180 !!test
3181 3c. Indent-Pre and block tags (pre-content on separate line)
3182 !! wikitext
3183 <p>
3184 foo
3185 </p>
3186
3187 <div>
3188 foo
3189 </div>
3190
3191 <center>
3192 foo
3193 </center>
3194
3195 <blockquote>
3196 foo
3197 </blockquote>
3198
3199 <blockquote>
3200 <pre>
3201 foo
3202 </pre>
3203 </blockquote>
3204
3205 <table><tr><td>
3206 foo
3207 </td></tr></table>
3208
3209 <ul><li>
3210 foo
3211 </li></ul>
3212
3213 !! html
3214 <p>
3215 foo
3216 </p>
3217 <div>
3218 <pre>foo
3219 </pre>
3220 </div>
3221 <center>
3222 <pre>foo
3223 </pre>
3224 </center>
3225 <blockquote>
3226 <p> foo
3227 </p>
3228 </blockquote>
3229 <blockquote>
3230 <pre>
3231 foo
3232 </pre>
3233 </blockquote>
3234 <table><tr><td>
3235 <pre>foo
3236 </pre>
3237 </td></tr></table>
3238 <ul><li>
3239 foo
3240 </li></ul>
3241
3242 !!end
3243
3244 !! test
3245 4. Indent-Pre and extension tags
3246 !! wikitext
3247 a <tag />
3248 !! html/php
3249 a <pre>
3250 NULL
3251 array (
3252 )
3253 </pre>
3254
3255 !! html/parsoid
3256 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3257 !! end
3258
3259 !!test
3260 Render paragraphs when indent-pre is suppressed in blocklevels
3261 !! wikitext
3262 <blockquote>
3263 foo
3264
3265 bar
3266 </blockquote>
3267 !! html
3268 <blockquote>
3269 <p> foo
3270 </p><p> bar
3271 </p>
3272 </blockquote>
3273
3274 !!end
3275
3276 !!test
3277 4. Multiple spaces at start-of-line
3278 !! wikitext
3279 <p> foo </p>
3280 foo
3281 {|
3282 |foo
3283 |}
3284 !! html
3285 <p> foo </p>
3286 <pre> foo
3287 </pre>
3288 <table>
3289 <tr>
3290 <td>foo
3291 </td></tr></table>
3292
3293 !!end
3294
3295 ## NOTE: the leading white-space chars on empty line are significant
3296 !! test
3297 5a. White-space in indent-pre
3298 !! wikitext
3299 a<br />
3300
3301 b
3302 !! html
3303 <pre>a<br />
3304
3305 b
3306 </pre>
3307 !! end
3308
3309 ## NOTE: the leading white-space chars on empty line are significant
3310 !! test
3311 5b. White-space in indent-pre
3312 !! wikitext
3313 a
3314
3315 b
3316
3317
3318 c
3319 !! html
3320 <pre>a
3321
3322 b
3323
3324
3325 c
3326 </pre>
3327 !! end
3328
3329 !! test
3330 5c. White-space in indent-pre
3331 !! wikitext
3332 ''a''
3333 ''b''
3334 ''c''
3335 !! html
3336 <pre><i>a</i>
3337 <i>b</i>
3338 <i>c</i>
3339 </pre>
3340 !! end
3341
3342 !! test
3343 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3344 !! wikitext
3345 a
3346
3347 <!-- continue -->
3348 b
3349
3350 c
3351
3352 d
3353 !! html
3354 <pre>a
3355
3356 b
3357 </pre>
3358 <pre>c
3359
3360 </pre>
3361 <p>d
3362 </p>
3363 !! end
3364
3365 !! test
3366 7a. Indent-pre and category links
3367 !! options
3368 parsoid=wt2html,wt2wt
3369 !! wikitext
3370 [[Category:foo]] <!-- No pre-wrapping -->
3371 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3372 !! html/php+tidy
3373 !! html/parsoid
3374 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3375 <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 -->
3376 !! end
3377
3378 ## We used to, but no longer wt2wt this test since the default serializer
3379 ## will normalize all categories to serialize on their own line.
3380 ## This wikitext usage is going to be fairly uncommon in production and
3381 ## selser will take care of preserving formatting in those scenarios.
3382 !! test
3383 7b. Indent-pre and category links
3384 !! options
3385 parsoid=wt2html
3386 !! wikitext
3387 [[Category:foo]] a
3388 [[Category:foo]] {{echo|b}}
3389 !! html/parsoid
3390 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3391 <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>
3392 !! end
3393
3394 !! test
3395 Indent-Pre: Newlines in comments shouldn't affect sol state
3396 !! wikitext
3397 a <!--
3398 foo
3399 --> b
3400 !! html/php+tidy
3401 <p>a b</p>
3402 !! html/parsoid
3403 <p>a <!--
3404 foo
3405 --> b</p>
3406 !! end
3407
3408 ###
3409 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3410 ###
3411
3412 !!test
3413 HTML-pre: 1. embedded newlines
3414 !! wikitext
3415 <pre>foo</pre>
3416
3417 <pre>
3418 foo
3419 </pre>
3420
3421 <pre>
3422
3423 foo
3424 </pre>
3425
3426 <pre>
3427
3428
3429 foo
3430 </pre>
3431 !! html/php+tidy
3432 <pre>
3433 foo
3434 </pre>
3435 <pre>
3436 foo
3437 </pre>
3438 <pre>
3439
3440 foo
3441 </pre>
3442 <pre>
3443
3444
3445 foo
3446 </pre>
3447 !! html/parsoid
3448 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3449
3450 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3451 foo
3452 </pre>
3453
3454 <pre data-parsoid='{"stx":"html"}'>
3455
3456 foo
3457 </pre>
3458
3459 <pre data-parsoid='{"stx":"html"}'>
3460
3461
3462 foo
3463 </pre>
3464 !!end
3465
3466 !! test
3467 HTML-pre: big spaces
3468 !! wikitext
3469 <pre>
3470
3471
3472
3473
3474 haha
3475
3476
3477
3478
3479 haha
3480
3481
3482
3483
3484 </pre>
3485 !! html/php+tidy
3486 <pre>
3487
3488
3489
3490
3491 haha
3492
3493
3494
3495
3496 haha
3497
3498
3499
3500
3501 </pre>
3502 !! html/parsoid
3503 <pre data-parsoid='{"stx":"html"}'>
3504
3505
3506
3507
3508 haha
3509
3510
3511
3512
3513 haha
3514
3515
3516
3517
3518 </pre>
3519 !! end
3520
3521 !!test
3522 HTML-pre: 2: indented text
3523 !! wikitext
3524 <pre>
3525 foo
3526 </pre>
3527 !! html
3528 <pre>
3529 foo
3530 </pre>
3531
3532 !!end
3533
3534 !!test
3535 HTML-pre: 3: other wikitext
3536 !! wikitext
3537 <pre>
3538 * foo
3539 # bar
3540 = no-h =
3541 '' no-italic ''
3542 [[ NoLink ]]
3543 </pre>
3544 !! html/php
3545 <pre>
3546 * foo
3547 # bar
3548 = no-h =
3549 '' no-italic ''
3550 [[ NoLink ]]
3551 </pre>
3552
3553 !! html/parsoid
3554 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3555 # bar
3556 = no-h =
3557 '' no-italic ''
3558 [[ NoLink ]]
3559 </pre>
3560 !!end
3561
3562 ###
3563 ### Definition lists
3564 ###
3565 !! test
3566 Simple definition
3567 !! wikitext
3568 ; name : Definition
3569 !! html
3570 <dl><dt> name&#160;</dt>
3571 <dd> Definition</dd></dl>
3572
3573 !! end
3574
3575 !! test
3576 Definition list for indentation only
3577 !! wikitext
3578 : Indented text
3579 !! html
3580 <dl><dd> Indented text</dd></dl>
3581
3582 !! end
3583
3584 !! test
3585 Definition list with no space
3586 !! wikitext
3587 ;name:Definition
3588 !! html
3589 <dl><dt>name</dt>
3590 <dd>Definition</dd></dl>
3591
3592 !!end
3593
3594 !! test
3595 Definition list with URL link
3596 !! wikitext
3597 ; http://example.com/ : definition
3598 !! html
3599 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3600 <dd> definition</dd></dl>
3601
3602 !! end
3603
3604 !! test
3605 Definition list with bracketed URL link
3606 !! wikitext
3607 ;[http://www.example.com/ Example]:Something about it
3608 !! html
3609 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3610 <dd>Something about it</dd></dl>
3611
3612 !! end
3613
3614 !! test
3615 Definition list with wikilink containing colon
3616 !! wikitext
3617 ; [[Help:FAQ]]: The least-read page on Wikipedia
3618 !! html
3619 <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>
3620 <dd> The least-read page on Wikipedia</dd></dl>
3621
3622 !! end
3623
3624 # At Brion's and JeLuF's insistence... :)
3625 !! test
3626 Definition list with news link containing colon
3627 !! wikitext
3628 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3629 !! html/php
3630 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3631 <dd> This isn't even a real newsgroup!</dd></dl>
3632
3633 !! html/parsoid
3634 <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>
3635 !! end
3636
3637 !! test
3638 Malformed definition list with colon
3639 !! wikitext
3640 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3641 !! html
3642 <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>
3643
3644 !! end
3645
3646 !! test
3647 Definition lists: colon in external link text
3648 !! wikitext
3649 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3650 !! html
3651 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3652 <dd> OK, I made that up</dd></dl>
3653
3654 !! end
3655
3656 !! test
3657 Definition lists: colon in HTML attribute
3658 !! wikitext
3659 ;<b style="display: inline">bold</b>
3660 !! html
3661 <dl><dt><b style="display: inline">bold</b></dt></dl>
3662
3663 !! end
3664
3665 !! test
3666 Definition lists: self-closed tag
3667 !! wikitext
3668 ;one<br/>two : two-line fun
3669 !! html
3670 <dl><dt>one<br />two&#160;</dt>
3671 <dd> two-line fun</dd></dl>
3672
3673 !! end
3674
3675 !! test
3676 Bug 11748: Literal closing tags
3677 !! wikitext
3678 <dl>
3679 <dt>test 1</dt>
3680 <dd>test test test test test</dd>
3681 <dt>test 2</dt>
3682 <dd>test test test test test</dd>
3683 </dl>
3684 !! html
3685 <dl>
3686 <dt>test 1</dt>
3687 <dd>test test test test test</dd>
3688 <dt>test 2</dt>
3689 <dd>test test test test test</dd>
3690 </dl>
3691
3692 !! end
3693
3694 !! test
3695 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3696 !! wikitext
3697 <ul><li>
3698 ; term : description
3699 * unordered
3700 </li></ul>
3701 !! html
3702 <ul><li>
3703 <dl><dt> term&#160;</dt>
3704 <dd> description</dd></dl>
3705 <ul><li> unordered</li></ul>
3706 </li></ul>
3707
3708 !! end
3709
3710 !! test
3711 Definition list with empty definition and following paragraph
3712 !! wikitext
3713 ; term:
3714 Paragraph text
3715 !! html
3716 <dl><dt> term</dt>
3717 <dd></dd></dl>
3718 <p>Paragraph text
3719 </p>
3720 !! end
3721
3722 !! test
3723 Nested definition lists using html syntax
3724 !! wikitext
3725 <dl><dt>x</dt>
3726 <dd>a</dd>
3727 <dd>b</dd></dl>
3728 !! html
3729 <dl><dt>x</dt>
3730 <dd>a</dd>
3731 <dd>b</dd></dl>
3732
3733 !! end
3734
3735 !! test
3736 Definition Lists: No nesting: Multiple dd's
3737 !! wikitext
3738 ;x
3739 :a
3740 :b
3741 !! html
3742 <dl><dt>x</dt>
3743 <dd>a</dd>
3744 <dd>b</dd></dl>
3745
3746 !! end
3747
3748 !! test
3749 Definition Lists: Indentation: Regular
3750 !! wikitext
3751 :i1
3752 ::i2
3753 :::i3
3754 !! html
3755 <dl><dd>i1
3756 <dl><dd>i2
3757 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3758
3759 !! end
3760
3761 !! test
3762 Definition Lists: Indentation: Missing 1st level
3763 !! wikitext
3764 ::i2
3765 :::i3
3766 !! html
3767 <dl><dd><dl><dd>i2
3768 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3769
3770 !! end
3771
3772 !! test
3773 Definition Lists: Indentation: Multi-level indent
3774 !! wikitext
3775 :::i3
3776 !! html
3777 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3778
3779 !! end
3780
3781 !! test
3782 Definition Lists: Hacky use to indent tables
3783 !! wikitext
3784 ::{|
3785 |foo
3786 |bar
3787 |}
3788 this text
3789 should be left alone
3790 !! html
3791 <dl><dd><dl><dd><table>
3792 <tr>
3793 <td>foo
3794 </td>
3795 <td>bar
3796 </td></tr></table></dd></dl></dd></dl>
3797 <p>this text
3798 should be left alone
3799 </p>
3800 !! end
3801
3802 !! test
3803 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3804 !! wikitext
3805 <!-- foo -->
3806 ::{|
3807 |foo
3808 |bar
3809 |}<!-- bar -->
3810 this text
3811 should be left alone
3812 !! html/parsoid
3813 <!-- foo -->
3814 <dl><dd><dl><dd><table><tr>
3815 <td>foo</td>
3816 <td>bar</td>
3817 </tr></table><!-- bar --></dd></dl></dd></dl>
3818 <p>this text
3819 should be left alone</p>
3820 !! end
3821
3822 !! test
3823 Definition Lists: Hacky use to indent tables, with comment before table
3824 !! wikitext
3825 ::<!-- foo -->{|
3826 |foo
3827 |}
3828 !! html/parsoid
3829 <dl><dd><dl><dd><!-- foo --><table><tr>
3830 <td>foo</td>
3831 </tr></table></dd></dl></dd></dl>
3832 !! end
3833
3834 # The trailing whitespace in this test is to catch a regression in
3835 # Parsoid after T54473.
3836 !! test
3837 Definition Lists: Hacky use to indent tables (WS-insensitive)
3838 !! wikitext
3839 : {|
3840 |a
3841 |}
3842 !! html/php
3843 <dl><dd><table>
3844 <tr>
3845 <td>a
3846 </td></tr></table></dd></dl>
3847
3848 !! html/parsoid
3849 <dl><dd> <table>
3850 <tbody><tr><td>a</td></tr>
3851 </tbody></table> </dd></dl>
3852 !! end
3853
3854 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3855 ## as an empty dt item. It also ignores all but the last ";" when followed
3856 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3857 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3858 ## ";"s.
3859 ##
3860 ## Ex: ";;t2 ::d2" is transformed into:
3861 ##
3862 ## <dl>
3863 ## <dt>t2 </dt>
3864 ## <dd>
3865 ## <dl>
3866 ## <dt></dt>
3867 ## <dd>d2</dd>
3868 ## </dl>
3869 ## </dd>
3870 ## </dl>
3871 ##
3872 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3873 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3874 ##
3875 ## <dl>
3876 ## <dt>
3877 ## <dl>
3878 ## <dt>t2 </dt>
3879 ## <dd>:d2</dd>
3880 ## </dl>
3881 ## </dt>
3882 ## </dl>
3883 ##
3884 ## All Parsoid only definition list tests have this difference.
3885 ##
3886 ## See also: https://phabricator.wikimedia.org/T8569
3887 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3888
3889 !! test
3890 Table / list interaction: indented table with lists in table contents
3891 !! wikitext
3892 :{|
3893 |-
3894 | a
3895 * b
3896 |-
3897 | c
3898 * d
3899 |}
3900 !! html
3901 <dl><dd><table>
3902
3903 <tr>
3904 <td> a
3905 <ul><li> b</li></ul>
3906 </td></tr>
3907 <tr>
3908 <td> c
3909 <ul><li> d</li></ul>
3910 </td></tr></table></dd></dl>
3911
3912 !! end
3913
3914 !!test
3915 Table / list interaction: lists nested in tables nested in indented lists
3916 !! wikitext
3917 :{|
3918 |
3919 :a
3920 :b
3921 |
3922 *c
3923 *d
3924 |}
3925
3926 *e
3927 *f
3928 !! html
3929 <dl><dd><table>
3930 <tr>
3931 <td>
3932 <dl><dd>a</dd>
3933 <dd>b</dd></dl>
3934 </td>
3935 <td>
3936 <ul><li>c</li>
3937 <li>d</li></ul>
3938 </td></tr></table></dd></dl>
3939 <ul><li>e</li>
3940 <li>f</li></ul>
3941
3942 !!end
3943
3944 !! test
3945 Definition Lists: Nesting: Multi-level (Parsoid only)
3946 !! options
3947 parsoid
3948 !! wikitext
3949 ;t1 :d1
3950 ;;t2 ::d2
3951 ;;;t3 :::d3
3952 !! html
3953 <dl>
3954 <dt>t1 </dt>
3955 <dd>d1</dd>
3956 <dt>
3957 <dl>
3958 <dt>t2 </dt>
3959 <dd>:d2</dd>
3960 <dt>
3961 <dl>
3962 <dt>t3 </dt>
3963 <dd>::d3</dd>
3964 </dl>
3965 </dt>
3966 </dl>
3967 </dt>
3968 </dl>
3969
3970
3971 !! end
3972
3973
3974 !! test
3975 Definition Lists: Nesting: Test 2 (Parsoid only)
3976 !! wikitext
3977 ;t1
3978 ::d2
3979 !! html/php+tidy
3980 <dl>
3981 <dt>t1</dt>
3982 <dd>
3983 <dl>
3984 <dd>d2</dd>
3985 </dl>
3986 </dd>
3987 </dl>
3988 !! html/parsoid
3989 <dl>
3990 <dt>t1</dt>
3991 <dd>
3992 <dl>
3993 <dd>d2</dd>
3994 </dl>
3995 </dd>
3996 </dl>
3997
3998 !! end
3999
4000
4001 !! test
4002 Definition Lists: Nesting: Test 3 (Parsoid only)
4003 !! wikitext
4004 :;t1
4005 ::::d2
4006 !! html/php+tidy
4007 <dl>
4008 <dd>
4009 <dl>
4010 <dt>t1</dt>
4011 <dd>
4012 <dl>
4013 <dd>
4014 <dl>
4015 <dd>d2</dd>
4016 </dl>
4017 </dd>
4018 </dl>
4019 </dd>
4020 </dl>
4021 </dd>
4022 </dl>
4023 !! html/parsoid
4024 <dl>
4025 <dd>
4026 <dl>
4027 <dt>t1</dt>
4028 <dd>
4029 <dl>
4030 <dd>
4031 <dl>
4032 <dd>d2</dd>
4033 </dl>
4034 </dd>
4035 </dl>
4036 </dd>
4037 </dl>
4038 </dd>
4039 </dl>
4040
4041 !! end
4042
4043
4044 !! test
4045 Definition Lists: Nesting: Test 4
4046 !! wikitext
4047 ::;t3
4048 :::d3
4049 !! html
4050 <dl><dd><dl><dd><dl><dt>t3</dt>
4051 <dd>d3</dd></dl></dd></dl></dd></dl>
4052
4053 !! end
4054
4055
4056 ## The Parsoid team believes the following three test exposes a
4057 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4058 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4059 ## It also exposes a "misfeature" in tidy, which doesn't like
4060 ## <dl> tags with a single <dt> child; it converts the <dt> into
4061 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4062 !! test
4063 Definition Lists: Mixed Lists: Test 1
4064 !! wikitext
4065 :;* foo
4066 ::* bar
4067 :; baz
4068 !! html/php
4069 <dl><dd><dl><dt><ul><li> foo</li>
4070 <li> bar</li></ul></dt></dl>
4071 <dl><dt> baz</dt></dl></dd></dl>
4072
4073 !! html/php+tidy
4074 <dl>
4075 <dd>
4076 <dl>
4077 <dd>
4078 <ul>
4079 <li>foo</li>
4080 <li>bar</li>
4081 </ul>
4082 </dd>
4083 </dl>
4084 <dl>
4085 <dt>baz</dt>
4086 </dl>
4087 </dd>
4088 </dl>
4089 !! html/parsoid
4090 <dl>
4091 <dd><dl>
4092 <dt><ul>
4093 <li> foo
4094 </li>
4095 </ul></dt>
4096 <dd><ul>
4097 <li> bar
4098 </li>
4099 </ul></dd>
4100 <dt> baz</dt>
4101 </dl></dd>
4102 </dl>
4103 !! end
4104
4105 !! test
4106 Definition Lists: Mixed Lists: Test 2
4107 !! wikitext
4108 *: d1
4109 *: d2
4110 !! html
4111 <ul><li><dl><dd> d1</dd>
4112 <dd> d2</dd></dl></li></ul>
4113
4114 !! end
4115
4116
4117 !! test
4118 Definition Lists: Mixed Lists: Test 3
4119 !! wikitext
4120 *::: d1
4121 *::: d2
4122 !! html
4123 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4124 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4125
4126 !! end
4127
4128
4129 !! test
4130 Definition Lists: Mixed Lists: Test 4
4131 !! wikitext
4132 *;d1 :d2
4133 *;d3 :d4
4134 !! html
4135 <ul><li><dl><dt>d1&#160;</dt>
4136 <dd>d2</dd>
4137 <dt>d3&#160;</dt>
4138 <dd>d4</dd></dl></li></ul>
4139
4140 !! end
4141
4142
4143 !! test
4144 Definition Lists: Mixed Lists: Test 5
4145 !! wikitext
4146 *:d1
4147 *:: d2
4148 !! html
4149 <ul><li><dl><dd>d1
4150 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4151
4152 !! end
4153
4154
4155 !! test
4156 Definition Lists: Mixed Lists: Test 6
4157 !! wikitext
4158 #*:d1
4159 #*::: d3
4160 !! html
4161 <ol><li><ul><li><dl><dd>d1
4162 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4163
4164 !! end
4165
4166
4167 !! test
4168 Definition Lists: Mixed Lists: Test 7
4169 !! wikitext
4170 :* d1
4171 :* d2
4172 !! html
4173 <dl><dd><ul><li> d1</li>
4174 <li> d2</li></ul></dd></dl>
4175
4176 !! end
4177
4178
4179 !! test
4180 Definition Lists: Mixed Lists: Test 8
4181 !! wikitext
4182 :* d1
4183 ::* d2
4184 !! html
4185 <dl><dd><ul><li> d1</li></ul>
4186 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4187
4188 !! end
4189
4190
4191 !! test
4192 Definition Lists: Mixed Lists: Test 9
4193 !! wikitext
4194 *;foo :bar
4195 !! html
4196 <ul><li><dl><dt>foo&#160;</dt>
4197 <dd>bar</dd></dl></li></ul>
4198
4199 !! end
4200
4201
4202 !! test
4203 Definition Lists: Mixed Lists: Test 10
4204 !! wikitext
4205 *#;foo :bar
4206 !! html
4207 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4208 <dd>bar</dd></dl></li></ol></li></ul>
4209
4210 !! end
4211
4212 # The Parsoid team disagrees with the PHP parser's seemingly-random
4213 # rules regarding dd/dt on the next two tests. Parsoid is more
4214 # consistent, and recognizes the shared nesting and keeps the
4215 # still-open tags around until the nesting is complete.
4216 # (And tidy again converts <dt> to <dd> before 'bar'.)
4217
4218 !! test
4219 Definition Lists: Mixed Lists: Test 11
4220 !! wikitext
4221 *#*#;*;;foo :bar
4222 *#*#;boo :baz
4223 !! html/php
4224 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4225 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4226 <dl><dt>boo&#160;</dt>
4227 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4228
4229 !! html/php+tidy
4230 <ul>
4231 <li>
4232 <ol>
4233 <li>
4234 <ul>
4235 <li>
4236 <ol>
4237 <li>
4238 <dl>
4239 <dt>foo&#160;</dt>
4240 <dd>
4241 <ul>
4242 <li>
4243 <dl>
4244 <dd>
4245 <dl>
4246 <dt>bar</dt>
4247 </dl>
4248 </dd>
4249 </dl>
4250 </li>
4251 </ul>
4252 </dd>
4253 </dl>
4254 <dl>
4255 <dt>boo&#160;</dt>
4256 <dd>baz</dd>
4257 </dl>
4258 </li>
4259 </ol>
4260 </li>
4261 </ul>
4262 </li>
4263 </ol>
4264 </li>
4265 </ul>
4266 !! html/parsoid
4267 <ul>
4268 <li>
4269 <ol>
4270 <li>
4271 <ul>
4272 <li>
4273 <ol>
4274 <li>
4275 <dl>
4276 <dt>
4277 <ul>
4278 <li>
4279 <dl>
4280 <dt>
4281 <dl>
4282 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4283 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4284 </dl></dt>
4285 </dl></li>
4286 </ul></dt>
4287 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4288 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4289 </dl></li>
4290 </ol></li>
4291 </ul></li>
4292 </ol></li>
4293 </ul>
4294 !! end
4295
4296
4297 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4298 # From whitelist:
4299 # * The test is wrong, there are two colons where there should be :;
4300 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4301 !! test
4302 Definition Lists: Weird Ones: Test 1
4303 !! wikitext
4304 *#;*::;; foo : bar (who uses this?)
4305 !! html/php
4306 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4307 <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>
4308
4309 !! html/php+tidy
4310 <ul>
4311 <li>
4312 <ol>
4313 <li>
4314 <dl>
4315 <dt>foo&#160;</dt>
4316 <dd>
4317 <ul>
4318 <li>
4319 <dl>
4320 <dd>
4321 <dl>
4322 <dd>
4323 <dl>
4324 <dd>
4325 <dl>
4326 <dt>bar (who uses this?)</dt>
4327 </dl>
4328 </dd>
4329 </dl>
4330 </dd>
4331 </dl>
4332 </dd>
4333 </dl>
4334 </li>
4335 </ul>
4336 </dd>
4337 </dl>
4338 </li>
4339 </ol>
4340 </li>
4341 </ul>
4342 !! html/parsoid
4343 <ul>
4344 <li>
4345 <ol>
4346 <li>
4347 <dl>
4348 <dt>
4349 <ul>
4350 <li>
4351 <dl>
4352 <dd>
4353 <dl>
4354 <dd>
4355 <dl>
4356 <dt>
4357 <dl>
4358 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4359 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4360 </dl></dt>
4361 </dl></dd>
4362 </dl></dd>
4363 </dl></li>
4364 </ul></dt>
4365 </dl></li>
4366 </ol></li>
4367 </ul>
4368 !! end
4369
4370 !! test
4371 Definition Lists: colons occurring in tags
4372 !! wikitext
4373 ;a:b
4374 ;'''a:b'''
4375 ;<i>a:b</i>
4376 ;<span>a:b</span>
4377 ;<div>a:b</div>
4378 ;<div>a
4379 :b</div>
4380 ;{{echo|a:b}}
4381 ;{{echo|''a:b''}}
4382 ;;;''a:b''
4383 !! html+tidy
4384 <dl>
4385 <dt>a</dt>
4386 <dd>b</dd>
4387 <dt><b>a:b</b></dt>
4388 <dt><i>a:b</i></dt>
4389 <dt><span>a:b</span></dt>
4390 <dd>
4391 <div>a:b</div>
4392 </dd>
4393 <dd>
4394 <div>a
4395 <dl>
4396 <dd>b</dd>
4397 </dl>
4398 </div>
4399 </dd>
4400 <dt>a</dt>
4401 <dd>b</dd>
4402 <dt><i>a:b</i></dt>
4403 </dl>
4404 <dl>
4405 <dd>
4406 <dl>
4407 <dd>
4408 <dl>
4409 <dt><i>a:b</i></dt>
4410 </dl>
4411 </dd>
4412 </dl>
4413 </dd>
4414 </dl>
4415 !! html/parsoid
4416 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4417 <dt><b>a:b</b></dt>
4418 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4419 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4420 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4421 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4422 <dd>b</dd>
4423 <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>
4424 <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>
4425 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4426 !! end
4427
4428 !! test
4429 Definition Lists: colons and tables 1
4430 !! wikitext
4431 :{|
4432 | x
4433 |}
4434 :{|
4435 | y
4436 |}
4437 !! html
4438 <dl><dd><table>
4439 <tr>
4440 <td> x
4441 </td></tr></table></dd></dl>
4442 <dl><dd><table>
4443 <tr>
4444 <td> y
4445 </td></tr></table></dd></dl>
4446
4447 !! end
4448
4449 # Parsoid's output (as documented below) differs from php's in this case.
4450 # This is probably a bug. If we fixup parsoid to match php's output, the
4451 # above test should pass and the below test case can be removed. It is
4452 # unclear which output is more desirable.
4453
4454 !! test
4455 Definition Lists: colons and tables 2
4456 !! wikitext
4457 :{|
4458 | x
4459 |}
4460 :{|
4461 | y
4462 |}
4463 !! html/parsoid
4464 <dl><dd><table>
4465 <tr>
4466 <td> x
4467 </td></tr></table></dd>
4468 <dd><table>
4469 <tr>
4470 <td> y
4471 </td></tr></table></dd></dl>
4472 !! end
4473
4474 !! test
4475 Definition Lists: template interaction
4476 !! wikitext
4477 ::{{definition_list}}
4478
4479 :one
4480 ::{{definition_list}}
4481 :::two
4482 :::three
4483 ::four
4484 !! html/parsoid
4485 <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">
4486 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4487
4488 <dl><dd data-parsoid='{}'>one
4489 <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">
4490 </span><dd about="#mwt2">two
4491 <dl><dd>two</dd>
4492 <dd>three</dd></dl></dd>
4493 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4494 !! end
4495
4496
4497 ###
4498 ### External links
4499 ###
4500 !! test
4501 External links: non-bracketed
4502 !! wikitext
4503 Non-bracketed: http://example.com
4504 !! html
4505 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4506 </p>
4507 !! end
4508
4509 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4510 !! test
4511 External links: numbered
4512 !! wikitext
4513 Numbered: [http://example.com]
4514 Numbered: [http://example.net]
4515 Numbered: [http://example.com]
4516 !! html/php
4517 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4518 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4519 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4520 </p>
4521 !! html/parsoid
4522 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4523 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4524 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4525 !!end
4526
4527 !! test
4528 External links: specified text
4529 !! wikitext
4530 Specified text: [http://example.com link]
4531 !! html
4532 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4533 </p>
4534 !!end
4535
4536 !! test
4537 External links: trail
4538 !! wikitext
4539 Linktrails should not work for external links: [http://example.com link]s
4540 !! html
4541 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4542 </p>
4543 !! end
4544
4545 !! test
4546 External links: dollar sign in URL
4547 !! wikitext
4548 http://example.com/1$2345
4549 !! html
4550 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4551 </p>
4552 !! end
4553
4554 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4555 !! test
4556 External links: dollar sign in URL (autonumber)
4557 !! wikitext
4558 [http://example.com/1$2345]
4559 !! html/php
4560 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4561 </p>
4562 !! html/parsoid
4563 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4564 !!end
4565
4566 !! test
4567 External links: open square bracket forbidden in URL (bug 4377)
4568 !! options
4569 parsoid=wt2html,wt2wt,html2html
4570 !! wikitext
4571 http://example.com/1[2345
4572 !! html/php
4573 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4574 </p>
4575 !! html/parsoid
4576 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4577 !! end
4578
4579 !! test
4580 External links: open square bracket forbidden in URL (named) (bug 4377)
4581 !! options
4582 parsoid=wt2html,html2html
4583 !! wikitext
4584 [http://example.com/1[2345]
4585 !! html/php
4586 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4587 </p>
4588 !! html/parsoid
4589 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4590 !!end
4591
4592 # parsoid adds a space before the link name
4593 !! test
4594 External links: open square bracket forbidden in URL (named) (bug 4377)
4595 Parsoid variant.
4596 !! wikitext
4597 [http://example.com/1 [2345]
4598 !! html
4599 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4600 </p>
4601 !!end
4602
4603 !! test
4604 External links: nowiki in URL link text (bug 6230)
4605 !! wikitext
4606 [http://example.com/ <nowiki>''example site''</nowiki>]
4607 !! html
4608 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4609 </p>
4610 !! end
4611
4612 !! test
4613 External links: newline forbidden in text (bug 6230 regression check)
4614 !! wikitext
4615 [http://example.com/ first
4616 second]
4617 !! html
4618 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4619 second]
4620 </p>
4621 !!end
4622
4623 !! test
4624 External links: Pipe char between url and text
4625 !! wikitext
4626 [http://example.com | link]
4627 !! html
4628 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4629 </p>
4630 !!end
4631
4632 !! test
4633 External links: protocol-relative URL in brackets
4634 !! wikitext
4635 [//example.com/ Test]
4636 !! html
4637 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4638 </p>
4639 !! end
4640
4641 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4642 !! test
4643 External links: protocol-relative URL in brackets without text
4644 !! wikitext
4645 [//example.com]
4646 !! html/php
4647 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4648 </p>
4649 !! html/parsoid
4650 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4651 !! end
4652
4653 !! test
4654 External links: protocol-relative URL in free text is left alone
4655 !! wikitext
4656 //example.com/Foo
4657 !! html
4658 <p>//example.com/Foo
4659 </p>
4660 !!end
4661
4662 !! test
4663 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4664 !! wikitext
4665 foo//example.com/Foo
4666 !! html
4667 <p>foo//example.com/Foo
4668 </p>
4669 !! end
4670
4671 !! test
4672 External links: with no contents
4673 !! wikitext
4674 [http://en.wikipedia.org/wiki/Foo]
4675
4676 [[wikipedia:Foo|Bar]]
4677
4678 [[wikipedia:Foo|<span>Bar</span>]]
4679 !! html/php
4680 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4681 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4682 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4683 </p>
4684 !! html/parsoid
4685 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4686 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4687 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4688 !! end
4689
4690 !! test
4691 External links: Free with trailing punctuation
4692 !! wikitext
4693 http://example.com,
4694 http://example.com;
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/url_with_(brackets)
4702 (http://example.com/url_without_brackets)
4703 http://example.com/url_with_entity&amp;
4704 http://example.com/url_with_entity&#x26;
4705 http://example.com/url_with_entity&#038;
4706 http://example.com/url_with_entity&nbsp;
4707 http://example.com/url_with_entity&#xA0;
4708 http://example.com/url_with_entity&#160;
4709 http://example.com/url_with_entity&lt;
4710 http://example.com/url_with_entity&#x3C;
4711 http://example.com/url_with_entity&#60;
4712 !! html/php
4713 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4714 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4715 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4722 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4723 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4724 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</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">http://example.com/url_with_entity</a>&#160;
4727 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
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>&lt;
4730 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4731 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4732 </p>
4733 !! html/parsoid
4734 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4735 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4736 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4743 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4744 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4745 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</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">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4748 <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>
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;#160;","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;lt;","srcContent":"&lt;"}'>&lt;</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;#x3C;","srcContent":"&lt;"}'>&lt;</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;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4753 !! end
4754
4755 !! test
4756 External links: tricky Parsoid html2html case
4757 !! options
4758 parsoid=wt2html,wt2wt,html2html
4759 !! wikitext
4760 http://example.com/url_with_entity&amp;amp;
4761 !! html/php
4762 <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>;
4763 </p>
4764 !! html/parsoid
4765 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4766 !! end
4767
4768 !! test
4769 External links: Free with trailing quotes (T113666)
4770 !! wikitext
4771 '''News:''' Stuff here
4772
4773 news:'a'b''c''d e
4774 !! html/php
4775 <p><b>News:</b> Stuff here
4776 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4777 </p>
4778 !! html/parsoid
4779 <p><b>News:</b> Stuff here</p>
4780 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4781 !! end
4782
4783 !! test
4784 External links: Lone protocols are never linked (T105697)
4785 !! wikitext
4786 http://
4787 http://;
4788 (http://)
4789 bitcoin:
4790 bitcoin:;
4791 (bitcoin:)
4792 !! html
4793 <p>http://
4794 http://;
4795 (http://)
4796 bitcoin:
4797 bitcoin:;
4798 (bitcoin:)
4799 </p>
4800 !! end
4801
4802 !! test
4803 External links: No preceding word characters allowed (bug 65278)
4804 !! wikitext
4805 NOPEhttp://example.com
4806 N0http://example.com
4807 ok:http://example.com
4808 ok-http://example.com
4809 !! html
4810 <p>NOPEhttp://example.com
4811 N0http://example.com
4812 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4813 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4814 </p>
4815 !! end
4816
4817 !! test
4818 External links: nofollow domain exception
4819 !! wikitext
4820 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4821 !! html
4822 <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>.
4823 </p>
4824 !!end
4825
4826 !! test
4827 External image
4828 !! wikitext
4829 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4830 !! html
4831 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External image from https
4837 !! wikitext
4838 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4839 !! html
4840 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4841 </p>
4842 !! end
4843
4844 !! test
4845 External image (when not allowed)
4846 !! options
4847 wgAllowExternalImages=0
4848 !! wikitext
4849 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4850 !! html
4851 <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>
4852 </p>
4853 !! end
4854
4855 !! test
4856 Link to non-http image, no img tag
4857 !! wikitext
4858 Link to non-http image, no img tag: ftp://example.com/test.jpg
4859 !! html
4860 <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>
4861 </p>
4862 !! end
4863
4864 !! test
4865 External links: terminating separator
4866 !! wikitext
4867 Terminating separator: http://example.com/thing,
4868 !! html
4869 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4870 </p>
4871 !! end
4872
4873 !! test
4874 External links: intervening separator
4875 !! wikitext
4876 Intervening separator: http://example.com/1,2,3
4877 !! html
4878 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4879 </p>
4880 !! end
4881
4882 !! test
4883 External links: old bug with URL in query
4884 !! wikitext
4885 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4886 !! html
4887 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4888 </p>
4889 !! end
4890
4891 !! test
4892 External links: old URL-in-URL bug, mixed protocols
4893 !! wikitext
4894 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4895 !! html
4896 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4897 </p>
4898 !!end
4899
4900 # Since Parsoid is starting to emit canonical wikitext for links,
4901 # [http://example.com http://example.com] will not RT back to that
4902 # form anymore.
4903 !! test
4904 External links: URL in text
4905 !! options
4906 parsoid=wt2html
4907 !! wikitext
4908 URL in text: [http://example.com http://example.com]
4909 !! html/php
4910 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4911 </p>
4912 !! html/parsoid
4913 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4914 !! end
4915
4916 !! test
4917 External links: Clickable images
4918 !! wikitext
4919 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4920 !! html/php
4921 <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>
4922 </p>
4923 !! html/parsoid
4924 <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>
4925 !! end
4926
4927 !! test
4928 External links: raw ampersand
4929 !! wikitext
4930 Old &amp; use: http://x&y
4931 !! html
4932 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4933 </p>
4934 !! end
4935
4936 !! test
4937 External links: encoded ampersand
4938 !! wikitext
4939 Old &amp; use: http://x&amp;y
4940 !! html/php
4941 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4942 </p>
4943 !! html/parsoid
4944 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4945 !! end
4946
4947 !! test
4948 External links: encoded equals (bug 6102)
4949 !! wikitext
4950 http://example.com/?foo&#61;bar
4951 !! html/php
4952 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4953 </p>
4954 !! html/parsoid
4955 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4956 !! end
4957
4958 ##
4959 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4960 ## does it number them. As discussed in bug 53505, we can identify
4961 ## autonumbered links via CSS.
4962 ##
4963
4964 !! test
4965 External links: [raw ampersand]
4966 !! wikitext
4967 Old &amp; use: [http://x&y]
4968 !! html/php
4969 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4970 </p>
4971 !! html/parsoid
4972 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4973 !! end
4974
4975 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4976 # mode will return the [raw ampersand] wikitext
4977 !! test
4978 External links: [encoded ampersand]
4979 !! options
4980 parsoid=wt2html,wt2wt,html2html
4981 !! wikitext
4982 Old &amp; use: [http://x&amp;y]
4983 !! html/php
4984 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4985 </p>
4986 !! html/parsoid
4987 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4988 !! end
4989
4990 !! test
4991 External links: [raw equals]
4992 !! wikitext
4993 [http://example.com/?foo=bar]
4994 !! html/php
4995 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4996 </p>
4997 !! html/parsoid
4998 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4999 !! end
5000
5001 # note that parsoid html is identical to [raw equals] case; so html2wt
5002 # mode will return the [raw equals] wikitext
5003 !! test
5004 External links: [encoded equals] (bug 6102)
5005 !! options
5006 parsoid=wt2html,wt2wt,html2html
5007 !! wikitext
5008 [http://example.com/?foo&#61;bar]
5009 !! html/php
5010 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5011 </p>
5012 !! html/parsoid
5013 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5014 !! end
5015
5016 # xxx parsoid strips the IDN character, so the round-trip tests will
5017 # obviously fail and are disabled. --cscott
5018 !! test
5019 External links: [IDN ignored character reference in hostname; strip it right off]
5020 !! options
5021 parsoid=wt2html,wt2wt,html2html
5022 !! wikitext
5023 [http://e&zwnj;xample.com/]
5024 !! html/php
5025 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5026 </p>
5027 !! html/parsoid
5028 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5029 !! end
5030
5031 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5032 # Where an external link could easily circumvent the sanitization of the text of
5033 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5034 # test demands a higher standard. That's a bit strange.
5035 #
5036 # Example:
5037 #
5038 # http://e‌xample.com -> [http://example.com|http://example.com]
5039 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5040 #
5041 # The first example is sanitized, but the second is not. Any security benefits
5042 # from this production are trivial to circumvent. Either remove this test and
5043 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5044 # the test accordingly.
5045 #
5046 # All our love,
5047 # The Parsoid team.
5048 # xxx parsoid strips the IDN character, so the round-trip tests will
5049 # obviously fail and are disabled. --cscott
5050 !! test
5051 External links: IDN ignored character reference in hostname; strip it right off
5052 !! options
5053 parsoid=wt2html,html2html
5054 !! wikitext
5055 http://e&zwnj;xample.com/
5056 !! html/php
5057 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5058 </p>
5059 !! html/parsoid
5060 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5061 !! end
5062
5063 !! test
5064 External links: www.jpeg.org (bug 554)
5065 !! wikitext
5066 http://www.jpeg.org
5067 !! html
5068 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5069 </p>
5070 !! end
5071
5072 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5073 !! test
5074 External links: URL within URL (original bug 2)
5075 !! wikitext
5076 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5077 !! html/php
5078 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5079 </p>
5080 !! html/parsoid
5081 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5082 !! end
5083
5084 !! test
5085 BUG 361: URL inside bracketed URL
5086 !! wikitext
5087 [http://www.example.com/foo http://www.example.com/bar]
5088 !! html
5089 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5090 </p>
5091 !! end
5092
5093 !! test
5094 BUG 361: URL within URL, not bracketed
5095 !! wikitext
5096 http://www.example.com/foo?=http://www.example.com/bar
5097 !! html
5098 <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>
5099 </p>
5100 !! end
5101
5102 !! test
5103 BUG 289: ">"-token in URL-tail
5104 !! wikitext
5105 http://www.example.com/<hello>
5106 !! html
5107 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5108 </p>
5109 !!end
5110
5111 !! test
5112 BUG 289: literal ">"-token in URL-tail
5113 !! wikitext
5114 http://www.example.com/<b>html</b>
5115 !! html/php
5116 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5117 </p>
5118 !! html/parsoid
5119 <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>
5120 !! end
5121
5122 !! test
5123 BUG 289: ">"-token in bracketed URL
5124 !! wikitext
5125 [http://www.example.com/<hello> stuff]
5126 !! html
5127 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5128 </p>
5129 !!end
5130
5131 !! test
5132 BUG 289: literal ">"-token in bracketed URL
5133 !! wikitext
5134 [http://www.example.com/<b>html</b> stuff]
5135 !! html
5136 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5137 </p>
5138 !!end
5139
5140 !! test
5141 BUG 289: literal double quote at end of URL
5142 !! wikitext
5143 http://www.example.com/"hello"
5144 !! html
5145 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5146 </p>
5147 !!end
5148
5149 !! test
5150 BUG 289: literal double quote in bracketed URL
5151 !! wikitext
5152 [http://www.example.com/"hello" stuff]
5153 !! html
5154 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5155 </p>
5156 !!end
5157
5158 !! test
5159 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5160 !! wikitext
5161 [http://www.example.com test]
5162 !! html
5163 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5164 </p>
5165 !! end
5166
5167 !! test
5168 External links: link text with spaces
5169 !! wikitext
5170 [http://www.example.com a b c]
5171 [http://www.example.com ''a'' ''b'']
5172 !! html
5173 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5174 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5175 </p>
5176 !! end
5177
5178 !! test
5179 External links: wiki links within external link (Bug 3695)
5180 !! options
5181 parsoid=wt2html,html2html
5182 !! wikitext
5183 [http://example.com [[wikilink]] embedded in ext link]
5184 !! html/php
5185 <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>
5186 </p>
5187 !! html/parsoid
5188 <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>
5189 !! end
5190
5191 !! test
5192 BUG 787: Links with one slash after the url protocol are invalid
5193 !! wikitext
5194 http:/example.com
5195
5196 [http:/example.com title]
5197 !! html
5198 <p>http:/example.com
5199 </p><p>[http:/example.com title]
5200 </p>
5201 !! end
5202
5203 !! test
5204 Bracketed external links with template-generated invalid target
5205 !! wikitext
5206 [{{echo|http:/example.com}} title]
5207 !! html
5208 <p>[http:/example.com title]
5209 </p>
5210 !! end
5211
5212 !! test
5213 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5214 !! wikitext
5215 ''[http://example.com text'']
5216 [http://example.com '''text]'''
5217 ''Something [http://example.com in italic'']
5218 ''Something [http://example.com mixed''''', even bold]'''
5219 '''''Now [http://example.com both''''']
5220 !! html
5221 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5222 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5223 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5224 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5225 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5226 </p>
5227 !! end
5228
5229
5230 !! test
5231 Bug 4781: %26 in URL
5232 !! wikitext
5233 http://www.example.com/?title=AT%26T
5234 !! html/php
5235 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5236 </p>
5237 !! html/parsoid
5238 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5239 !! end
5240
5241 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5242 # % is actually legal in HTML5. Any change in output would need testing though.
5243 !! test
5244 Bug 4781, 5267: %25 in URL
5245 !! wikitext
5246 http://www.example.com/?title=100%25_Bran
5247 !! html/php
5248 <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>
5249 </p>
5250 !! html/parsoid
5251 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5252 !! end
5253
5254 !! test
5255 Bug 4781, 5267: %28, %29 in URL
5256 !! wikitext
5257 http://www.example.com/?title=Ben-Hur_%281959_film%29
5258 !! html/php
5259 <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>
5260 </p>
5261 !! html/parsoid
5262 <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>
5263 !! end
5264
5265
5266 !! test
5267 Bug 4781: %26 in autonumber URL
5268 !! wikitext
5269 [http://www.example.com/?title=AT%26T]
5270 !! html/php
5271 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5272 </p>
5273 !! html/parsoid
5274 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5275 !! end
5276
5277 !! test
5278 Bug 4781, 5267: %26 in autonumber URL
5279 !! wikitext
5280 [http://www.example.com/?title=100%25_Bran]
5281 !! html/php
5282 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5283 </p>
5284 !! html/parsoid
5285 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5286 !! end
5287
5288 !! test
5289 Bug 4781, 5267: %28, %29 in autonumber URL
5290 !! wikitext
5291 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5292 !! html/php
5293 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5294 </p>
5295 !! html/parsoid
5296 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5297 !! end
5298
5299
5300 !! test
5301 Bug 4781: %26 in bracketed URL
5302 !! wikitext
5303 [http://www.example.com/?title=AT%26T link]
5304 !! html/php
5305 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5306 </p>
5307 !! html/parsoid
5308 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5309 !! end
5310
5311 !! test
5312 Bug 4781, 5267: %25 in bracketed URL
5313 !! wikitext
5314 [http://www.example.com/?title=100%25_Bran link]
5315 !! html
5316 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5317 </p>
5318 !! end
5319
5320 !! test
5321 Bug 4781, 5267: %28, %29 in bracketed URL
5322 !! wikitext
5323 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5324 !! html/php
5325 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5326 </p>
5327 !! html/parsoid
5328 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5329 !! end
5330
5331 !! test
5332 External link containing a period in the anchor. (bug 63947)
5333 !! wikitext
5334 [//foo.org/bar#baz. bang]
5335
5336 [//foo.org/bar. bang]
5337 !! html/php
5338 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5339 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5340 </p>
5341 !! html/parsoid
5342 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5343 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5344 !! end
5345
5346 !! test
5347 External link containing a single quote. (bug 63947)
5348 !! wikitext
5349 [//foo.org/bar'baz]
5350
5351 [//foo.org/bar'baz bang]
5352 !! html/php
5353 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5354 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5355 </p>
5356 !! html/parsoid
5357 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5358 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5359 !! end
5360
5361 !! test
5362 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5363 !! wikitext
5364 Some [http://example.com/ pretty ''italics'' and stuff]!
5365 !! html
5366 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5367 </p>
5368 !! end
5369
5370 !! test
5371 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5372 !! wikitext
5373 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5374 !! html
5375 <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>
5376 </p>
5377 !! end
5378
5379 !! test
5380 External link containing double-single-quotes with no space separating the url from text in italics
5381 !! wikitext
5382 [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]].]
5383 !! html/php
5384 <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>
5385 </p>
5386 !! html/php+tidy
5387 <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>
5388 !! html/parsoid
5389 <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>
5390 !! end
5391
5392 !! test
5393 External link with comments in link text
5394 !! wikitext
5395 [http://www.google.com Google <!-- comment -->]
5396 !! html/php
5397 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5398 </p>
5399 !! html/parsoid
5400 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5401 !! end
5402
5403 !! test
5404 External link to bare IPv4 address
5405 !! wikitext
5406 [http://192.168.0.1 Link]
5407 !! html/php
5408 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5409 </p>
5410 !! html/parsoid
5411 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5412 !! end
5413
5414 !! test
5415 URL-encoding in URL functions (single parameter)
5416 !! wikitext
5417 {{localurl:Some page|amp=&}}
5418 !! html
5419 <p>/index.php?title=Some_page&amp;amp=&amp;
5420 </p>
5421 !! end
5422
5423 !! test
5424 URL-encoding in URL functions (multiple parameters)
5425 !! wikitext
5426 {{localurl:Some page|q=?&amp=&}}
5427 !! html
5428 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5429 </p>
5430 !! end
5431
5432 !! test
5433 Brackets in urls
5434 !! wikitext
5435 http://example.com/index.php?foozoid%5B%5D=bar
5436
5437 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5438 !! html/php
5439 <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>
5440 </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>
5441 </p>
5442 !! html/parsoid
5443 <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>
5444
5445 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5446 !! end
5447
5448 !! test
5449 IPv6 urls, autolink format (T23261)
5450 !! wikitext
5451 http://[2404:130:0:1000::187:2]/index.php
5452
5453 Examples from RFC 2373, section 2.2:
5454 * http://[1080::8:800:200C:417A]/unicast
5455 * http://[FF01::101]/multicast
5456 * http://[::1]/loopback
5457 * http://[::]/unspecified
5458 * http://[::13.1.68.3]/ipv4compat
5459 * http://[::FFFF:129.144.52.38]/ipv4compat
5460
5461 Examples from RFC 2732, section 2:
5462 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5463 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5464 * http://[3ffe:2a00:100:7031::1]
5465 * http://[1080::8:800:200C:417A]/foo
5466 * http://[::192.9.5.5]/ipng
5467 * http://[::FFFF:129.144.52.38]:80/index.html
5468 * http://[2010:836B:4179::836B:4179]
5469
5470 !! html/php
5471 <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>
5472 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5473 </p>
5474 <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>
5475 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5476 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5477 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5478 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5479 <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>
5480 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5481 </p>
5482 <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>
5483 <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>
5484 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5485 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5486 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5487 <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>
5488 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5489
5490 !! html/parsoid
5491 <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>
5492
5493 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5494 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5495 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5496 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5500
5501 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5502 <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>
5503 <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>
5504 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5505 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5507 <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>
5508 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5509 !! end
5510
5511 !! test
5512 IPv6 urls, bracketed format (T23261)
5513 !! wikitext
5514 [http://[2404:130:0:1000::187:2]/index.php test]
5515
5516 Examples from RFC 2373, section 2.2:
5517 * [http://[1080::8:800:200C:417A] unicast]
5518 * [http://[FF01::101] multicast]
5519 * [http://[::1]/ loopback]
5520 * [http://[::] unspecified]
5521 * [http://[::13.1.68.3] ipv4compat]
5522 * [http://[::FFFF:129.144.52.38] ipv4compat]
5523
5524 Examples from RFC 2732, section 2:
5525 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5526 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5527 * [http://[3ffe:2a00:100:7031::1] 3]
5528 * [http://[1080::8:800:200C:417A]/foo 4]
5529 * [http://[::192.9.5.5]/ipng 5]
5530 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5531 * [http://[2010:836B:4179::836B:4179] 7]
5532
5533 !! html/php
5534 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5535 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5536 </p>
5537 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5538 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5539 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5540 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5541 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5542 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5543 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5544 </p>
5545 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5546 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5547 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5548 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5549 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5550 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5551 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5552
5553 !! html/parsoid
5554 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5555
5556 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5557 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5558 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5559 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5560 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5561 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5562 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5563
5564 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5565 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5566 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5567 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5568 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5569 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5570 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5571 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5572 !! end
5573
5574 !! test
5575 Non-extlinks in brackets
5576 !! wikitext
5577 [foo]
5578 [foo bar]
5579 [foo ''bar'']
5580 [fool's] errand
5581 [fool's errand]
5582 [{{echo|foo}}]
5583 [{{echo|foo}} bar]
5584 [{{echo|foo}} ''bar'']
5585 [{{echo|foo}}l's] errand
5586 [{{echo|foo}}l's errand]
5587 [url={{echo|foo}}]
5588 [url=http://example.com]
5589 [http:// bare protocols don't count]
5590 !! html/php
5591 <p>[foo]
5592 [foo bar]
5593 [foo <i>bar</i>]
5594 [fool's] errand
5595 [fool's errand]
5596 [foo]
5597 [foo bar]
5598 [foo <i>bar</i>]
5599 [fool's] errand
5600 [fool's errand]
5601 [url=foo]
5602 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5603 [http:// bare protocols don't count]
5604 </p>
5605 !! html/parsoid
5606 <p>[foo]
5607 [foo bar]
5608 [foo <i>bar</i>]
5609 [fool's] errand
5610 [fool's errand]
5611 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5612 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5613 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5614 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5615 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5616 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5617 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5618 [http:// bare protocols don't count]</p>
5619 !! end
5620
5621 !! test
5622 Percent encoding in external links
5623 !! wikitext
5624 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5625 !! html/php
5626 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5627 </p>
5628 !! html/parsoid
5629 <p><a rel="mw:ExtLink"
5630 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5631 !! end
5632
5633 !! test
5634 Use url link syntax for links where the content is equal the link target
5635 !! wikitext
5636 http://example.com
5637 !! html/php
5638 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5639 </p>
5640 !! html/parsoid
5641 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5642 !! end
5643
5644 !! test
5645 Parenthesis in external links, especially URL links
5646 !! wikitext
5647 http://example.com)
5648
5649 http://example.com/test)
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/a)b
5660
5661 [http://example.com) foo]
5662 !! html/php
5663 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5664 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5665 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</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/a)b">http://example.com/a)b</a>
5670 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5671 </p>
5672 !! html/parsoid
5673 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5674 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5675 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</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/a)b">http://example.com/a)b</a></p>
5680 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5681 !! end
5682
5683 !! test
5684 Parenthesis in external links, w/ transclusion or comment
5685 !! wikitext
5686 (http://example.com/{{echo|hi}})
5687
5688 (http://example.com<!-- hi -->)
5689 !! html/php
5690 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5691 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5692 </p>
5693 !! html/parsoid
5694 <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>
5695
5696 <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>
5697 !! end
5698
5699 !! test
5700 Serialize <a> tags with invalid link targets as plain text
5701 !! options
5702 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5703 !! html/parsoid
5704 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5705 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5706 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5707 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5708 !! wikitext
5709 text
5710 <nowiki>*</nowiki>text
5711 <nowiki>[[foo]]</nowiki>
5712 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5713 !! end
5714
5715 !! test
5716 mw:ExtLink -vs- mw:WikiLink (T94723)
5717 !! options
5718 parsoid=html2wt
5719 !! html/parsoid
5720 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5721 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5722 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5723 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5724 <p>
5725 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5726 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5727 </p>
5728 !! wikitext
5729 [[Foo|Bar]]
5730 [[Foo|Bar]]
5731 [[wikipedia:Foo|Bar]]
5732 [[wikipedia:Foo|Bar]]
5733
5734 [[wikipedia:European_Robin|European Robin]]
5735 [[wikipedia:European_Robin|European Robin]]
5736 !! end
5737
5738 !! test
5739 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5740 !! options
5741 parsoid=wt2wt
5742 !! wikitext
5743 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5744 !! html/parsoid
5745 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5746 !! end
5747
5748
5749 ###
5750 ### Quotes
5751 ###
5752
5753 !! test
5754 Quotes
5755 !! wikitext
5756 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5757
5758 Normal text. '''''Bold italic text.''''' Normal text.
5759 !! html
5760 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5761 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5762 </p>
5763 !! end
5764
5765
5766 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5767 # parser strips. The wikitext contains just the first half of the bold
5768 # quote pair.
5769 !! test
5770 Unclosed and unmatched quotes
5771 !! wikitext
5772 '''''Bold italic text '''with bold deactivated''' in between.'''''
5773
5774 '''''Bold italic text ''with italic deactivated'' in between.'''''
5775
5776 '''Bold text..
5777
5778 ..spanning two paragraphs (should not work).'''
5779
5780 '''Bold tag left open
5781
5782 ''Italic tag left open
5783
5784 Normal text.
5785
5786 <!-- Unmatching number of opening, closing tags: -->
5787 '''This year''''s election ''should'' beat '''last year''''s.
5788
5789 ''Tom'''s car is bigger than ''Susan'''s.
5790
5791 Plain ''italic'''s plain
5792 !! html/php
5793 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5794 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5795 </p><p><b>Bold text..</b>
5796 </p><p>..spanning two paragraphs (should not work).
5797 </p><p><b>Bold tag left open</b>
5798 </p><p><i>Italic tag left open</i>
5799 </p><p>Normal text.
5800 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5801 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5802 </p><p>Plain <i>italic'</i>s plain
5803 </p>
5804 !! html/parsoid
5805 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5806 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5807 </p><p><b>Bold text..</b>
5808 </p><p>..spanning two paragraphs (should not work).<b></b>
5809 </p><p><b>Bold tag left open</b>
5810 </p><p><i>Italic tag left open</i>
5811 </p><p>Normal text.
5812 </p>
5813 <!-- Unmatching number of opening, closing tags: -->
5814 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5815 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5816 </p><p>Plain <i>italic'</i>s plain
5817 </p>
5818 !! end
5819
5820 ###
5821 ### Tables
5822 ###
5823 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5824 ###
5825
5826 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5827 # is the bare minimum required by the spec, see:
5828 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5829 # Parsoid team replies: empty table tags are legal in HTML5
5830 !! test
5831 A table with no data.
5832 !! options
5833 parsoid=wt2html
5834 !! wikitext
5835 {||}
5836 !! html/php
5837
5838 !! html/parsoid
5839 <table></table>
5840
5841 !! end
5842
5843 !! test
5844 A table with stray table end tags on start tag line (wt2html)
5845 !! options
5846 parsoid=wt2html
5847 !! wikitext
5848 {|style="color: red;"|}
5849
5850 {|style="color: red;" |}
5851 |foo
5852 |}
5853
5854 {|style="color: red;"|} id="foo"
5855 |foo
5856 |}
5857
5858 {|style="color: red;" |} id="foo"
5859 |foo
5860 |}
5861 !! html
5862 <table style="color: red;"></table>
5863
5864 <table style="color: red;">
5865 <tbody><tr>
5866 <td>foo</td>
5867 </tr></tbody>
5868 </table>
5869
5870 <table style="color: red;" id="foo">
5871 <tbody><tr>
5872 <td>foo</td>
5873 </tr></tbody>
5874 </table>
5875
5876 <table style="color: red;" id="foo">
5877 <tbody><tr>
5878 <td>foo</td>
5879 </tr></tbody>
5880 </table>
5881
5882 !! end
5883
5884 !! test
5885 A table with no data (take 2)
5886 !! wikitext
5887 {|
5888 |}
5889 !! html/parsoid
5890 <table></table>
5891 !! end
5892
5893 # A table with nothing but a caption is invalid XHTML, we might want to render
5894 # this as <p>caption</p>
5895 # Parsoid team replies: table with only a caption is legal in HTML5
5896 !! test
5897 A table with nothing but a caption
5898 !! wikitext
5899 {|
5900 |+ caption
5901 |}
5902 !! html/php
5903 <table>
5904 <caption> caption
5905 </caption><tr><td></td></tr></table>
5906
5907 !! html/parsoid
5908 <table><caption> caption</caption></table>
5909 !! end
5910
5911 !! test
5912 A table with caption with default-spaced attributes and a table row
5913 !! wikitext
5914 {|
5915 |+ style="color: red;" | caption1
5916 |-
5917 | foo
5918 |}
5919 !! html
5920 <table>
5921 <caption style="color: red;"> caption1
5922 </caption>
5923 <tr>
5924 <td> foo
5925 </td></tr></table>
5926
5927 !! end
5928
5929 !! test
5930 A table with captions with non-default spaced attributes and a table row
5931 !! wikitext
5932 {|
5933 |+style="color: red;"|caption2
5934 |+ style="color: red;"| caption3
5935 |-
5936 | foo
5937 |}
5938 !! html
5939 <table>
5940 <caption style="color: red;">caption2
5941 </caption>
5942 <caption style="color: red;"> caption3
5943 </caption>
5944 <tr>
5945 <td> foo
5946 </td></tr></table>
5947
5948 !! end
5949
5950 !! test
5951 Table td-cell syntax variations
5952 !! wikitext
5953 {|
5954 | foo bar foo | baz
5955 | foo bar foo || baz
5956 | style='color:red;' | baz
5957 | style='color:red;' || baz
5958 |}
5959 !! html
5960 <table>
5961 <tr>
5962 <td> baz
5963 </td>
5964 <td> foo bar foo </td>
5965 <td> baz
5966 </td>
5967 <td style="color:red;"> baz
5968 </td>
5969 <td> style='color:red;' </td>
5970 <td> baz
5971 </td></tr></table>
5972
5973 !! end
5974
5975 !! test
5976 Simple table
5977 !! wikitext
5978 {|
5979 | 1 || 2
5980 |-
5981 | 3 || 4
5982 |}
5983 !! html
5984 <table>
5985 <tr>
5986 <td> 1 </td>
5987 <td> 2
5988 </td></tr>
5989 <tr>
5990 <td> 3 </td>
5991 <td> 4
5992 </td></tr></table>
5993
5994 !! end
5995
5996 !! test
5997 Simple table but with multiple dashes for row wikitext
5998 !! wikitext
5999 {|
6000 | foo
6001 |-----
6002 | bar
6003 |}
6004 !! html
6005 <table>
6006 <tr>
6007 <td> foo
6008 </td></tr>
6009 <tr>
6010 <td> bar
6011 </td></tr></table>
6012
6013 !! end
6014
6015 !! test
6016 Multiplication table
6017 !! wikitext
6018 {| border="1" cellpadding="2"
6019 |+Multiplication table
6020 |-
6021 ! &times; !! 1 !! 2 !! 3
6022 |-
6023 ! 1
6024 | 1 || 2 || 3
6025 |-
6026 ! 2
6027 | 2 || 4 || 6
6028 |-
6029 ! 3
6030 | 3 || 6 || 9
6031 |-
6032 ! 4
6033 | 4 || 8 || 12
6034 |-
6035 ! 5
6036 | 5 || 10 || 15
6037 |}
6038 !! html
6039 <table border="1" cellpadding="2">
6040 <caption>Multiplication table
6041 </caption>
6042 <tr>
6043 <th> &#215; </th>
6044 <th> 1 </th>
6045 <th> 2 </th>
6046 <th> 3
6047 </th></tr>
6048 <tr>
6049 <th> 1
6050 </th>
6051 <td> 1 </td>
6052 <td> 2 </td>
6053 <td> 3
6054 </td></tr>
6055 <tr>
6056 <th> 2
6057 </th>
6058 <td> 2 </td>
6059 <td> 4 </td>
6060 <td> 6
6061 </td></tr>
6062 <tr>
6063 <th> 3
6064 </th>
6065 <td> 3 </td>
6066 <td> 6 </td>
6067 <td> 9
6068 </td></tr>
6069 <tr>
6070 <th> 4
6071 </th>
6072 <td> 4 </td>
6073 <td> 8 </td>
6074 <td> 12
6075 </td></tr>
6076 <tr>
6077 <th> 5
6078 </th>
6079 <td> 5 </td>
6080 <td> 10 </td>
6081 <td> 15
6082 </td></tr></table>
6083
6084 !! end
6085
6086 !! test
6087 Accept "||" in table headings
6088 !! wikitext
6089 {|
6090 !h1 || h2
6091 |}
6092 !! html
6093 <table>
6094 <tr>
6095 <th>h1 </th>
6096 <th> h2
6097 </th></tr></table>
6098
6099 !! end
6100
6101 !! test
6102 Accept "!!" in table data
6103 !! wikitext
6104 {|
6105 | Foo!! ||
6106 |}
6107 !! html
6108 <table>
6109 <tr>
6110 <td> Foo!! </td>
6111 <td>
6112 </td></tr></table>
6113
6114 !! html/parsoid
6115 <table>
6116 <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>
6117 </tbody></table>
6118 !! end
6119
6120 !! test
6121 Accept "||" in indented table headings
6122 !! wikitext
6123 :{|
6124 !h1 || h2
6125 |}
6126 !! html
6127 <dl><dd><table>
6128 <tr>
6129 <th>h1 </th>
6130 <th> h2
6131 </th></tr></table></dd></dl>
6132
6133 !! end
6134
6135 !! test
6136 Accept "!!" in templates
6137 !! wikitext
6138 {|
6139 !a {{echo|b!!c}}
6140 |}
6141 !! html/php
6142 <table>
6143 <tr>
6144 <th>a b</th>
6145 <th>c
6146 </th></tr></table>
6147
6148 !! html/parsoid
6149 <table>
6150 <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>
6151 !! end
6152
6153 !! test
6154 Accept "!!" in table headings after newline
6155 !! wikitext
6156 {|
6157 !a
6158 b!!c
6159 |}
6160 !! html/php
6161 <table>
6162 <tr>
6163 <th>a
6164 <p>b!!c
6165 </p>
6166 </th></tr></table>
6167
6168 !! html/parsoid
6169 <table>
6170 <tbody><tr><th>a
6171 <p>b!!c</p></th></tr>
6172 </tbody></table>
6173 !! end
6174
6175 !! test
6176 Accept "!!" in table data of mixed wikitext / html syntax
6177 !! wikitext
6178 {|
6179 !a
6180 <tr><td>b!!c</td></tr>
6181 |}
6182 !! html+tidy
6183 <table>
6184 <tr>
6185 <th>a</th>
6186 </tr>
6187 <tr>
6188 <td>b!!c</td>
6189 </tr>
6190 </table>
6191 !! html/parsoid
6192 <table>
6193 <tbody><tr><th>a</th></tr>
6194 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6195 </tbody></table>
6196 !! end
6197
6198 !! test
6199 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6200 !! wikitext
6201 {|
6202 !| h1
6203 || a
6204 |}
6205 !! html
6206 <table>
6207 <tr>
6208 <th> h1
6209 </th>
6210 <td> a
6211 </td></tr></table>
6212
6213 !! end
6214
6215 !!test
6216 Accept "| !" at start of line in tables (ignore !-attribute)
6217 !! wikitext
6218 {|
6219 |-
6220 | !style="color:red" | bar
6221 |}
6222 !! html
6223 <table>
6224
6225 <tr>
6226 <td> bar
6227 </td></tr></table>
6228
6229 !!end
6230
6231 !!test
6232 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 +/-
6233 !! wikitext
6234 {|
6235 |-
6236 |style='color:red;'|+1
6237 |style='color:blue;'|-1
6238 |-
6239 | 1 || 2 || 3
6240 | 1 ||+2 ||-3
6241 |-
6242 | +1
6243 | -1
6244 |}
6245 !! html
6246 <table>
6247
6248 <tr>
6249 <td style="color:red;">+1
6250 </td>
6251 <td style="color:blue;">-1
6252 </td></tr>
6253 <tr>
6254 <td> 1 </td>
6255 <td> 2 </td>
6256 <td> 3
6257 </td>
6258 <td> 1 </td>
6259 <td>+2 </td>
6260 <td>-3
6261 </td></tr>
6262 <tr>
6263 <td> +1
6264 </td>
6265 <td> -1
6266 </td></tr></table>
6267
6268 !!end
6269
6270 !! test
6271 Table rowspan
6272 !! wikitext
6273 {| border=1
6274 | Cell 1, row 1
6275 |rowspan=2| Cell 2, row 1 (and 2)
6276 | Cell 3, row 1
6277 |-
6278 | Cell 1, row 2
6279 | Cell 3, row 2
6280 |}
6281 !! html
6282 <table border="1">
6283 <tr>
6284 <td> Cell 1, row 1
6285 </td>
6286 <td rowspan="2"> Cell 2, row 1 (and 2)
6287 </td>
6288 <td> Cell 3, row 1
6289 </td></tr>
6290 <tr>
6291 <td> Cell 1, row 2
6292 </td>
6293 <td> Cell 3, row 2
6294 </td></tr></table>
6295
6296 !! end
6297
6298 !! test
6299 Nested table
6300 !! wikitext
6301 {| border=1
6302 | &alpha;
6303 |
6304 {| bgcolor=#ABCDEF border=2
6305 |nested
6306 |-
6307 |table
6308 |}
6309 |the original table again
6310 |}
6311 !! html
6312 <table border="1">
6313 <tr>
6314 <td> &#945;
6315 </td>
6316 <td>
6317 <table bgcolor="#ABCDEF" border="2">
6318 <tr>
6319 <td>nested
6320 </td></tr>
6321 <tr>
6322 <td>table
6323 </td></tr></table>
6324 </td>
6325 <td>the original table again
6326 </td></tr></table>
6327
6328 !! end
6329
6330 !! test
6331 Invalid attributes in table cell (bug 1830)
6332 !! wikitext
6333 {|
6334 |Cell:|broken
6335 |}
6336 !! html
6337 <table>
6338 <tr>
6339 <td>broken
6340 </td></tr></table>
6341
6342 !! end
6343
6344 !! test
6345 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6346 !! wikitext
6347 {|
6348 | title="foo" |bar
6349 | title="foo<nowiki>|</nowiki>" |bar
6350 | title="foo<nowiki>|</nowiki>" bar
6351 |}
6352 !! html/php
6353 <table>
6354 <tr>
6355 <td title="foo">bar
6356 </td>
6357 <td title="foo&#124;">bar
6358 </td>
6359 <td> title="foo|" bar
6360 </td></tr></table>
6361
6362 !! html/parsoid
6363 <table>
6364 <tbody><tr><td title="foo">bar</td>
6365 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6366 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6367 </tbody></table>
6368 !! end
6369
6370 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6371 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6372 # *2wt modes will fail.
6373 !! test
6374 Table security: embedded pipes
6375 !! options
6376 parsoid=wt2html,html2html
6377 !! wikitext
6378 {|
6379 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6380 !! html/php
6381 <table>
6382 <tr>
6383 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6384 <td>]" onmouseover="alert(document.cookie)"&gt;test
6385 </td>
6386 </tr>
6387 </table>
6388
6389 !! html/parsoid
6390 <table><tbody>
6391 <tr>
6392 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6393 !! end
6394
6395 !! test
6396 Element attributes with double ! should not be broken up by <th>
6397 !! wikitext
6398 {|
6399 ! hi <div class="!!">ha</div> ho
6400 |}
6401 !! html/php
6402 <table>
6403 <tr>
6404 <th> hi <div class="!!">ha</div> ho
6405 </th></tr></table>
6406
6407 !! html/parsoid
6408 <table>
6409 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6410 </tbody></table>
6411 !! end
6412
6413 !! test
6414 ! and || in element attributes should not be parsed as <th>/<td>
6415 !! wikitext
6416 {|
6417 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6418 |}
6419 !! html/php
6420 <table>
6421 <tr>
6422 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6423 </td></tr></table>
6424
6425 !! html/parsoid
6426 <table>
6427 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6428 </tbody></table>
6429 !! end
6430
6431 # FIXME: The output seems broken. Filed as T110268.
6432 !! test
6433 ! and || in td attributes should not be parsed as <th>/<td>
6434 !! options
6435 parsoid=wt2html
6436 !! wikitext
6437 {|
6438 | style="color: red !important;" data-contrived="put this here ||" | foo
6439 |}
6440 !! html/php
6441 <table>
6442 <tr>
6443 <td> style="color: red !important;" data-contrived="put this here </td>
6444 <td> foo
6445 </td></tr></table>
6446
6447 !! html/parsoid
6448 <table>
6449 <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>
6450 </tbody></table>
6451 !! end
6452
6453 !! test
6454 Break on | in element attribute in template
6455 !! options
6456 parsoid=wt2html,html2html
6457 !! wikitext
6458 {{echo|1=<div class="hi|ho">ha</div>}}
6459 !! html/php
6460 <p>ho"&gt;ha&lt;/div&gt;
6461 </p>
6462 !! html/parsoid
6463 <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>
6464 !! end
6465
6466 ## We don't support roundtripping of these attributes in Parsoid.
6467 ## Selective serialization takes care of preventing dirty diffs.
6468 ## But, on edits, we dirty-diff the invalid attribute text.
6469 !! test
6470 Invalid text in table attributes should be discarded
6471 !! options
6472 parsoid=wt2html
6473 !! wikitext
6474 {| <span>boo</span> style='border:1px solid black'
6475 | <span>boo</span> style='color:blue' | 1
6476 |<span>boo</span> style='color:blue'| 2
6477 |}
6478 !! html/php
6479 <table style="border:1px solid black">
6480 <tr>
6481 <td style="color:blue"> 1
6482 </td>
6483 <td style="color:blue"> 2
6484 </td></tr></table>
6485
6486 !! html/parsoid
6487 <table style="border:1px solid black">
6488 <tr>
6489 <td style="color:blue"> 1</td>
6490 <td style="color:blue"> 2</td>
6491 </tr>
6492 </table>
6493 !! end
6494
6495 !! test
6496 Invalid text in table attributes should be preserved by selective serializer
6497 !! options
6498 parsoid={
6499 "modes": ["selser"],
6500 "changes": [
6501 ["td:first-child", "text", "abc"],
6502 ["td + td", "text", "xyz"]
6503 ]
6504 }
6505 !! wikitext
6506 {| <span>boo</span> style='border:1px solid black'
6507 | <span>boo</span> style='color:blue' | 1
6508 |<span>boo</span> style='color:blue'| 2
6509 |}
6510 !! wikitext/edited
6511 {| <span>boo</span> style='border:1px solid black'
6512 | <span>boo</span> style='color:blue' |abc
6513 |<span>boo</span> style='color:blue'|xyz
6514 |}
6515 !! end
6516
6517 !! test
6518 1. Template-generated table cell attributes and cell content
6519 !! wikitext
6520 {|
6521 |{{table_attribs}}
6522 | {{table_attribs}}
6523 || {{table_attribs_5}}
6524 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6525 |align=center {{table_attribs}}
6526 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6527 |}
6528 !! html
6529 <table>
6530 <tr>
6531 <td style="color:red;">Foo
6532 </td>
6533 <td style="color:red;">Foo
6534 </td>
6535 <td> style="color:red;"</td>
6536 <td>Bar
6537 </td>
6538 <td style="color:red;">Foo
6539 </td>
6540 <td align="center" style="color:red;">Foo
6541 </td>
6542 <td align="center" style="color:red;">Foo
6543 </td></tr></table>
6544
6545 !! end
6546
6547 !! test
6548 2. Template-generated table cell attributes and cell content
6549 !! wikitext
6550 {|
6551 |{{table_attribs_2}}
6552 |}
6553 !! html/php
6554 <table>
6555 <tr>
6556 <td style="color:red;">Foo
6557 </td>
6558 <td>Bar</td>
6559 <td>Baz
6560 </td></tr></table>
6561
6562 !! html/parsoid
6563 <table>
6564 <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>
6565 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6566 </tbody></table>
6567 !! end
6568
6569 !! test
6570 3. Template-generated table cell attributes and cell content
6571 !! wikitext
6572 {|
6573 !align=center {{table_header_cells}}
6574 |-
6575 |align=center {{table_cells}}
6576 |}
6577 !! html/php
6578 <table>
6579 <tr>
6580 <th align="center" style="color:red;">Foo</th>
6581 <th style="color:red;"><i>Bar</i></th>
6582 <th style="color:brown;"><i>Foo</i> and Baz
6583 </th></tr>
6584 <tr>
6585 <td align="center" style="color:red;">Foo</td>
6586 <td style="color:red;"><i>Bar</i></td>
6587 <td style="color:brown;"><i>Foo</i> and Baz
6588 </td></tr></table>
6589
6590 !! html/parsoid
6591 <table>
6592 <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>
6593 <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>
6594 </tbody></table>
6595 !! end
6596
6597 !! test
6598 4. Template-generated table cell attributes and cell content inside a templated table
6599 !! wikitext
6600 {{tbl-start}}
6601 !align=center {{table_header_cells}}
6602 |-
6603 |align=center {{table_cells}}
6604 {{tbl-end}}
6605 !! html/php
6606 <table>
6607 <tr>
6608 <th align="center" style="color:red;">Foo</th>
6609 <th style="color:red;"><i>Bar</i></th>
6610 <th style="color:brown;"><i>Foo</i> and Baz
6611 </th></tr>
6612 <tr>
6613 <td align="center" style="color:red;">Foo</td>
6614 <td style="color:red;"><i>Bar</i></td>
6615 <td style="color:brown;"><i>Foo</i> and Baz
6616 </td></tr></table>
6617
6618 !! html/parsoid
6619 <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}}]}'>
6620 <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>
6621 <tr>
6622 <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>
6623 </tbody></table>
6624 !! end
6625
6626 ## Edge case fix to prevent future regressions
6627 !! test
6628 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6629 !! wikitext
6630 {|
6631 |{{table_attribs_7}}
6632 |}
6633 <references />
6634 !! html/parsoid
6635 <table>
6636 <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="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6637 </tbody></table>
6638 <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="#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>
6639 !! end
6640
6641 !! test
6642 Table with row followed by newlines and table heading
6643 !! options
6644 parsoid=wt2html,html2html
6645 !! wikitext
6646 {|
6647 |-
6648
6649 ! foo
6650 |}
6651 !! html/*
6652 <table>
6653
6654
6655 <tr>
6656 <th> foo
6657 </th></tr></table>
6658
6659 !! end
6660
6661 !! test
6662 Table with empty line following the start tag
6663 !! options
6664 parsoid=wt2html,html2html
6665 !! wikitext
6666 {|
6667
6668 |-
6669 | foo
6670 |}
6671 !! html/*
6672 <table>
6673
6674
6675 <tr>
6676 <td> foo
6677 </td></tr></table>
6678
6679 !! end
6680
6681 !! test
6682 Table attributes with empty value
6683 !! options
6684 parsoid=wt2html,html2html
6685 !! wikitext
6686 {|
6687 | style=| hello
6688 |}
6689 !! html/php
6690 <table>
6691 <tr>
6692 <td style=""> hello
6693 </td></tr></table>
6694
6695 !! html/parsoid
6696 <table>
6697 <tbody><tr><td style=""> hello</td></tr>
6698 </tbody></table>
6699 !! end
6700
6701 !! test
6702 Wikitext table with a lot of comments
6703 !! wikitext
6704 {|
6705 <!-- c0 -->
6706 | foo
6707 <!-- c1 -->
6708 |-<!-- c2 -->
6709 <!-- c3 -->
6710 |<!-- c4 -->
6711 <!-- c5 -->
6712 |}
6713 !! html
6714 <table>
6715 <tr>
6716 <td> foo
6717 </td></tr>
6718 <tr>
6719 <td>
6720 </td></tr></table>
6721
6722 !! end
6723
6724 !! test
6725 Wikitext table comments represented in parsoid dom
6726 !! wikitext
6727 {|<!--c1--><!--c2-->
6728 |-<!--c3-->
6729 | x
6730 |}
6731 !! html/php+tidy
6732 <table>
6733 <tr>
6734 <td>x</td>
6735 </tr>
6736 </table>
6737 !! html/parsoid
6738 <table><!--c1--><!--c2-->
6739 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6740 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6741 </tbody></table>
6742 !! end
6743
6744 !! test
6745 Wikitext table with double-line table cell
6746 !! wikitext
6747 {|
6748 |a
6749 b
6750 |}
6751 !! html
6752 <table>
6753 <tr>
6754 <td>a
6755 <p>b
6756 </p>
6757 </td></tr></table>
6758
6759 !! end
6760
6761 !! test
6762 Table cell with a single comment
6763 !! wikitext
6764 {|
6765 | <!-- c1 -->
6766 | a
6767 |}
6768 !! html
6769 <table>
6770 <tr>
6771 <td>
6772 </td>
6773 <td> a
6774 </td></tr></table>
6775
6776 !! end
6777
6778 !! test
6779 Table-cell after a comment-only-empty-line
6780 !! wikitext
6781 {|
6782 |a
6783 <!--c1-->
6784 <!--c2-->| b
6785 |}
6786 !! html
6787 <table>
6788 <tr>
6789 <td>a
6790 </td>
6791 <td> b
6792 </td></tr></table>
6793
6794 !! html/parsoid
6795 <table>
6796 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6797 <!--c1-->
6798 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6799 </tbody></table>
6800
6801 !! end
6802
6803 !! test
6804 Build table with {{!}}
6805 !! wikitext
6806 {{{!}} class="wikitable"
6807 ! header
6808 ! second header
6809 {{!}}- style="color:red;"
6810 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6811 {{!}}}
6812 !! html
6813 <table class="wikitable">
6814 <tr>
6815 <th> header
6816 </th>
6817 <th> second header
6818 </th></tr>
6819 <tr style="color:red;">
6820 <td> data </td>
6821 <td style="color:red;"> second data
6822 </td></tr></table>
6823
6824 !! end
6825
6826 !! test
6827 Build table with pipe as data
6828 !! wikitext
6829 {| class="wikitable"
6830 ! header
6831 ! second header
6832 |- style="color:red;"
6833 | data || style="color:red;" | second data
6834 |-
6835 | style="color:red;" | data with | || style="color:red;" | second data with |
6836 |-
6837 || data with | ||| second data with |
6838 |}
6839 !! html
6840 <table class="wikitable">
6841 <tr>
6842 <th> header
6843 </th>
6844 <th> second header
6845 </th></tr>
6846 <tr style="color:red;">
6847 <td> data </td>
6848 <td style="color:red;"> second data
6849 </td></tr>
6850 <tr>
6851 <td style="color:red;"> data with | </td>
6852 <td style="color:red;"> second data with |
6853 </td></tr>
6854 <tr>
6855 <td> data with | </td>
6856 <td> second data with |
6857 </td></tr></table>
6858
6859 !! end
6860
6861 !! test
6862 Build table with wikilink
6863 !! wikitext
6864 {| class="wikitable"
6865 ! header || second header
6866 |- style="color:red;"
6867 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6868 |-
6869 | data || second data [[Main Page|link|text with pipe]]
6870 |}
6871 !! html
6872 <table class="wikitable">
6873 <tr>
6874 <th> header </th>
6875 <th> second header
6876 </th></tr>
6877 <tr style="color:red;">
6878 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6879 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6880 </td></tr>
6881 <tr>
6882 <td> data </td>
6883 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6884 </td></tr></table>
6885
6886 !! end
6887
6888 # The expected HTML structure in this test is debatable. The PHP parser does
6889 # not parse this kind of table at all. The main focus for Parsoid is on
6890 # round-tripping, so this output is ok for now. TODO: revisit!
6891 !! test
6892 Wikitext table with html-syntax row
6893 !! wikitext
6894 {|
6895 |-
6896 <td>foo</td>
6897 |}
6898 !! html/parsoid
6899 <table>
6900 <tbody>
6901 <tr>
6902 <td>foo</td></tr></tbody></table>
6903 !! end
6904
6905 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6906 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6907 ## PHP parser, which tidy then compounds by fostering the content
6908 ## entirely out of the table. Parsoid recognizes the table context
6909 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6910 ## depends on PHP's treatment of broken table markup!
6911 !! test
6912 Implicit <td> after a |-
6913 !! options
6914 parsoid=wt2html,html2html
6915 !! wikitext
6916 {|
6917 |-
6918 a
6919 |}
6920 !! html/php
6921 <table>
6922
6923 a
6924 </table>
6925
6926 !! html/php+tidy
6927 <p>a</p>
6928 !! html/parsoid
6929 <table>
6930 <tr><td>a</td></tr>
6931 </table>
6932 !! end
6933
6934 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6935 !! test
6936 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6937 !! options
6938 parsoid=wt2html,html2html
6939 !! wikitext
6940 {|
6941 |-
6942 |
6943 a
6944 |-
6945 b
6946 |}
6947 !! html/php
6948 <table>
6949
6950 <tr>
6951 <td>
6952 <pre>a
6953 </pre>
6954 </td></tr>
6955 b
6956 </table>
6957
6958 !! html/php+tidy
6959 <p>b</p>
6960 <table>
6961 <tr>
6962 <td>
6963 <pre>
6964 a
6965 </pre></td>
6966 </tr>
6967 </table>
6968 !! html/parsoid
6969 <table>
6970 <tbody>
6971 <tr><td><pre>a</pre></td></tr>
6972 <tr><td> b</td></tr>
6973 </tbody>
6974 </table>
6975 !! end
6976
6977 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6978 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6979 !! test
6980 Lists should be recognized in an implicit <td> context
6981 !! options
6982 parsoid=wt2html,html2html
6983 !! wikitext
6984 {|
6985 |-
6986 *a
6987 |}
6988 !! html/php
6989 <table>
6990
6991 <ul><li>a</li></ul>
6992 </table>
6993
6994 !! html/php+tidy
6995 <ul>
6996 <li>a</li>
6997 </ul>
6998 !! html/parsoid
6999 <table>
7000 <tr>
7001 <td><ul>
7002 <li>a</li>
7003 </ul></td>
7004 </tr>
7005 </table>
7006 !! end
7007
7008 !! test
7009 Table cells not properly parsed in an implicit-td context
7010 !! wikitext
7011 {|
7012 |-
7013 {{table_attribs_4}} || a || b
7014 |}
7015 !! html/php+tidy
7016 <table>
7017 <tr>
7018 <td style="background-color:#DC241f;" width="10px"></td>
7019 <td>a</td>
7020 <td>b</td>
7021 </tr>
7022 </table>
7023 !! html/parsoid
7024 <table>
7025 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7026 <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>
7027 </tbody></table>
7028 !! end
7029
7030 !! test
7031 Parsoid: Round-trip tables directly followed by content (bug 51219)
7032 !! options
7033 parsoid=wt2html,wt2wt
7034 !! wikitext
7035 {|
7036 |foo
7037 |} bar
7038
7039 {|
7040 |baz
7041 |}<b>quux</b>
7042 !! html+tidy
7043 <table>
7044 <tr>
7045 <td>foo</td>
7046 </tr>
7047 </table>
7048 <p>bar</p>
7049 <table>
7050 <tr>
7051 <td>baz</td>
7052 </tr>
7053 </table>
7054 <p><b>quux</b></p>
7055 !! end
7056
7057 !! test
7058 Parsoid: Default to a newline after tables in new content (bug 51219)
7059 !! options
7060 parsoid=html2wt
7061 !! html/parsoid
7062 <table><tbody>
7063 <tr><td>foo</td></tr></tbody></table> bar
7064 <table><tbody>
7065 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7066 !! wikitext
7067 {|
7068 |foo
7069 |}
7070 <nowiki> </nowiki>bar
7071 {|
7072 |baz
7073 |}
7074 '''quux'''
7075 !! end
7076
7077 !! test
7078 Parsoid: newline inducing block nodes don't suppress <nowiki>
7079 !! options
7080 parsoid=html2wt
7081 !! html/parsoid
7082 a<h1>foo</h1>
7083 !! wikitext
7084 <nowiki> </nowiki>a
7085
7086 = foo =
7087 !! end
7088
7089 !! test
7090 Parsoid: Row-syntax table headings followed by comment & table cells
7091 !! options
7092 parsoid=wt2html,wt2wt
7093 !! wikitext
7094 {|
7095 ! foo || bar
7096 <!-- foo --> || baz || quux
7097 |}
7098 !! html/php
7099 <table>
7100 <tr>
7101 <th> foo </th>
7102 <th> bar
7103 </th>
7104 <td> baz </td>
7105 <td> quux
7106 </td></tr></table>
7107
7108 !! html/parsoid
7109 <table>
7110 <tbody><tr><th> foo </th><th> bar
7111 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7112 </tbody></table>
7113 !! end
7114
7115 !!test
7116 Parsoid: Recover better from broken table attributes
7117 !!options
7118 parsoid=wt2html
7119 !!wikitext
7120 {| class="foo
7121 | class="bar" |
7122 foo
7123 |}
7124 !!html/php+tidy
7125 <table class="foo">
7126 <tr>
7127 <td class="bar">
7128 <p>foo</p>
7129 </td>
7130 </tr>
7131 </table>
7132 !!html/parsoid
7133 <table class="foo">
7134 <tr>
7135 <td class="bar">
7136 <p>foo</p></td></tr>
7137 </tbody></table>
7138 !!end
7139
7140 !! test
7141 Tables: Digest broken attributes on table and tr tag
7142 !! options
7143 parsoid=wt2html
7144 !! wikitext
7145 {| || |} ++
7146 |- || || ++ --
7147 |- > [
7148 |}
7149 !! html
7150 <table>
7151 <tbody>
7152 <tr></tr>
7153 <tr></tr>
7154 </tbody></table>
7155 !! end
7156
7157 # T137406: Whitespace in the HTML
7158 !! test
7159 1. Generate correct wikitext for tables with thead/tbody/tfoot
7160 !! options
7161 parsoid=html2wt
7162 !! html/parsoid
7163 <table>
7164 <caption>Test</caption>
7165 <thead>
7166 <tr>
7167 <th>Month</th>
7168 <th>Savings</th>
7169 </tr>
7170 </thead>
7171 <tbody>
7172 <tr>
7173 <td>January</td>
7174 <td>$100</td>
7175 </tr>
7176 <tr>
7177 <td>February</td>
7178 <td>$80</td>
7179 </tr>
7180 </tbody>
7181 <tfoot>
7182 <tr>
7183 <td>Sum</td>
7184 <td>$180</td>
7185 </tr>
7186 </tfoot>
7187 </table>
7188 !! wikitext
7189 {|
7190 |+Test
7191 !Month
7192 !Savings
7193 |-
7194 |January
7195 |$100
7196 |-
7197 |February
7198 |$80
7199 |-
7200 |Sum
7201 |$180
7202 |}
7203 !! html/php+tidy
7204 <table>
7205 <caption>Test</caption>
7206 <tr>
7207 <th>Month</th>
7208 <th>Savings</th>
7209 </tr>
7210 <tr>
7211 <td>January</td>
7212 <td>$100</td>
7213 </tr>
7214 <tr>
7215 <td>February</td>
7216 <td>$80</td>
7217 </tr>
7218 <tr>
7219 <td>Sum</td>
7220 <td>$180</td>
7221 </tr>
7222 </table>
7223 !! end
7224
7225 # T137406: No whitespace in the HTML
7226 !! test
7227 2. Generate correct wikitext for tables with thead/tbody/tfoot
7228 !! options
7229 parsoid=html2wt
7230 !! html/parsoid
7231 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7232 !! wikitext
7233 {|
7234 !heading
7235 |-
7236 |foo
7237 |}
7238 !! end
7239
7240 !! test
7241 Testing serialization after deletion in references
7242 !! options
7243 parsoid={
7244 "modes": ["wt2wt"],
7245 "changes": [
7246 ["#x", "remove"]
7247 ]
7248 }
7249 !! wikitext
7250 hi <ref><div id="x">ho</div></ref>
7251
7252 <references />
7253 !! wikitext/edited
7254 hi <ref></ref>
7255
7256 <references />
7257 !! end
7258
7259 !!test
7260 Testing serialization after deletion of table cells
7261 !!options
7262 parsoid={
7263 "modes": ["wt2wt", "selser"],
7264 "changes": [
7265 ["#x", "remove"]
7266 ]
7267 }
7268 !!wikitext
7269 {|
7270 !h1 !!h2 !!h3
7271 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7272 |}
7273 !! wikitext/edited
7274 {|
7275 !h1 !!h2 !!h3
7276 |c2 |||c3
7277 |}
7278 !!end
7279
7280 !! test
7281 Testing selser after addition of new row before first row (T125419)
7282 !! options
7283 parsoid={
7284 "modes": ["wt2wt", "selser"],
7285 "changes": [
7286 [ "tr", "before", "<tr><td>X</td></tr>" ]
7287 ]
7288 }
7289 !! wikitext
7290 {|
7291 |a
7292 |}
7293 !! wikitext/edited
7294 {|
7295 |X
7296 |-
7297 |a
7298 |}
7299 !! end
7300
7301 !! test
7302 Serialize new table rows in a HTML table using HTML tags
7303 !! options
7304 parsoid={
7305 "modes": ["wt2wt", "selser"],
7306 "changes": [
7307 [ "tr", "before", "<tr><td>X</td></tr>" ]
7308 ]
7309 }
7310 !! wikitext
7311 <table><tr><td>a</td></tr></table>
7312 !! wikitext/edited
7313 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7314 !! end
7315
7316 !! test
7317 Serialize new table cells in a HTML row using HTML tags
7318 !! options
7319 parsoid={
7320 "modes": ["wt2wt", "selser"],
7321 "changes": [
7322 [ "td", "before", "<td>X</td>" ]
7323 ]
7324 }
7325 !! wikitext
7326 <table><tr><td>a</td></tr></table>
7327 !! wikitext/edited
7328 <table><tr><td>X</td><td>a</td></tr></table>
7329 !! end
7330
7331 !! test
7332 Wikitext tables can be nested inside HTML tables
7333 !! options
7334 parsoid=html2wt
7335 !! html
7336 <table data-parsoid='{"stx":"html"}'>
7337 <tr><td>
7338 <table>
7339 <tr><td>foo</td></tr>
7340 </table>
7341 </td></tr>
7342 </table>
7343 !! wikitext
7344 <table>
7345 <tr><td>
7346 {|
7347 |foo
7348 |}
7349 </td></tr>
7350 </table>
7351 !! end
7352
7353 !! test
7354 Serialize wikitext list items as HTML list items when embedded in a HTML list
7355 !! options
7356 parsoid=html2wt
7357 !! html
7358 <ul data-parsoid='{"stx": "html"}'>
7359 <li data-parsoid='{}'>a</li>
7360 <li>b</li>
7361 </ul>
7362 !! wikitext
7363 <ul>
7364 <li>a</li>
7365 <li>b</li>
7366 </ul>
7367 !! end
7368
7369 # SSS FIXME: Is this actually a good thing given the
7370 # odd nested list output that is generated by MW?
7371 # <ul><li>foo<ul>..</ul></li></ul> instead of
7372 # <ul><li>foo</li><ul>..</ul></ul>
7373 !! test
7374 Wikitext lists can be nested inside HTML lists
7375 !! options
7376 parsoid=html2wt
7377 !! html
7378 <ul data-parsoid='{"stx": "html"}'>
7379 <li data-parsoid='{"stx": "html"}'>a
7380 <ul><li>b</li></ul>
7381 </li>
7382 </ul>
7383
7384 <ul data-parsoid='{"stx": "html"}'>
7385 <li>x
7386 <ul><li>y</li></ul>
7387 </li>
7388 </ul>
7389 !! wikitext
7390 <ul>
7391 <li>a
7392 * b
7393 </li>
7394 </ul>
7395
7396 <ul>
7397 <li>x
7398 * y
7399 </li>
7400 </ul>
7401 !! end
7402
7403 ###
7404 ### Internal links
7405 ###
7406 !! test
7407 Plain link, capitalized
7408 !! wikitext
7409 [[Main Page]]
7410 !! html
7411 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7412 </p>
7413 !! end
7414
7415 !! test
7416 Plain link, uncapitalized
7417 !! wikitext
7418 [[main Page]]
7419 !! html
7420 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7421 </p>
7422 !! end
7423
7424 !! test
7425 Piped link
7426 !! wikitext
7427 [[Main Page|The Main Page]]
7428 !! html
7429 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7430 </p>
7431 !! end
7432
7433 !! test
7434 Piped link with comment in link text
7435 !! wikitext
7436 [[Main Page|The Main<!--front--> Page]]
7437 !! html
7438 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7439 </p>
7440 !! end
7441
7442 !! test
7443 Piped link with multiple pipe characters in link text
7444 !! wikitext
7445 [[Main Page||The|Main|Page|]]
7446 !! html/php
7447 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7448 </p>
7449 !! html/parsoid
7450 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7451 !! end
7452
7453 !! test
7454 Piped link with no link text
7455 !! wikitext
7456 [[Thomas Bek (bishop of St David's)|]]
7457 !! html/php
7458 <p>[[Thomas Bek (bishop of St David's)|]]
7459 </p>
7460 !! html/parsoid
7461 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7462 !! end
7463
7464 !! test
7465 Piped link with empty link text
7466 !! wikitext
7467 [[Main Page|<nowiki />]] - empty nowiki
7468 [[Main Page| ]] - empty space
7469 [[Main Page|&nbsp;]] - empty non breaking space
7470 !! html/php
7471 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7472 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7473 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7474 </p>
7475 !! html/parsoid
7476 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7477 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7478 <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>
7479 !! end
7480
7481 !! test
7482 Broken link
7483 !! wikitext
7484 [[Zigzagzogzagzig]]
7485 !! html
7486 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7487 </p>
7488 !! end
7489
7490 !! test
7491 Broken link with fragment
7492 !! wikitext
7493 [[Zigzagzogzagzig#zug]]
7494 !! html
7495 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7496 </p>
7497 !! end
7498
7499 !! test
7500 Special page link with fragment
7501 !! wikitext
7502 [[Special:Version#anchor]]
7503 !! html
7504 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7505 </p>
7506 !! end
7507
7508 !! test
7509 Nonexistent special page link with fragment
7510 !! wikitext
7511 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7512 !! html
7513 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7514 </p>
7515 !! end
7516
7517 !! test
7518 Link with prefix
7519 !! wikitext
7520 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7521 !! html
7522 <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>
7523 </p>
7524 !! end
7525
7526 !! test
7527 Link with suffix
7528 !! wikitext
7529 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7530 !! html
7531 <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>!!!
7532 </p>
7533 !! end
7534
7535 !! article
7536 prefixed article
7537 !! text
7538 Some text
7539 !! endarticle
7540
7541 !! test
7542 Bug 43661: Piped links with identical prefixes
7543 !! wikitext
7544 [[prefixed article|prefixed articles with spaces]]
7545
7546 [[prefixed article|prefixed articlesaoeu]]
7547
7548 [[Main Page|Main Page test]]
7549 !! html
7550 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7551 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7552 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7553 </p>
7554 !! end
7555
7556
7557 !! test
7558 Link with HTML entity in suffix / tail
7559 !! wikitext
7560 [[Main Page]]&quot;, [[Main Page]]&#97;
7561 !! html/php
7562 <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;
7563 </p>
7564 !! html/parsoid
7565 <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>
7566 !! end
7567
7568 !! test
7569 Link with 3 brackets
7570 !! wikitext
7571 [[[Main Page]]]
7572 Foo [[[Main Page]]]
7573 !! html
7574 <p>[[[Main Page]]]
7575 Foo [[[Main Page]]]
7576 </p>
7577 !! end
7578
7579 !! test
7580 Link with 4 brackets
7581 !! wikitext
7582 [[[[Main Page]]]]
7583 !! html
7584 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7585 </p>
7586 !! end
7587
7588 !! test
7589 Piped link with 3 brackets
7590 !! wikitext
7591 [[[main page|the main page]]]
7592 !! html
7593 <p>[[[main page|the main page]]]
7594 </p>
7595 !! end
7596
7597 !! test
7598 Piped link with extlink-like text
7599 !! wikitext
7600 [[Main Page|[bar]]]
7601 [[Main Page|This is a [bar]]]
7602 !! html/php
7603 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7604 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7605 </p>
7606 !! html/parsoid
7607 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7608 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7609 !! end
7610
7611 !! test
7612 Link with multiple pipes
7613 !! wikitext
7614 [[Main Page|The|Main|Page]]
7615 !! html
7616 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7617 </p>
7618 !! end
7619
7620 !! test
7621 Anchor containing a #. (bug 63430)
7622 !! wikitext
7623 [[Main Page#And#Link]]
7624 !! html/php
7625 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7626 </p>
7627 !! html/parsoid
7628 <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>
7629 !! end
7630
7631 !! test
7632 Link to namespaces
7633 !! wikitext
7634 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7635 !! html
7636 <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>
7637 </p>
7638 !! end
7639
7640 !! test
7641 Link with space in namespace
7642 !! wikitext
7643 [[User talk:Foo bar]]
7644 !! html
7645 <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>
7646 </p>
7647 !! end
7648
7649 !! article
7650 MemoryAlpha:AlphaTest
7651 !! text
7652 This is an article in the MemoryAlpha namespace
7653 (which shadows the memoryalpha interwiki link).
7654 !! endarticle
7655
7656 !! test
7657 Namespace takes precedence over interwiki link (bug 51680)
7658 !! wikitext
7659 [[MemoryAlpha:AlphaTest]]
7660 !! html
7661 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7662 </p>
7663 !! end
7664
7665 # The previous test doesn't work correctly in html2*, due to not recognizing the
7666 # link as an internal one. This one checks for the correct behavior.
7667 !! test
7668 Link to namespace preferred over interwiki with correct rel attribute
7669 !! options
7670 parsoid=html2wt,html2html
7671 !! html/parsoid
7672 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7673 !! wikitext
7674 [[MemoryAlpha:AlphaTest]]
7675 !! end
7676
7677 !! test
7678 Piped link to namespace
7679 !! wikitext
7680 [[Meta:Disclaimers|The disclaimers]]
7681 !! html
7682 <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>
7683 </p>
7684 !! end
7685
7686 !! test
7687 Link containing }
7688 !! wikitext
7689 [[Usually caused by a typo (oops}]]
7690 !! html
7691 <p>[[Usually caused by a typo (oops}]]
7692 </p>
7693 !! end
7694
7695 !! article
7696 7% Solution
7697 !! text
7698 Just a test of an article title containing a percent.
7699 !! endarticle
7700
7701 !! test
7702 Link containing % (not as a hex sequence)
7703 !! wikitext
7704 [[7% Solution]]
7705 [[7% Solution|7%25 Solution]]
7706 !! html/php
7707 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7708 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7709 </p>
7710 !! html/parsoid
7711 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7712 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7713 !! end
7714
7715 # note that the parsoid HTML is identical to the previous test output,
7716 # so the previous test ensures that the html2wt mode will generate the
7717 # "not as a hex sequence" wikitext.
7718 !! test
7719 Link containing % as a single hex sequence interpreted to char
7720 !! options
7721 parsoid=wt2wt,wt2html,html2html
7722 !! wikitext
7723 [[7%25 Solution]]
7724 [[7%25 Solution|7%25 Solution]]
7725 !! html/php
7726 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7727 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7728 </p>
7729 !! html/parsoid
7730 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7731 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7732 !!end
7733
7734 !! test
7735 Link containing % as a double hex sequence interpreted to hex sequence
7736 !! wikitext
7737 [[7%2525 Solution]]
7738 !! html
7739 <p>[[7%2525 Solution]]
7740 </p>
7741 !!end
7742
7743 ## Example for such a section: == < ==
7744 !! test
7745 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7746 !! wikitext
7747 [[%23%3c]][[%23%3e]]
7748 !! html/php
7749 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7750 </p>
7751 !! html/parsoid
7752 <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>
7753 !! end
7754
7755 !! test
7756 Link containing "<#" and ">#" as a hex sequences
7757 !! wikitext
7758 [[%3c%23]][[%3e%23]]
7759 !! html
7760 <p>[[%3c%23]][[%3e%23]]
7761 </p>
7762 !! end
7763
7764 !! test
7765 Link containing an equals sign
7766 !! wikitext
7767 [[Special:BookSources/isbn=4-00-026157-6]]
7768 !! html/php
7769 <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>
7770 </p>
7771 !! html/parsoid
7772 <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>
7773 !! end
7774
7775 !! article
7776 Foo~bar
7777 !! text
7778 Just a test of an article title containing a tilde.
7779 !! endarticle
7780
7781 # note that links containing signatures, like [[Foo~~~~]], are
7782 # massaged by the pre-save transform (PST) and so the tildes are never
7783 # seen by the parser.
7784 !! test
7785 Link containing a tilde
7786 !! wikitext
7787 [[Foo~bar]]
7788 !! html/php
7789 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7790 </p>
7791 !! html/parsoid
7792 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7793 !! end
7794
7795 !! test
7796 Link containing double-single-quotes '' (bug 4598)
7797 !! wikitext
7798 [[Lista d''e paise d''o munno]]
7799 !! html/php
7800 <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>
7801 </p>
7802 !! html/parsoid
7803 <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>
7804 !! end
7805
7806 !! test
7807 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7808 !! wikitext
7809 Some [[Link|pretty ''italics'' and stuff]]!
7810 !! html/php
7811 <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>!
7812 </p>
7813 !! html/parsoid
7814 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7815 !! end
7816
7817 !! test
7818 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7819 !! wikitext
7820 ''Some [[Link|pretty ''italics'' and stuff]]!''
7821 !! html
7822 <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>
7823 </p>
7824 !! end
7825
7826 !! test
7827 Link with double quotes in title part (literal) and alternate part (interpreted)
7828 !! wikitext
7829 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7830
7831 [[''Pentecoste'']]
7832
7833 [[''Pentecoste''|Pentecoste]]
7834
7835 [[''Pentecoste''|''Pentecoste'']]
7836 !! html/php
7837 <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>
7838 </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>
7839 </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>
7840 </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>
7841 </p>
7842 !! html/parsoid
7843 <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>
7844 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7845 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7846 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7847 !! end
7848
7849 !! test
7850 Broken image links with HTML captions (bug 39700)
7851 !! wikitext
7852 [[File:Nonexistent|<script></script>]]
7853 [[File:Nonexistent|100x100px|<script></script>]]
7854 [[File:Nonexistent|&lt;]]
7855 [[File:Nonexistent|a<i>b</i>c]]
7856 !! html/php
7857 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7858 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7859 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7860 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7861 </p>
7862 !! html/parsoid
7863 <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>
7864 <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>
7865 <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>
7866 <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>
7867 !! end
7868
7869 !! test
7870 Plain link to URL
7871 !! wikitext
7872 [[http://www.example.com]]
7873 !! html/php
7874 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7875 </p>
7876 !! html/parsoid
7877 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7878 !! end
7879
7880 !! test
7881 Plain link to URL with link text
7882 !! wikitext
7883 [[http://www.example.com Link text]]
7884 !! html
7885 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7886 </p>
7887 !! end
7888
7889 !! test
7890 Plain link to protocol-relative URL
7891 !! wikitext
7892 [[//www.example.com]]
7893 !! html/php
7894 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7895 </p>
7896 !! html/parsoid
7897 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7898 !! end
7899
7900 !! test
7901 Plain link to protocol-relative URL with link text
7902 !! wikitext
7903 [[//www.example.com Link text]]
7904 !! html
7905 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7906 </p>
7907 !! end
7908
7909 !! test
7910 Plain link to page with question mark in title
7911 !! wikitext
7912 [[A?b]]
7913
7914 [[A?b|Baz]]
7915 !! html
7916 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7917 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7918 </p>
7919 !! end
7920
7921
7922 # I'm fairly sure the expected result here is wrong.
7923 # We want these to be URL links, not pseudo-pages with URLs for titles....
7924 # However the current output is also pretty screwy.
7925 #
7926 # ----
7927 # I'm changing it to match the current output--it arguably makes more
7928 # sense in the light of the test above. Old expected result was:
7929 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7930 #</p>
7931 # But I think this test is bordering on "garbage in, garbage out" anyway.
7932 # -- wtm
7933 !! test
7934 Piped link to URL
7935 !! wikitext
7936 Piped link to URL: [[http://www.example.com|an example URL]]
7937 !! html/php
7938 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7939 </p>
7940 !! html/parsoid
7941 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7942 !! end
7943
7944 !! test
7945 BUG 2: [[page|http://url/]] should link to page, not http://url/
7946 !! wikitext
7947 [[Main Page|http://url/]]
7948 !! html/php
7949 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7950 </p>
7951 !! html/parsoid
7952 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7953 !! end
7954
7955 # Parsoid does not mark self-links, by design.
7956 !! test
7957 BUG 337: Escaped self-links should be bold
7958 !! options
7959 title=[[Bug462]]
7960 !! wikitext
7961 [[Bu&#103;462]] [[Bug462]]
7962 !! html/php
7963 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7964 </p>
7965 !! html/php+tidy
7966 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7967 !! html/parsoid
7968 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7969 !! end
7970
7971 !! test
7972 Self-link to section should not be bold
7973 !! options
7974 title=[[Main Page]]
7975 !! wikitext
7976 [[Main Page#section]]
7977 !! html
7978 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7979 </p>
7980 !! end
7981
7982 !! article
7983 00
7984 !! text
7985 This is 00.
7986 !! endarticle
7987
7988 !!test
7989 Self-link to numeric title
7990 !!options
7991 title=[[0]]
7992 !! wikitext
7993 [[0]]
7994 !! html
7995 <p><strong class="selflink">0</strong>
7996 </p>
7997 !!end
7998
7999 !!test
8000 Link to numeric-equivalent title
8001 !!options
8002 title=[[0]]
8003 !! wikitext
8004 [[00]]
8005 !! html
8006 <p><a href="/wiki/00" title="00">00</a>
8007 </p>
8008 !!end
8009
8010 !! test
8011 <nowiki> inside a link
8012 !! wikitext
8013 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8014 !! html
8015 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8016 </p>
8017 !! end
8018
8019 !! test
8020 Non-breaking spaces in title
8021 !! wikitext
8022 [[&nbsp; Main &nbsp; Page &nbsp;]]
8023 !! html
8024 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8025 </p>
8026 !!end
8027
8028 !! test
8029 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8030 !! options
8031 language=ca
8032 !! wikitext
8033 '''[[Main Page]]'''
8034 !! html
8035 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8036 </p>
8037 !! end
8038
8039 !! test
8040 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8041 !! options
8042 language=ca
8043 !! wikitext
8044 ''[[Main Page]]''
8045 !! html
8046 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8047 </p>
8048 !! end
8049
8050 !! test
8051 Internal link with en linktrail: no apostrophes (bug 27473)
8052 !! options
8053 language=en
8054 !! wikitext
8055 [[Something]]'nice
8056 !! html
8057 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8058 </p>
8059 !! end
8060
8061 !! test
8062 Internal link with ca linktrail with apostrophes (bug 27473)
8063 !! options
8064 language=ca
8065 !! wikitext
8066 [[Something]]'nice
8067 !! html
8068 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8069 </p>
8070 !! end
8071
8072 !! test
8073 Internal link with kaa linktrail with apostrophes (bug 27473)
8074 !! options
8075 language=kaa
8076 !! wikitext
8077 [[Something]]'nice
8078 !! html
8079 <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>
8080 </p>
8081 !! end
8082
8083 !! test
8084 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8085 !! wikitext
8086 [[User:Foo/Test/63636:Bar|Test]]
8087 !! html/php
8088 <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>
8089 </p>
8090 !! html/parsoid
8091 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8092 !! end
8093
8094 ## Mainly a sanity check for Parsoid
8095 !! test
8096 Handle title parsing for subpages
8097 !! options
8098 title=[[/123123]]
8099 !! wikitext
8100 123
8101 !! html/parsoid
8102 <p>123</p>
8103 !! end
8104
8105 ## FIXME: Add a working php section here
8106 !! test
8107 Link to a subpage from a namespace other than main
8108 !! options
8109 title=[[User:test]]
8110 !! wikitext
8111 [[/123]]
8112 !! html/parsoid
8113 <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>
8114 !! end
8115
8116 !! test
8117 Ensure that transclusion titles are not url-decoded
8118 !! options
8119 subpage title=[[Test]]
8120 parsoid=wt2html
8121 !! wikitext
8122 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8123 !! html/php
8124 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8125 </p>
8126 !! html/parsoid
8127 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8128 !! end
8129
8130 !! test
8131 Purely hash wikilink
8132 !! options
8133 title=[[User:test/123]]
8134 !! wikitext
8135 [[#a|b]]
8136 !! html/php
8137 <p><a href="#a">b</a>
8138 </p>
8139 !! html/parsoid
8140 <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>
8141 !! end
8142
8143 !! test
8144 1. Interaction of linktrail and template encapsulation
8145 !! options
8146 parsoid
8147 !! wikitext
8148 {{echo|[[Foo]]}}l
8149 !! html
8150 <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>
8151 !! end
8152
8153 !! test
8154 2. Interaction of linktrail and template encapsulation
8155 !! options
8156 parsoid
8157 !! wikitext
8158 {{echo|Some [[Fool]]}}s
8159 !! html
8160 <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>
8161 !! end
8162
8163 !! test
8164 3. Interaction of linktrail and template encapsulation
8165 !! options
8166 parsoid
8167 !! wikitext
8168 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8169 !! html
8170 <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>
8171 !! end
8172
8173 !! article
8174 Söfnuður
8175 !! text
8176 Test.
8177 !! endarticle
8178
8179 !! test
8180 Internal link with is link prefix
8181 !! options
8182 language=is
8183 !! wikitext
8184 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8185 !! html
8186 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8187 </p>
8188 !! end
8189
8190 !! article
8191 Mótmælendatrú
8192 !! text
8193 Test.
8194 !! endarticle
8195
8196 !! test
8197 Internal link with is link trail and link prefix
8198 !! options
8199 language=is
8200 !! wikitext
8201 [[mótmælendatrú|xxx]]ar
8202 [[mótmælendatrú]]ar
8203 mótmælenda[[söfnuður]]
8204 mótmælenda[[söfnuður|söfnuðir]]
8205 mótmælenda[[söfnuður|söfnuðir]]xxx
8206 !! html
8207 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8208 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8209 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8210 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8211 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8212 </p>
8213 !! end
8214
8215 !! test
8216 Parsoid link trail escaping
8217 !! options
8218 parsoid=html2wt,html2html
8219 !! html/parsoid
8220 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8221 !! wikitext
8222 [[apple]]<nowiki/>s
8223 !! end
8224
8225 !! test
8226 Parsoid link prefix escaping
8227 !! options
8228 language=is
8229 parsoid=html2wt,html2html
8230 !! html/parsoid
8231 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8232 !! wikitext
8233 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8234 !! end
8235
8236 !! test
8237 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8238 !! wikitext
8239 [[Foo| bar]]
8240
8241 [[Foo| ''bar'']]
8242
8243 [http://wp.org foo]
8244
8245 [http://wp.org ''foo'']
8246 !! html
8247 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8248 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8249 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8250 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8251 </p>
8252 !! end
8253
8254 !! test
8255 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8256 !! options
8257 parsoid
8258 !! wikitext
8259 [[Foo|{{echo|a}} b {{echo|c}}]]
8260 !! html
8261 <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>
8262 !! end
8263
8264 !! test
8265 Link with angle bracket after anchor
8266 !! wikitext
8267 [[Foo#<bar>]]
8268 !! html/php
8269 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8270 </p>
8271 !! html/parsoid
8272 <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>
8273 !! end
8274
8275 ###
8276 ### Interwiki links (see maintenance/interwiki.sql)
8277 ###
8278
8279 !! test
8280 Inline interwiki link
8281 !! options
8282 parsoid=wt2html,wt2wt,html2html
8283 !! wikitext
8284 [[MeatBall:SoftSecurity]]
8285 !! html/php
8286 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8287 </p>
8288 !! html/parsoid
8289 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8290 !! end
8291
8292 !! test
8293 Inline interwiki link with empty title (bug 2372)
8294 !! options
8295 parsoid=wt2html,wt2wt,html2html
8296 !! wikitext
8297 [[MeatBall:]]
8298 !! html/php
8299 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8300 </p>
8301 !! html/parsoid
8302 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8303 !! end
8304
8305 !! test
8306 Interwiki link encoding conversion (bug 1636)
8307 !! wikitext
8308 *[[Wikipedia:ro:Olteni&#0355;a]]
8309 *[[Wikipedia:ro:Olteni&#355;a]]
8310 !! html
8311 <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>
8312 <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>
8313
8314 !! html+tidy
8315 <ul>
8316 <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>
8317 <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>
8318 </ul>
8319 !! end
8320
8321 !! test
8322 Interwiki link with fragment (bug 2130)
8323 !! wikitext
8324 [[MeatBall:SoftSecurity#foo]]
8325 !! html
8326 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8327 </p>
8328 !! end
8329
8330 !! test
8331 Link scenarios with escaped fragments
8332 !! wikitext
8333 [[#Is this great?]]
8334 [[Foo#Is this great?]]
8335 [[meatball:Foo#Is this great?]]
8336 !! html/php
8337 <p><a href="#Is_this_great.3F">#Is this great?</a>
8338 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8339 <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>
8340 </p>
8341 !! html/parsoid
8342 <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>
8343 <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>
8344 <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>
8345 !! end
8346
8347 # Ideally the wikipedia: prefix here should be proto-relative too
8348 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8349 # define the 'en' prefix, and originally the test used 'wikipedia',
8350 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8351 # article.
8352 !! test
8353 Different interwiki prefixes mapping to the same URL
8354 !! wikitext
8355 [[:en:Foo]]
8356
8357 [[:en:Foo|Foo]]
8358
8359 [[wikipedia:Foo]]
8360
8361 [[:wikipedia:Foo|Foo]]
8362
8363 [[wikipedia:en:Foo]]
8364
8365 [[:wikipedia:en:Foo]]
8366
8367 [[ wikiPEdia :Foo]]
8368 !! html/parsoid
8369 <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>
8370
8371 <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>
8372
8373 <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>
8374
8375 <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>
8376
8377 <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>
8378
8379 <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>
8380
8381 <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>
8382 !! end
8383
8384 !! test
8385 Interwiki links that cannot be represented in wiki syntax
8386 !! wikitext
8387 [[meatball:ok]]
8388 [[meatball:ok#foo|ok with fragment]]
8389 [[meatball:ok_as_well?|ok ending with ? mark]]
8390 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8391 [http://de.wikipedia.org/wiki/#foo is just fragment]
8392
8393 !! html/php
8394 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8395 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8396 <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>
8397 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8398 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8399 </p>
8400 !! html/parsoid
8401 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8402 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8403 <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>
8404 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8405 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8406 !! end
8407
8408 !! test
8409 Interwiki links: trail
8410 !! wikitext
8411 [[wikipedia:Foo|Ba]]r
8412 !! html/php
8413 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8414 </p>
8415 !! html/parsoid
8416 <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>
8417 !! end
8418
8419 !! test
8420 Local interwiki link
8421 !! options
8422 parsoid=wt2html,wt2wt,html2html
8423 !! wikitext
8424 [[local:Template:Foo]]
8425 !! html/php
8426 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8427 </p>
8428 !! html/parsoid
8429 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8430 !! end
8431
8432 # Parsoid does not mark self-links, by design.
8433 !! test
8434 Local interwiki link: self-link to current page
8435 !! options
8436 title=[[Main Page]]
8437 parsoid=wt2html,wt2wt,html2html
8438 !! wikitext
8439 [[local:Main Page]]
8440 !! html/php
8441 <p><strong class="selflink">local:Main Page</strong>
8442 </p>
8443 !! html/parsoid
8444 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8445 !! end
8446
8447 !! test
8448 Local interwiki link: prefix only (bug 64167)
8449 !! options
8450 parsoid=wt2html,wt2wt,html2html
8451 !! wikitext
8452 [[local:]]
8453 !! html/php
8454 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8455 </p>
8456 !! html/parsoid
8457 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8458 !! end
8459
8460 !! test
8461 Local interwiki link: with additional interwiki prefix (bug 61357)
8462 !! options
8463 parsoid=wt2html,wt2wt,html2html
8464 !! wikitext
8465 [[local:meatball:Hello]]
8466 !! html/php
8467 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8468 </p>
8469 !! html/parsoid
8470 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8471 !! end
8472
8473 !! test
8474 Multiple local interwiki link prefixes
8475 !! wikitext
8476 [[local:local:local:local:mi:local:Foo]]
8477 !! options
8478 parsoid=wt2html,wt2wt,html2html
8479 !! html/php
8480 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8481 </p>
8482 !! html/parsoid
8483 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8484 !! end
8485
8486 ###
8487 ### Interlanguage links
8488 ### Language links (so that searching for '### language' matches..)
8489 ###
8490
8491 !! test
8492 Interlanguage link
8493 !! wikitext
8494 Blah blah blah
8495 [[zh:Chinese]]
8496 !! html/php
8497 <p>Blah blah blah
8498 </p>
8499 !! html/parsoid
8500 <p>Blah blah blah</p>
8501 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8502 !! end
8503
8504 ## parsoid html2wt will lose the space variations
8505 !! test
8506 Interlanguage link with spacing
8507 !! options
8508 parsoid=wt2html,wt2wt,html2html
8509 !! wikitext
8510 Blah blah blah
8511 [[ zh : Chinese ]]
8512 !! html/php
8513 <p>Blah blah blah
8514 </p>
8515 !! html/parsoid
8516 <p>Blah blah blah</p>
8517 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8518 !! end
8519
8520 !! test
8521 Double interlanguage link
8522 !! wikitext
8523 Blah blah blah
8524 [[es:Spanish]]
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://es.wikipedia.org/wiki/Spanish"/>
8532 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8533 !! end
8534
8535 ## parsoid html2wt will lose the space variations
8536 !! test
8537 Interlanguage link variations
8538 !! options
8539 parsoid=wt2html,wt2wt,html2html
8540 !! wikitext
8541 Blah blah blah
8542 [[ es :Spanish]]
8543 [[ ZH :Chinese]]
8544 [[es:Foo_bar]]
8545 !! html/php
8546 <p>Blah blah blah
8547 </p>
8548 !! html/parsoid
8549 <p>Blah blah blah</p>
8550 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8551 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8552 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8553 !! end
8554
8555 ## parsoid html2wt will normalize the space to _
8556 !! test
8557 Space and question mark encoding in interlanguage links (T95473)
8558 !! options
8559 parsoid=wt2html,wt2wt,html2html
8560 !! wikitext
8561 Blah blah blah
8562 [[es:Foo bar?]]
8563 !! html/php
8564 <p>Blah blah blah
8565 </p>
8566 !! html/parsoid
8567 <p>Blah blah blah</p>
8568 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8569 !! end
8570
8571 !! test
8572 Interlanguage link, with prefix links
8573 !! options
8574 language=ln
8575 !! wikitext
8576 Blah blah blah
8577 [[zh:Chinese]]
8578 !! html/php
8579 <p>Blah blah blah
8580 </p>
8581 !! html/parsoid
8582 <p>Blah blah blah</p>
8583 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8584 !! end
8585
8586 !! test
8587 Double interlanguage link, with prefix links (bug 8897)
8588 !! options
8589 language=ln
8590 !! wikitext
8591 Blah blah blah
8592 [[es:Spanish]]
8593 [[zh:Chinese]]
8594 !! html/php
8595 <p>Blah blah blah
8596 </p>
8597 !! html/parsoid
8598 <p>Blah blah blah</p>
8599 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8600 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8601 !! end
8602
8603 !! test
8604 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8605 !! wikitext
8606 Blah blah blah
8607 [[mul:Article]]
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" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8614 !! end
8615
8616 ## PHP parser tests script needs an update
8617 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8618 !! test
8619 Language links render as inline links if $wgInterwikiMagic=false
8620 !! options
8621 wgInterwikiMagic=false
8622 parsoid=wt2html,wt2wt,html2html
8623 !! wikitext
8624 Blah blah blah
8625 [[zh:Chinese]]
8626 !! html/parsoid
8627 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
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 in the Talk namespace
8634 !! options
8635 title=Talk:Foo
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 !! test
8645 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8646 !! options
8647 language=ln
8648 !! wikitext
8649 [[WW&nbsp;II]]
8650 !! html
8651 <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>
8652 </p>
8653 !! end
8654
8655 !! test
8656 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8657 !! options
8658 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8659 !! html/parsoid
8660 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8661 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8662 !! wikitext
8663 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8664
8665 He&amp;nbsp;llo He&amp;nbsp;llo
8666 !! html/php
8667 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8668 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8669 </p>
8670 !! end
8671
8672 # html2wt will fail because of title normalization without data-parsoid
8673 !! test
8674 Parsoid: handle constructor well
8675 !! options
8676 parsoid=wt2html,wt2wt
8677 !! wikitext
8678 [[constructor]]
8679
8680 [[constructor:foo]]
8681 !! html/php
8682 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8683 </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>
8684 </p>
8685 !! html/parsoid
8686 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8687
8688 <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>
8689 !! end
8690
8691 !! article
8692 ko:
8693 !! text
8694 Test.
8695 !! endarticle
8696
8697 # Note that `ko` isn't a known interlanguage prefix
8698 !! test
8699 Parsoid: recognize interlanguage links without a target page
8700 !! options
8701 ill
8702 !! wikitext
8703 [[es:]]
8704
8705 [[ko:]]
8706 !! html/php
8707 es:
8708 !! html/parsoid
8709 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8710
8711 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8712 !! end
8713
8714 # Note that `ko` isn't a known interwiki prefix
8715 !! test
8716 Parsoid: recognize interwiki links without a target page
8717 !! options
8718 parsoid=wt2html,wt2wt,html2html
8719 !! wikitext
8720 [[:es:]]
8721
8722 [[:ko:]]
8723 !! html/php
8724 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8725 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8726 </p>
8727 !! html/parsoid
8728 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8729 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8730 !! end
8731
8732 !! test
8733 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8734 !! wikitext
8735 [[mi:Foo]]
8736 !! html/php
8737 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8738 </p>
8739 !! html/parsoid
8740 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8741 !! end
8742
8743 !! test
8744 Interlanguage link with preceding local interwiki link (bug 68085)
8745 !! options
8746 parsoid=wt2html,wt2wt,html2html
8747 !! wikitext
8748 Blah blah blah
8749 [[local:es:Spanish]]
8750 !! html/php
8751 <p>Blah blah blah
8752 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8753 </p>
8754 !! html/parsoid
8755 <p>Blah blah blah
8756 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8757 !! end
8758
8759 !! test
8760 Looks like an interlanguage link, but is actually a local interwiki
8761 !! options
8762 parsoid=wt2html,wt2wt,html2html
8763 !! wikitext
8764 Blah blah blah
8765 [[mi:Template:Foo]]
8766 !! html/php
8767 <p>Blah blah blah
8768 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8769 </p>
8770 !! html/parsoid
8771 <p>Blah blah blah
8772 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8773 !! end
8774
8775 ###
8776 ### Redirects, Parsoid-only
8777 ###
8778
8779 !! test
8780 1. Simple redirect to page
8781 !! wikitext
8782 #REDIRECT [[Main Page]]
8783 !! html/parsoid
8784 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8785 !! end
8786
8787 !! test
8788 2. Other redirect variants
8789 !! wikitext
8790 #REDIRECT [[Main_Page]]
8791 !! html/parsoid
8792 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8793 !! end
8794
8795 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8796 # This tests the Parsoid bail-out code.
8797 !! test
8798 3. Other redirect variants
8799 !! wikitext
8800 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8801 !! html/parsoid
8802 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8803 !! end
8804
8805 !! test
8806 4. Redirect to a templated destination
8807 !! wikitext
8808 #REDIRECT [[{{echo|Foo}}bar]]
8809 !! html/parsoid
8810 <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"}]]}'/>
8811 !! end
8812
8813 !! test
8814 Empty redirect
8815 !! options
8816 parsoid=wt2html,wt2wt
8817 !! wikitext
8818 #REDIRECT [[]]
8819 !! html/parsoid
8820 <ol>
8821 <li>REDIRECT [[]]</li></ol>
8822 !! end
8823
8824 !! test
8825 Optional colon in #REDIRECT
8826 !! options
8827 # the colon is archaic syntax. we support it for wt2html, but we
8828 # don't care that it roundtrips back to the modern syntax.
8829 parsoid=wt2html,html2html
8830 !! wikitext
8831 #REDIRECT:[[Main Page]]
8832 !! html/parsoid
8833 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8834 !! end
8835
8836 !! test
8837 Whitespace in #REDIRECT with optional colon
8838 !! options
8839 # the colon and gratuitous whitespace is archaic syntax. we support
8840 # it for wt2html, but we don't care that it roundtrips back to the
8841 # modern syntax (without extra whitespace)
8842 parsoid=wt2html,html2html
8843 !! wikitext
8844
8845 #REDIRECT
8846 :
8847 [[Main Page]]
8848 !! html/parsoid
8849 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8850 !! end
8851
8852 !! test
8853 Piped link in #REDIRECT
8854 !! options
8855 # content after piped link is ignored. we support this syntax,
8856 # but don't care that the piped link is lost when we roundtrip this.
8857 parsoid=wt2html
8858 !! wikitext
8859 #REDIRECT [[Main Page|bar]]
8860 !! html/parsoid
8861 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8862 !! end
8863
8864 !! test
8865 Redirect to category (T104502)
8866 !! options
8867 parsoid=wt2html,wt2wt
8868 !! wikitext
8869 #REDIRECT [[Category:Foo]]
8870 !! html/parsoid
8871 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8872 !! end
8873
8874 !! test
8875 Redirect to category with URL encoding (T104502)
8876 !! options
8877 parsoid=wt2html
8878 !! wikitext
8879 #REDIRECT [[Category%3AFoo]]
8880 !! html/parsoid
8881 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8882 !! end
8883
8884 !! test
8885 Redirect to category page
8886 !! wikitext
8887 #REDIRECT [[:Category:Foo]]
8888 !! html/parsoid
8889 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8890 !! end
8891
8892 !! test
8893 Redirect to image page (1)
8894 !! wikitext
8895 #REDIRECT [[File:Wiki.png]]
8896 !! html/parsoid
8897 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8898 !! end
8899
8900 !! test
8901 Redirect to image page (2)
8902 !! wikitext
8903 #REDIRECT [[Image:Wiki.png]]
8904 !! html/parsoid
8905 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8906 !! end
8907
8908 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8909 # Next test confirms this.
8910 !! test
8911 Redirect to language (1) (T104918)
8912 !! options
8913 parsoid=wt2html,wt2wt,html2html
8914 !! wikitext
8915 #REDIRECT [[en:File:Wiki.png]]
8916 !! html/parsoid
8917 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8918 !! end
8919
8920 !! test
8921 Redirect to language (2) (T104918)
8922 !! wikitext
8923 #REDIRECT [[:en:File:Wiki.png]]
8924 !! html/parsoid
8925 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8926 !! end
8927
8928 !! test
8929 Redirect to interwiki (T104918)
8930 !! wikitext
8931 #REDIRECT [[meatball:File:Wiki.png]]
8932 !! html/parsoid
8933 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8934 !! end
8935
8936 !! test
8937 Non-English #REDIRECT
8938 !! options
8939 language=is
8940 !! wikitext
8941 #TILVÍSUN [[Main Page]]
8942 !! html/parsoid
8943 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8944 !! end
8945
8946 !! test
8947 Redirect syntax under text isn't considered a redirect
8948 !! wikitext
8949 some text
8950 #redirect [[Main Page]]
8951 !! html/parsoid
8952 <p>some text</p>
8953 <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>
8954 !! end
8955
8956 # FIXME: Should hoist the redirect to the top of the page and ensure there
8957 # is only one.
8958 !! test
8959 New redirect
8960 !! options
8961 parsoid=html2wt
8962 !! html/parsoid
8963 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8964 !! wikitext
8965 Foo
8966 #REDIRECT [[Foo]]
8967 !! end
8968
8969 ##
8970 ## XHTML tidiness
8971 ###
8972
8973 !! test
8974 <br> to <br />
8975 !! wikitext
8976 1<br>2<br />3
8977 !! html
8978 <p>1<br />2<br />3
8979 </p>
8980 !! end
8981
8982 !! test
8983 Broken br tag sanitization
8984 !! wikitext
8985 </br>
8986 !! html/php
8987 <p>&lt;/br&gt;
8988 </p>
8989 !! end
8990
8991 # TODO: Fix html2html mode (bug 51055)!
8992 !! test
8993 Parsoid: Broken br tag recognition
8994 !! options
8995 parsoid=wt2html
8996 !! wikitext
8997 </br>
8998
8999 <br/ >
9000 !! html+tidy
9001 <p><br /></p>
9002 <p><br /></p>
9003 !! end
9004
9005 !! test
9006 Incorrecly removing closing slashes from correctly formed XHTML
9007 !! wikitext
9008 <br style="clear:both;" />
9009 !! html
9010 <p><br style="clear:both;" />
9011 </p>
9012 !! end
9013
9014 !! test
9015 Failing to transform badly formed HTML into correct XHTML
9016 !! wikitext
9017 <br style="clear: left;">
9018 <br style="clear: right;">
9019 <br style="clear: both;">
9020 !! html
9021 <p><br style="clear: left;" />
9022 <br style="clear: right;" />
9023 <br style="clear: both;" />
9024 </p>
9025 !!end
9026
9027 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9028 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9029 !! test
9030 Handling html with a div self-closing tag
9031 !! wikitext
9032 <div title />
9033 <div title/>
9034 <div title/ >
9035 <div title=bar />
9036 <div title=bar/>
9037 <div title=bar/ >
9038 !! html/php
9039 <p>&lt;div title /&gt;
9040 &lt;div title/&gt;
9041 </p>
9042 <div>
9043 <p>&lt;div title=bar /&gt;
9044 &lt;div title=bar/&gt;
9045 </p>
9046 <div title="bar/"></div>
9047 </div>
9048
9049 !! html/parsoid
9050 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9051 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9052 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9053 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9054 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9055 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9056 !! end
9057
9058 !! test
9059 Handling html with a br self-closing tag
9060 !! wikitext
9061 <br title />
9062 <br title/>
9063 <br title/ >
9064 <br title=bar />
9065 <br title=bar/>
9066 <br title=bar/ >
9067 !! html/php
9068 <p><br title="" />
9069 <br title="" />
9070 <br />
9071 <br title="bar" />
9072 <br title="bar" />
9073 <br title="bar/" />
9074 </p>
9075 !! html/parsoid
9076 <p><br title="" />
9077 <br title="" />
9078 <br title="" />
9079 <br title="bar" />
9080 <br title="bar" />
9081 <br title="bar/" />
9082 </p>
9083 !! end
9084
9085 !! test
9086 Horizontal ruler (should it add that extra space?)
9087 !! wikitext
9088 <hr>
9089 <hr >
9090 foo <hr
9091 > bar
9092 !! html+tidy
9093 <hr />
9094 <hr />
9095 <p>foo</p>
9096 <hr />
9097 <p>bar</p>
9098 !! end
9099
9100 !! test
9101 Horizontal ruler -- 4+ dashes render hr
9102 !! wikitext
9103 ----
9104 !! html
9105 <hr />
9106
9107 !! end
9108
9109 !! test
9110 Horizontal ruler -- eats additional dashes on the same line
9111 !! wikitext
9112 ---------
9113 !! html
9114 <hr />
9115
9116 !! end
9117
9118 !! test
9119 Horizontal ruler -- does not collapse dashes on consecutive lines
9120 !! wikitext
9121 ----
9122 ----
9123 !! html
9124 <hr />
9125 <hr />
9126
9127 !! end
9128
9129 !! test
9130 Horizontal ruler -- <4 dashes render as plain text
9131 !! wikitext
9132 ---
9133 !! html
9134 <p>---
9135 </p>
9136 !! end
9137
9138 !! test
9139 Horizontal ruler -- Supports content following dashes on same line
9140 !! wikitext
9141 ---- Foo
9142 !! html
9143 <hr /> Foo
9144
9145 !! html+tidy
9146 <hr />
9147 <p>Foo</p>
9148 !! end
9149
9150 ###
9151 ### Block-level elements
9152 ###
9153 !! test
9154 Common list
9155 !! wikitext
9156 *Common list
9157 * item 2
9158 *item 3
9159 !! html
9160 <ul><li>Common list</li>
9161 <li> item 2</li>
9162 <li>item 3</li></ul>
9163
9164 !! end
9165
9166 !! test
9167 Numbered list
9168 !! wikitext
9169 #Numbered list
9170 #item 2
9171 # item 3
9172 !! html
9173 <ol><li>Numbered list</li>
9174 <li>item 2</li>
9175 <li> item 3</li></ol>
9176
9177 !! end
9178
9179 !! test
9180 Mixed list
9181 !! wikitext
9182 *Mixed list
9183 *# with numbers
9184 ** and bullets
9185 *# and numbers
9186 *bullets again
9187 **bullet level 2
9188 ***bullet level 3
9189 ***#Number on level 4
9190 **bullet level 2
9191 **#Number on level 3
9192 **#Number on level 3
9193 *#number level 2
9194 *Level 1
9195 *** Level 3
9196 #** Level 3, but ordered
9197 !! html
9198 <ul><li>Mixed list
9199 <ol><li> with numbers</li></ol>
9200 <ul><li> and bullets</li></ul>
9201 <ol><li> and numbers</li></ol></li>
9202 <li>bullets again
9203 <ul><li>bullet level 2
9204 <ul><li>bullet level 3
9205 <ol><li>Number on level 4</li></ol></li></ul></li>
9206 <li>bullet level 2
9207 <ol><li>Number on level 3</li>
9208 <li>Number on level 3</li></ol></li></ul>
9209 <ol><li>number level 2</li></ol></li>
9210 <li>Level 1
9211 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9212 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9213
9214 !! end
9215
9216 !! test
9217 1. Nested mixed wikitext and html list
9218 !! wikitext
9219 * hi
9220 * <ul><li>ho</li></ul>
9221 * hi
9222 ** ho
9223 !! html/php
9224 <ul><li> hi</li>
9225 <li> <ul><li>ho</li></ul></li>
9226 <li> hi
9227 <ul><li> ho</li></ul></li></ul>
9228
9229 !! html/parsoid
9230 <ul><li> hi</li>
9231 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9232 <li> hi
9233 <ul><li> ho</li></ul></li></ul>
9234 !! end
9235
9236 !! test
9237 2. Nested mixed wikitext and html list (incompatible)
9238 !! wikitext
9239 ; hi
9240 : {{echo|<li>ho</li>}}
9241 !! html/php
9242 <dl><dt> hi</dt>
9243 <dd> <li>ho</li></dd></dl>
9244
9245 !! html/parsoid
9246 <dl><dt> hi</dt>
9247 <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>
9248 !! end
9249
9250 !! test
9251 Nested lists 1
9252 !! wikitext
9253 *foo
9254 **bar
9255 !! html
9256 <ul><li>foo
9257 <ul><li>bar</li></ul></li></ul>
9258
9259 !! end
9260
9261 !! test
9262 Nested lists 2
9263 !! wikitext
9264 **foo
9265 *bar
9266 !! html
9267 <ul><li><ul><li>foo</li></ul></li>
9268 <li>bar</li></ul>
9269
9270 !! end
9271
9272 !! test
9273 Nested lists 3 (first element empty)
9274 !! wikitext
9275 *
9276 **bar
9277 !! html
9278 <ul><li>
9279 <ul><li>bar</li></ul></li></ul>
9280
9281 !! end
9282
9283 !! test
9284 Nested lists 4 (first element empty)
9285 !! wikitext
9286 **
9287 *bar
9288 !! html
9289 <ul><li><ul><li></li></ul></li>
9290 <li>bar</li></ul>
9291
9292 !! end
9293
9294 !! test
9295 Nested lists 5 (both elements empty)
9296 !! wikitext
9297 **
9298 *
9299 !! html
9300 <ul><li><ul><li></li></ul></li>
9301 <li></li></ul>
9302
9303 !! end
9304
9305 !! test
9306 Nested lists 6 (both elements empty)
9307 !! wikitext
9308 *
9309 **
9310 !! html
9311 <ul><li>
9312 <ul><li></li></ul></li></ul>
9313
9314 !! end
9315
9316 !! test
9317 Nested lists 7 (skip initial nesting levels)
9318 !! wikitext
9319 *** foo
9320 !! html
9321 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9322
9323 !! end
9324
9325 !! test
9326 Nested lists 8 (multiple nesting transitions)
9327 !! wikitext
9328 * foo
9329 *** bar
9330 ** baz
9331 * boo
9332 !! html
9333 <ul><li> foo
9334 <ul><li><ul><li> bar</li></ul></li>
9335 <li> baz</li></ul></li>
9336 <li> boo</li></ul>
9337
9338 !! end
9339
9340 !! test
9341 Nested lists 9 (extension interaction)
9342 !! options
9343 parsoid
9344 !! wikitext
9345 *<references />
9346 !! html/parsoid
9347 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9348 !! end
9349
9350 !! test
9351 1. Lists with start-of-line-transparent tokens before bullets: Comments
9352 !! wikitext
9353 *foo
9354 *<!--cmt-->bar
9355 <!--cmt-->*baz
9356 !! html
9357 <ul><li>foo</li>
9358 <li>bar</li>
9359 <li>baz</li></ul>
9360
9361 !! end
9362
9363 !! test
9364 2. Lists with start-of-line-transparent tokens before bullets: Template close
9365 !! wikitext
9366 *foo {{echo|bar
9367 }}*baz
9368 !! html
9369 <ul><li>foo bar</li>
9370 <li>baz</li></ul>
9371
9372 !! end
9373
9374 !! test
9375 List items are not parsed correctly following a <pre> block (bug 785)
9376 !! wikitext
9377 * <pre>foo</pre>
9378 * <pre>bar</pre>
9379 * zar
9380 !! html/php
9381 <ul><li> <pre>foo</pre></li>
9382 <li> <pre>bar</pre></li>
9383 <li> zar</li></ul>
9384
9385 !! html/parsoid
9386 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9387 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9388 <li> zar</li></ul>
9389 !! end
9390
9391 !! test
9392 List items from template
9393 !! wikitext
9394
9395 {{inner list}}
9396 * item 2
9397
9398 * item 0
9399 {{inner list}}
9400 * item 2
9401
9402 * item 0
9403 * notSOL{{inner list}}
9404 * item 2
9405 !! html
9406 <ul><li> item 1</li>
9407 <li> item 2</li></ul>
9408 <ul><li> item 0</li>
9409 <li> item 1</li>
9410 <li> item 2</li></ul>
9411 <ul><li> item 0</li>
9412 <li> notSOL</li>
9413 <li> item 1</li>
9414 <li> item 2</li></ul>
9415
9416 !! end
9417
9418 !! test
9419 List interrupted by empty line or heading
9420 !! wikitext
9421 * foo
9422
9423 ** bar
9424 == A heading ==
9425 * Another list item
9426 !! html
9427 <ul><li> foo</li></ul>
9428 <ul><li><ul><li> bar</li></ul></li></ul>
9429 <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>
9430 <ul><li> Another list item</li></ul>
9431
9432 !!end
9433
9434 !!test
9435 Multiple list tags generated by templates
9436 !! wikitext
9437 {{echo|<li>}}a
9438 {{echo|<li>}}b
9439 {{echo|<li>}}c
9440 !! html
9441 <li>a
9442 <li>b
9443 <li>c</li>
9444 </li>
9445 </li>
9446
9447 !! html+tidy
9448 <ul>
9449 <li>a</li>
9450 <li>b</li>
9451 <li>c</li>
9452 </ul>
9453 !!end
9454
9455 !!test
9456 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9457 !! wikitext
9458 *a
9459 <!--This line will NOT split the list-->
9460 *b
9461 <!--This line will NOT split the list either-->
9462 *c
9463 <!--foo--> <!----> <!--This line NOT split the list either-->
9464 *d
9465 !! html
9466 <ul><li>a</li>
9467 <li>b</li>
9468 <li>c</li>
9469 <li>d</li></ul>
9470
9471 !!end
9472
9473 !!test
9474 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9475 !! wikitext
9476 *a
9477 <!--This line will NOT split the list-->
9478 *b
9479 <!--This line will NOT split the list either-->
9480 *c
9481 <!--foo--> <!----> <!--This line NOT split the list
9482 either-->
9483 *d
9484 !! html
9485 <ul><li>a</li>
9486 <li>b</li>
9487 <li>c</li>
9488 <li>d</li></ul>
9489
9490 !!end
9491
9492 !!test
9493 Test the li-hack
9494 (The PHP parser relies on Tidy for the hack)
9495 !!options
9496 parsoid=wt2html,wt2wt
9497 !! wikitext
9498 * foo
9499 * <li>li-hack
9500 * {{echo|<li>templated li-hack}}
9501 * <!--foo--> <li> unsupported li-hack with preceding comments
9502
9503 <ul>
9504 <li><li>not a li-hack
9505 </li>
9506 </ul>
9507 !! html+tidy
9508 <ul>
9509 <li>foo</li>
9510 <li>li-hack</li>
9511 <li>templated li-hack</li>
9512 <li>unsupported li-hack with preceding comments</li>
9513 </ul>
9514 <ul>
9515 <li>not a li-hack</li>
9516 </ul>
9517 !!end
9518
9519 !! test
9520 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9521 !! options
9522 parsoid
9523 !! wikitext
9524 # foo
9525 ## bar
9526 * foo
9527 ** bar
9528 : foo
9529 :: bar
9530 !! html
9531 <ol>
9532 <li> foo<ol>
9533 <li> bar</li>
9534 </ol></li>
9535 </ol><ul>
9536 <li> foo<ul>
9537 <li> bar</li>
9538 </ul></li>
9539 </ul><dl>
9540 <dd> foo<dl>
9541 <dd> bar</dd>
9542 </dl></dd>
9543 </dl>
9544 !! end
9545
9546 !! test
9547 Parsoid: Test of whitespace serialization with Templated bullets
9548 !! options
9549 parsoid
9550 !! wikitext
9551 * {{bullet}}
9552 !! html
9553 <ul>
9554 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9555 </ul>
9556 !! end
9557
9558 # ------------------------------------------------------------------------
9559 # The next set of tests are about Parsoid's ability to handle badly nested
9560 # tags (parse, minimize scope of fixup, and roundtrip back)
9561 # ------------------------------------------------------------------------
9562
9563 !! test
9564 Unbalanced closing block tags break a list
9565 (php parser relies on Tidy to fix up)
9566 !! wikitext
9567 <div>
9568 *a</div><div>
9569 *b</div>
9570 !! html+tidy
9571 <div>
9572 <ul>
9573 <li>a</li>
9574 </ul>
9575 </div>
9576 <div>
9577 <ul>
9578 <li>b</li>
9579 </ul>
9580 </div>
9581 !! end
9582
9583 # Parsoid fails this test, but it might be tricky to support properly.
9584 # See bug 68395.
9585 !! test
9586 Unbalanced closing non-block tags don't break a list
9587 (php parser relies on Tidy to fix up)
9588 !! wikitext
9589 <span>
9590 *a</span><span>
9591 *b</span>
9592 !! html/php+tidy
9593 <ul>
9594 <li><span>a</span></li>
9595 <li><span>b</span></li>
9596 </ul>
9597 !! html/parsoid
9598 <span>
9599 <ul>
9600 <li>a<span></span>
9601 </li>
9602 <li>b
9603 </li>
9604 </ul>
9605 </span>
9606 !! end
9607
9608 !! test
9609 Unclosed formatting tags that straddle lists are closed and reopened
9610 (php parser relies on Tidy to fix up)
9611 !! options
9612 parsoid=wt2html,wt2wt,html2html
9613 !! wikitext
9614 # <s> a
9615 # b </s>
9616 !! html/php+tidy
9617 <ol>
9618 <li><s>a</s></li>
9619 <li><s>b</s></li>
9620 </ol>
9621 !! html/parsoid
9622 <ol><li> <s> a</s></li>
9623 <li><s> b </s></li></ol>
9624 !! end
9625
9626 # See bug 68395.
9627 !!test
9628 1. List embedded in a formatting tag
9629 !! wikitext
9630 <small>
9631 * foo
9632 </small>
9633 !! html/php+tidy
9634 <ul>
9635 <li><small>foo</small></li>
9636 </ul>
9637 !! html/parsoid
9638 <small>
9639 <ul>
9640 <li> foo</li>
9641 </ul>
9642 </small>
9643 !!end
9644
9645 ## Ugly Parsoid output here
9646 ## Not sure what the right output is.
9647 !!test
9648 2. List embedded in a formatting tag
9649 !! wikitext
9650 <small>
9651 *a
9652 *b</small>
9653 !! html/php+tidy
9654 <ul>
9655 <li><small>a</small></li>
9656 <li><small>b</small></li>
9657 </ul>
9658 !! html/parsoid
9659 <small></small>
9660 <ul><small>
9661 <li>a</li>
9662 </small>
9663 <li><small>b</small></li>
9664 </ul>
9665 !!end
9666
9667 # Ugly Parsoid and PHP parser output here
9668 # Not sure if we want to make this a test!
9669 #
9670 ## !!test
9671 ## 3. Unclosed formatting tags in list elements
9672 ## !! wikitext
9673 ## *<small>a
9674 ## *<small>b
9675 ## !! html/php+tidy
9676 ## <ul>
9677 ## <li><small>a</small></li>
9678 ## <li><small><small>b</small></small></li>
9679 ## </ul>
9680 ## !! html/parsoid
9681 ## <ul>
9682 ## <li><small>a</small></li>
9683 ## <small>
9684 ## <li><small>b</small></li>
9685 ## </small></ul>
9686 ## !!end
9687
9688 # This is a bug in the PHP parser + tidy combination.
9689 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9690 # and then fostered out of the table by tidy.)
9691 # We believe the Parsoid output to be correct.
9692 !! test
9693 Table with missing opening <tr> tag
9694 !! options
9695 parsoid=wt2html,wt2wt
9696 !! wikitext
9697 <table>
9698 <td>foo</td>
9699 </tr>
9700 </table>
9701 !! html+tidy
9702 <table>
9703 <tr>
9704 <td>foo</td>
9705 </tr>
9706 </table>
9707 !! end
9708
9709 ###
9710 ### Magic Words
9711 ###
9712
9713 # Note that the current date is hard-coded as
9714 # 1970-01-01T00:02:03Z (a Thursday)
9715 # when running parser tests. The timezone is also fixed to GMT, so
9716 # local date will be identical to current date.
9717
9718 !! test
9719 Magic Word: {{CURRENTDAY}}
9720 !! wikitext
9721 {{CURRENTDAY}}
9722 !! html
9723 <p>1
9724 </p>
9725 !! end
9726
9727 !! test
9728 Magic Word: {{CURRENTDAY2}}
9729 !! wikitext
9730 {{CURRENTDAY2}}
9731 !! html
9732 <p>01
9733 </p>
9734 !! end
9735
9736 !! test
9737 Magic Word: {{CURRENTDAYNAME}}
9738 !! wikitext
9739 {{CURRENTDAYNAME}}
9740 !! html
9741 <p>Thursday
9742 </p>
9743 !! end
9744
9745 !! test
9746 Magic Word: {{CURRENTDOW}}
9747 !! wikitext
9748 {{CURRENTDOW}}
9749 !! html
9750 <p>4
9751 </p>
9752 !! end
9753
9754 !! test
9755 Magic Word: {{CURRENTMONTH}}
9756 !! wikitext
9757 {{CURRENTMONTH}}
9758 !! html
9759 <p>01
9760 </p>
9761 !! end
9762
9763 !! test
9764 Magic Word: {{CURRENTMONTH1}}
9765 !! wikitext
9766 {{CURRENTMONTH1}}
9767 !! html
9768 <p>1
9769 </p>
9770 !! end
9771
9772 !! test
9773 Magic Word: {{CURRENTMONTHABBREV}}
9774 !! wikitext
9775 {{CURRENTMONTHABBREV}}
9776 !! html
9777 <p>Jan
9778 </p>
9779 !! end
9780
9781 !! test
9782 Magic Word: {{CURRENTMONTHNAME}}
9783 !! wikitext
9784 {{CURRENTMONTHNAME}}
9785 !! html
9786 <p>January
9787 </p>
9788 !! end
9789
9790 !! test
9791 Magic Word: {{CURRENTMONTHNAMEGEN}}
9792 !! wikitext
9793 {{CURRENTMONTHNAMEGEN}}
9794 !! html
9795 <p>January
9796 </p>
9797 !! end
9798
9799 !! test
9800 Magic Word: {{CURRENTTIME}}
9801 !! wikitext
9802 {{CURRENTTIME}}
9803 !! html
9804 <p>00:02
9805 </p>
9806 !! end
9807
9808 !! test
9809 Magic Word: {{CURRENTHOUR}}
9810 !! wikitext
9811 {{CURRENTHOUR}}
9812 !! html
9813 <p>00
9814 </p>
9815 !! end
9816
9817 !! test
9818 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9819 !! wikitext
9820 {{CURRENTWEEK}}
9821 !! html
9822 <p>1
9823 </p>
9824 !! end
9825
9826 !! test
9827 Magic Word: {{CURRENTYEAR}}
9828 !! wikitext
9829 {{CURRENTYEAR}}
9830 !! html
9831 <p>1970
9832 </p>
9833 !! end
9834
9835 !! test
9836 Magic Word: {{CURRENTTIMESTAMP}}
9837 !! wikitext
9838 {{CURRENTTIMESTAMP}}
9839 !! html
9840 <p>19700101000203
9841 </p>
9842 !! end
9843
9844 !! test
9845 Magic Words LOCAL (UTC)
9846 !! wikitext
9847 * {{LOCALMONTH}}
9848 * {{LOCALMONTH1}}
9849 * {{LOCALMONTHNAME}}
9850 * {{LOCALMONTHNAMEGEN}}
9851 * {{LOCALMONTHABBREV}}
9852 * {{LOCALDAY}}
9853 * {{LOCALDAY2}}
9854 * {{LOCALDAYNAME}}
9855 * {{LOCALYEAR}}
9856 * {{LOCALTIME}}
9857 * {{LOCALHOUR}}
9858 * {{LOCALWEEK}}
9859 * {{LOCALDOW}}
9860 * {{LOCALTIMESTAMP}}
9861 !! html
9862 <ul><li> 01</li>
9863 <li> 1</li>
9864 <li> January</li>
9865 <li> January</li>
9866 <li> Jan</li>
9867 <li> 1</li>
9868 <li> 01</li>
9869 <li> Thursday</li>
9870 <li> 1970</li>
9871 <li> 00:02</li>
9872 <li> 00</li>
9873 <li> 1</li>
9874 <li> 4</li>
9875 <li> 19700101000203</li></ul>
9876
9877 !! end
9878
9879 !! test
9880 Magic Word: {{FULLPAGENAME}}
9881 !! options
9882 title=[[User:Ævar Arnfjörð Bjarmason]]
9883 !! wikitext
9884 {{FULLPAGENAME}}
9885 !! html
9886 <p>User:Ævar Arnfjörð Bjarmason
9887 </p>
9888 !! end
9889
9890 !! test
9891 Magic Word: {{FULLPAGENAMEE}}
9892 !! options
9893 title=[[User:Ævar Arnfjörð Bjarmason]]
9894 !! wikitext
9895 {{FULLPAGENAMEE}}
9896 !! html
9897 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9898 </p>
9899 !! end
9900
9901 !! test
9902 Magic Word: {{TALKSPACE}}
9903 !! options
9904 title=[[User:Ævar Arnfjörð Bjarmason]]
9905 !! wikitext
9906 {{TALKSPACE}}
9907 !! html
9908 <p>User talk
9909 </p>
9910 !! end
9911
9912 !! test
9913 Magic Word: {{TALKSPACE}}, same namespace
9914 !! options
9915 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9916 !! wikitext
9917 {{TALKSPACE}}
9918 !! html
9919 <p>User talk
9920 </p>
9921 !! end
9922
9923 !! test
9924 Magic Word: {{TALKSPACE}}, main namespace
9925 !! options
9926 title=[[Parser Test]]
9927 !! wikitext
9928 {{TALKSPACE}}
9929 !! html
9930 <p>Talk
9931 </p>
9932 !! end
9933
9934 !! test
9935 Magic Word: {{TALKSPACEE}}
9936 !! options
9937 title=[[User:Ævar Arnfjörð Bjarmason]]
9938 !! wikitext
9939 {{TALKSPACEE}}
9940 !! html
9941 <p>User_talk
9942 </p>
9943 !! end
9944
9945 !! test
9946 Magic Word: {{SUBJECTSPACE}}
9947 !! options
9948 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9949 !! wikitext
9950 {{SUBJECTSPACE}}
9951 !! html
9952 <p>User
9953 </p>
9954 !! end
9955
9956 !! test
9957 Magic Word: {{SUBJECTSPACE}}, same namespace
9958 !! options
9959 title=[[User:Ævar Arnfjörð Bjarmason]]
9960 !! wikitext
9961 {{SUBJECTSPACE}}
9962 !! html
9963 <p>User
9964 </p>
9965 !! end
9966
9967 !! test
9968 Magic Word: {{SUBJECTSPACE}}, main namespace
9969 !! options
9970 title=[[Parser Test]]
9971 !! wikitext
9972 {{SUBJECTSPACE}}
9973 !! html
9974
9975 !! end
9976
9977 !! test
9978 Magic Word: {{SUBJECTSPACEE}}
9979 !! options
9980 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9981 !! wikitext
9982 {{SUBJECTSPACEE}}
9983 !! html
9984 <p>User
9985 </p>
9986 !! end
9987
9988 !! test
9989 Magic Word: {{NAMESPACE}}
9990 !! options
9991 title=[[User:Ævar Arnfjörð Bjarmason]]
9992 !! wikitext
9993 {{NAMESPACE}}
9994 !! html
9995 <p>User
9996 </p>
9997 !! end
9998
9999 !! test
10000 Magic Word: {{NAMESPACEE}}
10001 !! options
10002 title=[[User:Ævar Arnfjörð Bjarmason]]
10003 !! wikitext
10004 {{NAMESPACEE}}
10005 !! html
10006 <p>User
10007 </p>
10008 !! end
10009
10010 !! test
10011 Magic Word: {{NAMESPACENUMBER}}
10012 !! options
10013 title=[[User:Ævar Arnfjörð Bjarmason]]
10014 !! wikitext
10015 {{NAMESPACENUMBER}}
10016 !! html
10017 <p>2
10018 </p>
10019 !! end
10020
10021 !! test
10022 Magic Word: {{SUBPAGENAME}}
10023 !! options
10024 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10025 !! wikitext
10026 {{SUBPAGENAME}}
10027 !! html
10028 <p>sub ö
10029 </p>
10030 !! end
10031
10032 !! test
10033 Magic Word: {{SUBPAGENAMEE}}
10034 !! options
10035 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10036 !! wikitext
10037 {{SUBPAGENAMEE}}
10038 !! html
10039 <p>sub_%C3%B6
10040 </p>
10041 !! end
10042
10043 !! test
10044 Magic Word: {{ROOTPAGENAME}}
10045 !! options
10046 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10047 !! wikitext
10048 {{ROOTPAGENAME}}
10049 !! html
10050 <p>Ævar Arnfjörð Bjarmason
10051 </p>
10052 !! end
10053
10054 !! test
10055 Magic Word: {{ROOTPAGENAMEE}}
10056 !! options
10057 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10058 !! wikitext
10059 {{ROOTPAGENAMEE}}
10060 !! html
10061 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10062 </p>
10063 !! end
10064
10065 !! test
10066 Magic Word: {{BASEPAGENAME}}
10067 !! options
10068 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10069 !! wikitext
10070 {{BASEPAGENAME}}
10071 !! html
10072 <p>Ævar Arnfjörð Bjarmason
10073 </p>
10074 !! end
10075
10076 !! test
10077 Magic Word: {{BASEPAGENAMEE}}
10078 !! options
10079 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10080 !! wikitext
10081 {{BASEPAGENAMEE}}
10082 !! html
10083 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10084 </p>
10085 !! end
10086
10087 !! test
10088 Magic Word: {{TALKPAGENAME}}
10089 !! options
10090 title=[[User:Ævar Arnfjörð Bjarmason]]
10091 !! wikitext
10092 {{TALKPAGENAME}}
10093 !! html
10094 <p>User talk:Ævar Arnfjörð Bjarmason
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{TALKPAGENAMEE}}
10100 !! options
10101 title=[[User:Ævar Arnfjörð Bjarmason]]
10102 !! wikitext
10103 {{TALKPAGENAMEE}}
10104 !! html
10105 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10106 </p>
10107 !! end
10108
10109 !! test
10110 Magic Word: {{SUBJECTPAGENAME}}
10111 !! options
10112 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10113 !! wikitext
10114 {{SUBJECTPAGENAME}}
10115 !! html
10116 <p>User:Ævar Arnfjörð Bjarmason
10117 </p>
10118 !! end
10119
10120 !! test
10121 Magic Word: {{SUBJECTPAGENAMEE}}
10122 !! options
10123 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10124 !! wikitext
10125 {{SUBJECTPAGENAMEE}}
10126 !! html
10127 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10128 </p>
10129 !! end
10130
10131 !! test
10132 Magic Word: {{NUMBEROFFILES}}
10133 !! wikitext
10134 {{NUMBEROFFILES}}
10135 !! html
10136 <p>7
10137 </p>
10138 !! end
10139
10140 !! test
10141 Magic Word: {{PAGENAME}}
10142 !! options
10143 title=[[User:Ævar Arnfjörð Bjarmason]]
10144 !! wikitext
10145 {{PAGENAME}}
10146 !! html
10147 <p>Ævar Arnfjörð Bjarmason
10148 </p>
10149 !! end
10150
10151 !! test
10152 Magic Word: {{PAGENAME}} with metacharacters
10153 !! options
10154 title=[['foo & bar = baz']]
10155 !! wikitext
10156 ''{{PAGENAME}}''
10157 !! html/php
10158 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10159 </p>
10160 !! html+tidy
10161 <p><i>'foo &amp; bar = baz'</i></p>
10162 !! end
10163
10164 !! test
10165 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10166 !! options
10167 title=[[*RFC 1234 http://example.com/]]
10168 !! wikitext
10169 {{PAGENAME}}
10170 !! html/php
10171 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10172 </p>
10173 !! html+tidy
10174 <p>*RFC 1234 http://example.com/</p>
10175 !! end
10176
10177 !! test
10178 Magic Word: {{PAGENAMEE}}
10179 !! options
10180 title=[[User:Ævar Arnfjörð Bjarmason]]
10181 !! wikitext
10182 {{PAGENAMEE}}
10183 !! html
10184 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10185 </p>
10186 !! end
10187
10188 !! test
10189 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10190 !! options
10191 title=[[*RFC 1234 http://example.com/]]
10192 !! wikitext
10193 {{PAGENAMEE}}
10194 !! html/php
10195 <p>&#42;RFC_1234_http&#58;//example.com/
10196 </p>
10197 !! html+tidy
10198 <p>*RFC_1234_http://example.com/</p>
10199 !! end
10200
10201 !! test
10202 Magic Word: {{REVISIONID}}
10203 !! wikitext
10204 {{REVISIONID}}
10205 !! html
10206 <p>1337
10207 </p>
10208 !! end
10209
10210 !! test
10211 Magic Word: {{SCRIPTPATH}}
10212 !! wikitext
10213 {{SCRIPTPATH}}
10214 !! html
10215
10216 !! end
10217
10218 !! test
10219 Magic Word: {{STYLEPATH}}
10220 !! wikitext
10221 {{STYLEPATH}}
10222 !! html
10223 <p>/skins
10224 </p>
10225 !! end
10226
10227 !! test
10228 Magic Word: {{SERVER}}
10229 !! wikitext
10230 {{SERVER}}
10231 !! html
10232 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10233 </p>
10234 !! end
10235
10236 !! test
10237 Magic Word: {{SERVERNAME}}
10238 !! wikitext
10239 {{SERVERNAME}}
10240 !! html
10241 <p>example.org
10242 </p>
10243 !! end
10244
10245 !! test
10246 Magic Word: {{SITENAME}}
10247 !! wikitext
10248 {{SITENAME}}
10249 !! html
10250 <p>MediaWiki
10251 </p>
10252 !! end
10253
10254 !! test
10255 Case-sensitive magic words, when cased differently, should just be template transclusions
10256 !! wikitext
10257 {{CurrentMonth}}
10258 {{currentday}}
10259 {{cURreNTweEK}}
10260 {{currentHour}}
10261 !! html
10262 <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>
10263 <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>
10264 <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>
10265 <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>
10266 </p>
10267 !! end
10268
10269 !! test
10270 Case-insensitive magic words should still work with weird casing.
10271 !! wikitext
10272 {{sErVeRNaMe}}
10273 {{LCFirst:AOEU}}
10274 {{ucFIRST:aoeu}}
10275 {{SERver}}
10276 !! html
10277 <p>example.org
10278 aOEU
10279 Aoeu
10280 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10281 </p>
10282 !! end
10283
10284 # From plwiki:PLOS_ONE
10285 !! test
10286 Parsoid: Page property magic word with magic word contents
10287 !! wikitext
10288 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10289 !! html/parsoid
10290 <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>"}]]}'/>
10291 !! end
10292
10293 !! test
10294 Parsoid: Template-generated DISPLAYTITLE
10295 !! wikitext
10296 {{{{echo|DISPLAYTITLE}}:Foo}}
10297 !! html/parsoid
10298 <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}}]}'/>
10299 !! end
10300
10301 !! test
10302 Namespace 1 {{ns:1}}
10303 !! wikitext
10304 {{ns:1}}
10305 !! html
10306 <p>Talk
10307 </p>
10308 !! end
10309
10310 !! test
10311 Namespace 1 {{ns:01}}
10312 !! wikitext
10313 {{ns:01}}
10314 !! html
10315 <p>Talk
10316 </p>
10317 !! end
10318
10319 !! test
10320 Namespace 0 {{ns:0}} (bug 4783)
10321 !! wikitext
10322 {{ns:0}}
10323 !! html
10324
10325 !! end
10326
10327 !! test
10328 Namespace 0 {{ns:00}} (bug 4783)
10329 !! wikitext
10330 {{ns:00}}
10331 !! html
10332
10333 !! end
10334
10335 !! test
10336 Namespace -1 {{ns:-1}}
10337 !! wikitext
10338 {{ns:-1}}
10339 !! html
10340 <p>Special
10341 </p>
10342 !! end
10343
10344 !! test
10345 Namespace User {{ns:User}}
10346 !! wikitext
10347 {{ns:User}}
10348 !! html
10349 <p>User
10350 </p>
10351 !! end
10352
10353 !! test
10354 Namespace User talk {{ns:User_talk}}
10355 !! wikitext
10356 {{ns:User_talk}}
10357 !! html
10358 <p>User talk
10359 </p>
10360 !! end
10361
10362 !! test
10363 Namespace User talk {{ns:uSeR tAlK}}
10364 !! wikitext
10365 {{ns:uSeR tAlK}}
10366 !! html
10367 <p>User talk
10368 </p>
10369 !! end
10370
10371 !! test
10372 Namespace File {{ns:File}}
10373 !! wikitext
10374 {{ns:File}}
10375 !! html
10376 <p>File
10377 </p>
10378 !! end
10379
10380 !! test
10381 Namespace File {{ns:Image}}
10382 !! wikitext
10383 {{ns:Image}}
10384 !! html
10385 <p>File
10386 </p>
10387 !! end
10388
10389 !! test
10390 Namespace (lang=de) Benutzer {{ns:User}}
10391 !! options
10392 language=de
10393 !! wikitext
10394 {{ns:User}}
10395 !! html
10396 <p>Benutzer
10397 </p>
10398 !! end
10399
10400 !! test
10401 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10402 !! options
10403 language=de
10404 !! wikitext
10405 {{ns:3}}
10406 !! html
10407 <p>Benutzer Diskussion
10408 </p>
10409 !! end
10410
10411 !! test
10412 Urlencode
10413 !! wikitext
10414 {{urlencode:hi world?!}}
10415 {{urlencode:hi world?!|WIKI}}
10416 {{urlencode:hi world?!|PATH}}
10417 {{urlencode:hi world?!|QUERY}}
10418 !! html/php
10419 <p>hi+world%3F%21
10420 hi_world%3F!
10421 hi%20world%3F%21
10422 hi+world%3F%21
10423 </p>
10424 !! end
10425
10426 !! test
10427 Magic Word: prioritize type info over data-parsoid
10428 !! options
10429 parsoid=html2wt
10430 !! html/parsoid
10431 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10432 !! wikitext
10433 __FORCETOC__
10434 !! end
10435
10436 !! test
10437 Magic Word: serialize on separate line (parsoid)
10438 !! options
10439 parsoid=wt2wt,html2wt
10440 !! wikitext
10441 foo
10442 __NOTOC__
10443 bar
10444 !! html/parsoid
10445 foo<meta property="mw:PageProp/notoc"/>bar
10446 !! end
10447
10448 !! test
10449 Magic Word: rt non-english wikis
10450 !! options
10451 parsoid=wt2wt
10452 language=de
10453 !! wikitext
10454 __NOEDITSECTION__
10455 !! html/parsoid
10456 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10457 !! end
10458
10459 !!test
10460 __proto__ is treated as normal wikitext (T105997)
10461 !!wikitext
10462 __proto__
10463 !!html
10464 <p>__proto__
10465 </p>
10466 !!end
10467
10468 ###
10469 ### Magic links
10470 ###
10471 !! test
10472 Magic links: internal link to RFC (bug 479)
10473 !! wikitext
10474 [[RFC 123]]
10475 !! html/php
10476 <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>
10477 </p>
10478 !! html/parsoid
10479 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10480 !! end
10481
10482 !! test
10483 Magic links: RFC (bug 479)
10484 !! wikitext
10485 RFC 822
10486 !! html/php
10487 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10488 </p>
10489 !! html/parsoid
10490 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10491 !! end
10492
10493 !! test
10494 Magic links: RFC (bug 65278)
10495 !! wikitext
10496 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10497 !! html/php
10498 <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.
10499 </p>
10500 !! html/parsoid
10501 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10502 !! end
10503
10504 !! test
10505 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10506 !! wikitext
10507 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10508 RFC
10509 822
10510 !! html/php
10511 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10512 RFC
10513 822
10514 </p>
10515 !! html/parsoid
10516 <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>
10517 RFC
10518 822</p>
10519 !! end
10520
10521 !! test
10522 Magic links: ISBN (bug 1937)
10523 !! wikitext
10524 ISBN 0-306-40615-2
10525 !! html/php
10526 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10527 </p>
10528 !! html/parsoid
10529 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10530 !! end
10531
10532 !! test
10533 Magic links: ISBN (bug 65278)
10534 !! wikitext
10535 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10536 !! html/php
10537 <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.
10538 </p>
10539 !! html/parsoid
10540 <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>
10541 !! end
10542
10543 !! test
10544 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10545 !! wikitext
10546 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10547 ISBN
10548 9780316098113
10549 ISBN 978
10550 0316098113
10551 !! html/php
10552 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10553 ISBN
10554 9780316098113
10555 ISBN 978
10556 0316098113
10557 </p>
10558 !! html/parsoid
10559 <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>
10560 ISBN
10561 9780316098113
10562 ISBN 978
10563 0316098113</p>
10564 !! end
10565
10566 !! test
10567 Magic links: PMID incorrectly converts space to underscore
10568 !! wikitext
10569 PMID 1234
10570 !! html/php
10571 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10572 </p>
10573 !! html/parsoid
10574 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10575 !! end
10576
10577 !! test
10578 Magic links: PMID (bug 65278)
10579 !! wikitext
10580 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10581 !! html/php
10582 <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.
10583 </p>
10584 !! html/parsoid
10585 <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>
10586 !! end
10587
10588 !! test
10589 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10590 !! wikitext
10591 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10592 PMID
10593 1234
10594 !! html/php
10595 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10596 PMID
10597 1234
10598 </p>
10599 !! html/parsoid
10600 <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>
10601 PMID
10602 1234</p>
10603 !! end
10604
10605 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10606 # since these are ExtLinkText, not MagicLinkText
10607 !! test
10608 Magic links: use appropriate serialization for "almost" magic links.
10609 !! wikitext
10610 X[[Special:BookSources/0978739256|foo]]
10611
10612 X[//tools.ietf.org/html/rfc1234 foo]
10613 !! html/php
10614 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10615 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10616 </p>
10617 !! html/parsoid
10618 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10619 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10620 !! end
10621
10622 !! test
10623 Magic links: All disabled (T47942)
10624 !! options
10625 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10626 !! wikitext
10627 ISBN 0-306-40615-2
10628 PMID 1234
10629 RFC 4321
10630 !! html/php
10631 <p>ISBN 0-306-40615-2
10632 PMID 1234
10633 RFC 4321
10634 </p>
10635 !! end
10636
10637 ###
10638 ### Templates
10639 ####
10640
10641 !! test
10642 Nonexistent template
10643 !! wikitext
10644 {{thistemplatedoesnotexist}}
10645 !! html
10646 <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>
10647 </p>
10648 !! end
10649
10650 !! test
10651 Template with invalid target containing tags
10652 !! wikitext
10653 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10654 !! html
10655 <p>{{a<b>b</b>|foo|a=b|a = b}}
10656 </p>
10657 !! end
10658
10659 !! test
10660 Template with invalid target containing unclosed tag
10661 !! wikitext
10662 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10663 !! html
10664 <p>{{a<b>|foo|a=b|a = b}}</b>
10665 </p>
10666 !! end
10667
10668 !! test
10669 Template with invalid target containing wikilink
10670 !! wikitext
10671 {{[[Main Page]]}}
10672 !! html/php
10673 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10674 </p>
10675 !! html/parsoid
10676 <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>
10677 !! end
10678
10679 !! test
10680 Template with just whitespace in it, bug #68421
10681 !! wikitext
10682 {{echo|{{ }}}}
10683 !! html/parsoid
10684 <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>
10685 !! end
10686
10687 !! article
10688 Template:test
10689 !! text
10690 This is a test template
10691 !! endarticle
10692
10693 !! test
10694 Simple template
10695 !! wikitext
10696 {{test}}
10697 !! html
10698 <p>This is a test template
10699 </p>
10700 !! end
10701
10702 !! test
10703 Template with explicit namespace
10704 !! wikitext
10705 {{Template:test}}
10706 !! html
10707 <p>This is a test template
10708 </p>
10709 !! end
10710
10711
10712 !! article
10713 Template:paramtest
10714 !! text
10715 This is a test template with parameter {{{param}}}
10716 !! endarticle
10717
10718 !! test
10719 Template parameter
10720 !! wikitext
10721 {{paramtest|param=foo}}
10722 !! html
10723 <p>This is a test template with parameter foo
10724 </p>
10725 !! end
10726
10727 !! article
10728 Template:paramtestnum
10729 !! text
10730 [[{{{1}}}|{{{2}}}]]
10731 !! endarticle
10732
10733 !! test
10734 Template unnamed parameter
10735 !! wikitext
10736 {{paramtestnum|Main Page|the main page}}
10737 !! html
10738 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10739 </p>
10740 !! end
10741
10742 !! article
10743 Template:templatesimple
10744 !! text
10745 (test)
10746 !! endarticle
10747
10748 !! article
10749 Template:templateredirect
10750 !! text
10751 #redirect [[Template:templatesimple]]
10752 !! endarticle
10753
10754 !! article
10755 Template:templateasargtestnum
10756 !! text
10757 {{{{{1}}}}}
10758 !! endarticle
10759
10760 !! article
10761 Template:templateasargtest
10762 !! text
10763 {{template{{{templ}}}}}
10764 !! endarticle
10765
10766 !! article
10767 Template:templateasargtest2
10768 !! text
10769 {{{{{templ}}}}}
10770 !! endarticle
10771
10772 !! test
10773 Template with template name as unnamed argument
10774 !! wikitext
10775 {{templateasargtestnum|templatesimple}}
10776 !! html
10777 <p>(test)
10778 </p>
10779 !! end
10780
10781 !! test
10782 Template with template name as argument
10783 !! wikitext
10784 {{templateasargtest|templ=simple}}
10785 !! html
10786 <p>(test)
10787 </p>
10788 !! end
10789
10790 !! test
10791 Template with template name as argument (2)
10792 !! wikitext
10793 {{templateasargtest2|templ=templatesimple}}
10794 !! html
10795 <p>(test)
10796 </p>
10797 !! end
10798
10799 !! article
10800 Template:templateasargtestdefault
10801 !! text
10802 {{{{{templ|templatesimple}}}}}
10803 !! endarticle
10804
10805 !! article
10806 Template:templa
10807 !! text
10808 '''templ'''
10809 !! endarticle
10810
10811 !! test
10812 Template with default value
10813 !! wikitext
10814 {{templateasargtestdefault}}
10815 !! html
10816 <p>(test)
10817 </p>
10818 !! end
10819
10820 !! test
10821 Template with default value (value set)
10822 !! wikitext
10823 {{templateasargtestdefault|templ=templa}}
10824 !! html
10825 <p><b>templ</b>
10826 </p>
10827 !! end
10828
10829 !! test
10830 Template redirect
10831 !! wikitext
10832 {{templateredirect}}
10833 !! html/php
10834 <p>(test)
10835 </p>
10836 !! html/parsoid
10837 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10838 !! end
10839
10840 !! test
10841 Template with argument in separate line
10842 !! wikitext
10843 {{ templateasargtest |
10844 templ = simple }}
10845 !! html
10846 <p>(test)
10847 </p>
10848 !! end
10849
10850 !! test
10851 Template with complex template as argument
10852 !! wikitext
10853 {{paramtest|
10854 param ={{ templateasargtest |
10855 templ = simple }}}}
10856 !! html
10857 <p>This is a test template with parameter (test)
10858 </p>
10859 !! end
10860
10861 !! test
10862 Template with thumb image (with link in description)
10863 !! wikitext
10864 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10865 !! html/php
10866 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>
10867
10868 !! html+tidy
10869 <p>This is a test template with parameter</p>
10870 <div class="thumb tright">
10871 <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>
10872 <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>
10873 </div>
10874 </div>
10875 !! html/parsoid
10876 <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>
10877 !! end
10878
10879 !! article
10880 Template:complextemplate
10881 !! text
10882 {{{1}}} {{paramtest|
10883 param ={{{param}}}}}
10884 !! endarticle
10885
10886 !! test
10887 Template with complex arguments
10888 !! wikitext
10889 {{complextemplate|
10890 param ={{ templateasargtest |
10891 templ = simple }}|[[Template:complextemplate|link]]}}
10892 !! html
10893 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10894 </p>
10895 !! end
10896
10897 !! test
10898 BUG 553: link with two variables in a piped link
10899 !! wikitext
10900 {|
10901 |[[{{{1}}}|{{{2}}}]]
10902 |}
10903 !! html/php
10904 <table>
10905 <tr>
10906 <td>[[{{{1}}}|{{{2}}}]]
10907 </td></tr></table>
10908
10909 !! html/parsoid
10910 <table>
10911 <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>
10912 !! end
10913
10914 # See: T2553
10915 !! test
10916 Abort table cell attribute parsing on wikilink
10917 !! wikitext
10918 {|
10919 | testing [[one|two]] | three || four
10920 | testing one two | three || four
10921 | testing="[[one|two]]" | three || four
10922 |}
10923 !! html/php
10924 <table>
10925 <tr>
10926 <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>
10927 <td> four
10928 </td>
10929 <td> three </td>
10930 <td> four
10931 </td>
10932 <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>
10933 <td> four
10934 </td></tr></table>
10935
10936 !! html/parsoid
10937 <table>
10938 <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>
10939 <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>
10940 <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>
10941 </tbody></table>
10942 !! end
10943
10944 !! test
10945 Don't abort table cell attribute parsing if wikilink is found in template arg
10946 !! wikitext
10947 {|
10948 | Test {{#tag:ref|One two "[[three]]" four}}
10949 |}
10950 !! html/parsoid
10951 <table>
10952 <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>
10953 </tbody></table>
10954 !! end
10955
10956 !! test
10957 Magic variable as template parameter
10958 !! wikitext
10959 {{paramtest|param={{SITENAME}}}}
10960 !! html
10961 <p>This is a test template with parameter MediaWiki
10962 </p>
10963 !! end
10964
10965 !! article
10966 Template:linktest
10967 !! text
10968 [[{{{param}}}|link]]
10969 !! endarticle
10970
10971 !! test
10972 Template parameter as link source
10973 !! wikitext
10974 {{linktest|param=Main Page}}
10975 !! html
10976 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10977 </p>
10978 !! end
10979
10980 !!article
10981 Template:paramtest2
10982 !! text
10983 including another template, {{paramtest|param={{{arg}}}}}
10984 !! endarticle
10985
10986 !! test
10987 Template passing argument to another template
10988 !! wikitext
10989 {{paramtest2|arg='hmm'}}
10990 !! html
10991 <p>including another template, This is a test template with parameter 'hmm'
10992 </p>
10993 !! end
10994
10995 !! article
10996 Template:Linktest2
10997 !! text
10998 Main Page
10999 !! endarticle
11000
11001 !! test
11002 Template as link source
11003 !! wikitext
11004 [[{{linktest2}}]]
11005
11006 [[{{linktest2}}|Main Page]]
11007
11008 [[{{linktest2}}]]Page
11009 !! html
11010 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11011 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11012 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11013 </p>
11014 !! end
11015
11016
11017 !! article
11018 Template:loop1
11019 !! text
11020 {{loop2}}
11021 !! endarticle
11022
11023 !! article
11024 Template:loop2
11025 !! text
11026 {{loop1}}
11027 !! endarticle
11028
11029 !! test
11030 Template infinite loop
11031 !! wikitext
11032 {{loop1}}
11033 !! html
11034 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11035 </p>
11036 !! end
11037
11038 !! test
11039 Template from main namespace
11040 !! wikitext
11041 {{:Main Page}}
11042 !! html
11043 <p>blah blah
11044 </p>
11045 !! end
11046
11047 !! article
11048 Template:table
11049 !! text
11050 {|
11051 | 1 || 2
11052 |-
11053 | 3 || 4
11054 |}
11055 !! endarticle
11056
11057 !! test
11058 BUG 529: Template with table, not included at beginning of line
11059 !! wikitext
11060 foo {{table}}
11061 !! html
11062 <p>foo
11063 </p>
11064 <table>
11065 <tr>
11066 <td> 1 </td>
11067 <td> 2
11068 </td></tr>
11069 <tr>
11070 <td> 3 </td>
11071 <td> 4
11072 </td></tr></table>
11073
11074 !! end
11075
11076 !! test
11077 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11078 !! wikitext
11079 foo
11080 {{table}}
11081 !! html
11082 <p>foo
11083 </p>
11084 <table>
11085 <tr>
11086 <td> 1 </td>
11087 <td> 2
11088 </td></tr>
11089 <tr>
11090 <td> 3 </td>
11091 <td> 4
11092 </td></tr></table>
11093
11094 !! end
11095
11096 !! test
11097 BUG 41: Template parameters shown as broken links
11098 !! wikitext
11099 {{{parameter}}}
11100 !! html
11101 <p>{{{parameter}}}
11102 </p>
11103 !! end
11104
11105 !! test
11106 Template with targets containing wikilinks
11107 !! wikitext
11108 {{[[foo]]}}
11109
11110 {{[[{{echo|foo}}]]}}
11111
11112 {{{{echo|[[foo}}]]}}
11113 !! html
11114 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11115 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11116 </p><p>{{[[foo}}]]
11117 </p>
11118 !! end
11119
11120 !! article
11121 Template:''
11122 !! text
11123 bar
11124 !! endarticle
11125
11126 !! test
11127 Templates: Double quotes as template target
11128 !! wikitext
11129 foo {{''}} baz
11130 !! html/php
11131 <p>foo bar baz
11132 </p>
11133 !! html/parsoid
11134 <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
11135 </p>
11136 !! end
11137
11138 ## This test is about making sure Parsoid's data-mw is well formed in the
11139 ## face of multiple templates with intersecting and overlapping ranges. The
11140 ## wikitext itself is wretched.
11141 !! test
11142 Templates with intersecting and overlapping ranges
11143 !! wikitext
11144 {|{{echo|
11145 <p>ha</p>}}
11146 {|{{echo|
11147 <p>ho</p>}}
11148 {{echo|{{!}}hi}}
11149 |}
11150 !! html/php+tidy
11151 <p>ha</p>
11152 <p>ho</p>
11153 <table>
11154 <tr>
11155 <td></td>
11156 </tr>
11157 <tr>
11158 <td>hi</td>
11159 </tr>
11160 </table>
11161 <table>
11162 <tr>
11163 <td></td>
11164 </tr>
11165 </table>
11166 !! html/parsoid
11167 <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":""}]]}'>
11168
11169 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11170
11171 <tbody><tr><td>hi</td></tr>
11172 </tbody></table>
11173 !! end
11174
11175 !! article
11176 Template:MSGNW test
11177 !! text
11178 ''None'' of '''this''' should be
11179 * interpreted
11180 but rather passed unmodified
11181 {{test}}
11182 <gallery>
11183 File:Foobar.jpg
11184 </gallery>
11185 <!-- comment -->
11186 !! endarticle
11187
11188 # hmm, fix this or just deprecate msgnw and document its behavior?
11189 !! test
11190 msgnw keyword
11191 !! wikitext
11192 {{msgnw:MSGNW test}}
11193 !! html/php
11194 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11195 &#42; interpreted
11196 &#32;but rather passed unmodified
11197 &#123;&#123;test&#125;&#125;
11198 &#60;gallery&#62;
11199 File:Foobar.jpg
11200 &#60;/gallery&#62;
11201 &#60;!-- comment --&#62;
11202 </p>
11203 !! end
11204
11205 !! test
11206 int keyword
11207 !! wikitext
11208 {{int:youhavenewmessages|lots of money|not!}}
11209 !! html
11210 <p>You have lots of money (not!).
11211 </p>
11212 !! end
11213
11214 !! test
11215 int keyword - non-existing message
11216 !! wikitext
11217 {{int:var}}
11218 !! html
11219 <p>⧼var⧽
11220 </p>
11221 !! end
11222
11223 !! article
11224 Template:Includes
11225 !! text
11226 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11227 !! endarticle
11228
11229 !! test
11230 <includeonly> and <noinclude> being included
11231 !! wikitext
11232 {{Includes}}
11233 !! html
11234 <p>Foobar
11235 </p>
11236 !! end
11237
11238 !! article
11239 Template:Includes2
11240 !! text
11241 <onlyinclude>Foo</onlyinclude>bar
11242 !! endarticle
11243
11244 !! test
11245 <onlyinclude> being included
11246 !! wikitext
11247 {{Includes2}}
11248 !! html
11249 <p>Foo
11250 </p>
11251 !! end
11252
11253
11254 !! article
11255 Template:Includes3
11256 !! text
11257 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11258 !! endarticle
11259
11260 !! test
11261 <onlyinclude> and <includeonly> being included
11262 !! wikitext
11263 {{Includes3}}
11264 !! html
11265 <p>Foo
11266 </p>
11267 !! end
11268
11269 !! test
11270 <includeonly> and <noinclude> on a page
11271 !! wikitext
11272 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11273 !! html
11274 <p>Foozar
11275 </p>
11276 !! end
11277
11278 !! test
11279 Un-closed <noinclude>
11280 !! wikitext
11281 <noinclude>
11282 !! html
11283 !! end
11284
11285 !! test
11286 <onlyinclude> on a page
11287 !! wikitext
11288 <onlyinclude>Foo</onlyinclude>bar
11289 !! html
11290 <p>Foobar
11291 </p>
11292 !! end
11293
11294 !! test
11295 Un-closed <onlyinclude>
11296 !! wikitext
11297 <onlyinclude>
11298 !! html
11299 !! end
11300
11301 !!test
11302 Self-closed noinclude, includeonly, onlyinclude tags
11303 !! wikitext
11304 <noinclude />
11305 <includeonly />
11306 <onlyinclude />
11307 !! html
11308 <p><br />
11309 </p>
11310 !!end
11311
11312 !!test
11313 Unbalanced includeonly and noinclude tags
11314 !! wikitext
11315 {|
11316 |a</noinclude>
11317 |b</noinclude></noinclude>
11318 |c</noinclude></includeonly>
11319 |d</includeonly></includeonly>
11320 |}
11321 !! html
11322 <table>
11323 <tr>
11324 <td>a
11325 </td>
11326 <td>b
11327 </td>
11328 <td>c&lt;/includeonly&gt;
11329 </td>
11330 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11331 </td></tr></table>
11332
11333 !!end
11334
11335 !! article
11336 Template:Includeonly section
11337 !! text
11338 <includeonly>
11339 ==Includeonly section==
11340 </includeonly>
11341 ==Section T-1==
11342 !!endarticle
11343
11344 !! test
11345 Bug 6563: Edit link generation for section shown by <includeonly>
11346 !! wikitext
11347 {{includeonly section}}
11348 !! html
11349 <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>
11350 <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>
11351
11352 !! end
11353
11354 # Uses same input as the contents of [[Template:Includeonly section]]
11355 !! test
11356 Bug 6563: Section extraction for section shown by <includeonly>
11357 !! options
11358 section=T-2
11359 !! wikitext
11360 <includeonly>
11361 ==Includeonly section==
11362 </includeonly>
11363 ==Section T-2==
11364 !! html
11365 ==Section T-2==
11366 !! end
11367
11368 !! test
11369 Bug 6563: Edit link generation for section suppressed by <includeonly>
11370 !! wikitext
11371 <includeonly>
11372 ==Includeonly section==
11373 </includeonly>
11374 ==Section 1==
11375 !! html
11376 <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>
11377
11378 !! end
11379
11380 !! test
11381 Bug 6563: Section extraction for section suppressed by <includeonly>
11382 !! options
11383 section=1
11384 !! wikitext
11385 <includeonly>
11386 ==Includeonly section==
11387 </includeonly>
11388 ==Section 1==
11389 !! html
11390 ==Section 1==
11391 !! end
11392
11393 !! test
11394 Un-closed <includeonly>
11395 !! wikitext
11396 <includeonly>
11397 !! html/php
11398 !! html/parsoid
11399 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11400 !! end
11401
11402 ## We used to, but no longer wt2wt this test since the default serializer
11403 ## will normalize the include directives to serialize on their own line.
11404 ## Selser will take care of preserving formatting in scenarios where they
11405 ## intermingled with other wikitext.
11406 !! test
11407 Includes and comments at SOL
11408 !! options
11409 parsoid=wt2html,html2html
11410 !! wikitext
11411 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11412
11413 <noinclude>
11414 some
11415 </noinclude>* stuff
11416 * here
11417
11418 <includeonly>can have stuff</includeonly>=== here ===
11419
11420 !! html/php
11421 <h2><span class="mw-headline" id="hu">hu</span></h2>
11422 <p>some
11423 </p>
11424 <ul><li> stuff</li>
11425 <li> here</li></ul>
11426 <h3><span class="mw-headline" id="here">here</span></h3>
11427
11428 !! html/parsoid
11429 <!-- 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>
11430
11431 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11432 <p>some</p>
11433 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11434 <li> here</li></ul>
11435
11436 <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>
11437
11438 !! end
11439
11440 # TODO: test with DOM fragment reuse!
11441 !! test
11442 Parsoid: DOM fragment reuse
11443 !! options
11444 parsoid=wt2wt,wt2html
11445 !! wikitext
11446 a{{echo|b<table></table>c}}d
11447
11448 a{{echo|b
11449 <table></table>
11450 c}}d
11451
11452 {{echo|a
11453
11454 <table></table>
11455
11456 b}}
11457 !! html
11458 <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>
11459
11460 <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">
11461 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11462 </span><p about="#mwt2">cd</p>
11463
11464 <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">
11465
11466 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11467
11468 </span><p about="#mwt3">b</p>
11469 !! end
11470
11471 !! test
11472 Parsoid: Merge double tds (T52603)
11473 !! options
11474 parsoid
11475 !! wikitext
11476 {|
11477 |{{echo|{{!}} foo}}
11478 |}
11479 !! html
11480 <table><tbody>
11481 <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>
11482 </tbody></table>
11483 !! end
11484
11485 !! test
11486 Parsoid: Merge double tds in nested transclusion content (T52603)
11487 !! options
11488 parsoid
11489 !! wikitext
11490 {{echo|<div>}}
11491 {|
11492 |{{echo|{{!}} foo}}
11493 |}
11494 {{echo|</div>}}
11495 !! html
11496 <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}}]}'>
11497 <table><tbody>
11498 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11499 </tbody></table>
11500 </div>
11501 !! end
11502
11503 ###
11504 ### <includeonly> and <noinclude> in attributes
11505 ###
11506 !!test
11507 0. includeonly around the entire attribute
11508 !! wikitext
11509 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11510 !! html
11511 <p><span id="v2">bar</span>
11512 </p>
11513 !!end
11514
11515 !!test
11516 1. includeonly in html attr key
11517 !! wikitext
11518 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11519 !! html
11520 <p><span id="foo">bar</span>
11521 </p>
11522 !!end
11523
11524 !!test
11525 2. includeonly in html attr value
11526 !! wikitext
11527 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11528 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11529 !! html
11530 <p><span id="v1">bar</span>
11531 <span id="v1">bar</span>
11532 </p>
11533 !!end
11534
11535 !!test
11536 3. includeonly in part of an attr value
11537 !! wikitext
11538 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11539 !! html
11540 <p><span style="color:red;">bar</span>
11541 </p>
11542 !!end
11543
11544 !!test
11545 4. includeonly in table attributes
11546 !! wikitext
11547 {|
11548 |- <noinclude>
11549 |-
11550 |a
11551 </noinclude>
11552 |- <includeonly>
11553 |-
11554 |b
11555 </includeonly>
11556 |}
11557 !! html
11558 <table>
11559
11560
11561 <tr>
11562 <td>a
11563 </td></tr>
11564 </table>
11565
11566 !!end
11567
11568 ###
11569 ### Token Stream Patcher tests
11570 ###
11571 ### These tests won't always pass wt2wt and other modes because
11572 ### on serialization, the table will be output on a new line.
11573 ### For now, we are blacklisting them, and using this to test selser.
11574 ###
11575
11576 !!test
11577 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11578 !!options
11579 parsoid=wt2html,wt2wt
11580 !!wikitext
11581 {{echo|}}{| width = '100%'
11582 |foo
11583 |}
11584 !!html/parsoid
11585 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11586 <tbody><tr><td>foo</td></tr>
11587 </tbody></table>
11588 !!end
11589
11590 ## We used to, but no longer wt2wt this test since the default serializer
11591 ## will normalize the include directives to serialize on their own line.
11592 ## Selser will take care of preserving formatting in scenarios where they
11593 ## intermingled with other wikitext.
11594 !!test
11595 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11596 !!options
11597 parsoid=wt2html
11598 !!wikitext
11599 <includeonly>a</includeonly>{| {{{b}}}
11600 |c
11601 |}
11602 !!html/parsoid
11603 <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":""}]]}'>
11604 <tbody><tr><td>c</td></tr>
11605 </tbody></table>
11606 !!end
11607
11608 !! test
11609 Table wikitext syntax outside wiki-tables
11610 !! wikitext
11611 a
11612 |+ not a caption
11613 ! not a table heading
11614 |- not a table row
11615 | not a table cell
11616 | class="foo bar" | baz
11617 b
11618 |}
11619 |-
11620 c
11621 !! html
11622 <p>a
11623 |+ not a caption
11624 ! not a table heading
11625 |- not a table row
11626 | not a table cell
11627 | class="foo bar" | baz
11628 b
11629 |}
11630 |-
11631 c
11632 </p>
11633 !! end
11634
11635 ###
11636 ### Testing parsing of templates where a template arg
11637 ### has the same name as the template itself.
11638 ###
11639
11640 !! article
11641 Template:quote
11642 !! text
11643 {{{quote|{{{1}}}}}}
11644 !! endarticle
11645
11646 !!test
11647 Templates: Template Name/Arg clash: 1. Use of positional param
11648 !! wikitext
11649 {{quote|foo}}
11650 !! html
11651 <p>foo
11652 </p>
11653 !!end
11654
11655 !!test
11656 Templates: Template Name/Arg clash: 2. Use of named param
11657 !! wikitext
11658 {{quote|quote=foo}}
11659 !! html
11660 <p>foo
11661 </p>
11662 !!end
11663
11664 !!test
11665 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11666 !! wikitext
11667 {{quote|quote}}
11668 !! html
11669 <p>quote
11670 </p>
11671 !!end
11672
11673 ###
11674 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11675 ###
11676
11677 !!test
11678 Templates: 1. Simple use
11679 !! wikitext
11680 {{echo|Foo}}
11681 !! html
11682 <p>Foo
11683 </p>
11684 !!end
11685
11686 !!test
11687 Templates: 2. Inside a block tag
11688 !! wikitext
11689 <div>{{echo|Foo}}</div>
11690 <blockquote>{{echo|Foo}}</blockquote>
11691 !! html
11692 <div>Foo</div>
11693 <blockquote>Foo</blockquote>
11694
11695 !! html+tidy
11696 <div>Foo</div>
11697 <blockquote>
11698 <p>Foo</p>
11699 </blockquote>
11700 !!end
11701
11702 !!test
11703 Templates: P-wrapping: 1a. Templates on consecutive lines
11704 !! wikitext
11705 {{echo|Foo}}
11706 {{echo|bar}}
11707 !! html
11708 <p>Foo
11709 bar
11710 </p>
11711 !!end
11712
11713 !!test
11714 Templates: P-wrapping: 1b. Templates on consecutive lines
11715 !! wikitext
11716 Foo
11717
11718 {{echo|bar}}
11719 {{echo|baz}}
11720 !! html
11721 <p>Foo
11722 </p><p>bar
11723 baz
11724 </p>
11725 !!end
11726
11727 !!test
11728 Templates: P-wrapping: 1c. Templates on consecutive lines
11729 !! wikitext
11730 {{echo|Foo}}
11731 {{echo|bar}} <div>baz</div>
11732 !! html
11733 <p>Foo
11734 </p>
11735 bar <div>baz</div>
11736
11737 !! html+tidy
11738 <p>Foo</p>
11739 <p>bar</p>
11740 <div>baz</div>
11741 !! end
11742
11743 !!test
11744 Templates: P-wrapping: 1d. Template preceded by comment-only line
11745 !!options
11746 parsoid
11747 !! wikitext
11748 <!-- foo -->
11749 {{echo|Bar}}
11750 !! html
11751 <!-- foo -->
11752
11753 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11754 !!end
11755
11756 !!test
11757 Templates: Inline Text: 1. Multiple template uses
11758 !! wikitext
11759 {{echo|Foo}}bar{{echo|baz}}
11760 !! html
11761 <p>Foobarbaz
11762 </p>
11763 !!end
11764
11765 !!test
11766 Templates: Inline Text: 2. Back-to-back template uses
11767 !! wikitext
11768 {{echo|Foo}}{{echo|bar}}
11769 !! html
11770 <p>Foobar
11771 </p>
11772 !!end
11773
11774 !!test
11775 Templates: Block Tags: 1. Multiple template uses
11776 !! wikitext
11777 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11778 !! html
11779 <div>Foo</div><div>bar</div><div>baz</div>
11780
11781 !!end
11782
11783 !!test
11784 Templates: Block Tags: 2. Back-to-back template uses
11785 !! wikitext
11786 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11787 !! html
11788 <div>Foo</div><div>bar</div>
11789
11790 !!end
11791
11792 # This is an edge case relating to paragraph wrapping.
11793 !!test
11794 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11795 !! wikitext
11796 {{echo|a
11797 b</p>}}
11798 !! html/parsoid
11799 <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
11800 b</p>
11801 !!end
11802
11803 !!test
11804 Templates: Links: 1. Simple example
11805 !! wikitext
11806 {{echo|[[Foo|bar]]}}
11807 !! html
11808 <p><a href="/wiki/Foo" title="Foo">bar</a>
11809 </p>
11810 !!end
11811
11812 !!test
11813 Templates: Links: 2. Generation of link href
11814 !! wikitext
11815 [[{{echo|Foo}}|bar]]
11816 !! html
11817 <p><a href="/wiki/Foo" title="Foo">bar</a>
11818 </p>
11819 !!end
11820
11821 !!test
11822 Templates: Links: 3. Generation of part of a link href
11823 !! wikitext
11824 [[Fo{{echo|o}}|bar]]
11825
11826 [[Foo{{echo|bar}}]]
11827
11828 [[Foo{{echo|bar}}baz]]
11829
11830 [[Foo{{echo|bar}}|bar]]
11831
11832 [[:Foo{{echo|bar}}]]
11833
11834 [[:Foo{{echo|bar}}|bar]]
11835 !! html
11836 <p><a href="/wiki/Foo" title="Foo">bar</a>
11837 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11838 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11839 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11840 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11841 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11842 </p>
11843 !!end
11844
11845 !!test
11846 Templates: Links: 4. Multiple templates generating link href
11847 !! wikitext
11848 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11849 !! html
11850 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11851 </p>
11852 !!end
11853
11854 !!test
11855 Templates: Links: 5. Generation of link text
11856 !! wikitext
11857 [[Foo|{{echo|bar}}]]
11858 !! html
11859 <p><a href="/wiki/Foo" title="Foo">bar</a>
11860 </p>
11861 !!end
11862
11863 !!test
11864 Templates: Links: 5. Nested templates (only outermost template should be marked)
11865 !! wikitext
11866 {{echo|[[{{echo|Foo}}|bar]]}}
11867 !! html
11868 <p><a href="/wiki/Foo" title="Foo">bar</a>
11869 </p>
11870 !!end
11871
11872 !!test
11873 Templates: HTML Tag: 1. Generation of HTML attr. key
11874 !! wikitext
11875 <div {{echo|style}}="color:red;">foo</div>
11876 !! html
11877 <div style="color:red;">foo</div>
11878
11879 !!end
11880
11881 !!test
11882 Templates: HTML Tag: 2. Generation of HTML attr. value
11883 !! wikitext
11884 <div style={{echo|'color:red;'}}>foo</div>
11885 !! html
11886 <div style="color:red;">foo</div>
11887
11888 !!end
11889
11890 !!test
11891 Templates: HTML Tag: 3. Generation of HTML attr key and value
11892 !! wikitext
11893 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11894 !! html
11895 <div style="color:red;">foo</div>
11896
11897 !!end
11898
11899 !!test
11900 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11901 !! wikitext
11902 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11903 !! html
11904 <div title="This is a long title with just one piece templated">foo</div>
11905
11906 !!end
11907
11908 !!test
11909 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11910 !! wikitext
11911 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11912 !! html
11913 <div title="This is a long title with just one piece templated">foo</div>
11914
11915 !!end
11916
11917 !!test
11918 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11919 !! wikitext
11920 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11921 !! html
11922 <div title="This is a long title with just one piece templated">foo</div>
11923
11924 !!end
11925
11926 # SSS FIXME: While it is great we added support for all this,
11927 # do we want to make this part of the spec? Maybe we want to
11928 # deprecate this kind of usage in the future?
11929 !!test
11930 Templates: HTML Tag: 7. Generation of partial attribute key string
11931 !! wikitext
11932 <div st{{echo|yle}}="color:red;">foo</div>
11933 !! html
11934 <div style="color:red;">foo</div>
11935
11936 !!end
11937
11938 !! test
11939 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11940 !! wikitext
11941 <div {{echo|1=id="v1"}}>bar</div>
11942 !! html
11943 <div id="v1">bar</div>
11944
11945 !!end
11946
11947 !! test
11948 Templates: HTML Tag: 9. Multiple template-generated attributes
11949 !! wikitext
11950 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11951 !! html
11952 <div id="v1" title="foo">bar</div>
11953
11954 !!end
11955
11956 !! test
11957 Templates: Support for templates generating attributes and content
11958 !! wikitext
11959 {| {{mixed_attr_content_template}}
11960 |-
11961 |bar
11962 |}
11963 !! html/php
11964 <table style="color:red;" title="T48811">
11965
11966 <tr>
11967 <td>foo
11968 </td></tr>
11969 <tr>
11970 <td>bar
11971 </td></tr></table>
11972
11973 !! html/parsoid
11974 <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|}"]}'>
11975 <tbody><tr>
11976 <td>foo</td></tr>
11977 <tr>
11978 <td>bar</td></tr>
11979 </tbody></table>
11980 !!end
11981
11982 !! test
11983 1. Entities and nowikis inside templated attributes should be handled correctly
11984 !! wikitext
11985 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11986 !! html/php
11987 <div style="background:#f9f9f9;">foo</div>
11988
11989 !! html/parsoid
11990 <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>
11991 !! end
11992
11993 !! test
11994 2. Entities and nowikis inside templated attributes should be handled correctly
11995 !! wikitext
11996 {|
11997 |{{table_attribs_3}}
11998 |}
11999 !! html/php
12000 <table>
12001 <tr>
12002 <td style="background:#f9f9f9;">Foo
12003 </td></tr></table>
12004
12005 !! html/parsoid
12006 <table>
12007 <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>
12008 </tbody></table>
12009 !! end
12010
12011 !! test
12012 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12013 !! wikitext
12014 {{tbl-start}}
12015 |{{table_attribs_3}}
12016 {{tbl-end}}
12017 !! html/php
12018 <table>
12019 <tr>
12020 <td style="background:#f9f9f9;">Foo
12021 </td></tr></table>
12022
12023 !! html/parsoid
12024 <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}}]}'>
12025 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12026 </tbody></table>
12027 !! end
12028
12029 # T107622
12030 !! test
12031 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12032 !! wikitext
12033 {|
12034 | {{table_attribs_6}} hi
12035 |}
12036 !! html/php
12037 <table>
12038 <tr>
12039 <td style="background: red;"> hi
12040 </td></tr></table>
12041
12042 !! html/parsoid
12043 <table>
12044 <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>
12045 </tbody></table>
12046 !! end
12047
12048 !!test
12049 Templates: HTML Tables: 1. Generating start of a HTML table
12050 !! wikitext
12051 {{echo|<table><tr><td>foo</td>}}</tr></table>
12052 !! html
12053 <table><tr><td>foo</td></tr></table>
12054
12055 !!end
12056
12057 !!test
12058 Templates: HTML Tables: 2a. Generating middle of a HTML table
12059 !! wikitext
12060 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12061 !! html
12062 <table><tr><td>foo</td></tr></table>
12063
12064 !!end
12065
12066 !!test
12067 Templates: HTML Tables: 2b. Generating middle of a HTML table
12068 !! wikitext
12069 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12070 !! html
12071 <table><tr><td>foo</td></tr></table>
12072
12073 !!end
12074
12075 !!test
12076 Templates: HTML Tables: 3. Generating end of a HTML table
12077 !! wikitext
12078 <table><tr>{{echo|<td>foo</td></tr></table>}}
12079 !! html
12080 <table><tr><td>foo</td></tr></table>
12081
12082 !!end
12083
12084 !!test
12085 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12086 !! wikitext
12087 {{echo|<table>}}<tr><td>foo</td></tr></table>
12088 !! html
12089 <table><tr><td>foo</td></tr></table>
12090
12091 !!end
12092
12093 !!test
12094 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12095 !! wikitext
12096 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12097 !! html
12098 <table><tr><td>foo</td></tr></table>
12099
12100 !!end
12101
12102 !!test
12103 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12104 !! wikitext
12105 <table><tr>{{echo|<td>}}foo</td></tr></table>
12106 !! html
12107 <table><tr><td>foo</td></tr></table>
12108
12109 !!end
12110
12111 !!test
12112 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12113 !! wikitext
12114 <table><tr><td>foo{{echo|</td>}}</tr></table>
12115 !! html
12116 <table><tr><td>foo</td></tr></table>
12117
12118 !!end
12119
12120 !!test
12121 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12122 !! wikitext
12123 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12124 !! html
12125 <table><tr><td>foo</td></tr></table>
12126
12127 !!end
12128
12129 !!test
12130 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12131 !! wikitext
12132 <table><tr><td>foo</td></tr>{{echo|</table>}}
12133 !! html
12134 <table><tr><td>foo</td></tr></table>
12135
12136 !!end
12137
12138 !!test
12139 Templates: HTML Tables: 5. Proper fostering of categories from inside
12140 !!options
12141 parsoid=wt2html,wt2wt
12142 !! wikitext
12143 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12144 <!--Two categories (Bug 50330)-->
12145 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12146 !! html
12147 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12148 <!--Two categories (Bug 50330)-->
12149 <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>
12150 !!end
12151
12152 !!test
12153 Templates: Wiki Tables: 1a. Fostering of entire template content
12154 !! wikitext
12155 {|
12156 {{echo|a}}
12157 |}
12158 !! html
12159 <table>
12160 a
12161 <tr><td></td></tr></table>
12162
12163 !! html+tidy
12164 <p>a</p>
12165 <table>
12166 <tr>
12167 <td></td>
12168 </tr>
12169 </table>
12170 !! end
12171
12172 !!test
12173 Templates: Wiki Tables: 1b. Fostering of entire template content
12174 !! wikitext
12175 {|
12176 {{echo|<div>}}
12177 foo
12178 {{echo|</div>}}
12179 |}
12180 !! html
12181 <table>
12182 <div>
12183 <p>foo
12184 </p>
12185 </div>
12186 <tr><td></td></tr></table>
12187
12188 !! html+tidy
12189 <div>
12190 <p>foo</p>
12191 </div>
12192 <table>
12193 <tr>
12194 <td></td>
12195 </tr>
12196 </table>
12197 !! end
12198
12199 !!test
12200 Templates: Wiki Tables: 2. Fostering of partial template content
12201 !! wikitext
12202 {|
12203 {{echo|a
12204 <div>b</div>}}
12205 |}
12206 !! html
12207 <table>
12208 a
12209 <div>b</div>
12210 <tr><td></td></tr></table>
12211
12212 !! html+tidy
12213 <p>a</p>
12214 <div>b</div>
12215 <table>
12216 <tr>
12217 <td></td>
12218 </tr>
12219 </table>
12220 !! end
12221
12222 !!test
12223 Templates: Wiki Tables: 3. td-content via multiple templates
12224 !! wikitext
12225 {|
12226 {{echo|{{pipe}}a}}{{echo|b}}
12227 |}
12228 !! html
12229 <table>
12230 <tr>
12231 <td>ab
12232 </td></tr></table>
12233
12234 !!end
12235
12236 !!test
12237 Templates: Wiki Tables: 4. Templated tags, no content
12238 !! wikitext
12239 {{tbl-start}}
12240 {{tbl-end}}
12241 !! html
12242 <table>
12243 <tr><td></td></tr></table>
12244
12245 !!end
12246
12247 !!test
12248 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12249 !! wikitext
12250 {{tbl-start}}
12251 |foo
12252 {{tbl-end}}
12253 !! html
12254 <table>
12255 <tr>
12256 <td>foo
12257 </td></tr></table>
12258
12259 !!end
12260
12261 !!test
12262 Templates: Wiki Tables: 6. Templated tags, templated 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 ## This test case is very specific to Parsoid's internals
12276 ## and is hence only tested for Parsoid's code. Parsoid uses
12277 ## a <meta> marker tag for <ref> tags and they are expanded
12278 ## much later. We are verifying that this <meta> tag usage
12279 ## doesn't prevent foster parenting.
12280 !!test
12281 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12282 !!wikitext
12283 {{PartialTable}}<ref>foo</ref>
12284 |}
12285
12286 <references />
12287 !!html/parsoid
12288 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
12289 <tbody>
12290 </tbody></table>
12291
12292 <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="#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>
12293 !!end
12294
12295 !! test
12296 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12297 !! wikitext
12298 {{echo|
12299 {{{!}}
12300 {{!}}-}}
12301 <onlyinclude>
12302 |foo
12303 </onlyinclude>
12304 {{!}}}
12305 !! html/parsoid
12306 <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{{!}}}"]}'>
12307 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12308 <tbody><tr>
12309
12310 <td>foo
12311 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12312 </tbody></table>
12313 !! end
12314
12315 !!test
12316 Templates: Lists: Multi-line list-items via templates
12317 !! wikitext
12318 *{{echo|a {{nonexistent|
12319 unused}}}}
12320 *{{echo|b {{nonexistent|
12321 unused}}}}
12322 !! html
12323 <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>
12324 <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>
12325
12326 !!end
12327
12328 !!test
12329 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12330 !! wikitext
12331 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12332 !! html
12333 <p><i>ab</i>c<i>d</i>e
12334 </p>
12335 !!end
12336
12337 !!test
12338 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12339 (PHP parser generates misnested html)
12340 !! wikitext
12341 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12342 !! html/parsoid
12343 <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>
12344 !!end
12345
12346 !!test
12347 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12348 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12349 !! options
12350 parsoid=wt2html,wt2wt
12351 !! wikitext
12352 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12353 !! html
12354 <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>
12355 <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>
12356 <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>
12357 !!end
12358
12359 !!test
12360 Templates: Ugly nesting: 4. Divs opened/closed across templates
12361 !! wikitext
12362 a<div>b{{echo|c</div>d}}e
12363 !! html
12364 a<div>bc</div>de
12365
12366 !! html+tidy
12367 <p>a</p>
12368 <div>bc</div>
12369 <p>de</p>
12370 !! end
12371
12372 !!test
12373 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12374 (Parsoid-centric)
12375 !! options
12376 parsoid
12377 !! wikitext
12378 {|
12379 |{{echo|foo</table>}}
12380 |bar
12381 |}
12382 !! html
12383 <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|}"]}'>
12384
12385 <tbody>
12386 <tr>
12387 <td>foo</td></tr></tbody></table><span about="#mwt1">
12388 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12389 |}</span>
12390 !!end
12391
12392 !!test
12393 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12394 (Parsoid-centric)
12395 !! options
12396 parsoid
12397 !! wikitext
12398 <table>
12399 <tr>
12400 <td>
12401 <table>
12402 <tr>
12403 <td>1. {{echo|foo </table>}}</td>
12404 <td> bar </td>
12405 <td>2. {{echo|baz </table>}}</td>
12406 </tr>
12407 <tr>
12408 <td>abc</td>
12409 </tr>
12410 </table>
12411 </td>
12412 </tr>
12413 <tr>
12414 <td>xyz</td>
12415 </tr>
12416 </table>
12417 !! html
12418 <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>"]}'>
12419 <tbody><tr>
12420 <td>
12421 <table>
12422 <tbody><tr>
12423 <td>1. foo </td></tr></tbody></table></td>
12424 <td> bar </td>
12425 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12426 </span><span about="#mwt2">
12427 </span><span about="#mwt2">
12428 </span><span about="#mwt2">abc</span><span about="#mwt2">
12429 </span><span about="#mwt2">
12430 </span><span about="#mwt2">
12431 </span><span about="#mwt2">
12432 </span><span about="#mwt2">
12433 </span><span about="#mwt2">
12434 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12435 </span><span about="#mwt2">
12436 </span>
12437 !!end
12438
12439 !! test
12440 Templates: Ugly templates: 3. newline-only template parameter
12441 !! wikitext
12442 foo {{echo|
12443 }}
12444 !! html
12445 <p>foo
12446 </p>
12447 !! end
12448
12449 # This looks like a bug: a single newline triggers p/br for some reason.
12450 !! test
12451 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12452 !! wikitext
12453 {{echo|
12454 }}
12455 !! html
12456 <p><br />
12457 </p>
12458 !! end
12459
12460 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12461 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12462 !! test
12463 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12464 !! wikitext
12465 {{echo|<table>}}
12466 {{echo|<div>foo}}
12467 {{echo|</table>}}
12468 !! html/parsoid
12469 <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
12470 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12471 </table>
12472 !! end
12473
12474 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12475 # that are "identical" and generate nesting cycles in the algorithm
12476 !! test
12477 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12478 !! wikitext
12479 {{echo|<table><tr><td><table>}}
12480 {{echo|<div>}}
12481 {{echo|</div>}}
12482 !! html/parsoid
12483 <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"}'>
12484 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12485 </table></td></tr></tbody></table>
12486 !! end
12487
12488 !! test
12489 Templates: Parameters substituted at the top-level
12490 !! wikitext
12491 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12492 !! html/php
12493 <p><i>who</i> me? <b>never!</b>
12494 </p>
12495 !! html/parsoid
12496 <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>
12497 !! end
12498
12499 !!test
12500 Parser Functions: 1. Simple example
12501 !! wikitext
12502 {{uc:foo}}
12503 !! html
12504 <p>FOO
12505 </p>
12506 !!end
12507
12508 !!test
12509 Parser Functions: 2. Nested use (only outermost should be marked up)
12510 !! wikitext
12511 {{uc:{{lc:FOO}}}}
12512 !! html
12513 <p>FOO
12514 </p>
12515 !!end
12516
12517 ###
12518 ### Pre-save transform tests
12519 ###
12520 !! test
12521 pre-save transform: subst:
12522 !! options
12523 pst
12524 !! wikitext
12525 {{subst:test}}
12526 !! html/php
12527 This is a test template
12528 !! end
12529
12530 !! test
12531 pre-save transform: normal template
12532 !! options
12533 pst
12534 !! wikitext
12535 {{test}}
12536 !! html/php
12537 {{test}}
12538 !! end
12539
12540 !! test
12541 pre-save transform: nonexistent template
12542 !! options
12543 pst
12544 !! wikitext
12545 {{thistemplatedoesnotexist}}
12546 !! html/php
12547 {{thistemplatedoesnotexist}}
12548 !! end
12549
12550 !! test
12551 pre-save transform: subst magic variables
12552 !! options
12553 pst
12554 !! wikitext
12555 {{subst:SITENAME}}
12556 !! html/php
12557 MediaWiki
12558 !! end
12559
12560 # This is bug 89, which I fixed. -- wtm
12561 !! test
12562 pre-save transform: subst: templates with parameters
12563 !! options
12564 pst
12565 !! wikitext
12566 {{subst:paramtest|param="something else"}}
12567 !! html/php
12568 This is a test template with parameter "something else"
12569 !! end
12570
12571 !! article
12572 Template:nowikitest
12573 !! text
12574 <nowiki>'''not wiki'''</nowiki>
12575 !! endarticle
12576
12577 !! test
12578 pre-save transform: nowiki in subst (bug 1188)
12579 !! options
12580 pst
12581 !! wikitext
12582 {{subst:nowikitest}}
12583 !! html/php
12584 <nowiki>'''not wiki'''</nowiki>
12585 !! end
12586
12587 !! article
12588 Template:commenttest
12589 !! text
12590 This template has <!-- a comment --> in it.
12591 !! endarticle
12592
12593 !! test
12594 pre-save transform: comment in subst (bug 1936)
12595 !! options
12596 pst
12597 !! wikitext
12598 {{subst:commenttest}}
12599 !! html/php
12600 This template has <!-- a comment --> in it.
12601 !! end
12602
12603 !! test
12604 pre-save transform: unclosed tag
12605 !! options
12606 pst
12607 !! wikitext
12608 <nowiki>'''not wiki'''
12609 !! html/php
12610 <nowiki>'''not wiki'''
12611 !! end
12612
12613 !! test
12614 pre-save transform: mixed tag case
12615 !! options
12616 pst
12617 !! wikitext
12618 <NOwiki>'''not wiki'''</noWIKI>
12619 !! html/php
12620 <NOwiki>'''not wiki'''</noWIKI>
12621 !! end
12622
12623 !! test
12624 pre-save transform: unclosed comment in <nowiki>
12625 !! options
12626 pst
12627 !! wikitext
12628 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12629 !! html/php
12630 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12631 !!end
12632
12633 # Leading @ in this template definition works around a limitation
12634 # in parsoid's parserTests which otherwise strips the <span> from the
12635 # result (confusing it for a template wrapper)
12636 !! article
12637 Template:dangerous
12638 !!text
12639 @<span onmouseover="alert('crap')">Oh no</span>
12640 !!endarticle
12641
12642 !!test
12643 (confirming safety of fix for subst bug 1936)
12644 !! wikitext
12645 {{Template:dangerous}}
12646 !! html
12647 <p>@<span>Oh no</span>
12648 </p>
12649 !! end
12650
12651 !! test
12652 pre-save transform: comment containing gallery (bug 5024)
12653 !! options
12654 pst
12655 !! wikitext
12656 <!-- <gallery>data</gallery> -->
12657 !! html/php
12658 <!-- <gallery>data</gallery> -->
12659 !!end
12660
12661 !! test
12662 pre-save transform: comment containing extension
12663 !! options
12664 pst
12665 !! wikitext
12666 <!-- <tag>data</tag> -->
12667 !! html/php
12668 <!-- <tag>data</tag> -->
12669 !!end
12670
12671 !! test
12672 pre-save transform: comment containing nowiki
12673 !! options
12674 pst
12675 !! wikitext
12676 <!-- <nowiki>data</nowiki> -->
12677 !! html/php
12678 <!-- <nowiki>data</nowiki> -->
12679 !!end
12680
12681 !! test
12682 pre-save transform: <noinclude> in subst (bug 3298)
12683 !! options
12684 pst
12685 !! wikitext
12686 {{subst:Includes}}
12687 !! html/php
12688 Foobar
12689 !! end
12690
12691 !! test
12692 pre-save transform: <onlyinclude> in subst (bug 3298)
12693 !! options
12694 pst
12695 !! wikitext
12696 {{subst:Includes2}}
12697 !! html/php
12698 Foo
12699 !! end
12700
12701 !! article
12702 Template:SubstTest
12703 !!text
12704 {{<includeonly>subst:</includeonly>Includes}}
12705 !! endarticle
12706
12707 !! article
12708 Template:SafeSubstTest
12709 !! text
12710 {{<includeonly>safesubst:</includeonly>Includes}}
12711 !! endarticle
12712
12713 !! test
12714 bug 22297: safesubst: works during PST
12715 !! options
12716 pst
12717 !! wikitext
12718 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12719 !! html/php
12720 FoobarFoobar
12721 !! end
12722
12723 !! test
12724 bug 22297: safesubst: works during normal parse
12725 !! wikitext
12726 {{SafeSubstTest}}
12727 !! html
12728 <p>Foobar
12729 </p>
12730 !! end
12731
12732 !! test
12733 subst: does not work during normal parse
12734 !! wikitext
12735 {{SubstTest}}
12736 !! html
12737 <p>{{subst:Includes}}
12738 </p>
12739 !! end
12740
12741 !! test
12742 pre-save transform: context links ("pipe trick")
12743 !! options
12744 pst
12745 !! wikitext
12746 [[Article (context)|]]
12747 [[Bar:Article|]]
12748 [[:Bar:Article|]]
12749 [[Bar:Article (context)|]]
12750 [[:Bar:Article (context)|]]
12751 [[|Article]]
12752 [[|Article (context)]]
12753 [[Bar:X (Y) Z|]]
12754 [[:Bar:X (Y) Z|]]
12755 !! html/php
12756 [[Article (context)|Article]]
12757 [[Bar:Article|Article]]
12758 [[:Bar:Article|Article]]
12759 [[Bar:Article (context)|Article]]
12760 [[:Bar:Article (context)|Article]]
12761 [[Article]]
12762 [[Article (context)]]
12763 [[Bar:X (Y) Z|X (Y) Z]]
12764 [[:Bar:X (Y) Z|X (Y) Z]]
12765 !! end
12766
12767 !! test
12768 pre-save transform: context links ("pipe trick") with interwiki prefix
12769 !! options
12770 pst
12771 !! wikitext
12772 [[interwiki:Article|]]
12773 [[:interwiki:Article|]]
12774 [[interwiki:Bar:Article|]]
12775 [[:interwiki:Bar:Article|]]
12776 !! html/php
12777 [[interwiki:Article|Article]]
12778 [[:interwiki:Article|Article]]
12779 [[interwiki:Bar:Article|Bar:Article]]
12780 [[:interwiki:Bar:Article|Bar:Article]]
12781 !! end
12782
12783 !! test
12784 pre-save transform: context links ("pipe trick") with parens in title
12785 !! options
12786 pst title=[[Somearticle (context)]]
12787 !! wikitext
12788 [[|Article]]
12789 !! html/php
12790 [[Article (context)|Article]]
12791 !! end
12792
12793 !! test
12794 pre-save transform: context links ("pipe trick") with comma in title
12795 !! options
12796 pst title=[[Someplace, Somewhere]]
12797 !! wikitext
12798 [[|Otherplace]]
12799 [[Otherplace, Elsewhere|]]
12800 [[Otherplace, Elsewhere, Anywhere|]]
12801 !! html/php
12802 [[Otherplace, Somewhere|Otherplace]]
12803 [[Otherplace, Elsewhere|Otherplace]]
12804 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12805 !! end
12806
12807 !! test
12808 pre-save transform: context links ("pipe trick") with parens and comma
12809 !! options
12810 pst title=[[Someplace (IGNORED), Somewhere]]
12811 !! wikitext
12812 [[|Otherplace]]
12813 [[Otherplace (place), Elsewhere|]]
12814 !! html/php
12815 [[Otherplace, Somewhere|Otherplace]]
12816 [[Otherplace (place), Elsewhere|Otherplace]]
12817 !! end
12818
12819 !! test
12820 pre-save transform: context links ("pipe trick") with comma and parens
12821 !! options
12822 pst title=[[Who, me? (context)]]
12823 !! wikitext
12824 [[|Yes, you.]]
12825 [[Me, Myself, and I (1937 song)|]]
12826 !! html/php
12827 [[Yes, you. (context)|Yes, you.]]
12828 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12829 !! end
12830
12831 !! test
12832 pre-save transform: context links ("pipe trick") with namespace
12833 !! options
12834 pst title=[[Ns:Somearticle]]
12835 !! wikitext
12836 [[|Article]]
12837 !! html/php
12838 [[Ns:Article|Article]]
12839 !! end
12840
12841 !! test
12842 pre-save transform: context links ("pipe trick") with namespace and parens
12843 !! options
12844 pst title=[[Ns:Somearticle (context)]]
12845 !! wikitext
12846 [[|Article]]
12847 !! html/php
12848 [[Ns:Article (context)|Article]]
12849 !! end
12850
12851 !! test
12852 pre-save transform: context links ("pipe trick") with namespace and comma
12853 !! options
12854 pst title=[[Ns:Somearticle, Context, Whatever]]
12855 !! wikitext
12856 [[|Article]]
12857 !! html/php
12858 [[Ns:Article, Context, Whatever|Article]]
12859 !! end
12860
12861 !! test
12862 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12863 !! options
12864 pst title=[[Ns:Somearticle, Context (context)]]
12865 !! wikitext
12866 [[|Article]]
12867 !! html/php
12868 [[Ns:Article (context)|Article]]
12869 !! end
12870
12871 !! test
12872 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12873 !! options
12874 pst title=[[Ns:Somearticle (IGNORED), Context]]
12875 !! wikitext
12876 [[|Article]]
12877 !! html/php
12878 [[Ns:Article, Context|Article]]
12879 !! end
12880
12881 !! test
12882 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12883 !! options
12884 pst
12885 !! wikitext
12886 [[Article(context)|]]
12887 [[Bar:Article(context)|]]
12888 [[:Bar:Article(context)|]]
12889 [[|Article(context)]]
12890 [[Bar:X(Y)Z|]]
12891 [[:Bar:X(Y)Z|]]
12892 !! html/php
12893 [[Article(context)|Article]]
12894 [[Bar:Article(context)|Article]]
12895 [[:Bar:Article(context)|Article]]
12896 [[Article(context)]]
12897 [[Bar:X(Y)Z|X(Y)Z]]
12898 [[:Bar:X(Y)Z|X(Y)Z]]
12899 !! end
12900
12901 !! test
12902 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12903 !! options
12904 pst
12905 !! wikitext
12906 [[Article (context)|]]
12907 [[Bar:Article (context)|]]
12908 [[:Bar:Article (context)|]]
12909 [[|Article (context)]]
12910 [[Bar:X (Y) Z|]]
12911 [[:Bar:X (Y) Z|]]
12912 !! html/php
12913 [[Article (context)|Article]]
12914 [[Bar:Article (context)|Article]]
12915 [[:Bar:Article (context)|Article]]
12916 [[Article (context)]]
12917 [[Bar:X (Y) Z|X (Y) Z]]
12918 [[:Bar:X (Y) Z|X (Y) Z]]
12919 !! end
12920
12921 !! test
12922 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12923 !! options
12924 pst
12925 !! wikitext
12926 [[Article(context)|]]
12927 [[Bar:Article(context)|]]
12928 [[:Bar:Article(context)|]]
12929 [[|Article(context)]]
12930 [[Bar:X(Y)Z|]]
12931 [[:Bar:X(Y)Z|]]
12932 !! html/php
12933 [[Article(context)|Article]]
12934 [[Bar:Article(context)|Article]]
12935 [[:Bar:Article(context)|Article]]
12936 [[Article(context)]]
12937 [[Bar:X(Y)Z|X(Y)Z]]
12938 [[:Bar:X(Y)Z|X(Y)Z]]
12939 !! end
12940
12941 !! test
12942 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12943 !! options
12944 pst
12945 !! wikitext
12946 [[Article (context), context|]]
12947 [[Article (context),context|]]
12948 [[Bar:Article (context), context|]]
12949 [[Bar:Article (context),context|]]
12950 [[:Bar:Article (context), context|]]
12951 [[:Bar:Article (context),context|]]
12952 !! html/php
12953 [[Article (context), context|Article]]
12954 [[Article (context),context|Article]]
12955 [[Bar:Article (context), context|Article]]
12956 [[Bar:Article (context),context|Article]]
12957 [[:Bar:Article (context), context|Article]]
12958 [[:Bar:Article (context),context|Article]]
12959 !! end
12960
12961 !! test
12962 pre-save transform: trim trailing empty lines
12963 !! options
12964 pst
12965 !! wikitext
12966 Empty lines are trimmed
12967
12968
12969
12970
12971 !! html/php
12972 Empty lines are trimmed
12973 !! end
12974
12975 !! test
12976 pre-save transform: Signature expansion
12977 !! options
12978 pst
12979 !! wikitext
12980 * ~~~
12981 * <noinclude>~~~</noinclude>
12982 * <includeonly>~~~</includeonly>
12983 * <onlyinclude>~~~</onlyinclude>
12984 !! html/php
12985 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12986 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12987 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12988 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12989 !! end
12990
12991
12992 !! test
12993 pre-save transform: Signature expansion in nowiki tags (bug 93)
12994 !! options
12995 pst disabled
12996 !! wikitext
12997 Shall not expand:
12998
12999 <nowiki>~~~~</nowiki>
13000
13001 <includeonly><nowiki>~~~~</nowiki></includeonly>
13002
13003 <noinclude><nowiki>~~~~</nowiki></noinclude>
13004
13005 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13006
13007 {{subst:Foo}} shall be converted to FOO
13008
13009 As well as inside noinclude/onlyinclude
13010 <noinclude>{{subst:Foo}}</noinclude>
13011 <onlyinclude>{{subst:Foo}}</onlyinclude>
13012
13013 But not inside includeonly
13014 <includeonly>{{subst:Foo}}</includeonly>
13015 !! html/php
13016 Shall not expand:
13017
13018 <nowiki>~~~~</nowiki>
13019
13020 <includeonly><nowiki>~~~~</nowiki></includeonly>
13021
13022 <noinclude><nowiki>~~~~</nowiki></noinclude>
13023
13024 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13025
13026 FOO shall be converted to FOO
13027
13028 As well as inside noinclude/onlyinclude
13029 <noinclude>FOO</noinclude>
13030 <onlyinclude>FOO</onlyinclude>
13031
13032 But not inside includeonly
13033 <includeonly>{{subst:Foo}}</includeonly>
13034 !! end
13035
13036 !! test
13037 Parsoid: Recognize nowiki with trailing space in tags
13038 !! options
13039 parsoid=wt2html
13040 !! wikitext
13041 <nowiki ><div>[[foo]]</nowiki >
13042
13043 a<nowiki / >b
13044
13045 c<nowiki />d
13046
13047 e<nowiki/ >f
13048 !! html
13049 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13050 <p>ab</p>
13051 <p>cd</p>
13052 <p>ef</p>
13053 !! end
13054
13055 !! test
13056 Parsoid: Recognize nowiki with odd capitalization
13057 !! options
13058 parsoid=wt2html
13059 !! wikitext
13060 <noWikI ><div>[[foo]]</Nowiki >
13061 !! html
13062 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13063 !! end
13064
13065
13066 !! test
13067 Parsoid: Escape nowiki with trailing space in tags
13068 !! options
13069 parsoid=html2wt
13070 !! html/parsoid
13071 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13072 <p>a&lt;nowiki /&gt;b</p>
13073 <p>c&lt;nowiki/ &gt;d</p>
13074 !! wikitext
13075 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13076
13077 a&lt;nowiki /&gt;b
13078
13079 c&lt;nowiki/ &gt;d
13080 !! end
13081
13082 !! test
13083 Parsoid: Escape weird noWikI capitalizations
13084 !! options
13085 parsoid=html2wt
13086 !! html/parsoid
13087 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13088 !! wikitext
13089 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13090 !! end
13091
13092 ###
13093 ### Message transform tests
13094 ###
13095 !! test
13096 message transform: magic variables
13097 !! options
13098 msg
13099 !! wikitext
13100 {{SITENAME}}
13101 !! html
13102 MediaWiki
13103 !! end
13104
13105 !! test
13106 message transform: should not transform wiki markup
13107 !! options
13108 msg
13109 !! wikitext
13110 ''test''
13111 !! html
13112 ''test''
13113 !! end
13114
13115 !! test
13116 message transform: <noinclude> in transcluded template (bug 4926)
13117 !! options
13118 msg
13119 !! wikitext
13120 {{Includes}}
13121 !! html
13122 Foobar
13123 !! end
13124
13125 !! test
13126 message transform: <onlyinclude> in transcluded template (bug 4926)
13127 !! options
13128 msg
13129 !! wikitext
13130 {{Includes2}}
13131 !! html
13132 Foo
13133 !! end
13134
13135 !! test
13136 {{#special:}} page name, known
13137 !! options
13138 msg
13139 !! wikitext
13140 {{#special:Recentchanges}}
13141 !! html
13142 Special:RecentChanges
13143 !! end
13144
13145 !! test
13146 {{#special:}} page name with subpage, known
13147 !! options
13148 msg
13149 !! wikitext
13150 {{#special:Recentchanges/param}}
13151 !! html
13152 Special:RecentChanges/param
13153 !! end
13154
13155 !! test
13156 {{#special:}} page name, unknown
13157 !! options
13158 msg
13159 !! wikitext
13160 {{#special:foobar nonexistent}}
13161 !! html
13162 Special:Foobar nonexistent
13163 !! end
13164
13165 !! test
13166 {{#speciale:}} page name, known
13167 !! options
13168 msg
13169 !! wikitext
13170 {{#speciale:Recentchanges}}
13171 !! html
13172 Special:RecentChanges
13173 !! end
13174
13175 !! test
13176 {{#speciale:}} page name with subpage, known
13177 !! options
13178 msg
13179 !! wikitext
13180 {{#speciale:Recentchanges/param}}
13181 !! html
13182 Special:RecentChanges/param
13183 !! end
13184
13185 !! test
13186 {{#speciale:}} page name, unknown
13187 !! options
13188 msg
13189 !! wikitext
13190 {{#speciale:foobar nonexistent}}
13191 !! html
13192 Special:Foobar_nonexistent
13193 !! end
13194
13195 ###
13196 ### Images
13197 ###
13198 ### For Parsoid-specific tests, see
13199 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13200
13201 !! test
13202 Simple image
13203 !! options
13204 parsoid=wt2html,wt2wt,html2html
13205 !! wikitext
13206 [[Image:foobar.jpg]]
13207 !! html/php
13208 <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>
13209 </p>
13210 !! html/parsoid
13211 <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>
13212 !! end
13213
13214 !! test
13215 Simple image (using File: namespace, now canonical)
13216 !! wikitext
13217 [[File:Foobar.jpg]]
13218 !! html/php
13219 <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>
13220 </p>
13221 !! html/parsoid
13222 <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>
13223 !! end
13224
13225 !! test
13226 Right-aligned image
13227 !! wikitext
13228 [[File:Foobar.jpg|right]]
13229 !! html/php
13230 <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>
13231
13232 !! html/parsoid
13233 <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>
13234 !! end
13235
13236 !! test
13237 Image with caption
13238 !! wikitext
13239 [[File:Foobar.jpg|right|Caption text]]
13240 !! html/php
13241 <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>
13242
13243 !! html/parsoid
13244 <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>
13245 !! end
13246
13247 !! test
13248 Image with caption, bug 53312 #1
13249 !! wikitext
13250 [[File:Foobar.jpg|right|Caption page stuff]]
13251 !! html/php
13252 <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>
13253
13254 !! html/parsoid
13255 <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>
13256 !! end
13257
13258 !! test
13259 Image with caption, bug 53312 #2
13260 !! wikitext
13261 [[File:Foobar.jpg|right|Caption page=]]
13262 !! html/php
13263 <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>
13264
13265 !! html/parsoid
13266 <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>
13267 !! end
13268
13269 !! test
13270 Image with caption, bug 53312 #3
13271 !! wikitext
13272 [[File:Foobar.jpg|right|Caption page=stuff]]
13273 !! html/php
13274 <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>
13275
13276 !! html/parsoid
13277 <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>
13278 !! end
13279
13280 !! test
13281 Allow empty links in image captions (Bug 60753)
13282 !! options
13283 thumbsize=220
13284 !! wikitext
13285 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13286 [[]]
13287 [[Link2]]
13288 ]]
13289 !! html/php
13290 <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>
13291
13292 !! html/parsoid
13293 <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>
13294 [[]]
13295 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13296 </figcaption></figure>
13297 !! end
13298
13299 !! test
13300 Titles in unlinked images (T23454)
13301 !! wikitext
13302 [[File:Foobar.jpg|link=|stuff]]
13303 !! html/php
13304 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13305 </p>
13306 !! end
13307
13308 !! test
13309 Link with empty target
13310 !! wikitext
13311 [[]]
13312 !! html
13313 <p>[[]]
13314 </p>
13315 !! end
13316
13317 !! test
13318 Image with link trail
13319 !! wikitext
13320 Linktrails should not work for images: [[File:Foobar.jpg]]s
13321 !! html/php
13322 <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
13323 </p>
13324 !! html/parsoid
13325 <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>
13326 !! end
13327
13328 !! test
13329 Image with empty attribute
13330 !! options
13331 parsoid=wt2html,wt2wt,html2html
13332 !! wikitext
13333 [[File:Foobar.jpg|right||Caption text]]
13334 !! html/php
13335 <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>
13336
13337 !! html/parsoid
13338 <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>
13339 !! end
13340
13341 !! test
13342 1. Block image with individual attributes from templates
13343 !! wikitext
13344 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13345 !! html/php
13346 <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>
13347
13348 !! html/parsoid
13349 <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>
13350 !! end
13351
13352 !! test
13353 2. Block Image with individual attributes from templates
13354 !! wikitext
13355 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13356 !! html/php
13357 <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>
13358
13359 !! html/parsoid
13360 <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>
13361 !! end
13362
13363 !! test
13364 3. Inline image with individual attributes from templates
13365 !! wikitext
13366 [[File:Foobar.jpg|{{echo|50px}}]]
13367 !! html/php
13368 <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>
13369 </p>
13370 !! html/parsoid
13371 <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>
13372 !! end
13373
13374 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13375 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13376 !! test
13377 Image with multiple attributes from the same template
13378 !! wikitext
13379 [[File:Foobar.jpg|{{image_attribs}}]]
13380 !! html/php
13381 <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>
13382
13383 !! html/parsoid
13384 <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>
13385 !! end
13386
13387 !! test
13388 Image with link tails
13389 !! options
13390 thumbsize=220
13391 !! wikitext
13392 123[[File:Foobar.jpg]]456
13393 123[[File:Foobar.jpg|right]]456
13394 123[[File:Foobar.jpg|thumb]]456
13395 !! html/php
13396 <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
13397 </p>
13398 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
13399 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
13400
13401 !! html/php+tidy
13402 <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>
13403 <p>123</p>
13404 <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>
13405 <p>456 123</p>
13406 <div class="thumb tright">
13407 <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>
13408 <div class="thumbcaption">
13409 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13410 </div>
13411 </div>
13412 </div>
13413 <p>456</p>
13414 !! html/parsoid
13415 <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>
13416 <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>
13417 <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>
13418 !! end
13419
13420 !! test
13421 Image with multiple captions -- only last one is accepted
13422 !! wikitext
13423 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13424 !! html/php
13425 <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>
13426
13427 !! html/parsoid
13428 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
13429 !! end
13430
13431 !! test
13432 Image with multiple widths -- use last
13433 !! wikitext
13434 [[File:Foobar.jpg|200px|300px|caption]]
13435 !! html/php
13436 <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>
13437 </p>
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 !! test
13443 Image with multiple alignments -- use first (bug 48664)
13444 !! options
13445 thumbsize=220
13446 !! wikitext
13447 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13448
13449 [[File:Foobar.jpg|middle|text-top|caption]]
13450 !! html/php
13451 <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>
13452 <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>
13453 </p>
13454 !! html/parsoid
13455 <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>
13456 <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>
13457 !! end
13458
13459 !! test
13460 Image with width attribute at different positions
13461 !! wikitext
13462 [[File:Foobar.jpg|200px|right|Caption]]
13463 [[File:Foobar.jpg|right|200px|Caption]]
13464 [[File:Foobar.jpg|right|Caption|200px]]
13465 !! html/php
13466 <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>
13467 <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>
13468 <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>
13469
13470 !! html/parsoid
13471 <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>
13472 <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>
13473 <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>
13474 !! end
13475
13476 # a sad bit of backward-compatibility
13477 !! test
13478 Image with size specified with pxpx (bug 13500, 51628)
13479 !! options
13480 parsoid=wt2html,wt2wt,html2html
13481 !! wikitext
13482 [[File:Foobar.jpg|20pxpx]]
13483 [[File:Foobar.jpg|200x20pxpx]]
13484 !! html/php
13485 <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>
13486 <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>
13487 </p>
13488 !! html/parsoid
13489 <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>
13490 !! end
13491
13492 !! test
13493 Image with link parameter, wiki target
13494 !! wikitext
13495 [[File:Foobar.jpg|link=Main Page]]
13496 !! html/php
13497 <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>
13498 </p>
13499 !! html/parsoid
13500 <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>
13501 !! end
13502
13503 # parsoid bug 49293 (part 1)
13504 !! test
13505 Image with link parameter, URL target
13506 !! wikitext
13507 [[File:Foobar.jpg|link=http://example.com/]]
13508 !! html/php
13509 <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>
13510 </p>
13511 !! html/parsoid
13512 <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>
13513 !! end
13514
13515 # parsoid bug 49293 (part 2)
13516 !! test
13517 Image with link parameter, protocol-less URL target
13518 !! wikitext
13519 [[File:Foobar.jpg|link=//example.com/]]
13520 !! html/php
13521 <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>
13522 </p>
13523 !! html/parsoid
13524 <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>
13525 !! end
13526
13527 !! test
13528 Escaping non-block captions (T107435)
13529 !! options
13530 parsoid={
13531 "modes": ["wt2wt"],
13532 "changes": [
13533 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13534 ]
13535 }
13536 !! wikitext
13537 [[Image:Foobar.jpg|caption]]
13538 !! wikitext/edited
13539 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13540 !! end
13541
13542 # wgExternalLinkTarget not supported by Parsoid
13543 !! test
13544 Image with link parameter, wgExternalLinkTarget
13545 !! wikitext
13546 [[Image:foobar.jpg|link=http://example.com/]]
13547 !! config
13548 wgExternalLinkTarget='foobar'
13549 !! html/php
13550 <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>
13551 </p>
13552 !! end
13553
13554 !! test
13555 Image with link parameter, wgNoFollowLinks set to false
13556 !! wikitext
13557 [[Image:foobar.jpg|link=http://example.com/]]
13558 !! config
13559 wgNoFollowLinks=false
13560 !! html
13561 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13562 </p>
13563 !! end
13564
13565 !! test
13566 Image with link parameter, wgNoFollowDomainExceptions
13567 !! wikitext
13568 [[Image:foobar.jpg|link=http://example.com/]]
13569 !! config
13570 wgNoFollowDomainExceptions='example.com'
13571 !! html
13572 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13573 </p>
13574 !! end
13575
13576 # wgExternalLinkTarget not supported by Parsoid
13577 !! test
13578 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13579 !! wikitext
13580 [[Image:foobar.jpg|link=http://example.com/|Title]]
13581 !! config
13582 wgExternalLinkTarget='foobar'
13583 !! html/php
13584 <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>
13585 </p>
13586 !! end
13587
13588 !! test
13589 Image with empty link parameter
13590 !! wikitext
13591 [[File:Foobar.jpg|link=]]
13592 !! html/php
13593 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13594 </p>
13595 !! html/parsoid
13596 <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>
13597 !! end
13598
13599 !! test
13600 Image with link parameter (wiki target) and unnamed parameter
13601 !! wikitext
13602 [[File:Foobar.jpg|link=Main_Page|Title]]
13603 !! html/php
13604 <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>
13605 </p>
13606 !! html/parsoid
13607 <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>
13608 !! end
13609
13610 !! test
13611 Image with link parameter (URL target) and unnamed parameter
13612 !! wikitext
13613 [[File:Foobar.jpg|link=http://example.com/|Title]]
13614 !! html/php
13615 <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>
13616 </p>
13617 !! html/parsoid
13618 <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>
13619 !! end
13620
13621 !! test
13622 Thumbnail image with link parameter
13623 !! options
13624 thumbsize=220
13625 parsoid=wt2html,wt2wt,html2html
13626 !! wikitext
13627 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13628 !! html/php
13629 <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>
13630
13631 !! html/parsoid
13632 <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>
13633 !! end
13634
13635 !! test
13636 Manually-specified thumbnail image
13637 !! options
13638 thumbsize=220
13639 !! wikitext
13640 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13641 !! html/php
13642 <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>
13643
13644 !! html/parsoid
13645 <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>
13646 !! end
13647
13648 !! test
13649 Manually-specified thumbnail image with explicit link to wiki page
13650 !! options
13651 thumbsize=220
13652 parsoid=wt2html,wt2wt,html2html
13653 !! wikitext
13654 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13655 !! html/php
13656 <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>
13657
13658 !! html/parsoid
13659 <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>
13660 !! end
13661
13662 !! test
13663 Manually-specified thumbnail image with explicit link to url
13664 !! options
13665 thumbsize=220
13666 parsoid=wt2html,wt2wt,html2html
13667 !! wikitext
13668 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13669 !! html/php
13670 <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>
13671
13672 !! html/parsoid
13673 <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>
13674 !! end
13675
13676 !! test
13677 Manually-specified thumbnail image with explicit no link
13678 !! options
13679 thumbsize=220
13680 parsoid=wt2html,wt2wt,html2html
13681 !! wikitext
13682 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13683 !! html/php
13684 <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>
13685
13686 !! html/parsoid
13687 <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>
13688 !! end
13689
13690 !! test
13691 Manually-specified thumbnail image with explicit link and alt text
13692 !! options
13693 thumbsize=220
13694 parsoid=wt2html,wt2wt,html2html
13695 !! wikitext
13696 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13697 !! html/php
13698 <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>
13699
13700 !! html/parsoid
13701 <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>
13702 !! end
13703
13704 !! test
13705 Image with frame and link
13706 !! options
13707 parsoid=wt2html,wt2wt,html2html
13708 !! wikitext
13709 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13710 !! html/php
13711 <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>
13712
13713 !! html/parsoid
13714 <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>
13715 !! end
13716
13717 !! test
13718 Image with frame and link and explicit alt
13719 !! options
13720 parsoid=wt2html,wt2wt,html2html
13721 !! wikitext
13722 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13723 !! html/php
13724 <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>
13725
13726 !! html/parsoid
13727 <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>
13728 !! end
13729
13730 !! test
13731 Image with wiki markup in implicit alt
13732 !! wikitext
13733 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13734
13735 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13736 !! html/php
13737 <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>
13738 </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>
13739 </p>
13740 !! html/parsoid
13741 <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>
13742
13743 <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>
13744 !! end
13745
13746 !! test
13747 Alt image option should handle most kinds of wikitext without barfing
13748 !! wikitext
13749 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13750 !! html/php
13751 <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>
13752
13753 !! html/parsoid
13754 <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>
13755 !! end
13756
13757 ###################
13758 # Conflicting image format options.
13759 # First option specified should 'win'.
13760 # All three cases in each test should be identical.
13761
13762 !! test
13763 Image with 'frameless' first.
13764 !! options
13765 parsoid=wt2html,wt2wt,html2html
13766 !! wikitext
13767 [[File:Foobar.jpg|frameless|caption]]
13768
13769 [[File:Foobar.jpg|frameless|frame|caption]]
13770
13771 [[File:Foobar.jpg|frameless|thumb|caption]]
13772 !! html/php
13773 <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>
13774 </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>
13775 </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>
13776 </p>
13777 !! html/parsoid
13778 <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>
13779 <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>
13780 <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>
13781 !! end
13782
13783 !! test
13784 Image with 'frame' first.
13785 !! options
13786 parsoid=wt2html,wt2wt,html2html
13787 !! wikitext
13788 [[File:Foobar.jpg|frame|caption]]
13789 [[File:Foobar.jpg|frame|frameless|caption]]
13790 [[File:Foobar.jpg|frame|thumb|caption]]
13791 !! html/php
13792 <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>
13793 <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>
13794 <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>
13795
13796 !! html/parsoid
13797 <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>
13798 <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>
13799 <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>
13800 !! end
13801
13802 !! test
13803 Image with 'thumb' first.
13804 !! options
13805 parsoid=wt2html,wt2wt,html2html
13806 !! wikitext
13807 [[File:Foobar.jpg|thumb|caption]]
13808 [[File:Foobar.jpg|thumb|frameless|caption]]
13809 [[File:Foobar.jpg|thumb|frame|caption]]
13810 !! html/php
13811 <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>
13812 <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>
13813 <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>
13814
13815 !! html/parsoid
13816 <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>
13817 <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>
13818 <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>
13819 !! end
13820
13821 ###################
13822 # Image sizing.
13823 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13824 # and https://phabricator.wikimedia.org/T64258
13825 # Foobar has actual size of 1941x220
13826 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13827 # a scalable format.
13828 # 2. Framed images always ignore size options; always render at default size.
13829 # 3. "Unspecified format" and border are the only types which can be
13830 # enlarged.
13831
13832 !! test
13833 Image: "unspecified format" and border enlarge
13834 !! options
13835 parsoid=wt2html,wt2wt,html2html
13836 !! wikitext
13837 [[File:Foobar.jpg|2000px]]
13838
13839 [[File:Foobar.jpg|border|2000px]]
13840 !! html/php
13841 <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>
13842 </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>
13843 </p>
13844 !! html/parsoid
13845 <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>
13846 <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>
13847 !! end
13848
13849 !! test
13850 Image: "unspecified format" and border reduce
13851 !! options
13852 parsoid=wt2html,wt2wt,html2html
13853 !! wikitext
13854 [[File:Foobar.jpg|1000px]]
13855
13856 [[File:Foobar.jpg|border|1000px]]
13857 !! html/php
13858 <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>
13859 </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>
13860 </p>
13861 !! html/parsoid
13862 <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>
13863 <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>
13864 !! end
13865
13866 !! test
13867 Image: thumbs reduce
13868 !! options
13869 parsoid=wt2html,wt2wt,html2html
13870 !! wikitext
13871 [[File:Foobar.jpg|thumb|50px]]
13872 !! html/php
13873 <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>
13874
13875 !! html/parsoid
13876 <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>
13877 !! end
13878
13879 !! test
13880 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13881 !! options
13882 parsoid=wt2html,wt2wt,html2html
13883 !! wikitext
13884 [[File:Foobar.jpg|thumb|2000px]]
13885
13886 [[File:Foobar.svg|thumb|2000px]]
13887 !! html/php
13888 <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>
13889 <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>
13890
13891 !! html/parsoid
13892 <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>
13893 <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>
13894 !! end
13895
13896 !! test
13897 Image: frameless can reduce in size
13898 !! options
13899 parsoid=wt2html,wt2wt,html2html
13900 !! wikitext
13901 [[File:Foobar.jpg|frameless|50px]]
13902 !! html/php
13903 <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>
13904 </p>
13905 !! html/parsoid
13906 <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>
13907 !! end
13908
13909 !! test
13910 Image: bitmap frameless can't be enlarged past original size, but vector can
13911 !! options
13912 parsoid=wt2html,wt2wt,html2html
13913 !! wikitext
13914 [[File:Foobar.jpg|frameless|2000px]]
13915
13916 [[File:Foobar.svg|frameless|2000px]]
13917 !! html/php
13918 <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>
13919 </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>
13920 </p>
13921 !! html/parsoid
13922 <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>
13923 <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>
13924 !! end
13925
13926 !! test
13927 Image: framed images are always unscaled.
13928 !! options
13929 parsoid=wt2html,wt2wt,html2html
13930 !! wikitext
13931 [[File:Foobar.jpg|frame]]
13932
13933 [[File:Foobar.jpg|frame|50px]]
13934
13935 [[File:Foobar.jpg|frame|50x50px]]
13936
13937 [[File:Foobar.jpg|frame|2000px]]
13938 !! html/php
13939 <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>
13940 <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>
13941 <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>
13942 <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>
13943
13944 !! html/parsoid
13945 <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>
13946 <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>
13947 <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>
13948 <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>
13949 !! end
13950
13951 ###################
13952
13953 !! test
13954 Link to image page- image page normally doesn't exists, hence edit link
13955 Add test with existing image page
13956 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13957 !! wikitext
13958 [[:Image:test]]
13959 !! html
13960 <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>
13961 </p>
13962 !! end
13963
13964 !! test
13965 bug 18784 Link to non-existent image page with caption should use caption as link text
13966 !! wikitext
13967 [[:Image:test|caption]]
13968 !! html
13969 <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>
13970 </p>
13971 !! end
13972
13973 !! test
13974 Frameless image caption with a free URL
13975 !! wikitext
13976 [[File:Foobar.jpg|http://example.com]]
13977 !! html/php
13978 <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>
13979 </p>
13980 !! html/parsoid
13981 <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>
13982 !! end
13983
13984 !! test
13985 Thumbnail image caption with a free URL
13986 !! options
13987 thumbsize=220
13988 !! wikitext
13989 [[File:Foobar.jpg|thumb|http://example.com]]
13990 !! html/php
13991 <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>
13992
13993 !! html/parsoid
13994 <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>
13995 !! end
13996
13997 !! test
13998 Thumbnail image caption with a free URL and explicit alt
13999 !! options
14000 thumbsize=220
14001 parsoid=wt2html,wt2wt,html2html
14002 !! wikitext
14003 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14004 !! html/php
14005 <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>
14006
14007 !! html/parsoid
14008 <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>
14009 !! end
14010
14011 !! test
14012 SVG thumbnails with no language set
14013 !! options
14014 !! wikitext
14015 [[File:Foobar.svg|thumb|caption]]
14016 !! html/php
14017 <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>
14018
14019 !! html/parsoid
14020 <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>
14021 !! end
14022
14023 !! test
14024 SVG thumbnails with language de
14025 !! options
14026 parsoid=wt2html,wt2wt,html2html
14027 !! wikitext
14028 [[File:Foobar.svg|thumb|caption|lang=de]]
14029 !! html/php
14030 <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>
14031
14032 !! html/parsoid
14033 <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>
14034 !! end
14035
14036 !! test
14037 SVG thumbnails with invalid language code
14038 !! options
14039 parsoid=wt2html,wt2wt,html2html
14040 !! wikitext
14041 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14042 !! html/php
14043 <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>
14044
14045 !! html/parsoid
14046 <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>
14047 !! end
14048
14049 !! test
14050 BUG 1887: A ISBN with a thumbnail
14051 !! wikitext
14052 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14053 !! html/php
14054 <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>
14055
14056 !! html/parsoid
14057 <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>
14058 !! end
14059
14060 !! test
14061 BUG 1887: A RFC with a thumbnail
14062 !! wikitext
14063 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14064 !! html/php
14065 <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>
14066
14067 !! html/parsoid
14068 <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>
14069 !! end
14070
14071 !! test
14072 BUG 1887: A mailto link with a thumbnail
14073 !! wikitext
14074 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14075 !! html/php
14076 <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>
14077
14078 !! html/parsoid
14079 <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>
14080 !! end
14081
14082 # Pending resolution to bug 368
14083 !! test
14084 BUG 648: Frameless image caption with a link
14085 !! wikitext
14086 [[File:Foobar.jpg|text with a [[link]] in it]]
14087 !! html/php
14088 <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>
14089 </p>
14090 !! html/parsoid
14091 <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>
14092 !! end
14093
14094 !! test
14095 BUG 648: Frameless image caption with a link (suffix)
14096 !! wikitext
14097 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14098 !! html/php
14099 <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>
14100 </p>
14101 !! html/parsoid
14102 <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>
14103 !! end
14104
14105 !! test
14106 BUG 648: Frameless image caption with an interwiki link
14107 !! wikitext
14108 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14109 !! html/php
14110 <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>
14111 </p>
14112 !! html/parsoid
14113 <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>
14114 !! end
14115
14116 !! test
14117 BUG 648: Frameless image caption with a piped interwiki link
14118 !! wikitext
14119 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14120 !! html/php
14121 <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>
14122 </p>
14123 !! html/parsoid
14124 <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>
14125 !! end
14126
14127 !! test
14128 T107474: Frameless image caption with <nowiki>
14129 !! wikitext
14130 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14131 !! html/parsoid
14132 <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>
14133 !! end
14134
14135 !! test
14136 Escape HTML special chars in image alt text
14137 !! wikitext
14138 [[File:Foobar.jpg|& < > "]]
14139 !! html/php
14140 <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>
14141 </p>
14142 !! html/parsoid
14143 <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>
14144 !! end
14145
14146 !! test
14147 Entities in file name and attributes
14148 !! wikitext
14149 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14150 !! html/php
14151 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14152 </p>
14153 !! html/parsoid
14154 <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>
14155 !! end
14156
14157 !! test
14158 BUG 499: Alt text should have &#1234;, not &amp;1234;
14159 !! wikitext
14160 [[File:Foobar.jpg|&#9792;]]
14161 !! html/php
14162 <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>
14163 </p>
14164 !! html/parsoid
14165 <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>
14166 !! end
14167
14168 !! test
14169 Broken image caption with link
14170 !! options
14171 parsoid=wt2html,wt2wt,html2html
14172 !! wikitext
14173 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14174 !! html/php
14175 <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.
14176 </p>
14177 !! html/parsoid
14178 <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>
14179 !! end
14180
14181 !! test
14182 Image caption containing another image
14183 !! wikitext
14184 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14185 !! html/php
14186 <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>
14187
14188 !! html/parsoid
14189 <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>
14190 !! end
14191
14192 !! test
14193 Image: caption containing a newline
14194 !! wikitext
14195 [[File:Foobar.jpg|This
14196 *is some text]]
14197 !! html/php
14198 <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>
14199 </p>
14200 !! html/parsoid
14201 <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>
14202 !!end
14203
14204 !!test
14205 Image: caption containing leading space
14206 (The leading space should not trigger nowiki escaping in wt2wt mode)
14207 !! wikitext
14208 [[File:Foobar.jpg|thumb| bar]]
14209 !! html/php
14210 <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>
14211
14212 !! html/parsoid
14213 <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>
14214 !!end
14215
14216 !! test
14217 Image: caption containing a table
14218 !! options
14219 parsoid=wt2html,wt2wt,html2html
14220 !! wikitext
14221 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14222 {|
14223 ! Foo !! Bar
14224 |-
14225 | Foo1 || Bar1
14226 |}
14227 and some more text.]]
14228 !! html/php
14229 <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>
14230
14231 !! html/parsoid
14232 <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
14233 <table>
14234 <tbody>
14235 <tr><th>Foo </th><th>Bar</th></tr>
14236 <tr>
14237 <td>Foo1 </td>
14238 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14239 !! end
14240
14241 !! test
14242 Bug 3090: External links other than http: in image captions
14243 !! wikitext
14244 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14245 !! html/php
14246 <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>
14247
14248 !! html/parsoid
14249 <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>
14250 !! end
14251
14252 !! test
14253 Custom class
14254 !! options
14255 parsoid=wt2html,wt2wt,html2html
14256 !! wikitext
14257 [[Image:foobar.jpg|a|class=b]]
14258 !! html/php
14259 <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>
14260 </p>
14261 !! html/parsoid
14262 <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>
14263 !! end
14264
14265 !! test
14266 Localized image handling (1).
14267 !! options
14268 parsoid=wt2html,wt2wt,html2html
14269 language=es
14270 !! wikitext
14271 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14272 !! html/php
14273 <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>
14274
14275 !! html/parsoid
14276 <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>
14277 !! end
14278
14279 !! test
14280 Localized image handling (2).
14281 !! options
14282 thumbsize=220
14283 parsoid=wt2html,wt2wt,html2html
14284 language=es
14285 !! wikitext
14286 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14287 !! html/php
14288 <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>
14289
14290 !! html/parsoid
14291 <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>
14292 !! end
14293
14294 !! test
14295 Localized image handling (3).
14296 !! options
14297 language=fa
14298 parsoid=html2wt
14299 !! html/parsoid
14300 <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>
14301 !! wikitext
14302 [[File:Foobar.jpg|بندانگشتی]]
14303 !! end
14304
14305 !! test
14306 "border", "frameless" and "class" attributes on an image.
14307 !! options
14308 thumbsize=220
14309 parsoid=wt2html,wt2wt,html2html
14310 !! wikitext
14311 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14312 !! html/php
14313 <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>
14314 </p>
14315 !! html/parsoid
14316 <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>
14317 !! end
14318
14319 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14320 !! test
14321 Invalid image attributes (bug 62500)
14322 !! options
14323 thumbsize=220
14324 parsoid=wt2html,wt2wt,html2html
14325 !! wikitext
14326 [[File:Foobar.jpg|thumb|float|left|caption]]
14327
14328 [[File:Foobar.jpg|thumb|righ|caption]]
14329
14330 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14331 !! html/php
14332 <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>
14333 <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>
14334 <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>
14335
14336 !! html/parsoid
14337 <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>
14338 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14339 <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>
14340 !! end
14341
14342 !! article
14343 File:Barfoo.jpg
14344 !! text
14345 #REDIRECT [[File:Barfoo.jpg]]
14346 !! endarticle
14347
14348 # FIXME: Parsoid should run this test -- but we'd need to teach the
14349 # mockAPI about the redirected Barfoo.jpg image.
14350 !! test
14351 Redirected image
14352 !! wikitext
14353 [[Image:Barfoo.jpg]]
14354 !! html/php
14355 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14356 </p>
14357 !! end
14358
14359 !! test
14360 Missing image with uploads disabled
14361 !! options
14362 wgEnableUploads=0
14363 !! wikitext
14364 [[File:Foobaz.jpg]]
14365 !! html/php
14366 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14367 </p>
14368 !! html/parsoid
14369 <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>
14370 !! end
14371
14372 # Parsoid-specific testing for images
14373 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14374 # Currently imperfect due to a flaw in the Parsoid testrunner
14375 # Work in progress
14376 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14377 # image tests.
14378
14379 !! test
14380 Parsoid-specific image handling - simple image with size and middle alignment
14381 !! wikitext
14382 [[File:Foobar.jpg|middle|50px]]
14383 !! html/parsoid
14384 <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>
14385 !! end
14386
14387 !! test
14388 Parsoid-specific image handling - simple image with size, middle alignment,
14389 non-standard namespace alias
14390 !! options
14391 parsoid=wt2wt,wt2html,html2html
14392 !! wikitext
14393 [[Image:Foobar.jpg|middle|50px]]
14394 !! html/parsoid
14395 <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>
14396 !! end
14397
14398 !! test
14399 Parsoid-specific image handling - simple image with size and middle alignment
14400 (existing content)
14401 !! wikitext
14402 [[File:Foobar.jpg|50px|middle]]
14403 !! html/parsoid
14404 <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>
14405 !! end
14406
14407 !! test
14408 Parsoid-specific image handling - simple image with size and middle alignment
14409 and non-standard namespace name
14410 !! options
14411 parsoid=wt2html,wt2wt,html2html
14412 !! wikitext
14413 [[Image:Foobar.jpg|50px|middle]]
14414 !! html/parsoid
14415 <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>
14416 !! end
14417
14418 !! test
14419 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14420 !! wikitext
14421 [[File:Foobar.jpg|500x10px|baseline|caption]]
14422 !! html/parsoid
14423 <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>
14424 !! end
14425
14426 !! test
14427 Parsoid-specific image handling - simple image with border and size spec
14428 !! wikitext
14429 [[File:Foobar.jpg|50px|border|caption]]
14430 !! html/parsoid
14431 <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>
14432 !! end
14433
14434 !! test
14435 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14436 !! wikitext
14437 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14438 !! html/parsoid
14439 <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>
14440 !! end
14441
14442 !! test
14443 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14444 (existing content)
14445 !! wikitext
14446 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14447 !! html/parsoid
14448 <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>
14449 !! end
14450
14451 !! test
14452 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14453 !! wikitext
14454 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14455 !! html/parsoid
14456 <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>
14457 !! end
14458
14459 !! test
14460 Parsoid-specific image handling - thumbnail with specific size, halign,
14461 valign, and caption (existing content)
14462 !! wikitext
14463 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14464 !! html/parsoid
14465 <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>
14466 !! end
14467
14468 !! test
14469 Parsoid-specific image handling - framed image with specific size and caption
14470 (size is ignored)
14471 !! options
14472 parsoid=wt2html,wt2wt,html2html
14473 !! wikitext
14474 [[File:Foobar.jpg|frame|500x50px|caption]]
14475 !! html/parsoid
14476 <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>
14477 !! end
14478
14479 !! test
14480 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14481 (size is ignored)
14482 !! options
14483 parsoid=wt2html,wt2wt,html2html
14484 !! wikitext
14485 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14486 !! html/parsoid
14487 <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>
14488 !! end
14489
14490 !! test
14491 Parsoid-specific image handling - frameless image with specific size, border, and caption
14492 !! wikitext
14493 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14494 !! html/parsoid
14495 <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>
14496 !! end
14497
14498 !! test
14499 Parsoid-specific image handling - simple image with a formatted caption
14500 !! wikitext
14501 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14502 !! html/parsoid
14503 <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>
14504 !! end
14505
14506 !! test
14507 Parsoid-specific image handling - caption with a template in it
14508 !! wikitext
14509 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14510 !! html/parsoid
14511 <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>
14512 !! end
14513
14514 !! test
14515 Parsoid-specific image handling - caption with unbalanced tags in it
14516 !! options
14517 parsoid=wt2html,wt2wt,html2html
14518 !! wikitext
14519 foo
14520 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14521 bar
14522 !! html/parsoid
14523 <p>foo</p>
14524 <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>
14525 <p>bar</p>
14526 !! end
14527
14528 !! test
14529 Parsoid-specific image handling - empty caption (1)
14530 !! options
14531 parsoid=wt2html,wt2wt
14532 !! wikitext
14533 [[File:Foobar.jpg|thumb|]]
14534 !! html/parsoid
14535 <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>
14536 !! end
14537
14538 # empty captions don't get serialized unless we're in the "round trip" case
14539 !! test
14540 Parsoid-specific image handling - empty caption (2)
14541 !! options
14542 parsoid=html2wt
14543 !! html/parsoid
14544 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14545 <a href="./File:Foobar.jpg">
14546 <img resource="./File:Foobar.jpg"
14547 src="//example.com/images/3/3a/Foobar.jpg"
14548 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14549 height="25" width="220"/>
14550 </a>
14551 <figcaption></figcaption>
14552 </figure>
14553 !! wikitext
14554 [[File:Foobar.jpg|thumb]]
14555 !! end
14556
14557 !! test
14558 Parsoid-specific image handling - whitespace caption
14559 !! wikitext
14560 [[File:Foobar.jpg|thumb| ]]
14561 !! html/parsoid
14562 <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>
14563 !! end
14564
14565 !! test
14566 Parsoid-specific image handling - lang option
14567 !! wikitext
14568 foo
14569 [[File:Foobar.svg|lang=de|caption]]
14570 bar
14571 !! html/parsoid
14572 <p>foo
14573 <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>
14574 bar</p>
14575 !! end
14576
14577 ## Edge case bugs in Parsoid from T93580
14578 !! test
14579 T93580: 1. Templated <ref> inside block images
14580 !! wikitext
14581 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14582
14583 <references />
14584 !! html/parsoid
14585 <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="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14586
14587 <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="#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>
14588 !! end
14589
14590 !! test
14591 T93580: 2. <ref> inside inline images
14592 !! wikitext
14593 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14594
14595 <references />
14596 !! html/parsoid
14597 <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=\"#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>
14598
14599 <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="#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>
14600 !! end
14601
14602 !! test
14603 T93580: 3. Templated <ref> inside inline images
14604 !! wikitext
14605 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14606
14607 <references />
14608 !! html/parsoid
14609 <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=\"#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>
14610
14611 <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="#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>
14612 !! end
14613
14614 ###
14615 ### Subpages
14616 ###
14617 !! article
14618 Subpage test/subpage
14619 !! text
14620 foo
14621 !! endarticle
14622
14623 !! test
14624 Subpage link
14625 !! options
14626 subpage title=[[Subpage test]]
14627 !! wikitext
14628 [[/subpage]]
14629 !! html
14630 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14631 </p>
14632 !! end
14633
14634 !! test
14635 Subpage noslash link
14636 !! options
14637 subpage title=[[Subpage test]]
14638 !! wikitext
14639 [[/subpage/]]
14640 !! html
14641 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14642 </p>
14643 !! end
14644
14645 !! article
14646 Subpage test/1/2/subpage
14647 !! text
14648 blah
14649 !! endarticle
14650
14651 !! test
14652 Relative subpage noslash link
14653 !! options
14654 parsoid=wt2wt,wt2html,html2html
14655 subpage title=[[Subpage test/1/2/3/4]]
14656 !! wikitext
14657 [[../../subpage/]]
14658
14659 [[../../subpage]]
14660 !! html/php
14661 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14662 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14663 </p>
14664 !! html/parsoid
14665 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14666 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14667 !! end
14668
14669 !! test
14670 Parsoid: dot-slash prefixed wikilinks
14671 !! wikitext
14672 [[./foo]]
14673
14674 [[././bar]]
14675
14676 [[././baz/]]
14677 !! html/php
14678 <p>[[./foo]]
14679 </p><p>[[././bar]]
14680 </p><p>[[././baz/]]
14681 </p>
14682 !! html/parsoid
14683 <p>[[./foo]]
14684 </p><p>[[././bar]]
14685 </p><p>[[././baz/]]
14686 </p>
14687 !! end
14688
14689 !! test
14690 Render invalid page names as plain text (bug 51090)
14691 !! wikitext
14692 [[./../foo|bar]]
14693 [[foo�|bar]]
14694 [[foo/.|bar]]
14695 [[foo/..|bar]]
14696 [[foo~~~bar]]
14697 [[foo>bar]]
14698 [[foo[bar]]
14699 [[.]]
14700 [[..]]
14701 [[foo././bar]]
14702
14703 [[{{echo|./../foo}}|bar]]
14704 [[{{echo|foo/.}}|bar]]
14705 [[{{echo|foo/..}}|bar]]
14706 [[{{echo|foo~~~~bar}}]]
14707 [[{{echo|foo>bar}}]]
14708 [[{{echo|foo././bar}}]]
14709 [[{{echo|foo{bar}}]]
14710 [[{{echo|foo}bar}}]]
14711 [[{{echo|foo[bar}}]]
14712 [[{{echo|foo]bar}}]]
14713 [[{{echo|foo<bar}}]]
14714 !!html/php
14715 <p>[[./../foo|bar]]
14716 [[foo�|bar]]
14717 [[foo/.|bar]]
14718 [[foo/..|bar]]
14719 [[foo~~~bar]]
14720 [[foo&gt;bar]]
14721 [[foo[bar]]
14722 [[.]]
14723 [[..]]
14724 [[foo././bar]]
14725 </p><p>[[./../foo|bar]]
14726 [[foo/.|bar]]
14727 [[foo/..|bar]]
14728 [[foo~~~~bar]]
14729 [[foo&gt;bar]]
14730 [[foo././bar]]
14731 [[foo{bar]]
14732 [[foo}bar]]
14733 [[foo[bar]]
14734 [[foo]bar]]
14735 [[foo&lt;bar]]
14736 </p>
14737 !!html/parsoid
14738 <p>[[./../foo|bar]]
14739 [[foo�|bar]]
14740 [[foo/.|bar]]
14741 [[foo/..|bar]]
14742 [[foo~~~bar]]
14743 [[foo>bar]]
14744 [[foo[bar]]
14745 [[.]]
14746 [[..]]
14747 [[foo././bar]]</p>
14748
14749 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14750 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14751 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14752 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14753 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14754 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14755 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14756 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14757 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14758 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14759 [[<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>
14760 !!end
14761
14762 !! test
14763 Disabled subpages
14764 !! wikitext
14765 [[/subpage]]
14766 !! html
14767 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14768 </p>
14769 !! end
14770
14771 !! test
14772 BUG 561: {{/Subpage}}
14773 !! options
14774 subpage title=[[Page]]
14775 !! wikitext
14776 {{/Subpage}}
14777 !! html
14778 <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>
14779 </p>
14780 !! end
14781
14782 ###
14783 ### Categories
14784 ###
14785 !! article
14786 Category:MediaWiki User's Guide
14787 !! text
14788 blah
14789 !! endarticle
14790
14791 !! test
14792 Link to category
14793 !! wikitext
14794 [[:Category:MediaWiki User's Guide]]
14795 !! html
14796 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14797 </p>
14798 !! end
14799
14800 !! test
14801 Simple category
14802 !! options
14803 cat
14804 !! wikitext
14805 [[Category:MediaWiki User's Guide]]
14806 !! html/php
14807 cat=MediaWiki_User's_Guide sort=
14808 !! html/parsoid
14809 <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"}}'/>
14810 !! end
14811
14812 !! test
14813 PAGESINCATEGORY invalid title fatal (r33546 fix)
14814 !! wikitext
14815 {{PAGESINCATEGORY:<bogus>}}
14816 !! html
14817 <p>0
14818 </p>
14819 !! end
14820
14821 !! test
14822 Category with different sort key
14823 !! options
14824 cat
14825 !! wikitext
14826 [[Category:MediaWiki User's Guide|Foo]]
14827 !! html/php
14828 cat=MediaWiki_User's_Guide sort=Foo
14829 !! html/parsoid
14830 <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"}}'/>
14831 !! end
14832
14833 !! test
14834 Category with identical sort key
14835 !! options
14836 cat
14837 !! wikitext
14838 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14839 !! html/php
14840 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14841 !! html/parsoid
14842 <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"}}'/>
14843 !! end
14844
14845 !! test
14846 Category with empty sort key
14847 !! options
14848 cat
14849 pst
14850 !! wikitext
14851 [[Category:MediaWiki User's Guide|]]
14852 !! html/php
14853 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14854 !! end
14855
14856 !! test
14857 Category with empty sort key and parentheses
14858 !! options
14859 cat
14860 pst
14861 !! wikitext
14862 [[Category:Foo (bar)|]]
14863 !! html/php
14864 [[Category:Foo (bar)|Foo]]
14865 !! end
14866
14867 !! test
14868 Category with link tail
14869 !! options
14870 cat
14871 pst
14872 !! wikitext
14873 123[[Category:Foo]]456
14874 !! html/php
14875 123[[Category:Foo]]456
14876 !! end
14877
14878 !! test
14879 Category with template
14880 !! options
14881 cat
14882 pst
14883 !! wikitext
14884 [[Category:{{echo|Foo}}]]
14885 !! html/php
14886 [[Category:{{echo|Foo}}]]
14887 !! end
14888
14889 !! test
14890 Category with template in sort key
14891 !! options
14892 cat
14893 pst
14894 !! wikitext
14895 [[Category:Foo|{{echo|Bar}}]]
14896 !! html/php
14897 [[Category:Foo|{{echo|Bar}}]]
14898 !! end
14899
14900 !! test
14901 Category with template in sort key and title
14902 !! options
14903 cat
14904 pst
14905 !! wikitext
14906 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14907 !! html/php
14908 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14909 !! end
14910
14911 ## We used to, but no longer wt2wt this test since the default serializer
14912 ## will normalize all categories to serialize on their own line.
14913 ## This wikitext usage is going to be fairly uncommon in production and
14914 ## selser will take care of preserving formatting in those scenarios.
14915 !! test
14916 Category / paragraph interactions
14917 !! options
14918 parsoid=wt2html
14919 !! wikitext
14920 Foo [[Category:Baz]] Bar
14921
14922 Foo [[Category:Baz]]
14923 Bar
14924
14925 Foo
14926 [[Category:Baz]]
14927 Bar
14928
14929 Foo
14930 [[Category:Baz]] Bar
14931
14932 Foo
14933 [[Category:Baz]]
14934 [[Category:Baz]]
14935 [[Category:Baz]]
14936 Bar
14937
14938 [[Category:Baz]]
14939 [[Category:Baz]]
14940 [[Category:Baz]]
14941
14942 [[Category:Baz]]
14943 {{echo|[[Category:Baz]]}}
14944 [[Category:Baz]]
14945 !! html/php
14946 <p>Foo Bar
14947 </p><p>Foo
14948 Bar
14949 </p><p>Foo
14950 Bar
14951 </p><p>Foo Bar
14952 </p><p>Foo
14953 Bar
14954 </p>
14955 !! html/parsoid
14956 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14957 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14958 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14959 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14960 <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>
14961 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14962 !! end
14963
14964 ## We used to, but no longer wt2wt this test since the default serializer
14965 ## will normalize all categories to serialize on their own line.
14966 ## This wikitext usage is going to be fairly uncommon in production and
14967 ## selser will take care of preserving formatting in those scenarios.
14968 ##
14969 ## The whitespace on the empty line is part of the test. Please do not delete
14970 !! test
14971 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14972 !! options
14973 parsoid=wt2html
14974 !! wikitext
14975 This
14976
14977 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14978
14979 {{echo|[[Category:Foo]] and so should this!}}
14980 !! html/php
14981 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14982 </p>
14983 !! html/parsoid
14984 <p>This
14985
14986 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14987
14988 <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>
14989 !! end
14990
14991 ## Parsoid will not try to wt2wt this while preserving newlines because
14992 ## it suppresses excess newlines within list items -- and we don't want to
14993 ## introduce a special case just for categories, which is, in reality somewhat
14994 ## odd behavior -- categories are unlikely to be used in list items like this
14995 ## in top-level pages and are only likely to show up in template-generated
14996 ## list items where this RT-ing is a non-issue.
14997 ##
14998 ## The whitespace on the empty line is part of the test. Please do not delete
14999 !! test
15000 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15001 !! options
15002 parsoid=wt2html
15003 !! wikitext
15004 * This
15005
15006 [[Category:Foo]] and this should be part of the same list item
15007 * So should this
15008
15009 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15010 !! html
15011 <ul><li>This and this should be part of the same list item</li>
15012 <li>So should this and this should be part of the same list item</li></ul>
15013 !! html/parsoid
15014 <ul>
15015 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15016 <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>
15017 </ul>
15018 !! end
15019
15020 ## Newlines and categories that follow the last item of a list
15021 ## are treated differently because this (list followed by categories)
15022 ## is an extremely common pattern on wikis.
15023 !! test
15024 3. Categories and newlines: newline suppression for last list item should RT properly
15025 !! wikitext
15026 * a
15027 * b
15028
15029 [[Category:Foo]]
15030
15031 [[Category:Bar]]
15032 [[Category:Baz]]
15033 !! html/parsoid
15034 <ul><li> a</li>
15035 <li> b</li></ul>
15036
15037 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15038
15039 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15040 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15041 !! end
15042
15043 !! test
15044 4. Categories and newlines: newline suppression for last list item should RT properly
15045 !! wikitext
15046 * a
15047 **** b
15048
15049 [[Category:Foo]]
15050 !! html/parsoid
15051 <ul><li> a
15052 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15053
15054 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15055 !! end
15056
15057 ## only wt2html for this to make sure the algo only applies to the rightmost path
15058 !! test
15059 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15060 !! options
15061 parsoid=wt2html
15062 !! wikitext
15063 * a
15064 ** b
15065 [[Category:Foo]]
15066 * c
15067 ** d
15068 [[Category:Foo]]
15069 !! html/parsoid
15070 <ul><li> a
15071 <ul><li> b
15072 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15073 <li> c
15074 <ul><li> d</li></ul></li></ul>
15075 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15076 !! end
15077
15078 ## We used to, but no longer wt2wt this test since the default serializer
15079 ## will normalize all categories to serialize on their own line.
15080 ## This wikitext usage is going to be fairly uncommon in production and
15081 ## selser will take care of preserving formatting in those scenarios.
15082 !! test
15083 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15084 !! options
15085 parsoid=wt2html
15086 !! wikitext
15087 * a [[Category:Foo]]
15088 !! html/parsoid
15089 <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>
15090 !! end
15091
15092 # This test also demonstrates because of newline+category tunneling
15093 # through the list hander, template wrapping doesn't expand to the
15094 # containing list when the list item swallows the category.
15095 !! test
15096 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15097 !! wikitext
15098 * {{echo|a
15099 [[Category:Foo]]}}
15100 !! html/parsoid
15101 <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
15102 </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>
15103 !! end
15104
15105 !! test
15106 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15107 !! wikitext
15108 * a
15109
15110 {{echo|[[Category:Foo]]
15111 [[Category:Bar]]}}
15112 [[Category:Baz]]
15113 !! html/parsoid
15114 <ul><li> a</li></ul>
15115
15116 <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">
15117 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15118 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15119 !! end
15120
15121 !! test
15122 Category links with multiple namespaces
15123 !! wikitext
15124 [[Category:Project:Foo]]
15125 !! html/parsoid
15126 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15127 !! end
15128
15129 !! test
15130 Parsoid: Serialize link to category page with colon escape
15131 !! options
15132 parsoid
15133 !! wikitext
15134
15135 [[:Category:Foo]]
15136 [[:Category:Foo|Bar]]
15137 !! html
15138 <p>
15139 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15140 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15141 </p>
15142 !! end
15143
15144 # We used to, but no longer wt2wt this test since the default serializer
15145 # will normalize all categories to serialize on their own line.
15146 # This wikitext usage is going to be fairly uncommon in production and
15147 # selser will take care of preventing whitespace insertion if this
15148 # occurs in an article.
15149 #
15150 # html2html disabled for the same reason (whitespace insertion between
15151 # x and y).
15152 #
15153 # html2wt disabled because it localizes the "Category" namespace.
15154 !! test
15155 Link prefix/suffixes aren't applied to category links
15156 !! options
15157 parsoid=wt2html
15158 language=is
15159 !! wikitext
15160 x[[Category:Foo]]y
15161 !! html/php
15162 <p>xy
15163 </p>
15164 !! html/parsoid
15165 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15166 !! end
15167
15168 !! test
15169 Parsoid: Serialize link to file page with colon escape
15170 !! options
15171 parsoid
15172 !! wikitext
15173
15174 [[:File:Foo.png]]
15175 [[:File:Foo.png|Bar]]
15176 !! html
15177 <p>
15178 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15179 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15180 </p>
15181 !! end
15182
15183 !! test
15184 Parsoid: Serialize a genuine category link without colon escape
15185 !! options
15186 parsoid
15187 !! wikitext
15188 [[Category:Foo]]
15189 [[Category:Foo|Bar]]
15190 !! html
15191 <link rel="mw:PageProp/Category" href="./Category:Foo">
15192 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15193 !! end
15194
15195 !! test
15196 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15197 !! options
15198 parsoid=html2wt
15199 !! html/parsoid
15200 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15201 !! wikitext
15202 [[Category:Toxine bactérienne]]
15203 !! end
15204
15205 !! test
15206 Parsoid: Defaultsort
15207 !! wikitext
15208 {{DEFAULTSORT:Foo}}
15209 !! html/parsoid
15210 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15211 !! end
15212
15213 !! test
15214 Parsoid: Defaultsort (template-generated)
15215 !! wikitext
15216 {{{{echo|DEFAULTSORT}}:Foo}}
15217 !! html/parsoid
15218 <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}}]}'/>
15219 !! end
15220
15221 ###
15222 ### Inter-language links
15223 ###
15224 !! test
15225 Interlanguage links
15226 !! options
15227 ill
15228 !! wikitext
15229 [[es:Alimento]]
15230 [[fr:Nourriture]]
15231 [[zh:食品]]
15232 !! html/php
15233 es:Alimento fr:Nourriture zh:食品
15234 !! html/parsoid
15235 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15236 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15237 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15238 !! end
15239
15240 !! test
15241 Duplicate interlanguage links (bug 24502)
15242 !! options
15243 ill
15244 !! wikitext
15245 [[es:1]]
15246 [[es:2]]
15247 [[fr:1]]
15248 [[fr:2]]
15249 !! html/php
15250 es:1 fr:1
15251 !! html/parsoid
15252 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15253 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15254 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15255 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15256 !! end
15257
15258 ###
15259 ### Sections
15260 ###
15261 !! test
15262 Basic section headings
15263 !! wikitext
15264 == Headline 1 ==
15265 Some text
15266
15267 ==Headline 2==
15268 More
15269 ===Smaller headline===
15270 Blah blah
15271 !! html
15272 <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>
15273 <p>Some text
15274 </p>
15275 <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>
15276 <p>More
15277 </p>
15278 <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>
15279 <p>Blah blah
15280 </p>
15281 !! end
15282
15283 !! test
15284 Section headings with TOC
15285 !! wikitext
15286 == Headline 1 ==
15287 === Subheadline 1 ===
15288 ===== Skipping a level =====
15289 ====== Skipping a level ======
15290
15291 == Headline 2 ==
15292 Some text
15293 ===Another headline===
15294 !! html
15295 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15296 <ul>
15297 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15298 <ul>
15299 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15300 <ul>
15301 <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>
15302 <ul>
15303 <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>
15304 </ul>
15305 </li>
15306 </ul>
15307 </li>
15308 </ul>
15309 </li>
15310 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15311 <ul>
15312 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15313 </ul>
15314 </li>
15315 </ul>
15316 </div>
15317
15318 <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>
15319 <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>
15320 <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>
15321 <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>
15322 <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>
15323 <p>Some text
15324 </p>
15325 <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>
15326
15327 !! end
15328
15329 !! test
15330 TOC anchors don't collide
15331 !! wikitext
15332 __FORCETOC__
15333 == Headline 2 ==
15334 == Headline ==
15335 == Headline 2 ==
15336 == Headline ==
15337 !! html/php
15338 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15339 <ul>
15340 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15341 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15342 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15343 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15344 </ul>
15345 </div>
15346
15347 <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>
15348 <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>
15349 <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>
15350 <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>
15351
15352 !! end
15353
15354 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15355 !! test
15356 Handling of sections up to level 6 and beyond
15357 !! wikitext
15358 = Level 1 Heading=
15359 == Level 2 Heading==
15360 === Level 3 Heading===
15361 ==== Level 4 Heading====
15362 ===== Level 5 Heading=====
15363 ====== Level 6 Heading======
15364 ======= Level 7 Heading=======
15365 ======== Level 8 Heading========
15366 ========= Level 9 Heading=========
15367 ========== Level 10 Heading==========
15368 !! html
15369 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15370 <ul>
15371 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15372 <ul>
15373 <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>
15374 <ul>
15375 <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>
15376 <ul>
15377 <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>
15378 <ul>
15379 <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>
15380 <ul>
15381 <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>
15382 <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>
15383 <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>
15384 <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>
15385 <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>
15386 </ul>
15387 </li>
15388 </ul>
15389 </li>
15390 </ul>
15391 </li>
15392 </ul>
15393 </li>
15394 </ul>
15395 </li>
15396 </ul>
15397 </div>
15398
15399 <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>
15400 <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>
15401 <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>
15402 <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>
15403 <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>
15404 <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>
15405 <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>
15406 <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>
15407 <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>
15408 <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>
15409
15410 !! end
15411
15412 !! test
15413 TOC regression (T11764)
15414 !! wikitext
15415 == title 1 ==
15416 === title 1.1 ===
15417 ==== title 1.1.1 ====
15418 === title 1.2 ===
15419 == title 2 ==
15420 === title 2.1 ===
15421 !! html
15422 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15423 <ul>
15424 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15425 <ul>
15426 <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>
15427 <ul>
15428 <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>
15429 </ul>
15430 </li>
15431 <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>
15432 </ul>
15433 </li>
15434 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15435 <ul>
15436 <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>
15437 </ul>
15438 </li>
15439 </ul>
15440 </div>
15441
15442 <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>
15443 <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>
15444 <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>
15445 <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>
15446 <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>
15447 <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>
15448
15449 !! end
15450
15451 !! test
15452 TOC for heading containing <span id="..."></span> (T96153)
15453 !! wikitext
15454 __FORCETOC__
15455 ==<span id="old-anchor"></span>New title==
15456 !! html/php
15457 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15458 <ul>
15459 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15460 </ul>
15461 </div>
15462
15463 <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>
15464
15465 !! end
15466
15467 !! test
15468 TOC with wgMaxTocLevel=3 (bug 6204)
15469 !! options
15470 wgMaxTocLevel=3
15471 !! wikitext
15472 == title 1 ==
15473 === title 1.1 ===
15474 ==== title 1.1.1 ====
15475 === title 1.2 ===
15476 == title 2 ==
15477 === title 2.1 ===
15478 !! html
15479 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15480 <ul>
15481 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15482 <ul>
15483 <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>
15484 <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>
15485 </ul>
15486 </li>
15487 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15488 <ul>
15489 <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>
15490 </ul>
15491 </li>
15492 </ul>
15493 </div>
15494
15495 <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>
15496 <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>
15497 <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>
15498 <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>
15499 <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>
15500 <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>
15501
15502 !! end
15503
15504 !! test
15505 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15506 !! options
15507 wgMaxTocLevel=3
15508 !! wikitext
15509 ==Section 1==
15510 ===Section 1.1===
15511 ====Section 1.1.1====
15512 ====Section 1.1.1.1====
15513 ==Section 2==
15514 !! html
15515 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15516 <ul>
15517 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15518 <ul>
15519 <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>
15520 </ul>
15521 </li>
15522 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15523 </ul>
15524 </div>
15525
15526 <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>
15527 <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>
15528 <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>
15529 <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>
15530 <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>
15531
15532 !! end
15533
15534
15535 !! test
15536 Resolving duplicate section names
15537 !! wikitext
15538 == Foo bar ==
15539 == Foo bar ==
15540 !! html
15541 <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>
15542 <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>
15543
15544 !! end
15545
15546 !! test
15547 Resolving duplicate section names with differing case (bug 10721)
15548 !! wikitext
15549 == Foo bar ==
15550 == Foo Bar ==
15551 !! html
15552 <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>
15553 <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>
15554
15555 !! end
15556
15557 !! article
15558 Template:sections
15559 !! text
15560 ===Section 1===
15561 ==Section 2==
15562 !! endarticle
15563
15564 !! test
15565 Template with sections, __NOTOC__
15566 !! wikitext
15567 __NOTOC__
15568 ==Section 0==
15569 {{sections}}
15570 ==Section 4==
15571 !! html
15572 <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>
15573 <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>
15574 <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>
15575 <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>
15576
15577 !! end
15578
15579 !! test
15580 __NOEDITSECTION__ keyword
15581 !! wikitext
15582 __NOEDITSECTION__
15583 ==Section 1==
15584 ==Section 2==
15585 !! html
15586 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15587 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15588
15589 !! end
15590
15591 !! test
15592 Link inside a section heading
15593 !! wikitext
15594 ==Section with a [[Main Page|link]] in it==
15595 !! html
15596 <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>
15597
15598 !! end
15599
15600 !! test
15601 TOC regression (T14077)
15602 !! wikitext
15603 __TOC__
15604 == title 1 ==
15605 === title 1.1 ===
15606 == title 2 ==
15607 !! html
15608 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15609 <ul>
15610 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15611 <ul>
15612 <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>
15613 </ul>
15614 </li>
15615 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15616 </ul>
15617 </div>
15618
15619 <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>
15620 <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>
15621 <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>
15622
15623 !! end
15624
15625 !! test
15626 BUG 1219 URL next to image (good)
15627 !! wikitext
15628 http://example.com [[File:Foobar.jpg]]
15629 !! html/php
15630 <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>
15631 </p>
15632 !! html/parsoid
15633 <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>
15634 !!end
15635
15636 !! test
15637 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15638 !! wikitext
15639 ===
15640 The line above must have a trailing space!
15641 === <!--
15642 --> <!-- -->
15643 But just in case it doesn't...
15644 !! html
15645 <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>
15646 <p>The line above must have a trailing space!
15647 </p>
15648 <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>
15649 <p>But just in case it doesn't...
15650 </p>
15651 !! end
15652
15653 !! test
15654 Header with special characters (bug 25462)
15655 !! wikitext
15656 The tooltips shall not show entities to the user (ie. be double escaped)
15657
15658 == text > text ==
15659 section 1
15660
15661 == text < text ==
15662 section 2
15663
15664 == text & text ==
15665 section 3
15666
15667 == text ' text ==
15668 section 4
15669
15670 == text " text ==
15671 section 5
15672 !! html
15673 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15674 </p>
15675 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15676 <ul>
15677 <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>
15678 <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>
15679 <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>
15680 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15681 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15682 </ul>
15683 </div>
15684
15685 <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>
15686 <p>section 1
15687 </p>
15688 <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>
15689 <p>section 2
15690 </p>
15691 <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>
15692 <p>section 3
15693 </p>
15694 <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>
15695 <p>section 4
15696 </p>
15697 <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>
15698 <p>section 5
15699 </p>
15700 !! end
15701
15702 !! test
15703 Header with space, plus and underscore as entity
15704 !! wikitext
15705 Id should not contain + for spaces
15706
15707 == Space between Text ==
15708 section 1
15709
15710 == Space-Entity&#32;between&#32;Text ==
15711 section 2
15712
15713 == Plus+between+Text ==
15714 section 3
15715
15716 == Plus-Entity&#43;between&#43;Text ==
15717 section 4
15718
15719 == Underscore_between_Text ==
15720 section 5
15721
15722 == Underscore-Entity&#95;between&#95;Text ==
15723 section 6
15724
15725 [[#Space between Text]]
15726 [[#Space-Entity&#32;between&#32;Text]]
15727 [[#Plus+between+Text]]
15728 [[#Plus-Entity&#43;between&#43;Text]]
15729 [[#Underscore_between_Text]]
15730 [[#Underscore-Entity&#95;between&#95;Text]]
15731 !! html
15732 <p>Id should not contain + for spaces
15733 </p>
15734 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15735 <ul>
15736 <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>
15737 <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>
15738 <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>
15739 <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>
15740 <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>
15741 <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>
15742 </ul>
15743 </div>
15744
15745 <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>
15746 <p>section 1
15747 </p>
15748 <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>
15749 <p>section 2
15750 </p>
15751 <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>
15752 <p>section 3
15753 </p>
15754 <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>
15755 <p>section 4
15756 </p>
15757 <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>
15758 <p>section 5
15759 </p>
15760 <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>
15761 <p>section 6
15762 </p><p><a href="#Space_between_Text">#Space between Text</a>
15763 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15764 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15765 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15766 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15767 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15768 </p>
15769 !! end
15770
15771 !! test
15772 Headers with excess '=' characters
15773 (Are similar tests necessary beyond the 1st level?)
15774 !! wikitext
15775 =foo==
15776 ==foo=
15777 =''italic'' heading==
15778 ==''italic'' heading=
15779 !! html
15780 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15781 <ul>
15782 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15783 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15784 <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>
15785 <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>
15786 </ul>
15787 </div>
15788
15789 <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>
15790 <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>
15791 <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>
15792 <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>
15793
15794 !! end
15795
15796 !! test
15797 HTML headers vs TOC (bug 23393)
15798 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15799 !! wikitext
15800 <h1>Header 1</h1>
15801 == Header 1.1 ==
15802 == Header 1.2 ==
15803
15804 <h1>Header 2
15805 </h1>
15806 == Header 2.1 ==
15807 == Header 2.2 ==
15808 __NOEDITSECTION__
15809 !! html
15810 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15811 <ul>
15812 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15813 <ul>
15814 <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>
15815 <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>
15816 </ul>
15817 </li>
15818 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15819 <ul>
15820 <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>
15821 <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>
15822 </ul>
15823 </li>
15824 </ul>
15825 </div>
15826
15827 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15828 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15829 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15830 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15831 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15832 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15833
15834 !! end
15835
15836 !! test
15837 Single-line or multiline-comments can follow headings
15838 !! options
15839 parsoid=wt2html,wt2wt
15840 !! wikitext
15841 ==foo==<!---->
15842 ==bar==<!--c1-->
15843 ==baz==<!--
15844 c2
15845 c3-->
15846 !! html
15847 <h2><span class="mw-headline" id="foo">foo</span></h2>
15848 <h2><span class="mw-headline" id="bar">bar</span></h2>
15849 <h2><span class="mw-headline" id="baz">baz</span></h2>
15850
15851 !! end
15852
15853 !! test
15854 BUG 1219 URL next to image (broken)
15855 !! wikitext
15856 http://example.com[[File:Foobar.jpg]]
15857 !! html/php
15858 <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>
15859 </p>
15860 !! html/parsoid
15861 <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>
15862 !!end
15863
15864 !! test
15865 Bug 1186 news: in the middle of text
15866 !! wikitext
15867 http://en.wikinews.org/wiki/Wikinews:Workplace
15868 !! html
15869 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15870 </p>
15871 !!end
15872
15873
15874 !! test
15875 Namespaced link must have a title
15876 !! wikitext
15877 [[Project:]]
15878 !! html
15879 <p>[[Project:]]
15880 </p>
15881 !!end
15882
15883 !! test
15884 Namespaced link must have a title (bad fragment version)
15885 !! wikitext
15886 [[Project:#fragment]]
15887 !! html
15888 <p>[[Project:#fragment]]
15889 </p>
15890 !!end
15891
15892
15893 ###
15894 ### HTML tags and HTML attributes
15895 ###
15896
15897 !! test
15898 div with no attributes
15899 !! wikitext
15900 <div>HTML rocks</div>
15901 !! html
15902 <div>HTML rocks</div>
15903
15904 !! end
15905
15906 !! test
15907 div with double-quoted attribute
15908 !! wikitext
15909 <div id="rock">HTML rocks</div>
15910 !! html
15911 <div id="rock">HTML rocks</div>
15912
15913 !! end
15914
15915 !! test
15916 div with single-quoted attribute
15917 !! wikitext
15918 <div id='rock'>HTML rocks</div>
15919 !! html
15920 <div id="rock">HTML rocks</div>
15921
15922 !! end
15923
15924 !! test
15925 div with unquoted attribute
15926 !! wikitext
15927 <div id=rock>HTML rocks</div>
15928 !! html
15929 <div id="rock">HTML rocks</div>
15930
15931 !! end
15932
15933 !! test
15934 div with illegal double attributes
15935 !! wikitext
15936 <div id="a" id="b">HTML rocks</div>
15937 !! html
15938 <div id="b">HTML rocks</div>
15939
15940 !!end
15941
15942 !! test
15943 div with empty attribute value, space before equals
15944 !! options
15945 parsoid=wt2html,html2html
15946 !! wikitext
15947 <div class =>HTML rocks</div>
15948 !! html/php
15949 <div class="">HTML rocks</div>
15950
15951 !! html/parsoid
15952 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15953 !! end
15954
15955 !! test
15956 div with multiple empty attribute values
15957 !! options
15958 parsoid=wt2html,html2html
15959 !! wikitext
15960 <div id= title=>HTML rocks</div>
15961 !! html/php
15962 <div id="title.3D">HTML rocks</div>
15963
15964 !! html/parsoid
15965 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15966 !! end
15967
15968 !! test
15969 table with multiple empty attribute values
15970 !! options
15971 parsoid=wt2html,html2html
15972 !! wikitext
15973 {| title= id=
15974 | hi
15975 |}
15976 !! html/php
15977 <table title="id=">
15978 <tr>
15979 <td> hi
15980 </td></tr></table>
15981
15982 !! html/parsoid
15983 <table title="id=">
15984 <tbody><tr><td> hi</td></tr>
15985 </tbody></table>
15986 !! end
15987
15988 !! test
15989 div with braces in attribute value
15990 !! wikitext
15991 <div title="{}">Foo</div>
15992 !! html/php
15993 <div title="&#123;}">Foo</div>
15994
15995 !! html/parsoid
15996 <div title="{}">Foo</div>
15997 !! end
15998
15999 !! test
16000 div with empty attribute value, no space before equals
16001 !! options
16002 parsoid=wt2html,html2html
16003 !! wikitext
16004 <div class=>HTML rocks</div>
16005 !! html/php
16006 <div class="">HTML rocks</div>
16007
16008 !! html/parsoid
16009 <div class="">HTML rocks</div>
16010 !! end
16011
16012 !! test
16013 HTML multiple attributes correction
16014 !! wikitext
16015 <p class="error" class="awesome">Awesome!</p>
16016 !! html
16017 <p class="awesome">Awesome!</p>
16018
16019 !!end
16020
16021 !! test
16022 Table multiple attributes correction
16023 !! wikitext
16024 {|
16025 !+ class="error" class="awesome"| status
16026 |}
16027 !! html
16028 <table>
16029 <tr>
16030 <th class="awesome"> status
16031 </th></tr></table>
16032
16033 !!end
16034
16035 !! test
16036 DIV IN UPPERCASE
16037 !! wikitext
16038 <DIV ID="x">HTML ROCKS</DIV>
16039 !! html
16040 <div id="x">HTML ROCKS</div>
16041
16042 !!end
16043
16044 !! test
16045 Non-ASCII pseudo-tags are rendered as text
16046 !! wikitext
16047 <khyô>
16048 !! html
16049 <p>&lt;khyô&gt;
16050 </p>
16051 !! end
16052
16053 !! test
16054 Pseudo-tag with URL 'name' renders as url link
16055 !! wikitext
16056 <http://example.com/>
16057 !! html
16058 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16059 </p>
16060 !! end
16061
16062 !! test
16063 text with amp in the middle of nowhere
16064 !! wikitext
16065 Remember AT&T?
16066 !! html
16067 <p>Remember AT&amp;T?
16068 </p>
16069 !! end
16070
16071 !! test
16072 text with character entity: eacute
16073 !! wikitext
16074 I always thought &eacute; was a cute letter.
16075 !! html
16076 <p>I always thought &#233; was a cute letter.
16077 </p>
16078 !! html+tidy
16079 <p>I always thought é was a cute letter.</p>
16080 !! end
16081
16082 !! test
16083 text with entity-escaped character entity-like string: eacute
16084 !! wikitext
16085 I always thought &amp;eacute; was a cute letter.
16086 !! html
16087 <p>I always thought &amp;eacute; was a cute letter.
16088 </p>
16089 !! end
16090
16091 !! test
16092 text with undefined character entity: xacute
16093 !! wikitext
16094 I always thought &xacute; was a cute letter.
16095 !! html
16096 <p>I always thought &amp;xacute; was a cute letter.
16097 </p>
16098 !! end
16099
16100 !! test
16101 HTML5 tags
16102 !! wikitext
16103 <data value="5">five</data>
16104 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16105 <mark>This highlighted text</mark>
16106 !! html
16107 <p><data value="5">five</data>
16108 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16109 <mark>This highlighted text</mark>
16110 </p>
16111 !! end
16112
16113 !! test
16114 HTML tag with leading space is parsed as text
16115 !! wikitext
16116 < div>foo< /div>
16117 !! html
16118 <p>&lt; div&gt;foo&lt; /div&gt;
16119 </p>
16120 !! end
16121
16122 ###
16123 ### Nesting tests (see bug 41545, 50604, 51081)
16124 ###
16125
16126 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16127 # Note that html2wt is considerably more difficult if we use <b> in
16128 # the test case, instead of <big>
16129 !! test
16130 Ensure that HTML adoption agency algorithm is properly implemented.
16131 !! wikitext
16132 <big>X<big>Y</big>Z</big>
16133 !! html
16134 <p><big>X<big>Y</big>Z</big>
16135 </p>
16136 !! end
16137
16138 # This was bug 41545 in the PHP parser.
16139 # Note that tidy doesn't handle this correctly.
16140 !! test
16141 Nesting of <kbd>
16142 !! wikitext
16143 <kbd>X<kbd>Y</kbd>Z</kbd>
16144 !! html
16145 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16146 </p>
16147 !! end
16148
16149 # The following cases were bug 51081 in the PHP parser.
16150 # Note that there are some other nestable tags (b, i, etc) which are
16151 # not covered; see bug 51081 for discussion.
16152
16153 # Note that tidy doesn't handle this correctly.
16154 !! test
16155 Nesting of <em>
16156 !! wikitext
16157 <em>X<em>Y</em>Z</em>
16158 !! html
16159 <p><em>X<em>Y</em>Z</em>
16160 </p>
16161 !! end
16162
16163 # Note that tidy doesn't handle this correctly.
16164 !! test
16165 Nesting of <strong>
16166 !! wikitext
16167 <strong>X<strong>Y</strong>Z</strong>
16168 !! html
16169 <p><strong>X<strong>Y</strong>Z</strong>
16170 </p>
16171 !! end
16172
16173 !! test
16174 Nesting of <q>
16175 !! wikitext
16176 <q>X<q>Y</q>Z</q>
16177 !! html+tidy
16178 <p><q>X<q>Y</q>Z</q></p>
16179 !! end
16180
16181 # Note that tidy doesn't handle this correctly.
16182 !! test
16183 Nesting of <ruby>
16184 !! wikitext
16185 <ruby>X<ruby>Y</ruby>Z</ruby>
16186 !! html
16187 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16188 </p>
16189 !! end
16190
16191 # Note that tidy doesn't handle this correctly.
16192 !! test
16193 Nesting of <bdo>
16194 !! wikitext
16195 <bdo>X<bdo>Y</bdo>Z</bdo>
16196 !! html
16197 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16198 </p>
16199 !! end
16200
16201
16202 ###
16203 ### Media links
16204 ###
16205
16206 !! test
16207 Media link
16208 !! wikitext
16209 [[Media:Foobar.jpg]]
16210 !! html
16211 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16212 </p>
16213 !! end
16214
16215 !! test
16216 Media link with text
16217 !! wikitext
16218 [[Media:Foobar.jpg|A neat file to look at]]
16219 !! html
16220 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16221 </p>
16222 !! end
16223
16224 # FIXME: this is still bad HTML tag nesting
16225 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16226 !! test
16227 Media link with nasty text
16228 !! wikitext
16229 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16230 !! html
16231 <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>
16232
16233 !! html+tidy
16234 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16235 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16236 !! end
16237
16238 !! test
16239 Media link to nonexistent file (bug 1702)
16240 !! wikitext
16241 [[Media:No such.jpg]]
16242 !! html
16243 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16244 </p>
16245 !! end
16246
16247 !! test
16248 Image link to nonexistent file (bug 1850 - good)
16249 !! wikitext
16250 [[File:No_such.jpg]]
16251 !! html/php
16252 <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>
16253 </p>
16254 !! html/parsoid
16255 <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>
16256 !! end
16257
16258 !! test
16259 :Image link to nonexistent file (bug 1850 - bad)
16260 !! wikitext
16261 [[:Image:No such.jpg]]
16262 !! html/php
16263 <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>
16264 </p>
16265 !! html/parsoid
16266 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16267 !! end
16268
16269
16270
16271 !! test
16272 Character reference normalization in link text (bug 1938)
16273 !! wikitext
16274 [[Main Page|this&that]]
16275 !! html
16276 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16277 </p>
16278 !!end
16279
16280 !! article
16281 אַ
16282 !! text
16283 Test for unicode normalization
16284
16285 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16286 !! endarticle
16287
16288 !! test
16289 (bug 19451) Links should refer to the normalized form.
16290 !! wikitext
16291 [[&#xFB2E;]]
16292 [[&#x5d0;&#x5b7;]]
16293 [[&#x5d0;ַ]]
16294 [[א&#x5b7;]]
16295 [[אַ]]
16296 !! html
16297 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16298 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16299 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16300 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16301 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16302 </p>
16303 !! end
16304
16305 !! test
16306 Empty attribute crash test (bug 2067)
16307 !! wikitext
16308 <font color="">foo</font>
16309 !! html
16310 <p><font color="">foo</font>
16311 </p>
16312 !! end
16313
16314 !! test
16315 Empty attribute crash test single-quotes (bug 2067)
16316 !! wikitext
16317 <font color=''>foo</font>
16318 !! html
16319 <p><font color="">foo</font>
16320 </p>
16321 !! end
16322
16323 !! test
16324 Attribute test: equals, then nothing
16325 !! options
16326 parsoid=wt2html,html2html
16327 !! wikitext
16328 <font color=>foo</font>
16329 !! html/php
16330 <p><font color="">foo</font>
16331 </p>
16332 !! html/parsoid
16333 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16334 !! end
16335
16336 !! test
16337 Attribute test: unquoted value
16338 !! options
16339 parsoid=wt2html,html2html
16340 !! wikitext
16341 <font color=x>foo</font>
16342 !! html/php
16343 <p><font color="x">foo</font>
16344 </p>
16345 !! html/parsoid
16346 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16347 !! end
16348
16349 !! test
16350 Attribute test: unquoted but illegal value (hash)
16351 !! wikitext
16352 <font color=#x>foo</font>
16353 !! html
16354 <p><font color="#x">foo</font>
16355 </p>
16356 !! end
16357
16358 # Parsoid does not serialize to empty attribute syntax,
16359 # so wt2wt and html2wt cases are skipped
16360 !! test
16361 Attribute test: no value (T54330)
16362 !! options
16363 parsoid=wt2html,html2html
16364 !! wikitext
16365 <font color>foo</font>
16366 !! html/php
16367 <p><font color="">foo</font>
16368 </p>
16369 !! html/parsoid
16370 <p><font color="">foo</font></p>
16371 !! end
16372
16373 !! test
16374 Bug 2095: link with three closing brackets
16375 !! wikitext
16376 [[Main Page]]]
16377 !! html/php
16378 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16379 </p>
16380 !! html/parsoid
16381 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16382 !! end
16383
16384 !! test
16385 Bug 2095: link with pipe and three closing brackets
16386 !! wikitext
16387 [[Main Page|link]]]
16388 !! html/php
16389 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16390 </p>
16391 !! html/parsoid
16392 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16393 !! end
16394
16395 !! test
16396 Bug 2095: link with pipe and three closing brackets, version 2
16397 !! wikitext
16398 [[Main Page|[http://example.com/]]]
16399 !! html/php
16400 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16401 </p>
16402 !! html/parsoid
16403 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16404 !! end
16405
16406
16407 ###
16408 ### Safety
16409 ###
16410
16411 !! article
16412 Template:Dangerous attribute
16413 !! text
16414 " onmouseover="alert(document.cookie)
16415 !! endarticle
16416
16417 !! article
16418 Template:Dangerous style attribute
16419 !! text
16420 border-size: expression(alert(document.cookie))
16421 !! endarticle
16422
16423 !! article
16424 Template:Div style
16425 !! text
16426 <div style="float: right; {{{1}}}">Magic div</div>
16427 !! endarticle
16428
16429 !! test
16430 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16431 !! wikitext
16432 <div title="{{test}}"></div>
16433 !! html
16434 <div title="This is a test template"></div>
16435
16436 !! end
16437
16438 # Parsoid has enough context to handle this case
16439 !! test
16440 Bug 2304: HTML attribute safety (dangerous template; 2309)
16441 !! wikitext
16442 <div title="{{dangerous attribute}}"></div>
16443 !! html/php
16444 <div title=""></div>
16445
16446 !! html/parsoid
16447 <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>
16448 !! end
16449
16450 !! test
16451 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16452 !! wikitext
16453 <div style="{{dangerous style attribute}}"></div>
16454 !! html
16455 <div style="/* insecure input */"></div>
16456
16457 !! end
16458
16459 !! test
16460 Bug 2304: HTML attribute safety (safe parameter; 2309)
16461 !! wikitext
16462 {{div style|width: 200px}}
16463 !! html
16464 <div style="float: right; width: 200px">Magic div</div>
16465
16466 !! end
16467
16468 !! test
16469 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16470 !! wikitext
16471 {{div style|width: expression(alert(document.cookie))}}
16472 !! html
16473 <div style="/* insecure input */">Magic div</div>
16474
16475 !! end
16476
16477 !! test
16478 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16479 !! wikitext
16480 {{div style|"><script>alert(document.cookie)</script>}}
16481 !! html
16482 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16483
16484 !! end
16485
16486 !! test
16487 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16488 !! wikitext
16489 {{div style|" ><script>alert(document.cookie)</script>}}
16490 !! html
16491 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16492
16493 !! end
16494
16495 !! test
16496 Bug 2304: HTML attribute safety (link)
16497 !! wikitext
16498 <div title="[[Main Page]]"></div>
16499 !! html
16500 <div title="&#91;&#91;Main Page]]"></div>
16501
16502 !! end
16503
16504 !! test
16505 Bug 2304: HTML attribute safety (italics)
16506 !! wikitext
16507 <div title="''foobar''"></div>
16508 !! html
16509 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16510
16511 !! end
16512
16513 !! test
16514 Bug 2304: HTML attribute safety (bold)
16515 !! wikitext
16516 <div title="'''foobar'''"></div>
16517 !! html
16518 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16519
16520 !! end
16521
16522
16523 !! test
16524 Bug 2304: HTML attribute safety (ISBN)
16525 !! wikitext
16526 <div title="ISBN 1234567890"></div>
16527 !! html
16528 <div title="&#73;SBN 1234567890"></div>
16529
16530 !! end
16531
16532 !! test
16533 Bug 2304: HTML attribute safety (RFC)
16534 !! wikitext
16535 <div title="RFC 1234"></div>
16536 !! html
16537 <div title="&#82;FC 1234"></div>
16538
16539 !! end
16540
16541 !! test
16542 Bug 2304: HTML attribute safety (PMID)
16543 !! wikitext
16544 <div title="PMID 1234567890"></div>
16545 !! html
16546 <div title="&#80;MID 1234567890"></div>
16547
16548 !! end
16549
16550 !! test
16551 Bug 2304: HTML attribute safety (web link)
16552 !! wikitext
16553 <div title="http://example.com/"></div>
16554 !! html
16555 <div title="http&#58;//example.com/"></div>
16556
16557 !! end
16558
16559 !! test
16560 Bug 2304: HTML attribute safety (named web link)
16561 !! wikitext
16562 <div title="[http://example.com/ link]"></div>
16563 !! html
16564 <div title="&#91;http&#58;//example.com/ link]"></div>
16565
16566 !! end
16567
16568 !! test
16569 Bug 3244: HTML attribute safety (extension; safe)
16570 !! wikitext
16571 <div style="<nowiki>background:blue</nowiki>"></div>
16572 !! html
16573 <div style="background:blue"></div>
16574
16575 !! end
16576
16577 !! test
16578 Bug 3244: HTML attribute safety (extension; unsafe)
16579 !! wikitext
16580 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16581 !! html
16582 <div style="/* insecure input */"></div>
16583
16584 !! end
16585
16586 # More MSIE fun discovered by Tom Gilder
16587
16588 !! test
16589 MSIE CSS safety test: spurious slash
16590 !! wikitext
16591 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16592 !! html
16593 <div style="/* insecure input */">evil</div>
16594
16595 !! end
16596
16597 !! test
16598 MSIE CSS safety test: hex code
16599 !! wikitext
16600 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16601 !! html
16602 <div style="/* insecure input */">evil</div>
16603
16604 !! end
16605
16606 !! test
16607 MSIE CSS safety test: comment in url
16608 !! wikitext
16609 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16610 !! html
16611 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16612
16613 !! end
16614
16615 !! test
16616 MSIE CSS safety test: comment in expression
16617 !! wikitext
16618 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16619 !! html
16620 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16621
16622 !! end
16623
16624 !! test
16625 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16626 !! wikitext
16627 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16628 !! html
16629 <p style="/* invalid control char */">A</p>
16630
16631 !! end
16632
16633 !! test
16634 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16635 !! wikitext
16636 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16637 <div style="top:EXPRESSION(alert())">B</div>
16638 !! html
16639 <p style="/* insecure input */">A</p>
16640 <div style="/* insecure input */">B</div>
16641
16642 !! end
16643
16644 !! test
16645 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16646 !! wikitext
16647 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16648 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16649 !! html
16650 <div style="/* insecure input */">A</div>
16651 <p style="/* insecure input */">B</p>
16652
16653 !! end
16654
16655 !! test
16656 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16657 !! wikitext
16658 <div style="background-image:url⁽javascript:alert())">A</div>
16659 <div style="background-image:url₍javascript:alert())">B</div>
16660 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16661 !! html
16662 <div style="/* insecure input */">A</div>
16663 <div style="/* insecure input */">B</div>
16664 <p style="/* insecure input */">C</p>
16665
16666 !! end
16667
16668 # FIXME: Parsoid fails to sanitize this! See T58846.
16669 !! test
16670 Opera -o-link CSS
16671 !! wikitext
16672 <div
16673 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;"
16674 style="-o-link:attr(title);-o-link-source:current">X</div>
16675 !! html
16676 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16677
16678 !! end
16679
16680 !! test
16681 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16682 !! wikitext
16683 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16684 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16685 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16686 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16687 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16688 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16689 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16690 !! html
16691 <p style="/* insecure input */">A</p>
16692 <p style="/* insecure input */">B</p>
16693 <p style="/* insecure input */">C</p>
16694 <p style="/* insecure input */">D</p>
16695 <p style="/* insecure input */">E</p>
16696 <p style="/* insecure input */">F</p>
16697 <p style="/* insecure input */">G</p>
16698
16699 !! end
16700
16701 !! test
16702 Table attribute legitimate extension
16703 !! wikitext
16704 {|
16705 !+ style="<nowiki>color:blue</nowiki>"| status
16706 |}
16707 !! html
16708 <table>
16709 <tr>
16710 <th style="color:blue"> status
16711 </th></tr></table>
16712
16713 !!end
16714
16715 !! test
16716 Table attribute safety
16717 !! wikitext
16718 {|
16719 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16720 |}
16721 !! html
16722 <table>
16723 <tr>
16724 <th style="/* insecure input */"> status
16725 </th></tr></table>
16726
16727 !! end
16728
16729 !! test
16730 CSS line continuation 1
16731 !! wikitext
16732 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16733 !! html
16734 <div style="/* insecure input */"></div>
16735
16736 !! end
16737
16738 !! test
16739 CSS line continuation 2
16740 !! wikitext
16741 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16742 !! html
16743 <div style="/* invalid control char */"></div>
16744
16745 !! end
16746
16747 !! article
16748 Template:Identity
16749 !! text
16750 {{{1}}}
16751 !! endarticle
16752
16753 !! test
16754 Expansion of multi-line templates in attribute values (bug 6255)
16755 !! wikitext
16756 <div style="background: {{identity|#00FF00}}">-</div>
16757 !! html
16758 <div style="background: #00FF00">-</div>
16759
16760 !! end
16761
16762
16763 !! test
16764 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16765 !! wikitext
16766 <div style="background:
16767 #00FF00">-</div>
16768 !! html/php
16769 <div style="background: #00FF00">-</div>
16770
16771 !! html/parsoid
16772 <div style="background:
16773 #00FF00">-</div>
16774 !! end
16775
16776 !! test
16777 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16778 !! wikitext
16779 <div style="background: &#10;#00FF00">-</div>
16780 !! html
16781 <div style="background: &#10;#00FF00">-</div>
16782
16783 !! end
16784
16785 !! test
16786 Tags which are hidden from Tidy cannot pass through the Sanitizer
16787 !! wikitext
16788 <mw:toc><script>alert();</script></mw:toc>
16789 !! html+tidy
16790 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16791 !! end
16792
16793 ###
16794 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16795 ###
16796 !! test
16797 Parser hook: empty input
16798 !! wikitext
16799 <tag></tag>
16800 !! html/php
16801 <pre>
16802 ''
16803 array (
16804 )
16805 </pre>
16806
16807 !! html/parsoid
16808 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16809 !! end
16810
16811 ## Don't expect parsoid to rt this form.
16812 !! test
16813 Parser hook: empty input using terminated empty elements
16814 !! options
16815 parsoid=wt2html,html2html
16816 !! wikitext
16817 <tag/>
16818 !! html/php
16819 <pre>
16820 NULL
16821 array (
16822 )
16823 </pre>
16824
16825 !! html/parsoid
16826 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16827 !! end
16828
16829 !! test
16830 Parser hook: empty input using terminated empty elements (space before)
16831 !! wikitext
16832 <tag />
16833 !! html/php
16834 <pre>
16835 NULL
16836 array (
16837 )
16838 </pre>
16839
16840 !! html/parsoid
16841 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16842 !! end
16843
16844 !! test
16845 Parser hook: basic input
16846 !! wikitext
16847 <tag>input</tag>
16848 !! html/php
16849 <pre>
16850 'input'
16851 array (
16852 )
16853 </pre>
16854
16855 !! html/parsoid
16856 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16857 !! end
16858
16859 ## Don't expect parsoid to rt this form.
16860 !! test
16861 Parser hook: case insensitive
16862 !! options
16863 parsoid=wt2html,html2html
16864 !! wikitext
16865 <TAG>input</TAG>
16866 !! html/php
16867 <pre>
16868 'input'
16869 array (
16870 )
16871 </pre>
16872
16873 !! html/parsoid
16874 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16875 !! end
16876
16877 ## Don't expect parsoid to rt this form.
16878 !! test
16879 Parser hook: case insensitive, redux
16880 !! options
16881 parsoid=wt2html,html2html
16882 !! wikitext
16883 <TaG>input</TAg>
16884 !! html/php
16885 <pre>
16886 'input'
16887 array (
16888 )
16889 </pre>
16890
16891 !! html/parsoid
16892 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16893 !! end
16894
16895 !! test
16896 Parser hook: nested tags
16897 !! wikitext
16898 <tag><tag></tag></tag>
16899 !! html/php
16900 <pre>
16901 '<tag>'
16902 array (
16903 )
16904 </pre>&lt;/tag&gt;
16905
16906 !! html/parsoid
16907 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16908 !! end
16909
16910 !! test
16911 Parser hook: basic arguments
16912 !! wikitext
16913 <tag width="200" height="100" depth="50" square=""></tag>
16914 !! html/php
16915 <pre>
16916 ''
16917 array (
16918 'width' => '200',
16919 'height' => '100',
16920 'depth' => '50',
16921 'square' => '',
16922 )
16923 </pre>
16924
16925 !! html/parsoid
16926 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16927 !! end
16928
16929 ## Don't expect parsoid to rt this form.
16930 !! test
16931 Parser hook: basic arguments, variations
16932 !! options
16933 parsoid=wt2html,html2html
16934 !! wikitext
16935 <tag width=200 height = "100" depth = '50' square></tag>
16936 !! html/php
16937 <pre>
16938 ''
16939 array (
16940 'width' => '200',
16941 'height' => '100',
16942 'depth' => '50',
16943 'square' => '',
16944 )
16945 </pre>
16946
16947 !! html/parsoid
16948 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16949 !! end
16950
16951 !! test
16952 Parser hook: argument containing a forward slash (bug 5344)
16953 !! wikitext
16954 <tag filename="/tmp/bla"></tag>
16955 !! html/php
16956 <pre>
16957 ''
16958 array (
16959 'filename' => '/tmp/bla',
16960 )
16961 </pre>
16962
16963 !! html/parsoid
16964 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16965 !! end
16966
16967 ## Don't expect parsoid to rt this form.
16968 !! test
16969 Parser hook: empty input using terminated empty elements (bug 2374)
16970 !! options
16971 parsoid=wt2html,html2html
16972 !! wikitext
16973 <tag foo=bar/>text
16974 !! html/php
16975 <pre>
16976 NULL
16977 array (
16978 'foo' => 'bar',
16979 )
16980 </pre>text
16981
16982 !! html/parsoid
16983 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16984 !! end
16985
16986 ## </tag> should be output literally since there is no matching tag that begins it
16987 ## Don't expect parsoid to rt this form.
16988 !! test
16989 Parser hook: basic arguments using terminated empty elements (bug 2374)
16990 !! options
16991 parsoid=wt2html
16992 !! wikitext
16993 <tag width=200 height = "100" depth = '50' square/>
16994 other stuff
16995 </tag>
16996 !! html/php
16997 <pre>
16998 NULL
16999 array (
17000 'width' => '200',
17001 'height' => '100',
17002 'depth' => '50',
17003 'square' => '',
17004 )
17005 </pre>
17006 <p>other stuff
17007 &lt;/tag&gt;
17008 </p>
17009 !! html/parsoid
17010 <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
17011 &lt;/tag></p>
17012 !! end
17013
17014 ## Don't expect parsoid to rt this form.
17015 !! test
17016 Parser hook: Don't allow unclosed extension tags
17017 !! options
17018 parsoid=wt2html
17019 !! wikitext
17020 test <tag>123
17021
17022 this is a '''test'''
17023 !! html/php
17024 <p>test &lt;tag&gt;123
17025 </p><p>this is a <b>test</b>
17026 </p>
17027 !! html/parsoid
17028 <p>test &lt;tag>123</p>
17029
17030 <p>this is a <b>test</b></p>
17031 !! end
17032
17033 ###
17034 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17035 ###
17036
17037 !! test
17038 Parser hook: static parser hook not inside a comment
17039 !! wikitext
17040 <statictag>hello, world</statictag>
17041
17042 <statictag action="flush" />
17043 !! html/php
17044 <p><br />
17045 hello, world
17046 </p>
17047 !! html/parsoid
17048 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17049 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17050 !! end
17051
17052 !! test
17053 Parser hook: static parser hook inside a comment
17054 !! wikitext
17055 <!-- <statictag>hello, world</statictag> -->
17056 <statictag action="flush" />
17057 !! html/php
17058 <p><br />
17059 </p>
17060 !! html/parsoid
17061 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17062 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17063 !! end
17064
17065 # Nested template calls; this case was broken by Parser.php rev 1.506,
17066 # since reverted.
17067
17068 !! article
17069 Template:One-parameter
17070 !! text
17071 (My parameter is: {{{1}}})
17072 !! endarticle
17073
17074 !! article
17075 Template:Map-one-parameter
17076 !! text
17077 {{{{{1}}}|{{{2}}}}}
17078 !! endarticle
17079
17080 !! test
17081 Nested template calls
17082 !! wikitext
17083 {{Map-one-parameter|One-parameter|param}}
17084 !! html
17085 <p>(My parameter is: param)
17086 </p>
17087 !! end
17088
17089
17090 ###
17091 ### Sanitizer
17092 ###
17093
17094 # HTML+Tidy effectively strips out the empty tags completely
17095 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17096 # which Tidy would have done for the PHP parser had there been content inside it.
17097 !! test
17098 Sanitizer: Closing of open tags
17099 !! wikitext
17100 <s></s><table></table>
17101 !! html
17102 <s></s><table></table>
17103
17104 !! html/parsoid
17105 <p><s></s></p><table></table>
17106 !! end
17107
17108 !! test
17109 Sanitizer: Closing of open but not closed tags
17110 !! wikitext
17111 <s>foo
17112 !! html
17113 <p><s>foo</s>
17114 </p>
17115 !! end
17116
17117 !! test
17118 Sanitizer: Closing of closed but not open tags
17119 !! options
17120 parsoid=wt2html
17121 !! wikitext
17122 </s>
17123 !! html/php+tidy
17124 !! html/parsoid
17125 !! end
17126
17127 !! test
17128 Sanitizer: Closing of closed but not open table tags
17129 !! options
17130 parsoid=wt2html
17131 !! wikitext
17132 Table not started</td></tr></table>
17133 !! html/php+tidy
17134 <p>Table not started</p>
17135 !! html/parsoid
17136 <p>Table not started</p>
17137 !! end
17138
17139 !! test
17140 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17141 !! wikitext
17142 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17143 !! html/php
17144 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17145 </p>
17146 !! html/parsoid
17147 <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>
17148 !! end
17149
17150 # In HTML5, the restrictions are that id must contain at least one character,
17151 # and must not contain any space characters.
17152 !! test
17153 Sanitizer: Validating the contents of the id attribute (bug 4515)
17154 !! options
17155 disabled
17156 !! wikitext
17157 <br id="" /><br id="a space" />
17158 !! html
17159 Something ...
17160 !! end
17161
17162 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17163 !! test
17164 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17165 !! options
17166 disabled
17167 !! wikitext
17168 <br id="foo" /><br id="foo" />
17169 !! html
17170 Something need to be done. foo-2 ?
17171 !! end
17172
17173 !! test
17174 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17175 !! wikitext
17176 <div itemscope>
17177 <meta itemprop="hello" content="world">
17178 <meta http-equiv="refresh" content="5">
17179 <meta itemprop="hello" http-equiv="refresh" content="5">
17180 <link itemprop="hello" href="{{SERVER}}">
17181 <link rel="stylesheet" href="{{SERVER}}">
17182 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17183 </div>
17184 !! html
17185 <div itemscope="">
17186 <p> <meta itemprop="hello" content="world" />
17187 &lt;meta http-equiv="refresh" content="5"&gt;
17188 <meta itemprop="hello" content="5" />
17189 </p>
17190 <link itemprop="hello" href="http&#58;//example.org" />
17191 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17192 <link itemprop="hello" href="http&#58;//example.org" />
17193 </div>
17194
17195 !! end
17196
17197 !! test
17198 Language converter: output gets cut off unexpectedly (bug 5757)
17199 !! options
17200 language=zh
17201 !! wikitext
17202 this bit is safe: }-
17203
17204 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17205
17206 then we get cut off here: }-
17207
17208 all additional text is vanished
17209 !! html
17210 <p>this bit is safe: }-
17211 </p><p>but if we add a conversion instance: xxx
17212 </p><p>then we get cut off here: }-
17213 </p><p>all additional text is vanished
17214 </p>
17215 !! end
17216
17217 !! test
17218 Self closed html pairs (bug 5487)
17219 !! options
17220 !! wikitext
17221 <center><font id="bug" />Centered text</center>
17222 <div><font id="bug2" />In div text</div>
17223 !! html
17224 <center>&lt;font id="bug" /&gt;Centered text</center>
17225 <div>&lt;font id="bug2" /&gt;In div text</div>
17226
17227 !! end
17228
17229 #
17230 #
17231 #
17232
17233 !! test
17234 Punctuation: nbsp before exclamation
17235 !! wikitext
17236 C'est grave !
17237 !! html
17238 <p>C'est grave&#160;!
17239 </p>
17240 !! end
17241
17242 !! test
17243 Punctuation: CSS !important (bug 11874)
17244 !! wikitext
17245 <div style="width:50% !important">important</div>
17246 !! html
17247 <div style="width:50% !important">important</div>
17248
17249 !!end
17250
17251 !! test
17252 Punctuation: CSS ! important (bug 11874; with space after)
17253 !! wikitext
17254 <div style="width:50% ! important">important</div>
17255 !! html
17256 <div style="width:50% ! important">important</div>
17257
17258 !!end
17259
17260 !! test
17261 HTML bullet list, closed tags (bug 5497)
17262 !! wikitext
17263 <ul>
17264 <li>One</li>
17265 <li>Two</li>
17266 </ul>
17267 !! html/php
17268 <ul>
17269 <li>One</li>
17270 <li>Two</li>
17271 </ul>
17272
17273 !! html/parsoid
17274 <ul data-parsoid='{"stx":"html"}'>
17275 <li data-parsoid='{"stx":"html"}'>One</li>
17276 <li data-parsoid='{"stx":"html"}'>Two</li>
17277 </ul>
17278
17279 !! end
17280
17281 !! test
17282 HTML bullet list, unclosed tags (bug 5497)
17283 !! wikitext
17284 <ul>
17285 <li>One
17286 <li>Two
17287 </ul>
17288 !! html/php+tidy
17289 <ul>
17290 <li>One</li>
17291 <li>Two</li>
17292 </ul>
17293 !! html/parsoid
17294 <ul data-parsoid='{"stx":"html"}'>
17295 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17296 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17297 </ul>
17298
17299 !! end
17300
17301 !! test
17302 HTML ordered list, closed tags (bug 5497)
17303 !! wikitext
17304 <ol>
17305 <li>One</li>
17306 <li>Two</li>
17307 </ol>
17308 !! html/php
17309 <ol>
17310 <li>One</li>
17311 <li>Two</li>
17312 </ol>
17313
17314 !! html/parsoid
17315 <ol data-parsoid='{"stx":"html"}'>
17316 <li data-parsoid='{"stx":"html"}'>One</li>
17317 <li data-parsoid='{"stx":"html"}'>Two</li>
17318 </ol>
17319
17320 !! end
17321
17322 !! test
17323 HTML ordered list, unclosed tags (bug 5497)
17324 !! options
17325 !! wikitext
17326 <ol>
17327 <li>One
17328 <li>Two
17329 </ol>
17330 !! html/php+tidy
17331 <ol>
17332 <li>One</li>
17333 <li>Two</li>
17334 </ol>
17335 !! html/parsoid
17336 <ol data-parsoid='{"stx":"html"}'>
17337 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17338 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17339 </ol>
17340
17341 !! end
17342
17343 !! test
17344 HTML nested bullet list, closed tags (bug 5497)
17345 !! wikitext
17346 <ul>
17347 <li>One</li>
17348 <li>Two:
17349 <ul>
17350 <li>Sub-one</li>
17351 <li>Sub-two</li>
17352 </ul>
17353 </li>
17354 </ul>
17355 !! html/php
17356 <ul>
17357 <li>One</li>
17358 <li>Two:
17359 <ul>
17360 <li>Sub-one</li>
17361 <li>Sub-two</li>
17362 </ul>
17363 </li>
17364 </ul>
17365
17366 !! html/parsoid
17367 <ul data-parsoid='{"stx":"html"}'>
17368 <li data-parsoid='{"stx":"html"}'>One</li>
17369 <li data-parsoid='{"stx":"html"}'>Two:
17370 <ul data-parsoid='{"stx":"html"}'>
17371 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17372 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17373 </ul>
17374 </li>
17375 </ul>
17376 !! end
17377
17378 !! test
17379 HTML nested bullet list, open tags (bug 5497)
17380 !! wikitext
17381 <ul>
17382 <li>One
17383 <li>Two:
17384 <ul>
17385 <li>Sub-one
17386 <li>Sub-two
17387 </ul>
17388 </ul>
17389 !! html/php+tidy
17390 <ul>
17391 <li>One</li>
17392 <li>Two:
17393 <ul>
17394 <li>Sub-one</li>
17395 <li>Sub-two</li>
17396 </ul>
17397 </li>
17398 </ul>
17399 !! html/parsoid
17400 <ul>
17401 <li>One
17402 </li>
17403 <li>Two:
17404 <ul>
17405 <li>Sub-one
17406 </li>
17407 <li>Sub-two
17408 </li>
17409 </ul>
17410 </li>
17411 </ul>
17412
17413 !! end
17414
17415 !! test
17416 HTML nested ordered list, closed tags (bug 5497)
17417 !! wikitext
17418 <ol>
17419 <li>One</li>
17420 <li>Two:
17421 <ol>
17422 <li>Sub-one</li>
17423 <li>Sub-two</li>
17424 </ol>
17425 </li>
17426 </ol>
17427 !! html
17428 <ol>
17429 <li>One</li>
17430 <li>Two:
17431 <ol>
17432 <li>Sub-one</li>
17433 <li>Sub-two</li>
17434 </ol>
17435 </li>
17436 </ol>
17437
17438 !! end
17439
17440 !! test
17441 HTML nested ordered list, open tags (bug 5497)
17442 !! wikitext
17443 <ol>
17444 <li>One
17445 <li>Two:
17446 <ol>
17447 <li>Sub-one
17448 <li>Sub-two
17449 </ol>
17450 </ol>
17451 !! html/php
17452 <ol>
17453 <li>One
17454 <li>Two:
17455 <ol>
17456 <li>Sub-one
17457 <li>Sub-two
17458 </ol>
17459 </ol>
17460
17461 !! html/parsoid
17462 <ol>
17463 <li>One
17464 </li>
17465 <li>Two:
17466 <ol>
17467 <li>Sub-one
17468 </li>
17469 <li>Sub-two
17470 </li>
17471 </ol>
17472 </li>
17473 </ol>
17474
17475 !! end
17476
17477 !! test
17478 HTML ordered list item with parameters oddity
17479 !! wikitext
17480 <ol><li id="fragment">One</li>
17481 </ol>
17482 !! html
17483 <ol><li id="fragment">One</li>
17484 </ol>
17485
17486 !! end
17487
17488 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17489 !!test
17490 bug 5918: autonumbering
17491 !! wikitext
17492 [http://first/] [http://second] [ftp://ftp]
17493
17494 ftp://inlineftp
17495
17496 [mailto:enclosed@mail.tld With target]
17497
17498 [mailto:enclosed@mail.tld]
17499
17500 mailto:inline@mail.tld
17501 !! html/php
17502 <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>
17503 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17504 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17505 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17506 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17507 </p>
17508 !! html/parsoid
17509 <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>
17510 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17511 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17512 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17513 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17514 !! end
17515
17516
17517 #
17518 # Security and HTML correctness
17519 # From Nick Jenkins' fuzz testing
17520 #
17521
17522 !! test
17523 Fuzz testing: Parser13
17524 !! wikitext
17525 {|
17526 | http://a|
17527 !! html
17528 <table>
17529 <tr>
17530 <td>
17531 </td>
17532 </tr>
17533 </table>
17534
17535 !! end
17536
17537 !! test
17538 Fuzz testing: Parser14
17539 !! wikitext
17540 == onmouseover= ==
17541 http://__TOC__
17542 !! html
17543 <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>
17544 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17545 <ul>
17546 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17547 </ul>
17548 </div>
17549
17550
17551 !! html+tidy
17552 <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>
17553 <p>http://</p>
17554 <div id="toc" class="toc">
17555 <div id="toctitle">
17556 <h2>Contents</h2>
17557 </div>
17558 <ul>
17559 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17560 </ul>
17561 </div>
17562 <p></p>
17563 !! end
17564
17565 !! test
17566 Fuzz testing: Parser14-table
17567 !! options
17568 parsoid=wt2html,html2html
17569 !! wikitext
17570 ==a==
17571 {| STYLE=__TOC__
17572 !! html
17573 <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>
17574 <table style="&#95;_TOC&#95;_">
17575 <tr><td></td></tr>
17576 </table>
17577
17578 !! html+tidy
17579 <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>
17580 <table style="__TOC__">
17581 <tr>
17582 <td></td>
17583 </tr>
17584 </table>
17585 !! html/parsoid
17586 <h2>a</h2>
17587 <table style="__TOC__"></table>
17588 !! end
17589
17590 # Known to produce bogus xml (extra </td>)
17591 !! test
17592 Fuzz testing: Parser16
17593 !! wikitext
17594 {|
17595 !https://||||||
17596 !! html
17597 <table>
17598 <tr>
17599 <th>https://</th>
17600 <th></th>
17601 <th></th>
17602 <th>
17603 </td>
17604 </tr>
17605 </table>
17606
17607 !! html+tidy
17608 <table>
17609 <tr>
17610 <th>https://</th>
17611 <th></th>
17612 <th></th>
17613 <th></th>
17614 </tr>
17615 </table>
17616 !! end
17617
17618 !! test
17619 Fuzz testing: Parser21
17620 !! wikitext
17621 {|
17622 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17623 |
17624 !! html
17625 <table>
17626 <tr>
17627 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17628 </th>
17629 <td>
17630 </td>
17631 </tr>
17632 </table>
17633
17634 !! end
17635
17636 !! test
17637 Fuzz testing: Parser22
17638 !! wikitext
17639 http://===r:::https://b
17640
17641 {|
17642 !! html
17643 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17644 </p>
17645 <table>
17646 <tr><td></td></tr>
17647 </table>
17648
17649 !! end
17650
17651 # Known to produce bad XML for now
17652 !! test
17653 Fuzz testing: Parser24
17654 !! wikitext
17655 {|
17656 {{{|
17657 <u CLASS=
17658 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17659 <br style="onmouseover='alert(document.cookie);' " />
17660
17661 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17662 |
17663 !! html
17664 <table>
17665 {{{|
17666 <u class="&#124;">}}}} &gt;
17667 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17668
17669 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17670 <tr>
17671 <td></u>
17672 </td>
17673 </tr>
17674 </table>
17675
17676 !! end
17677
17678 # Note: the current result listed for this is not what the original one was,
17679 # but the original bug was JavaScript injection, which is fixed in any case.
17680 # It's not clear that the original result listed was any more correct than the
17681 # current one. Original result:
17682 # <p>{{{|
17683 # </p>
17684 # <li class="&#124;&#124;">
17685 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17686 !!test
17687 Fuzz testing: Parser25 (bug 6055)
17688 !! wikitext
17689 {{{
17690 |
17691 <LI CLASS=||
17692 >
17693 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17694 !! html
17695 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17696 </p>
17697 !! end
17698
17699 !!test
17700 Fuzz testing: URL adjacent extension (with space, clean)
17701 !! wikitext
17702 http://example.com <nowiki>junk</nowiki>
17703 !! html/php
17704 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17705 </p>
17706 !! html/parsoid
17707 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17708 !! end
17709
17710 !!test
17711 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17712 !! wikitext
17713 http://example.com<nowiki>junk</nowiki>
17714 !! html/php
17715 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17716 </p>
17717 !! html/parsoid
17718 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17719 !! end
17720
17721 !!test
17722 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17723 !! wikitext
17724 http://example.com<pre>junk</pre>
17725 !! html/php
17726 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17727
17728 !! html/php+tidy
17729 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17730 <pre>
17731 junk
17732 </pre>
17733 !! html/parsoid
17734 <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>
17735 !!end
17736
17737 !!test
17738 Fuzz testing: image with bogus manual thumbnail
17739 !! wikitext
17740 [[Image:foobar.jpg|thumbnail= ]]
17741 !! html/php
17742 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17743
17744 !! html/parsoid
17745 <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>
17746 !!end
17747
17748 !! test
17749 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17750 !! wikitext
17751 <pre dir="&#10;"></pre>
17752 !! html
17753 <pre dir="&#10;"></pre>
17754
17755 !! end
17756
17757 !! test
17758 Parsing optional HTML elements (Bug 6171)
17759 !! options
17760 !! wikitext
17761 <table>
17762 <tr>
17763 <td> Some tabular data</td>
17764 <td> More tabular data ...
17765 <td> And yet som tabular data</td>
17766 </tr>
17767 </table>
17768 !! html
17769 <table>
17770 <tr>
17771 <td> Some tabular data</td>
17772 <td> More tabular data ...
17773 </td><td> And yet som tabular data</td>
17774 </tr>
17775 </table>
17776
17777 !! end
17778
17779 !! test
17780 Correct handling of <td>, <tr> (Bug 6171)
17781 !! options
17782 !! wikitext
17783 <table>
17784 <tr>
17785 <td> Some tabular data</td>
17786 <td> More tabular data ...</td>
17787 <td> And yet som tabular data</td>
17788 </tr>
17789 </table>
17790 !! html
17791 <table>
17792 <tr>
17793 <td> Some tabular data</td>
17794 <td> More tabular data ...</td>
17795 <td> And yet som tabular data</td>
17796 </tr>
17797 </table>
17798
17799 !! end
17800
17801
17802 !! test
17803 Parsing crashing regression (fr:JavaScript)
17804 !! wikitext
17805 </body></x>
17806 !! html
17807 <p>&lt;/body&gt;&lt;/x&gt;
17808 </p>
17809 !! end
17810
17811 !! test
17812 Inline wiki vs wiki block nesting
17813 !! wikitext
17814 '''Bold paragraph
17815
17816 New wiki paragraph
17817 !! html
17818 <p><b>Bold paragraph</b>
17819 </p><p>New wiki paragraph
17820 </p>
17821 !! end
17822
17823 # FIXME: The current php output is documented
17824 # and desired output is the parsoid target.
17825 !! test
17826 Inline HTML vs wiki block nesting
17827 !! wikitext
17828 <b>Bold paragraph
17829
17830 New wiki paragraph
17831 !! html/php
17832 <p><b>Bold paragraph
17833 </p><p>New wiki paragraph</b>
17834 </p>
17835 !! html/parsoid
17836 <p><b>Bold paragraph</b>
17837 </p><p>New wiki paragraph
17838 </p>
17839 !! end
17840
17841 # Original result was this:
17842 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17843 # </p>
17844 # While that might be marginally more intuitive, maybe, the six-apostrophe
17845 # construct is clearly pathological and the result stated here (which is what
17846 # the parser actually does) is about as reasonable as anything.
17847 !!test
17848 Mixing markup for italics and bold
17849 !! options
17850 !! wikitext
17851 '''bold''''''bold''bolditalics'''''
17852 !! html
17853 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17854 </p>
17855 !! end
17856
17857
17858 !! article
17859 Xyzzyx
17860 !! text
17861 Article for special page transclusion test
17862 !! endarticle
17863
17864 !! test
17865 Special page transclusion
17866 !! options
17867 !! wikitext
17868 {{Special:Prefixindex/Xyzzyx}}
17869 !! html
17870 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17871 </ul>
17872
17873 !! end
17874
17875 !! test
17876 Special page transclusion twice (bug 5021)
17877 !! options
17878 !! wikitext
17879 {{Special:Prefixindex/Xyzzyx}}
17880 {{Special:Prefixindex/Xyzzyx}}
17881 !! html
17882 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17883 </ul>
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 Transclusion of default MediaWiki message
17891 !! wikitext
17892 {{MediaWiki:Mainpage}}
17893 !! html
17894 <p>Main Page
17895 </p>
17896 !! end
17897
17898 !! test
17899 Transclusion of nonexistent MediaWiki message
17900 !! wikitext
17901 {{MediaWiki:Mainpagexxx}}
17902 !! html
17903 <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>
17904 </p>
17905 !! end
17906
17907 !! test
17908 Transclusion of MediaWiki message with underscore
17909 !! wikitext
17910 {{MediaWiki:history_short}}
17911 !! html
17912 <p>History
17913 </p>
17914 !! end
17915
17916 !! test
17917 Transclusion of MediaWiki message with space
17918 !! wikitext
17919 {{MediaWiki:history short}}
17920 !! html
17921 <p>History
17922 </p>
17923 !! end
17924
17925 !! test
17926 Invalid header with following text
17927 !! wikitext
17928 = x = y
17929 !! html
17930 <p>= x = y
17931 </p>
17932 !! end
17933
17934
17935 !! test
17936 Section extraction test (section 0)
17937 !! options
17938 section=0
17939 !! wikitext
17940 start
17941 ==a==
17942 ===aa===
17943 ====aaa====
17944 ==b==
17945 ===ba===
17946 ===bb===
17947 ====bba====
17948 ===bc===
17949 ==c==
17950 ===ca===
17951 !! html/php
17952 start
17953 !! end
17954
17955 !! test
17956 Section extraction test (section 1)
17957 !! options
17958 section=1
17959 !! wikitext
17960 start
17961 ==a==
17962 ===aa===
17963 ====aaa====
17964 ==b==
17965 ===ba===
17966 ===bb===
17967 ====bba====
17968 ===bc===
17969 ==c==
17970 ===ca===
17971 !! html/php
17972 ==a==
17973 ===aa===
17974 ====aaa====
17975 !! end
17976
17977 !! test
17978 Section extraction test (section 2)
17979 !! options
17980 section=2
17981 !! wikitext
17982 start
17983 ==a==
17984 ===aa===
17985 ====aaa====
17986 ==b==
17987 ===ba===
17988 ===bb===
17989 ====bba====
17990 ===bc===
17991 ==c==
17992 ===ca===
17993 !! html/php
17994 ===aa===
17995 ====aaa====
17996 !! end
17997
17998 !! test
17999 Section extraction test (section 3)
18000 !! options
18001 section=3
18002 !! wikitext
18003 start
18004 ==a==
18005 ===aa===
18006 ====aaa====
18007 ==b==
18008 ===ba===
18009 ===bb===
18010 ====bba====
18011 ===bc===
18012 ==c==
18013 ===ca===
18014 !! html/php
18015 ====aaa====
18016 !! end
18017
18018 !! test
18019 Section extraction test (section 4)
18020 !! options
18021 section=4
18022 !! wikitext
18023 start
18024 ==a==
18025 ===aa===
18026 ====aaa====
18027 ==b==
18028 ===ba===
18029 ===bb===
18030 ====bba====
18031 ===bc===
18032 ==c==
18033 ===ca===
18034 !! html/php
18035 ==b==
18036 ===ba===
18037 ===bb===
18038 ====bba====
18039 ===bc===
18040 !! end
18041
18042 !! test
18043 Section extraction test (section 5)
18044 !! options
18045 section=5
18046 !! wikitext
18047 start
18048 ==a==
18049 ===aa===
18050 ====aaa====
18051 ==b==
18052 ===ba===
18053 ===bb===
18054 ====bba====
18055 ===bc===
18056 ==c==
18057 ===ca===
18058 !! html/php
18059 ===ba===
18060 !! end
18061
18062 !! test
18063 Section extraction test (section 6)
18064 !! options
18065 section=6
18066 !! wikitext
18067 start
18068 ==a==
18069 ===aa===
18070 ====aaa====
18071 ==b==
18072 ===ba===
18073 ===bb===
18074 ====bba====
18075 ===bc===
18076 ==c==
18077 ===ca===
18078 !! html/php
18079 ===bb===
18080 ====bba====
18081 !! end
18082
18083 !! test
18084 Section extraction test (section 7)
18085 !! options
18086 section=7
18087 !! wikitext
18088 start
18089 ==a==
18090 ===aa===
18091 ====aaa====
18092 ==b==
18093 ===ba===
18094 ===bb===
18095 ====bba====
18096 ===bc===
18097 ==c==
18098 ===ca===
18099 !! html/php
18100 ====bba====
18101 !! end
18102
18103 !! test
18104 Section extraction test (section 8)
18105 !! options
18106 section=8
18107 !! wikitext
18108 start
18109 ==a==
18110 ===aa===
18111 ====aaa====
18112 ==b==
18113 ===ba===
18114 ===bb===
18115 ====bba====
18116 ===bc===
18117 ==c==
18118 ===ca===
18119 !! html/php
18120 ===bc===
18121 !! end
18122
18123 !! test
18124 Section extraction test (section 9)
18125 !! options
18126 section=9
18127 !! wikitext
18128 start
18129 ==a==
18130 ===aa===
18131 ====aaa====
18132 ==b==
18133 ===ba===
18134 ===bb===
18135 ====bba====
18136 ===bc===
18137 ==c==
18138 ===ca===
18139 !! html/php
18140 ==c==
18141 ===ca===
18142 !! end
18143
18144 !! test
18145 Section extraction test (section 10)
18146 !! options
18147 section=10
18148 !! wikitext
18149 start
18150 ==a==
18151 ===aa===
18152 ====aaa====
18153 ==b==
18154 ===ba===
18155 ===bb===
18156 ====bba====
18157 ===bc===
18158 ==c==
18159 ===ca===
18160 !! html/php
18161 ===ca===
18162 !! end
18163
18164 !! test
18165 Section extraction test (nonexistent section 11)
18166 !! options
18167 section=11
18168 !! wikitext
18169 start
18170 ==a==
18171 ===aa===
18172 ====aaa====
18173 ==b==
18174 ===ba===
18175 ===bb===
18176 ====bba====
18177 ===bc===
18178 ==c==
18179 ===ca===
18180 !! html/php
18181 !! end
18182
18183 !! test
18184 Section extraction test with bogus heading (section 1)
18185 !! options
18186 section=1
18187 !! wikitext
18188 ==a==
18189 ==bogus== not a legal section
18190 ==b==
18191 !! html/php
18192 ==a==
18193 ==bogus== not a legal section
18194 !! end
18195
18196 !! test
18197 Section extraction test with bogus heading (section 2)
18198 !! options
18199 section=2
18200 !! wikitext
18201 ==a==
18202 ==bogus== not a legal section
18203 ==b==
18204 !! html/php
18205 ==b==
18206 !! end
18207
18208 !! test
18209 Section extraction test with comment after heading (section 1)
18210 !! options
18211 section=1
18212 !! wikitext
18213 ==a==
18214 ==b== <!-- -->
18215 ==c==
18216 !! html/php
18217 ==a==
18218 !! end
18219
18220 !! test
18221 Section extraction test with comment after heading (section 2)
18222 !! options
18223 section=2
18224 !! wikitext
18225 ==a==
18226 ==b== <!-- -->
18227 ==c==
18228 !! html/php
18229 ==b== <!-- -->
18230 !! end
18231
18232 !! test
18233 Section extraction test with bogus <nowiki> heading (section 1)
18234 !! options
18235 section=1
18236 !! wikitext
18237 ==a==
18238 ==bogus== <nowiki>not a legal section</nowiki>
18239 ==b==
18240 !! html/php
18241 ==a==
18242 ==bogus== <nowiki>not a legal section</nowiki>
18243 !! end
18244
18245 !! test
18246 Section extraction test with bogus <nowiki> heading (section 2)
18247 !! options
18248 section=2
18249 !! wikitext
18250 ==a==
18251 ==bogus== <nowiki>not a legal section</nowiki>
18252 ==b==
18253 !! html/php
18254 ==b==
18255 !! end
18256
18257 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18258 # instead of respecting commented sections
18259 !! test
18260 Section extraction prefixed by comment (section 1)
18261 !! options
18262 section=1
18263 !! wikitext
18264 <!-- -->==sec1==
18265 ==sec2==
18266 !! html/php
18267 ==sec2==
18268 !!end
18269
18270 !! test
18271 Section extraction prefixed by comment (section 2)
18272 !! options
18273 section=2
18274 !! wikitext
18275 <!-- -->==sec1==
18276 ==sec2==
18277 !! html/php
18278
18279 !!end
18280
18281 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18282 # instead of respecting HTML-style headings
18283 !! test
18284 Section extraction, mixed wiki and html (section 1)
18285 !! options
18286 section=1
18287 !! wikitext
18288 <h2>unmarked</h2>
18289 unmarked
18290 ==1==
18291 one
18292 ==2==
18293 two
18294 !! html/php
18295 ==1==
18296 one
18297 !! end
18298
18299 !! test
18300 Section extraction, mixed wiki and html (section 2)
18301 !! options
18302 section=2
18303 !! wikitext
18304 <h2>unmarked</h2>
18305 unmarked
18306 ==1==
18307 one
18308 ==2==
18309 two
18310 !! html/php
18311 ==2==
18312 two
18313 !! end
18314
18315
18316 # Formerly testing for bug 3342
18317 !! test
18318 Section extraction, heading surrounded by <noinclude>
18319 !! options
18320 section=1
18321 !! wikitext
18322 <noinclude>==unmarked==</noinclude>
18323 ==marked==
18324 !! html/php
18325 ==marked==
18326 !!end
18327
18328 # Test behavior of bug 19910
18329 !! test
18330 Sectiion with all-equals
18331 !! options
18332 section=2
18333 !! wikitext
18334 ===
18335 The line above must have a trailing space
18336 === <!--
18337 --> <!-- -->
18338 But just in case it doesn't...
18339 !! html/php
18340 === <!--
18341 --> <!-- -->
18342 But just in case it doesn't...
18343 !! end
18344
18345 !! test
18346 Section replacement test (section 0)
18347 !! options
18348 replace=0,"xxx"
18349 !! wikitext
18350 start
18351 ==a==
18352 ===aa===
18353 ====aaa====
18354 ==b==
18355 ===ba===
18356 ===bb===
18357 ====bba====
18358 ===bc===
18359 ==c==
18360 ===ca===
18361 !! html/php
18362 xxx
18363
18364 ==a==
18365 ===aa===
18366 ====aaa====
18367 ==b==
18368 ===ba===
18369 ===bb===
18370 ====bba====
18371 ===bc===
18372 ==c==
18373 ===ca===
18374 !! end
18375
18376 !! test
18377 Section replacement test (section 1)
18378 !! options
18379 replace=1,"xxx"
18380 !! wikitext
18381 start
18382 ==a==
18383 ===aa===
18384 ====aaa====
18385 ==b==
18386 ===ba===
18387 ===bb===
18388 ====bba====
18389 ===bc===
18390 ==c==
18391 ===ca===
18392 !! html/php
18393 start
18394 xxx
18395
18396 ==b==
18397 ===ba===
18398 ===bb===
18399 ====bba====
18400 ===bc===
18401 ==c==
18402 ===ca===
18403 !! end
18404
18405 !! test
18406 Section replacement test (section 2)
18407 !! options
18408 replace=2,"xxx"
18409 !! wikitext
18410 start
18411 ==a==
18412 ===aa===
18413 ====aaa====
18414 ==b==
18415 ===ba===
18416 ===bb===
18417 ====bba====
18418 ===bc===
18419 ==c==
18420 ===ca===
18421 !! html/php
18422 start
18423 ==a==
18424 xxx
18425
18426 ==b==
18427 ===ba===
18428 ===bb===
18429 ====bba====
18430 ===bc===
18431 ==c==
18432 ===ca===
18433 !! end
18434
18435 !! test
18436 Section replacement test (section 3)
18437 !! options
18438 replace=3,"xxx"
18439 !! wikitext
18440 start
18441 ==a==
18442 ===aa===
18443 ====aaa====
18444 ==b==
18445 ===ba===
18446 ===bb===
18447 ====bba====
18448 ===bc===
18449 ==c==
18450 ===ca===
18451 !! html/php
18452 start
18453 ==a==
18454 ===aa===
18455 xxx
18456
18457 ==b==
18458 ===ba===
18459 ===bb===
18460 ====bba====
18461 ===bc===
18462 ==c==
18463 ===ca===
18464 !! end
18465
18466 !! test
18467 Section replacement test (section 4)
18468 !! options
18469 replace=4,"xxx"
18470 !! wikitext
18471 start
18472 ==a==
18473 ===aa===
18474 ====aaa====
18475 ==b==
18476 ===ba===
18477 ===bb===
18478 ====bba====
18479 ===bc===
18480 ==c==
18481 ===ca===
18482 !! html/php
18483 start
18484 ==a==
18485 ===aa===
18486 ====aaa====
18487 xxx
18488
18489 ==c==
18490 ===ca===
18491 !! end
18492
18493 !! test
18494 Section replacement test (section 5)
18495 !! options
18496 replace=5,"xxx"
18497 !! wikitext
18498 start
18499 ==a==
18500 ===aa===
18501 ====aaa====
18502 ==b==
18503 ===ba===
18504 ===bb===
18505 ====bba====
18506 ===bc===
18507 ==c==
18508 ===ca===
18509 !! html/php
18510 start
18511 ==a==
18512 ===aa===
18513 ====aaa====
18514 ==b==
18515 xxx
18516
18517 ===bb===
18518 ====bba====
18519 ===bc===
18520 ==c==
18521 ===ca===
18522 !! end
18523
18524 !! test
18525 Section replacement test (section 6)
18526 !! options
18527 replace=6,"xxx"
18528 !! wikitext
18529 start
18530 ==a==
18531 ===aa===
18532 ====aaa====
18533 ==b==
18534 ===ba===
18535 ===bb===
18536 ====bba====
18537 ===bc===
18538 ==c==
18539 ===ca===
18540 !! html/php
18541 start
18542 ==a==
18543 ===aa===
18544 ====aaa====
18545 ==b==
18546 ===ba===
18547 xxx
18548
18549 ===bc===
18550 ==c==
18551 ===ca===
18552 !! end
18553
18554 !! test
18555 Section replacement test (section 7)
18556 !! options
18557 replace=7,"xxx"
18558 !! wikitext
18559 start
18560 ==a==
18561 ===aa===
18562 ====aaa====
18563 ==b==
18564 ===ba===
18565 ===bb===
18566 ====bba====
18567 ===bc===
18568 ==c==
18569 ===ca===
18570 !! html/php
18571 start
18572 ==a==
18573 ===aa===
18574 ====aaa====
18575 ==b==
18576 ===ba===
18577 ===bb===
18578 xxx
18579
18580 ===bc===
18581 ==c==
18582 ===ca===
18583 !! end
18584
18585 !! test
18586 Section replacement test (section 8)
18587 !! options
18588 replace=8,"xxx"
18589 !! wikitext
18590 start
18591 ==a==
18592 ===aa===
18593 ====aaa====
18594 ==b==
18595 ===ba===
18596 ===bb===
18597 ====bba====
18598 ===bc===
18599 ==c==
18600 ===ca===
18601 !! html/php
18602 start
18603 ==a==
18604 ===aa===
18605 ====aaa====
18606 ==b==
18607 ===ba===
18608 ===bb===
18609 ====bba====
18610 xxx
18611
18612 ==c==
18613 ===ca===
18614 !!end
18615
18616 !! test
18617 Section replacement test (section 9)
18618 !! options
18619 replace=9,"xxx"
18620 !! wikitext
18621 start
18622 ==a==
18623 ===aa===
18624 ====aaa====
18625 ==b==
18626 ===ba===
18627 ===bb===
18628 ====bba====
18629 ===bc===
18630 ==c==
18631 ===ca===
18632 !! html/php
18633 start
18634 ==a==
18635 ===aa===
18636 ====aaa====
18637 ==b==
18638 ===ba===
18639 ===bb===
18640 ====bba====
18641 ===bc===
18642 xxx
18643 !! end
18644
18645 !! test
18646 Section replacement test (section 10)
18647 !! options
18648 replace=10,"xxx"
18649 !! wikitext
18650 start
18651 ==a==
18652 ===aa===
18653 ====aaa====
18654 ==b==
18655 ===ba===
18656 ===bb===
18657 ====bba====
18658 ===bc===
18659 ==c==
18660 ===ca===
18661 !! html/php
18662 start
18663 ==a==
18664 ===aa===
18665 ====aaa====
18666 ==b==
18667 ===ba===
18668 ===bb===
18669 ====bba====
18670 ===bc===
18671 ==c==
18672 xxx
18673 !! end
18674
18675 !! test
18676 Section replacement test with initial whitespace (bug 13728)
18677 !! options
18678 replace=2,"xxx"
18679 !! wikitext
18680 Preformatted initial line
18681 ==a==
18682 ===a===
18683 !! html/php
18684 Preformatted initial line
18685 ==a==
18686 xxx
18687 !! end
18688
18689
18690 !! test
18691 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18692 !! options
18693 section=1
18694 !! wikitext
18695 ==a==
18696 a
18697 !! html/php
18698 ==a==
18699 a
18700 !! end
18701
18702 !! test
18703 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18704 !! options
18705 section=1
18706 !! wikitext
18707 ==a==
18708 a
18709 !! html/php
18710 ==a==
18711 a
18712 !! end
18713
18714
18715 !! test
18716 Section extraction, <pre> around bogus header (bug 10309)
18717 !! options
18718 section=2
18719 !! wikitext
18720 == Section One ==
18721 <pre>
18722 =======
18723 </pre>
18724
18725 == Section Two ==
18726 stuff
18727 !! html/php
18728 == Section Two ==
18729 stuff
18730 !! end
18731
18732 !! test
18733 Section replacement, <pre> around bogus header (bug 10309)
18734 !! options
18735 replace=2,"xxx"
18736 !! wikitext
18737 == Section One ==
18738 <pre>
18739 =======
18740 </pre>
18741
18742 == Section Two ==
18743 stuff
18744 !! html/php
18745 == Section One ==
18746 <pre>
18747 =======
18748 </pre>
18749
18750 xxx
18751 !! end
18752
18753
18754 !! test
18755 Handling of &#x0A; in URLs
18756 !! wikitext
18757 ** irc://&#x0A;a
18758 !! html/php
18759 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18760
18761 !! html/parsoid
18762 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18763 a">irc://
18764 a</a></li></ul></li></ul>
18765 !! end
18766
18767 !! test
18768 Handling of %0A in URLs
18769 !! wikitext
18770 ** irc://%0Aa
18771 !! html/php
18772 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18773
18774 !! html/parsoid
18775 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18776 !! end
18777
18778
18779 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18780 !! test
18781 5 quotes, code coverage +1 line
18782 !! options
18783 parsoid=wt2html
18784 !! wikitext
18785 '''''
18786 !! html/php
18787 !! html/parsoid
18788 <p><b><i></i></b></p>
18789 !! end
18790
18791 # same html as previous, but wikitext adjusted to match parsoid html2wt
18792 # note that wt2html and html2html will put the <i> before the <b>
18793 !! test
18794 5 quotes, code coverage +1 line w/ nowiki (1)
18795 !! options
18796 parsoid=wt2wt,html2wt
18797 !! wikitext
18798 '''''<nowiki/>'''''
18799 !! html/php
18800 <p><i></i>
18801 </p>
18802 !! html/parsoid
18803 <p><b><i></i></b></p>
18804 !! end
18805
18806 # same as previous, just swapping the <i> and <b>
18807 !! test
18808 5 quotes, code coverage +1 line w/ nowiki (2)
18809 !! wikitext
18810 '''''<nowiki/>'''''
18811 !! html/php
18812 <p><i></i>
18813 </p>
18814 !! html/parsoid
18815 <p><i><b></b></i></p>
18816 !! end
18817
18818 !! test
18819 Special:Search page linking.
18820 !! wikitext
18821 {{Special:search}}
18822 !! html
18823 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18824 </p>
18825 !! end
18826
18827 !! test
18828 {{!}} is a magic word
18829 !! wikitext
18830 {{!}} is a magic word there and {{!}} is still a magic word here
18831 | is not a magic word here but {{!}} is still a magic word here
18832 !! html/php
18833 <p>| is a magic word there and | is still a magic word here
18834 | is not a magic word here but | is still a magic word here
18835 </p>
18836 !! html/parsoid
18837 <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
18838 | 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>
18839
18840 !! end
18841
18842 !! test
18843 Say the magic word
18844 !! options
18845 title=[[Parser test]]
18846 !! wikitext
18847 * {{PAGENAME}}
18848 * {{PAGENAMEE}}
18849 * {{FULLPAGENAME}}
18850 * {{FULLPAGENAMEE}}
18851 * {{BASEPAGENAME}}
18852 * {{BASEPAGENAMEE}}
18853 * {{SUBPAGENAME}}
18854 * {{SUBPAGENAMEE}}
18855 * {{ROOTPAGENAME}}
18856 * {{ROOTPAGENAMEE}}
18857 * {{TALKPAGENAME}}
18858 * {{TALKPAGENAMEE}}
18859 * {{SUBJECTPAGENAME}}
18860 * {{SUBJECTPAGENAMEE}}
18861 * {{NAMESPACEE}}
18862 * {{NAMESPACE}}
18863 * {{NAMESPACENUMBER}}
18864 * {{TALKSPACE}}
18865 * {{TALKSPACEE}}
18866 * {{SUBJECTSPACE}}
18867 * {{SUBJECTSPACEE}}
18868 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18869 !! html
18870 <ul><li> Parser test</li>
18871 <li> Parser_test</li>
18872 <li> Parser test</li>
18873 <li> Parser_test</li>
18874 <li> Parser test</li>
18875 <li> Parser_test</li>
18876 <li> Parser test</li>
18877 <li> Parser_test</li>
18878 <li> Parser test</li>
18879 <li> Parser_test</li>
18880 <li> Talk:Parser test</li>
18881 <li> Talk:Parser_test</li>
18882 <li> Parser test</li>
18883 <li> Parser_test</li>
18884 <li> </li>
18885 <li> </li>
18886 <li> 0</li>
18887 <li> Talk</li>
18888 <li> Talk</li>
18889 <li> </li>
18890 <li> </li>
18891 <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>
18892
18893 !! end
18894 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18895
18896 ## Parsoid thinks the "centre" here is a property, not a caption.
18897 !! test
18898 Gallery
18899 !! options
18900 parsoid={
18901 "modes": ["wt2html"],
18902 "nativeGallery": true
18903 }
18904 !! wikitext
18905 <gallery>
18906 image1.png |
18907 image2.gif|||||
18908
18909 image3|
18910 image4 |300px| centre
18911 image5.svg| http://///////
18912 [[x|xx]]]]
18913 * image6
18914 </gallery>
18915 !! html/php
18916 <ul class="gallery mw-gallery-traditional">
18917 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18918 <div class="thumb" style="height: 150px;">Image1.png</div>
18919 <div class="gallerytext">
18920 </div>
18921 </div></li>
18922 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18923 <div class="thumb" style="height: 150px;">Image2.gif</div>
18924 <div class="gallerytext">
18925 </div>
18926 </div></li>
18927 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18928 <div class="thumb" style="height: 150px;">Image3</div>
18929 <div class="gallerytext">
18930 </div>
18931 </div></li>
18932 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18933 <div class="thumb" style="height: 150px;">Image4</div>
18934 <div class="gallerytext">
18935 <pre>centre
18936 </pre>
18937 </div>
18938 </div></li>
18939 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18940 <div class="thumb" style="height: 150px;">Image5.svg</div>
18941 <div class="gallerytext">
18942 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18943 </p>
18944 </div>
18945 </div></li>
18946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18947 <div class="thumb" style="height: 150px;">* image6</div>
18948 <div class="gallerytext">
18949 </div>
18950 </div></li>
18951 </ul>
18952
18953 !! html/parsoid
18954 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
18955 <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>
18956 <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>
18957 <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>
18958 <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>
18959 <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>
18960 <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>
18961 </ul>
18962 !! end
18963
18964 !! test
18965 Gallery (with options, html)
18966 !! options
18967 parsoid={
18968 "modes": ["wt2html", "html2html"],
18969 "nativeGallery": true
18970 }
18971 !! wikitext
18972 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
18973 File:Nonexistent.jpg|caption
18974 File:Nonexistent.jpg
18975 image:foobar.jpg|some '''caption''' [[Main Page]]
18976 image:foobar.jpg
18977 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18978 </gallery>
18979 !! html/php
18980 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18981 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18982 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18983 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18984 <div class="gallerytext">
18985 <p>caption
18986 </p>
18987 </div>
18988 </div></li>
18989 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18990 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18991 <div class="gallerytext">
18992 </div>
18993 </div></li>
18994 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18995 <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>
18996 <div class="gallerytext">
18997 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18998 </p>
18999 </div>
19000 </div></li>
19001 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19002 <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>
19003 <div class="gallerytext">
19004 </div>
19005 </div></li>
19006 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19007 <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>
19008 <div class="gallerytext">
19009 <p>blabla.
19010 </p>
19011 </div>
19012 </div></li>
19013 </ul>
19014
19015 !! html/parsoid
19016 <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":{}}'>
19017 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19018 <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>
19019 <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>
19020 <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>
19021 <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>
19022 <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>
19023 </ul>
19024 !! end
19025
19026 !! test
19027 Gallery (with options, extsrc)
19028 !! options
19029 parsoid={
19030 "nativeGallery": false
19031 }
19032 !! wikitext
19033 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19034 File:Nonexistent.jpg|caption
19035 File:Nonexistent.jpg
19036 image:foobar.jpg|some '''caption''' [[Main Page]]
19037 image:foobar.jpg
19038 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19039 </gallery>
19040 !! html/php
19041 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19042 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19043 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19044 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19045 <div class="gallerytext">
19046 <p>caption
19047 </p>
19048 </div>
19049 </div></li>
19050 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19051 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19052 <div class="gallerytext">
19053 </div>
19054 </div></li>
19055 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19056 <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>
19057 <div class="gallerytext">
19058 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19059 </p>
19060 </div>
19061 </div></li>
19062 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19063 <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>
19064 <div class="gallerytext">
19065 </div>
19066 </div></li>
19067 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19068 <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>
19069 <div class="gallerytext">
19070 <p>blabla.
19071 </p>
19072 </div>
19073 </div></li>
19074 </ul>
19075
19076 !! html/parsoid
19077 <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"}}'>
19078 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19079 <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>
19080 <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>
19081 <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>
19082 <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>
19083 <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>
19084 </ul>
19085 !! end
19086
19087 !! test
19088 Gallery with link that has fragment
19089 !! options
19090 parsoid={
19091 "modes": ["wt2html", "html2html"],
19092 "nativeGallery": true
19093 }
19094 !! wikitext
19095 <gallery>
19096 image:foobar.jpg|link=Main_Page
19097 image:foobar.jpg|link=Main_Page#section
19098 image:foobar.jpg|link=Main Page#section|caption
19099 </gallery>
19100 !! html/php
19101 <ul class="gallery mw-gallery-traditional">
19102 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19103 <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>
19104 <div class="gallerytext">
19105 </div>
19106 </div></li>
19107 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19108 <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>
19109 <div class="gallerytext">
19110 </div>
19111 </div></li>
19112 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19113 <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>
19114 <div class="gallerytext">
19115 <p>caption
19116 </p>
19117 </div>
19118 </div></li>
19119 </ul>
19120
19121 !! html/parsoid
19122 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19123 <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>
19124 <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>
19125 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19126 </ul>
19127 !! end
19128
19129 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19130 !! test
19131 Gallery with template inside caption
19132 !! options
19133 parsoid={
19134 "nativeGallery": true
19135 }
19136 !! wikitext
19137 <gallery caption="{{echo|hi}}">
19138 File:Foobar.jpg|{{echo|ho}}
19139 </gallery>
19140 !! html/php
19141 <ul class="gallery mw-gallery-traditional">
19142 <li class='gallerycaption'>{{echo|hi}}</li>
19143 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19144 <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>
19145 <div class="gallerytext">
19146 <p>ho
19147 </p>
19148 </div>
19149 </div></li>
19150 </ul>
19151
19152 !! html/parsoid
19153 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19154 <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>
19155 <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>
19156 </ul>
19157 !! end
19158
19159 !! test
19160 Gallery with wikitext inside caption
19161 !! options
19162 parsoid={
19163 "nativeGallery": true
19164 }
19165 !! wikitext
19166 <gallery>
19167 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19168 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19169 </gallery>
19170 !! html/php
19171 <ul class="gallery mw-gallery-traditional">
19172 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19173 <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>
19174 <div class="gallerytext">
19175 <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>
19176 </p>
19177 </div>
19178 </div></li>
19179 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19180 <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>
19181 <div class="gallerytext">
19182 <p>This is a test template
19183 </p>
19184 </div>
19185 </div></li>
19186 </ul>
19187
19188 !! html/parsoid
19189 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19190 <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>
19191 <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>
19192 </ul>
19193 !! end
19194
19195 !! test
19196 Gallery (with showfilename option)
19197 !! options
19198 parsoid={
19199 "nativeGallery": true
19200 }
19201 !! wikitext
19202 <gallery showfilename="">
19203 File:Nonexistent.jpg|caption
19204 File:Nonexistent.jpg
19205 File:Foobar.jpg|some '''caption''' [[Main Page]]
19206 File:Foobar.jpg
19207 </gallery>
19208 !! html/php
19209 <ul class="gallery mw-gallery-traditional">
19210 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19211 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19212 <div class="gallerytext">
19213 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19214 caption
19215 </p>
19216 </div>
19217 </div></li>
19218 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19219 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19220 <div class="gallerytext">
19221 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19222 </p>
19223 </div>
19224 </div></li>
19225 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19226 <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>
19227 <div class="gallerytext">
19228 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19229 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19230 </p>
19231 </div>
19232 </div></li>
19233 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19234 <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>
19235 <div class="gallerytext">
19236 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19237 </p>
19238 </div>
19239 </div></li>
19240 </ul>
19241
19242 !! html/parsoid
19243 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19244 <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>
19245 <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>
19246 <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>
19247 <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>
19248 </ul>
19249 !! end
19250
19251 ## Should Parsoid be preserving these variations?
19252 !! test
19253 Gallery (with namespace-less filenames)
19254 !! options
19255 parsoid={
19256 "modes": ["wt2html", "html2html"],
19257 "nativeGallery": true
19258 }
19259 !! wikitext
19260 <gallery>
19261 File:Nonexistent.jpg
19262 Nonexistent.jpg
19263 image:foobar.jpg
19264 foobar.jpg
19265 </gallery>
19266 !! html/php
19267 <ul class="gallery mw-gallery-traditional">
19268 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19269 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19270 <div class="gallerytext">
19271 </div>
19272 </div></li>
19273 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19274 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19275 <div class="gallerytext">
19276 </div>
19277 </div></li>
19278 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19279 <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>
19280 <div class="gallerytext">
19281 </div>
19282 </div></li>
19283 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19284 <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>
19285 <div class="gallerytext">
19286 </div>
19287 </div></li>
19288 </ul>
19289
19290 !! html/parsoid
19291 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19292 <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>
19293 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19294 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19295 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19296 </ul>
19297 !! end
19298
19299 !! test
19300 Gallery override link with WikiLink (T36852)
19301 !! options
19302 parsoid={
19303 "nativeGallery": true
19304 }
19305 !! wikitext
19306 <gallery>
19307 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19308 </gallery>
19309 !! html/php
19310 <ul class="gallery mw-gallery-traditional">
19311 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19312 <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>
19313 <div class="gallerytext">
19314 </div>
19315 </div></li>
19316 </ul>
19317
19318 !! html/parsoid
19319 <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":{}}'>
19320 <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>
19321 </ul>
19322 !! end
19323
19324 !! test
19325 Gallery override link with absolute external link (T36852)
19326 !! options
19327 parsoid={
19328 "nativeGallery": true
19329 }
19330 !! wikitext
19331 <gallery>
19332 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19333 </gallery>
19334 !! html/php
19335 <ul class="gallery mw-gallery-traditional">
19336 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19337 <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>
19338 <div class="gallerytext">
19339 </div>
19340 </div></li>
19341 </ul>
19342
19343 !! html/parsoid
19344 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19345 <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>
19346 </ul>
19347 !! end
19348
19349 !! test
19350 Gallery override link with malicious javascript (T36852)
19351 !! options
19352 parsoid={
19353 "modes": ["wt2html", "html2html"],
19354 "nativeGallery": true
19355 }
19356 !! wikitext
19357 <gallery>
19358 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19359 </gallery>
19360 !! html/php
19361 <ul class="gallery mw-gallery-traditional">
19362 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19363 <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>
19364 <div class="gallerytext">
19365 </div>
19366 </div></li>
19367 </ul>
19368
19369 !! html/parsoid
19370 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19371 <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>
19372 </ul>
19373 !! end
19374
19375 !! test
19376 Gallery with invalid title as link (T45964)
19377 !! options
19378 parsoid={
19379 "modes": ["wt2html", "html2html"],
19380 "nativeGallery": true
19381 }
19382 !! wikitext
19383 <gallery>
19384 File:Foobar.jpg|link=<
19385 </gallery>
19386 !! html/php
19387 <ul class="gallery mw-gallery-traditional">
19388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19389 <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>
19390 <div class="gallerytext">
19391 </div>
19392 </div></li>
19393 </ul>
19394
19395 !! html/parsoid
19396 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19397 <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>
19398 </ul>
19399 !! end
19400
19401 !! test
19402 HTML Hex character encoding (spells the word "JavaScript")
19403 !! options
19404 parsoid=wt2html,wt2wt,html2html
19405 !! wikitext
19406 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19407 !! html/php
19408 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19409 </p>
19410 !! html/php+tidy
19411 <p>JavaScript</p>
19412 !! html/parsoid
19413 <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>
19414 !! end
19415
19416 !! test
19417 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19418 !! wikitext
19419 &#xsee;&#XSEE;
19420 !! html/php
19421 <p>&amp;#xsee;&amp;#XSEE;
19422 </p>
19423 !! html/parsoid
19424 <p>&amp;#xsee;&amp;#XSEE;</p>
19425 !! end
19426
19427 !! test
19428 HTML Hex character encoding mixed case
19429 !! options
19430 parsoid=wt2html,wt2wt,html2html
19431 !! wikitext
19432 &#xEE;&#Xee;
19433 !! html/php
19434 <p>&#xee;&#xee;
19435 </p>
19436 !! html/php+tidy
19437 <p>îî</p>
19438 !! html/parsoid
19439 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19440 !! end
19441
19442 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19443 # Note that U+000C (form feed) is not a valid XML character, so
19444 # it is banned even though allowed in HTML5.
19445 !! test
19446 Illegal character references (T106578)
19447 !! wikitext
19448 ; Null: &#00;
19449 ; FF: &#xC;
19450 ; CR: &#xD;
19451 ; Control (low): &#8;
19452 ; Control (high): &#x7F; &#x9F;
19453 ; Surrogate: &#xD83D;&#xDCA9;
19454 ; This is an okay astral character: &#x1F4A9;
19455 !! html+tidy
19456 <dl>
19457 <dt>Null</dt>
19458 <dd>&amp;#00;</dd>
19459 <dt>FF</dt>
19460 <dd>&amp;#xC;</dd>
19461 <dt>CR</dt>
19462 <dd>&amp;#xD;</dd>
19463 <dt>Control (low)</dt>
19464 <dd>&amp;#8;</dd>
19465 <dt>Control (high)</dt>
19466 <dd>&amp;#x7F; &amp;#x9F;</dd>
19467 <dt>Surrogate</dt>
19468 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19469 <dt>This is an okay astral character</dt>
19470 <dd>💩</dd>
19471 </dl>
19472 !! end
19473
19474 !! test
19475 __FORCETOC__ override
19476 !! wikitext
19477 __NEWSECTIONLINK__
19478 __FORCETOC__
19479 !! html/php
19480 <p><br />
19481 </p>
19482 !! end
19483
19484 !! test
19485 ISBN code coverage
19486 !! wikitext
19487 ISBN 978-0-1234-56&#x20;789
19488 !! html
19489 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19490 </p>
19491 !! html+tidy
19492 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19493 !! html/parsoid
19494 <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>
19495 !! end
19496
19497 !! test
19498 ISBN followed by 5 spaces
19499 !! wikitext
19500 ISBN
19501 !! html
19502 <p>ISBN
19503 </p>
19504 !! end
19505
19506 !! test
19507 Double ISBN
19508 !! wikitext
19509 ISBN ISBN 1234567890
19510 !! html/php
19511 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19512 </p>
19513 !! html/parsoid
19514 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19515 !! end
19516
19517 # Uppercase X and lowercase x as well
19518 !! test
19519 ISBN with an X
19520 !! wikitext
19521 ISBN 3-462-04561-X
19522 ISBN 3-462-04561-x
19523 ISBN 080442957X
19524 ISBN 080442957x
19525 ISBN 978080442957X
19526 ISBN 978080442957x
19527 !! html/php
19528 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19529 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19530 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19531 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19532 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19533 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19534 </p>
19535 !! html/parsoid
19536 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19537 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19538 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19539 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19540 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19541 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19542 !! end
19543
19544 !! test
19545 ISBN with empty prefix (parsoid test)
19546 !! wikitext
19547 ISBN 1234567890
19548 !! html/php
19549 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19550 </p>
19551 !! html/parsoid
19552 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19553 !! end
19554
19555 !! test
19556 Bug 22905: <abbr> followed by ISBN followed by </a>
19557 !! wikitext
19558 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19559 !! html/php
19560 <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>
19561 </p>
19562 !! html/parsoid
19563 <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>
19564 !! end
19565
19566 !! test
19567 Double RFC
19568 !! wikitext
19569 RFC RFC 1234
19570 !! html
19571 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19572 </p>
19573 !! end
19574
19575 !! test
19576 Double RFC with a wiki link
19577 !! wikitext
19578 RFC [[RFC 1234]]
19579 !! html
19580 <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>
19581 </p>
19582 !! end
19583
19584 !! test
19585 RFC code coverage
19586 !! wikitext
19587 RFC 983&#x20;987
19588 !! html
19589 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19590 </p>
19591 !! html+tidy
19592 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19593 !! end
19594
19595 !! test
19596 Centre-aligned image
19597 !! wikitext
19598 [[Image:foobar.jpg|centre]]
19599 !! html
19600 <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>
19601
19602 !!end
19603
19604 !! test
19605 None-aligned image
19606 !! wikitext
19607 [[Image:foobar.jpg|none]]
19608 !! html
19609 <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>
19610
19611 !!end
19612
19613 !! test
19614 Width + Height sized image (using px) (height is ignored)
19615 !! wikitext
19616 [[Image:foobar.jpg|640x480px]]
19617 !! html
19618 <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>
19619 </p>
19620 !!end
19621
19622 !! test
19623 Width-sized image (using px, no following whitespace)
19624 !! wikitext
19625 [[Image:foobar.jpg|640px]]
19626 !! html
19627 <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>
19628 </p>
19629 !!end
19630
19631 !! test
19632 Width-sized image (using px, with following whitespace - test regression from r39467)
19633 !! wikitext
19634 [[Image:foobar.jpg|640px ]]
19635 !! html
19636 <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>
19637 </p>
19638 !!end
19639
19640 !! test
19641 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19642 !! wikitext
19643 [[Image:foobar.jpg| 640px]]
19644 !! html
19645 <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>
19646 </p>
19647 !!end
19648
19649 !! test
19650 Image with page parameter
19651 !! options
19652 djvu
19653 !! wikitext
19654 [[File:LoremIpsum.djvu|page=2]]
19655 !! html/php
19656 <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>
19657 </p>
19658 !! html/parsoid
19659 <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>
19660 !! end
19661
19662 !! test
19663 Another italics / bold test
19664 !! wikitext
19665 ''' ''x'
19666 !! html
19667 <pre>'<i> </i>x'
19668 </pre>
19669 !!end
19670
19671 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19672 !! test
19673 dt/dd/dl test
19674 !! wikitext
19675 :;;;::
19676 !! html/php
19677 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19678
19679 !! html/parsoid
19680 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19681
19682 !!end
19683
19684
19685 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19686 !! test
19687 Images with the "|" character in the comment
19688 !! wikitext
19689 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19690 !! html/php
19691 <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>
19692
19693 !! html/parsoid
19694 <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>
19695 !! end
19696
19697 !! test
19698 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19699 !! wikitext
19700 <html><script>alert(1);</script></html>
19701 !! html
19702 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19703 </p>
19704 !! end
19705
19706 !! test
19707 HTML with raw HTML ($wgRawHtml==true)
19708 !! options
19709 wgRawHtml=1
19710 !! wikitext
19711 <html><script>alert(1);</script></html>
19712 !! html
19713 <p><script>alert(1);</script>
19714 </p>
19715 !! end
19716
19717 !! test
19718 Parents of subpages, one level up
19719 !! options
19720 subpage title=[[Subpage test/L1/L2/L3]]
19721 !! wikitext
19722 [[../|L2]]
19723 !! html
19724 <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>
19725 </p>
19726 !! end
19727
19728
19729 !! test
19730 Parents of subpages, one level up, not named
19731 !! options
19732 subpage title=[[Subpage test/L1/L2/L3]]
19733 !! wikitext
19734 [[../]]
19735 !! html
19736 <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>
19737 </p>
19738 !! end
19739
19740
19741
19742 !! test
19743 Parents of subpages, two levels up
19744 !! options
19745 subpage title=[[Subpage test/L1/L2/L3]]
19746 !! wikitext
19747 [[../../|L1]]2
19748
19749 [[../../|L1]]l
19750 !! html
19751 <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
19752 </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>
19753 </p>
19754 !! end
19755
19756 !! test
19757 Parents of subpages, two levels up, without trailing slash or name.
19758 !! options
19759 subpage title=[[Subpage test/L1/L2/L3]]
19760 !! wikitext
19761 [[../..]]
19762 !! html
19763 <p>[[../..]]
19764 </p>
19765 !! end
19766
19767 !! test
19768 Parents of subpages, two levels up, with lots of extra trailing slashes.
19769 !! options
19770 subpage title=[[Subpage test/L1/L2/L3]]
19771 !! wikitext
19772 [[../../////]]
19773 !! html
19774 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
19775 </p>
19776 !! end
19777
19778 !! article
19779 Subpage test/L1/L2/L3Sibling
19780 !! text
19781 Sibling article
19782 !! endarticle
19783
19784 !! test
19785 Transclusion of a sibling page (one level up)
19786 !! options
19787 subpage title=[[Subpage test/L1/L2/L3]]
19788 !! wikitext
19789 {{../L3Sibling}}
19790 !! html
19791 <p>Sibling article
19792 </p>
19793 !! end
19794
19795 !! test
19796 Transclusion of a child page
19797 !! options
19798 subpage title=[[Subpage test/L1/L2]]
19799 !! wikitext
19800 {{/L3Sibling}}
19801 !! html
19802 <p>Sibling article
19803 </p>
19804 !! end
19805
19806 # This is wt2html only in Parsoid because we add <nowiki>
19807 # because of {{..}} and we don't expect to fix that to
19808 # eliminate the nowikis selective for {{..}} markup.
19809 !! test
19810 Non-transclusion because of too many up levels
19811 !! options
19812 subpage title=[[Subpage test/L1/L2/L3]]
19813 parsoid=wt2html
19814 !! wikitext
19815 {{../../../../More than parent}}
19816 !! html/php
19817 <p>{{../../../../More than parent}}
19818 </p>
19819 !! html/parsoid
19820 <p>{{../../../../More than parent}}</p>
19821 !! end
19822
19823 !! test
19824 Definition list code coverage
19825 !! wikitext
19826 ; title : def
19827 ; title : def
19828 ;title: def
19829 !! html/php
19830 <dl><dt> title &#160;</dt>
19831 <dd> def</dd>
19832 <dt> title&#160;</dt>
19833 <dd> def</dd>
19834 <dt>title</dt>
19835 <dd> def</dd></dl>
19836
19837 !! html/parsoid
19838 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19839 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19840 <dt>title</dt><dd> def</dd></dl>
19841 !! end
19842
19843 !! test
19844 Don't fall for the self-closing div
19845 !! wikitext
19846 <div>hello world</div/>
19847 !! html
19848 <div>hello world</div>
19849
19850 !! end
19851
19852 !! test
19853 MSGNW magic word
19854 !! wikitext
19855 {{MSGNW:msg}}
19856 !! html/php
19857 <p>&#91;&#91;:Template:Msg&#93;&#93;
19858 </p>
19859 !! end
19860
19861 !! test
19862 RAW magic word
19863 !! wikitext
19864 {{RAW:QUERTY}}
19865 !! html
19866 <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>
19867 </p>
19868 !! end
19869
19870 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19871 !! test
19872 Always escape literal '>' in output, not just after '<'
19873 !! wikitext
19874 ><>
19875 !! html
19876 <p>&gt;&lt;&gt;
19877 </p>
19878 !! end
19879
19880 !! test
19881 Template caching
19882 !! wikitext
19883 {{Test}}
19884 {{Test}}
19885 !! html
19886 <p>This is a test template
19887 This is a test template
19888 </p>
19889 !! end
19890
19891
19892 !! article
19893 MediaWiki:Fake
19894 !! text
19895 ==header==
19896 !! endarticle
19897
19898 !! test
19899 Inclusion of !userCanEdit() content
19900 !! wikitext
19901 {{MediaWiki:Fake}}
19902 !! html
19903 <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>
19904
19905 !! end
19906
19907
19908 !! test
19909 Out-of-order TOC heading levels
19910 !! wikitext
19911 ==2==
19912 ======6======
19913 ===3===
19914 =1=
19915 =====5=====
19916 ==2==
19917 !! html
19918 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19919 <ul>
19920 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19921 <ul>
19922 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19923 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19924 </ul>
19925 </li>
19926 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19927 <ul>
19928 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19929 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19930 </ul>
19931 </li>
19932 </ul>
19933 </div>
19934
19935 <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>
19936 <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>
19937 <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>
19938 <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>
19939 <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>
19940 <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>
19941
19942 !! end
19943
19944
19945 !! test
19946 ISBN with a dummy number
19947 !! wikitext
19948 ISBN ---
19949 !! html
19950 <p>ISBN ---
19951 </p>
19952 !! end
19953
19954
19955 !! test
19956 ISBN with space-delimited number
19957 !! wikitext
19958 ISBN 92 9017 032 8
19959 !! html
19960 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19961 </p>
19962 !! end
19963
19964
19965 !! test
19966 ISBN with multiple spaces, no number
19967 !! wikitext
19968 ISBN foo
19969 !! html
19970 <p>ISBN foo
19971 </p>
19972 !! end
19973
19974
19975 !! test
19976 ISBN length
19977 !! wikitext
19978 ISBN 123456789
19979
19980 ISBN 1234567890
19981
19982 ISBN 12345678901
19983 !! html
19984 <p>ISBN 123456789
19985 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19986 </p><p>ISBN 12345678901
19987 </p>
19988 !! end
19989
19990
19991 !! test
19992 ISBN with trailing year (bug 8110)
19993 !! wikitext
19994 ISBN 1-234-56789-0 - 2006
19995
19996 ISBN 1 234 56789 0 - 2006
19997 !! html
19998 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19999 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20000 </p>
20001 !! end
20002
20003
20004 !! test
20005 anchorencode
20006 !! wikitext
20007 {{anchorencode:foo bar©#%n}}
20008 !! html
20009 <p>foo_bar.C2.A9.23.25n
20010 </p>
20011 !! end
20012
20013 !! test
20014 anchorencode trims spaces
20015 !! wikitext
20016 {{anchorencode: __pretty__please__}}
20017 !! html
20018 <p>pretty_please
20019 </p>
20020 !! end
20021
20022 !! test
20023 anchorencode deals with links
20024 !! wikitext
20025 {{anchorencode: [[hello|world]] [[hi]]}}
20026 !! html
20027 <p>world_hi
20028 </p>
20029 !! end
20030
20031 !! test
20032 anchorencode deals with templates
20033 !! wikitext
20034 {{anchorencode: {{Foo}} }}
20035 !! html
20036 <p>FOO
20037 </p>
20038 !! end
20039
20040 !! test
20041 anchorencode encodes like the TOC generator: (bug 18431)
20042 !! wikitext
20043 === _ +:.3A%3A&&amp;]] ===
20044 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20045 __NOEDITSECTION__
20046 !! html
20047 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20048 <p>.2B:.3A.253A.26.26.5D.5D
20049 </p>
20050 !! end
20051
20052 !! test
20053 Bug 6200: blockquotes and paragraph formatting
20054 !! wikitext
20055 <blockquote>
20056 foo
20057 </blockquote>
20058
20059 bar
20060
20061 baz
20062 !! html
20063 <blockquote>
20064 <p>foo
20065 </p>
20066 </blockquote>
20067 <p>bar
20068 </p>
20069 <pre>baz
20070 </pre>
20071 !! end
20072
20073 !! test
20074 Bug 8293: Use of center tag ruins paragraph formatting
20075 !! wikitext
20076 <center>
20077 foo
20078 </center>
20079
20080 bar
20081
20082 baz
20083 !! html
20084 <center>
20085 <p>foo
20086 </p>
20087 </center>
20088 <p>bar
20089 </p>
20090 <pre>baz
20091 </pre>
20092 !! end
20093
20094 !!test
20095 Parsing of overlapping (improperly nested) inline html tags
20096 !! wikitext
20097 <span><s>x</span></s>
20098 !! html/php
20099 <p><span><s>x&lt;/span&gt;</s></span>
20100 </p>
20101 !! html/parsoid
20102 <p><span><s>x</s></span>
20103 </p>
20104 !!end
20105
20106 ###
20107 ### Language variants related tests
20108 ###
20109 !! test
20110 Self-link in language variants
20111 !! options
20112 title=[[Dunav]] language=sr
20113 !! wikitext
20114 Both [[Dunav]] and [[Дунав]] are names for this river.
20115 !! html
20116 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20117 </p>
20118 !!end
20119
20120 !! article
20121 Дуна
20122 !! text
20123 content
20124 !! endarticle
20125
20126 !! test
20127 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20128 !! options
20129 title=[[Duna]] language=sr
20130 !! wikitext
20131 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20132 !! html
20133 <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.
20134 </p>
20135 !! end
20136
20137 !! test
20138 Link to a section of a variant of this title shouldn't be parsed as self-link
20139 !! options
20140 title=[[Duna]] language=sr
20141 !! wikitext
20142 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20143 !! html
20144 <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.
20145 </p>
20146 !! end
20147
20148 !! test
20149 Link to pages in language variants
20150 !! options
20151 language=sr
20152 !! wikitext
20153 Main Page can be written as [[Маин Паге]]
20154 !! html
20155 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20156 </p>
20157 !!end
20158
20159
20160 !! test
20161 Multiple links to pages in language variants
20162 !! options
20163 language=sr
20164 !! wikitext
20165 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20166 !! html
20167 <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>.
20168 </p>
20169 !!end
20170
20171
20172 !! test
20173 Simple template in language variants
20174 !! options
20175 language=sr
20176 !! wikitext
20177 {{тест}}
20178 !! html
20179 <p>This is a test template
20180 </p>
20181 !! end
20182
20183
20184 !! test
20185 Template with explicit namespace in language variants
20186 !! options
20187 language=sr
20188 !! wikitext
20189 {{Template:тест}}
20190 !! html
20191 <p>This is a test template
20192 </p>
20193 !! end
20194
20195
20196 !! test
20197 Basic test for template parameter in language variants
20198 !! options
20199 language=sr
20200 !! wikitext
20201 {{парамтест|param=foo}}
20202 !! html
20203 <p>This is a test template with parameter foo
20204 </p>
20205 !! end
20206
20207 !! test
20208 Simple category in language variants
20209 !! options
20210 language=sr cat
20211 !! wikitext
20212 [[Category:МедиаWики Усер'с Гуиде]]
20213 !! html/php
20214 cat=МедиаWики_Усер'с_Гуиде sort=
20215 !! html/parsoid
20216 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20217 !! end
20218
20219 !! article
20220 Category:分类
20221 !! text
20222 blah
20223 !! endarticle
20224
20225 !! article
20226 Category:分類
20227 !! text
20228 blah
20229 !! endarticle
20230
20231 ## We used to, but no longer wt2wt this test since the default serializer
20232 ## will normalize all categories to serialize on their own line.
20233 ## This wikitext usage is going to be fairly uncommon in production and
20234 ## selser will take care of preserving formatting in those scenarios.
20235 !! test
20236 Don't convert blue categorylinks to another variant (bug 33210)
20237 !! options
20238 cat
20239 language=zh
20240 parsoid=wt2html
20241 !! wikitext
20242 [[A]][[Category:分类]]
20243 !! html/php
20244 cat=分类 sort=
20245 !! html/parsoid
20246 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20247 <link rel="mw:PageProp/Category" href="Category:分类"/>
20248 !! end
20249
20250 !! test
20251 Stripping -{}- tags (language variants)
20252 !! options
20253 language=sr
20254 !! wikitext
20255 Latin proverb: -{Ne nuntium necare}-
20256 !! html
20257 <p>Latin proverb: Ne nuntium necare
20258 </p>
20259 !! end
20260
20261
20262 !! test
20263 Prevent conversion with -{}- tags (language variants)
20264 !! options
20265 language=sr variant=sr-ec
20266 !! wikitext
20267 Latinski: -{Ne nuntium necare}-
20268 !! html
20269 <p>Латински: Ne nuntium necare
20270 </p>
20271 !! end
20272
20273
20274 !! test
20275 Prevent conversion of text with -{}- tags (language variants)
20276 !! options
20277 language=sr variant=sr-ec
20278 !! wikitext
20279 Latinski: -{Ne nuntium necare}-
20280 !! html
20281 <p>Латински: Ne nuntium necare
20282 </p>
20283 !! end
20284
20285
20286 !! test
20287 Prevent conversion of links with -{}- tags (language variants)
20288 !! options
20289 language=sr variant=sr-ec
20290 !! wikitext
20291 -{[[Main Page]]}-
20292 !! html
20293 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20294 </p>
20295 !! end
20296
20297
20298 !! test
20299 -{}- tags within headlines (within html for parserConvert())
20300 !! options
20301 language=sr variant=sr-ec
20302 !! wikitext
20303 == -{Naslov}- ==
20304 !! html
20305 <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>
20306
20307 !! end
20308
20309
20310 !! test
20311 Explicit definition of language variant alternatives
20312 !! options
20313 language=zh variant=zh-tw
20314 !! wikitext
20315 -{zh:China;zh-tw:Taiwan}-, not China
20316 !! html
20317 <p>Taiwan, not China
20318 </p>
20319 !! end
20320
20321
20322 !! test
20323 Conversion around HTML tags
20324 !! options
20325 language=sr variant=sr-ec
20326 !! wikitext
20327 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20328 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20329 !! html
20330 <p>
20331 <span title="ЛаCтин">ски</span>
20332 </p>
20333 !! end
20334
20335
20336 !! test
20337 Explicit session-wise language variant mapping (A flag and - flag)
20338 !! options
20339 language=zh variant=zh-tw
20340 !! wikitext
20341 Taiwan is not China.
20342 But -{A|zh:China;zh-tw:Taiwan}- is China,
20343 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20344 and -{China}- is China.
20345 !! html
20346 <p>Taiwan is not China.
20347 But Taiwan is Taiwan,
20348 (This should be stripped!)
20349 and China is China.
20350 </p>
20351 !! end
20352
20353 !! test
20354 Explicit session-wise language variant mapping (H flag for hide)
20355 !! options
20356 language=zh variant=zh-tw
20357 !! wikitext
20358 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20359 Taiwan is China.
20360 !! html
20361 <p>(This should be stripped!)
20362 Taiwan is Taiwan.
20363 </p>
20364 !! end
20365
20366 !! test
20367 Adding explicit conversion rule for title (T flag)
20368 !! options
20369 language=zh variant=zh-tw showtitle
20370 !! wikitext
20371 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20372 !! html
20373 Taiwan
20374 <p>Should be stripped!
20375 </p>
20376 !! end
20377
20378 !! test
20379 Testing that changing the language variant here in the tests actually works
20380 !! options
20381 language=zh variant=zh showtitle
20382 !! wikitext
20383 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20384 !! html
20385 China
20386 <p>Should be stripped!
20387 </p>
20388 !! end
20389
20390 !! test
20391 Recursive conversion of alt and title attrs shouldn't clear converter state
20392 !! options
20393 language=zh variant=zh-cn showtitle
20394 !! wikitext
20395 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20396 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20397 !! html
20398 China
20399 <p>
20400 Should be stripped<span title="Exclamation">!</span>
20401 </p>
20402 !! end
20403
20404 !! test
20405 Bug 24072: more test on conversion rule for title
20406 !! options
20407 language=zh variant=zh-tw showtitle
20408 !! wikitext
20409 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20410 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20411 !! html
20412 Taiwan
20413 <p>This should be stripped!
20414 This won't take interferes with the title rule.
20415 </p>
20416 !! end
20417
20418 !! test
20419 Partly disable title conversion if variant == main language code
20420 !! options
20421 language=zh variant=zh title=[[ZH]] showtitle
20422 !! wikitext
20423 -{T|zh-cn:CN;zh-tw:TW}-
20424 !! html
20425 ZH
20426 <p>
20427 </p>
20428 !! end
20429
20430 !! test
20431 Partly disable title conversion if variant == main language code, more
20432 !! options
20433 language=zh variant=zh title=[[ZH]] showtitle
20434 !! wikitext
20435 -{T|TW}-
20436 !! html
20437 ZH
20438 <p>
20439 </p>
20440 !! end
20441
20442 !! test
20443 Raw output of variant escape tags (R flag)
20444 !! options
20445 language=zh variant=zh-tw
20446 !! wikitext
20447 Raw: -{R|zh:China;zh-tw:Taiwan}-
20448 !! html
20449 <p>Raw: zh:China;zh-tw:Taiwan
20450 </p>
20451 !! end
20452
20453 !! test
20454 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20455 !! options
20456 language=zh variant=zh-cn
20457 !! input
20458 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20459 !! result
20460 <p>0
20461 </p>
20462 !! end
20463
20464 !! test
20465 Conversion rules from [numeric-only string] to [something else] (T48634)
20466 !! options
20467 language=zh variant=zh-cn
20468 !! input
20469 -{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
20470 !! result
20471 <p>D12345EE12345
20472 </p>
20473 !! end
20474
20475 !! test
20476 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20477 !! options
20478 language=zh variant=zh-cn
20479 !! input
20480 -{H|zh-cn:foo;zh-tw:;}-foobar
20481 !! result
20482 <p>foobar
20483 </p>
20484 !! end
20485
20486 !! test
20487 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20488 !! options
20489 language=zh variant=zh-cn
20490 !! input
20491 -{H|=>zh-cn:foo;}-foobar
20492 !! result
20493 <p>foobar
20494 </p>
20495 !! end
20496
20497 !! test
20498 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20499 !! options
20500 language=zh variant=zh-cn
20501 !! input
20502 -{H|}-foobar
20503 !! result
20504 <p>foobar
20505 </p>
20506 !! end
20507
20508 !! test
20509 Nested using of manual convert syntax
20510 !! options
20511 language=zh variant=zh-hk
20512 !! wikitext
20513 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20514 !! html
20515 <p>Nested: Hello Hong Kong!
20516 </p>
20517 !! end
20518
20519 # Since Parsoid is starting to emit canonical wikitext for links,
20520 # [http://example.com http://example.com] will not RT back to that
20521 # form anymore.
20522 !! test
20523 Proper conversion of text in external links
20524 !! options
20525 language=sr variant=sr-ec
20526 parsoid=wt2html
20527 !! wikitext
20528 http://www.google.com
20529 gopher://www.google.com
20530 [http://www.google.com http://www.google.com]
20531 [gopher://www.google.com gopher://www.google.com]
20532 [https://www.google.com irc://www.google.com]
20533 [ftp://www.google.com www.google.com/ftp://dir]
20534 [//www.google.com www.google.com]
20535 !! html/php
20536 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20537 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20538 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20539 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20540 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20541 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20542 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20543 </p>
20544 !! html/parsoid
20545 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20546 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20547 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20548 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20549 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20550 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20551 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20552 !! end
20553
20554 !! test
20555 Do not convert roman numbers to language variants
20556 !! options
20557 language=sr variant=sr-ec
20558 !! wikitext
20559 Fridrih IV je car.
20560 !! html
20561 <p>Фридрих IV је цар.
20562 </p>
20563 !! end
20564
20565 !! test
20566 Unclosed language converter markup "-{"
20567 !! options
20568 language=sr
20569 !! wikitext
20570 -{T|hello
20571 !! html
20572 <p>-{T|hello
20573 </p>
20574 !! end
20575
20576 !! test
20577 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20578 !! options
20579 language=sr
20580 !! wikitext
20581 -{R|=&gt;}-
20582 !! html
20583 <p>=&gt;
20584 </p>
20585 !!end
20586
20587 !! test
20588 Don't break link parsing if language converter markup is in the caption.
20589 !! options
20590 language=sr variant=sr-ec
20591 !! wikitext
20592 [[Main Page|-{R|main page}-]]
20593 !! html
20594 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20595 </p>
20596 !! end
20597
20598 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20599 !! test
20600 Don't break image parsing if language converter markup is in the caption.
20601 !! options
20602 language=sr
20603 !! wikitext
20604 [[File:Foobar.jpg|-{R|caption}-]]
20605 !! html/parsoid
20606 <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>
20607 </p>
20608 !! end
20609
20610 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20611 !! test
20612 Don't break list handling if language converter markup is in the item.
20613 !! options
20614 language=zh variant=zh-cn
20615 !! wikitext
20616 ;-{zh-cn:AAA;zh-tw:BBB}-
20617 !! html/php
20618 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20619
20620 !! html/parsoid
20621 <dl><dt>AAA
20622 </dt></dl>
20623 !! end
20624
20625 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20626 !! test
20627 Don't break table handling if language converter markup is in the cell.
20628 !! options
20629 language=sr variant=sr-ec
20630 !! wikitext
20631 {|
20632 |-
20633 | -{R|B}-
20634 |}
20635 !! html/php
20636 <table>
20637
20638 <tr>
20639 <td>Б}-
20640 </td></tr></table>
20641
20642 !! html/parsoid
20643 <table>
20644
20645 <tr>
20646 <td> B
20647 </td></tr></table>
20648
20649 !! end
20650
20651 !! test
20652 Bug 529: Uncovered bullet
20653 !! wikitext
20654 * Foo {{bullet}}
20655 !! html
20656 <ul><li> Foo </li>
20657 <li> Bar</li></ul>
20658
20659 !! end
20660
20661 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20662 # Templates in Wikipedia rely on this behavior, as tidy has always been
20663 # enabled there. These tests are normally run *without* tidy, so specify the
20664 # full output here.
20665 # To test realistic parsing behavior, apply a tidy-like transformation to both
20666 # the expected output and your parser's output.
20667 !! test
20668 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20669 !! wikitext
20670 ******* Foo {{bullet}}
20671 !! html
20672 <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>
20673 <li> Bar</li></ul>
20674
20675 !! end
20676
20677 !! test
20678 Bug 529: Uncovered table already at line-start
20679 !! wikitext
20680 x
20681
20682 {{table}}
20683 y
20684 !! html
20685 <p>x
20686 </p>
20687 <table>
20688 <tr>
20689 <td> 1 </td>
20690 <td> 2
20691 </td></tr>
20692 <tr>
20693 <td> 3 </td>
20694 <td> 4
20695 </td></tr></table>
20696 <p>y
20697 </p>
20698 !! end
20699
20700 !! test
20701 Bug 529: Uncovered bullet in parser function result
20702 !! wikitext
20703 * Foo {{lc:{{bullet}} }}
20704 !! html
20705 <ul><li> Foo </li>
20706 <li> bar</li></ul>
20707
20708 !! end
20709
20710 !! test
20711 Bug 5678: Double-parsed template argument
20712 !! wikitext
20713 {{lc:{{{1}}}|hello}}
20714 !! html
20715 <p>{{{1}}}
20716 </p>
20717 !! end
20718
20719 !! test
20720 Bug 5678: Double-parsed template invocation
20721 !! wikitext
20722 {{lc:{{paramtest {{!}} param = hello }} }}
20723 !! html
20724 <p>{{paramtest | param = hello }}
20725 </p>
20726 !! end
20727
20728 !! test
20729 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20730 !! options
20731 language=cs
20732 title=[[Main Page]]
20733 !! wikitext
20734 {{PRVNÍVELKÉ:ěščř}}
20735 {{prvnívelké:ěščř}}
20736 {{PRVNÍMALÉ:ěščř}}
20737 {{prvnímalé:ěščř}}
20738 {{MALÁ:ěščř}}
20739 {{malá:ěščř}}
20740 {{VELKÁ:ěščř}}
20741 {{velká:ěščř}}
20742 !! html
20743 <p>Ěščř
20744 Ěščř
20745 ěščř
20746 ěščř
20747 ěščř
20748 ěščř
20749 ĚŠČŘ
20750 ĚŠČŘ
20751 </p>
20752 !! end
20753
20754 !! test
20755 Morwen/13: Unclosed link followed by heading
20756 !! wikitext
20757 [[link
20758 ==heading==
20759 !! html
20760 <p>[[link
20761 </p>
20762 <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>
20763
20764 !! end
20765
20766 !! test
20767 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20768 !! wikitext
20769 {{foo|
20770 =heading=
20771 !! html
20772 <p>{{foo|
20773 </p>
20774 <h1><span class="mw-headline" id="heading">heading</span></h1>
20775
20776 !! end
20777
20778 !! test
20779 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20780 !! wikitext
20781 {{foo|
20782 ==heading==
20783 !! html
20784 <p>{{foo|
20785 </p>
20786 <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>
20787
20788 !! end
20789
20790 !! test
20791 Tildes in comments
20792 !! options
20793 pst
20794 !! wikitext
20795 <!-- ~~~~ -->
20796 !! html/php
20797 <!-- ~~~~ -->
20798 !! end
20799
20800 !! test
20801 Paragraphs inside divs (no extra line breaks)
20802 !! wikitext
20803 <div>Line one
20804
20805 Line two</div>
20806 !! html
20807 <div>Line one
20808 Line two</div>
20809
20810 !! end
20811
20812 !! test
20813 Paragraphs inside divs (extra line break on open)
20814 !! wikitext
20815 <div>
20816 Line one
20817
20818 Line two</div>
20819 !! html
20820 <div>
20821 <p>Line one
20822 </p>
20823 Line two</div>
20824
20825 !! end
20826
20827 !! test
20828 Paragraphs inside divs (extra line break on close)
20829 !! wikitext
20830 <div>Line one
20831
20832 Line two
20833 </div>
20834 !! html
20835 <div>Line one
20836 <p>Line two
20837 </p>
20838 </div>
20839
20840 !! end
20841
20842 !! test
20843 Paragraphs inside divs (extra line break on open and close)
20844 !! wikitext
20845 <div>
20846 Line one
20847
20848 Line two
20849 </div>
20850 !! html
20851 <div>
20852 <p>Line one
20853 </p><p>Line two
20854 </p>
20855 </div>
20856
20857 !! end
20858
20859 !! test
20860 Nesting tags, paragraphs on lines which begin with <div>
20861 !! wikitext
20862 <div></div><strong>A
20863 B</strong>
20864 !! html/php+tidy
20865 <p><strong>A</strong></p>
20866 <p><strong>B</strong></p>
20867 !! html/parsoid
20868 <div></div>
20869 <p><strong>A
20870 B</strong>
20871 </p>
20872 !! end
20873
20874 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20875 !! test
20876 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20877 !! wikitext
20878 <blockquote>Line one
20879
20880 Line two</blockquote>
20881 !! html
20882 <blockquote>Line one
20883 Line two</blockquote>
20884
20885 !! html+tidy
20886 <blockquote>
20887 <p>Line one Line two</p>
20888 </blockquote>
20889 !! end
20890
20891 !! test
20892 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20893 !! wikitext
20894 <blockquote>
20895 Line one
20896
20897 Line two</blockquote>
20898 !! html
20899 <blockquote>
20900 <p>Line one
20901 </p>
20902 Line two</blockquote>
20903
20904 !! html+tidy
20905 <blockquote>
20906 <p>Line one</p>
20907 Line two</blockquote>
20908 !! end
20909
20910 !! test
20911 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20912 !! wikitext
20913 <blockquote>Line one
20914
20915 Line two
20916 </blockquote>
20917 !! html
20918 <blockquote>Line one
20919 <p>Line two
20920 </p>
20921 </blockquote>
20922
20923 !! html+tidy
20924 <blockquote>
20925 <p>Line one</p>
20926 <p>Line two</p>
20927 </blockquote>
20928 !! end
20929
20930 !! test
20931 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20932 !! wikitext
20933 <blockquote>
20934 Line one
20935
20936 Line two
20937 </blockquote>
20938 !! html
20939 <blockquote>
20940 <p>Line one
20941 </p><p>Line two
20942 </p>
20943 </blockquote>
20944
20945 !! html+tidy
20946 <blockquote>
20947 <p>Line one</p>
20948 <p>Line two</p>
20949 </blockquote>
20950 !! end
20951
20952 !! test
20953 Paragraphs inside blockquotes/divs (no extra line breaks)
20954 !! wikitext
20955 <blockquote><div>Line one
20956
20957 Line two</div></blockquote>
20958 !! html
20959 <blockquote><div>Line one
20960 Line two</div></blockquote>
20961
20962 !! end
20963
20964 !! test
20965 Paragraphs inside blockquotes/divs (extra line break on open)
20966 !! wikitext
20967 <blockquote><div>
20968 Line one
20969
20970 Line two</div></blockquote>
20971 !! html
20972 <blockquote><div>
20973 <p>Line one
20974 </p>
20975 Line two</div></blockquote>
20976
20977 !! end
20978
20979 !! test
20980 Paragraphs inside blockquotes/divs (extra line break on close)
20981 !! wikitext
20982 <blockquote><div>Line one
20983
20984 Line two
20985 </div></blockquote>
20986 !! html
20987 <blockquote><div>Line one
20988 <p>Line two
20989 </p>
20990 </div></blockquote>
20991
20992 !! end
20993
20994 !! test
20995 Paragraphs inside blockquotes/divs (extra line break on open and close)
20996 !! wikitext
20997 <blockquote><div>
20998 Line one
20999
21000 Line two
21001 </div></blockquote>
21002 !! html
21003 <blockquote><div>
21004 <p>Line one
21005 </p><p>Line two
21006 </p>
21007 </div></blockquote>
21008
21009 !! end
21010
21011 !! test
21012 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21013 !! options
21014 wgLinkHolderBatchSize=0
21015 !! wikitext
21016 [[meatball:1]]
21017 [[meatball:2]]
21018 [[meatball:3]]
21019 !! html
21020 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21021 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21022 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21023 </p>
21024 !! end
21025
21026 !! test
21027 Free external link invading image caption
21028 !! wikitext
21029 [[Image:Foobar.jpg|thumb|http://x|hello]]
21030 !! html
21031 <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>
21032
21033 !! end
21034
21035 !! test
21036 Bug 15196: localised external link numbers
21037 !! options
21038 language=fa
21039 !! wikitext
21040 [http://en.wikipedia.org/]
21041 !! html/php
21042 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21043 </p>
21044 !! html/parsoid
21045 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21046 !! end
21047
21048 !! test
21049 Multibyte character in padleft
21050 !! wikitext
21051 {{padleft:-Hello|7|Æ}}
21052 !! html
21053 <p>Æ-Hello
21054 </p>
21055 !! end
21056
21057 !! test
21058 Multibyte character in padright
21059 !! wikitext
21060 {{padright:Hello-|7|Æ}}
21061 !! html
21062 <p>Hello-Æ
21063 </p>
21064 !! end
21065
21066 !!test
21067 formatdate parser function
21068 !! wikitext
21069 {{#formatdate:2009-03-24}}
21070 !! html
21071 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21072 </p>
21073 !! end
21074
21075 !!test
21076 formatdate parser function, with default format
21077 !! wikitext
21078 {{#formatdate:2009-03-24|mdy}}
21079 !! html
21080 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21081 </p>
21082 !! end
21083
21084 !! test
21085 Spacing of numbers in formatted dates
21086 !! wikitext
21087 {{#formatdate:January 15}}
21088 !! html
21089 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21090 </p>
21091 !! end
21092
21093 !! test
21094 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
21095 !! options
21096 language=nl title=[[MediaWiki:Common.css]]
21097 !! wikitext
21098 {{#formatdate:2009-03-24|dmy}}
21099 !! html
21100 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21101 </p>
21102 !! end
21103
21104 #
21105 #
21106 #
21107
21108 #
21109 # Edit comments
21110 #
21111
21112 !! test
21113 Edit comment with link
21114 !! options
21115 comment
21116 !! wikitext
21117 I like the [[Main Page]] a lot
21118 !! html/php
21119 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21120 !!end
21121
21122 !! test
21123 Edit comment with link and link text
21124 !! options
21125 comment
21126 !! wikitext
21127 I like the [[Main Page|best pages]] a lot
21128 !! html/php
21129 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21130 !!end
21131
21132 !! test
21133 Edit comment with link and link text with suffix
21134 !! options
21135 comment
21136 !! wikitext
21137 I like the [[Main Page|best page]]s a lot
21138 !! html/php
21139 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21140 !!end
21141
21142 !! test
21143 Edit comment with section link (non-local, eg in history list)
21144 !! options
21145 comment title=[[Main Page]]
21146 !! wikitext
21147 /* External links */ removed bogus entries
21148 !! html/php
21149 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21150 !!end
21151
21152 !! test
21153 Edit comment with section link and text before it (non-local, eg in history list)
21154 !! options
21155 comment title=[[Main Page]]
21156 !! wikitext
21157 pre-comment text /* External links */ removed bogus entries
21158 !! html/php
21159 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>
21160 !!end
21161
21162 !! test
21163 Edit comment with section link (local, eg in diff view)
21164 !! options
21165 comment local title=[[Main Page]]
21166 !! wikitext
21167 /* External links */ removed bogus entries
21168 !! html/php
21169 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21170 !!end
21171
21172 !! test
21173 Edit comment with subpage link (bug 14080)
21174 !! options
21175 comment
21176 subpage
21177 title=[[Subpage test]]
21178 !! wikitext
21179 Poked at a [[/subpage]] here...
21180 !! html/php
21181 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21182 !!end
21183
21184 !! test
21185 Edit comment with subpage link and link text (bug 14080)
21186 !! options
21187 comment
21188 subpage
21189 title=[[Subpage test]]
21190 !! wikitext
21191 Poked at a [[/subpage|neat little page]] here...
21192 !! html/php
21193 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21194 !!end
21195
21196 !! test
21197 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21198 !! options
21199 comment
21200 title=[[Subpage test]]
21201 !! wikitext
21202 Poked at a [[/subpage]] here...
21203 !! html/php
21204 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...
21205 !!end
21206
21207 !! test
21208 Edit comment with bare anchor link (local, as on diff)
21209 !! options
21210 comment
21211 local
21212 title=[[Main Page]]
21213 !! wikitext
21214 [[#section]]
21215 !! html/php
21216 <a href="#section">#section</a>
21217 !! end
21218
21219 !! test
21220 Edit comment with bare anchor link (non-local, as on history)
21221 !! options
21222 comment
21223 title=[[Main Page]]
21224 !! wikitext
21225 [[#section]]
21226 !! html/php
21227 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21228 !! end
21229
21230 !! test
21231 Anchor starting with underscore
21232 !! options
21233 title=[[Foo]]
21234 !! wikitext
21235 [[#_ref|One]]
21236 !! html/php
21237 <p><a href="#_ref">One</a>
21238 </p>
21239 !! html/parsoid
21240 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21241 !! end
21242
21243 !! test
21244 Id starting with underscore
21245 !! wikitext
21246 <div id="_ref"></div>
21247 !! html/*
21248 <div id="_ref"></div>
21249
21250 !! end
21251
21252 !! test
21253 Edit comment with link with more than one pipe (T99346)
21254 !! options
21255 comment
21256 !! wikitext
21257 [[Main Page|Many|pipes]]
21258 !! html/php
21259 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21260 !! end
21261
21262 !! test
21263 Complex edit comment with link with more than one pipe (T99346)
21264 !! options
21265 comment
21266 !! wikitext
21267 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21268 !! html/php
21269 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;
21270 !! end
21271
21272 !! test
21273 Space normalisation on autocomment (bug 22784)
21274 !! options
21275 comment
21276 title=[[Main Page]]
21277 !! wikitext
21278 /* __hello__world__ */
21279 !! html/php
21280 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21281 !! end
21282
21283 !! test
21284 percent-encoding and + signs in comments (Bug 26410)
21285 !! options
21286 comment
21287 !! wikitext
21288 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21289 !! html/php
21290 <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>
21291 !! end
21292
21293 # Parsoid doesn't support this yet: see bug 73581
21294 # but it *should* omit the 'src' attribute if the image is bad.
21295 # PHP side of tests was disabled in
21296 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21297 # because of issues in the PHP parserTests infrastructure
21298 # (but the output below is indeed what the PHP side emits)
21299 !! test
21300 Bad images - basic functionality
21301 !! wikitext
21302 [[File:Bad.jpg]]
21303 !! DISABLED/html/php
21304 !! html/parsoid
21305 <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>
21306 !! end
21307
21308 !! test
21309 Bad images - bug 16039: text after bad image disappears
21310 !! wikitext
21311 Foo bar
21312 [[File:Bad.jpg]]
21313 Bar foo
21314 !! DISABLED/html/php
21315 <p>Foo bar
21316 </p><p>Bar foo
21317 </p>
21318 !! html/parsoid
21319 <p>Foo bar
21320 <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>
21321 Bar foo</p>
21322 !! end
21323
21324 !! test
21325 Verify that displaytitle works (bug #22501) no displaytitle
21326 !! options
21327 showtitle
21328 !! config
21329 wgAllowDisplayTitle=true
21330 wgRestrictDisplayTitle=false
21331 !! wikitext
21332 this is not the the title
21333 !! html/php
21334 Parser test
21335 <p>this is not the the title
21336 </p>
21337 !! end
21338
21339 !! test
21340 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21341 !! options
21342 showtitle
21343 title=[[Screen]]
21344 !! config
21345 wgAllowDisplayTitle=true
21346 wgRestrictDisplayTitle=false
21347 !! wikitext
21348 this is not the the title
21349 {{DISPLAYTITLE:whatever}}
21350 !! html/php
21351 whatever
21352 <p>this is not the the title
21353 </p>
21354 !! end
21355
21356 !! test
21357 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21358 !! options
21359 showtitle
21360 title=[[Screen]]
21361 !! config
21362 wgAllowDisplayTitle=true
21363 wgRestrictDisplayTitle=true
21364 !! wikitext
21365 this is not the the title
21366 {{DISPLAYTITLE:whatever}}
21367 !! html/php
21368 Screen
21369 <p>this is not the the title
21370 </p>
21371 !! end
21372
21373 !! test
21374 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21375 !! options
21376 showtitle
21377 title=[[Screen]]
21378 !! config
21379 wgAllowDisplayTitle=true
21380 wgRestrictDisplayTitle=true
21381 !! wikitext
21382 this is not the the title
21383 {{DISPLAYTITLE:screen}}
21384 !! html/php
21385 screen
21386 <p>this is not the the title
21387 </p>
21388 !! end
21389
21390 !! test
21391 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21392 !! options
21393 showtitle
21394 title=[[Screen]]
21395 !! config
21396 wgAllowDisplayTitle=false
21397 !! wikitext
21398 this is not the the title
21399 {{DISPLAYTITLE:screen}}
21400 !! html/php
21401 Screen
21402 <p>this is not the the title
21403 <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>
21404 </p>
21405 !! end
21406
21407 !! test
21408 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21409 !! options
21410 showtitle
21411 title=[[Screen]]
21412 !! config
21413 wgAllowDisplayTitle=false
21414 !! wikitext
21415 this is not the the title
21416 !! html/php
21417 Screen
21418 <p>this is not the the title
21419 </p>
21420 !! end
21421
21422 !! test
21423 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21424 !! options
21425 showtitle
21426 title=[[Screen]]
21427 !! config
21428 wgAllowDisplayTitle=true
21429 wgRestrictDisplayTitle=true
21430 !! wikitext
21431 this is not the the title
21432 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21433 !! html/php
21434 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21435 <p>this is not the the title
21436 </p>
21437 !! end
21438
21439 !! test
21440 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21441 !! options
21442 showtitle
21443 title=[[Screen]]
21444 !! config
21445 wgAllowDisplayTitle=true
21446 wgRestrictDisplayTitle=true
21447 !! wikitext
21448 this is not the the title
21449 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21450 !! html/php
21451 <span style="color: red;">s</span>creen
21452 <p>this is not the the title
21453 </p>
21454 !! end
21455
21456 !! test
21457 Page status indicators: Empty name is invalid
21458 !! options
21459 showindicators
21460 !! wikitext
21461 <indicator name=" "></indicator>
21462 <indicator></indicator>
21463 !! html
21464 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21465 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21466 </p>
21467 !! end
21468
21469 !! test
21470 Page status indicators: Weird syntaxes that are okay
21471 !! options
21472 showindicators
21473 !! wikitext
21474 <indicator name="empty" />
21475 <indicator name="name"></indicator>
21476 !! html
21477 empty=
21478 name=
21479 <p><br />
21480 </p>
21481 !! end
21482
21483 !! test
21484 Page status indicators: Torture test
21485 !! options
21486 showindicators
21487 !! wikitext
21488 <indicator name="01">hello world</indicator>
21489 <indicator name="02">[[Main Page]]</indicator>
21490 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21491 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21492 <indicator name="05">* foo
21493 * bar</indicator>
21494 <indicator name="06"><nowiki>foo</nowiki></indicator>
21495 <indicator name="07"> Preformatted</indicator>
21496 <indicator name="08"><div>Broken tag</indicator>
21497 <indicator name="09">{| class=wikitable
21498 | cell
21499 |}</indicator>
21500 <indicator name="10">Two
21501
21502 paragraphs</indicator>
21503 !! html
21504 01=hello world
21505 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21506 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" />
21507 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>
21508 05=<ul><li> foo</li>
21509 <li> bar</li></ul>
21510
21511 06=foo
21512 07=<pre>Preformatted
21513 </pre>
21514 08=<div>Broken tag</div>
21515
21516 09=<table class="wikitable">
21517 <tr>
21518 <td> cell
21519 </td></tr></table>
21520
21521 10=<p>Two
21522 </p><p>paragraphs
21523 </p>
21524 <p><br />
21525 </p><p><br />
21526 </p><p><br />
21527 </p><p><br />
21528 </p><p><br />
21529 </p>
21530 !! end
21531
21532 !! test
21533 preload: check <noinclude> and <includeonly>
21534 !! options
21535 preload
21536 !! wikitext
21537 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21538 !! html/php
21539 Hello kind world.
21540 !! end
21541
21542 !! test
21543 preload: check <onlyinclude>
21544 !! options
21545 preload
21546 !! wikitext
21547 Goodbye <onlyinclude>Hello world</onlyinclude>
21548 !! html/php
21549 Hello world
21550 !! end
21551
21552 !! test
21553 preload: can pass tags through if we want to
21554 !! options
21555 preload
21556 !! wikitext
21557 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21558 !! html/php
21559 <includeonly>Hello world</includeonly>
21560 !! end
21561
21562 !! test
21563 preload: check that it doesn't try to do tricks
21564 !! options
21565 preload
21566 !! wikitext
21567 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21568 !! html/php
21569 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21570 !! end
21571
21572 !! test
21573 Play a bit with r67090 and bug 3158
21574 !! wikitext
21575 <div style="width:50% !important">&nbsp;</div>
21576 <div style="width:50%&nbsp;!important">&nbsp;</div>
21577 <div style="width:50%&#160;!important">&nbsp;</div>
21578 <div style="border : solid;">&nbsp;</div>
21579 !! html/php
21580 <div style="width:50% !important">&#160;</div>
21581 <div style="width:50% !important">&#160;</div>
21582 <div style="width:50% !important">&#160;</div>
21583 <div style="border&#160;: solid;">&#160;</div>
21584
21585 !! html/parsoid
21586 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21587 <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>
21588 <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>
21589 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21590
21591 !! end
21592
21593 !! test
21594 HTML5 data attributes
21595 !! wikitext
21596 <span data-foo="bar">Baz</span>
21597 <p data-abc-def_hij="">Quuz</p>
21598 !! html/php
21599 <p><span data-foo="bar">Baz</span>
21600 </p>
21601 <p data-abc-def_hij="">Quuz</p>
21602
21603 !! html/parsoid
21604 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21605 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21606 !! end
21607
21608 !! test
21609 Strip reserved data attributes
21610 !! wikitext
21611 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21612 !! html/php
21613 <div data-ok="fred">d</div>
21614
21615 !! html/parsoid
21616 <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>
21617 !! end
21618
21619 !! test
21620 percent-encoding and + signs in internal links (Bug 26410)
21621 !! wikitext
21622 [[User:+%]] [[Page+title%]]
21623 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21624 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21625 [[%33%45]] [[%33%45+]]
21626 !! html/php
21627 <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>
21628 <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>
21629 <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>
21630 <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>
21631 </p>
21632 !! html/parsoid
21633 <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>
21634 <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>
21635 <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>
21636 <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>
21637 !! end
21638
21639 !! test
21640 Special characters in embedded file links (bug 27679)
21641 !! wikitext
21642 [[File:Contains & ampersand.jpg]]
21643 [[File:Does not exist.jpg|Title with & ampersand]]
21644 !! html/php
21645 <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>
21646 <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>
21647 </p>
21648 !! html/parsoid
21649 <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>
21650 <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>
21651 !! end
21652
21653 !! test
21654 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21655 !! wikitext
21656 Text&apos;s been normalized?
21657 !! html
21658 <p>Text&#39;s been normalized?
21659 </p>
21660 !! end
21661
21662 !! test
21663 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21664 !! wikitext
21665 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21666 !! html
21667 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21668 </p>
21669 !! end
21670
21671 !! test
21672 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21673 !! wikitext
21674 [http://www.example.org/ ideograms]
21675 !! html
21676 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21677 </p>
21678 !! end
21679
21680 !! test
21681 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21682 !! wikitext
21683 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21684 !! html
21685 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21686 </p>
21687 !! end
21688
21689 !! article
21690 Mediawiki:loop1
21691 !! text
21692 {{Identical|A}}
21693 !! endarticle
21694
21695 !! article
21696 Mediawiki:loop2
21697 !! text
21698 {{Identical|B}}
21699 !! endarticle
21700
21701 !! article
21702 Template:Identical
21703 !! text
21704 {{int:loop1}}
21705 {{int:loop2}}
21706 !! endarticle
21707
21708 !! test
21709 Bug 31098 Template which includes system messages which includes the template
21710 !! wikitext
21711 {{Identical}}
21712 !! html
21713 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21714 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21715 </p>
21716 !! end
21717
21718 !! test
21719 Bug31490 Turkish: ucfirst 'blah'
21720 !! options
21721 language=tr
21722 !! wikitext
21723 {{ucfirst:blah}}
21724 !! html
21725 <p>Blah
21726 </p>
21727 !! end
21728
21729 !! test
21730 Bug31490 Turkish: ucfirst 'ix'
21731 !! options
21732 language=tr
21733 !! wikitext
21734 {{ucfirst:ix}}
21735 !! html
21736 <p>İx
21737 </p>
21738 !! end
21739
21740 !! test
21741 Bug31490 Turkish: lcfirst 'BLAH'
21742 !! options
21743 language=tr
21744 !! wikitext
21745 {{lcfirst:BLAH}}
21746 !! html
21747 <p>bLAH
21748 </p>
21749 !! end
21750
21751 !! test
21752 Bug31490 Turkish: ucfırst (with a dotless i)
21753 !! options
21754 language=tr
21755 !! wikitext
21756 {{ucfırst:blah}}
21757 !! html
21758 <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>
21759 </p>
21760 !! end
21761
21762 !! test
21763 Bug31490 ucfırst (with a dotless i) with English language
21764 !! options
21765 language=en
21766 !! wikitext
21767 {{ucfırst:blah}}
21768 !! html
21769 <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>
21770 </p>
21771 !! end
21772
21773 !! test
21774 Bug 26375: TOC with italics
21775 !! options
21776 title=[[Main Page]]
21777 !! wikitext
21778 __TOC__
21779 == ''Lost'' episodes ==
21780 !! html
21781 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21782 <ul>
21783 <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>
21784 </ul>
21785 </div>
21786
21787 <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>
21788
21789 !! end
21790
21791 !! test
21792 Bug 26375: TOC with bold
21793 !! options
21794 title=[[Main Page]]
21795 !! wikitext
21796 __TOC__
21797 == '''should be bold''' then normal text ==
21798 !! html
21799 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21800 <ul>
21801 <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>
21802 </ul>
21803 </div>
21804
21805 <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>
21806
21807 !! end
21808
21809 !! test
21810 Bug 33845: Headings become cursive in TOC when they contain an image
21811 !! options
21812 title=[[Main Page]]
21813 !! wikitext
21814 __TOC__
21815 == Image [[Image:foobar.jpg]] ==
21816 !! html
21817 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21818 <ul>
21819 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21820 </ul>
21821 </div>
21822
21823 <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>
21824
21825 !! end
21826
21827 !! test
21828 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21829 !! options
21830 title=[[Main Page]]
21831 !! wikitext
21832 __TOC__
21833 == <blockquote>Quote</blockquote> ==
21834 !! html
21835 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21836 <ul>
21837 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21838 </ul>
21839 </div>
21840
21841 <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>
21842
21843 !! html+tidy
21844 <p></p>
21845 <div id="toc" class="toc">
21846 <div id="toctitle">
21847 <h2>Contents</h2>
21848 </div>
21849 <ul>
21850 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21851 </ul>
21852 </div>
21853 <p></p>
21854 <h2><span class="mw-headline" id="Quote"></span></h2>
21855 <blockquote>
21856 <p><span class="mw-headline" id="Quote">Quote</span></p>
21857 </blockquote>
21858 <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>
21859 !! end
21860
21861 !! test
21862 Unclosed tags in TOC
21863 !! options
21864 title=[[Main Page]]
21865 !! wikitext
21866 __TOC__
21867 == Proof: 2 < 3 ==
21868 <small>Hanc marginis exiguitas non caperet.</small>
21869 QED
21870 !! html
21871 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21872 <ul>
21873 <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>
21874 </ul>
21875 </div>
21876
21877 <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>
21878 <p><small>Hanc marginis exiguitas non caperet.</small>
21879 QED
21880 </p>
21881 !! end
21882
21883 !! test
21884 Multiple tags in TOC
21885 !! wikitext
21886 __TOC__
21887 == <i>Foo</i> <b>Bar</b> ==
21888
21889 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21890 !! html
21891 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21892 <ul>
21893 <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>
21894 <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>
21895 </ul>
21896 </div>
21897
21898 <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>
21899 <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>
21900
21901 !! html+tidy
21902 <p></p>
21903 <div id="toc" class="toc">
21904 <div id="toctitle">
21905 <h2>Contents</h2>
21906 </div>
21907 <ul>
21908 <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>
21909 <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>
21910 </ul>
21911 </div>
21912 <p></p>
21913 <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>
21914 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21915 <blockquote>
21916 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21917 </blockquote>
21918 <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>
21919 !! end
21920
21921 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21922 # html5 tag parsing.
21923 !! test
21924 Tags with parameters in TOC
21925 !! options
21926 parsoid=wt2html
21927 !! wikitext
21928 __TOC__
21929 == <sup class="in-h2">Hello</sup> ==
21930
21931 == <sup class="a > b">Evilbye</sup> ==
21932 !! html/php
21933 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21934 <ul>
21935 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21936 <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>
21937 </ul>
21938 </div>
21939
21940 <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>
21941 <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>
21942
21943 !! html/parsoid
21944 <meta property="mw:PageProp/toc" />
21945 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21946
21947 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21948 !! end
21949
21950 !! test
21951 span tags with directionality in TOC
21952 !! wikitext
21953 __TOC__
21954 == <span dir="ltr">C++</span> ==
21955
21956 == <span dir="rtl">זבנג!</span> ==
21957
21958 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21959
21960 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21961
21962 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21963 !! html
21964 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21965 <ul>
21966 <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>
21967 <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>
21968 <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>
21969 <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>
21970 <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>
21971 </ul>
21972 </div>
21973
21974 <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>
21975 <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>
21976 <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>
21977 <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>
21978 <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>
21979
21980 !! end
21981
21982 !! test
21983 Bug 72884: bdi element in ToC
21984 !! wikitext
21985 __TOC__
21986 == <bdi>test</bdi> ==
21987 !! html
21988 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21989 <ul>
21990 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21991 </ul>
21992 </div>
21993
21994 <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>
21995
21996 !! end
21997
21998 !! test
21999 T35715: s/strike element in ToC
22000 !! wikitext
22001 __TOC__
22002 == <s>test</s> test <strike>test</strike> ==
22003 !! html
22004 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22005 <ul>
22006 <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>
22007 </ul>
22008 </div>
22009
22010 <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>
22011
22012 !! end
22013
22014 # Note that the html output does not have the <p></p>, but the
22015 # html+tidy output *does*. This is because the empty <p></p> is
22016 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22017 !! test
22018 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22019 !! wikitext
22020 __TOC__
22021 == x ==
22022 !! html
22023 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22024 <ul>
22025 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22026 </ul>
22027 </div>
22028
22029 <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>
22030
22031 !! html+tidy
22032 <p></p>
22033 <div id="toc" class="toc">
22034 <div id="toctitle">
22035 <h2>Contents</h2>
22036 </div>
22037 <ul>
22038 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22039 </ul>
22040 </div>
22041 <p></p>
22042 <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>
22043 !! end
22044
22045 !! article
22046 MediaWiki:Bug32057
22047 !! text
22048 == {{int:headline_sample}} ==
22049 !! endarticle
22050
22051 !! test
22052 Bug 32057: Title needed when expanding <h> nodes.
22053 !! options
22054 title=[[Main Page]]
22055 !! wikitext
22056 {{int:Bug32057}}
22057 !! html
22058 <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>
22059
22060 !! end
22061
22062 !! test
22063 Strip marker in urlencode
22064 !! wikitext
22065 {{urlencode:x<nowiki/>y}}
22066 {{urlencode:x<nowiki/>y|wiki}}
22067 {{urlencode:x<nowiki/>y|path}}
22068 {{urlencode:x<pre id="one">two</pre>y}}
22069 !! html/php
22070 <p>xy
22071 xy
22072 xy
22073 xy
22074 </p>
22075 !! end
22076
22077 !! test
22078 Strip marker in lc
22079 !! wikitext
22080 {{lc:x<nowiki/>y}}
22081 !! html
22082 <p>xy
22083 </p>
22084 !! end
22085
22086 !! test
22087 Strip marker in uc
22088 !! wikitext
22089 {{uc:x<nowiki/>y}}
22090 !! html
22091 <p>XY
22092 </p>
22093 !! end
22094
22095 !! test
22096 Strip marker in formatNum
22097 !! wikitext
22098 {{formatnum:1<nowiki/>2}}
22099 {{formatnum:1<nowiki/>2|R}}
22100 !! html
22101 <p>12
22102 12
22103 </p>
22104 !! end
22105
22106 !! test
22107 Check noCommafy in formatNum
22108 !! options
22109 language=be-tarask
22110 !! wikitext
22111 {{formatnum:123456.78}}
22112 {{formatnum:123456.78|NOSEP}}
22113 !! html
22114 <p>123 456,78
22115 123456.78
22116 </p>
22117 !! end
22118
22119 !! test
22120 Wrong option for formatNum (bug 56199)
22121 !! wikitext
22122 {{formatnum:1,234.56|Random}}
22123 {{formatnum:1,234.56|EVERYTHING}}
22124 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22125 !! html
22126 <p>1,234.56
22127 1,234.56
22128 1,234.56
22129 </p>
22130 !! end
22131
22132 !! test
22133 Strip marker in grammar
22134 !! options
22135 language=fi
22136 !! wikitext
22137 {{grammar:elative|foo<nowiki/>bar}}
22138 !! html
22139 <p>foobarista
22140 </p>
22141 !! end
22142
22143 !! test
22144 Strip marker in padleft
22145 !! wikitext
22146 {{padleft:|2|x<nowiki/>y}}
22147 !! html
22148 <p>xy
22149 </p>
22150 !! end
22151
22152 !! test
22153 Strip marker in padright
22154 !! wikitext
22155 {{padright:|2|x<nowiki/>y}}
22156 !! html
22157 <p>xy
22158 </p>
22159 !! end
22160
22161 !! test
22162 Strip marker in anchorencode
22163 !! wikitext
22164 {{anchorencode:x<nowiki/>y}}
22165 !! html
22166 <p>xy
22167 </p>
22168 !! end
22169
22170 !! test
22171 nowiki inside link inside heading (bug 18295)
22172 !! wikitext
22173 ==[[foo|x<nowiki>y</nowiki>z]]==
22174 !! html
22175 <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>
22176
22177 !! end
22178
22179 !! test
22180 new support for bdi element (bug 31817)
22181 !! wikitext
22182 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22183 !! html
22184 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22185
22186 !!end
22187
22188 !! test
22189 Ignore pipe between table row attributes
22190 !! wikitext
22191 {|
22192 | quux
22193 |- id=foo | style='color: red'
22194 | bar
22195 |}
22196 !! html
22197 <table>
22198 <tr>
22199 <td> quux
22200 </td></tr>
22201 <tr id="foo" style="color: red">
22202 <td> bar
22203 </td></tr></table>
22204
22205 !! end
22206
22207 !! test
22208 Language parser function
22209 !! wikitext
22210 {{#language:ar}}
22211 !! html
22212 <p>العربية
22213 </p>
22214 !! end
22215
22216 !!test
22217 Padleft and padright as substr
22218 !! wikitext
22219 {{padleft:|3|abcde}}
22220 {{padright:|3|abcde}}
22221 !! html
22222 <p>abc
22223 abc
22224 </p>
22225 !! end
22226
22227 !!test
22228 Special parser function
22229 !! wikitext
22230 {{#special:RandomPage}}
22231 {{#special:BaDtItLe}}
22232 {{#special:Foobar}}
22233 !! html
22234 <p>Special:Random
22235 Special:Badtitle
22236 Special:Foobar
22237 </p>
22238 !! end
22239
22240 !!test
22241 Bug 34939 - Case insensitive link parsing ([HttP://])
22242 !! wikitext
22243 [HttP://MediaWiki.Org/]
22244 !! html/php
22245 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22246 </p>
22247 !! html/parsoid
22248 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22249 !! end
22250
22251 !!test
22252 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22253 !! wikitext
22254 [HttP://MediaWiki.Org/ MediaWiki]
22255 !! html
22256 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22257 </p>
22258 !! end
22259
22260 !!test
22261 Bug 34939 - Case insensitive link parsing (HttP://)
22262 !! wikitext
22263 HttP://MediaWiki.Org/
22264 !! html/php
22265 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22266 </p>
22267 !! html/parsoid
22268 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22269 !! end
22270
22271 !!test
22272 Disable TOC
22273 !! options
22274 notoc
22275 !! wikitext
22276 Lead
22277 == Section 1 ==
22278 == Section 2 ==
22279 == Section 3 ==
22280 == Section 4 ==
22281 == Section 5 ==
22282 !! html
22283 <p>Lead
22284 </p>
22285
22286 <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>
22287 <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>
22288 <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>
22289 <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>
22290 <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>
22291
22292 !! end
22293
22294
22295 ###
22296 ### Parsoid-specific tests
22297 ### Parsoid-PHP parser incompatibilities
22298 ###
22299 !!test
22300 1. SOL-sensitive wikitext tokens as template-args
22301 !!options
22302 parsoid=wt2html,wt2wt
22303 !! wikitext
22304 {{echo|*a}}
22305 {{echo|#a}}
22306 {{echo|:a}}
22307 !! html
22308 <span about="#mwt1" typeof="mw:Transclusion">
22309 </span><ul about="#mwt1"><li>a</li>
22310 </ul>
22311 <span about="#mwt2" typeof="mw:Transclusion">
22312 </span><ol about="#mwt2"><li>a</li>
22313 </ol>
22314 <span about="#mwt3" typeof="mw:Transclusion">
22315 </span><dl about="#mwt3"><dd>a</dd>
22316 </dl>
22317 !!end
22318
22319 #### -----------------------------------------------------------------
22320 #### Parsoid-specific functionality tests
22321 #### -----------------------------------------------------------------
22322
22323 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22324 # We know wt2wt will fail, but we expect selser to pass.
22325 # Due to the nature of our testing, wt2wt and selser tests will enter the
22326 # blacklist and we'll catch selser regressions based on changes to the
22327 # blacklist entries for selser tests.
22328 !! test
22329 1. Bad treebuilder fixup of formatting elt is cleaned up
22330 !! options
22331 parsoid=wt2html,wt2wt
22332 !! wikitext
22333 {|
22334 |
22335 <small>
22336 [[Image:Foobar.jpg|right|Test]]
22337 </small>
22338 |}
22339 !! html/parsoid
22340 <table>
22341 <tbody><tr><td>
22342 <small>
22343 <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>
22344 </small>
22345 </td></tr>
22346 </tbody></table>
22347 !! end
22348
22349 !! test
22350 2. Bad treebuilder fixup of formatting elt is cleaned up
22351 !! options
22352 parsoid=wt2html,wt2wt
22353 !! wikitext
22354 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22355
22356 <small>[[Image:Foobar.jpg|right|300px]]</small>
22357 !! html/parsoid
22358
22359 <p><b>foo</b></p>
22360 <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>
22361 <p><b>bar</b></p>
22362 <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>
22363 !! end
22364
22365 !! test
22366 3. Bad treebuilder fixup of formatting elt is cleaned up
22367 !! options
22368 parsoid=wt2html,wt2wt
22369 !! wikitext
22370 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22371 !! html/parsoid
22372 <p><small><b>foo</b></small></p>
22373 <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>
22374 <p><small><b>bar</b></small></p>
22375 !! end
22376
22377 !! test
22378 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22379 !! options
22380 parsoid=wt2html,wt2wt
22381 !! wikitext
22382 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22383 !! html/parsoid
22384 <p><b><small></small></b></p>
22385 <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>
22386 <p></p>
22387 !! end
22388
22389 #### ----------------------------------------------------------------
22390 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22391 #### tags. Parsoid's output for these tags differs from that of the
22392 #### PHP parser.
22393 #### ----------------------------------------------------------------
22394
22395 !!test
22396 Ref: 1. ref-location should be replaced with an index span
22397 !! wikitext
22398 A <ref>foo</ref>
22399 B <ref name="x">foo</ref>
22400 C <ref name="y" />
22401 <references />
22402 !! html/parsoid
22403 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22404 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="#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
22405 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="#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
22406 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22407 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22408 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="#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>
22409 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="#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>
22410 </ol>
22411 !!end
22412
22413 !!test
22414 Ref: 2. ref-tags with identical names should all get the same index
22415 !! wikitext
22416 A <ref name="x">foo</ref>
22417 B <ref name="x" />
22418 <references />
22419 !! html/parsoid
22420 <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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22421 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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22422 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22423 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#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>
22424 </ol>
22425 !!end
22426
22427 !!test
22428 Ref: 3. spaces in ref-names should be ignored
22429 !! wikitext
22430 A <ref name="x">foo</ref>
22431 B <ref name=" x " />
22432 C <ref name= x />
22433 <references />
22434 !! html/parsoid
22435 <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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22436 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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22437 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="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22438 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22439 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="#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>
22440 </ol>
22441 !!end
22442
22443 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22444 !!test
22445 Ref: 4. 'constructor' should be accepted as a valid ref-name
22446 !! wikitext
22447 A <ref name="constructor">foo</ref>
22448 <references />
22449 !! html/parsoid
22450 <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="#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22451 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22452 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="#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>
22453 </ol>
22454 !!end
22455
22456 !!test
22457 Ref: 5. body should accept generic wikitext
22458 !! wikitext
22459 A <ref>
22460 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22461 </ref>
22462
22463 <references />
22464 !! html/parsoid
22465 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22466
22467 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22468 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22469 </span></li>
22470 </ol>
22471 !!end
22472
22473 !!test
22474 Ref: 6. indent-pres should not be output in ref-body
22475 !! wikitext
22476 A <ref>
22477 foo
22478 bar
22479 baz
22480 </ref>
22481
22482 <references />
22483 !! html/parsoid
22484 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22485
22486 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22487 <li about="#cite_note-1" id="cite_note-1"><a href="#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
22488 bar
22489 baz
22490 </span></li>
22491 </ol>
22492 !!end
22493
22494 !!test
22495 Ref: 7. No p-wrapping in ref-body
22496 !! wikitext
22497 A <ref>
22498 foo
22499
22500 bar
22501
22502
22503 baz
22504
22505
22506
22507 booz
22508 </ref>
22509
22510 <references />
22511 !! html/parsoid
22512 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22513
22514 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22515 <li about="#cite_note-1" id="cite_note-1"><a href="#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
22516
22517 bar
22518
22519
22520 baz
22521
22522
22523
22524 booz
22525 </span></li>
22526 </ol>
22527 !!end
22528
22529 !!test
22530 Ref: 8. transclusion wikitext has lower precedence
22531 !! wikitext
22532 A <ref> foo {{echo|</ref> B C}}
22533
22534 <references />
22535 !! html/parsoid
22536 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C}}</p>
22537 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22538 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22539 </ol>
22540 !!end
22541
22542 !!test
22543 Ref: 9. unclosed comments should not leak out of ref-body
22544 !! wikitext
22545 A <ref> foo <!--</ref> B C
22546 <references />
22547 !! html/parsoid
22548 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22549 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22550 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22551 </ol>
22552 !!end
22553
22554 !!test
22555 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22556 !! wikitext
22557 A <ref> <b> foo </ref> B C
22558
22559 <references />
22560 !! html/parsoid
22561 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22562
22563
22564 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22565 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22566 </ol>
22567 !!end
22568
22569 !!test
22570 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22571 !! wikitext
22572 A <ref>foo</ref> B
22573 C <ref>bar</ref> D
22574 <references />
22575 !! html/parsoid
22576 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
22577 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="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
22578 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22579 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22580 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
22581 </ol>
22582 !!end
22583
22584 !!test
22585 Ref: 12. ref-tags act as trailing newline migration barrier
22586 !! wikitext
22587 <!--the newline at the end of this line moves out of the p tag-->a
22588
22589 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22590 <ref />
22591
22592 c
22593 <references />
22594 !! html/parsoid
22595 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22596
22597
22598 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22599 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22600
22601 <p>c</p>
22602 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22603 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22604 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
22605 !!end
22606
22607 !!test
22608 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22609 !! wikitext
22610 <ref>foo</ref> A
22611 <ref>bar
22612 </ref> B
22613 <references />
22614 !! html/parsoid
22615 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
22616 <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="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
22617 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22618 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22619 <li about="#cite_note-2" id="cite_note-2"><a href="#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
22620 </span></li>
22621 </ol>
22622 !!end
22623
22624 ## Roundtripping fails because of nowiki'ing
22625 !! test
22626 Ref: 14. A nested ref-tag should be emitted as plain text
22627 !! options
22628 parsoid=wt2html
22629 !! wikitext
22630 <ref>foo <ref>bar</ref> baz</ref>
22631
22632 <references />
22633 !! html/parsoid
22634 <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="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span> baz&lt;/ref></p>
22635
22636 <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="#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>
22637 !! end
22638
22639 !!test
22640 Ref: 15. ref-tags with identical names should get identical indexes
22641 !! wikitext
22642 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22643 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22644
22645 <references />
22646 !! html/parsoid
22647 <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="#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="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22648 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="#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="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22649
22650 <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="#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="#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="#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="#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>
22651 </ol>
22652 !!end
22653
22654 ## We don't bother wt2wt-ing non-standard whitespace
22655 !!test
22656 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22657 !!options
22658 parsoid=wt2html
22659 !! wikitext
22660 A <ref >foo</ref >
22661
22662 <references />
22663 !! html/parsoid
22664 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22665 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22666 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22667 !!end
22668
22669 !!test
22670 Ref: 17. Generate valid HTML5 id/about attributes
22671 !!wikitext
22672 <ref name="a b">foo</ref>
22673
22674 <references />
22675 !!html/parsoid
22676 <p><span 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="#cite_note-a_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22677 </p>
22678
22679 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22680 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="#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>
22681 </ol>
22682 !!end
22683
22684 !!test
22685 Ref: 18. T58916: Extension attributes should be parsed as plain text
22686 !!wikitext
22687 <ref name="{{echo|a}}">foo</ref>
22688
22689 <references />
22690 !!html/parsoid
22691 <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="#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
22692 </p>
22693
22694 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22695 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="#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>
22696 </ol>
22697 !!end
22698
22699 !!test
22700 Ref: 19. ref-tags with identical name encodings should get identical indexes
22701 !! wikitext
22702 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22703
22704 <references />
22705 !! html/parsoid
22706 <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="#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="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22707 </p>
22708 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22709 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="#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>
22710 </ol>
22711 !!end
22712
22713 !!test
22714 Ref: 20. ref-tags with identical names but different content should keep it
22715 !! wikitext
22716 A <ref name="foo">Foo one</ref>
22717 B <ref name="foo">Foo two</ref>
22718 C <ref name="foo" />
22719
22720 <references />
22721 !! html/parsoid
22722 <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="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22723 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="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22724 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="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22725
22726 <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="#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="#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>
22727 </ol>
22728 !!end
22729
22730 !!test
22731 References: 1. references tag without any refs should be handled properly
22732 !! wikitext
22733 <references />
22734 !! html/parsoid
22735 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22736 !!end
22737
22738 !!test
22739 References: 2. references tag with group only outputs references from that group
22740 !! wikitext
22741 A <ref group="a">foo</ref>
22742 B <ref group="b">bar</ref>
22743 C <ref>baz</ref>
22744
22745 <references group="a" />
22746 <references />
22747 <references group="b" />
22748 !! html/parsoid
22749 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22750 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="#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
22751 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="#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
22752
22753 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22754 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22755 </ol>
22756 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22757 <li about="#cite_note-3" id="cite_note-3"><a href="#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>
22758 </ol>
22759 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22760 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
22761 </ol>
22762 !!end
22763
22764 !!test
22765 References: 3. ref list should be cleared after processing references
22766 !! wikitext
22767 A <ref>foo</ref>
22768
22769 <references />
22770
22771 B <ref>bar</ref>
22772
22773 <references />
22774 !! html/parsoid
22775 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22776
22777 <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="#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>
22778 </ol>
22779
22780 <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="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
22781
22782 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22783 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
22784 </ol>
22785 !!end
22786
22787 !!test
22788 References: 4. only referenced group should be cleared after processing references
22789 !! wikitext
22790 A <ref group="a">afoo</ref>
22791 B <ref>bfoo</ref>
22792
22793 <references group="a" />
22794
22795 C <ref>cfoo</ref>
22796
22797 <references />
22798 !! html/parsoid
22799 <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="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22800 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="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
22801
22802 <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="#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>
22803 </ol>
22804
22805 <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="#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
22806
22807 <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="#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="#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>
22808 </ol>
22809 !!end
22810
22811 ## Don't expect this to rt since we're dropping content
22812 !! test
22813 References: 5. ref tags in references should be processed while ignoring all other content
22814 !! options
22815 parsoid=wt2html,html2html
22816 !! wikitext
22817 A <ref name="a" />
22818 B <ref name="b">bar</ref>
22819
22820 <references>
22821 <ref name="a">foo</ref>
22822 This should just get lost.
22823 </references>
22824 !! html/parsoid
22825 <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="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22826 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="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22827
22828
22829 <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=\"#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="#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="#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>
22830 </ol>
22831 !! end
22832
22833 !! test
22834 References: 6. <references /> from a transclusion
22835 !! wikitext
22836 <ref>Foo</ref> {{echo|<references />}}
22837 !! html/parsoid
22838 <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="#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="#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>
22839 </ol>
22840 !! end
22841
22842 !! test
22843 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22844 !! wikitext
22845 A <ref>foo bar for a</ref>
22846 B <ref group="X" name="b" />
22847
22848 <references />
22849
22850 <references group="X">
22851 <ref name="b">foo</ref>
22852 </references>
22853 !! html/parsoid
22854 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22855 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="#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
22856 </p>
22857
22858 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22859 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22860 </ol>
22861
22862 <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=\"#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"}}'>
22863 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="#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>
22864 </ol>
22865 !! end
22866
22867 !! test
22868 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22869 !! wikitext
22870 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22871 <references />
22872 !! html/parsoid
22873 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22874 <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="#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>
22875 </ol>
22876 !!end
22877
22878 # This test only works in wt2html now as the <references /> are always generated
22879 # unless selser is active. Once T72722 is fixed, we should add a changes test
22880 # here to ensure that unrelated changes don't add the new <references />
22881 # when selser is active.
22882 !! test
22883 References: 9. Generate missing references list at the end
22884 !! wikitext
22885 A <ref>foo</ref>
22886 B <ref group="inexistent">bar</ref>
22887 !! html/parsoid
22888 <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="#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="#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
22889 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22890 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
22891 </ol>
22892 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22893 <li about="#cite_note-2" id="cite_note-2"><a href="#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>
22894 </ol>
22895 !! end
22896
22897 !! test
22898 References: 10. New <references/> shouldn't be added for unrelated edits.
22899 !! options
22900 parsoid={
22901 "modes": ["selser"],
22902 "changes": [["#x", "remove"]],
22903 "selser": "noauto"
22904 }
22905 !! wikitext
22906 Unrelated text<span id="x"> that's going to disappear</span>.
22907 A <ref>foo</ref>
22908 !! wikitext/edited
22909 Unrelated text.
22910 A <ref>foo</ref>
22911 !!end
22912
22913 !! test
22914 Entities in ref name
22915 !! wikitext
22916 <ref name="test &amp; me">hi</ref>
22917 <references />
22918 !! html/parsoid
22919 <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="#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22920 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22921 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="#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>
22922 </ol>
22923 !! end
22924
22925 ## The output here may look funny, but it's what the php parser will do. The
22926 ## unclosed references tag becomes escaped text, and then a new references
22927 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22928 ## nowiki tags, and the auto-generated references tag is only dropped in
22929 ## rtTestMode.
22930 !! test
22931 Generate references for unclosed references tag
22932 !! options
22933 parsoid=wt2html
22934 !! wikitext
22935 a<ref>foo</ref>
22936
22937 <references>
22938 !! html/parsoid
22939 <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="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
22940
22941 <p>&lt;references></p>
22942 <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="#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>
22943 !! end
22944
22945 !! test
22946 New reference serializes on its own line
22947 !! options
22948 parsoid=wt2wt,html2wt
22949 !! wikitext
22950 foo
22951 <references />
22952 !! html/parsoid
22953 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22954 !! end
22955
22956 #--------- Test stripping of empty nodes in template content ----------
22957 !!test
22958 Empty LI and TR nodes should be stripped from template content
22959 !!wikitext
22960 {{EmptyLITest}}
22961 {{EmptyTRTest}}
22962 !!html/parsoid
22963 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22964 <li>a</li>
22965 <li>b</li>
22966 </ul>
22967 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22968 <tbody>
22969 <tr>
22970 <td>foo</td>
22971 </tr>
22972 <tr>
22973 <td>bar</td>
22974 </tr>
22975 </tbody>
22976 </table>
22977 !!end
22978
22979 !!test
22980 Empty LI and TR nodes should not be stripped from top-level content
22981 !!wikitext
22982 * a
22983 *
22984 * b
22985 {|
22986 |-
22987 |-
22988 |foo
22989 |}
22990 !!html/parsoid
22991 <ul>
22992 <li> a</li>
22993 <li></li>
22994 <li> b</li>
22995 </ul>
22996 <table>
22997 <tbody>
22998 <tr></tr>
22999 <tr>
23000 <td>foo</td>
23001 </tr>
23002 </tbody>
23003 </table>
23004 !!end
23005
23006 !!test
23007 Empty TR nodes should not be stripped if they have any attributes set
23008 !!wikitext
23009 {{EmptyTRWithHTMLAttrTest}}
23010 !!html/parsoid
23011 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23012 <tr align="center"></tr>
23013 <tr><td>foo</td></tr>
23014 <tr align="center"></tr>
23015 <tr><td>bar</td></tr>
23016 </table>
23017 !!end
23018
23019 #### ----------------------------------------------------------------
23020 #### The following section of tests are primarily to test
23021 #### wikitext escaping capabilities of Parsoid. Given that
23022 #### escaping can be done any number of ways, the wikitext (input)
23023 #### is always adjusted to reflect how Parsoid adds nowiki
23024 #### escape tags.
23025 ####
23026 #### We are marking several tests as parsoid-only since the
23027 #### HTML in the result section is different from what the
23028 #### PHP parser generates for it.
23029 #### ----------------------------------------------------------------
23030
23031
23032 #### --------------- Headings ---------------
23033 #### 0. Unnested
23034 #### 1. Nested inside html <h1>=foo=</h1>
23035 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23036 #### 3. Nested inside html with wikitext split by html tags
23037 #### 4. No escape needed
23038 #### 5. Empty headings <h1></h1>
23039 #### 6. Heading chars in SOL context
23040 #### ----------------------------------------
23041 !! test
23042 Headings: 0. Unnested
23043 !! options
23044 parsoid=html2wt
23045 !! html/parsoid
23046 <p>=foo=</p>
23047
23048 <p> =foo=
23049 <!--cmt-->
23050 =foo=</p>
23051
23052 <p>=foo<i>a</i>=</p>
23053 !! wikitext
23054 <nowiki>=foo=</nowiki>
23055
23056 <nowiki> </nowiki>=foo=
23057 <!--cmt-->
23058 <nowiki>=foo=</nowiki>
23059
23060 =foo''a''<nowiki>=</nowiki>
23061 !!end
23062
23063 # New headings and existing headings are handled differently
23064 !! test
23065 Headings: 1. Nested inside html
23066 !! options
23067 parsoid=html2wt
23068 !! html/parsoid
23069 <h1>=foo=</h1>
23070 <h2>=foo=</h2>
23071 <h3>=foo=</h3>
23072
23073 <h1 data-parsoid=''>=foo=</h1>
23074 <h2 data-parsoid=''>=foo=</h2>
23075 <h3 data-parsoid=''>=foo=</h3>
23076 <h4 data-parsoid=''>=foo=</h4>
23077 <h5 data-parsoid=''>=foo=</h5>
23078 <h6 data-parsoid=''>=foo=</h6>
23079 !! wikitext
23080 = =foo= =
23081
23082 == =foo= ==
23083
23084 === =foo= ===
23085
23086 =<nowiki>=foo=</nowiki>=
23087 ==<nowiki>=foo=</nowiki>==
23088 ===<nowiki>=foo=</nowiki>===
23089 ====<nowiki>=foo=</nowiki>====
23090 =====<nowiki>=foo=</nowiki>=====
23091 ======<nowiki>=foo=</nowiki>======
23092
23093 !!end
23094
23095 !! test
23096 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23097 !! options
23098 parsoid=html2wt
23099 !! html/parsoid
23100 <h1>foo</h1>*bar
23101 <h1>foo</h1>=bar
23102 <h1>foo</h1>=bar=
23103 !! wikitext
23104 = foo =
23105 <nowiki>*</nowiki>bar
23106
23107 = foo =
23108 =bar
23109
23110 = foo =
23111 <nowiki>=bar=</nowiki>
23112 !!end
23113
23114 !! test
23115 Headings: 3. Nested inside html with wikitext split by html tags
23116 !! options
23117 parsoid=html2wt
23118 !! html/parsoid
23119 <h1>=<b>bold</b>foo=</h1>
23120 !! wikitext
23121 = ='''bold'''foo= =
23122 !!end
23123
23124 !! test
23125 Headings: 4a. No escaping needed (testing just h1 and h2)
23126 !! options
23127 parsoid=html2wt
23128 !! html/parsoid
23129 <h1>=foo</h1>
23130 <h1>foo=</h1>
23131 <h1> =foo= </h1>
23132 <h1>=foo= bar</h1>
23133 <h2>=foo</h2>
23134 <h2>foo=</h2>
23135 <h1>=</h1>
23136 <h1><i>=</i>foo=</h1>
23137 !! wikitext
23138 = =foo =
23139
23140 = foo= =
23141
23142 = =foo= =
23143
23144 = =foo= bar =
23145
23146 == =foo ==
23147
23148 == foo= ==
23149
23150 = = =
23151
23152 = ''=''foo= =
23153 !!end
23154
23155 !! test
23156 Headings: 4b. No escaping needed (inside p-tags)
23157 !! options
23158 parsoid=html2wt
23159 !! html/parsoid
23160 <p>===
23161 =foo= x
23162 =foo= <s></s>
23163 </p>
23164 !! wikitext
23165 ===
23166 =foo= x
23167 =foo= <s></s>
23168 !!end
23169
23170 !! test
23171 Headings: 5. Empty headings
23172 !! options
23173 parsoid=html2wt
23174 !! html/parsoid
23175 <h1 data-parsoid='{}'></h1>
23176
23177 <h2 data-parsoid='{}'></h2>
23178
23179 <h3 data-parsoid='{}'></h3>
23180
23181 <h4 data-parsoid='{}'></h4>
23182
23183 <h5 data-parsoid='{}'></h5>
23184
23185 <h6 data-parsoid='{}'></h6>
23186 !! wikitext
23187 =<nowiki/>=
23188
23189 ==<nowiki/>==
23190
23191 ===<nowiki/>===
23192
23193 ====<nowiki/>====
23194
23195 =====<nowiki/>=====
23196
23197 ======<nowiki/>======
23198 !!end
23199
23200 !! test
23201 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23202 !! options
23203 parsoid=html2wt
23204 !! html/parsoid
23205 <p>=a=</p>
23206
23207 <p>=a=</p>
23208
23209 <p>=a=</p>
23210 !! wikitext
23211 <nowiki>=a=</nowiki>
23212
23213 <nowiki>=a=</nowiki>
23214
23215 <nowiki>=a=</nowiki>
23216 !!end
23217
23218 !! test
23219 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23220 !! options
23221 parsoid=html2wt
23222 !! html/parsoid
23223 <p>=a=
23224 b</p>
23225
23226 <p>=a=
23227 b</p>
23228
23229 <p>=a=
23230 b</p>
23231 !! wikitext
23232 <nowiki>=a=</nowiki>
23233 b
23234
23235 <nowiki>=a=</nowiki>
23236 b
23237
23238 <nowiki>=a=</nowiki>
23239 b
23240 !!end
23241
23242 !! test
23243 Headings: 6c. Heading chars in SOL context (leading newline break)
23244 !! options
23245 parsoid=html2wt
23246 !! html/parsoid
23247 <p>a
23248 =b=</p>
23249 !! wikitext
23250 a
23251 <nowiki>=b=</nowiki>
23252 !!end
23253
23254 !! test
23255 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23256 !! options
23257 parsoid=html2wt
23258 !! html/parsoid
23259 <!--c0--><p>=a=</p>
23260
23261 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23262 !! wikitext
23263 <!--c0--><nowiki>=a=</nowiki>
23264
23265 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23266 !!end
23267
23268 !! test
23269 Headings: 6d. Heading chars in SOL context (No escaping needed)
23270 !! options
23271 parsoid=html2wt
23272 !! html/parsoid
23273 =a=<div>b</div>
23274 !! wikitext
23275 =a=<div>b</div>
23276 !!end
23277
23278 !! test
23279 Headings: 7. Insert a newline between new content and headings
23280 !! options
23281 parsoid=html2wt
23282 !! html/parsoid
23283 <h2>NEW</h2>
23284 <p>new</p>
23285 <h2 data-parsoid='{}'>A</h2>
23286 <p data-parsoid='{}'>a</p>
23287 !! wikitext
23288 == NEW ==
23289 new
23290
23291 ==A==
23292 a
23293
23294 !! end
23295
23296 #### --------------- Lists ---------------
23297 #### 0. Outside nests (*foo, etc.)
23298 #### 1. Nested inside html <ul><li>*foo</li></ul>
23299 #### 2. Inside definition lists
23300 #### 3. Only bullets at start should be escaped
23301 #### 4. No escapes needed
23302 #### 5. No unnecessary escapes
23303 #### 6. Escape bullets in SOL position
23304 #### 7. Escape bullets in a multi-line context
23305 #### ----------------------------------------
23306
23307 !! test
23308 Lists: 0. Outside nests
23309 !! options
23310 parsoid=html2wt
23311 !! html/parsoid
23312 <p>*foo</p>
23313
23314 <p>#foo</p>
23315
23316 <p>;Foo:bar</p>
23317 !! wikitext
23318 <nowiki>*</nowiki>foo
23319
23320 <nowiki>#</nowiki>foo
23321
23322 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23323 !!end
23324
23325 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23326 ## to test wikitext escaping, and insignificant whitespace diffs
23327 ## cause PHP parser tests to barf
23328 !! test
23329 Lists: 1. Nested inside html (No unnecessary escapes)
23330 !! options
23331 parsoid=html2wt
23332 !! html/parsoid
23333 <ul>
23334 <li>*foo</li>
23335 <li>#foo</li>
23336 <li>:foo</li>
23337 <li>;foo</li>
23338 <li data-parsoid='{}'>*foo</li>
23339 <li data-parsoid='{}'>#foo</li>
23340 <li data-parsoid='{}'>:foo</li>
23341 <li data-parsoid='{}'>;foo</li>
23342 </ul>
23343
23344 <ol>
23345 <li>*foo</li>
23346 <li>#foo</li>
23347 <li>:foo</li>
23348 <li>;foo</li>
23349 <li data-parsoid='{}'>*foo</li>
23350 <li data-parsoid='{}'>#foo</li>
23351 <li data-parsoid='{}'>:foo</li>
23352 <li data-parsoid='{}'>;foo</li>
23353 </ol>
23354 !! wikitext
23355 * *foo
23356 * #foo
23357 * :foo
23358 * ;foo
23359 *<nowiki>*foo</nowiki>
23360 *<nowiki>#foo</nowiki>
23361 *<nowiki>:foo</nowiki>
23362 *<nowiki>;foo</nowiki>
23363
23364 # *foo
23365 # #foo
23366 # :foo
23367 # ;foo
23368 #<nowiki>*foo</nowiki>
23369 #<nowiki>#foo</nowiki>
23370 #<nowiki>:foo</nowiki>
23371 #<nowiki>;foo</nowiki>
23372 !!end
23373
23374 !! test
23375 Lists: 2. Inside definition lists
23376 !! options
23377 parsoid=html2wt
23378 !! html/parsoid
23379 <dl><dt>;foo</dt></dl>
23380 <dl><dt>:foo</dt></dl>
23381 <dl><dt>:foo</dt>
23382 <dd>bar</dd></dl>
23383 <dl><dd>:foo</dd></dl>
23384 !! wikitext
23385 ; ;foo
23386
23387 ; <nowiki>:foo</nowiki>
23388
23389 ; <nowiki>:foo</nowiki>
23390 : bar
23391
23392 : :foo
23393 !!end
23394
23395 !! test
23396 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23397 !! options
23398 parsoid=html2wt
23399 !! html/parsoid
23400 <ul>
23401 <li>*foo*bar</li>
23402 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23403 </ul>
23404 !! wikitext
23405 * *foo*bar
23406 *<nowiki>*foo</nowiki>''it''*bar
23407 !!end
23408
23409 !! test
23410 Lists: 4. No escapes needed
23411 !! options
23412 parsoid=html2wt
23413 !! html/parsoid
23414 <ul>
23415 <li>foo*bar
23416 </li>
23417 </ul>
23418 <ul>
23419 <li><i>foo</i>*bar
23420 </li>
23421 </ul>
23422 <ul>
23423 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23424 </li>
23425 </ul>
23426 <ul>
23427 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23428 </li>
23429 </ul>
23430 !! wikitext
23431 *foo*bar
23432
23433 *''foo''*bar
23434
23435 *[[Foo]]: bar
23436
23437 *[[Foo]]*bar
23438 !!end
23439
23440 !! test
23441 Lists: 5. No unnecessary escapes
23442 !! options
23443 parsoid=html2wt
23444 !! html/parsoid
23445 <ul><li> bar <span>[[foo]]</span></li></ul>
23446 <ul><li> =bar <span>[[foo]]</span></li></ul>
23447 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23448 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23449 <ul><li> =bar <span>foo]]</span>=</li></ul>
23450 <ul><li> <s></s>: a</li></ul>
23451 <ul><li> <i>* foo</i></li></ul>
23452
23453 !! wikitext
23454 * bar <span><nowiki>[[foo]]</nowiki></span>
23455
23456 * =bar <span><nowiki>[[foo]]</nowiki></span>
23457
23458 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23459
23460 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23461
23462 * =bar <span>foo]]</span>=
23463
23464 * <s></s>: a
23465
23466 * ''* foo''
23467 !!end
23468
23469 !! test
23470 Lists: 6. Escape bullets in SOL position
23471 !! options
23472 parsoid=html2wt
23473 !! html/parsoid
23474 <p><!--cmt-->*foo</p>
23475 !! wikitext
23476 <!--cmt--><nowiki>*</nowiki>foo
23477 !!end
23478
23479 !! test
23480 Lists: 7. Escape bullets in a multi-line context
23481 !! options
23482 parsoid=html2wt
23483 !! html/parsoid
23484 <p>a
23485 *b
23486 </p>
23487 !! wikitext
23488 a
23489 <nowiki>*</nowiki>b
23490 !!end
23491
23492 !! test
23493 Lists: 8. Escape colons only if not present in tags
23494 !! options
23495 parsoid=html2wt
23496 !! html/parsoid
23497 <dl><dt>a:b<i>c:d</i></dt></dl>
23498 !! wikitext
23499 ; <nowiki>a:b</nowiki>''c:d''
23500 !! end
23501
23502 #### --------------- HRs ---------------
23503 #### 1. Single line
23504 #### -----------------------------------
23505
23506 !! test
23507 HRs: 1. Single line
23508 !! options
23509 parsoid=html2wt
23510 !! html/parsoid
23511 <hr />----
23512 <hr />=foo=
23513 <hr />*foo
23514 !! wikitext
23515 ----<nowiki>----</nowiki>
23516 ----=foo=
23517 ----*foo
23518 !! end
23519
23520 #### --------------- Tables ---------------
23521 #### 1a. Simple example
23522 #### 1b. No escaping needed (!foo)
23523 #### 1c. No escaping needed (|foo)
23524 #### 1d. No escaping needed (|}foo)
23525 ####
23526 #### 2a. Nested in td (<td>foo|bar</td>)
23527 #### 2b. Nested in td (<td>foo||bar</td>)
23528 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23529 ####
23530 #### 3a. Nested in th (<th>foo!bar</th>)
23531 #### 3b. Nested in th (<th>foo!!bar</th>)
23532 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23533 ####
23534 #### 4a. Escape -
23535 #### 4b. Escape +
23536 #### 4c. No escaping needed
23537 #### --------------------------------------
23538
23539 !! test
23540 Tables: 1a. Simple example
23541 !! options
23542 parsoid=html2wt
23543 !! html/parsoid
23544 <p>{|
23545 |}
23546 </p>
23547 !! wikitext
23548 <nowiki>{|</nowiki>
23549 |}
23550 !! end
23551
23552 !! test
23553 Tables: 1b. No escaping needed
23554 !! options
23555 parsoid=html2wt
23556 !! html/parsoid
23557 <p>!foo
23558 </p>
23559 !! wikitext
23560 !foo
23561 !! end
23562
23563 !! test
23564 Tables: 1c. No escaping needed
23565 !! options
23566 parsoid=html2wt
23567 !! html/parsoid
23568 <p>|foo
23569 </p>
23570 !! wikitext
23571 |foo
23572 !! end
23573
23574 !! test
23575 Tables: 1d. No escaping needed
23576 !! options
23577 parsoid=html2wt
23578 !! html/parsoid
23579 <p>|}foo
23580 </p>
23581 !! wikitext
23582 |}foo
23583 !! end
23584
23585 !! test
23586 Tables: 2a. Nested in td
23587 !! options
23588 parsoid=html2wt
23589 !! html/parsoid
23590 <table><tbody><tr>
23591 <td>foo|bar</td></tr>
23592 <tr><td>x<div>a|b</div></td>
23593 </tbody></table>
23594 !! wikitext
23595 {|
23596 |<nowiki>foo|bar</nowiki>
23597 |-
23598 |x<div><nowiki>a|b</nowiki></div>
23599 |}
23600 !! html/php+tidy
23601 <table>
23602 <tr>
23603 <td>foo|bar</td>
23604 </tr>
23605 <tr>
23606 <td>x
23607 <div>a|b</div>
23608 </td>
23609 </tr>
23610 </table>
23611 !! end
23612
23613 !! test
23614 Tables: 2b. Nested in td
23615 !! options
23616 parsoid=html2wt
23617 !! html/parsoid
23618 <table><tbody><tr>
23619 <td>foo||bar</td>
23620 <td>a<i>b||c</i></td>
23621 <td>a<i><div>b||c</div></i></td>
23622 </tr></tbody></table>
23623 !! wikitext
23624 {|
23625 |<nowiki>foo||bar</nowiki>
23626 |a''<nowiki>b||c</nowiki>''
23627 |a''<div><nowiki>b||c</nowiki></div>''
23628 |}
23629 !! html/php
23630 <table>
23631 <tr>
23632 <td>foo||bar
23633 </td>
23634 <td>a<i>b||c</i>
23635 </td>
23636 <td>a<i><div>b||c</div></i>
23637 </td></tr></table>
23638
23639 !! end
23640
23641 !! test
23642 Tables: 2c. Nested in td -- no escaping needed
23643 !! options
23644 parsoid=html2wt
23645 !! html/*
23646 <table>
23647 <tr>
23648 <td>foo!!bar
23649 </td></tr></table>
23650
23651 !! wikitext
23652 {|
23653 |foo!!bar
23654 |}
23655 !! end
23656
23657 !! test
23658 Tables: 3a. Nested in th
23659 !! options
23660 parsoid=html2wt
23661 !! html/*
23662 <table>
23663 <tr>
23664 <th>foo!bar
23665 </th></tr></table>
23666
23667 !! wikitext
23668 {|
23669 !foo!bar
23670 |}
23671 !! end
23672
23673 !! test
23674 Tables: 3b. Nested in th
23675 !! options
23676 parsoid=html2wt
23677 !! html/parsoid
23678 <table><tbody>
23679 <tr><th>foo!!bar</th>
23680 <th><i>foo|bar</i></th>
23681 <th><i>foo!!bar</i></th>
23682 <th><i><span>foo!!bar</span></i></th>
23683 </tr></tbody></table>
23684 !! wikitext
23685 {|
23686 !<nowiki>foo!!bar</nowiki>
23687 !''<nowiki>foo|bar</nowiki>''
23688 !''<nowiki>foo!!bar</nowiki>''
23689 !''<span><nowiki>foo!!bar</nowiki></span>''
23690 |}
23691 !! html/php
23692 <table>
23693 <tr>
23694 <th>foo!!bar
23695 </th>
23696 <th><i>foo|bar</i>
23697 </th>
23698 <th><i>foo!!bar</i>
23699 </th>
23700 <th><i><span>foo!!bar</span></i>
23701 </th></tr></table>
23702
23703 !! end
23704
23705 !! test
23706 Tables: 3c. Nested in th
23707 !! options
23708 parsoid=html2wt
23709 !! html/parsoid
23710 <table><tbody>
23711 <tr><th>foo||bar</th>
23712 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23713 </tr></tbody></table>
23714 !! wikitext
23715 {|
23716 !<nowiki>foo||bar</nowiki>
23717 !<nowiki>foo||bar</nowiki>
23718 |}
23719 !! html/php
23720 <table>
23721 <tr>
23722 <th>foo||bar
23723 </th>
23724 <th>foo||bar
23725 </th></tr></table>
23726
23727 !! end
23728
23729 !! test
23730 Tables: 4a. Escape -
23731 !! options
23732 parsoid=html2wt
23733 !! html/*
23734 <table>
23735 <tr>
23736 <th>-bar
23737 </th></tr>
23738 <tr>
23739 <td>-bar
23740 </td></tr></table>
23741
23742 !! wikitext
23743 {|
23744 !-bar
23745 |-
23746 |<nowiki>-bar</nowiki>
23747 |}
23748 !! end
23749
23750 !! test
23751 Tables: 4b. Escape +
23752 !! options
23753 parsoid=html2wt
23754 !! html/*
23755 <table>
23756 <tr>
23757 <th>+bar
23758 </th></tr>
23759 <tr>
23760 <td>+bar
23761 </td></tr></table>
23762
23763 !! wikitext
23764 {|
23765 !+bar
23766 |-
23767 |<nowiki>+bar</nowiki>
23768 |}
23769 !! end
23770
23771 !! test
23772 Tables: 4c. No escaping needed
23773 !! options
23774 parsoid=html2wt
23775 !! html/parsoid
23776 <table><tbody>
23777 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23778 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23779 <tr><td>foo
23780 <p>bar|baz
23781 +bar
23782 -bar</p></td></tr>
23783 <tr><td>x
23784 <div>a|b</div></td>
23785 </tbody></table>
23786 !! wikitext
23787 {|
23788 |foo-bar
23789 |foo+bar
23790 |-
23791 |''foo''-bar
23792 |''foo''+bar
23793 |-
23794 |foo
23795 bar|baz
23796 +bar
23797 -bar
23798 |-
23799 |x
23800 <div>a|b</div>
23801 |}
23802 !! html/php
23803 <table>
23804 <tr>
23805 <td>foo-bar
23806 </td>
23807 <td>foo+bar
23808 </td></tr>
23809 <tr>
23810 <td><i>foo</i>-bar
23811 </td>
23812 <td><i>foo</i>+bar
23813 </td></tr>
23814 <tr>
23815 <td>foo
23816 <p>bar|baz
23817 +bar
23818 -bar
23819 </p>
23820 </td></tr>
23821 <tr>
23822 <td>x
23823 <div>a|b</div>
23824 </td></tr></table>
23825
23826 !! end
23827
23828 !! test
23829 Tables: 4d. No escaping needed
23830 !! options
23831 parsoid=html2wt
23832 !! html/parsoid
23833 <table>
23834 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23835 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23836 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23837 </tbody></table>
23838 !! wikitext
23839 {|
23840 |[[Foo]]-bar
23841 ||+1
23842 ||-2
23843 |}
23844 !! html/php
23845 <table>
23846 <tr>
23847 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23848 </td>
23849 <td>+1
23850 </td>
23851 <td>-2
23852 </td></tr></table>
23853
23854 !! end
23855
23856 !! test
23857 T97430: Don't emit empty nowiki pairs around marker meta tags
23858 !! options
23859 parsoid=html2wt
23860 !! html/parsoid
23861 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23862 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23863 !! wikitext
23864 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23865 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23866 !! end
23867
23868 !! test
23869 Unclosed xmlish element in table line shouldn't eat end delimiters
23870 !! options
23871 parsoid=html2wt
23872 !! html/parsoid
23873 <table>
23874 <tbody><tr><td> &lt;foo</td>
23875 <td> bar></td></tr>
23876 </tbody></table>
23877 !! wikitext
23878 {|
23879 | <foo
23880 | bar>
23881 |}
23882 !! html/php
23883 <table>
23884 <tr>
23885 <td> &lt;foo
23886 </td>
23887 <td> bar&gt;
23888 </td></tr></table>
23889
23890 !! end
23891
23892 #### --------------- Links ----------------
23893 #### 1. Quote marks in link text
23894 #### 2. Wikilinks: Escapes needed
23895 #### 3. Wikilinks: No escapes needed
23896 #### 4. Extlinks: Escapes needed
23897 #### 5. Extlinks: No escapes needed
23898 #### --------------------------------------
23899 !! test
23900 Links 1. WikiLinks: No escapes needed
23901 !! options
23902 parsoid=html2wt
23903 !! html/parsoid
23904 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23905 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23906 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23907 !! wikitext
23908 [[Foo|Foo''boo'']]
23909 [[Foo|[Foobar]]]
23910 [[Foo|x [Foobar] x]]
23911 !! html/php
23912 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23913 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23914 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23915 </p>
23916 !! end
23917
23918 !! test
23919 Links 2. WikiLinks: Escapes needed
23920 !! options
23921 parsoid=html2wt
23922 !! html/parsoid
23923 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23924 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23925 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23926 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23927 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23928 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23929 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23930 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23931 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23932 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23933 !! wikitext
23934 [[Foo|<nowiki>Foobar]</nowiki>]]
23935 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23936 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23937 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23938 [[Foo|<nowiki>|Bar</nowiki>]]
23939 [[Foo|<nowiki>]]bar</nowiki>]]
23940 [[Foo|<nowiki>[[bar</nowiki>]]
23941 [[Foo|<nowiki>x [[ y</nowiki>]]
23942 [[Foo|<nowiki>x ]] y</nowiki>]]
23943 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23944 !! html/php
23945 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23946 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23947 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23948 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23949 <a href="/wiki/Foo" title="Foo">|Bar</a>
23950 <a href="/wiki/Foo" title="Foo">]]bar</a>
23951 <a href="/wiki/Foo" title="Foo">[[bar</a>
23952 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23953 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23954 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23955 </p>
23956 !! end
23957
23958 !! test
23959 Links 3. WikiLinks: No escapes needed
23960 !! options
23961 parsoid=html2wt
23962 !! html/parsoid
23963 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23964 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23965 !! wikitext
23966 [[Foo|[Foobar]]
23967 [[Foo|foo|bar]]
23968 !! html/php
23969 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23970 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23971 </p>
23972 !! end
23973
23974 !! test
23975 Links 4. ExtLinks: Escapes needed
23976 !! options
23977 parsoid=html2wt
23978 !! html/parsoid
23979 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23980 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23981 <p>[http://google.com]</p>
23982 <p>[http://google.com google]</p>
23983 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23984 <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>
23985 !! wikitext
23986 [http://google.com <nowiki>[google]</nowiki>]
23987 [http://google.com <nowiki>google]</nowiki>]
23988
23989 <nowiki>[http://google.com]</nowiki>
23990
23991 <nowiki>[http://google.com google]</nowiki>
23992
23993 [http://google.com<nowiki>]</nowiki>
23994
23995 [{{echo|http://google.com}}<nowiki>]</nowiki>
23996 !! html/php
23997 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23998 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23999 </p><p>[http://google.com]
24000 </p><p>[http://google.com google]
24001 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24002 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24003 </p>
24004 !! end
24005
24006 !! test
24007 Links 5. ExtLinks: No escapes needed
24008 !! options
24009 parsoid=html2wt
24010 !! html/parsoid
24011 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24012 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24013 !! wikitext
24014 [http://google.com [google]
24015
24016 [[http://google.com]]
24017 !! html/php
24018 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24019 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24020 </p>
24021 !! end
24022
24023 !! test
24024 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24025 !! options
24026 parsoid=html2wt
24027 !! html/parsoid
24028 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24029 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24030 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24031 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24032 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24033 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24034 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24035 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24036 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24037 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24038 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24039 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24040 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24041 </p>
24042 !! wikitext
24043 x<nowiki/>http://example.com<nowiki/>y
24044 http://example.com<nowiki/>?x
24045 http://example.com<nowiki/>&x
24046 http://example.com<nowiki/>'x
24047 http://example.com<nowiki/>,x
24048 http://example.com<nowiki/>.x
24049 http://example.com<nowiki/>;x
24050 http://example.com<nowiki/>:x
24051 http://example.com<nowiki/>;x
24052 http://example.com<nowiki/>!x
24053 http://example.com<nowiki/>=x
24054 http://example.com<nowiki/>(x)
24055 http://example.com(x<nowiki/>)
24056 !! end
24057
24058 !! test
24059 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24060 !! options
24061 parsoid=html2wt
24062 !! html/parsoid
24063 <p>x
24064 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24065 y
24066 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24067 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24068 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24069 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24070 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24071 </p>
24072 !! wikitext
24073 x
24074 http://example.com
24075 y
24076 "http://example.com"
24077 (http://example.com)
24078 (http://example.com) foo
24079 http://example.com,
24080 http://example.com, foo
24081 !! html/php
24082 <p>x
24083 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24084 y
24085 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24086 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24087 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24088 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24089 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24090 </p>
24091 !! end
24092
24093 !! test
24094 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24095 !! options
24096 parsoid=html2wt
24097 !! html/parsoid
24098 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24099 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24100 !! wikitext
24101 http://example.com.,;:!?\
24102 -http://example.com:
24103 !! html/php
24104 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24105 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24106 </p>
24107 !! end
24108
24109 !! test
24110 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24111 !! options
24112 parsoid=html2wt
24113 !! html/parsoid
24114 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24115 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24116 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24117 !! wikitext
24118 RFC 123<nowiki/>4
24119 RFC 123<nowiki/>y
24120 X<nowiki/>RFC 123<nowiki/>y
24121 !! end
24122
24123 !! test
24124 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24125 !! options
24126 parsoid=html2wt
24127 !! html/parsoid
24128 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24129 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24130 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24131 </p>
24132 !! wikitext
24133 RFC 123?foo
24134 RFC 123&foo
24135 -RFC 123-
24136 !! html/php
24137 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24138 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24139 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24140 </p>
24141 !! end
24142
24143 !! test
24144 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24145 !! options
24146 parsoid=html2wt
24147 !! html/parsoid
24148 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24149 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24150 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24151 !! wikitext
24152 PMID 123<nowiki/>4
24153 PMID 123<nowiki/>y
24154 X<nowiki/>PMID 123<nowiki/>y
24155 !! end
24156
24157 !! test
24158 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24159 !! options
24160 parsoid=html2wt
24161 !! html/parsoid
24162 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24163 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24164 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24165 </p>
24166 !! wikitext
24167 PMID 123?foo
24168 PMID 123&foo
24169 -PMID 123-
24170 !! html/php
24171 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24172 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24173 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24174 </p>
24175 !! end
24176
24177 !! test
24178 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24179 !! options
24180 parsoid=html2wt
24181 !! html/parsoid
24182 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24183 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24184 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24185 </p>
24186 !! wikitext
24187 ISBN 1234567890<nowiki/>1
24188 ISBN 1234567890<nowiki/>x
24189 a<nowiki/>ISBN 1234567890<nowiki/>b
24190 !! end
24191
24192 !! test
24193 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24194 !! options
24195 parsoid=html2wt
24196 !! html/parsoid
24197 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24198 !! wikitext
24199 -ISBN 1234567890's
24200 !! html/php
24201 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24202 </p>
24203 !! end
24204
24205 !! test
24206 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24207 !! options
24208 parsoid=html2wt
24209 !! html/*
24210 <p>this is not a link: http://example.com
24211 </p>
24212 !! wikitext
24213 this is not a link: <nowiki>http://example.com</nowiki>
24214 !! end
24215
24216 !! test
24217 Links 15. Link trails can't become link prefixes.
24218 !! options
24219 language=is
24220 parsoid=html2wt
24221 !! html/parsoid
24222 <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>
24223 !! wikitext
24224 [[Söfnuður]]-[[00]]
24225 !! html/php
24226 <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>
24227 </p>
24228 !! end
24229
24230 #### --------------- Quotes ---------------
24231 #### 1. Quotes inside <b> and <i>
24232 #### 2. Link fragments separated by <i> and <b> tags
24233 #### 3. Link fragments inside <i> and <b>
24234 #### 4. No escaping needed
24235 #### --------------------------------------
24236 !! test
24237 1a. Quotes inside <b> and <i>
24238 !! options
24239 parsoid=html2wt
24240 !! html/*
24241 <p><i>'foo'</i>
24242 <i>''foo''</i>
24243 <i>'''foo'''</i>
24244 <i>foo</i>'s
24245 <b>'foo'</b>
24246 <b>''foo''</b>
24247 <b>'''foo'''</b>
24248 <b>foo'<i>bar'</i>baz</b>
24249 <b>foo</b>'s
24250 '<i>foo</i>
24251 <i>foo</i>'
24252 <i>foo'</i>'
24253 '<i>foo</i>'
24254 '<b>foo</b>
24255 <b>foo</b>'
24256 '<b>foo</b>'
24257 <i>fools'<span> errand</span></i>
24258 <i><span>fool</span>'s errand</i>
24259 '<i>foo</i> bar '<i>baz</i>
24260 a|!*#-:;+-~[]{}b'<i>x</i>
24261 </p>
24262 !! wikitext
24263 ''<nowiki/>'foo'''
24264 ''<nowiki>''foo''</nowiki>''
24265 ''<nowiki>'''foo'''</nowiki>''
24266 ''foo''<nowiki/>'s
24267 '''<nowiki/>'foo''''
24268 '''<nowiki>''foo''</nowiki>'''
24269 '''<nowiki>'''foo'''</nowiki>'''
24270 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24271 '''foo'''<nowiki/>'s
24272 '''foo''
24273 ''foo''<nowiki/>'
24274 ''foo'''<nowiki/>'
24275 '''foo''<nowiki/>'
24276 ''''foo'''
24277 '''foo'''<nowiki/>'
24278 ''''foo'''<nowiki/>'
24279 ''fools'<span> errand</span>''
24280 ''<span>fool</span>'s errand''
24281 '<nowiki/>''foo'' bar '''baz''
24282 a|!*#-:;+-~[]{}b'''x''
24283 !! end
24284
24285 !! test
24286 1b. Quotes inside <b> and <i> with other tags on same line
24287 !! options
24288 parsoid=html2wt
24289 !! html/parsoid
24290 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24291 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24292 <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>
24293 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24294 '<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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
24295 '<i>foo</i> <div title="name">test</div>
24296 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24297 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24298 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
24299 </ol>
24300 !! wikitext
24301 '''a'' foo ''[[bar]]''
24302 ''a''' foo ''[[bar]]''
24303 ''a''' foo '''{{echo|[[bar]]}}'''
24304 [[foo]] x'''[[bar]]''
24305 '''foo'' <ref>test</ref>
24306 '''foo'' <div title="name">test</div>
24307 '''foo'' and <br> bar
24308 <references />
24309 !! end
24310
24311 !! test
24312 2. Link fragments separated by <i> and <b> tags
24313 !! options
24314 parsoid=html2wt
24315 !! html/parsoid
24316 <p>[[<i>foo</i>hello]]</p>
24317 <p>[[<b>foo</b>hello]]</p>
24318 !! wikitext
24319 [[''foo''<nowiki>hello]]</nowiki>
24320
24321 [['''foo'''<nowiki>hello]]</nowiki>
24322 !! end
24323
24324 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24325 # this is one of the shortcomings of this format
24326 !! test
24327 3. Link fragments inside <i> and <b>
24328 !! options
24329 parsoid=html2wt
24330 !! html/parsoid
24331 <p><i>[[foo</i>]]</p>
24332 <p><b>[[foo</b>]]</p>
24333 !! wikitext
24334 ''[[foo''<nowiki>]]</nowiki>
24335
24336 '''[[foo'''<nowiki>]]</nowiki>
24337 !! end
24338
24339 !! test
24340 4. No escaping needed
24341 !! options
24342 options=html2wt
24343 !! html/parsoid
24344 <p>'<span><i>bar</i></span>'
24345 '<span><b>bar</b></span>'
24346 'a:b'foo
24347 </p>
24348 !! wikitext
24349 '<span>''bar''</span>'
24350 '<span>'''bar'''</span>'
24351 'a:b'foo
24352 !! end
24353
24354 #### ----------- Paragraphs ---------------
24355 #### 1. No unnecessary escapes
24356 #### --------------------------------------
24357
24358 !! test
24359 1. No unnecessary escapes
24360 !! options
24361 parsoid=html2wt
24362 !! html/parsoid
24363 <p>bar <span>[[foo]]</span>
24364 </p><p>=bar <span>[[foo]]</span>
24365 </p><p>[[bar <span>[[foo]]</span>
24366 </p><p>]]bar <span>[[foo]]</span>
24367 </p><p>=bar <span>foo]]</span>=
24368 </p>
24369 !! wikitext
24370 bar <span><nowiki>[[foo]]</nowiki></span>
24371
24372 =bar <span><nowiki>[[foo]]</nowiki></span>
24373
24374 [[bar <span><nowiki>[[foo]]</nowiki></span>
24375
24376 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24377
24378 =bar <span>foo]]</span><nowiki>=</nowiki>
24379 !!end
24380
24381 #### ----------------------- PRE --------------------------
24382 #### 1. Leading whitespace in SOL context should be escaped
24383 #### ------------------------------------------------------
24384 !! test
24385 1. Leading whitespace in SOL context should be escaped
24386 !! options
24387 parsoid=html2wt
24388 !! html/parsoid
24389 <p> a</p>
24390
24391 <p> a</p>
24392
24393 <p> a(tab)</p>
24394
24395 <p> a
24396 <!--cmt-->
24397 a</p>
24398
24399 <p>a
24400 b</p>
24401
24402 <p>a
24403 b</p>
24404
24405 <p>a
24406 b</p>
24407 !! wikitext
24408 <nowiki> </nowiki>a
24409
24410 <nowiki> </nowiki> a
24411
24412 a(tab)
24413
24414 <nowiki> </nowiki> a
24415 <!--cmt-->
24416 <nowiki> </nowiki>a
24417
24418 a
24419 <nowiki> </nowiki>b
24420
24421 a
24422 b
24423
24424 a
24425 b
24426 !! html/php
24427 <p> a
24428 </p><p> a
24429 </p><p> a(tab)
24430 </p><p> a
24431 a
24432 </p><p>a
24433 b
24434 </p><p>a
24435 b
24436 </p><p>a
24437 b
24438 </p>
24439 !! end
24440
24441 !! test
24442 2. Leading whitespace in non-indent-pre contexts should not be escaped
24443 !! options
24444 parsoid=html2wt
24445 !! html/parsoid
24446 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
24447 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24448 <li about="#cite_note-1" id="cite_note-1"><a href="#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>
24449 b</span></li>
24450 </ol>
24451 !! wikitext
24452 foo <ref>''a''
24453 b</ref>
24454 <references />
24455 !! end
24456
24457 !! test
24458 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24459 !! options
24460 parsoid=html2wt
24461 !! html/parsoid
24462 <blockquote>
24463 <p>
24464 a
24465 <span>b</span>
24466 c</p>
24467 </blockquote>
24468 !! wikitext
24469 <blockquote>
24470 a
24471 <span>b</span>
24472 c
24473 </blockquote>
24474 !! end
24475
24476 !! test
24477 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24478 !! options
24479 options=html2wt
24480 !! html/parsoid
24481 <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>
24482 !! wikitext
24483 [[File:Foobar.jpg|thumb|caption]]
24484 !! end
24485
24486 !! test
24487 5. Nowiki escaping should account for indent-pres
24488 !! options
24489 parsoid=html2wt
24490 !! html/parsoid
24491 <pre>==foo==</pre>
24492 !! wikitext
24493 ==foo==
24494 !! end
24495
24496 !!test
24497 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24498 !! options
24499 parsoid=html2wt
24500 !! html/parsoid
24501 <pre>
24502 * foo
24503 * bar
24504 </pre>
24505 !! wikitext
24506 * foo
24507 * bar
24508 !! end
24509
24510 #### --------------- Behavior Switches --------------------
24511
24512 !! test
24513 1. Valid behavior switches should be escaped
24514 !! options
24515 parsoid=html2wt
24516 !! html/parsoid
24517 __TOC__
24518 <i>__TOC__</i>
24519 !! wikitext
24520 <nowiki>__TOC__</nowiki>
24521 ''<nowiki>__TOC__</nowiki>''
24522 !! end
24523
24524 !! test
24525 2. Invalid behavior switches should not be escaped
24526 !! options
24527 parsoid=html2wt
24528 !! html/parsoid
24529 __TOO__
24530 __|__
24531 !! wikitext
24532 __TOO__
24533 __|__
24534 !! end
24535
24536 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24537 !! test
24538 Behavior switches should be SOL-transparent
24539 !! options
24540 parsoid=html2wt
24541 !! html/parsoid
24542 <meta property="mw:PageProp/toc" />
24543
24544 <!-- this one's bogus -->
24545 <pre>__TOO__</pre>
24546
24547 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24548
24549 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24550 !! wikitext
24551 __TOC__
24552
24553 <!-- this one's bogus -->
24554 __TOO__
24555
24556 __TOC__ foo
24557
24558 __TOC__
24559 bar
24560 !! end
24561
24562 #### --------------- HTML tags ---------------
24563 #### 1. a tags
24564 #### 2. other tags
24565 #### 3. multi-line html tag
24566 #### 4. extension tags
24567 #### -----------------------------------------
24568 !! test
24569 1. a tags
24570 !! options
24571 parsoid=html2wt
24572 !! html/parsoid
24573 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24574 !! wikitext
24575 <a href="http://google.com">google</a>
24576 !! end
24577
24578 !! test
24579 2. other tags
24580 !! options
24581 parsoid=html2wt
24582 !! html/parsoid
24583 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24584 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24585 <li> &lt;td&gt;</li></ul>
24586
24587 !! wikitext
24588 * <nowiki><div>foo</div></nowiki>
24589 * <nowiki><div style="color:red">foo</div></nowiki>
24590 * <nowiki><td></nowiki>
24591 !! end
24592
24593 !! test
24594 3. multi-line html tag
24595 !! options
24596 parsoid=html2wt
24597 !! html/parsoid
24598 <p>&lt;div
24599 &gt;foo&lt;/div
24600 &gt;
24601 </p>
24602 !! wikitext
24603 <nowiki><div
24604 >foo</div
24605 ></nowiki>
24606 !! end
24607
24608 !! test
24609 4. extension tags
24610 !! options
24611 parsoid=html2wt
24612 !! html/parsoid
24613 <p>&lt;ref&gt;foo&lt;/ref&gt;
24614 </p><p>&lt;ref&gt;bar
24615 </p><p>baz&lt;/ref&gt;
24616 </p>
24617 !! wikitext
24618 <nowiki><ref>foo</ref></nowiki>
24619
24620 <nowiki><ref>bar</nowiki>
24621
24622 baz<nowiki></ref></nowiki>
24623 !! end
24624
24625 #### --------------- Others ---------------
24626 !! test
24627 Escaping nowikis
24628 !! options
24629 parsoid=html2wt
24630 !! html/parsoid
24631 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24632 </p>
24633 !! wikitext
24634 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24635 !! end
24636
24637 ## The quote-char in the input is necessary for triggering the bug
24638 !! test
24639 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24640 !! options
24641 parsoid=html2wt
24642 !! html/parsoid
24643 <p>foo's bar :</p>
24644 !! wikitext
24645 foo's bar :
24646 !! end
24647
24648 #----------- End of wikitext escaping tests --------------
24649
24650 !! test
24651
24652 Tag-like HTML structures are passed through as text
24653 !! wikitext
24654 <x y>
24655
24656 <x.y>
24657
24658 <x-y>
24659
24660 1>2
24661
24662 x<y
24663
24664 a>b
24665
24666 1<d e>f
24667 !! html
24668 <p>&lt;x y&gt;
24669 </p><p>&lt;x.y&gt;
24670 </p><p>&lt;x-y&gt;
24671 </p><p>1&gt;2
24672 </p><p>x&lt;y
24673 </p><p>a&gt;b
24674 </p><p>1&lt;d e&gt;f
24675 </p>
24676 !! end
24677
24678 !! test
24679 HTML tag with necessary entities in attributes
24680 !! wikitext
24681 <span title="&amp;amp;">foo</span>
24682 !! html
24683 <p><span title="&amp;amp;">foo</span>
24684 </p>
24685 !! end
24686
24687 !! test
24688 HTML tag with 'unnecessary' entity encoding in attributes
24689 !! wikitext
24690 <span title="&amp;">foo</span>
24691 !! html
24692 <p><span title="&amp;">foo</span>
24693 </p>
24694 !! end
24695
24696 !! test
24697 HTML tag with broken attribute value quoting
24698 !! options
24699 parsoid=wt2html,html2html
24700 !! wikitext
24701 <span title="Hello world>Foo</span>
24702 !! html/php
24703 <p><span title="Hello world">Foo</span>
24704 </p>
24705 !! html/parsoid
24706 <p><span title="Hello world">Foo</span></p>
24707 !! end
24708
24709 !! test
24710 Self-closed tag with broken attribute value quoting
24711 !! options
24712 parsoid=wt2html,html2html
24713 !! wikitext
24714 <div title="Hello world />Foo
24715 !! html/php+tidy
24716 <div title="Hello world"></div>
24717 <p>Foo</p>
24718 !! html/parsoid
24719 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24720 !! end
24721
24722 !! test
24723 Table with broken attribute value quoting
24724 !! options
24725 parsoid=wt2html,html2html
24726 !! wikitext
24727 {|
24728 | title="Hello world|Foo
24729 |}
24730 !! html/php
24731 <table>
24732 <tr>
24733 <td title="Hello world">Foo
24734 </td></tr></table>
24735
24736 !! html/parsoid
24737 <table>
24738 <tr>
24739 <td title="Hello world">Foo
24740 </td></tr></table>
24741
24742 !! end
24743
24744 !! test
24745 Table with broken attribute value quoting on consecutive lines
24746 !! options
24747 parsoid=wt2html,html2html
24748 !! wikitext
24749 {|
24750 | title="Hello world|Foo
24751 | style="color:red|Bar
24752 |}
24753 !! html/php
24754 <table>
24755 <tr>
24756 <td title="Hello world">Foo
24757 </td>
24758 <td style="color:red">Bar
24759 </td></tr></table>
24760
24761 !! html/parsoid
24762 <table><tbody>
24763 <tr>
24764 <td title="Hello world">Foo
24765 </td><td style="color: red">Bar
24766 </td></tr></tbody></table>
24767
24768 !! end
24769
24770 !!test
24771 Accept empty td cell attribute
24772 !! wikitext
24773 {|
24774 | align="center" | foo || |
24775 |}
24776 !! html
24777 <table>
24778 <tr>
24779 <td align="center"> foo </td>
24780 <td>
24781 </td></tr></table>
24782
24783 !!end
24784
24785 !!test
24786 Non-empty attributes in th-cells
24787 !! wikitext
24788 {|
24789 ! Foo !! style="color: red" | Bar
24790 |}
24791 !! html
24792 <table>
24793 <tr>
24794 <th> Foo </th>
24795 <th style="color: red"> Bar
24796 </th></tr></table>
24797
24798 !!end
24799
24800 !!test
24801 Accept empty attributes in th-cells
24802 !! wikitext
24803 {|
24804 !| foo !!| bar
24805 |}
24806 !! html
24807 <table>
24808 <tr>
24809 <th> foo </th>
24810 <th> bar
24811 </th></tr></table>
24812
24813 !!end
24814
24815 !!test
24816 Empty table rows go away
24817 !! wikitext
24818 {|
24819 | Hello
24820 | there
24821 |- class="foo"
24822 |-
24823 |}
24824 !! html
24825 <table>
24826 <tr>
24827 <td> Hello
24828 </td>
24829 <td> there
24830 </td></tr>
24831
24832 </table>
24833
24834 !! end
24835
24836 ###
24837 ### Parsoid-centric tests for testing RTing of inter-element separators
24838 ### Edge cases not tested by existing parser tests and specific to
24839 ### Parsoid-specific serialization strategies.
24840 ###
24841
24842 !!test
24843 RT-ed inter-element separators should be valid separators
24844 !! wikitext
24845 {|
24846 |- [[foo]]
24847 |}
24848 !! html/php
24849 <table>
24850
24851 </table>
24852
24853 !! html/parsoid
24854 <table>
24855 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24856 </tbody></table>
24857 !!end
24858
24859 # Parsoid-only since PHP parser relies on Tidy for correct output
24860 !!test
24861 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24862 !!options
24863 parsoid
24864 !! wikitext
24865 {|
24866 |<small>foo
24867 bar
24868 |}
24869
24870 {|
24871 |<small>foo<small>
24872 |}
24873 !! html
24874 <table>
24875 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24876 <p>bar</p></small></td></tr>
24877 </tbody></table>
24878
24879 <table>
24880 <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>
24881 </tbody></table>
24882 !!end
24883
24884 # Note that the "style" attribute is really a template parameter here.
24885 # The = would have to be {{=}} if you wanted the literal.
24886 !!test
24887 Empty TD followed by TD with tpl-generated attribute
24888 !! wikitext
24889 {|
24890 |-
24891 |
24892 |{{echo|style='color:red'}}|foo
24893 |}
24894 !! html
24895 <table>
24896
24897 <tr>
24898 <td>
24899 </td>
24900 <td>foo
24901 </td></tr></table>
24902
24903 !!end
24904
24905 !!test
24906 Indented table with an empty td
24907 !! wikitext
24908 {|
24909 |-
24910 |
24911 |foo
24912 |}
24913 !! html
24914 <table>
24915
24916 <tr>
24917 <td>
24918 </td>
24919 <td>foo
24920 </td></tr></table>
24921
24922 !!end
24923
24924 ## We have some newline diffs RT-ing this edge case
24925 ## and it is not important enough -- we seem to be emitting
24926 ## at most 2 newlines after a </tr> and this is unrelated to
24927 ## the issue from T85627 that this is testing.
24928 !!test
24929 Indented table with blank lines in between (T85627)
24930 !! options
24931 parsoid=wt2html
24932 !! wikitext
24933 {|
24934 |foo
24935
24936
24937 |}
24938 !! html
24939 <table>
24940
24941 <tr>
24942 <td>foo
24943 </td></tr></table>
24944
24945 !!end
24946
24947 !!test
24948 Indented block & table
24949 !! wikitext
24950 <div>foo</div>
24951 {|
24952 |foo
24953 |}
24954 !! html/php
24955 <div>foo</div>
24956 <table>
24957 <tr>
24958 <td>foo
24959 </td></tr></table>
24960
24961 !! html/parsoid
24962 <div data-parsoid='{"stx":"html"}'>foo</div>
24963 <table><tbody>
24964 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24965 </tbody></table>
24966 !!end
24967
24968 !! test
24969 Indent and comment before table row
24970 !! wikitext
24971 {|
24972 <!--hi-->|-
24973 | there
24974 |}
24975 !! html/php
24976 <table>
24977
24978 <tr>
24979 <td> there
24980 </td></tr></table>
24981
24982 !! html/parsoid
24983 <table>
24984 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24985 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24986 </tbody></table>
24987 !! end
24988
24989 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24990 !!test
24991 Empty TR followed by a template-generated TR
24992 !!options
24993 parsoid
24994 !! wikitext
24995 {|
24996 |-
24997 {{echo|<tr><td>foo</td></tr>}}
24998 |}
24999 !! html
25000 <table>
25001 <tbody>
25002 <tr></tr>
25003 <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}}]}'>
25004 <td>foo</td></tr>
25005 </tbody></table>
25006 !!end
25007
25008 ## PHP and parsoid output differ for this, and since this is primarily
25009 ## for testing Parsoid's serializer, marking this Parsoid only
25010 !!test
25011 Empty TR followed by mixed-ws-comment line should RT correctly
25012 !!options
25013 parsoid
25014 !! wikitext
25015 {|
25016 |-
25017 <!--c-->
25018 |-
25019 <!--c--> <!--d-->
25020 |}
25021 !! html
25022 <table>
25023 <tbody>
25024 <tr></tr>
25025 <!--c-->
25026 <tr>
25027 <!--c--> </tr><!--d-->
25028 </tbody></table>
25029
25030 !!end
25031
25032 !!test
25033 Multi-line image caption generated by templates with/without trailing newlines
25034 !! wikitext
25035 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25036 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25037 !! html/parsoid
25038 <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>
25039 <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>
25040 !!end
25041
25042 !! test
25043 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25044 !! options
25045 parsoid=html2wt
25046 !! html/parsoid
25047 <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>
25048
25049 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25050 !! wikitext
25051 <includeonly>foo</includeonly>
25052 new para
25053
25054 [[Category:Foo]]
25055
25056 = new heading =
25057 !! end
25058
25059 ## PHP emits broken html for this, and since this is primarily
25060 ## a Parsoid serializer test, marking this Parsoid only
25061 !!test
25062 Improperly nested inline or quotes tags with whitespace in between
25063 !! wikitext
25064 <span> <s>x</span> </s>
25065 ''' ''x''' ''
25066 !! html/parsoid
25067 <p><span> <s>x</s></span><s> </s>
25068 <b> <i>x</i></b><i> </i>
25069 </p>
25070 !!end
25071
25072 !!test
25073 Encapsulate protected attributes from wt
25074 !! wikitext
25075 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25076
25077 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25078 | ok
25079 |}
25080 !! html/parsoid
25081 <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>
25082
25083 <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">
25084 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25085 </tbody></table>
25086 !!end
25087
25088 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25089 ## Having nested or stray pre tags results in the attempt to add duplicates,
25090 ## causing an assertion fail. This test tries to prevent that situation.
25091 !!test
25092 Ensure ParagraphWrapper can deal with stray closing pre tags
25093 !!options
25094 parsoid=wt2html
25095 !! wikitext
25096 plain text</pre>
25097 !! html/parsoid
25098 plain text
25099 !!end
25100
25101 !!test
25102 1. Ensure fostered text content is wrapped in element nodes
25103 !!options
25104 parsoid=wt2html
25105 !! wikitext
25106 <table>hi</table><table>ho</table>
25107 !! html/parsoid
25108 <p>hi</p>
25109 <table></table>
25110 <p>ho</p>
25111 <table></table>
25112 !!end
25113
25114 !!test
25115 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25116 !!options
25117 parsoid=wt2html,wt2wt
25118 !! wikitext
25119 <table>
25120 <tr> || ||
25121 <td> a
25122 </table>
25123 !! html/parsoid
25124 <p> || ||
25125 </p><table>
25126 <tbody><tr><td> a</td></tr>
25127 </tbody></table>
25128 !!end
25129
25130 !!test
25131 Encapsulation properly handles null DSR information from foster box
25132 !!options
25133 parsoid=wt2html,wt2wt
25134 !! wikitext
25135 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25136 !! html/parsoid
25137 <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>
25138 !!end
25139
25140 !!test
25141 1. Encapsulate foster-parented transclusion content
25142 !!options
25143 parsoid=wt2wt,wt2html
25144 !! wikitext
25145 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25146 !! html/parsoid
25147 <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>
25148 <tbody>
25149 <tr>
25150 <td>bar</td>
25151 </tr>
25152 </tbody>
25153 </table>
25154 !!end
25155
25156 !!test
25157 2. Encapsulate foster-parented transclusion content
25158 !!options
25159 parsoid=wt2wt,wt2html
25160 !! wikitext
25161 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25162 !! html/parsoid
25163 <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>
25164 <table>
25165 <tbody>
25166 <tr>
25167 <td>bar</td>
25168 </tr>
25169 </tbody>
25170 </table>
25171 !!end
25172
25173 !!test
25174 3. Encapsulate foster-parented transclusion content
25175 !!options
25176 parsoid=wt2wt,wt2html
25177 !! wikitext
25178 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25179 !! html/parsoid
25180 <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;]}">
25181 <p>foo</p>
25182 </div>
25183 <table>
25184 <tbody>
25185 <tr>
25186 <td>bar</td>
25187 </tr>
25188 </tbody>
25189 </table>
25190 !!end
25191
25192 !!test
25193 4. Encapsulate foster-parented transclusion content
25194 !!options
25195 parsoid=wt2wt,wt2html
25196 !! wikitext
25197 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25198 !! html/parsoid
25199 <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;]}">
25200 <p>foo</p>
25201 </div>
25202 <table>
25203 <tbody>
25204 <tr>
25205 <td>bar</td>
25206 </tr>
25207 </tbody>
25208 </table>
25209 !!end
25210
25211 !!test
25212 5. Encapsulate foster-parented transclusion content
25213 !!options
25214 parsoid=wt2wt,wt2html
25215 !! wikitext
25216 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25217 !! html/parsoid
25218 <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>
25219 <table>
25220 <tbody>
25221 <tr>
25222 <td>
25223 <div>
25224 <p>foo</p>
25225 </div>
25226 </td>
25227 </tr>
25228 </tbody>
25229 </table>
25230 !!end
25231
25232 !!test
25233 6. Encapsulate foster-parented transclusion content
25234 !!options
25235 parsoid=wt2wt,wt2html
25236 !! wikitext
25237 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25238 !! html/parsoid
25239 <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>
25240 <table>
25241 <tbody>
25242 <tr>
25243 <td>
25244 <div>
25245 <p>foo</p>
25246 </div>
25247 </td>
25248 </tr>
25249 </tbody>
25250 </table>
25251 <p>ok</p>
25252 !!end
25253
25254 !!test
25255 7. Encapsulate foster-parented transclusion content
25256 !!options
25257 parsoid=wt2wt,wt2html
25258 !! wikitext
25259 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25260 !! html/parsoid
25261 <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>
25262 <table>
25263 <tbody>
25264 <tr>
25265 <td>bar</td>
25266 </tr>
25267 </tbody>
25268 </table>
25269 !!end
25270
25271 # Note that the wt is broken on purpose: the = should be {{=}} if you
25272 # don't want it to be a template parameter key.
25273 !!test
25274 8. Encapsulate foster-parented transclusion content
25275 !!options
25276 parsoid=wt2wt,wt2html
25277 !! wikitext
25278 {{echo|a
25279 }}{|{{echo|style='color:red'}}
25280 |-
25281 |b
25282 |}
25283 !! html/parsoid
25284 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25285 <span> </span>
25286 <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>
25287 <table>
25288 <tbody>
25289 <tr>
25290 <td>b</td>
25291 </tr>
25292 </tbody>
25293 </table>
25294 !!end
25295
25296 !!test
25297 9. Encapsulate foster-parented transclusion content
25298 !!options
25299 parsoid=wt2wt,wt2html
25300 !! wikitext
25301 <table>{{echo|hi</table>hello}}
25302 !! html/parsoid
25303 <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>
25304 !!end
25305
25306 !!test
25307 Table in fosterable position
25308 !!options
25309 parsoid=wt2html
25310 !! wikitext
25311 {{OpenTable}}
25312 <div>
25313 {|
25314 |}
25315 </div>
25316 |}
25317 !! html/parsoid
25318 <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">
25319 </span>
25320 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25321
25322 <table>
25323 </table>
25324 !!end
25325
25326 # Parsoid only for bug 64747
25327 !! test
25328 Properly encapsulate empty-content transclusions in fosterable positions
25329 !! wikitext
25330 <table>
25331 {{#if:|
25332 <td>foo</td>
25333 }}
25334 </table>
25335 !! html/parsoid
25336 <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"}]]}'>
25337
25338 </table>
25339 !! end
25340
25341 !! test
25342 Always encapsulate foster box when template range is expanded to table
25343 !! options
25344 parsoid=wt2wt
25345 !! wikitext
25346 {|
25347 hello
25348 {{OpenTable}}
25349 |}
25350 !! html/parsoid
25351
25352 !! end
25353
25354 !! test
25355 T115289: Unclosed table
25356 !! wikitext
25357 {{echo|<table>}}<!--c-->[[Category:Two]]
25358 !! html/parsoid
25359 <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>
25360 !! end
25361
25362 !! test
25363 T115289: Don't migrate newlines out of tables with fostered content
25364 !! wikitext
25365 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25366 !! html/parsoid
25367 <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>
25368 !! end
25369
25370 !! test
25371 T73074: More fostering fun
25372 !! wikitext
25373 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25374 !! html/parsoid
25375 <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>
25376 !! end
25377
25378 !!test
25379 Support <object> element with .data attribute
25380 !!options
25381 parsoid=html2wt
25382 !! html/parsoid
25383 <object data="test.swf"></object>
25384 !! wikitext
25385 <object data="test.swf"></object>
25386 !!end
25387
25388 !! test
25389 Don't block XML namespace declaration
25390 !! wikitext
25391 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25392 !! html/php
25393 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25394 </p>
25395 !! html/parsoid
25396 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25397 !! end
25398
25399 # -----------------------------------------------------------------
25400 # The following section of tests are primarily to spec requirements
25401 # around Parsoid's serialization (old, new, edited content)
25402 #
25403 # All these tests are marked Parsoid html2wt and html2html only
25404 # ----------------------------------------------------------------
25405
25406 !! test
25407 Ignore rel attribute in a-tags during serialization to url-links
25408 !! options
25409 parsoid=html2wt
25410 !! html/parsoid
25411 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25412 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25413 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25414 !! wikitext
25415 http://en.wikipedia.org/wiki/Foobar
25416 http://en.wikipedia.org/wiki/Foobar
25417 http://en.wikipedia.org/wiki/Foobar
25418 !! end
25419
25420 # 'mi' is a localinterwiki prefix as well as a language
25421 !! test
25422 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25423 !! options
25424 parsoid=html2wt
25425 !! html/parsoid
25426 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25427 !! wikitext
25428 [[Foo]]
25429 !! end
25430
25431 # See T93839
25432 !! test
25433 New wikilinks should be serialized properly
25434 !! options
25435 parsoid=html2wt
25436 !! html/parsoid
25437 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25438 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25439 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25440 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25441 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25442 !! wikitext
25443 [[Foo]]
25444 [[Foo]]
25445 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25446 http://en.wikipedia.org/wiki/Foo
25447 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25448 !! end
25449
25450 !! test
25451 New wiki links (href variations)
25452 !! options
25453 parsoid=html2wt
25454 !! html/parsoid
25455 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25456 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25457 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25458 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25459 !! wikitext
25460 [[Foo_bar]]
25461 [[Foo_bar]]
25462 [[Foo_bar]]
25463 [[Toxine bactérienne]]
25464 !! end
25465
25466 !! test
25467 New wiki links (content string variations)
25468 !! options
25469 parsoid=html2wt
25470 !! html/parsoid
25471 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25472 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25473 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25474 !! wikitext
25475 [[Foo_bar]]
25476 [[Foo bar]]
25477 [[Foo_bar|./Foo_bar]]
25478 !! end
25479
25480 !! test
25481 New category links (href variations)
25482 !! options
25483 parsoid=html2wt
25484 !! html/parsoid
25485 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25486 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25487 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25488 !! wikitext
25489 [[Category:Toxine bactérienne]]
25490 [[Category:Toxine bactérienne]]
25491 [[Category:Toxine bactérienne]]
25492 !! end
25493
25494 !! test
25495 New sol transparent links don't need indent-pre nowiki protection
25496 !! options
25497 parsoid=html2wt
25498 language=de
25499 !! html/parsoid
25500 <link rel="mw:PageProp/redirect" href="./Main_Page">
25501 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25502 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25503 !! wikitext
25504 #WEITERLEITUNG [[Main Page]]
25505 <!-- this is good --> [[Category:Good]]
25506 <!-- this is great --> [[Kategorie:Great]]
25507 !! end
25508
25509 !! test
25510 New interlanguage links (href variations)
25511 !! options
25512 parsoid=html2wt
25513 !! html/parsoid
25514 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25515 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25516 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25517 !! wikitext
25518 [[es:Toxine bactérienne]]
25519 [[es:Toxine_bactérienne]]
25520 [[es:Toxine_bactérienne]]
25521 !! end
25522
25523 !! test
25524 Image: Modifying size of an image (1)
25525 !! options
25526 parsoid={
25527 "modes": ["wt2wt"],
25528 "changes": [
25529 ["img[height]", "attr", "height", "22"],
25530 ["img[width]", "attr", "width", "200"]
25531 ]
25532 }
25533 !! wikitext
25534 [[Image:Foobar.jpg|230x230px]]
25535 !! wikitext/edited
25536 [[Image:Foobar.jpg|200x200px]]
25537 !!end
25538
25539 !! test
25540 Image: Modifying size of an image (2)
25541 !! options
25542 parsoid={
25543 "modes": ["wt2wt"],
25544 "changes": [
25545 ["img[height]", "attr", "height", "100"],
25546 ["img[width]", "attr", "width", "500"]
25547 ]
25548 }
25549 !! wikitext
25550 [[Image:Foobar.jpg|230x230px]]
25551 !! wikitext/edited
25552 [[Image:Foobar.jpg|500x500px]]
25553 !!end
25554
25555 # Change in size is ignored so long as class='mw-default-size'
25556 !! test
25557 Image: Modifying size of an image (3)
25558 !! options
25559 parsoid={
25560 "modes": ["wt2wt"],
25561 "changes": [
25562 ["figure[class]", "removeClass", "mw-default-size"],
25563 ["figure img", "attr", "height", "19"],
25564 ["figure img", "attr", "width", "170"]
25565 ]
25566 }
25567 !! wikitext
25568 [[Image:Foobar.jpg|thumb]]
25569 !! wikitext/edited
25570 [[Image:Foobar.jpg|thumb|170x170px]]
25571 !!end
25572
25573 !! test
25574 Image: Modifying alignment of an image (bug 48665)
25575 !! options
25576 parsoid={
25577 "modes": ["wt2wt"],
25578 "changes": [
25579 ["figure[class]", "removeClass", "mw-halign-right"],
25580 ["figure[class]", "addClass", "mw-halign-left"]
25581 ]
25582 }
25583 !! wikitext
25584 [[Image:Foobar.jpg|thumb|caption|right]]
25585 !! wikitext/edited
25586 [[Image:Foobar.jpg|thumb|caption|left]]
25587 !! end
25588
25589 !! test
25590 Image: Modifying mw-default-size of an frameless image (bug 62805)
25591 !! options
25592 parsoid={
25593 "modes": ["wt2wt"],
25594 "changes": [
25595 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25596 ]
25597 }
25598 !! wikitext
25599 [[Image:Foobar.jpg|frameless|right]]
25600 !! wikitext/edited
25601 [[Image:Foobar.jpg|frameless|right|220x220px]]
25602 !! end
25603
25604 !! test
25605 Image: Modifying valign of an image (bug 49221)
25606 !! options
25607 parsoid={
25608 "modes": ["wt2wt"],
25609 "changes": [
25610 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25611 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25612 ]
25613 }
25614 !! wikitext
25615 [[File:Foobar.jpg|20px|middle]]
25616 !! wikitext/edited
25617 [[File:Foobar.jpg|20px|text-top]]
25618 !! end
25619
25620 !! test
25621 Image: Modifying alt attribute of an image (bug 56400)
25622 !! options
25623 parsoid={
25624 "modes": ["wt2wt"],
25625 "changes": [
25626 ["img[alt]", "attr", "alt", "some alternate edited text"]
25627 ]
25628 }
25629 !! wikitext
25630 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25631 !! wikitext/edited
25632 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25633 !!end
25634
25635 !! test
25636 Image: Modifying caption of an image
25637 !! options
25638 parsoid={
25639 "modes": ["wt2wt"],
25640 "changes": [
25641 ["figcaption", "text", "new caption"]
25642 ]
25643 }
25644 !! wikitext
25645 [[Image:Foobar.jpg|thumb|original caption]]
25646 !! wikitext/edited
25647 [[Image:Foobar.jpg|thumb|new caption]]
25648 !!end
25649
25650 !! test
25651 Image: empty alt attribute (bug 48924)
25652 !! options
25653 parsoid
25654 !! wikitext
25655 [[File:Foobar.jpg|thumb|alt=|bar]]
25656 !! html
25657 <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>
25658 !! end
25659
25660 !! test
25661 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25662 !! options
25663 parsoid=html2wt
25664 language=ar
25665 disabled
25666 !! html/parsoid
25667 <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>
25668 !! wikitext
25669 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25670 !! end
25671
25672 !! test
25673 Image: Block level image should have \n before and after
25674 !! wikitext
25675 123
25676 [[File:Foobar.jpg|right|thumb|150x150px]]
25677 456
25678 !! html/parsoid
25679 <p>123</p>
25680 <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>
25681 <p>456</p>
25682 !!end
25683
25684 !! test
25685 Image: New block level image should have \n before and after (existing content)
25686 !! wikitext
25687 123
25688 [[File:Foobar.jpg|right|thumb|150x150px]]
25689 456
25690 !! html/parsoid
25691 <p>123</p>
25692 <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>
25693 <p>456</p>
25694 !!end
25695
25696 !! test
25697 Image: upright option (parsoid)
25698 !! wikitext
25699 [[File:Foobar.jpg|thumb|upright|caption]]
25700 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25701 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25702 !! html/parsoid
25703 <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>
25704 <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>
25705 <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>
25706 !!end
25707
25708 !! test
25709 Image: upright option is ignored on inline and frame images (parsoid)
25710 !! wikitext
25711 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25712 !! html/parsoid
25713 <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>
25714 !!end
25715
25716 !! test
25717 Image: from basic HTML (1)
25718 !! options
25719 parsoid=html2wt
25720 !! html/parsoid
25721 <span typeof="mw:Image">
25722 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25723 </span>
25724 !! wikitext
25725 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25726 !! end
25727
25728 !! test
25729 Image: from basic HTML (2)
25730 !! options
25731 parsoid=html2wt
25732 !! html/parsoid
25733 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25734 !! wikitext
25735 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25736 !! end
25737
25738 !! test
25739 Image: from basic HTML (3)
25740 !! options
25741 parsoid=html2wt
25742 !! html/parsoid
25743 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25744 !! wikitext
25745 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25746 !! end
25747
25748 !! test
25749 Image: from basic HTML (4)
25750 !! options
25751 parsoid=html2wt
25752 !! html/parsoid
25753 <img src="./File:Foobar.jpg">
25754 !! wikitext
25755 [[File:Foobar.jpg|link=]]
25756 !! end
25757
25758 !! test
25759 Image: Invalid title as link
25760 !! wikitext
25761 [[File:Foobar.jpg|link=<]]
25762 !! html/php
25763 <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>
25764 </p>
25765 !! html/parsoid
25766 <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>
25767 !! end
25768
25769 !! test
25770 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25771 !! options
25772 parsoid=html2wt
25773 !! html/parsoid
25774 <ul>
25775 <li><p>foo</p></li>
25776 </ul>
25777 !! wikitext
25778 * foo
25779 !! end
25780
25781 !! test
25782 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25783 !! options
25784 parsoid=html2wt
25785 !! html/parsoid
25786 <ul> <li>foo</li></ul>
25787 !! wikitext
25788 * foo
25789 !! end
25790
25791 !! test
25792 Don't strip leading whitespace when handling indent-pre suppressing tags
25793 !! options
25794 parsoid=html2wt
25795 !! html/parsoid
25796 <table>
25797 <tr><td> indented row</td></tr>
25798 </table>
25799 <blockquote><p>
25800 <b>This is very bold of you!</b>
25801 </p>
25802 <table><tr><td>
25803 indented cell (no pre-wrapping!)
25804 </td></tr></table>
25805 </blockquote>
25806 <p>foo</p>
25807 <div>bar</div>
25808 !! wikitext
25809 {|
25810 | indented row
25811 |}
25812 <blockquote>
25813 '''This is very bold of you!'''
25814
25815 {|
25816 |
25817 indented cell (no pre-wrapping!)
25818 |}
25819 </blockquote>
25820 foo
25821 <div>bar</div>
25822 !! end
25823
25824 !! test
25825 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25826 !! options
25827 parsoid=html2wt
25828 !! html/parsoid
25829 <p>foo</p>
25830 <span>bar</span>
25831
25832 <span>foo2
25833 </span>bar2
25834
25835 <div>foo</div>
25836 <span>bar</span>
25837
25838 <div>
25839 <span>foo</span>
25840 </div>
25841 !! wikitext
25842 foo
25843
25844 <span>bar</span>
25845
25846 <span>foo2
25847 <nowiki> </nowiki></span>bar2
25848
25849 <div>foo</div>
25850 <nowiki> </nowiki><span>bar</span>
25851
25852 <div>
25853 <nowiki> </nowiki><span>foo</span>
25854 </div>
25855 !! end
25856
25857 !! test
25858 Lists: Dont insert newlines in a serialized list item.
25859 !! options
25860 parsoid=html2wt
25861 !! html/parsoid
25862 <ul><li>a<br>b</li><li>c</li></ul>
25863 !! wikitext
25864 * a<br>b
25865 * c
25866 !! end
25867
25868 !! test
25869 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25870 !! options
25871 parsoid={
25872 "modes": ["html2wt"],
25873 "scrubWikitext": false
25874 }
25875 !! html/parsoid
25876 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25877 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25878
25879 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25880 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25881
25882 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25883
25884 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25885 !! wikitext
25886 == hello there [[Category:A1]] ==
25887
25888 == [[Category:A2]] hi pal ==
25889
25890 == <!--foo--> [[Category:A3]] how goes it ==
25891
25892 == it goes well [[Category:A4]] <!--bar--> ==
25893
25894 ==howdy [[Category:A5]]==
25895
25896 == __TOC__ ok ==
25897 !! end
25898
25899 !! test
25900 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25901 !! options
25902 parsoid={
25903 "modes": ["html2wt"],
25904 "scrubWikitext": true
25905 }
25906 !! html/parsoid
25907 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25908 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25909
25910 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25911 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25912
25913 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25914 !! wikitext
25915 == hello there ==
25916 [[Category:A1]]
25917 [[Category:A2]]
25918
25919 == hi pal ==
25920
25921 <!--foo--> [[Category:A3]]
25922
25923 == how goes it ==
25924
25925 == it goes well ==
25926 [[Category:A4]] <!--bar-->
25927
25928 __TOC__
25929
25930 == ok ==
25931 !! end
25932
25933 !! test
25934 Headings: Don't hoist metas that come from templates
25935 !! options
25936 parsoid={
25937 "modes": ["html2wt"],
25938 "scrubWikitext": true
25939 }
25940 !! html/parsoid
25941 <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>
25942 !! wikitext
25943 == {{echo|foo [[Category:Foo]]}} ==
25944 !! end
25945
25946 !! test
25947 Headings: Category in ref isn't hoisted
25948 !! options
25949 parsoid={
25950 "modes": ["html2wt"],
25951 "scrubWikitext": true
25952 }
25953 !! html/parsoid
25954 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
25955
25956 <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="#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>
25957 !! wikitext
25958 == foo <ref>bar
25959 [[Category:Baz]] </ref> ==
25960
25961 <references />
25962 !! end
25963
25964 !! test
25965 Parsoid: Serialize positional parameters with = in them as named parameter
25966 !! options
25967 parsoid=html2wt
25968 !! html/parsoid
25969 <p about="#mwt1" typeof="mw:Transclusion"
25970 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25971
25972 <p about="#mwt1" typeof="mw:Transclusion"
25973 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25974
25975 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25976 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25977 <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>
25978 !! wikitext
25979 {{echo|1=f=oo}}
25980
25981 {{echo|1=f=oo|2=bar}}
25982
25983 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25984 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25985 {{echo|<nowiki>f=oo</nowiki>|bar}}
25986 !! end
25987
25988 !! test
25989 Parsoid: Serialize positional parameters with = in extlink as named parameter
25990 !! options
25991 parsoid=html2wt
25992 !! html/parsoid
25993 <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>
25994 !! wikitext
25995 {{echo|1=http://stuff?is=ok}}
25996 !! end
25997
25998 !! test
25999 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26000 !! options
26001 parsoid=html2wt
26002 !! html/parsoid
26003 <div>a<p>b</p></div>
26004 <div>a
26005 <p>b</p></div>
26006 <div>
26007 a
26008 <p>b</p></div>
26009 !! wikitext
26010 <div>a
26011 b
26012 </div>
26013 <div>a
26014 b
26015 </div>
26016 <div>
26017 a
26018
26019 b
26020 </div>
26021 !! end
26022
26023 !! test
26024 Substrings resembling wikitext in hrefs should not get nowiki escapes
26025 !! options
26026 parsoid=html2wt
26027 !! html/parsoid
26028 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26029 !! wikitext
26030 [[Foo''bar''baz]]
26031 !! end
26032
26033 !! test
26034 Enforce single-line context in the serializer
26035 !! options
26036 parsoid=html2wt
26037 !! html/parsoid
26038 <h2>testing
26039 123</h2>
26040
26041 <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">
26042 </span><span about="#mwt1">you</span> </h2>
26043
26044 <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="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26045
26046 <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="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
26047 there</span></li></ol>
26048
26049 <ul><li>asd
26050 sdf</li></ul>
26051
26052 <ul><li>foo
26053 bar
26054 baz</li>
26055 <li>foo <b>bar</b>
26056 baz</li></ul>
26057
26058 <dl><dt>hi
26059 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26060 ho</dd></dl>
26061
26062 <dl><dd> <table>
26063 <tbody><tr><td> ha
26064 ha
26065 ha</td></tr>
26066 </tbody></table></dd></dl>
26067 !! wikitext
26068 == testing 123 ==
26069
26070 == hi {{bogus|there
26071 you}} ==
26072
26073 == foo <ref>hello
26074 there</ref> ==
26075
26076 <references />
26077
26078 * asd sdf
26079
26080 * foo bar baz
26081 * foo '''bar''' baz
26082
26083 ; hi ho : hi ho
26084
26085 : {|
26086 | ha
26087 ha
26088 ha
26089 |}
26090 !! end
26091
26092 !! test
26093 Serialize new placeholder space without spans
26094 !! options
26095 parsoid=html2wt
26096 !! html/parsoid
26097 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26098
26099 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26100
26101 <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>
26102 !! wikitext
26103 foo : bar
26104
26105 foo : bar
26106
26107 <ref>foo : bar</ref>ok
26108 !! end
26109
26110
26111 #-----------------------
26112 # Tag minimization tests
26113 #-----------------------
26114
26115 !! test
26116 1. I/B quote minimization: wikitext-only tags should be combined
26117 !! options
26118 parsoid=html2wt
26119 !! html/parsoid
26120 <p><i>A</i><i>B</i></p>
26121 <p><b>A</b><b>B</b></p>
26122 <p><i>A</i><b><i>B</i></b></p>
26123 <p><b>A</b><i><b>B</b></i></p>
26124 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26125 <p><i><b>A</b></i><i><b>B</b></i></p>
26126 <p><i><b>A</b></i><b><i>B</i></b></p>
26127 <p><b><i>A</i></b><i><b>B</b></i></p>
26128 !! wikitext
26129 ''AB''
26130
26131 '''AB'''
26132
26133 ''A'''B'''''
26134
26135 '''A''B'''''
26136
26137 '''A''BC''D'''
26138
26139 '''''AB'''''
26140
26141 '''''AB'''''
26142
26143 '''''AB'''''
26144 !! end
26145
26146 !! test
26147 2. I/B quote minimization: wikitext and html tags should not be combined
26148 !! options
26149 parsoid=html2wt
26150 !! html/parsoid
26151 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26152 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26153 !! wikitext
26154 ''A''<i>B</i>
26155
26156 ''A''<nowiki/>'''<i>B</i>'''
26157 !! end
26158
26159 !! test
26160 3. I/B quote minimization: templated content stops minimization
26161 !! options
26162 parsoid=html2wt
26163 !! html/parsoid
26164 <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>
26165 <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>
26166 !! wikitext
26167 ''A''{{echo|''B''}}
26168
26169 ''A''{{echo|'''''B'''''}}
26170 !! end
26171
26172 !! test
26173 4. I/B quote minimization: new content should be mimimized with adjacent old content
26174 !! options
26175 parsoid=html2wt
26176 !! html/parsoid
26177 <p><i>A</i><i>B</i></p>
26178 <p><b>A</b><b>B</b></p>
26179 <p><i>A</i><b><i>B</i></b></p>
26180 !! wikitext
26181 ''AB''
26182
26183 '''AB'''
26184
26185 ''A'''B'''''
26186 !! end
26187
26188 !! test
26189 5a. Merge adjacent quote nodes if they've been edited
26190 !! options
26191 parsoid={
26192 "modes": ["wt2wt", "selser"],
26193 "changes": [
26194 ["p", "contents", "remove", ":contains('b')"]
26195 ]
26196 }
26197 !! wikitext
26198 ''a''b''c''
26199 !! wikitext/edited
26200 ''ac''
26201 !! end
26202
26203 !! test
26204 5b. Merge adjacent quote nodes if they've been edited
26205 !! options
26206 parsoid={
26207 "modes": ["wt2wt", "selser"],
26208 "changes": [
26209 ["#x", "remove"]
26210 ]
26211 }
26212 !! wikitext
26213 ''a''<span id="x">b</span>''c''
26214 !! wikitext/edited
26215 ''ac''
26216 !! end
26217
26218 !! test
26219 1. Merge adjacent link nodes as long as at least one element is new
26220 !! options
26221 parsoid={
26222 "modes": ["html2wt"],
26223 "scrubWikitext": true
26224 }
26225 !! html/parsoid
26226 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26227 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26228 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26229 !! wikitext
26230 [[Football]]
26231 [[Football]]
26232 [[Football|Foot]][[Football|ball]]
26233 !! end
26234
26235 !! test
26236 2. Merge adjacent link nodes and enable additional normalizations
26237 !! options
26238 parsoid={
26239 "modes": ["html2wt"],
26240 "scrubWikitext": true
26241 }
26242 !! html/parsoid
26243 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26244 !! wikitext
26245 [[Football|''Football'']]
26246 !! end
26247
26248 !! test
26249 3. Don't merge adjacent link nodes if scrubWikitext is false
26250 !! options
26251 parsoid={
26252 "modes": ["html2wt"],
26253 "scrubWikitext": false
26254 }
26255 !! html/parsoid
26256 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26257 !! wikitext
26258 [[Football|Foot]][[Football|ball]]
26259 !! end
26260
26261 #------------------------------
26262 # End of tag minimization tests
26263 #------------------------------
26264
26265 !!test
26266 Bug 54262: New entities
26267 !! options
26268 parsoid=html2wt
26269 !! html/parsoid
26270 <span typeof="mw:Entity">&nbsp;</span>
26271 !! wikitext
26272 &nbsp;
26273 !! end
26274
26275 ## Note that there is no wikitext output for 'unknownproperty' ##
26276 ## Unknown magic words are silently dropped ##
26277
26278 !! test
26279 Magic words
26280 !! options
26281 parsoid=html2wt
26282 !! html/parsoid
26283 <meta property='mw:PageProp/toc' />
26284 <meta property='mw:PageProp/notoc' />
26285 <meta property='mw:PageProp/forcetoc' />
26286 <meta property='mw:PageProp/index' />
26287 <meta property='mw:PageProp/noindex' />
26288 <meta property='mw:PageProp/nogallery' />
26289 <meta property='mw:PageProp/noeditsection' />
26290 <meta property='mw:PageProp/notitleconvert' />
26291 <meta property='mw:PageProp/nocontentconvert' />
26292 <meta property='mw:PageProp/unknownproperty' />
26293 !! wikitext
26294 __TOC__
26295 __NOTOC__
26296 __FORCETOC__
26297 __INDEX__
26298 __NOINDEX__
26299 __NOGALLERY__
26300 __NOEDITSECTION__
26301 __NOTITLECONVERT__
26302 __NOCONTENTCONVERT__
26303 !! end
26304
26305 !! test
26306 Consecutive <pre>s should not get merged
26307 !! options
26308 parsoid=html2wt,html2html
26309 !! html/parsoid
26310 <pre>a</pre><pre>b</pre>
26311
26312 <pre>c
26313 </pre><pre>
26314 d</pre>
26315
26316 <pre>e
26317
26318 </pre><pre>
26319
26320 f</pre>
26321 !! wikitext
26322 a
26323
26324 b
26325
26326 c
26327
26328 d
26329
26330 e
26331
26332
26333
26334 f
26335 !! end
26336
26337 !! test
26338 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26339 !! options
26340 parsoid=html2wt
26341 !! html/parsoid
26342 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26343 !! wikitext
26344 [[Special:BookSources/1234567890|ISBN 1234567895]]
26345 !! end
26346
26347 !! test
26348 Edited RFC links not serializable as RFC links should serialize as extlinks
26349 !! options
26350 parsoid=html2wt
26351 !! html/parsoid
26352 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26353 !! wikitext
26354 [//tools.ietf.org/html/rfc123 New RFC]
26355 !! end
26356
26357 !! test
26358 Edited PMID links not serializable as PMID links should serialize as extlinks
26359 !! options
26360 parsoid=html2wt
26361 !! html/parsoid
26362 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26363 !! wikitext
26364 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26365 !! end
26366
26367 !! test
26368 WTS of autolinks with trailing/surrounding context
26369 !! options
26370 parsoid=html2wt
26371 !! html/parsoid
26372 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26373 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26374 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26375 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26376 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26377 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26378 !! wikitext
26379 http://cscott.net'''foo'''
26380
26381 http://cscott.net<b>foo</b>
26382
26383 '''http://cscott.net'''
26384
26385 '''http://cscott.net '''
26386
26387 '''http://cscott.net<nowiki/>x'''
26388
26389 http://cscott.net<nowiki/>x
26390 !! end
26391
26392 !! test
26393 WTS of autolinks with nowikis (round-trip)
26394 !! wikitext
26395 x<nowiki/>http://cscott.net<nowiki/>x
26396 !! html/parsoid
26397 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26398 !! end
26399
26400 # this is the "easy" test because it leaves in place all the
26401 # data-parsoid information indicating this is an autolink
26402 !! test
26403 WTS of autolinks with escapes (editing)
26404 !! options
26405 parsoid={
26406 "modes": ["wt2wt"],
26407 "changes": [
26408 [ "meta", "remove" ]
26409 ]
26410 }
26411 !! wikitext
26412 x<nowiki/>http://cscott.net<nowiki/>x
26413 !! wikitext/edited
26414 x<nowiki/>http://cscott.net<nowiki/>x
26415 !! end
26416
26417 !! test
26418 WTS of edited autolink-like text (T103364)
26419 !! options
26420 parsoid={
26421 "modes": ["wt2wt"],
26422 "changes": [
26423 [ "span[typeof]", "removeAttr", "typeof" ]
26424 ]
26425 }
26426 !! wikitext
26427 Not a link: <nowiki>http://example.com</nowiki>.
26428 !! wikitext/edited
26429 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26430 !! end
26431
26432 !! test
26433 WTS of newly-authored autolink-like text (T103364)
26434 !! options
26435 parsoid=html2wt
26436 !! html/parsoid
26437 <p>http://example.com is not a link.</p>
26438 !! wikitext
26439 <nowiki>http://example.com</nowiki> is not a link.
26440 !! end
26441
26442 !! test
26443 WTS of autolink-like text after an autolink (T108563)
26444 !! options
26445 parsoid=html2wt
26446 !! html/parsoid
26447 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26448 !! wikitext
26449 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26450 !! end
26451
26452 !! test
26453 Magic links inside links (not autolinked)
26454 !! wikitext
26455 [[Foo|http://example.com]]
26456 [[Foo|RFC 1234]]
26457 [[Foo|PMID 1234]]
26458 [[Foo|ISBN 123456789x]]
26459
26460 [http://foo.com http://example.com]
26461 [http://foo.com RFC 1234]
26462 [http://foo.com PMID 1234]
26463 [http://foo.com ISBN 123456789x]
26464 !! html+tidy
26465 <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>
26466 <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>
26467 !! html/parsoid
26468 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26469 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26470 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26471 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26472
26473 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26474 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26475 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26476 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26477 !! end
26478
26479 !! test
26480 Magic links inside image captions (autolinked)
26481 !! wikitext
26482 [[File:Foobar.jpg|thumb|http://example.com]]
26483 [[File:Foobar.jpg|thumb|RFC 1234]]
26484 [[File:Foobar.jpg|thumb|PMID 1234]]
26485 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26486 !! html+tidy
26487 <div class="thumb tright">
26488 <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>
26489 <div class="thumbcaption">
26490 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26491 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26492 </div>
26493 </div>
26494 <div class="thumb tright">
26495 <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>
26496 <div class="thumbcaption">
26497 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26498 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26499 </div>
26500 </div>
26501 <div class="thumb tright">
26502 <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>
26503 <div class="thumbcaption">
26504 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26505 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26506 </div>
26507 </div>
26508 <div class="thumb tright">
26509 <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>
26510 <div class="thumbcaption">
26511 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26512 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26513 </div>
26514 </div>
26515 !! html/parsoid
26516 <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>
26517 <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>
26518 <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>
26519 <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>
26520 !! end
26521
26522 !! test
26523 WTS of magic word text (T109371)
26524 !! options
26525 parsoid=html2wt
26526 !! html/parsoid
26527 <p>RFC 1234</p>
26528 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26529 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26530 !! wikitext
26531 <nowiki>RFC 1234</nowiki>
26532
26533 [http://foo.com RFC 1234]
26534
26535 [[Foo|RFC 1234]]
26536 !! end
26537
26538 !! test
26539 Edited Redirect link should emit a non-piped wikitext link
26540 !! options
26541 parsoid=html2wt
26542 !! html/parsoid
26543 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26544 !! wikitext
26545 #REDIRECT [[Bar]]
26546 !! end
26547
26548 !! test
26549 T75121: Infer extension name from typeOf if data-mw is not present
26550 !! options
26551 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26552 !! html/parsoid
26553 <div typeOf="mw:Extension/foo"></div>
26554 !! wikitext
26555 <foo />
26556 !! end
26557
26558 # Note that the <p> wrapping isn't present in PHP parser output
26559 # The important thing for this test is that P-wrapping doesn't
26560 # interfere with the <nowiki> protection for leading - in <td>
26561 # (which isn't necessary for <th>).
26562 !! test
26563 T88318: p-wrapped dash in table.
26564 !! options
26565 parsoid=html2wt,wt2wt
26566 !! html/parsoid
26567 <table><tbody>
26568 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26569 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26570 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26571 </tbody></table>
26572 !! wikitext
26573 {|
26574 !-
26575 !-
26576 |-
26577 |<nowiki>-</nowiki>
26578 |<nowiki>- </nowiki>
26579 |-
26580 |<small>-</small>
26581 |<br>
26582 -
26583 |<br>
26584 -
26585 |}
26586 !! html/php+tidy
26587 <table>
26588 <tr>
26589 <th>-</th>
26590 <th>-</th>
26591 </tr>
26592 <tr>
26593 <td>-</td>
26594 <td>-</td>
26595 </tr>
26596 <tr>
26597 <td><small>-</small></td>
26598 <td><br />
26599 <p>-</p>
26600 </td>
26601 <td><br />
26602 <p>-</p>
26603 </td>
26604 </tr>
26605 </table>
26606 !! end
26607
26608 !! test
26609 T149209: WTS: Handle newlines in table cells properly
26610 !! options
26611 parsoid=html2wt
26612 !! html/parsoid
26613 <table>
26614 <tbody>
26615 <tr><td>a
26616 b
26617 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26618 <tr><td><p>x</p>
26619 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26620 </tbody></table>
26621 <table>
26622 <tbody>
26623 <tr><th>a
26624 b
26625 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26626 <tr><th><p>x</h>
26627 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26628 </tbody></table>
26629 !! wikitext
26630 {|
26631 |a
26632 b
26633 |c
26634 |-
26635 |x
26636 {{!}}y
26637 |}
26638 {|
26639 !a
26640 b
26641 !c
26642 |-
26643 !x
26644 !y
26645 |}
26646 !! end
26647
26648 !! test
26649 T149209: Selser: Handle newlines in table cells properly
26650 !! options
26651 parsoid={
26652 "modes": ["selser"],
26653 "changes": [
26654 [ "#h1", "html", "a\nb\n" ],
26655 [ "#h2", "html", "a\nb\n" ],
26656 [ "#c1", "html", "a\nb\n" ],
26657 [ "#c2", "html", "<p>a</p>" ],
26658 [ "#c3", "html", "<p>a</p>" ]
26659 ]
26660 }
26661 !! wikitext
26662 {|
26663 ! id="h1" |edit-me!!1
26664 |-
26665 ! id="h2" |edit-me||2
26666 |-
26667 | id="c1" |edit-me||3
26668 |-
26669 | id="c2" |edit-me||4
26670 |-
26671 | id="c3" |edit-me||p||q||r
26672 |}
26673 !! wikitext/edited
26674 {|
26675 ! id="h1" |a
26676 b
26677 !1
26678 |-
26679 ! id="h2" |a
26680 b
26681 !2
26682 |-
26683 | id="c1" |a
26684 b
26685 |3
26686 |-
26687 | id="c2" |a
26688 |4
26689 |-
26690 | id="c3" |a
26691 |p||q||r
26692 |}
26693 !! end
26694
26695 !! test
26696 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26697 !! options
26698 parsoid=html2wt
26699 !! html/parsoid
26700 <table id='mwAb'>
26701 <td id='mwAc'>foo</td>
26702 <td id='serialize-this'>bar</td>
26703 </table>
26704 !! wikitext
26705 {|
26706 |foo
26707 | id="serialize-this" |bar
26708 |}
26709 !! end
26710
26711 !! test
26712 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26713 !! options
26714 parsoid=html2wt
26715 !! html/parsoid
26716 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26717 !! wikitext
26718 <div id="hello">ok</div>
26719 !! end
26720
26721 !! test
26722 WTS change modes
26723 !! options
26724 parsoid={
26725 "modes": ["wt2wt"],
26726 "changes": [
26727 [ "#xyz", "before", "<b>before</b> stuff " ],
26728 [ "#xyz", "after", " stuff <i>after</i>" ],
26729 [ "#xyz", "html", "x <b>y</b> z" ]
26730 ]
26731 }
26732 !! wikitext
26733 <span id="xyz">hello</span>
26734 !! wikitext/edited
26735 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26736 !! end
26737
26738 !! test
26739 Never serialize a-tag as html, regardless of what data-parsoid has to say
26740 !! options
26741 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26742 !! html/parsoid
26743 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26744 !! wikitext
26745 [[Foo]]
26746 !! end
26747
26748 ## SSS FIXME: This is broken output nevertheless.
26749 ## What might be a reasonable non-broken output for this?
26750 ## This is an edge case unlikely to be seen in production
26751 ## that I am not wasting more time on this right now.
26752 !! test
26753 Never serialize a-tag as html, no matter what attributes it has
26754 !! options
26755 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26756 !! html/parsoid
26757 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26758 !! wikitext
26759 [http://boo.org http://boohoo.org]
26760 !! end
26761
26762 # Misnested is an indication that selser can reuse the source but these have
26763 # shown to sneak through on occasion. See T101768.
26764 # The original wikitext here is: [http://test.com [[one]] two three]
26765 !! test
26766 Strip span tags added to mark misnested links
26767 !! options
26768 parsoid=html2wt
26769 !! html/parsoid
26770 <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>
26771 !! wikitext
26772 [http://test.com][[one]] two three
26773 !! end
26774
26775 !! test
26776 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26777 !! options
26778 parsoid=html2wt
26779 !! html/parsoid
26780 <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|}"]}'>
26781 <tbody><tr><td>d
26782 </td></tr>
26783 </tbody></table>
26784 !! wikitext
26785 {{echo|a}}
26786 {|{{echo|c
26787 {{!}}d
26788 }}
26789 |}
26790 !! end
26791
26792 ## This test verifies the presence and computation of this attribute indirectly
26793 ## by making an edit and ensuring that the serialization is correct (which it would be
26794 ## only if firstWikitextNode is properly set).
26795 !! test
26796 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26797 !! options
26798 parsoid= {
26799 "modes": ["wt2wt"],
26800 "changes": [
26801 [ "div#x", "remove" ],
26802 [ "div", "before", "<div>new</div>" ]
26803 ]
26804 }
26805 !! wikitext
26806 <div id="x">foo</div>
26807 {|
26808 {{echo|<div>boo</div>
26809 {{!}}b}}
26810 |c
26811 |}
26812 !! wikitext/edited
26813
26814 <div>new</div>
26815 {|
26816 {{echo|<div>boo</div>
26817 {{!}}b}}
26818 |c
26819 |}
26820 !! end
26821
26822 # --------------------------------------------
26823 # Tests spec'ing wikitext serialization norms |
26824 # --------------------------------------------
26825
26826 !! test
26827 1. Categories should always be serialized on their own line
26828 !! options
26829 parsoid=html2wt
26830 !! html/parsoid
26831 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26832 !! wikitext
26833 foo
26834 [[Category:Foo]]
26835 bar
26836 !! end
26837
26838 !! test
26839 2. Categories that are part of templates should not introduce a line break
26840 !! wikitext
26841 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26842 !! html/parsoid
26843 <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>
26844 !! end
26845
26846 # Careful while editing these next 2 tests. There are \u200f characters
26847 # before and after the <link> tags in the HTML and following some
26848 # of the categories in wikitext
26849 # Do not remove these characters in edits.
26850 #
26851 # As part of the serialization, these bidi characters will get stripped.
26852 !! test
26853 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26854 !! options
26855 parsoid={
26856 "modes": ["html2wt"],
26857 "scrubWikitext": true
26858 }
26859 !! html/parsoid
26860 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26861 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26862 !! wikitext
26863 [[קטגוריה:טקסים]]
26864 [[קטגוריה: שיטות משפט]]
26865 !! end
26866
26867 !! test
26868 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26869 !! options
26870 parsoid={
26871 "modes": ["html2wt"],
26872 "scrubWikitext": true
26873 }
26874 !! html/parsoid
26875 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26876 !! wikitext
26877 [[קטגוריה:טקסים]]
26878 ‏y
26879 !! end
26880
26881 !! test
26882 Lists: Add space after bullets
26883 !! options
26884 parsoid=html2wt
26885 !! html/parsoid
26886 <ul>
26887 <li>foo</li>
26888 <li> bar</li>
26889 <li><span> baz</span></li>
26890 </ul>
26891 !! wikitext
26892 * foo
26893 * bar
26894 * <span> baz</span>
26895 !! end
26896
26897 !! test
26898 1. Headings: Add space before/after == (T53744)
26899 !! options
26900 parsoid=html2wt
26901 !! html/parsoid
26902 <h2>foo</h2>
26903 <h2> bar</h2>
26904 <h2>baz </h2>
26905 <h2><span> baz</span></h2>
26906 !! wikitext
26907 == foo ==
26908
26909 == bar ==
26910
26911 == baz ==
26912
26913 == <span> baz</span> ==
26914 !! end
26915
26916 !! test
26917 2. Headings: Add space before/after == even after hoisted content
26918 !! options
26919 parsoid={
26920 "modes": ["html2wt"],
26921 "scrubWikitext": true
26922 }
26923 !! html/parsoid
26924 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26925 !! wikitext
26926 [[Category:A2]]
26927
26928 == ok ==
26929 !! end
26930
26931 !! test
26932 1. Headings: suppress newly created empty headings
26933 !! options
26934 parsoid={
26935 "modes": ["html2wt"],
26936 "scrubWikitext": true
26937 }
26938 !! html/parsoid
26939 <h2></h2>
26940 !! wikitext
26941 !! end
26942
26943 !! test
26944 2. Headings: don't suppress empty headings if scrubWikitext is false
26945 !! options
26946 parsoid=html2wt
26947 !! html/parsoid
26948 <h2></h2>
26949 !! wikitext
26950 ==<nowiki/>==
26951 !! end
26952
26953 !! test
26954 3. Headings: suppress empty headings on edits
26955 !! options
26956 parsoid={
26957 "modes": ["selser"],
26958 "scrubWikitext": true,
26959 "changes": [
26960 [ "#x", "remove"]
26961 ]
26962 }
26963 !! wikitext
26964 ==<span id="x">foo</span>==
26965 !! wikitext/edited
26966 !! end
26967
26968 !! test
26969 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26970 !! options
26971 parsoid={
26972 "modes": ["html2wt"],
26973 "scrubWikitext": true
26974 }
26975 !! html/parsoid
26976 <h2>foo<br/>bar</h2>
26977 <h2>foo <span><br/>bar</span> baz</h2>
26978 !! wikitext
26979 == foo bar ==
26980
26981 == foo <span> bar</span> baz ==
26982 !! end
26983
26984 !! test
26985 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26986 !! options
26987 parsoid={
26988 "modes": ["html2wt"],
26989 "scrubWikitext": false
26990 }
26991 !! html/parsoid
26992 <h2>foo<br/>bar</h2>
26993 !! wikitext
26994 == foo<br> bar ==
26995 !! end
26996
26997 !! test
26998 1. WT Quote Tags: suppress newly created empty style tags
26999 !! options
27000 parsoid={
27001 "modes": ["html2wt"],
27002 "scrubWikitext": true
27003 }
27004 !! html/parsoid
27005 <i></i><b></b>
27006 !! wikitext
27007 !! end
27008
27009 !! test
27010 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27011 !! options
27012 parsoid=html2wt
27013 !! html/parsoid
27014 <i></i><b></b>
27015 !! wikitext
27016 ''<nowiki/>'''''<nowiki/>'''
27017 !! end
27018
27019 !! test
27020 3. WT Quote Tags: suppress empty style tags on edits
27021 !! options
27022 parsoid={
27023 "modes": ["selser"],
27024 "scrubWikitext": true,
27025 "changes": [
27026 [ "#x", "remove"]
27027 ]
27028 }
27029 !! wikitext
27030 '''<span id="x">foo</span>'''
27031 !! wikitext/edited
27032 !! end
27033
27034 !! test
27035 1. Anchors: suppress newly created empty anchors
27036 !! options
27037 parsoid={
27038 "modes": ["html2wt"],
27039 "scrubWikitext": true
27040 }
27041 !! html/parsoid
27042 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27043 !! wikitext
27044 !! end
27045
27046 !! test
27047 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27048 !! options
27049 parsoid={
27050 "modes": ["html2wt"],
27051 "scrubWikitext": false
27052 }
27053 !! html/parsoid
27054 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27055 !! wikitext
27056 [[Test|<nowiki/>]]
27057 !! end
27058
27059 !! test
27060 3. Anchors: suppress empty anchors on edits
27061 !! options
27062 parsoid={
27063 "modes": ["selser"],
27064 "scrubWikitext": true,
27065 "changes": [
27066 [ "#x", "remove"]
27067 ]
27068 }
27069 !! wikitext
27070 [[Test|<span id="x">foo</span>]]
27071 !! wikitext/edited
27072 !! end
27073
27074 !! test
27075 3a. Anchors: do not suppress numbered extlinks
27076 !! options
27077 parsoid={
27078 "modes": ["wt2wt"],
27079 "scrubWikitext": true
27080 }
27081 !! wikitext
27082 [http://foo.com]
27083 !! html/parsoid
27084 <a rel="mw:ExtLink" href="http://foo.com"></a>
27085 !! end
27086
27087 !! test
27088 3b. Anchors: do not suppress numbered extlinks
27089 !! options
27090 parsoid={
27091 "modes": ["wt2wt"],
27092 "scrubWikitext": true,
27093 "changes": [
27094 [ "#x", "remove"]
27095 ]
27096 }
27097 !! wikitext
27098 [http://foo.com <span id="x">foo</span>]
27099 !! wikitext/edited
27100 [http://foo.com]
27101 !! end
27102
27103 !!test
27104 Normalizations should be restricted to edited content
27105 !!options
27106 parsoid={
27107 "modes": ["selser"],
27108 "scrubWikitext": true,
27109 "changes": [
27110 [ "h1", "before", "<i></i>"]
27111 ]
27112 }
27113 !!wikitext
27114 a
27115 = =
27116 b
27117 !!wikitext/edited
27118 a
27119 = =
27120 b
27121 !!end
27122
27123 !! test
27124 1. Multiple normalizations (html2wt)
27125 !! options
27126 parsoid={
27127 "modes": ["html2wt"],
27128 "scrubWikitext": true
27129 }
27130 !! html
27131 <h2><i></i></h2>
27132 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27133 </a><b><i></i></b>x</p>
27134 !! wikitext
27135
27136 [[foo]]
27137 x
27138
27139 !! end
27140
27141 !! test
27142 2. Multiple normalizations (selser)
27143 !! options
27144 parsoid={
27145 "modes": ["selser"],
27146 "scrubWikitext": true,
27147 "changes": [
27148 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27149 ]
27150 }
27151 !! wikitext
27152 <span id="x">foo</span>
27153 !! wikitext/edited
27154 <span id="x">foo</span>
27155
27156 x
27157 !! end
27158
27159 !! test
27160 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27161 !! options
27162 parsoid={
27163 "modes": ["html2wt"],
27164 "scrubWikitext": true
27165 }
27166 !! html/parsoid
27167 <p> hi</p>
27168 <p> hello</p>
27169 !! wikitext
27170 hi
27171
27172 hello
27173 !! end
27174
27175 !! test
27176 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27177 !! options
27178 parsoid=html2wt
27179 !! html/parsoid
27180 <p> hi</p>
27181 <p> hello</p>
27182 !! wikitext
27183 <nowiki> </nowiki>hi
27184
27185 <nowiki> </nowiki> hello
27186 !! end
27187
27188 !! test
27189 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27190 !! options
27191 parsoid={
27192 "modes": ["html2wt"],
27193 "scrubWikitext": true
27194 }
27195 !! html/parsoid
27196 <p>Foo
27197 bar
27198 baz</p>
27199
27200 <table><tr><td>Foo
27201 bar
27202 baz bang</td></tr></table>
27203
27204 <p><!--boo--> foo
27205 bar</p>
27206
27207 <p> foo
27208 bar<span>boo</span></p>
27209 !! wikitext
27210 Foo
27211 bar
27212 baz
27213
27214 {|
27215 |Foo
27216 bar
27217 baz bang
27218 |}
27219
27220 <!--boo-->foo
27221 bar
27222
27223 foo
27224 bar<span>boo</span>
27225 !! end
27226
27227 !! test
27228 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27229 !! options
27230 parsoid={
27231 "modes": ["selser"],
27232 "scrubWikitext": true,
27233 "changes": [
27234 [ "p", "html", " a\n b" ]
27235 ]
27236 }
27237 !! wikitext
27238 xyz
27239 !! wikitext/edited
27240 a
27241 b
27242 !! end
27243
27244 !! test
27245 1. New links that end in spaces
27246 !! options
27247 parsoid={
27248 "modes": ["html2wt"],
27249 "scrubWikitext": false
27250 }
27251 !! html/parsoid
27252 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27253 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27254 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27255 !! wikitext
27256 [[Berlin ]]<nowiki/>is the capital of Germany.
27257
27258 [[Foo ]]'''bar'''
27259
27260 [[Boston ]] is a city.
27261 !! end
27262
27263 !! test
27264 2. New links that end in spaces
27265 !! options
27266 parsoid={
27267 "modes": ["html2wt"],
27268 "scrubWikitext": true
27269 }
27270 !! html/parsoid
27271 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27272 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27273 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27274 !! wikitext
27275 [[Berlin]] is the capital of Germany.
27276
27277 [[Foo]] '''bar'''
27278
27279 [[Boston]] is a city.
27280 !! end
27281
27282 !! test
27283 1. Table cells with escapable prefixes
27284 !! options
27285 parsoid={
27286 "modes": ["html2wt"],
27287 "scrubWikitext": false
27288 }
27289 !! html
27290 <table>
27291 <tr><td>a</td></tr>
27292 <tr><td>-</td></tr>
27293 <tr><td>+</td></tr>
27294 </table>
27295 !! wikitext
27296 {|
27297 |a
27298 |-
27299 |<nowiki>-</nowiki>
27300 |-
27301 |<nowiki>+</nowiki>
27302 |}
27303 !! end
27304
27305 !! test
27306 2. Table cells with escapable prefixes
27307 !! options
27308 parsoid={
27309 "modes": ["html2wt"],
27310 "scrubWikitext": true
27311 }
27312 !! html
27313 <table>
27314 <tr><td>a</td></tr>
27315 <tr><td>-</td></tr>
27316 <tr><td>+</td></tr>
27317 </table>
27318 !! wikitext
27319 {|
27320 |a
27321 |-
27322 | -
27323 |-
27324 | +
27325 |}
27326 !! end
27327
27328 !! test
27329 3a. Table cells with escapable prefixes after edits
27330 !! options
27331 parsoid={
27332 "modes": ["selser"],
27333 "scrubWikitext": true,
27334 "changes": [
27335 [ "table tbody tr:first-child td:first-child", "remove"]
27336 ]
27337 }
27338 !! wikitext
27339 {|
27340 |a||-
27341 |}
27342 !! wikitext/edited
27343 {|
27344 | -
27345 |}
27346 !! end
27347
27348 !! test
27349 3b. Table cells with escapable prefixes after edits
27350 !! options
27351 parsoid={
27352 "modes": ["selser"],
27353 "scrubWikitext": true,
27354 "changes": [
27355 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27356 [ "#x", "remove" ]
27357 ]
27358 }
27359 !! wikitext
27360 {|
27361 |pqr
27362 |<span id="x">foo</span>+
27363 |}
27364 !! wikitext/edited
27365 {|
27366 | -
27367 | +
27368 |}
27369 !! end
27370
27371 # FIXME: This test will fail because
27372 # normalization doesn't realize that the id attribute
27373 # will eliminate the escapable scenario
27374 !! test
27375 4a. Table cells without escapable prefixes after edits
27376 !! options
27377 parsoid={
27378 "modes": ["selser"],
27379 "scrubWikitext": true,
27380 "changes": [
27381 [ "#x", "html", "-" ]
27382 ]
27383 }
27384 !! wikitext
27385 {|
27386 | id="x" |abcd
27387 |}
27388 !! wikitext/edited
27389 {|
27390 | id="x" |-
27391 |}
27392 !! end
27393
27394 ## This tests normalizer's ability to discriminate between
27395 ## cells having identical content.
27396 !! test
27397 4b. Table cells without escapable prefixes after edits
27398 !! options
27399 parsoid={
27400 "modes": ["selser"],
27401 "scrubWikitext": true,
27402 "changes": [
27403 [ "td", "html", "-" ]
27404 ]
27405 }
27406 !! wikitext
27407 {|
27408 |a||b
27409 |}
27410 !! wikitext/edited
27411 {|
27412 | -||-
27413 |}
27414 !! end
27415
27416 ## This tests normalizer's ability to not be tripped by
27417 ## comments (and whitespace)
27418 !! test
27419 4c. Table cells without escapable prefixes after edits
27420 !! options
27421 parsoid={
27422 "modes": ["selser"],
27423 "scrubWikitext": true,
27424 "changes": [
27425 [ "table tbody tr td:first-child", "remove" ]
27426 ]
27427 }
27428 !! wikitext
27429 {|
27430 |-
27431 <!--foo--> |a||-
27432 |}
27433 !! wikitext/edited
27434 {|
27435 |-
27436 <!--foo--> | -
27437 |}
27438 !! end
27439
27440 ## This tests normalizer's ability to handle HTML cells
27441 !! test
27442 4d. Table cells without escapable prefixes after edits
27443 !! options
27444 parsoid={
27445 "modes": ["selser"],
27446 "scrubWikitext": true,
27447 "changes": [
27448 [ "td", "html", "-" ]
27449 ]
27450 }
27451 !! wikitext
27452 <table>
27453 <tr><td>a</td></tr>
27454 </table>
27455 !! wikitext/edited
27456 <table>
27457 <tr><td>-</td></tr>
27458 </table>
27459 !! end
27460
27461 ## T111151 Remove font elements without attributes
27462 !! test
27463 5a. font tags without attributes should be dropped in scrubWikitext mode
27464 !! options
27465 parsoid={
27466 "modes": ["html2wt"],
27467 "scrubWikitext": true
27468 }
27469 !! html
27470 <font>foo</font>
27471 <font><font>bar</font></font>
27472 <font class="x">boo</font>
27473 !! wikitext
27474 foo
27475 bar
27476 <font class="x">boo</font>
27477 !! end
27478
27479 !! test
27480 5b. font tags should not be dropped without scrubWikitext being enabled
27481 !! options
27482 parsoid={
27483 "modes": ["html2wt"],
27484 "scrubWikitext": false
27485 }
27486 !! html
27487 <font>foo</font>
27488 !! wikitext
27489 <font>foo</font>
27490 !! end
27491
27492 !! test
27493 Escape nowiki DOM elements
27494 !! options
27495 parsoid=html2wt
27496 !! html/parsoid
27497 <nowiki><i>foo</i></nowiki>
27498 !! wikitext
27499 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27500 !! end
27501
27502 # This is meant to be an interim fix while we go about figuring out
27503 # how to not introduce these trailing <nowiki/>s in the first place.
27504 !! test
27505 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27506 !! options
27507 parsoid=html2wt
27508 !! html/parsoid
27509 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27510 y</p>
27511 <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>
27512 <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>
27513 !! wikitext
27514 x
27515 y
27516
27517 {{echo|
27518 1 = <nowiki/>}}
27519
27520 {{echo|
27521 1 = <nowiki/>
27522 }}
27523 !! end
27524
27525 # ---------------------------------------------------
27526 # End of tests spec'ing wikitext serialization norms |
27527 # ---------------------------------------------------
27528
27529 # T104032
27530 !! test
27531 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27532 !! options
27533 parsoid=html2wt
27534 !! html/parsoid
27535 a<p>b</p>
27536 <b>c</b><p>d</p>
27537 <table><tr>
27538 <td>a<p>b</p></td>
27539 <td><b>c</b><p>d</p></td>
27540 </tr></table>
27541 !! wikitext
27542 a
27543
27544 b
27545
27546 '''c'''
27547
27548 d
27549 {|
27550 |a
27551 b
27552 |'''c'''
27553 d
27554 |}
27555 !! end
27556
27557 # -----------------------------------------------------------------
27558 # End of section for Parsoid-only html2wt tests for serialization
27559 # of new content
27560 # -----------------------------------------------------------------
27561
27562 # -----------------------------------------------------------------
27563 # The following section of tests are primarily to spec behavior of
27564 # the selective serializer. All these tests have manual selser
27565 # changes. The automated selser changes for all tests handle the
27566 # wide variation of changes, but these tests here capture specs
27567 # deterministically.
27568 # ----------------------------------------------------------------
27569
27570 ## T90517
27571 !! test
27572 Selser: New comments should not be lost
27573 !! options
27574 parsoid={
27575 "modes": ["selser"],
27576 "changes": [
27577 [ "#a", "after", "<!--c1-->" ],
27578 [ "#b", "before", "<!--c2-->" ]
27579 ]
27580 }
27581 !! wikitext
27582 <span id="a">a</span>
27583
27584 <span id="b">b</span>
27585 !! wikitext/edited
27586 <span id="a">a</span><!--c1-->
27587
27588 <!--c2--><span id="b">b</span>
27589 !! end
27590
27591 ## T89383
27592 !! test
27593 Selser: Check for validity of DSR before using it
27594 !! options
27595 parsoid={
27596 "modes": ["selser"],
27597 "changes": [
27598 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27599 ]
27600 }
27601 !! wikitext
27602 <span id="a">a</span>
27603 !! wikitext/edited
27604 {{DISPLAYTITLE:foo}}
27605 <span id="a">a</span>
27606 !! end
27607
27608 !! test
27609 1. DOMDiff: Changes to <ref> content should be looked up using id
27610 !! options
27611 parsoid={
27612 "modes": ["selser"],
27613 "changes": [
27614 ["#X", "after", "bar"],
27615 ["#Y", "after", "baz"]
27616 ]
27617 }
27618 !! wikitext
27619 X <ref><span id="X">foo</span></ref>
27620 Y <ref name="a" />
27621 <references>
27622 <ref name="a"><span id="Y">foo</span></ref>
27623 </references>
27624 !! wikitext/edited
27625 X <ref><span id="X">foo</span>bar</ref>
27626 Y <ref name="a" />
27627 <references>
27628 <ref name="a"><span id="Y">foo</span>baz</ref>
27629 </references>
27630 !! end
27631
27632 !! test
27633 2. DOMDiff: Changes to <ref> content should be looked up using id
27634 !! options
27635 parsoid={
27636 "modes": ["selser"],
27637 "changes": [
27638 ["#Z", "after", "bar"]
27639 ]
27640 }
27641 !! wikitext
27642 A <ref>foo bar for a</ref>
27643 B <ref group="X" name="b" />
27644
27645 <references />
27646
27647 <references group="X">
27648 <ref name="b"><span id="Z">foo</span></ref>
27649 </references>
27650 !! wikitext/edited
27651 A <ref>foo bar for a</ref>
27652 B <ref group="X" name="b" />
27653
27654 <references />
27655
27656 <references group="X">
27657 <ref name="b"><span id="Z">foo</span>bar</ref>
27658 </references>
27659 !! end
27660
27661 !! test
27662 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27663 !! options
27664 parsoid={
27665 "modes": ["selser"],
27666 "changes": [
27667 [ "div:first-child", "text", "bar" ]
27668 ]
27669 }
27670 !! wikitext
27671 <div style="{{1x|color:red;}}%">foo</div>
27672 !! wikitext/edited
27673 <div style="{{1x|color:red;}}%">bar</div>
27674 !! end
27675
27676 !! test
27677 Empty LI (T49673)
27678 !! wikitext
27679 * a
27680 *
27681 *
27682 * b
27683 !! html/php+tidy
27684 <ul>
27685 <li>a</li>
27686 <li class="mw-empty-elt"></li>
27687 <li class="mw-empty-elt"></li>
27688 <li>b</li>
27689 </ul>
27690 !! end
27691
27692 !! test
27693 Thumbnail output
27694 !! wikitext
27695 [[File:Thumb.png|thumb]]
27696 !! html/php+tidy
27697 <div class="thumb tright">
27698 <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>
27699 <div class="thumbcaption">
27700 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27701 </div>
27702 </div>
27703 </div>
27704 !! end
27705
27706 !! test
27707 unclosed internal link XSS (T137264)
27708 !! wikitext
27709 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27710 !! html/php
27711 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27712 </p>
27713 !! html/parsoid
27714 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27715 !! end