Merge "Add LoadBalancer::getMaintenanceConnectionRef() method"
[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 !! test
20599 T146304: Don't break template parsing if language converter markup is in the parameter.
20600 !! options
20601 language=sr variant=sr-ec
20602 !! wikitext
20603 {{echo|-{R|foo}-}}
20604 !! html/php
20605 <p>foo
20606 </p>
20607 !! end
20608
20609 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20610 !! test
20611 Don't break image parsing if language converter markup is in the caption.
20612 !! options
20613 language=sr
20614 !! wikitext
20615 [[File:Foobar.jpg|-{R|caption}-]]
20616 !! html/parsoid
20617 <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>
20618 </p>
20619 !! end
20620
20621 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20622 !! test
20623 Don't break list handling if language converter markup is in the item.
20624 !! options
20625 language=zh variant=zh-cn
20626 !! wikitext
20627 ;-{zh-cn:AAA;zh-tw:BBB}-
20628 !! html/php
20629 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20630
20631 !! html/parsoid
20632 <dl><dt>AAA
20633 </dt></dl>
20634 !! end
20635
20636 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20637 !! test
20638 Don't break table handling if language converter markup is in the cell.
20639 !! options
20640 language=sr variant=sr-ec
20641 !! wikitext
20642 {|
20643 |-
20644 | -{R|B}-
20645 |}
20646 !! html/php
20647 <table>
20648
20649 <tr>
20650 <td>Б}-
20651 </td></tr></table>
20652
20653 !! html/parsoid
20654 <table>
20655
20656 <tr>
20657 <td> B
20658 </td></tr></table>
20659
20660 !! end
20661
20662 !! test
20663 Bug 529: Uncovered bullet
20664 !! wikitext
20665 * Foo {{bullet}}
20666 !! html
20667 <ul><li> Foo </li>
20668 <li> Bar</li></ul>
20669
20670 !! end
20671
20672 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20673 # Templates in Wikipedia rely on this behavior, as tidy has always been
20674 # enabled there. These tests are normally run *without* tidy, so specify the
20675 # full output here.
20676 # To test realistic parsing behavior, apply a tidy-like transformation to both
20677 # the expected output and your parser's output.
20678 !! test
20679 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20680 !! wikitext
20681 ******* Foo {{bullet}}
20682 !! html
20683 <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>
20684 <li> Bar</li></ul>
20685
20686 !! end
20687
20688 !! test
20689 Bug 529: Uncovered table already at line-start
20690 !! wikitext
20691 x
20692
20693 {{table}}
20694 y
20695 !! html
20696 <p>x
20697 </p>
20698 <table>
20699 <tr>
20700 <td> 1 </td>
20701 <td> 2
20702 </td></tr>
20703 <tr>
20704 <td> 3 </td>
20705 <td> 4
20706 </td></tr></table>
20707 <p>y
20708 </p>
20709 !! end
20710
20711 !! test
20712 Bug 529: Uncovered bullet in parser function result
20713 !! wikitext
20714 * Foo {{lc:{{bullet}} }}
20715 !! html
20716 <ul><li> Foo </li>
20717 <li> bar</li></ul>
20718
20719 !! end
20720
20721 !! test
20722 Bug 5678: Double-parsed template argument
20723 !! wikitext
20724 {{lc:{{{1}}}|hello}}
20725 !! html
20726 <p>{{{1}}}
20727 </p>
20728 !! end
20729
20730 !! test
20731 Bug 5678: Double-parsed template invocation
20732 !! wikitext
20733 {{lc:{{paramtest {{!}} param = hello }} }}
20734 !! html
20735 <p>{{paramtest | param = hello }}
20736 </p>
20737 !! end
20738
20739 !! test
20740 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20741 !! options
20742 language=cs
20743 title=[[Main Page]]
20744 !! wikitext
20745 {{PRVNÍVELKÉ:ěščř}}
20746 {{prvnívelké:ěščř}}
20747 {{PRVNÍMALÉ:ěščř}}
20748 {{prvnímalé:ěščř}}
20749 {{MALÁ:ěščř}}
20750 {{malá:ěščř}}
20751 {{VELKÁ:ěščř}}
20752 {{velká:ěščř}}
20753 !! html
20754 <p>Ěščř
20755 Ěščř
20756 ěščř
20757 ěščř
20758 ěščř
20759 ěščř
20760 ĚŠČŘ
20761 ĚŠČŘ
20762 </p>
20763 !! end
20764
20765 !! test
20766 Morwen/13: Unclosed link followed by heading
20767 !! wikitext
20768 [[link
20769 ==heading==
20770 !! html
20771 <p>[[link
20772 </p>
20773 <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>
20774
20775 !! end
20776
20777 !! test
20778 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20779 !! wikitext
20780 {{foo|
20781 =heading=
20782 !! html
20783 <p>{{foo|
20784 </p>
20785 <h1><span class="mw-headline" id="heading">heading</span></h1>
20786
20787 !! end
20788
20789 !! test
20790 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20791 !! wikitext
20792 {{foo|
20793 ==heading==
20794 !! html
20795 <p>{{foo|
20796 </p>
20797 <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>
20798
20799 !! end
20800
20801 !! test
20802 Tildes in comments
20803 !! options
20804 pst
20805 !! wikitext
20806 <!-- ~~~~ -->
20807 !! html/php
20808 <!-- ~~~~ -->
20809 !! end
20810
20811 !! test
20812 Paragraphs inside divs (no extra line breaks)
20813 !! wikitext
20814 <div>Line one
20815
20816 Line two</div>
20817 !! html
20818 <div>Line one
20819 Line two</div>
20820
20821 !! end
20822
20823 !! test
20824 Paragraphs inside divs (extra line break on open)
20825 !! wikitext
20826 <div>
20827 Line one
20828
20829 Line two</div>
20830 !! html
20831 <div>
20832 <p>Line one
20833 </p>
20834 Line two</div>
20835
20836 !! end
20837
20838 !! test
20839 Paragraphs inside divs (extra line break on close)
20840 !! wikitext
20841 <div>Line one
20842
20843 Line two
20844 </div>
20845 !! html
20846 <div>Line one
20847 <p>Line two
20848 </p>
20849 </div>
20850
20851 !! end
20852
20853 !! test
20854 Paragraphs inside divs (extra line break on open and close)
20855 !! wikitext
20856 <div>
20857 Line one
20858
20859 Line two
20860 </div>
20861 !! html
20862 <div>
20863 <p>Line one
20864 </p><p>Line two
20865 </p>
20866 </div>
20867
20868 !! end
20869
20870 !! test
20871 Nesting tags, paragraphs on lines which begin with <div>
20872 !! wikitext
20873 <div></div><strong>A
20874 B</strong>
20875 !! html/php+tidy
20876 <p><strong>A</strong></p>
20877 <p><strong>B</strong></p>
20878 !! html/parsoid
20879 <div></div>
20880 <p><strong>A
20881 B</strong>
20882 </p>
20883 !! end
20884
20885 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20886 !! test
20887 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20888 !! wikitext
20889 <blockquote>Line one
20890
20891 Line two</blockquote>
20892 !! html
20893 <blockquote>Line one
20894 Line two</blockquote>
20895
20896 !! html+tidy
20897 <blockquote>
20898 <p>Line one Line two</p>
20899 </blockquote>
20900 !! end
20901
20902 !! test
20903 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20904 !! wikitext
20905 <blockquote>
20906 Line one
20907
20908 Line two</blockquote>
20909 !! html
20910 <blockquote>
20911 <p>Line one
20912 </p>
20913 Line two</blockquote>
20914
20915 !! html+tidy
20916 <blockquote>
20917 <p>Line one</p>
20918 Line two</blockquote>
20919 !! end
20920
20921 !! test
20922 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20923 !! wikitext
20924 <blockquote>Line one
20925
20926 Line two
20927 </blockquote>
20928 !! html
20929 <blockquote>Line one
20930 <p>Line two
20931 </p>
20932 </blockquote>
20933
20934 !! html+tidy
20935 <blockquote>
20936 <p>Line one</p>
20937 <p>Line two</p>
20938 </blockquote>
20939 !! end
20940
20941 !! test
20942 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20943 !! wikitext
20944 <blockquote>
20945 Line one
20946
20947 Line two
20948 </blockquote>
20949 !! html
20950 <blockquote>
20951 <p>Line one
20952 </p><p>Line two
20953 </p>
20954 </blockquote>
20955
20956 !! html+tidy
20957 <blockquote>
20958 <p>Line one</p>
20959 <p>Line two</p>
20960 </blockquote>
20961 !! end
20962
20963 !! test
20964 Paragraphs inside blockquotes/divs (no extra line breaks)
20965 !! wikitext
20966 <blockquote><div>Line one
20967
20968 Line two</div></blockquote>
20969 !! html
20970 <blockquote><div>Line one
20971 Line two</div></blockquote>
20972
20973 !! end
20974
20975 !! test
20976 Paragraphs inside blockquotes/divs (extra line break on open)
20977 !! wikitext
20978 <blockquote><div>
20979 Line one
20980
20981 Line two</div></blockquote>
20982 !! html
20983 <blockquote><div>
20984 <p>Line one
20985 </p>
20986 Line two</div></blockquote>
20987
20988 !! end
20989
20990 !! test
20991 Paragraphs inside blockquotes/divs (extra line break on close)
20992 !! wikitext
20993 <blockquote><div>Line one
20994
20995 Line two
20996 </div></blockquote>
20997 !! html
20998 <blockquote><div>Line one
20999 <p>Line two
21000 </p>
21001 </div></blockquote>
21002
21003 !! end
21004
21005 !! test
21006 Paragraphs inside blockquotes/divs (extra line break on open and close)
21007 !! wikitext
21008 <blockquote><div>
21009 Line one
21010
21011 Line two
21012 </div></blockquote>
21013 !! html
21014 <blockquote><div>
21015 <p>Line one
21016 </p><p>Line two
21017 </p>
21018 </div></blockquote>
21019
21020 !! end
21021
21022 !! test
21023 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21024 !! options
21025 wgLinkHolderBatchSize=0
21026 !! wikitext
21027 [[meatball:1]]
21028 [[meatball:2]]
21029 [[meatball:3]]
21030 !! html
21031 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21032 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21033 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21034 </p>
21035 !! end
21036
21037 !! test
21038 Free external link invading image caption
21039 !! wikitext
21040 [[Image:Foobar.jpg|thumb|http://x|hello]]
21041 !! html
21042 <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>
21043
21044 !! end
21045
21046 !! test
21047 Bug 15196: localised external link numbers
21048 !! options
21049 language=fa
21050 !! wikitext
21051 [http://en.wikipedia.org/]
21052 !! html/php
21053 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21054 </p>
21055 !! html/parsoid
21056 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21057 !! end
21058
21059 !! test
21060 Multibyte character in padleft
21061 !! wikitext
21062 {{padleft:-Hello|7|Æ}}
21063 !! html
21064 <p>Æ-Hello
21065 </p>
21066 !! end
21067
21068 !! test
21069 Multibyte character in padright
21070 !! wikitext
21071 {{padright:Hello-|7|Æ}}
21072 !! html
21073 <p>Hello-Æ
21074 </p>
21075 !! end
21076
21077 !!test
21078 formatdate parser function
21079 !! wikitext
21080 {{#formatdate:2009-03-24}}
21081 !! html
21082 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21083 </p>
21084 !! end
21085
21086 !!test
21087 formatdate parser function, with default format
21088 !! wikitext
21089 {{#formatdate:2009-03-24|mdy}}
21090 !! html
21091 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21092 </p>
21093 !! end
21094
21095 !! test
21096 Spacing of numbers in formatted dates
21097 !! wikitext
21098 {{#formatdate:January 15}}
21099 !! html
21100 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21101 </p>
21102 !! end
21103
21104 !! test
21105 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
21106 !! options
21107 language=nl title=[[MediaWiki:Common.css]]
21108 !! wikitext
21109 {{#formatdate:2009-03-24|dmy}}
21110 !! html
21111 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21112 </p>
21113 !! end
21114
21115 #
21116 #
21117 #
21118
21119 #
21120 # Edit comments
21121 #
21122
21123 !! test
21124 Edit comment with link
21125 !! options
21126 comment
21127 !! wikitext
21128 I like the [[Main Page]] a lot
21129 !! html/php
21130 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21131 !!end
21132
21133 !! test
21134 Edit comment with link and link text
21135 !! options
21136 comment
21137 !! wikitext
21138 I like the [[Main Page|best pages]] a lot
21139 !! html/php
21140 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21141 !!end
21142
21143 !! test
21144 Edit comment with link and link text with suffix
21145 !! options
21146 comment
21147 !! wikitext
21148 I like the [[Main Page|best page]]s a lot
21149 !! html/php
21150 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21151 !!end
21152
21153 !! test
21154 Edit comment with section link (non-local, eg in history list)
21155 !! options
21156 comment title=[[Main Page]]
21157 !! wikitext
21158 /* External links */ removed bogus entries
21159 !! html/php
21160 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21161 !!end
21162
21163 !! test
21164 Edit comment with section link and text before it (non-local, eg in history list)
21165 !! options
21166 comment title=[[Main Page]]
21167 !! wikitext
21168 pre-comment text /* External links */ removed bogus entries
21169 !! html/php
21170 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>
21171 !!end
21172
21173 !! test
21174 Edit comment with section link (local, eg in diff view)
21175 !! options
21176 comment local title=[[Main Page]]
21177 !! wikitext
21178 /* External links */ removed bogus entries
21179 !! html/php
21180 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21181 !!end
21182
21183 !! test
21184 Edit comment with subpage link (bug 14080)
21185 !! options
21186 comment
21187 subpage
21188 title=[[Subpage test]]
21189 !! wikitext
21190 Poked at a [[/subpage]] here...
21191 !! html/php
21192 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21193 !!end
21194
21195 !! test
21196 Edit comment with subpage link and link text (bug 14080)
21197 !! options
21198 comment
21199 subpage
21200 title=[[Subpage test]]
21201 !! wikitext
21202 Poked at a [[/subpage|neat little page]] here...
21203 !! html/php
21204 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21205 !!end
21206
21207 !! test
21208 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21209 !! options
21210 comment
21211 title=[[Subpage test]]
21212 !! wikitext
21213 Poked at a [[/subpage]] here...
21214 !! html/php
21215 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...
21216 !!end
21217
21218 !! test
21219 Edit comment with bare anchor link (local, as on diff)
21220 !! options
21221 comment
21222 local
21223 title=[[Main Page]]
21224 !! wikitext
21225 [[#section]]
21226 !! html/php
21227 <a href="#section">#section</a>
21228 !! end
21229
21230 !! test
21231 Edit comment with bare anchor link (non-local, as on history)
21232 !! options
21233 comment
21234 title=[[Main Page]]
21235 !! wikitext
21236 [[#section]]
21237 !! html/php
21238 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21239 !! end
21240
21241 !! test
21242 Anchor starting with underscore
21243 !! options
21244 title=[[Foo]]
21245 !! wikitext
21246 [[#_ref|One]]
21247 !! html/php
21248 <p><a href="#_ref">One</a>
21249 </p>
21250 !! html/parsoid
21251 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21252 !! end
21253
21254 !! test
21255 Id starting with underscore
21256 !! wikitext
21257 <div id="_ref"></div>
21258 !! html/*
21259 <div id="_ref"></div>
21260
21261 !! end
21262
21263 !! test
21264 Edit comment with link with more than one pipe (T99346)
21265 !! options
21266 comment
21267 !! wikitext
21268 [[Main Page|Many|pipes]]
21269 !! html/php
21270 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21271 !! end
21272
21273 !! test
21274 Complex edit comment with link with more than one pipe (T99346)
21275 !! options
21276 comment
21277 !! wikitext
21278 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21279 !! html/php
21280 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;
21281 !! end
21282
21283 !! test
21284 Space normalisation on autocomment (bug 22784)
21285 !! options
21286 comment
21287 title=[[Main Page]]
21288 !! wikitext
21289 /* __hello__world__ */
21290 !! html/php
21291 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21292 !! end
21293
21294 !! test
21295 percent-encoding and + signs in comments (Bug 26410)
21296 !! options
21297 comment
21298 !! wikitext
21299 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21300 !! html/php
21301 <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>
21302 !! end
21303
21304 # Parsoid doesn't support this yet: see bug 73581
21305 # but it *should* omit the 'src' attribute if the image is bad.
21306 # PHP side of tests was disabled in
21307 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21308 # because of issues in the PHP parserTests infrastructure
21309 # (but the output below is indeed what the PHP side emits)
21310 !! test
21311 Bad images - basic functionality
21312 !! wikitext
21313 [[File:Bad.jpg]]
21314 !! DISABLED/html/php
21315 !! html/parsoid
21316 <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>
21317 !! end
21318
21319 !! test
21320 Bad images - bug 16039: text after bad image disappears
21321 !! wikitext
21322 Foo bar
21323 [[File:Bad.jpg]]
21324 Bar foo
21325 !! DISABLED/html/php
21326 <p>Foo bar
21327 </p><p>Bar foo
21328 </p>
21329 !! html/parsoid
21330 <p>Foo bar
21331 <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>
21332 Bar foo</p>
21333 !! end
21334
21335 !! test
21336 Verify that displaytitle works (bug #22501) no displaytitle
21337 !! options
21338 showtitle
21339 !! config
21340 wgAllowDisplayTitle=true
21341 wgRestrictDisplayTitle=false
21342 !! wikitext
21343 this is not the the title
21344 !! html/php
21345 Parser test
21346 <p>this is not the the title
21347 </p>
21348 !! end
21349
21350 !! test
21351 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21352 !! options
21353 showtitle
21354 title=[[Screen]]
21355 !! config
21356 wgAllowDisplayTitle=true
21357 wgRestrictDisplayTitle=false
21358 !! wikitext
21359 this is not the the title
21360 {{DISPLAYTITLE:whatever}}
21361 !! html/php
21362 whatever
21363 <p>this is not the the title
21364 </p>
21365 !! end
21366
21367 !! test
21368 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21369 !! options
21370 showtitle
21371 title=[[Screen]]
21372 !! config
21373 wgAllowDisplayTitle=true
21374 wgRestrictDisplayTitle=true
21375 !! wikitext
21376 this is not the the title
21377 {{DISPLAYTITLE:whatever}}
21378 !! html/php
21379 Screen
21380 <p>this is not the the title
21381 </p>
21382 !! end
21383
21384 !! test
21385 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21386 !! options
21387 showtitle
21388 title=[[Screen]]
21389 !! config
21390 wgAllowDisplayTitle=true
21391 wgRestrictDisplayTitle=true
21392 !! wikitext
21393 this is not the the title
21394 {{DISPLAYTITLE:screen}}
21395 !! html/php
21396 screen
21397 <p>this is not the the title
21398 </p>
21399 !! end
21400
21401 !! test
21402 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21403 !! options
21404 showtitle
21405 title=[[Screen]]
21406 !! config
21407 wgAllowDisplayTitle=false
21408 !! wikitext
21409 this is not the the title
21410 {{DISPLAYTITLE:screen}}
21411 !! html/php
21412 Screen
21413 <p>this is not the the title
21414 <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>
21415 </p>
21416 !! end
21417
21418 !! test
21419 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21420 !! options
21421 showtitle
21422 title=[[Screen]]
21423 !! config
21424 wgAllowDisplayTitle=false
21425 !! wikitext
21426 this is not the the title
21427 !! html/php
21428 Screen
21429 <p>this is not the the title
21430 </p>
21431 !! end
21432
21433 !! test
21434 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21435 !! options
21436 showtitle
21437 title=[[Screen]]
21438 !! config
21439 wgAllowDisplayTitle=true
21440 wgRestrictDisplayTitle=true
21441 !! wikitext
21442 this is not the the title
21443 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21444 !! html/php
21445 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21446 <p>this is not the the title
21447 </p>
21448 !! end
21449
21450 !! test
21451 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21452 !! options
21453 showtitle
21454 title=[[Screen]]
21455 !! config
21456 wgAllowDisplayTitle=true
21457 wgRestrictDisplayTitle=true
21458 !! wikitext
21459 this is not the the title
21460 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21461 !! html/php
21462 <span style="color: red;">s</span>creen
21463 <p>this is not the the title
21464 </p>
21465 !! end
21466
21467 !! test
21468 Page status indicators: Empty name is invalid
21469 !! options
21470 showindicators
21471 !! wikitext
21472 <indicator name=" "></indicator>
21473 <indicator></indicator>
21474 !! html
21475 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21476 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21477 </p>
21478 !! end
21479
21480 !! test
21481 Page status indicators: Weird syntaxes that are okay
21482 !! options
21483 showindicators
21484 !! wikitext
21485 <indicator name="empty" />
21486 <indicator name="name"></indicator>
21487 !! html
21488 empty=
21489 name=
21490 <p><br />
21491 </p>
21492 !! end
21493
21494 !! test
21495 Page status indicators: Torture test
21496 !! options
21497 showindicators
21498 !! wikitext
21499 <indicator name="01">hello world</indicator>
21500 <indicator name="02">[[Main Page]]</indicator>
21501 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21502 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21503 <indicator name="05">* foo
21504 * bar</indicator>
21505 <indicator name="06"><nowiki>foo</nowiki></indicator>
21506 <indicator name="07"> Preformatted</indicator>
21507 <indicator name="08"><div>Broken tag</indicator>
21508 <indicator name="09">{| class=wikitable
21509 | cell
21510 |}</indicator>
21511 <indicator name="10">Two
21512
21513 paragraphs</indicator>
21514 !! html
21515 01=hello world
21516 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21517 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" />
21518 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>
21519 05=<ul><li> foo</li>
21520 <li> bar</li></ul>
21521
21522 06=foo
21523 07=<pre>Preformatted
21524 </pre>
21525 08=<div>Broken tag</div>
21526
21527 09=<table class="wikitable">
21528 <tr>
21529 <td> cell
21530 </td></tr></table>
21531
21532 10=<p>Two
21533 </p><p>paragraphs
21534 </p>
21535 <p><br />
21536 </p><p><br />
21537 </p><p><br />
21538 </p><p><br />
21539 </p><p><br />
21540 </p>
21541 !! end
21542
21543 !! test
21544 preload: check <noinclude> and <includeonly>
21545 !! options
21546 preload
21547 !! wikitext
21548 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21549 !! html/php
21550 Hello kind world.
21551 !! end
21552
21553 !! test
21554 preload: check <onlyinclude>
21555 !! options
21556 preload
21557 !! wikitext
21558 Goodbye <onlyinclude>Hello world</onlyinclude>
21559 !! html/php
21560 Hello world
21561 !! end
21562
21563 !! test
21564 preload: can pass tags through if we want to
21565 !! options
21566 preload
21567 !! wikitext
21568 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21569 !! html/php
21570 <includeonly>Hello world</includeonly>
21571 !! end
21572
21573 !! test
21574 preload: check that it doesn't try to do tricks
21575 !! options
21576 preload
21577 !! wikitext
21578 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21579 !! html/php
21580 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21581 !! end
21582
21583 !! test
21584 Play a bit with r67090 and bug 3158
21585 !! wikitext
21586 <div style="width:50% !important">&nbsp;</div>
21587 <div style="width:50%&nbsp;!important">&nbsp;</div>
21588 <div style="width:50%&#160;!important">&nbsp;</div>
21589 <div style="border : solid;">&nbsp;</div>
21590 !! html/php
21591 <div style="width:50% !important">&#160;</div>
21592 <div style="width:50% !important">&#160;</div>
21593 <div style="width:50% !important">&#160;</div>
21594 <div style="border&#160;: solid;">&#160;</div>
21595
21596 !! html/parsoid
21597 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21598 <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>
21599 <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>
21600 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21601
21602 !! end
21603
21604 !! test
21605 HTML5 data attributes
21606 !! wikitext
21607 <span data-foo="bar">Baz</span>
21608 <p data-abc-def_hij="">Quuz</p>
21609 !! html/php
21610 <p><span data-foo="bar">Baz</span>
21611 </p>
21612 <p data-abc-def_hij="">Quuz</p>
21613
21614 !! html/parsoid
21615 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21616 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21617 !! end
21618
21619 !! test
21620 Strip reserved data attributes
21621 !! wikitext
21622 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21623 !! html/php
21624 <div data-ok="fred">d</div>
21625
21626 !! html/parsoid
21627 <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>
21628 !! end
21629
21630 !! test
21631 percent-encoding and + signs in internal links (Bug 26410)
21632 !! wikitext
21633 [[User:+%]] [[Page+title%]]
21634 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21635 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21636 [[%33%45]] [[%33%45+]]
21637 !! html/php
21638 <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>
21639 <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>
21640 <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>
21641 <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>
21642 </p>
21643 !! html/parsoid
21644 <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>
21645 <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>
21646 <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>
21647 <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>
21648 !! end
21649
21650 !! test
21651 Special characters in embedded file links (bug 27679)
21652 !! wikitext
21653 [[File:Contains & ampersand.jpg]]
21654 [[File:Does not exist.jpg|Title with & ampersand]]
21655 !! html/php
21656 <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>
21657 <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>
21658 </p>
21659 !! html/parsoid
21660 <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>
21661 <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>
21662 !! end
21663
21664 !! test
21665 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21666 !! wikitext
21667 Text&apos;s been normalized?
21668 !! html
21669 <p>Text&#39;s been normalized?
21670 </p>
21671 !! end
21672
21673 !! test
21674 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21675 !! wikitext
21676 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21677 !! html
21678 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21679 </p>
21680 !! end
21681
21682 !! test
21683 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21684 !! wikitext
21685 [http://www.example.org/ ideograms]
21686 !! html
21687 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21688 </p>
21689 !! end
21690
21691 !! test
21692 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21693 !! wikitext
21694 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21695 !! html
21696 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21697 </p>
21698 !! end
21699
21700 !! article
21701 Mediawiki:loop1
21702 !! text
21703 {{Identical|A}}
21704 !! endarticle
21705
21706 !! article
21707 Mediawiki:loop2
21708 !! text
21709 {{Identical|B}}
21710 !! endarticle
21711
21712 !! article
21713 Template:Identical
21714 !! text
21715 {{int:loop1}}
21716 {{int:loop2}}
21717 !! endarticle
21718
21719 !! test
21720 Bug 31098 Template which includes system messages which includes the template
21721 !! wikitext
21722 {{Identical}}
21723 !! html
21724 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21725 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21726 </p>
21727 !! end
21728
21729 !! test
21730 Bug31490 Turkish: ucfirst 'blah'
21731 !! options
21732 language=tr
21733 !! wikitext
21734 {{ucfirst:blah}}
21735 !! html
21736 <p>Blah
21737 </p>
21738 !! end
21739
21740 !! test
21741 Bug31490 Turkish: ucfirst 'ix'
21742 !! options
21743 language=tr
21744 !! wikitext
21745 {{ucfirst:ix}}
21746 !! html
21747 <p>İx
21748 </p>
21749 !! end
21750
21751 !! test
21752 Bug31490 Turkish: lcfirst 'BLAH'
21753 !! options
21754 language=tr
21755 !! wikitext
21756 {{lcfirst:BLAH}}
21757 !! html
21758 <p>bLAH
21759 </p>
21760 !! end
21761
21762 !! test
21763 Bug31490 Turkish: ucfırst (with a dotless i)
21764 !! options
21765 language=tr
21766 !! wikitext
21767 {{ucfırst:blah}}
21768 !! html
21769 <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>
21770 </p>
21771 !! end
21772
21773 !! test
21774 Bug31490 ucfırst (with a dotless i) with English language
21775 !! options
21776 language=en
21777 !! wikitext
21778 {{ucfırst:blah}}
21779 !! html
21780 <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>
21781 </p>
21782 !! end
21783
21784 !! test
21785 Bug 26375: TOC with italics
21786 !! options
21787 title=[[Main Page]]
21788 !! wikitext
21789 __TOC__
21790 == ''Lost'' episodes ==
21791 !! html
21792 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21793 <ul>
21794 <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>
21795 </ul>
21796 </div>
21797
21798 <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>
21799
21800 !! end
21801
21802 !! test
21803 Bug 26375: TOC with bold
21804 !! options
21805 title=[[Main Page]]
21806 !! wikitext
21807 __TOC__
21808 == '''should be bold''' then normal text ==
21809 !! html
21810 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21811 <ul>
21812 <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>
21813 </ul>
21814 </div>
21815
21816 <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>
21817
21818 !! end
21819
21820 !! test
21821 Bug 33845: Headings become cursive in TOC when they contain an image
21822 !! options
21823 title=[[Main Page]]
21824 !! wikitext
21825 __TOC__
21826 == Image [[Image:foobar.jpg]] ==
21827 !! html
21828 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21829 <ul>
21830 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21831 </ul>
21832 </div>
21833
21834 <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>
21835
21836 !! end
21837
21838 !! test
21839 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21840 !! options
21841 title=[[Main Page]]
21842 !! wikitext
21843 __TOC__
21844 == <blockquote>Quote</blockquote> ==
21845 !! html
21846 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21847 <ul>
21848 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21849 </ul>
21850 </div>
21851
21852 <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>
21853
21854 !! html+tidy
21855 <p></p>
21856 <div id="toc" class="toc">
21857 <div id="toctitle">
21858 <h2>Contents</h2>
21859 </div>
21860 <ul>
21861 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21862 </ul>
21863 </div>
21864 <p></p>
21865 <h2><span class="mw-headline" id="Quote"></span></h2>
21866 <blockquote>
21867 <p><span class="mw-headline" id="Quote">Quote</span></p>
21868 </blockquote>
21869 <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>
21870 !! end
21871
21872 !! test
21873 Unclosed tags in TOC
21874 !! options
21875 title=[[Main Page]]
21876 !! wikitext
21877 __TOC__
21878 == Proof: 2 < 3 ==
21879 <small>Hanc marginis exiguitas non caperet.</small>
21880 QED
21881 !! html
21882 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21883 <ul>
21884 <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>
21885 </ul>
21886 </div>
21887
21888 <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>
21889 <p><small>Hanc marginis exiguitas non caperet.</small>
21890 QED
21891 </p>
21892 !! end
21893
21894 !! test
21895 Multiple tags in TOC
21896 !! wikitext
21897 __TOC__
21898 == <i>Foo</i> <b>Bar</b> ==
21899
21900 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21901 !! html
21902 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21903 <ul>
21904 <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>
21905 <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>
21906 </ul>
21907 </div>
21908
21909 <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>
21910 <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>
21911
21912 !! html+tidy
21913 <p></p>
21914 <div id="toc" class="toc">
21915 <div id="toctitle">
21916 <h2>Contents</h2>
21917 </div>
21918 <ul>
21919 <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>
21920 <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>
21921 </ul>
21922 </div>
21923 <p></p>
21924 <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>
21925 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21926 <blockquote>
21927 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21928 </blockquote>
21929 <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>
21930 !! end
21931
21932 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21933 # html5 tag parsing.
21934 !! test
21935 Tags with parameters in TOC
21936 !! options
21937 parsoid=wt2html
21938 !! wikitext
21939 __TOC__
21940 == <sup class="in-h2">Hello</sup> ==
21941
21942 == <sup class="a > b">Evilbye</sup> ==
21943 !! html/php
21944 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21945 <ul>
21946 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21947 <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>
21948 </ul>
21949 </div>
21950
21951 <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>
21952 <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>
21953
21954 !! html/parsoid
21955 <meta property="mw:PageProp/toc" />
21956 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21957
21958 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21959 !! end
21960
21961 !! test
21962 span tags with directionality in TOC
21963 !! wikitext
21964 __TOC__
21965 == <span dir="ltr">C++</span> ==
21966
21967 == <span dir="rtl">זבנג!</span> ==
21968
21969 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21970
21971 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21972
21973 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21974 !! html
21975 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21976 <ul>
21977 <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>
21978 <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>
21979 <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>
21980 <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>
21981 <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>
21982 </ul>
21983 </div>
21984
21985 <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>
21986 <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>
21987 <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>
21988 <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>
21989 <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>
21990
21991 !! end
21992
21993 !! test
21994 Bug 72884: bdi element in ToC
21995 !! wikitext
21996 __TOC__
21997 == <bdi>test</bdi> ==
21998 !! html
21999 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22000 <ul>
22001 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22002 </ul>
22003 </div>
22004
22005 <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>
22006
22007 !! end
22008
22009 !! test
22010 T35715: s/strike element in ToC
22011 !! wikitext
22012 __TOC__
22013 == <s>test</s> test <strike>test</strike> ==
22014 !! html
22015 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22016 <ul>
22017 <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>
22018 </ul>
22019 </div>
22020
22021 <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>
22022
22023 !! end
22024
22025 # Note that the html output does not have the <p></p>, but the
22026 # html+tidy output *does*. This is because the empty <p></p> is
22027 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22028 !! test
22029 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22030 !! wikitext
22031 __TOC__
22032 == x ==
22033 !! html
22034 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22035 <ul>
22036 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22037 </ul>
22038 </div>
22039
22040 <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>
22041
22042 !! html+tidy
22043 <p></p>
22044 <div id="toc" class="toc">
22045 <div id="toctitle">
22046 <h2>Contents</h2>
22047 </div>
22048 <ul>
22049 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22050 </ul>
22051 </div>
22052 <p></p>
22053 <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>
22054 !! end
22055
22056 !! article
22057 MediaWiki:Bug32057
22058 !! text
22059 == {{int:headline_sample}} ==
22060 !! endarticle
22061
22062 !! test
22063 Bug 32057: Title needed when expanding <h> nodes.
22064 !! options
22065 title=[[Main Page]]
22066 !! wikitext
22067 {{int:Bug32057}}
22068 !! html
22069 <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>
22070
22071 !! end
22072
22073 !! test
22074 Strip marker in urlencode
22075 !! wikitext
22076 {{urlencode:x<nowiki/>y}}
22077 {{urlencode:x<nowiki/>y|wiki}}
22078 {{urlencode:x<nowiki/>y|path}}
22079 {{urlencode:x<pre id="one">two</pre>y}}
22080 !! html/php
22081 <p>xy
22082 xy
22083 xy
22084 xy
22085 </p>
22086 !! end
22087
22088 !! test
22089 Strip marker in lc
22090 !! wikitext
22091 {{lc:x<nowiki/>y}}
22092 !! html
22093 <p>xy
22094 </p>
22095 !! end
22096
22097 !! test
22098 Strip marker in uc
22099 !! wikitext
22100 {{uc:x<nowiki/>y}}
22101 !! html
22102 <p>XY
22103 </p>
22104 !! end
22105
22106 !! test
22107 Strip marker in formatNum
22108 !! wikitext
22109 {{formatnum:1<nowiki/>2}}
22110 {{formatnum:1<nowiki/>2|R}}
22111 !! html
22112 <p>12
22113 12
22114 </p>
22115 !! end
22116
22117 !! test
22118 Check noCommafy in formatNum
22119 !! options
22120 language=be-tarask
22121 !! wikitext
22122 {{formatnum:123456.78}}
22123 {{formatnum:123456.78|NOSEP}}
22124 !! html
22125 <p>123 456,78
22126 123456.78
22127 </p>
22128 !! end
22129
22130 !! test
22131 Wrong option for formatNum (bug 56199)
22132 !! wikitext
22133 {{formatnum:1,234.56|Random}}
22134 {{formatnum:1,234.56|EVERYTHING}}
22135 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22136 !! html
22137 <p>1,234.56
22138 1,234.56
22139 1,234.56
22140 </p>
22141 !! end
22142
22143 !! test
22144 Strip marker in grammar
22145 !! options
22146 language=fi
22147 !! wikitext
22148 {{grammar:elative|foo<nowiki/>bar}}
22149 !! html
22150 <p>foobarista
22151 </p>
22152 !! end
22153
22154 !! test
22155 Strip marker in padleft
22156 !! wikitext
22157 {{padleft:|2|x<nowiki/>y}}
22158 !! html
22159 <p>xy
22160 </p>
22161 !! end
22162
22163 !! test
22164 Strip marker in padright
22165 !! wikitext
22166 {{padright:|2|x<nowiki/>y}}
22167 !! html
22168 <p>xy
22169 </p>
22170 !! end
22171
22172 !! test
22173 Strip marker in anchorencode
22174 !! wikitext
22175 {{anchorencode:x<nowiki/>y}}
22176 !! html
22177 <p>xy
22178 </p>
22179 !! end
22180
22181 !! test
22182 nowiki inside link inside heading (bug 18295)
22183 !! wikitext
22184 ==[[foo|x<nowiki>y</nowiki>z]]==
22185 !! html
22186 <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>
22187
22188 !! end
22189
22190 !! test
22191 new support for bdi element (bug 31817)
22192 !! wikitext
22193 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22194 !! html
22195 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22196
22197 !!end
22198
22199 !! test
22200 Ignore pipe between table row attributes
22201 !! wikitext
22202 {|
22203 | quux
22204 |- id=foo | style='color: red'
22205 | bar
22206 |}
22207 !! html
22208 <table>
22209 <tr>
22210 <td> quux
22211 </td></tr>
22212 <tr id="foo" style="color: red">
22213 <td> bar
22214 </td></tr></table>
22215
22216 !! end
22217
22218 !! test
22219 Language parser function
22220 !! wikitext
22221 {{#language:ar}}
22222 !! html
22223 <p>العربية
22224 </p>
22225 !! end
22226
22227 !!test
22228 Padleft and padright as substr
22229 !! wikitext
22230 {{padleft:|3|abcde}}
22231 {{padright:|3|abcde}}
22232 !! html
22233 <p>abc
22234 abc
22235 </p>
22236 !! end
22237
22238 !!test
22239 Special parser function
22240 !! wikitext
22241 {{#special:RandomPage}}
22242 {{#special:BaDtItLe}}
22243 {{#special:Foobar}}
22244 !! html
22245 <p>Special:Random
22246 Special:Badtitle
22247 Special:Foobar
22248 </p>
22249 !! end
22250
22251 !!test
22252 Bug 34939 - Case insensitive link parsing ([HttP://])
22253 !! wikitext
22254 [HttP://MediaWiki.Org/]
22255 !! html/php
22256 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22257 </p>
22258 !! html/parsoid
22259 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22260 !! end
22261
22262 !!test
22263 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22264 !! wikitext
22265 [HttP://MediaWiki.Org/ MediaWiki]
22266 !! html
22267 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22268 </p>
22269 !! end
22270
22271 !!test
22272 Bug 34939 - Case insensitive link parsing (HttP://)
22273 !! wikitext
22274 HttP://MediaWiki.Org/
22275 !! html/php
22276 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22277 </p>
22278 !! html/parsoid
22279 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22280 !! end
22281
22282 !!test
22283 Disable TOC
22284 !! options
22285 notoc
22286 !! wikitext
22287 Lead
22288 == Section 1 ==
22289 == Section 2 ==
22290 == Section 3 ==
22291 == Section 4 ==
22292 == Section 5 ==
22293 !! html
22294 <p>Lead
22295 </p>
22296
22297 <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>
22298 <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>
22299 <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>
22300 <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>
22301 <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>
22302
22303 !! end
22304
22305
22306 ###
22307 ### Parsoid-specific tests
22308 ### Parsoid-PHP parser incompatibilities
22309 ###
22310 !!test
22311 1. SOL-sensitive wikitext tokens as template-args
22312 !!options
22313 parsoid=wt2html,wt2wt
22314 !! wikitext
22315 {{echo|*a}}
22316 {{echo|#a}}
22317 {{echo|:a}}
22318 !! html
22319 <span about="#mwt1" typeof="mw:Transclusion">
22320 </span><ul about="#mwt1"><li>a</li>
22321 </ul>
22322 <span about="#mwt2" typeof="mw:Transclusion">
22323 </span><ol about="#mwt2"><li>a</li>
22324 </ol>
22325 <span about="#mwt3" typeof="mw:Transclusion">
22326 </span><dl about="#mwt3"><dd>a</dd>
22327 </dl>
22328 !!end
22329
22330 #### -----------------------------------------------------------------
22331 #### Parsoid-specific functionality tests
22332 #### -----------------------------------------------------------------
22333
22334 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22335 # We know wt2wt will fail, but we expect selser to pass.
22336 # Due to the nature of our testing, wt2wt and selser tests will enter the
22337 # blacklist and we'll catch selser regressions based on changes to the
22338 # blacklist entries for selser tests.
22339 !! test
22340 1. Bad treebuilder fixup of formatting elt is cleaned up
22341 !! options
22342 parsoid=wt2html,wt2wt
22343 !! wikitext
22344 {|
22345 |
22346 <small>
22347 [[Image:Foobar.jpg|right|Test]]
22348 </small>
22349 |}
22350 !! html/parsoid
22351 <table>
22352 <tbody><tr><td>
22353 <small>
22354 <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>
22355 </small>
22356 </td></tr>
22357 </tbody></table>
22358 !! end
22359
22360 !! test
22361 2. Bad treebuilder fixup of formatting elt is cleaned up
22362 !! options
22363 parsoid=wt2html,wt2wt
22364 !! wikitext
22365 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22366
22367 <small>[[Image:Foobar.jpg|right|300px]]</small>
22368 !! html/parsoid
22369
22370 <p><b>foo</b></p>
22371 <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>
22372 <p><b>bar</b></p>
22373 <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>
22374 !! end
22375
22376 !! test
22377 3. Bad treebuilder fixup of formatting elt is cleaned up
22378 !! options
22379 parsoid=wt2html,wt2wt
22380 !! wikitext
22381 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22382 !! html/parsoid
22383 <p><small><b>foo</b></small></p>
22384 <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>
22385 <p><small><b>bar</b></small></p>
22386 !! end
22387
22388 !! test
22389 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22390 !! options
22391 parsoid=wt2html,wt2wt
22392 !! wikitext
22393 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22394 !! html/parsoid
22395 <p><b><small></small></b></p>
22396 <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>
22397 <p></p>
22398 !! end
22399
22400 #### ----------------------------------------------------------------
22401 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22402 #### tags. Parsoid's output for these tags differs from that of the
22403 #### PHP parser.
22404 #### ----------------------------------------------------------------
22405
22406 !!test
22407 Ref: 1. ref-location should be replaced with an index span
22408 !! wikitext
22409 A <ref>foo</ref>
22410 B <ref name="x">foo</ref>
22411 C <ref name="y" />
22412 <references />
22413 !! html/parsoid
22414 <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>
22415 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>
22416 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>
22417 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22418 <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>
22419 <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>
22420 <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>
22421 </ol>
22422 !!end
22423
22424 !!test
22425 Ref: 2. ref-tags with identical names should all get the same index
22426 !! wikitext
22427 A <ref name="x">foo</ref>
22428 B <ref name="x" />
22429 <references />
22430 !! html/parsoid
22431 <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>
22432 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>
22433 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22434 <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>
22435 </ol>
22436 !!end
22437
22438 !!test
22439 Ref: 3. spaces in ref-names should be ignored
22440 !! wikitext
22441 A <ref name="x">foo</ref>
22442 B <ref name=" x " />
22443 C <ref name= x />
22444 <references />
22445 !! html/parsoid
22446 <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>
22447 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>
22448 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>
22449 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22450 <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>
22451 </ol>
22452 !!end
22453
22454 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22455 !!test
22456 Ref: 4. 'constructor' should be accepted as a valid ref-name
22457 !! wikitext
22458 A <ref name="constructor">foo</ref>
22459 <references />
22460 !! html/parsoid
22461 <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>
22462 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22463 <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>
22464 </ol>
22465 !!end
22466
22467 !!test
22468 Ref: 5. body should accept generic wikitext
22469 !! wikitext
22470 A <ref>
22471 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22472 </ref>
22473
22474 <references />
22475 !! html/parsoid
22476 <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>
22477
22478 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22479 <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>
22480 </span></li>
22481 </ol>
22482 !!end
22483
22484 !!test
22485 Ref: 6. indent-pres should not be output in ref-body
22486 !! wikitext
22487 A <ref>
22488 foo
22489 bar
22490 baz
22491 </ref>
22492
22493 <references />
22494 !! html/parsoid
22495 <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>
22496
22497 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22498 <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
22499 bar
22500 baz
22501 </span></li>
22502 </ol>
22503 !!end
22504
22505 !!test
22506 Ref: 7. No p-wrapping in ref-body
22507 !! wikitext
22508 A <ref>
22509 foo
22510
22511 bar
22512
22513
22514 baz
22515
22516
22517
22518 booz
22519 </ref>
22520
22521 <references />
22522 !! html/parsoid
22523 <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>
22524
22525 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22526 <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
22527
22528 bar
22529
22530
22531 baz
22532
22533
22534
22535 booz
22536 </span></li>
22537 </ol>
22538 !!end
22539
22540 !!test
22541 Ref: 8. transclusion wikitext has lower precedence
22542 !! wikitext
22543 A <ref> foo {{echo|</ref> B C}}
22544
22545 <references />
22546 !! html/parsoid
22547 <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>
22548 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22549 <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>
22550 </ol>
22551 !!end
22552
22553 !!test
22554 Ref: 9. unclosed comments should not leak out of ref-body
22555 !! wikitext
22556 A <ref> foo <!--</ref> B C
22557 <references />
22558 !! html/parsoid
22559 <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>
22560 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22561 <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>
22562 </ol>
22563 !!end
22564
22565 !!test
22566 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22567 !! wikitext
22568 A <ref> <b> foo </ref> B C
22569
22570 <references />
22571 !! html/parsoid
22572 <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>
22573
22574
22575 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22576 <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>
22577 </ol>
22578 !!end
22579
22580 !!test
22581 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22582 !! wikitext
22583 A <ref>foo</ref> B
22584 C <ref>bar</ref> D
22585 <references />
22586 !! html/parsoid
22587 <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
22588 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>
22589 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22590 <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>
22591 <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>
22592 </ol>
22593 !!end
22594
22595 !!test
22596 Ref: 12. ref-tags act as trailing newline migration barrier
22597 !! wikitext
22598 <!--the newline at the end of this line moves out of the p tag-->a
22599
22600 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22601 <ref />
22602
22603 c
22604 <references />
22605 !! html/parsoid
22606 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22607
22608
22609 <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>
22610 <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>
22611
22612 <p>c</p>
22613 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22614 <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>
22615 <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>
22616 !!end
22617
22618 !!test
22619 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22620 !! wikitext
22621 <ref>foo</ref> A
22622 <ref>bar
22623 </ref> B
22624 <references />
22625 !! html/parsoid
22626 <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
22627 <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>
22628 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22629 <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>
22630 <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
22631 </span></li>
22632 </ol>
22633 !!end
22634
22635 ## Roundtripping fails because of nowiki'ing
22636 !! test
22637 Ref: 14. A nested ref-tag should be emitted as plain text
22638 !! options
22639 parsoid=wt2html
22640 !! wikitext
22641 <ref>foo <ref>bar</ref> baz</ref>
22642
22643 <references />
22644 !! html/parsoid
22645 <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>
22646
22647 <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>
22648 !! end
22649
22650 !!test
22651 Ref: 15. ref-tags with identical names should get identical indexes
22652 !! wikitext
22653 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22654 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22655
22656 <references />
22657 !! html/parsoid
22658 <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>
22659 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>
22660
22661 <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>
22662 </ol>
22663 !!end
22664
22665 ## We don't bother wt2wt-ing non-standard whitespace
22666 !!test
22667 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22668 !!options
22669 parsoid=wt2html
22670 !! wikitext
22671 A <ref >foo</ref >
22672
22673 <references />
22674 !! html/parsoid
22675 <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>
22676 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22677 <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>
22678 !!end
22679
22680 !!test
22681 Ref: 17. Generate valid HTML5 id/about attributes
22682 !!wikitext
22683 <ref name="a b">foo</ref>
22684
22685 <references />
22686 !!html/parsoid
22687 <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>
22688 </p>
22689
22690 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22691 <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>
22692 </ol>
22693 !!end
22694
22695 !!test
22696 Ref: 18. T58916: Extension attributes should be parsed as plain text
22697 !!wikitext
22698 <ref name="{{echo|a}}">foo</ref>
22699
22700 <references />
22701 !!html/parsoid
22702 <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>
22703 </p>
22704
22705 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22706 <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>
22707 </ol>
22708 !!end
22709
22710 !!test
22711 Ref: 19. ref-tags with identical name encodings should get identical indexes
22712 !! wikitext
22713 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22714
22715 <references />
22716 !! html/parsoid
22717 <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>
22718 </p>
22719 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22720 <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>
22721 </ol>
22722 !!end
22723
22724 !!test
22725 Ref: 20. ref-tags with identical names but different content should keep it
22726 !! wikitext
22727 A <ref name="foo">Foo one</ref>
22728 B <ref name="foo">Foo two</ref>
22729 C <ref name="foo" />
22730
22731 <references />
22732 !! html/parsoid
22733 <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>
22734 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>
22735 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>
22736
22737 <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>
22738 </ol>
22739 !!end
22740
22741 !!test
22742 References: 1. references tag without any refs should be handled properly
22743 !! wikitext
22744 <references />
22745 !! html/parsoid
22746 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22747 !!end
22748
22749 !!test
22750 References: 2. references tag with group only outputs references from that group
22751 !! wikitext
22752 A <ref group="a">foo</ref>
22753 B <ref group="b">bar</ref>
22754 C <ref>baz</ref>
22755
22756 <references group="a" />
22757 <references />
22758 <references group="b" />
22759 !! html/parsoid
22760 <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>
22761 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>
22762 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>
22763
22764 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22765 <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>
22766 </ol>
22767 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22768 <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>
22769 </ol>
22770 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22771 <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>
22772 </ol>
22773 !!end
22774
22775 !!test
22776 References: 3. ref list should be cleared after processing references
22777 !! wikitext
22778 A <ref>foo</ref>
22779
22780 <references />
22781
22782 B <ref>bar</ref>
22783
22784 <references />
22785 !! html/parsoid
22786 <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>
22787
22788 <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>
22789 </ol>
22790
22791 <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>
22792
22793 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22794 <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>
22795 </ol>
22796 !!end
22797
22798 !!test
22799 References: 4. only referenced group should be cleared after processing references
22800 !! wikitext
22801 A <ref group="a">afoo</ref>
22802 B <ref>bfoo</ref>
22803
22804 <references group="a" />
22805
22806 C <ref>cfoo</ref>
22807
22808 <references />
22809 !! html/parsoid
22810 <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>
22811 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>
22812
22813 <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>
22814 </ol>
22815
22816 <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>
22817
22818 <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>
22819 </ol>
22820 !!end
22821
22822 ## Don't expect this to rt since we're dropping content
22823 !! test
22824 References: 5. ref tags in references should be processed while ignoring all other content
22825 !! options
22826 parsoid=wt2html,html2html
22827 !! wikitext
22828 A <ref name="a" />
22829 B <ref name="b">bar</ref>
22830
22831 <references>
22832 <ref name="a">foo</ref>
22833 This should just get lost.
22834 </references>
22835 !! html/parsoid
22836 <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>
22837 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>
22838
22839
22840 <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>
22841 </ol>
22842 !! end
22843
22844 !! test
22845 References: 6. <references /> from a transclusion
22846 !! wikitext
22847 <ref>Foo</ref> {{echo|<references />}}
22848 !! html/parsoid
22849 <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>
22850 </ol>
22851 !! end
22852
22853 !! test
22854 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22855 !! wikitext
22856 A <ref>foo bar for a</ref>
22857 B <ref group="X" name="b" />
22858
22859 <references />
22860
22861 <references group="X">
22862 <ref name="b">foo</ref>
22863 </references>
22864 !! html/parsoid
22865 <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>
22866 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>
22867 </p>
22868
22869 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22870 <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>
22871 </ol>
22872
22873 <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"}}'>
22874 <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>
22875 </ol>
22876 !! end
22877
22878 !! test
22879 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22880 !! wikitext
22881 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22882 <references />
22883 !! html/parsoid
22884 <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>
22885 <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>
22886 </ol>
22887 !!end
22888
22889 # This test only works in wt2html now as the <references /> are always generated
22890 # unless selser is active. Once T72722 is fixed, we should add a changes test
22891 # here to ensure that unrelated changes don't add the new <references />
22892 # when selser is active.
22893 !! test
22894 References: 9. Generate missing references list at the end
22895 !! wikitext
22896 A <ref>foo</ref>
22897 B <ref group="inexistent">bar</ref>
22898 !! html/parsoid
22899 <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>
22900 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22901 <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>
22902 </ol>
22903 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22904 <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>
22905 </ol>
22906 !! end
22907
22908 !! test
22909 References: 10. New <references/> shouldn't be added for unrelated edits.
22910 !! options
22911 parsoid={
22912 "modes": ["selser"],
22913 "changes": [["#x", "remove"]],
22914 "selser": "noauto"
22915 }
22916 !! wikitext
22917 Unrelated text<span id="x"> that's going to disappear</span>.
22918 A <ref>foo</ref>
22919 !! wikitext/edited
22920 Unrelated text.
22921 A <ref>foo</ref>
22922 !!end
22923
22924 !! test
22925 Entities in ref name
22926 !! wikitext
22927 <ref name="test &amp; me">hi</ref>
22928 <references />
22929 !! html/parsoid
22930 <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>
22931 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22932 <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>
22933 </ol>
22934 !! end
22935
22936 ## The output here may look funny, but it's what the php parser will do. The
22937 ## unclosed references tag becomes escaped text, and then a new references
22938 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22939 ## nowiki tags, and the auto-generated references tag is only dropped in
22940 ## rtTestMode.
22941 !! test
22942 Generate references for unclosed references tag
22943 !! options
22944 parsoid=wt2html
22945 !! wikitext
22946 a<ref>foo</ref>
22947
22948 <references>
22949 !! html/parsoid
22950 <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>
22951
22952 <p>&lt;references></p>
22953 <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>
22954 !! end
22955
22956 !! test
22957 New reference serializes on its own line
22958 !! options
22959 parsoid=wt2wt,html2wt
22960 !! wikitext
22961 foo
22962 <references />
22963 !! html/parsoid
22964 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22965 !! end
22966
22967 #--------- Test stripping of empty nodes in template content ----------
22968 !!test
22969 Empty LI and TR nodes should be stripped from template content
22970 !!wikitext
22971 {{EmptyLITest}}
22972 {{EmptyTRTest}}
22973 !!html/parsoid
22974 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22975 <li>a</li>
22976 <li>b</li>
22977 </ul>
22978 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22979 <tbody>
22980 <tr>
22981 <td>foo</td>
22982 </tr>
22983 <tr>
22984 <td>bar</td>
22985 </tr>
22986 </tbody>
22987 </table>
22988 !!end
22989
22990 !!test
22991 Empty LI and TR nodes should not be stripped from top-level content
22992 !!wikitext
22993 * a
22994 *
22995 * b
22996 {|
22997 |-
22998 |-
22999 |foo
23000 |}
23001 !!html/parsoid
23002 <ul>
23003 <li> a</li>
23004 <li></li>
23005 <li> b</li>
23006 </ul>
23007 <table>
23008 <tbody>
23009 <tr></tr>
23010 <tr>
23011 <td>foo</td>
23012 </tr>
23013 </tbody>
23014 </table>
23015 !!end
23016
23017 !!test
23018 Empty TR nodes should not be stripped if they have any attributes set
23019 !!wikitext
23020 {{EmptyTRWithHTMLAttrTest}}
23021 !!html/parsoid
23022 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23023 <tr align="center"></tr>
23024 <tr><td>foo</td></tr>
23025 <tr align="center"></tr>
23026 <tr><td>bar</td></tr>
23027 </table>
23028 !!end
23029
23030 #### ----------------------------------------------------------------
23031 #### The following section of tests are primarily to test
23032 #### wikitext escaping capabilities of Parsoid. Given that
23033 #### escaping can be done any number of ways, the wikitext (input)
23034 #### is always adjusted to reflect how Parsoid adds nowiki
23035 #### escape tags.
23036 ####
23037 #### We are marking several tests as parsoid-only since the
23038 #### HTML in the result section is different from what the
23039 #### PHP parser generates for it.
23040 #### ----------------------------------------------------------------
23041
23042
23043 #### --------------- Headings ---------------
23044 #### 0. Unnested
23045 #### 1. Nested inside html <h1>=foo=</h1>
23046 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23047 #### 3. Nested inside html with wikitext split by html tags
23048 #### 4. No escape needed
23049 #### 5. Empty headings <h1></h1>
23050 #### 6. Heading chars in SOL context
23051 #### ----------------------------------------
23052 !! test
23053 Headings: 0. Unnested
23054 !! options
23055 parsoid=html2wt
23056 !! html/parsoid
23057 <p>=foo=</p>
23058
23059 <p> =foo=
23060 <!--cmt-->
23061 =foo=</p>
23062
23063 <p>=foo<i>a</i>=</p>
23064 !! wikitext
23065 <nowiki>=foo=</nowiki>
23066
23067 <nowiki> </nowiki>=foo=
23068 <!--cmt-->
23069 <nowiki>=foo=</nowiki>
23070
23071 =foo''a''<nowiki>=</nowiki>
23072 !!end
23073
23074 # New headings and existing headings are handled differently
23075 !! test
23076 Headings: 1. Nested inside html
23077 !! options
23078 parsoid=html2wt
23079 !! html/parsoid
23080 <h1>=foo=</h1>
23081 <h2>=foo=</h2>
23082 <h3>=foo=</h3>
23083
23084 <h1 data-parsoid=''>=foo=</h1>
23085 <h2 data-parsoid=''>=foo=</h2>
23086 <h3 data-parsoid=''>=foo=</h3>
23087 <h4 data-parsoid=''>=foo=</h4>
23088 <h5 data-parsoid=''>=foo=</h5>
23089 <h6 data-parsoid=''>=foo=</h6>
23090 !! wikitext
23091 = =foo= =
23092
23093 == =foo= ==
23094
23095 === =foo= ===
23096
23097 =<nowiki>=foo=</nowiki>=
23098 ==<nowiki>=foo=</nowiki>==
23099 ===<nowiki>=foo=</nowiki>===
23100 ====<nowiki>=foo=</nowiki>====
23101 =====<nowiki>=foo=</nowiki>=====
23102 ======<nowiki>=foo=</nowiki>======
23103
23104 !!end
23105
23106 !! test
23107 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23108 !! options
23109 parsoid=html2wt
23110 !! html/parsoid
23111 <h1>foo</h1>*bar
23112 <h1>foo</h1>=bar
23113 <h1>foo</h1>=bar=
23114 !! wikitext
23115 = foo =
23116 <nowiki>*</nowiki>bar
23117
23118 = foo =
23119 =bar
23120
23121 = foo =
23122 <nowiki>=bar=</nowiki>
23123 !!end
23124
23125 !! test
23126 Headings: 3. Nested inside html with wikitext split by html tags
23127 !! options
23128 parsoid=html2wt
23129 !! html/parsoid
23130 <h1>=<b>bold</b>foo=</h1>
23131 !! wikitext
23132 = ='''bold'''foo= =
23133 !!end
23134
23135 !! test
23136 Headings: 4a. No escaping needed (testing just h1 and h2)
23137 !! options
23138 parsoid=html2wt
23139 !! html/parsoid
23140 <h1>=foo</h1>
23141 <h1>foo=</h1>
23142 <h1> =foo= </h1>
23143 <h1>=foo= bar</h1>
23144 <h2>=foo</h2>
23145 <h2>foo=</h2>
23146 <h1>=</h1>
23147 <h1><i>=</i>foo=</h1>
23148 !! wikitext
23149 = =foo =
23150
23151 = foo= =
23152
23153 = =foo= =
23154
23155 = =foo= bar =
23156
23157 == =foo ==
23158
23159 == foo= ==
23160
23161 = = =
23162
23163 = ''=''foo= =
23164 !!end
23165
23166 !! test
23167 Headings: 4b. No escaping needed (inside p-tags)
23168 !! options
23169 parsoid=html2wt
23170 !! html/parsoid
23171 <p>===
23172 =foo= x
23173 =foo= <s></s>
23174 </p>
23175 !! wikitext
23176 ===
23177 =foo= x
23178 =foo= <s></s>
23179 !!end
23180
23181 !! test
23182 Headings: 5. Empty headings
23183 !! options
23184 parsoid=html2wt
23185 !! html/parsoid
23186 <h1 data-parsoid='{}'></h1>
23187
23188 <h2 data-parsoid='{}'></h2>
23189
23190 <h3 data-parsoid='{}'></h3>
23191
23192 <h4 data-parsoid='{}'></h4>
23193
23194 <h5 data-parsoid='{}'></h5>
23195
23196 <h6 data-parsoid='{}'></h6>
23197 !! wikitext
23198 =<nowiki/>=
23199
23200 ==<nowiki/>==
23201
23202 ===<nowiki/>===
23203
23204 ====<nowiki/>====
23205
23206 =====<nowiki/>=====
23207
23208 ======<nowiki/>======
23209 !!end
23210
23211 !! test
23212 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23213 !! options
23214 parsoid=html2wt
23215 !! html/parsoid
23216 <p>=a=</p>
23217
23218 <p>=a=</p>
23219
23220 <p>=a=</p>
23221 !! wikitext
23222 <nowiki>=a=</nowiki>
23223
23224 <nowiki>=a=</nowiki>
23225
23226 <nowiki>=a=</nowiki>
23227 !!end
23228
23229 !! test
23230 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23231 !! options
23232 parsoid=html2wt
23233 !! html/parsoid
23234 <p>=a=
23235 b</p>
23236
23237 <p>=a=
23238 b</p>
23239
23240 <p>=a=
23241 b</p>
23242 !! wikitext
23243 <nowiki>=a=</nowiki>
23244 b
23245
23246 <nowiki>=a=</nowiki>
23247 b
23248
23249 <nowiki>=a=</nowiki>
23250 b
23251 !!end
23252
23253 !! test
23254 Headings: 6c. Heading chars in SOL context (leading newline break)
23255 !! options
23256 parsoid=html2wt
23257 !! html/parsoid
23258 <p>a
23259 =b=</p>
23260 !! wikitext
23261 a
23262 <nowiki>=b=</nowiki>
23263 !!end
23264
23265 !! test
23266 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23267 !! options
23268 parsoid=html2wt
23269 !! html/parsoid
23270 <!--c0--><p>=a=</p>
23271
23272 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23273 !! wikitext
23274 <!--c0--><nowiki>=a=</nowiki>
23275
23276 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23277 !!end
23278
23279 !! test
23280 Headings: 6d. Heading chars in SOL context (No escaping needed)
23281 !! options
23282 parsoid=html2wt
23283 !! html/parsoid
23284 =a=<div>b</div>
23285 !! wikitext
23286 =a=<div>b</div>
23287 !!end
23288
23289 !! test
23290 Headings: 7. Insert a newline between new content and headings
23291 !! options
23292 parsoid=html2wt
23293 !! html/parsoid
23294 <h2>NEW</h2>
23295 <p>new</p>
23296 <h2 data-parsoid='{}'>A</h2>
23297 <p data-parsoid='{}'>a</p>
23298 !! wikitext
23299 == NEW ==
23300 new
23301
23302 ==A==
23303 a
23304
23305 !! end
23306
23307 #### --------------- Lists ---------------
23308 #### 0. Outside nests (*foo, etc.)
23309 #### 1. Nested inside html <ul><li>*foo</li></ul>
23310 #### 2. Inside definition lists
23311 #### 3. Only bullets at start should be escaped
23312 #### 4. No escapes needed
23313 #### 5. No unnecessary escapes
23314 #### 6. Escape bullets in SOL position
23315 #### 7. Escape bullets in a multi-line context
23316 #### ----------------------------------------
23317
23318 !! test
23319 Lists: 0. Outside nests
23320 !! options
23321 parsoid=html2wt
23322 !! html/parsoid
23323 <p>*foo</p>
23324
23325 <p>#foo</p>
23326
23327 <p>;Foo:bar</p>
23328 !! wikitext
23329 <nowiki>*</nowiki>foo
23330
23331 <nowiki>#</nowiki>foo
23332
23333 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23334 !!end
23335
23336 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23337 ## to test wikitext escaping, and insignificant whitespace diffs
23338 ## cause PHP parser tests to barf
23339 !! test
23340 Lists: 1. Nested inside html (No unnecessary escapes)
23341 !! options
23342 parsoid=html2wt
23343 !! html/parsoid
23344 <ul>
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 </ul>
23354
23355 <ol>
23356 <li>*foo</li>
23357 <li>#foo</li>
23358 <li>:foo</li>
23359 <li>;foo</li>
23360 <li data-parsoid='{}'>*foo</li>
23361 <li data-parsoid='{}'>#foo</li>
23362 <li data-parsoid='{}'>:foo</li>
23363 <li data-parsoid='{}'>;foo</li>
23364 </ol>
23365 !! wikitext
23366 * *foo
23367 * #foo
23368 * :foo
23369 * ;foo
23370 *<nowiki>*foo</nowiki>
23371 *<nowiki>#foo</nowiki>
23372 *<nowiki>:foo</nowiki>
23373 *<nowiki>;foo</nowiki>
23374
23375 # *foo
23376 # #foo
23377 # :foo
23378 # ;foo
23379 #<nowiki>*foo</nowiki>
23380 #<nowiki>#foo</nowiki>
23381 #<nowiki>:foo</nowiki>
23382 #<nowiki>;foo</nowiki>
23383 !!end
23384
23385 !! test
23386 Lists: 2. Inside definition lists
23387 !! options
23388 parsoid=html2wt
23389 !! html/parsoid
23390 <dl><dt>;foo</dt></dl>
23391 <dl><dt>:foo</dt></dl>
23392 <dl><dt>:foo</dt>
23393 <dd>bar</dd></dl>
23394 <dl><dd>:foo</dd></dl>
23395 !! wikitext
23396 ; ;foo
23397
23398 ; <nowiki>:foo</nowiki>
23399
23400 ; <nowiki>:foo</nowiki>
23401 : bar
23402
23403 : :foo
23404 !!end
23405
23406 !! test
23407 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23408 !! options
23409 parsoid=html2wt
23410 !! html/parsoid
23411 <ul>
23412 <li>*foo*bar</li>
23413 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23414 </ul>
23415 !! wikitext
23416 * *foo*bar
23417 *<nowiki>*foo</nowiki>''it''*bar
23418 !!end
23419
23420 !! test
23421 Lists: 4. No escapes needed
23422 !! options
23423 parsoid=html2wt
23424 !! html/parsoid
23425 <ul>
23426 <li>foo*bar
23427 </li>
23428 </ul>
23429 <ul>
23430 <li><i>foo</i>*bar
23431 </li>
23432 </ul>
23433 <ul>
23434 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23435 </li>
23436 </ul>
23437 <ul>
23438 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23439 </li>
23440 </ul>
23441 !! wikitext
23442 *foo*bar
23443
23444 *''foo''*bar
23445
23446 *[[Foo]]: bar
23447
23448 *[[Foo]]*bar
23449 !!end
23450
23451 !! test
23452 Lists: 5. No unnecessary escapes
23453 !! options
23454 parsoid=html2wt
23455 !! html/parsoid
23456 <ul><li> bar <span>[[foo]]</span></li></ul>
23457 <ul><li> =bar <span>[[foo]]</span></li></ul>
23458 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23459 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23460 <ul><li> =bar <span>foo]]</span>=</li></ul>
23461 <ul><li> <s></s>: a</li></ul>
23462 <ul><li> <i>* foo</i></li></ul>
23463
23464 !! wikitext
23465 * bar <span><nowiki>[[foo]]</nowiki></span>
23466
23467 * =bar <span><nowiki>[[foo]]</nowiki></span>
23468
23469 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23470
23471 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23472
23473 * =bar <span>foo]]</span>=
23474
23475 * <s></s>: a
23476
23477 * ''* foo''
23478 !!end
23479
23480 !! test
23481 Lists: 6. Escape bullets in SOL position
23482 !! options
23483 parsoid=html2wt
23484 !! html/parsoid
23485 <p><!--cmt-->*foo</p>
23486 !! wikitext
23487 <!--cmt--><nowiki>*</nowiki>foo
23488 !!end
23489
23490 !! test
23491 Lists: 7. Escape bullets in a multi-line context
23492 !! options
23493 parsoid=html2wt
23494 !! html/parsoid
23495 <p>a
23496 *b
23497 </p>
23498 !! wikitext
23499 a
23500 <nowiki>*</nowiki>b
23501 !!end
23502
23503 !! test
23504 Lists: 8. Escape colons only if not present in tags
23505 !! options
23506 parsoid=html2wt
23507 !! html/parsoid
23508 <dl><dt>a:b<i>c:d</i></dt></dl>
23509 !! wikitext
23510 ; <nowiki>a:b</nowiki>''c:d''
23511 !! end
23512
23513 #### --------------- HRs ---------------
23514 #### 1. Single line
23515 #### -----------------------------------
23516
23517 !! test
23518 HRs: 1. Single line
23519 !! options
23520 parsoid=html2wt
23521 !! html/parsoid
23522 <hr />----
23523 <hr />=foo=
23524 <hr />*foo
23525 !! wikitext
23526 ----<nowiki>----</nowiki>
23527 ----=foo=
23528 ----*foo
23529 !! end
23530
23531 #### --------------- Tables ---------------
23532 #### 1a. Simple example
23533 #### 1b. No escaping needed (!foo)
23534 #### 1c. No escaping needed (|foo)
23535 #### 1d. No escaping needed (|}foo)
23536 ####
23537 #### 2a. Nested in td (<td>foo|bar</td>)
23538 #### 2b. Nested in td (<td>foo||bar</td>)
23539 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23540 ####
23541 #### 3a. Nested in th (<th>foo!bar</th>)
23542 #### 3b. Nested in th (<th>foo!!bar</th>)
23543 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23544 ####
23545 #### 4a. Escape -
23546 #### 4b. Escape +
23547 #### 4c. No escaping needed
23548 #### --------------------------------------
23549
23550 !! test
23551 Tables: 1a. Simple example
23552 !! options
23553 parsoid=html2wt
23554 !! html/parsoid
23555 <p>{|
23556 |}
23557 </p>
23558 !! wikitext
23559 <nowiki>{|</nowiki>
23560 |}
23561 !! end
23562
23563 !! test
23564 Tables: 1b. 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: 1c. 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: 1d. No escaping needed
23587 !! options
23588 parsoid=html2wt
23589 !! html/parsoid
23590 <p>|}foo
23591 </p>
23592 !! wikitext
23593 |}foo
23594 !! end
23595
23596 !! test
23597 Tables: 2a. Nested in td
23598 !! options
23599 parsoid=html2wt
23600 !! html/parsoid
23601 <table><tbody><tr>
23602 <td>foo|bar</td></tr>
23603 <tr><td>x<div>a|b</div></td>
23604 </tbody></table>
23605 !! wikitext
23606 {|
23607 |<nowiki>foo|bar</nowiki>
23608 |-
23609 |x<div><nowiki>a|b</nowiki></div>
23610 |}
23611 !! html/php+tidy
23612 <table>
23613 <tr>
23614 <td>foo|bar</td>
23615 </tr>
23616 <tr>
23617 <td>x
23618 <div>a|b</div>
23619 </td>
23620 </tr>
23621 </table>
23622 !! end
23623
23624 !! test
23625 Tables: 2b. Nested in td
23626 !! options
23627 parsoid=html2wt
23628 !! html/parsoid
23629 <table><tbody><tr>
23630 <td>foo||bar</td>
23631 <td>a<i>b||c</i></td>
23632 <td>a<i><div>b||c</div></i></td>
23633 </tr></tbody></table>
23634 !! wikitext
23635 {|
23636 |<nowiki>foo||bar</nowiki>
23637 |a''<nowiki>b||c</nowiki>''
23638 |a''<div><nowiki>b||c</nowiki></div>''
23639 |}
23640 !! html/php
23641 <table>
23642 <tr>
23643 <td>foo||bar
23644 </td>
23645 <td>a<i>b||c</i>
23646 </td>
23647 <td>a<i><div>b||c</div></i>
23648 </td></tr></table>
23649
23650 !! end
23651
23652 !! test
23653 Tables: 2c. Nested in td -- no escaping needed
23654 !! options
23655 parsoid=html2wt
23656 !! html/*
23657 <table>
23658 <tr>
23659 <td>foo!!bar
23660 </td></tr></table>
23661
23662 !! wikitext
23663 {|
23664 |foo!!bar
23665 |}
23666 !! end
23667
23668 !! test
23669 Tables: 3a. Nested in th
23670 !! options
23671 parsoid=html2wt
23672 !! html/*
23673 <table>
23674 <tr>
23675 <th>foo!bar
23676 </th></tr></table>
23677
23678 !! wikitext
23679 {|
23680 !foo!bar
23681 |}
23682 !! end
23683
23684 !! test
23685 Tables: 3b. Nested in th
23686 !! options
23687 parsoid=html2wt
23688 !! html/parsoid
23689 <table><tbody>
23690 <tr><th>foo!!bar</th>
23691 <th><i>foo|bar</i></th>
23692 <th><i>foo!!bar</i></th>
23693 <th><i><span>foo!!bar</span></i></th>
23694 </tr></tbody></table>
23695 !! wikitext
23696 {|
23697 !<nowiki>foo!!bar</nowiki>
23698 !''<nowiki>foo|bar</nowiki>''
23699 !''<nowiki>foo!!bar</nowiki>''
23700 !''<span><nowiki>foo!!bar</nowiki></span>''
23701 |}
23702 !! html/php
23703 <table>
23704 <tr>
23705 <th>foo!!bar
23706 </th>
23707 <th><i>foo|bar</i>
23708 </th>
23709 <th><i>foo!!bar</i>
23710 </th>
23711 <th><i><span>foo!!bar</span></i>
23712 </th></tr></table>
23713
23714 !! end
23715
23716 !! test
23717 Tables: 3c. Nested in th
23718 !! options
23719 parsoid=html2wt
23720 !! html/parsoid
23721 <table><tbody>
23722 <tr><th>foo||bar</th>
23723 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23724 </tr></tbody></table>
23725 !! wikitext
23726 {|
23727 !<nowiki>foo||bar</nowiki>
23728 !<nowiki>foo||bar</nowiki>
23729 |}
23730 !! html/php
23731 <table>
23732 <tr>
23733 <th>foo||bar
23734 </th>
23735 <th>foo||bar
23736 </th></tr></table>
23737
23738 !! end
23739
23740 !! test
23741 Tables: 4a. Escape -
23742 !! options
23743 parsoid=html2wt
23744 !! html/*
23745 <table>
23746 <tr>
23747 <th>-bar
23748 </th></tr>
23749 <tr>
23750 <td>-bar
23751 </td></tr></table>
23752
23753 !! wikitext
23754 {|
23755 !-bar
23756 |-
23757 |<nowiki>-bar</nowiki>
23758 |}
23759 !! end
23760
23761 !! test
23762 Tables: 4b. Escape +
23763 !! options
23764 parsoid=html2wt
23765 !! html/*
23766 <table>
23767 <tr>
23768 <th>+bar
23769 </th></tr>
23770 <tr>
23771 <td>+bar
23772 </td></tr></table>
23773
23774 !! wikitext
23775 {|
23776 !+bar
23777 |-
23778 |<nowiki>+bar</nowiki>
23779 |}
23780 !! end
23781
23782 !! test
23783 Tables: 4c. No escaping needed
23784 !! options
23785 parsoid=html2wt
23786 !! html/parsoid
23787 <table><tbody>
23788 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23789 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23790 <tr><td>foo
23791 <p>bar|baz
23792 +bar
23793 -bar</p></td></tr>
23794 <tr><td>x
23795 <div>a|b</div></td>
23796 </tbody></table>
23797 !! wikitext
23798 {|
23799 |foo-bar
23800 |foo+bar
23801 |-
23802 |''foo''-bar
23803 |''foo''+bar
23804 |-
23805 |foo
23806 bar|baz
23807 +bar
23808 -bar
23809 |-
23810 |x
23811 <div>a|b</div>
23812 |}
23813 !! html/php
23814 <table>
23815 <tr>
23816 <td>foo-bar
23817 </td>
23818 <td>foo+bar
23819 </td></tr>
23820 <tr>
23821 <td><i>foo</i>-bar
23822 </td>
23823 <td><i>foo</i>+bar
23824 </td></tr>
23825 <tr>
23826 <td>foo
23827 <p>bar|baz
23828 +bar
23829 -bar
23830 </p>
23831 </td></tr>
23832 <tr>
23833 <td>x
23834 <div>a|b</div>
23835 </td></tr></table>
23836
23837 !! end
23838
23839 !! test
23840 Tables: 4d. No escaping needed
23841 !! options
23842 parsoid=html2wt
23843 !! html/parsoid
23844 <table>
23845 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23846 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23847 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23848 </tbody></table>
23849 !! wikitext
23850 {|
23851 |[[Foo]]-bar
23852 ||+1
23853 ||-2
23854 |}
23855 !! html/php
23856 <table>
23857 <tr>
23858 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23859 </td>
23860 <td>+1
23861 </td>
23862 <td>-2
23863 </td></tr></table>
23864
23865 !! end
23866
23867 !! test
23868 T97430: Don't emit empty nowiki pairs around marker meta tags
23869 !! options
23870 parsoid=html2wt
23871 !! html/parsoid
23872 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23873 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23874 !! wikitext
23875 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23876 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23877 !! end
23878
23879 !! test
23880 Unclosed xmlish element in table line shouldn't eat end delimiters
23881 !! options
23882 parsoid=html2wt
23883 !! html/parsoid
23884 <table>
23885 <tbody><tr><td> &lt;foo</td>
23886 <td> bar></td></tr>
23887 </tbody></table>
23888 !! wikitext
23889 {|
23890 | <foo
23891 | bar>
23892 |}
23893 !! html/php
23894 <table>
23895 <tr>
23896 <td> &lt;foo
23897 </td>
23898 <td> bar&gt;
23899 </td></tr></table>
23900
23901 !! end
23902
23903 #### --------------- Links ----------------
23904 #### 1. Quote marks in link text
23905 #### 2. Wikilinks: Escapes needed
23906 #### 3. Wikilinks: No escapes needed
23907 #### 4. Extlinks: Escapes needed
23908 #### 5. Extlinks: No escapes needed
23909 #### --------------------------------------
23910 !! test
23911 Links 1. WikiLinks: No escapes needed
23912 !! options
23913 parsoid=html2wt
23914 !! html/parsoid
23915 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23916 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23917 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23918 !! wikitext
23919 [[Foo|Foo''boo'']]
23920 [[Foo|[Foobar]]]
23921 [[Foo|x [Foobar] x]]
23922 !! html/php
23923 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23924 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23925 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23926 </p>
23927 !! end
23928
23929 !! test
23930 Links 2. WikiLinks: Escapes needed
23931 !! options
23932 parsoid=html2wt
23933 !! html/parsoid
23934 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23935 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23936 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23937 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23938 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23939 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23940 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23941 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23942 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23943 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23944 !! wikitext
23945 [[Foo|<nowiki>Foobar]</nowiki>]]
23946 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23947 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23948 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23949 [[Foo|<nowiki>|Bar</nowiki>]]
23950 [[Foo|<nowiki>]]bar</nowiki>]]
23951 [[Foo|<nowiki>[[bar</nowiki>]]
23952 [[Foo|<nowiki>x [[ y</nowiki>]]
23953 [[Foo|<nowiki>x ]] y</nowiki>]]
23954 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23955 !! html/php
23956 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23957 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23958 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23959 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23960 <a href="/wiki/Foo" title="Foo">|Bar</a>
23961 <a href="/wiki/Foo" title="Foo">]]bar</a>
23962 <a href="/wiki/Foo" title="Foo">[[bar</a>
23963 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23964 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23965 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23966 </p>
23967 !! end
23968
23969 !! test
23970 Links 3. WikiLinks: No escapes needed
23971 !! options
23972 parsoid=html2wt
23973 !! html/parsoid
23974 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23975 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23976 !! wikitext
23977 [[Foo|[Foobar]]
23978 [[Foo|foo|bar]]
23979 !! html/php
23980 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23981 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23982 </p>
23983 !! end
23984
23985 !! test
23986 Links 4. ExtLinks: Escapes needed
23987 !! options
23988 parsoid=html2wt
23989 !! html/parsoid
23990 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23991 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23992 <p>[http://google.com]</p>
23993 <p>[http://google.com google]</p>
23994 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23995 <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>
23996 !! wikitext
23997 [http://google.com <nowiki>[google]</nowiki>]
23998 [http://google.com <nowiki>google]</nowiki>]
23999
24000 <nowiki>[http://google.com]</nowiki>
24001
24002 <nowiki>[http://google.com google]</nowiki>
24003
24004 [http://google.com<nowiki>]</nowiki>
24005
24006 [{{echo|http://google.com}}<nowiki>]</nowiki>
24007 !! html/php
24008 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24009 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24010 </p><p>[http://google.com]
24011 </p><p>[http://google.com google]
24012 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24013 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24014 </p>
24015 !! end
24016
24017 !! test
24018 Links 5. ExtLinks: No escapes needed
24019 !! options
24020 parsoid=html2wt
24021 !! html/parsoid
24022 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24023 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24024 !! wikitext
24025 [http://google.com [google]
24026
24027 [[http://google.com]]
24028 !! html/php
24029 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24030 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24031 </p>
24032 !! end
24033
24034 !! test
24035 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24036 !! options
24037 parsoid=html2wt
24038 !! html/parsoid
24039 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24040 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24041 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24042 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24043 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24044 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24045 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24046 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24047 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24048 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24049 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24050 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24051 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24052 </p>
24053 !! wikitext
24054 x<nowiki/>http://example.com<nowiki/>y
24055 http://example.com<nowiki/>?x
24056 http://example.com<nowiki/>&x
24057 http://example.com<nowiki/>'x
24058 http://example.com<nowiki/>,x
24059 http://example.com<nowiki/>.x
24060 http://example.com<nowiki/>;x
24061 http://example.com<nowiki/>:x
24062 http://example.com<nowiki/>;x
24063 http://example.com<nowiki/>!x
24064 http://example.com<nowiki/>=x
24065 http://example.com<nowiki/>(x)
24066 http://example.com(x<nowiki/>)
24067 !! end
24068
24069 !! test
24070 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24071 !! options
24072 parsoid=html2wt
24073 !! html/parsoid
24074 <p>x
24075 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24076 y
24077 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24078 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24079 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24080 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24081 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24082 </p>
24083 !! wikitext
24084 x
24085 http://example.com
24086 y
24087 "http://example.com"
24088 (http://example.com)
24089 (http://example.com) foo
24090 http://example.com,
24091 http://example.com, foo
24092 !! html/php
24093 <p>x
24094 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24095 y
24096 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24097 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24098 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24099 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24100 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24101 </p>
24102 !! end
24103
24104 !! test
24105 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24106 !! options
24107 parsoid=html2wt
24108 !! html/parsoid
24109 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24110 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24111 !! wikitext
24112 http://example.com.,;:!?\
24113 -http://example.com:
24114 !! html/php
24115 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24116 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24117 </p>
24118 !! end
24119
24120 !! test
24121 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24122 !! options
24123 parsoid=html2wt
24124 !! html/parsoid
24125 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24126 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24127 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24128 !! wikitext
24129 RFC 123<nowiki/>4
24130 RFC 123<nowiki/>y
24131 X<nowiki/>RFC 123<nowiki/>y
24132 !! end
24133
24134 !! test
24135 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24136 !! options
24137 parsoid=html2wt
24138 !! html/parsoid
24139 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24140 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24141 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24142 </p>
24143 !! wikitext
24144 RFC 123?foo
24145 RFC 123&foo
24146 -RFC 123-
24147 !! html/php
24148 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24149 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24150 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24151 </p>
24152 !! end
24153
24154 !! test
24155 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24156 !! options
24157 parsoid=html2wt
24158 !! html/parsoid
24159 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24160 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24161 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24162 !! wikitext
24163 PMID 123<nowiki/>4
24164 PMID 123<nowiki/>y
24165 X<nowiki/>PMID 123<nowiki/>y
24166 !! end
24167
24168 !! test
24169 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24170 !! options
24171 parsoid=html2wt
24172 !! html/parsoid
24173 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24174 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24175 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24176 </p>
24177 !! wikitext
24178 PMID 123?foo
24179 PMID 123&foo
24180 -PMID 123-
24181 !! html/php
24182 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24183 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24184 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24185 </p>
24186 !! end
24187
24188 !! test
24189 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24190 !! options
24191 parsoid=html2wt
24192 !! html/parsoid
24193 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24194 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24195 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24196 </p>
24197 !! wikitext
24198 ISBN 1234567890<nowiki/>1
24199 ISBN 1234567890<nowiki/>x
24200 a<nowiki/>ISBN 1234567890<nowiki/>b
24201 !! end
24202
24203 !! test
24204 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24205 !! options
24206 parsoid=html2wt
24207 !! html/parsoid
24208 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24209 !! wikitext
24210 -ISBN 1234567890's
24211 !! html/php
24212 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24213 </p>
24214 !! end
24215
24216 !! test
24217 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24218 !! options
24219 parsoid=html2wt
24220 !! html/*
24221 <p>this is not a link: http://example.com
24222 </p>
24223 !! wikitext
24224 this is not a link: <nowiki>http://example.com</nowiki>
24225 !! end
24226
24227 !! test
24228 Links 15. Link trails can't become link prefixes.
24229 !! options
24230 language=is
24231 parsoid=html2wt
24232 !! html/parsoid
24233 <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>
24234 !! wikitext
24235 [[Söfnuður]]-[[00]]
24236 !! html/php
24237 <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>
24238 </p>
24239 !! end
24240
24241 #### --------------- Quotes ---------------
24242 #### 1. Quotes inside <b> and <i>
24243 #### 2. Link fragments separated by <i> and <b> tags
24244 #### 3. Link fragments inside <i> and <b>
24245 #### 4. No escaping needed
24246 #### --------------------------------------
24247 !! test
24248 1a. Quotes inside <b> and <i>
24249 !! options
24250 parsoid=html2wt
24251 !! html/*
24252 <p><i>'foo'</i>
24253 <i>''foo''</i>
24254 <i>'''foo'''</i>
24255 <i>foo</i>'s
24256 <b>'foo'</b>
24257 <b>''foo''</b>
24258 <b>'''foo'''</b>
24259 <b>foo'<i>bar'</i>baz</b>
24260 <b>foo</b>'s
24261 '<i>foo</i>
24262 <i>foo</i>'
24263 <i>foo'</i>'
24264 '<i>foo</i>'
24265 '<b>foo</b>
24266 <b>foo</b>'
24267 '<b>foo</b>'
24268 <i>fools'<span> errand</span></i>
24269 <i><span>fool</span>'s errand</i>
24270 '<i>foo</i> bar '<i>baz</i>
24271 a|!*#-:;+-~[]{}b'<i>x</i>
24272 </p>
24273 !! wikitext
24274 ''<nowiki/>'foo'''
24275 ''<nowiki>''foo''</nowiki>''
24276 ''<nowiki>'''foo'''</nowiki>''
24277 ''foo''<nowiki/>'s
24278 '''<nowiki/>'foo''''
24279 '''<nowiki>''foo''</nowiki>'''
24280 '''<nowiki>'''foo'''</nowiki>'''
24281 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24282 '''foo'''<nowiki/>'s
24283 '''foo''
24284 ''foo''<nowiki/>'
24285 ''foo'''<nowiki/>'
24286 '''foo''<nowiki/>'
24287 ''''foo'''
24288 '''foo'''<nowiki/>'
24289 ''''foo'''<nowiki/>'
24290 ''fools'<span> errand</span>''
24291 ''<span>fool</span>'s errand''
24292 '<nowiki/>''foo'' bar '''baz''
24293 a|!*#-:;+-~[]{}b'''x''
24294 !! end
24295
24296 !! test
24297 1b. Quotes inside <b> and <i> with other tags on same line
24298 !! options
24299 parsoid=html2wt
24300 !! html/parsoid
24301 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24302 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24303 <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>
24304 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24305 '<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>
24306 '<i>foo</i> <div title="name">test</div>
24307 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24308 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24309 <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>
24310 </ol>
24311 !! wikitext
24312 '''a'' foo ''[[bar]]''
24313 ''a''' foo ''[[bar]]''
24314 ''a''' foo '''{{echo|[[bar]]}}'''
24315 [[foo]] x'''[[bar]]''
24316 '''foo'' <ref>test</ref>
24317 '''foo'' <div title="name">test</div>
24318 '''foo'' and <br> bar
24319 <references />
24320 !! end
24321
24322 !! test
24323 2. Link fragments separated by <i> and <b> tags
24324 !! options
24325 parsoid=html2wt
24326 !! html/parsoid
24327 <p>[[<i>foo</i>hello]]</p>
24328 <p>[[<b>foo</b>hello]]</p>
24329 !! wikitext
24330 [[''foo''<nowiki>hello]]</nowiki>
24331
24332 [['''foo'''<nowiki>hello]]</nowiki>
24333 !! end
24334
24335 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24336 # this is one of the shortcomings of this format
24337 !! test
24338 3. Link fragments inside <i> and <b>
24339 !! options
24340 parsoid=html2wt
24341 !! html/parsoid
24342 <p><i>[[foo</i>]]</p>
24343 <p><b>[[foo</b>]]</p>
24344 !! wikitext
24345 ''[[foo''<nowiki>]]</nowiki>
24346
24347 '''[[foo'''<nowiki>]]</nowiki>
24348 !! end
24349
24350 !! test
24351 4. No escaping needed
24352 !! options
24353 options=html2wt
24354 !! html/parsoid
24355 <p>'<span><i>bar</i></span>'
24356 '<span><b>bar</b></span>'
24357 'a:b'foo
24358 </p>
24359 !! wikitext
24360 '<span>''bar''</span>'
24361 '<span>'''bar'''</span>'
24362 'a:b'foo
24363 !! end
24364
24365 #### ----------- Paragraphs ---------------
24366 #### 1. No unnecessary escapes
24367 #### --------------------------------------
24368
24369 !! test
24370 1. No unnecessary escapes
24371 !! options
24372 parsoid=html2wt
24373 !! html/parsoid
24374 <p>bar <span>[[foo]]</span>
24375 </p><p>=bar <span>[[foo]]</span>
24376 </p><p>[[bar <span>[[foo]]</span>
24377 </p><p>]]bar <span>[[foo]]</span>
24378 </p><p>=bar <span>foo]]</span>=
24379 </p>
24380 !! wikitext
24381 bar <span><nowiki>[[foo]]</nowiki></span>
24382
24383 =bar <span><nowiki>[[foo]]</nowiki></span>
24384
24385 [[bar <span><nowiki>[[foo]]</nowiki></span>
24386
24387 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24388
24389 =bar <span>foo]]</span><nowiki>=</nowiki>
24390 !!end
24391
24392 #### ----------------------- PRE --------------------------
24393 #### 1. Leading whitespace in SOL context should be escaped
24394 #### ------------------------------------------------------
24395 !! test
24396 1. Leading whitespace in SOL context should be escaped
24397 !! options
24398 parsoid=html2wt
24399 !! html/parsoid
24400 <p> a</p>
24401
24402 <p> a</p>
24403
24404 <p> a(tab)</p>
24405
24406 <p> a
24407 <!--cmt-->
24408 a</p>
24409
24410 <p>a
24411 b</p>
24412
24413 <p>a
24414 b</p>
24415
24416 <p>a
24417 b</p>
24418 !! wikitext
24419 <nowiki> </nowiki>a
24420
24421 <nowiki> </nowiki> a
24422
24423 a(tab)
24424
24425 <nowiki> </nowiki> a
24426 <!--cmt-->
24427 <nowiki> </nowiki>a
24428
24429 a
24430 <nowiki> </nowiki>b
24431
24432 a
24433 b
24434
24435 a
24436 b
24437 !! html/php
24438 <p> a
24439 </p><p> a
24440 </p><p> a(tab)
24441 </p><p> a
24442 a
24443 </p><p>a
24444 b
24445 </p><p>a
24446 b
24447 </p><p>a
24448 b
24449 </p>
24450 !! end
24451
24452 !! test
24453 2. Leading whitespace in non-indent-pre contexts should not be escaped
24454 !! options
24455 parsoid=html2wt
24456 !! html/parsoid
24457 <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>
24458 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24459 <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>
24460 b</span></li>
24461 </ol>
24462 !! wikitext
24463 foo <ref>''a''
24464 b</ref>
24465 <references />
24466 !! end
24467
24468 !! test
24469 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24470 !! options
24471 parsoid=html2wt
24472 !! html/parsoid
24473 <blockquote>
24474 <p>
24475 a
24476 <span>b</span>
24477 c</p>
24478 </blockquote>
24479 !! wikitext
24480 <blockquote>
24481 a
24482 <span>b</span>
24483 c
24484 </blockquote>
24485 !! end
24486
24487 !! test
24488 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24489 !! options
24490 options=html2wt
24491 !! html/parsoid
24492 <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>
24493 !! wikitext
24494 [[File:Foobar.jpg|thumb|caption]]
24495 !! end
24496
24497 !! test
24498 5. Nowiki escaping should account for indent-pres
24499 !! options
24500 parsoid=html2wt
24501 !! html/parsoid
24502 <pre>==foo==</pre>
24503 !! wikitext
24504 ==foo==
24505 !! end
24506
24507 !!test
24508 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24509 !! options
24510 parsoid=html2wt
24511 !! html/parsoid
24512 <pre>
24513 * foo
24514 * bar
24515 </pre>
24516 !! wikitext
24517 * foo
24518 * bar
24519 !! end
24520
24521 #### --------------- Behavior Switches --------------------
24522
24523 !! test
24524 1. Valid behavior switches should be escaped
24525 !! options
24526 parsoid=html2wt
24527 !! html/parsoid
24528 __TOC__
24529 <i>__TOC__</i>
24530 !! wikitext
24531 <nowiki>__TOC__</nowiki>
24532 ''<nowiki>__TOC__</nowiki>''
24533 !! end
24534
24535 !! test
24536 2. Invalid behavior switches should not be escaped
24537 !! options
24538 parsoid=html2wt
24539 !! html/parsoid
24540 __TOO__
24541 __|__
24542 !! wikitext
24543 __TOO__
24544 __|__
24545 !! end
24546
24547 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24548 !! test
24549 Behavior switches should be SOL-transparent
24550 !! options
24551 parsoid=html2wt
24552 !! html/parsoid
24553 <meta property="mw:PageProp/toc" />
24554
24555 <!-- this one's bogus -->
24556 <pre>__TOO__</pre>
24557
24558 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24559
24560 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24561 !! wikitext
24562 __TOC__
24563
24564 <!-- this one's bogus -->
24565 __TOO__
24566
24567 __TOC__ foo
24568
24569 __TOC__
24570 bar
24571 !! end
24572
24573 #### --------------- HTML tags ---------------
24574 #### 1. a tags
24575 #### 2. other tags
24576 #### 3. multi-line html tag
24577 #### 4. extension tags
24578 #### -----------------------------------------
24579 !! test
24580 1. a tags
24581 !! options
24582 parsoid=html2wt
24583 !! html/parsoid
24584 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24585 !! wikitext
24586 <a href="http://google.com">google</a>
24587 !! end
24588
24589 !! test
24590 2. other tags
24591 !! options
24592 parsoid=html2wt
24593 !! html/parsoid
24594 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24595 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24596 <li> &lt;td&gt;</li></ul>
24597
24598 !! wikitext
24599 * <nowiki><div>foo</div></nowiki>
24600 * <nowiki><div style="color:red">foo</div></nowiki>
24601 * <nowiki><td></nowiki>
24602 !! end
24603
24604 !! test
24605 3. multi-line html tag
24606 !! options
24607 parsoid=html2wt
24608 !! html/parsoid
24609 <p>&lt;div
24610 &gt;foo&lt;/div
24611 &gt;
24612 </p>
24613 !! wikitext
24614 <nowiki><div
24615 >foo</div
24616 ></nowiki>
24617 !! end
24618
24619 !! test
24620 4. extension tags
24621 !! options
24622 parsoid=html2wt
24623 !! html/parsoid
24624 <p>&lt;ref&gt;foo&lt;/ref&gt;
24625 </p><p>&lt;ref&gt;bar
24626 </p><p>baz&lt;/ref&gt;
24627 </p>
24628 !! wikitext
24629 <nowiki><ref>foo</ref></nowiki>
24630
24631 <nowiki><ref>bar</nowiki>
24632
24633 baz<nowiki></ref></nowiki>
24634 !! end
24635
24636 #### --------------- Others ---------------
24637 !! test
24638 Escaping nowikis
24639 !! options
24640 parsoid=html2wt
24641 !! html/parsoid
24642 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24643 </p>
24644 !! wikitext
24645 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24646 !! end
24647
24648 ## The quote-char in the input is necessary for triggering the bug
24649 !! test
24650 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24651 !! options
24652 parsoid=html2wt
24653 !! html/parsoid
24654 <p>foo's bar :</p>
24655 !! wikitext
24656 foo's bar :
24657 !! end
24658
24659 #----------- End of wikitext escaping tests --------------
24660
24661 !! test
24662
24663 Tag-like HTML structures are passed through as text
24664 !! wikitext
24665 <x y>
24666
24667 <x.y>
24668
24669 <x-y>
24670
24671 1>2
24672
24673 x<y
24674
24675 a>b
24676
24677 1<d e>f
24678 !! html
24679 <p>&lt;x y&gt;
24680 </p><p>&lt;x.y&gt;
24681 </p><p>&lt;x-y&gt;
24682 </p><p>1&gt;2
24683 </p><p>x&lt;y
24684 </p><p>a&gt;b
24685 </p><p>1&lt;d e&gt;f
24686 </p>
24687 !! end
24688
24689 !! test
24690 HTML tag with necessary entities in attributes
24691 !! wikitext
24692 <span title="&amp;amp;">foo</span>
24693 !! html
24694 <p><span title="&amp;amp;">foo</span>
24695 </p>
24696 !! end
24697
24698 !! test
24699 HTML tag with 'unnecessary' entity encoding in attributes
24700 !! wikitext
24701 <span title="&amp;">foo</span>
24702 !! html
24703 <p><span title="&amp;">foo</span>
24704 </p>
24705 !! end
24706
24707 !! test
24708 HTML tag with broken attribute value quoting
24709 !! options
24710 parsoid=wt2html,html2html
24711 !! wikitext
24712 <span title="Hello world>Foo</span>
24713 !! html/php
24714 <p><span title="Hello world">Foo</span>
24715 </p>
24716 !! html/parsoid
24717 <p><span title="Hello world">Foo</span></p>
24718 !! end
24719
24720 !! test
24721 Self-closed tag with broken attribute value quoting
24722 !! options
24723 parsoid=wt2html,html2html
24724 !! wikitext
24725 <div title="Hello world />Foo
24726 !! html/php+tidy
24727 <div title="Hello world"></div>
24728 <p>Foo</p>
24729 !! html/parsoid
24730 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24731 !! end
24732
24733 !! test
24734 Table with broken attribute value quoting
24735 !! options
24736 parsoid=wt2html,html2html
24737 !! wikitext
24738 {|
24739 | title="Hello world|Foo
24740 |}
24741 !! html/php
24742 <table>
24743 <tr>
24744 <td title="Hello world">Foo
24745 </td></tr></table>
24746
24747 !! html/parsoid
24748 <table>
24749 <tr>
24750 <td title="Hello world">Foo
24751 </td></tr></table>
24752
24753 !! end
24754
24755 !! test
24756 Table with broken attribute value quoting on consecutive lines
24757 !! options
24758 parsoid=wt2html,html2html
24759 !! wikitext
24760 {|
24761 | title="Hello world|Foo
24762 | style="color:red|Bar
24763 |}
24764 !! html/php
24765 <table>
24766 <tr>
24767 <td title="Hello world">Foo
24768 </td>
24769 <td style="color:red">Bar
24770 </td></tr></table>
24771
24772 !! html/parsoid
24773 <table><tbody>
24774 <tr>
24775 <td title="Hello world">Foo
24776 </td><td style="color: red">Bar
24777 </td></tr></tbody></table>
24778
24779 !! end
24780
24781 !!test
24782 Accept empty td cell attribute
24783 !! wikitext
24784 {|
24785 | align="center" | foo || |
24786 |}
24787 !! html
24788 <table>
24789 <tr>
24790 <td align="center"> foo </td>
24791 <td>
24792 </td></tr></table>
24793
24794 !!end
24795
24796 !!test
24797 Non-empty attributes in th-cells
24798 !! wikitext
24799 {|
24800 ! Foo !! style="color: red" | Bar
24801 |}
24802 !! html
24803 <table>
24804 <tr>
24805 <th> Foo </th>
24806 <th style="color: red"> Bar
24807 </th></tr></table>
24808
24809 !!end
24810
24811 !!test
24812 Accept empty attributes in th-cells
24813 !! wikitext
24814 {|
24815 !| foo !!| bar
24816 |}
24817 !! html
24818 <table>
24819 <tr>
24820 <th> foo </th>
24821 <th> bar
24822 </th></tr></table>
24823
24824 !!end
24825
24826 !!test
24827 Empty table rows go away
24828 !! wikitext
24829 {|
24830 | Hello
24831 | there
24832 |- class="foo"
24833 |-
24834 |}
24835 !! html
24836 <table>
24837 <tr>
24838 <td> Hello
24839 </td>
24840 <td> there
24841 </td></tr>
24842
24843 </table>
24844
24845 !! end
24846
24847 ###
24848 ### Parsoid-centric tests for testing RTing of inter-element separators
24849 ### Edge cases not tested by existing parser tests and specific to
24850 ### Parsoid-specific serialization strategies.
24851 ###
24852
24853 !!test
24854 RT-ed inter-element separators should be valid separators
24855 !! wikitext
24856 {|
24857 |- [[foo]]
24858 |}
24859 !! html/php
24860 <table>
24861
24862 </table>
24863
24864 !! html/parsoid
24865 <table>
24866 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24867 </tbody></table>
24868 !!end
24869
24870 # Parsoid-only since PHP parser relies on Tidy for correct output
24871 !!test
24872 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24873 !!options
24874 parsoid
24875 !! wikitext
24876 {|
24877 |<small>foo
24878 bar
24879 |}
24880
24881 {|
24882 |<small>foo<small>
24883 |}
24884 !! html
24885 <table>
24886 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24887 <p>bar</p></small></td></tr>
24888 </tbody></table>
24889
24890 <table>
24891 <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>
24892 </tbody></table>
24893 !!end
24894
24895 # Note that the "style" attribute is really a template parameter here.
24896 # The = would have to be {{=}} if you wanted the literal.
24897 !!test
24898 Empty TD followed by TD with tpl-generated attribute
24899 !! wikitext
24900 {|
24901 |-
24902 |
24903 |{{echo|style='color:red'}}|foo
24904 |}
24905 !! html
24906 <table>
24907
24908 <tr>
24909 <td>
24910 </td>
24911 <td>foo
24912 </td></tr></table>
24913
24914 !!end
24915
24916 !!test
24917 Indented table with an empty td
24918 !! wikitext
24919 {|
24920 |-
24921 |
24922 |foo
24923 |}
24924 !! html
24925 <table>
24926
24927 <tr>
24928 <td>
24929 </td>
24930 <td>foo
24931 </td></tr></table>
24932
24933 !!end
24934
24935 ## We have some newline diffs RT-ing this edge case
24936 ## and it is not important enough -- we seem to be emitting
24937 ## at most 2 newlines after a </tr> and this is unrelated to
24938 ## the issue from T85627 that this is testing.
24939 !!test
24940 Indented table with blank lines in between (T85627)
24941 !! options
24942 parsoid=wt2html
24943 !! wikitext
24944 {|
24945 |foo
24946
24947
24948 |}
24949 !! html
24950 <table>
24951
24952 <tr>
24953 <td>foo
24954 </td></tr></table>
24955
24956 !!end
24957
24958 !!test
24959 Indented block & table
24960 !! wikitext
24961 <div>foo</div>
24962 {|
24963 |foo
24964 |}
24965 !! html/php
24966 <div>foo</div>
24967 <table>
24968 <tr>
24969 <td>foo
24970 </td></tr></table>
24971
24972 !! html/parsoid
24973 <div data-parsoid='{"stx":"html"}'>foo</div>
24974 <table><tbody>
24975 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24976 </tbody></table>
24977 !!end
24978
24979 !! test
24980 Indent and comment before table row
24981 !! wikitext
24982 {|
24983 <!--hi-->|-
24984 | there
24985 |}
24986 !! html/php
24987 <table>
24988
24989 <tr>
24990 <td> there
24991 </td></tr></table>
24992
24993 !! html/parsoid
24994 <table>
24995 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24996 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24997 </tbody></table>
24998 !! end
24999
25000 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25001 !!test
25002 Empty TR followed by a template-generated TR
25003 !!options
25004 parsoid
25005 !! wikitext
25006 {|
25007 |-
25008 {{echo|<tr><td>foo</td></tr>}}
25009 |}
25010 !! html
25011 <table>
25012 <tbody>
25013 <tr></tr>
25014 <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}}]}'>
25015 <td>foo</td></tr>
25016 </tbody></table>
25017 !!end
25018
25019 ## PHP and parsoid output differ for this, and since this is primarily
25020 ## for testing Parsoid's serializer, marking this Parsoid only
25021 !!test
25022 Empty TR followed by mixed-ws-comment line should RT correctly
25023 !!options
25024 parsoid
25025 !! wikitext
25026 {|
25027 |-
25028 <!--c-->
25029 |-
25030 <!--c--> <!--d-->
25031 |}
25032 !! html
25033 <table>
25034 <tbody>
25035 <tr></tr>
25036 <!--c-->
25037 <tr>
25038 <!--c--> </tr><!--d-->
25039 </tbody></table>
25040
25041 !!end
25042
25043 !!test
25044 Multi-line image caption generated by templates with/without trailing newlines
25045 !! wikitext
25046 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25047 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25048 !! html/parsoid
25049 <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>
25050 <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>
25051 !!end
25052
25053 !! test
25054 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25055 !! options
25056 parsoid=html2wt
25057 !! html/parsoid
25058 <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>
25059
25060 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25061 !! wikitext
25062 <includeonly>foo</includeonly>
25063 new para
25064
25065 [[Category:Foo]]
25066
25067 = new heading =
25068 !! end
25069
25070 ## PHP emits broken html for this, and since this is primarily
25071 ## a Parsoid serializer test, marking this Parsoid only
25072 !!test
25073 Improperly nested inline or quotes tags with whitespace in between
25074 !! wikitext
25075 <span> <s>x</span> </s>
25076 ''' ''x''' ''
25077 !! html/parsoid
25078 <p><span> <s>x</s></span><s> </s>
25079 <b> <i>x</i></b><i> </i>
25080 </p>
25081 !!end
25082
25083 !!test
25084 Encapsulate protected attributes from wt
25085 !! wikitext
25086 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25087
25088 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25089 | ok
25090 |}
25091 !! html/parsoid
25092 <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>
25093
25094 <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">
25095 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25096 </tbody></table>
25097 !!end
25098
25099 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25100 ## Having nested or stray pre tags results in the attempt to add duplicates,
25101 ## causing an assertion fail. This test tries to prevent that situation.
25102 !!test
25103 Ensure ParagraphWrapper can deal with stray closing pre tags
25104 !!options
25105 parsoid=wt2html
25106 !! wikitext
25107 plain text</pre>
25108 !! html/parsoid
25109 plain text
25110 !!end
25111
25112 !!test
25113 1. Ensure fostered text content is wrapped in element nodes
25114 !!options
25115 parsoid=wt2html
25116 !! wikitext
25117 <table>hi</table><table>ho</table>
25118 !! html/parsoid
25119 <p>hi</p>
25120 <table></table>
25121 <p>ho</p>
25122 <table></table>
25123 !!end
25124
25125 !!test
25126 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25127 !!options
25128 parsoid=wt2html,wt2wt
25129 !! wikitext
25130 <table>
25131 <tr> || ||
25132 <td> a
25133 </table>
25134 !! html/parsoid
25135 <p> || ||
25136 </p><table>
25137 <tbody><tr><td> a</td></tr>
25138 </tbody></table>
25139 !!end
25140
25141 !!test
25142 Encapsulation properly handles null DSR information from foster box
25143 !!options
25144 parsoid=wt2html,wt2wt
25145 !! wikitext
25146 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25147 !! html/parsoid
25148 <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>
25149 !!end
25150
25151 !!test
25152 1. Encapsulate foster-parented transclusion content
25153 !!options
25154 parsoid=wt2wt,wt2html
25155 !! wikitext
25156 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25157 !! html/parsoid
25158 <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>
25159 <tbody>
25160 <tr>
25161 <td>bar</td>
25162 </tr>
25163 </tbody>
25164 </table>
25165 !!end
25166
25167 !!test
25168 2. Encapsulate foster-parented transclusion content
25169 !!options
25170 parsoid=wt2wt,wt2html
25171 !! wikitext
25172 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25173 !! html/parsoid
25174 <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>
25175 <table>
25176 <tbody>
25177 <tr>
25178 <td>bar</td>
25179 </tr>
25180 </tbody>
25181 </table>
25182 !!end
25183
25184 !!test
25185 3. Encapsulate foster-parented transclusion content
25186 !!options
25187 parsoid=wt2wt,wt2html
25188 !! wikitext
25189 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25190 !! html/parsoid
25191 <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;]}">
25192 <p>foo</p>
25193 </div>
25194 <table>
25195 <tbody>
25196 <tr>
25197 <td>bar</td>
25198 </tr>
25199 </tbody>
25200 </table>
25201 !!end
25202
25203 !!test
25204 4. Encapsulate foster-parented transclusion content
25205 !!options
25206 parsoid=wt2wt,wt2html
25207 !! wikitext
25208 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25209 !! html/parsoid
25210 <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;]}">
25211 <p>foo</p>
25212 </div>
25213 <table>
25214 <tbody>
25215 <tr>
25216 <td>bar</td>
25217 </tr>
25218 </tbody>
25219 </table>
25220 !!end
25221
25222 !!test
25223 5. Encapsulate foster-parented transclusion content
25224 !!options
25225 parsoid=wt2wt,wt2html
25226 !! wikitext
25227 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25228 !! html/parsoid
25229 <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>
25230 <table>
25231 <tbody>
25232 <tr>
25233 <td>
25234 <div>
25235 <p>foo</p>
25236 </div>
25237 </td>
25238 </tr>
25239 </tbody>
25240 </table>
25241 !!end
25242
25243 !!test
25244 6. Encapsulate foster-parented transclusion content
25245 !!options
25246 parsoid=wt2wt,wt2html
25247 !! wikitext
25248 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25249 !! html/parsoid
25250 <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>
25251 <table>
25252 <tbody>
25253 <tr>
25254 <td>
25255 <div>
25256 <p>foo</p>
25257 </div>
25258 </td>
25259 </tr>
25260 </tbody>
25261 </table>
25262 <p>ok</p>
25263 !!end
25264
25265 !!test
25266 7. Encapsulate foster-parented transclusion content
25267 !!options
25268 parsoid=wt2wt,wt2html
25269 !! wikitext
25270 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25271 !! html/parsoid
25272 <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>
25273 <table>
25274 <tbody>
25275 <tr>
25276 <td>bar</td>
25277 </tr>
25278 </tbody>
25279 </table>
25280 !!end
25281
25282 # Note that the wt is broken on purpose: the = should be {{=}} if you
25283 # don't want it to be a template parameter key.
25284 !!test
25285 8. Encapsulate foster-parented transclusion content
25286 !!options
25287 parsoid=wt2wt,wt2html
25288 !! wikitext
25289 {{echo|a
25290 }}{|{{echo|style='color:red'}}
25291 |-
25292 |b
25293 |}
25294 !! html/parsoid
25295 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25296 <span> </span>
25297 <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>
25298 <table>
25299 <tbody>
25300 <tr>
25301 <td>b</td>
25302 </tr>
25303 </tbody>
25304 </table>
25305 !!end
25306
25307 !!test
25308 9. Encapsulate foster-parented transclusion content
25309 !!options
25310 parsoid=wt2wt,wt2html
25311 !! wikitext
25312 <table>{{echo|hi</table>hello}}
25313 !! html/parsoid
25314 <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>
25315 !!end
25316
25317 !!test
25318 Table in fosterable position
25319 !!options
25320 parsoid=wt2html
25321 !! wikitext
25322 {{OpenTable}}
25323 <div>
25324 {|
25325 |}
25326 </div>
25327 |}
25328 !! html/parsoid
25329 <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">
25330 </span>
25331 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25332
25333 <table>
25334 </table>
25335 !!end
25336
25337 # Parsoid only for bug 64747
25338 !! test
25339 Properly encapsulate empty-content transclusions in fosterable positions
25340 !! wikitext
25341 <table>
25342 {{#if:|
25343 <td>foo</td>
25344 }}
25345 </table>
25346 !! html/parsoid
25347 <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"}]]}'>
25348
25349 </table>
25350 !! end
25351
25352 !! test
25353 Always encapsulate foster box when template range is expanded to table
25354 !! options
25355 parsoid=wt2wt
25356 !! wikitext
25357 {|
25358 hello
25359 {{OpenTable}}
25360 |}
25361 !! html/parsoid
25362
25363 !! end
25364
25365 !! test
25366 T115289: Unclosed table
25367 !! wikitext
25368 {{echo|<table>}}<!--c-->[[Category:Two]]
25369 !! html/parsoid
25370 <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>
25371 !! end
25372
25373 !! test
25374 T115289: Don't migrate newlines out of tables with fostered content
25375 !! wikitext
25376 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25377 !! html/parsoid
25378 <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>
25379 !! end
25380
25381 !! test
25382 T73074: More fostering fun
25383 !! wikitext
25384 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25385 !! html/parsoid
25386 <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>
25387 !! end
25388
25389 !!test
25390 Support <object> element with .data attribute
25391 !!options
25392 parsoid=html2wt
25393 !! html/parsoid
25394 <object data="test.swf"></object>
25395 !! wikitext
25396 <object data="test.swf"></object>
25397 !!end
25398
25399 !! test
25400 Don't block XML namespace declaration
25401 !! wikitext
25402 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25403 !! html/php
25404 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25405 </p>
25406 !! html/parsoid
25407 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25408 !! end
25409
25410 # -----------------------------------------------------------------
25411 # The following section of tests are primarily to spec requirements
25412 # around Parsoid's serialization (old, new, edited content)
25413 #
25414 # All these tests are marked Parsoid html2wt and html2html only
25415 # ----------------------------------------------------------------
25416
25417 !! test
25418 Ignore rel attribute in a-tags during serialization to url-links
25419 !! options
25420 parsoid=html2wt
25421 !! html/parsoid
25422 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25423 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25424 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25425 !! wikitext
25426 http://en.wikipedia.org/wiki/Foobar
25427 http://en.wikipedia.org/wiki/Foobar
25428 http://en.wikipedia.org/wiki/Foobar
25429 !! end
25430
25431 # 'mi' is a localinterwiki prefix as well as a language
25432 !! test
25433 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25434 !! options
25435 parsoid=html2wt
25436 !! html/parsoid
25437 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25438 !! wikitext
25439 [[Foo]]
25440 !! end
25441
25442 # See T93839
25443 !! test
25444 New wikilinks should be serialized properly
25445 !! options
25446 parsoid=html2wt
25447 !! html/parsoid
25448 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25449 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25450 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25451 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25452 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25453 !! wikitext
25454 [[Foo]]
25455 [[Foo]]
25456 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25457 http://en.wikipedia.org/wiki/Foo
25458 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25459 !! end
25460
25461 !! test
25462 New wiki links (href variations)
25463 !! options
25464 parsoid=html2wt
25465 !! html/parsoid
25466 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25467 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25468 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25469 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25470 !! wikitext
25471 [[Foo_bar]]
25472 [[Foo_bar]]
25473 [[Foo_bar]]
25474 [[Toxine bactérienne]]
25475 !! end
25476
25477 !! test
25478 New wiki links (content string variations)
25479 !! options
25480 parsoid=html2wt
25481 !! html/parsoid
25482 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25483 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25484 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25485 !! wikitext
25486 [[Foo_bar]]
25487 [[Foo bar]]
25488 [[Foo_bar|./Foo_bar]]
25489 !! end
25490
25491 !! test
25492 New category links (href variations)
25493 !! options
25494 parsoid=html2wt
25495 !! html/parsoid
25496 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25497 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25498 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25499 !! wikitext
25500 [[Category:Toxine bactérienne]]
25501 [[Category:Toxine bactérienne]]
25502 [[Category:Toxine bactérienne]]
25503 !! end
25504
25505 !! test
25506 New sol transparent links don't need indent-pre nowiki protection
25507 !! options
25508 parsoid=html2wt
25509 language=de
25510 !! html/parsoid
25511 <link rel="mw:PageProp/redirect" href="./Main_Page">
25512 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25513 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25514 !! wikitext
25515 #WEITERLEITUNG [[Main Page]]
25516 <!-- this is good --> [[Category:Good]]
25517 <!-- this is great --> [[Kategorie:Great]]
25518 !! end
25519
25520 !! test
25521 New interlanguage links (href variations)
25522 !! options
25523 parsoid=html2wt
25524 !! html/parsoid
25525 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25526 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25527 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25528 !! wikitext
25529 [[es:Toxine bactérienne]]
25530 [[es:Toxine_bactérienne]]
25531 [[es:Toxine_bactérienne]]
25532 !! end
25533
25534 !! test
25535 Image: Modifying size of an image (1)
25536 !! options
25537 parsoid={
25538 "modes": ["wt2wt"],
25539 "changes": [
25540 ["img[height]", "attr", "height", "22"],
25541 ["img[width]", "attr", "width", "200"]
25542 ]
25543 }
25544 !! wikitext
25545 [[Image:Foobar.jpg|230x230px]]
25546 !! wikitext/edited
25547 [[Image:Foobar.jpg|200x200px]]
25548 !!end
25549
25550 !! test
25551 Image: Modifying size of an image (2)
25552 !! options
25553 parsoid={
25554 "modes": ["wt2wt"],
25555 "changes": [
25556 ["img[height]", "attr", "height", "100"],
25557 ["img[width]", "attr", "width", "500"]
25558 ]
25559 }
25560 !! wikitext
25561 [[Image:Foobar.jpg|230x230px]]
25562 !! wikitext/edited
25563 [[Image:Foobar.jpg|500x500px]]
25564 !!end
25565
25566 # Change in size is ignored so long as class='mw-default-size'
25567 !! test
25568 Image: Modifying size of an image (3)
25569 !! options
25570 parsoid={
25571 "modes": ["wt2wt"],
25572 "changes": [
25573 ["figure[class]", "removeClass", "mw-default-size"],
25574 ["figure img", "attr", "height", "19"],
25575 ["figure img", "attr", "width", "170"]
25576 ]
25577 }
25578 !! wikitext
25579 [[Image:Foobar.jpg|thumb]]
25580 !! wikitext/edited
25581 [[Image:Foobar.jpg|thumb|170x170px]]
25582 !!end
25583
25584 !! test
25585 Image: Modifying alignment of an image (bug 48665)
25586 !! options
25587 parsoid={
25588 "modes": ["wt2wt"],
25589 "changes": [
25590 ["figure[class]", "removeClass", "mw-halign-right"],
25591 ["figure[class]", "addClass", "mw-halign-left"]
25592 ]
25593 }
25594 !! wikitext
25595 [[Image:Foobar.jpg|thumb|caption|right]]
25596 !! wikitext/edited
25597 [[Image:Foobar.jpg|thumb|caption|left]]
25598 !! end
25599
25600 !! test
25601 Image: Modifying mw-default-size of an frameless image (bug 62805)
25602 !! options
25603 parsoid={
25604 "modes": ["wt2wt"],
25605 "changes": [
25606 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25607 ]
25608 }
25609 !! wikitext
25610 [[Image:Foobar.jpg|frameless|right]]
25611 !! wikitext/edited
25612 [[Image:Foobar.jpg|frameless|right|220x220px]]
25613 !! end
25614
25615 !! test
25616 Image: Modifying valign of an image (bug 49221)
25617 !! options
25618 parsoid={
25619 "modes": ["wt2wt"],
25620 "changes": [
25621 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25622 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25623 ]
25624 }
25625 !! wikitext
25626 [[File:Foobar.jpg|20px|middle]]
25627 !! wikitext/edited
25628 [[File:Foobar.jpg|20px|text-top]]
25629 !! end
25630
25631 !! test
25632 Image: Modifying alt attribute of an image (bug 56400)
25633 !! options
25634 parsoid={
25635 "modes": ["wt2wt"],
25636 "changes": [
25637 ["img[alt]", "attr", "alt", "some alternate edited text"]
25638 ]
25639 }
25640 !! wikitext
25641 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25642 !! wikitext/edited
25643 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25644 !!end
25645
25646 !! test
25647 Image: Modifying caption of an image
25648 !! options
25649 parsoid={
25650 "modes": ["wt2wt"],
25651 "changes": [
25652 ["figcaption", "text", "new caption"]
25653 ]
25654 }
25655 !! wikitext
25656 [[Image:Foobar.jpg|thumb|original caption]]
25657 !! wikitext/edited
25658 [[Image:Foobar.jpg|thumb|new caption]]
25659 !!end
25660
25661 !! test
25662 Image: empty alt attribute (bug 48924)
25663 !! options
25664 parsoid
25665 !! wikitext
25666 [[File:Foobar.jpg|thumb|alt=|bar]]
25667 !! html
25668 <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>
25669 !! end
25670
25671 !! test
25672 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25673 !! options
25674 parsoid=html2wt
25675 language=ar
25676 disabled
25677 !! html/parsoid
25678 <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>
25679 !! wikitext
25680 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25681 !! end
25682
25683 !! test
25684 Image: Block level image should have \n before and after
25685 !! wikitext
25686 123
25687 [[File:Foobar.jpg|right|thumb|150x150px]]
25688 456
25689 !! html/parsoid
25690 <p>123</p>
25691 <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>
25692 <p>456</p>
25693 !!end
25694
25695 !! test
25696 Image: New block level image should have \n before and after (existing content)
25697 !! wikitext
25698 123
25699 [[File:Foobar.jpg|right|thumb|150x150px]]
25700 456
25701 !! html/parsoid
25702 <p>123</p>
25703 <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>
25704 <p>456</p>
25705 !!end
25706
25707 !! test
25708 Image: upright option (parsoid)
25709 !! wikitext
25710 [[File:Foobar.jpg|thumb|upright|caption]]
25711 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25712 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25713 !! html/parsoid
25714 <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>
25715 <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>
25716 <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>
25717 !!end
25718
25719 !! test
25720 Image: upright option is ignored on inline and frame images (parsoid)
25721 !! wikitext
25722 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25723 !! html/parsoid
25724 <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>
25725 !!end
25726
25727 !! test
25728 Image: from basic HTML (1)
25729 !! options
25730 parsoid=html2wt
25731 !! html/parsoid
25732 <span typeof="mw:Image">
25733 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25734 </span>
25735 !! wikitext
25736 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25737 !! end
25738
25739 !! test
25740 Image: from basic HTML (2)
25741 !! options
25742 parsoid=html2wt
25743 !! html/parsoid
25744 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25745 !! wikitext
25746 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25747 !! end
25748
25749 !! test
25750 Image: from basic HTML (3)
25751 !! options
25752 parsoid=html2wt
25753 !! html/parsoid
25754 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25755 !! wikitext
25756 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25757 !! end
25758
25759 !! test
25760 Image: from basic HTML (4)
25761 !! options
25762 parsoid=html2wt
25763 !! html/parsoid
25764 <img src="./File:Foobar.jpg">
25765 !! wikitext
25766 [[File:Foobar.jpg|link=]]
25767 !! end
25768
25769 !! test
25770 Image: Invalid title as link
25771 !! wikitext
25772 [[File:Foobar.jpg|link=<]]
25773 !! html/php
25774 <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>
25775 </p>
25776 !! html/parsoid
25777 <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>
25778 !! end
25779
25780 !! test
25781 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25782 !! options
25783 parsoid=html2wt
25784 !! html/parsoid
25785 <ul>
25786 <li><p>foo</p></li>
25787 </ul>
25788 !! wikitext
25789 * foo
25790 !! end
25791
25792 !! test
25793 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25794 !! options
25795 parsoid=html2wt
25796 !! html/parsoid
25797 <ul> <li>foo</li></ul>
25798 !! wikitext
25799 * foo
25800 !! end
25801
25802 !! test
25803 Don't strip leading whitespace when handling indent-pre suppressing tags
25804 !! options
25805 parsoid=html2wt
25806 !! html/parsoid
25807 <table>
25808 <tr><td> indented row</td></tr>
25809 </table>
25810 <blockquote><p>
25811 <b>This is very bold of you!</b>
25812 </p>
25813 <table><tr><td>
25814 indented cell (no pre-wrapping!)
25815 </td></tr></table>
25816 </blockquote>
25817 <p>foo</p>
25818 <div>bar</div>
25819 !! wikitext
25820 {|
25821 | indented row
25822 |}
25823 <blockquote>
25824 '''This is very bold of you!'''
25825
25826 {|
25827 |
25828 indented cell (no pre-wrapping!)
25829 |}
25830 </blockquote>
25831 foo
25832 <div>bar</div>
25833 !! end
25834
25835 !! test
25836 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25837 !! options
25838 parsoid=html2wt
25839 !! html/parsoid
25840 <p>foo</p>
25841 <span>bar</span>
25842
25843 <span>foo2
25844 </span>bar2
25845
25846 <div>foo</div>
25847 <span>bar</span>
25848
25849 <div>
25850 <span>foo</span>
25851 </div>
25852 !! wikitext
25853 foo
25854
25855 <span>bar</span>
25856
25857 <span>foo2
25858 <nowiki> </nowiki></span>bar2
25859
25860 <div>foo</div>
25861 <nowiki> </nowiki><span>bar</span>
25862
25863 <div>
25864 <nowiki> </nowiki><span>foo</span>
25865 </div>
25866 !! end
25867
25868 !! test
25869 Lists: Dont insert newlines in a serialized list item.
25870 !! options
25871 parsoid=html2wt
25872 !! html/parsoid
25873 <ul><li>a<br>b</li><li>c</li></ul>
25874 !! wikitext
25875 * a<br>b
25876 * c
25877 !! end
25878
25879 !! test
25880 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25881 !! options
25882 parsoid={
25883 "modes": ["html2wt"],
25884 "scrubWikitext": false
25885 }
25886 !! html/parsoid
25887 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25888 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25889
25890 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25891 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25892
25893 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25894
25895 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25896 !! wikitext
25897 == hello there [[Category:A1]] ==
25898
25899 == [[Category:A2]] hi pal ==
25900
25901 == <!--foo--> [[Category:A3]] how goes it ==
25902
25903 == it goes well [[Category:A4]] <!--bar--> ==
25904
25905 ==howdy [[Category:A5]]==
25906
25907 == __TOC__ ok ==
25908 !! end
25909
25910 !! test
25911 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25912 !! options
25913 parsoid={
25914 "modes": ["html2wt"],
25915 "scrubWikitext": true
25916 }
25917 !! html/parsoid
25918 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25919 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25920
25921 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25922 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25923
25924 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25925 !! wikitext
25926 == hello there ==
25927 [[Category:A1]]
25928 [[Category:A2]]
25929
25930 == hi pal ==
25931
25932 <!--foo--> [[Category:A3]]
25933
25934 == how goes it ==
25935
25936 == it goes well ==
25937 [[Category:A4]] <!--bar-->
25938
25939 __TOC__
25940
25941 == ok ==
25942 !! end
25943
25944 !! test
25945 Headings: Don't hoist metas that come from templates
25946 !! options
25947 parsoid={
25948 "modes": ["html2wt"],
25949 "scrubWikitext": true
25950 }
25951 !! html/parsoid
25952 <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>
25953 !! wikitext
25954 == {{echo|foo [[Category:Foo]]}} ==
25955 !! end
25956
25957 !! test
25958 Headings: Category in ref isn't hoisted
25959 !! options
25960 parsoid={
25961 "modes": ["html2wt"],
25962 "scrubWikitext": true
25963 }
25964 !! html/parsoid
25965 <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>
25966
25967 <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>
25968 !! wikitext
25969 == foo <ref>bar
25970 [[Category:Baz]] </ref> ==
25971
25972 <references />
25973 !! end
25974
25975 !! test
25976 Parsoid: Serialize positional parameters with = in them as named parameter
25977 !! options
25978 parsoid=html2wt
25979 !! html/parsoid
25980 <p about="#mwt1" typeof="mw:Transclusion"
25981 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25982
25983 <p about="#mwt1" typeof="mw:Transclusion"
25984 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25985
25986 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25987 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25988 <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>
25989 !! wikitext
25990 {{echo|1=f=oo}}
25991
25992 {{echo|1=f=oo|2=bar}}
25993
25994 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25995 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25996 {{echo|<nowiki>f=oo</nowiki>|bar}}
25997 !! end
25998
25999 !! test
26000 Parsoid: Serialize positional parameters with = in extlink as named parameter
26001 !! options
26002 parsoid=html2wt
26003 !! html/parsoid
26004 <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>
26005 !! wikitext
26006 {{echo|1=http://stuff?is=ok}}
26007 !! end
26008
26009 !! test
26010 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26011 !! options
26012 parsoid=html2wt
26013 !! html/parsoid
26014 <div>a<p>b</p></div>
26015 <div>a
26016 <p>b</p></div>
26017 <div>
26018 a
26019 <p>b</p></div>
26020 !! wikitext
26021 <div>a
26022 b
26023 </div>
26024 <div>a
26025 b
26026 </div>
26027 <div>
26028 a
26029
26030 b
26031 </div>
26032 !! end
26033
26034 !! test
26035 Substrings resembling wikitext in hrefs should not get nowiki escapes
26036 !! options
26037 parsoid=html2wt
26038 !! html/parsoid
26039 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26040 !! wikitext
26041 [[Foo''bar''baz]]
26042 !! end
26043
26044 !! test
26045 Enforce single-line context in the serializer
26046 !! options
26047 parsoid=html2wt
26048 !! html/parsoid
26049 <h2>testing
26050 123</h2>
26051
26052 <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">
26053 </span><span about="#mwt1">you</span> </h2>
26054
26055 <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>
26056
26057 <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
26058 there</span></li></ol>
26059
26060 <ul><li>asd
26061 sdf</li></ul>
26062
26063 <ul><li>foo
26064 bar
26065 baz</li>
26066 <li>foo <b>bar</b>
26067 baz</li></ul>
26068
26069 <dl><dt>hi
26070 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26071 ho</dd></dl>
26072
26073 <dl><dd> <table>
26074 <tbody><tr><td> ha
26075 ha
26076 ha</td></tr>
26077 </tbody></table></dd></dl>
26078 !! wikitext
26079 == testing 123 ==
26080
26081 == hi {{bogus|there
26082 you}} ==
26083
26084 == foo <ref>hello
26085 there</ref> ==
26086
26087 <references />
26088
26089 * asd sdf
26090
26091 * foo bar baz
26092 * foo '''bar''' baz
26093
26094 ; hi ho : hi ho
26095
26096 : {|
26097 | ha
26098 ha
26099 ha
26100 |}
26101 !! end
26102
26103 !! test
26104 Serialize new placeholder space without spans
26105 !! options
26106 parsoid=html2wt
26107 !! html/parsoid
26108 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26109
26110 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26111
26112 <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>
26113 !! wikitext
26114 foo : bar
26115
26116 foo : bar
26117
26118 <ref>foo : bar</ref>ok
26119 !! end
26120
26121
26122 #-----------------------
26123 # Tag minimization tests
26124 #-----------------------
26125
26126 !! test
26127 1. I/B quote minimization: wikitext-only tags should be combined
26128 !! options
26129 parsoid=html2wt
26130 !! html/parsoid
26131 <p><i>A</i><i>B</i></p>
26132 <p><b>A</b><b>B</b></p>
26133 <p><i>A</i><b><i>B</i></b></p>
26134 <p><b>A</b><i><b>B</b></i></p>
26135 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26136 <p><i><b>A</b></i><i><b>B</b></i></p>
26137 <p><i><b>A</b></i><b><i>B</i></b></p>
26138 <p><b><i>A</i></b><i><b>B</b></i></p>
26139 !! wikitext
26140 ''AB''
26141
26142 '''AB'''
26143
26144 ''A'''B'''''
26145
26146 '''A''B'''''
26147
26148 '''A''BC''D'''
26149
26150 '''''AB'''''
26151
26152 '''''AB'''''
26153
26154 '''''AB'''''
26155 !! end
26156
26157 !! test
26158 2. I/B quote minimization: wikitext and html tags should not be combined
26159 !! options
26160 parsoid=html2wt
26161 !! html/parsoid
26162 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26163 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26164 !! wikitext
26165 ''A''<i>B</i>
26166
26167 ''A''<nowiki/>'''<i>B</i>'''
26168 !! end
26169
26170 !! test
26171 3. I/B quote minimization: templated content stops minimization
26172 !! options
26173 parsoid=html2wt
26174 !! html/parsoid
26175 <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>
26176 <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>
26177 !! wikitext
26178 ''A''{{echo|''B''}}
26179
26180 ''A''{{echo|'''''B'''''}}
26181 !! end
26182
26183 !! test
26184 4. I/B quote minimization: new content should be mimimized with adjacent old content
26185 !! options
26186 parsoid=html2wt
26187 !! html/parsoid
26188 <p><i>A</i><i>B</i></p>
26189 <p><b>A</b><b>B</b></p>
26190 <p><i>A</i><b><i>B</i></b></p>
26191 !! wikitext
26192 ''AB''
26193
26194 '''AB'''
26195
26196 ''A'''B'''''
26197 !! end
26198
26199 !! test
26200 5a. Merge adjacent quote nodes if they've been edited
26201 !! options
26202 parsoid={
26203 "modes": ["wt2wt", "selser"],
26204 "changes": [
26205 ["p", "contents", "remove", ":contains('b')"]
26206 ]
26207 }
26208 !! wikitext
26209 ''a''b''c''
26210 !! wikitext/edited
26211 ''ac''
26212 !! end
26213
26214 !! test
26215 5b. Merge adjacent quote nodes if they've been edited
26216 !! options
26217 parsoid={
26218 "modes": ["wt2wt", "selser"],
26219 "changes": [
26220 ["#x", "remove"]
26221 ]
26222 }
26223 !! wikitext
26224 ''a''<span id="x">b</span>''c''
26225 !! wikitext/edited
26226 ''ac''
26227 !! end
26228
26229 !! test
26230 1. Merge adjacent link nodes as long as at least one element is new
26231 !! options
26232 parsoid={
26233 "modes": ["html2wt"],
26234 "scrubWikitext": true
26235 }
26236 !! html/parsoid
26237 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26238 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26239 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26240 !! wikitext
26241 [[Football]]
26242 [[Football]]
26243 [[Football|Foot]][[Football|ball]]
26244 !! end
26245
26246 !! test
26247 2. Merge adjacent link nodes and enable additional normalizations
26248 !! options
26249 parsoid={
26250 "modes": ["html2wt"],
26251 "scrubWikitext": true
26252 }
26253 !! html/parsoid
26254 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26255 !! wikitext
26256 [[Football|''Football'']]
26257 !! end
26258
26259 !! test
26260 3. Don't merge adjacent link nodes if scrubWikitext is false
26261 !! options
26262 parsoid={
26263 "modes": ["html2wt"],
26264 "scrubWikitext": false
26265 }
26266 !! html/parsoid
26267 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26268 !! wikitext
26269 [[Football|Foot]][[Football|ball]]
26270 !! end
26271
26272 #------------------------------
26273 # End of tag minimization tests
26274 #------------------------------
26275
26276 !!test
26277 Bug 54262: New entities
26278 !! options
26279 parsoid=html2wt
26280 !! html/parsoid
26281 <span typeof="mw:Entity">&nbsp;</span>
26282 !! wikitext
26283 &nbsp;
26284 !! end
26285
26286 ## Note that there is no wikitext output for 'unknownproperty' ##
26287 ## Unknown magic words are silently dropped ##
26288
26289 !! test
26290 Magic words
26291 !! options
26292 parsoid=html2wt
26293 !! html/parsoid
26294 <meta property='mw:PageProp/toc' />
26295 <meta property='mw:PageProp/notoc' />
26296 <meta property='mw:PageProp/forcetoc' />
26297 <meta property='mw:PageProp/index' />
26298 <meta property='mw:PageProp/noindex' />
26299 <meta property='mw:PageProp/nogallery' />
26300 <meta property='mw:PageProp/noeditsection' />
26301 <meta property='mw:PageProp/notitleconvert' />
26302 <meta property='mw:PageProp/nocontentconvert' />
26303 <meta property='mw:PageProp/unknownproperty' />
26304 !! wikitext
26305 __TOC__
26306 __NOTOC__
26307 __FORCETOC__
26308 __INDEX__
26309 __NOINDEX__
26310 __NOGALLERY__
26311 __NOEDITSECTION__
26312 __NOTITLECONVERT__
26313 __NOCONTENTCONVERT__
26314 !! end
26315
26316 !! test
26317 Consecutive <pre>s should not get merged
26318 !! options
26319 parsoid=html2wt,html2html
26320 !! html/parsoid
26321 <pre>a</pre><pre>b</pre>
26322
26323 <pre>c
26324 </pre><pre>
26325 d</pre>
26326
26327 <pre>e
26328
26329 </pre><pre>
26330
26331 f</pre>
26332 !! wikitext
26333 a
26334
26335 b
26336
26337 c
26338
26339 d
26340
26341 e
26342
26343
26344
26345 f
26346 !! end
26347
26348 !! test
26349 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26350 !! options
26351 parsoid=html2wt
26352 !! html/parsoid
26353 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26354 !! wikitext
26355 [[Special:BookSources/1234567890|ISBN 1234567895]]
26356 !! end
26357
26358 !! test
26359 Edited RFC links not serializable as RFC links should serialize as extlinks
26360 !! options
26361 parsoid=html2wt
26362 !! html/parsoid
26363 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26364 !! wikitext
26365 [//tools.ietf.org/html/rfc123 New RFC]
26366 !! end
26367
26368 !! test
26369 Edited PMID links not serializable as PMID links should serialize as extlinks
26370 !! options
26371 parsoid=html2wt
26372 !! html/parsoid
26373 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26374 !! wikitext
26375 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26376 !! end
26377
26378 !! test
26379 WTS of autolinks with trailing/surrounding context
26380 !! options
26381 parsoid=html2wt
26382 !! html/parsoid
26383 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26384 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26385 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26386 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26387 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26388 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26389 !! wikitext
26390 http://cscott.net'''foo'''
26391
26392 http://cscott.net<b>foo</b>
26393
26394 '''http://cscott.net'''
26395
26396 '''http://cscott.net '''
26397
26398 '''http://cscott.net<nowiki/>x'''
26399
26400 http://cscott.net<nowiki/>x
26401 !! end
26402
26403 !! test
26404 WTS of autolinks with nowikis (round-trip)
26405 !! wikitext
26406 x<nowiki/>http://cscott.net<nowiki/>x
26407 !! html/parsoid
26408 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26409 !! end
26410
26411 # this is the "easy" test because it leaves in place all the
26412 # data-parsoid information indicating this is an autolink
26413 !! test
26414 WTS of autolinks with escapes (editing)
26415 !! options
26416 parsoid={
26417 "modes": ["wt2wt"],
26418 "changes": [
26419 [ "meta", "remove" ]
26420 ]
26421 }
26422 !! wikitext
26423 x<nowiki/>http://cscott.net<nowiki/>x
26424 !! wikitext/edited
26425 x<nowiki/>http://cscott.net<nowiki/>x
26426 !! end
26427
26428 !! test
26429 WTS of edited autolink-like text (T103364)
26430 !! options
26431 parsoid={
26432 "modes": ["wt2wt"],
26433 "changes": [
26434 [ "span[typeof]", "removeAttr", "typeof" ]
26435 ]
26436 }
26437 !! wikitext
26438 Not a link: <nowiki>http://example.com</nowiki>.
26439 !! wikitext/edited
26440 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26441 !! end
26442
26443 !! test
26444 WTS of newly-authored autolink-like text (T103364)
26445 !! options
26446 parsoid=html2wt
26447 !! html/parsoid
26448 <p>http://example.com is not a link.</p>
26449 !! wikitext
26450 <nowiki>http://example.com</nowiki> is not a link.
26451 !! end
26452
26453 !! test
26454 WTS of autolink-like text after an autolink (T108563)
26455 !! options
26456 parsoid=html2wt
26457 !! html/parsoid
26458 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26459 !! wikitext
26460 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26461 !! end
26462
26463 !! test
26464 Magic links inside links (not autolinked)
26465 !! wikitext
26466 [[Foo|http://example.com]]
26467 [[Foo|RFC 1234]]
26468 [[Foo|PMID 1234]]
26469 [[Foo|ISBN 123456789x]]
26470
26471 [http://foo.com http://example.com]
26472 [http://foo.com RFC 1234]
26473 [http://foo.com PMID 1234]
26474 [http://foo.com ISBN 123456789x]
26475 !! html+tidy
26476 <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>
26477 <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>
26478 !! html/parsoid
26479 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26480 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26481 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26482 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26483
26484 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26485 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26486 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26487 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26488 !! end
26489
26490 !! test
26491 Magic links inside image captions (autolinked)
26492 !! wikitext
26493 [[File:Foobar.jpg|thumb|http://example.com]]
26494 [[File:Foobar.jpg|thumb|RFC 1234]]
26495 [[File:Foobar.jpg|thumb|PMID 1234]]
26496 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26497 !! html+tidy
26498 <div class="thumb tright">
26499 <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>
26500 <div class="thumbcaption">
26501 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26502 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26503 </div>
26504 </div>
26505 <div class="thumb tright">
26506 <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>
26507 <div class="thumbcaption">
26508 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26509 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26510 </div>
26511 </div>
26512 <div class="thumb tright">
26513 <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>
26514 <div class="thumbcaption">
26515 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26516 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26517 </div>
26518 </div>
26519 <div class="thumb tright">
26520 <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>
26521 <div class="thumbcaption">
26522 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26523 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26524 </div>
26525 </div>
26526 !! html/parsoid
26527 <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>
26528 <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>
26529 <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>
26530 <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>
26531 !! end
26532
26533 !! test
26534 WTS of magic word text (T109371)
26535 !! options
26536 parsoid=html2wt
26537 !! html/parsoid
26538 <p>RFC 1234</p>
26539 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26540 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26541 !! wikitext
26542 <nowiki>RFC 1234</nowiki>
26543
26544 [http://foo.com RFC 1234]
26545
26546 [[Foo|RFC 1234]]
26547 !! end
26548
26549 !! test
26550 Edited Redirect link should emit a non-piped wikitext link
26551 !! options
26552 parsoid=html2wt
26553 !! html/parsoid
26554 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26555 !! wikitext
26556 #REDIRECT [[Bar]]
26557 !! end
26558
26559 !! test
26560 T75121: Infer extension name from typeOf if data-mw is not present
26561 !! options
26562 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26563 !! html/parsoid
26564 <div typeOf="mw:Extension/foo"></div>
26565 !! wikitext
26566 <foo />
26567 !! end
26568
26569 # Note that the <p> wrapping isn't present in PHP parser output
26570 # The important thing for this test is that P-wrapping doesn't
26571 # interfere with the <nowiki> protection for leading - in <td>
26572 # (which isn't necessary for <th>).
26573 !! test
26574 T88318: p-wrapped dash in table.
26575 !! options
26576 parsoid=html2wt,wt2wt
26577 !! html/parsoid
26578 <table><tbody>
26579 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26580 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26581 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26582 </tbody></table>
26583 !! wikitext
26584 {|
26585 !-
26586 !-
26587 |-
26588 |<nowiki>-</nowiki>
26589 |<nowiki>- </nowiki>
26590 |-
26591 |<small>-</small>
26592 |<br>
26593 -
26594 |<br>
26595 -
26596 |}
26597 !! html/php+tidy
26598 <table>
26599 <tr>
26600 <th>-</th>
26601 <th>-</th>
26602 </tr>
26603 <tr>
26604 <td>-</td>
26605 <td>-</td>
26606 </tr>
26607 <tr>
26608 <td><small>-</small></td>
26609 <td><br />
26610 <p>-</p>
26611 </td>
26612 <td><br />
26613 <p>-</p>
26614 </td>
26615 </tr>
26616 </table>
26617 !! end
26618
26619 !! test
26620 T149209: WTS: Handle newlines in table cells properly
26621 !! options
26622 parsoid=html2wt
26623 !! html/parsoid
26624 <table>
26625 <tbody>
26626 <tr><td>a
26627 b
26628 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26629 <tr><td><p>x</p>
26630 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26631 </tbody></table>
26632 <table>
26633 <tbody>
26634 <tr><th>a
26635 b
26636 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26637 <tr><th><p>x</h>
26638 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26639 </tbody></table>
26640 !! wikitext
26641 {|
26642 |a
26643 b
26644 |c
26645 |-
26646 |x
26647 {{!}}y
26648 |}
26649 {|
26650 !a
26651 b
26652 !c
26653 |-
26654 !x
26655 !y
26656 |}
26657 !! end
26658
26659 !! test
26660 T149209: Selser: Handle newlines in table cells properly
26661 !! options
26662 parsoid={
26663 "modes": ["selser"],
26664 "changes": [
26665 [ "#h1", "html", "a\nb\n" ],
26666 [ "#h2", "html", "a\nb\n" ],
26667 [ "#c1", "html", "a\nb\n" ],
26668 [ "#c2", "html", "<p>a</p>" ],
26669 [ "#c3", "html", "<p>a</p>" ]
26670 ]
26671 }
26672 !! wikitext
26673 {|
26674 ! id="h1" |edit-me!!1
26675 |-
26676 ! id="h2" |edit-me||2
26677 |-
26678 | id="c1" |edit-me||3
26679 |-
26680 | id="c2" |edit-me||4
26681 |-
26682 | id="c3" |edit-me||p||q||r
26683 |}
26684 !! wikitext/edited
26685 {|
26686 ! id="h1" |a
26687 b
26688 !1
26689 |-
26690 ! id="h2" |a
26691 b
26692 !2
26693 |-
26694 | id="c1" |a
26695 b
26696 |3
26697 |-
26698 | id="c2" |a
26699 |4
26700 |-
26701 | id="c3" |a
26702 |p||q||r
26703 |}
26704 !! end
26705
26706 !! test
26707 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26708 !! options
26709 parsoid=html2wt
26710 !! html/parsoid
26711 <table id='mwAb'>
26712 <td id='mwAc'>foo</td>
26713 <td id='serialize-this'>bar</td>
26714 </table>
26715 !! wikitext
26716 {|
26717 |foo
26718 | id="serialize-this" |bar
26719 |}
26720 !! end
26721
26722 !! test
26723 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26724 !! options
26725 parsoid=html2wt
26726 !! html/parsoid
26727 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26728 !! wikitext
26729 <div id="hello">ok</div>
26730 !! end
26731
26732 !! test
26733 WTS change modes
26734 !! options
26735 parsoid={
26736 "modes": ["wt2wt"],
26737 "changes": [
26738 [ "#xyz", "before", "<b>before</b> stuff " ],
26739 [ "#xyz", "after", " stuff <i>after</i>" ],
26740 [ "#xyz", "html", "x <b>y</b> z" ]
26741 ]
26742 }
26743 !! wikitext
26744 <span id="xyz">hello</span>
26745 !! wikitext/edited
26746 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26747 !! end
26748
26749 !! test
26750 Never serialize a-tag as html, regardless of what data-parsoid has to say
26751 !! options
26752 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26753 !! html/parsoid
26754 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26755 !! wikitext
26756 [[Foo]]
26757 !! end
26758
26759 ## SSS FIXME: This is broken output nevertheless.
26760 ## What might be a reasonable non-broken output for this?
26761 ## This is an edge case unlikely to be seen in production
26762 ## that I am not wasting more time on this right now.
26763 !! test
26764 Never serialize a-tag as html, no matter what attributes it has
26765 !! options
26766 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26767 !! html/parsoid
26768 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26769 !! wikitext
26770 [http://boo.org http://boohoo.org]
26771 !! end
26772
26773 # Misnested is an indication that selser can reuse the source but these have
26774 # shown to sneak through on occasion. See T101768.
26775 # The original wikitext here is: [http://test.com [[one]] two three]
26776 !! test
26777 Strip span tags added to mark misnested links
26778 !! options
26779 parsoid=html2wt
26780 !! html/parsoid
26781 <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>
26782 !! wikitext
26783 [http://test.com][[one]] two three
26784 !! end
26785
26786 !! test
26787 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26788 !! options
26789 parsoid=html2wt
26790 !! html/parsoid
26791 <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|}"]}'>
26792 <tbody><tr><td>d
26793 </td></tr>
26794 </tbody></table>
26795 !! wikitext
26796 {{echo|a}}
26797 {|{{echo|c
26798 {{!}}d
26799 }}
26800 |}
26801 !! end
26802
26803 ## This test verifies the presence and computation of this attribute indirectly
26804 ## by making an edit and ensuring that the serialization is correct (which it would be
26805 ## only if firstWikitextNode is properly set).
26806 !! test
26807 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26808 !! options
26809 parsoid= {
26810 "modes": ["wt2wt"],
26811 "changes": [
26812 [ "div#x", "remove" ],
26813 [ "div", "before", "<div>new</div>" ]
26814 ]
26815 }
26816 !! wikitext
26817 <div id="x">foo</div>
26818 {|
26819 {{echo|<div>boo</div>
26820 {{!}}b}}
26821 |c
26822 |}
26823 !! wikitext/edited
26824
26825 <div>new</div>
26826 {|
26827 {{echo|<div>boo</div>
26828 {{!}}b}}
26829 |c
26830 |}
26831 !! end
26832
26833 # --------------------------------------------
26834 # Tests spec'ing wikitext serialization norms |
26835 # --------------------------------------------
26836
26837 !! test
26838 1. Categories should always be serialized on their own line
26839 !! options
26840 parsoid=html2wt
26841 !! html/parsoid
26842 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26843 !! wikitext
26844 foo
26845 [[Category:Foo]]
26846 bar
26847 !! end
26848
26849 !! test
26850 2. Categories that are part of templates should not introduce a line break
26851 !! wikitext
26852 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26853 !! html/parsoid
26854 <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>
26855 !! end
26856
26857 # Careful while editing these next 2 tests. There are \u200f characters
26858 # before and after the <link> tags in the HTML and following some
26859 # of the categories in wikitext
26860 # Do not remove these characters in edits.
26861 #
26862 # As part of the serialization, these bidi characters will get stripped.
26863 !! test
26864 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26865 !! options
26866 parsoid={
26867 "modes": ["html2wt"],
26868 "scrubWikitext": true
26869 }
26870 !! html/parsoid
26871 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26872 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26873 !! wikitext
26874 [[קטגוריה:טקסים]]
26875 [[קטגוריה: שיטות משפט]]
26876 !! end
26877
26878 !! test
26879 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26880 !! options
26881 parsoid={
26882 "modes": ["html2wt"],
26883 "scrubWikitext": true
26884 }
26885 !! html/parsoid
26886 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26887 !! wikitext
26888 [[קטגוריה:טקסים]]
26889 ‏y
26890 !! end
26891
26892 !! test
26893 Lists: Add space after bullets
26894 !! options
26895 parsoid=html2wt
26896 !! html/parsoid
26897 <ul>
26898 <li>foo</li>
26899 <li> bar</li>
26900 <li><span> baz</span></li>
26901 </ul>
26902 !! wikitext
26903 * foo
26904 * bar
26905 * <span> baz</span>
26906 !! end
26907
26908 !! test
26909 1. Headings: Add space before/after == (T53744)
26910 !! options
26911 parsoid=html2wt
26912 !! html/parsoid
26913 <h2>foo</h2>
26914 <h2> bar</h2>
26915 <h2>baz </h2>
26916 <h2><span> baz</span></h2>
26917 !! wikitext
26918 == foo ==
26919
26920 == bar ==
26921
26922 == baz ==
26923
26924 == <span> baz</span> ==
26925 !! end
26926
26927 !! test
26928 2. Headings: Add space before/after == even after hoisted content
26929 !! options
26930 parsoid={
26931 "modes": ["html2wt"],
26932 "scrubWikitext": true
26933 }
26934 !! html/parsoid
26935 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26936 !! wikitext
26937 [[Category:A2]]
26938
26939 == ok ==
26940 !! end
26941
26942 !! test
26943 1. Headings: suppress newly created empty headings
26944 !! options
26945 parsoid={
26946 "modes": ["html2wt"],
26947 "scrubWikitext": true
26948 }
26949 !! html/parsoid
26950 <h2></h2>
26951 !! wikitext
26952 !! end
26953
26954 !! test
26955 2. Headings: don't suppress empty headings if scrubWikitext is false
26956 !! options
26957 parsoid=html2wt
26958 !! html/parsoid
26959 <h2></h2>
26960 !! wikitext
26961 ==<nowiki/>==
26962 !! end
26963
26964 !! test
26965 3. Headings: suppress empty headings on edits
26966 !! options
26967 parsoid={
26968 "modes": ["selser"],
26969 "scrubWikitext": true,
26970 "changes": [
26971 [ "#x", "remove"]
26972 ]
26973 }
26974 !! wikitext
26975 ==<span id="x">foo</span>==
26976 !! wikitext/edited
26977 !! end
26978
26979 !! test
26980 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26981 !! options
26982 parsoid={
26983 "modes": ["html2wt"],
26984 "scrubWikitext": true
26985 }
26986 !! html/parsoid
26987 <h2>foo<br/>bar</h2>
26988 <h2>foo <span><br/>bar</span> baz</h2>
26989 !! wikitext
26990 == foo bar ==
26991
26992 == foo <span> bar</span> baz ==
26993 !! end
26994
26995 !! test
26996 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26997 !! options
26998 parsoid={
26999 "modes": ["html2wt"],
27000 "scrubWikitext": false
27001 }
27002 !! html/parsoid
27003 <h2>foo<br/>bar</h2>
27004 !! wikitext
27005 == foo<br> bar ==
27006 !! end
27007
27008 !! test
27009 1. WT Quote Tags: suppress newly created empty style tags
27010 !! options
27011 parsoid={
27012 "modes": ["html2wt"],
27013 "scrubWikitext": true
27014 }
27015 !! html/parsoid
27016 <i></i><b></b>
27017 !! wikitext
27018 !! end
27019
27020 !! test
27021 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27022 !! options
27023 parsoid=html2wt
27024 !! html/parsoid
27025 <i></i><b></b>
27026 !! wikitext
27027 ''<nowiki/>'''''<nowiki/>'''
27028 !! end
27029
27030 !! test
27031 3. WT Quote Tags: suppress empty style tags on edits
27032 !! options
27033 parsoid={
27034 "modes": ["selser"],
27035 "scrubWikitext": true,
27036 "changes": [
27037 [ "#x", "remove"]
27038 ]
27039 }
27040 !! wikitext
27041 '''<span id="x">foo</span>'''
27042 !! wikitext/edited
27043 !! end
27044
27045 !! test
27046 1. Anchors: suppress newly created empty anchors
27047 !! options
27048 parsoid={
27049 "modes": ["html2wt"],
27050 "scrubWikitext": true
27051 }
27052 !! html/parsoid
27053 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27054 !! wikitext
27055 !! end
27056
27057 !! test
27058 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27059 !! options
27060 parsoid={
27061 "modes": ["html2wt"],
27062 "scrubWikitext": false
27063 }
27064 !! html/parsoid
27065 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27066 !! wikitext
27067 [[Test|<nowiki/>]]
27068 !! end
27069
27070 !! test
27071 3. Anchors: suppress empty anchors on edits
27072 !! options
27073 parsoid={
27074 "modes": ["selser"],
27075 "scrubWikitext": true,
27076 "changes": [
27077 [ "#x", "remove"]
27078 ]
27079 }
27080 !! wikitext
27081 [[Test|<span id="x">foo</span>]]
27082 !! wikitext/edited
27083 !! end
27084
27085 !! test
27086 3a. Anchors: do not suppress numbered extlinks
27087 !! options
27088 parsoid={
27089 "modes": ["wt2wt"],
27090 "scrubWikitext": true
27091 }
27092 !! wikitext
27093 [http://foo.com]
27094 !! html/parsoid
27095 <a rel="mw:ExtLink" href="http://foo.com"></a>
27096 !! end
27097
27098 !! test
27099 3b. Anchors: do not suppress numbered extlinks
27100 !! options
27101 parsoid={
27102 "modes": ["wt2wt"],
27103 "scrubWikitext": true,
27104 "changes": [
27105 [ "#x", "remove"]
27106 ]
27107 }
27108 !! wikitext
27109 [http://foo.com <span id="x">foo</span>]
27110 !! wikitext/edited
27111 [http://foo.com]
27112 !! end
27113
27114 !!test
27115 Normalizations should be restricted to edited content
27116 !!options
27117 parsoid={
27118 "modes": ["selser"],
27119 "scrubWikitext": true,
27120 "changes": [
27121 [ "h1", "before", "<i></i>"]
27122 ]
27123 }
27124 !!wikitext
27125 a
27126 = =
27127 b
27128 !!wikitext/edited
27129 a
27130 = =
27131 b
27132 !!end
27133
27134 !! test
27135 1. Multiple normalizations (html2wt)
27136 !! options
27137 parsoid={
27138 "modes": ["html2wt"],
27139 "scrubWikitext": true
27140 }
27141 !! html
27142 <h2><i></i></h2>
27143 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27144 </a><b><i></i></b>x</p>
27145 !! wikitext
27146
27147 [[foo]]
27148 x
27149
27150 !! end
27151
27152 !! test
27153 2. Multiple normalizations (selser)
27154 !! options
27155 parsoid={
27156 "modes": ["selser"],
27157 "scrubWikitext": true,
27158 "changes": [
27159 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27160 ]
27161 }
27162 !! wikitext
27163 <span id="x">foo</span>
27164 !! wikitext/edited
27165 <span id="x">foo</span>
27166
27167 x
27168 !! end
27169
27170 !! test
27171 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27172 !! options
27173 parsoid={
27174 "modes": ["html2wt"],
27175 "scrubWikitext": true
27176 }
27177 !! html/parsoid
27178 <p> hi</p>
27179 <p> hello</p>
27180 !! wikitext
27181 hi
27182
27183 hello
27184 !! end
27185
27186 !! test
27187 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27188 !! options
27189 parsoid=html2wt
27190 !! html/parsoid
27191 <p> hi</p>
27192 <p> hello</p>
27193 !! wikitext
27194 <nowiki> </nowiki>hi
27195
27196 <nowiki> </nowiki> hello
27197 !! end
27198
27199 !! test
27200 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27201 !! options
27202 parsoid={
27203 "modes": ["html2wt"],
27204 "scrubWikitext": true
27205 }
27206 !! html/parsoid
27207 <p>Foo
27208 bar
27209 baz</p>
27210
27211 <table><tr><td>Foo
27212 bar
27213 baz bang</td></tr></table>
27214
27215 <p><!--boo--> foo
27216 bar</p>
27217
27218 <p> foo
27219 bar<span>boo</span></p>
27220 !! wikitext
27221 Foo
27222 bar
27223 baz
27224
27225 {|
27226 |Foo
27227 bar
27228 baz bang
27229 |}
27230
27231 <!--boo-->foo
27232 bar
27233
27234 foo
27235 bar<span>boo</span>
27236 !! end
27237
27238 !! test
27239 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27240 !! options
27241 parsoid={
27242 "modes": ["selser"],
27243 "scrubWikitext": true,
27244 "changes": [
27245 [ "p", "html", " a\n b" ]
27246 ]
27247 }
27248 !! wikitext
27249 xyz
27250 !! wikitext/edited
27251 a
27252 b
27253 !! end
27254
27255 !! test
27256 1. New links that end in spaces
27257 !! options
27258 parsoid={
27259 "modes": ["html2wt"],
27260 "scrubWikitext": false
27261 }
27262 !! html/parsoid
27263 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27264 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27265 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27266 !! wikitext
27267 [[Berlin ]]<nowiki/>is the capital of Germany.
27268
27269 [[Foo ]]'''bar'''
27270
27271 [[Boston ]] is a city.
27272 !! end
27273
27274 !! test
27275 2. New links that end in spaces
27276 !! options
27277 parsoid={
27278 "modes": ["html2wt"],
27279 "scrubWikitext": true
27280 }
27281 !! html/parsoid
27282 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27283 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27284 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27285 !! wikitext
27286 [[Berlin]] is the capital of Germany.
27287
27288 [[Foo]] '''bar'''
27289
27290 [[Boston]] is a city.
27291 !! end
27292
27293 !! test
27294 1. Table cells with escapable prefixes
27295 !! options
27296 parsoid={
27297 "modes": ["html2wt"],
27298 "scrubWikitext": false
27299 }
27300 !! html
27301 <table>
27302 <tr><td>a</td></tr>
27303 <tr><td>-</td></tr>
27304 <tr><td>+</td></tr>
27305 </table>
27306 !! wikitext
27307 {|
27308 |a
27309 |-
27310 |<nowiki>-</nowiki>
27311 |-
27312 |<nowiki>+</nowiki>
27313 |}
27314 !! end
27315
27316 !! test
27317 2. Table cells with escapable prefixes
27318 !! options
27319 parsoid={
27320 "modes": ["html2wt"],
27321 "scrubWikitext": true
27322 }
27323 !! html
27324 <table>
27325 <tr><td>a</td></tr>
27326 <tr><td>-</td></tr>
27327 <tr><td>+</td></tr>
27328 </table>
27329 !! wikitext
27330 {|
27331 |a
27332 |-
27333 | -
27334 |-
27335 | +
27336 |}
27337 !! end
27338
27339 !! test
27340 3a. Table cells with escapable prefixes after edits
27341 !! options
27342 parsoid={
27343 "modes": ["selser"],
27344 "scrubWikitext": true,
27345 "changes": [
27346 [ "table tbody tr:first-child td:first-child", "remove"]
27347 ]
27348 }
27349 !! wikitext
27350 {|
27351 |a||-
27352 |}
27353 !! wikitext/edited
27354 {|
27355 | -
27356 |}
27357 !! end
27358
27359 !! test
27360 3b. Table cells with escapable prefixes after edits
27361 !! options
27362 parsoid={
27363 "modes": ["selser"],
27364 "scrubWikitext": true,
27365 "changes": [
27366 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27367 [ "#x", "remove" ]
27368 ]
27369 }
27370 !! wikitext
27371 {|
27372 |pqr
27373 |<span id="x">foo</span>+
27374 |}
27375 !! wikitext/edited
27376 {|
27377 | -
27378 | +
27379 |}
27380 !! end
27381
27382 # FIXME: This test will fail because
27383 # normalization doesn't realize that the id attribute
27384 # will eliminate the escapable scenario
27385 !! test
27386 4a. Table cells without escapable prefixes after edits
27387 !! options
27388 parsoid={
27389 "modes": ["selser"],
27390 "scrubWikitext": true,
27391 "changes": [
27392 [ "#x", "html", "-" ]
27393 ]
27394 }
27395 !! wikitext
27396 {|
27397 | id="x" |abcd
27398 |}
27399 !! wikitext/edited
27400 {|
27401 | id="x" |-
27402 |}
27403 !! end
27404
27405 ## This tests normalizer's ability to discriminate between
27406 ## cells having identical content.
27407 !! test
27408 4b. Table cells without escapable prefixes after edits
27409 !! options
27410 parsoid={
27411 "modes": ["selser"],
27412 "scrubWikitext": true,
27413 "changes": [
27414 [ "td", "html", "-" ]
27415 ]
27416 }
27417 !! wikitext
27418 {|
27419 |a||b
27420 |}
27421 !! wikitext/edited
27422 {|
27423 | -||-
27424 |}
27425 !! end
27426
27427 ## This tests normalizer's ability to not be tripped by
27428 ## comments (and whitespace)
27429 !! test
27430 4c. Table cells without escapable prefixes after edits
27431 !! options
27432 parsoid={
27433 "modes": ["selser"],
27434 "scrubWikitext": true,
27435 "changes": [
27436 [ "table tbody tr td:first-child", "remove" ]
27437 ]
27438 }
27439 !! wikitext
27440 {|
27441 |-
27442 <!--foo--> |a||-
27443 |}
27444 !! wikitext/edited
27445 {|
27446 |-
27447 <!--foo--> | -
27448 |}
27449 !! end
27450
27451 ## This tests normalizer's ability to handle HTML cells
27452 !! test
27453 4d. Table cells without escapable prefixes after edits
27454 !! options
27455 parsoid={
27456 "modes": ["selser"],
27457 "scrubWikitext": true,
27458 "changes": [
27459 [ "td", "html", "-" ]
27460 ]
27461 }
27462 !! wikitext
27463 <table>
27464 <tr><td>a</td></tr>
27465 </table>
27466 !! wikitext/edited
27467 <table>
27468 <tr><td>-</td></tr>
27469 </table>
27470 !! end
27471
27472 ## T111151 Remove font elements without attributes
27473 !! test
27474 5a. font tags without attributes should be dropped in scrubWikitext mode
27475 !! options
27476 parsoid={
27477 "modes": ["html2wt"],
27478 "scrubWikitext": true
27479 }
27480 !! html
27481 <font>foo</font>
27482 <font><font>bar</font></font>
27483 <font class="x">boo</font>
27484 !! wikitext
27485 foo
27486 bar
27487 <font class="x">boo</font>
27488 !! end
27489
27490 !! test
27491 5b. font tags should not be dropped without scrubWikitext being enabled
27492 !! options
27493 parsoid={
27494 "modes": ["html2wt"],
27495 "scrubWikitext": false
27496 }
27497 !! html
27498 <font>foo</font>
27499 !! wikitext
27500 <font>foo</font>
27501 !! end
27502
27503 !! test
27504 Escape nowiki DOM elements
27505 !! options
27506 parsoid=html2wt
27507 !! html/parsoid
27508 <nowiki><i>foo</i></nowiki>
27509 !! wikitext
27510 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27511 !! end
27512
27513 # This is meant to be an interim fix while we go about figuring out
27514 # how to not introduce these trailing <nowiki/>s in the first place.
27515 !! test
27516 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27517 !! options
27518 parsoid=html2wt
27519 !! html/parsoid
27520 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27521 y</p>
27522 <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>
27523 <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>
27524 !! wikitext
27525 x
27526 y
27527
27528 {{echo|
27529 1 = <nowiki/>}}
27530
27531 {{echo|
27532 1 = <nowiki/>
27533 }}
27534 !! end
27535
27536 # ---------------------------------------------------
27537 # End of tests spec'ing wikitext serialization norms |
27538 # ---------------------------------------------------
27539
27540 # T104032
27541 !! test
27542 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27543 !! options
27544 parsoid=html2wt
27545 !! html/parsoid
27546 a<p>b</p>
27547 <b>c</b><p>d</p>
27548 <table><tr>
27549 <td>a<p>b</p></td>
27550 <td><b>c</b><p>d</p></td>
27551 </tr></table>
27552 !! wikitext
27553 a
27554
27555 b
27556
27557 '''c'''
27558
27559 d
27560 {|
27561 |a
27562 b
27563 |'''c'''
27564 d
27565 |}
27566 !! end
27567
27568 # -----------------------------------------------------------------
27569 # End of section for Parsoid-only html2wt tests for serialization
27570 # of new content
27571 # -----------------------------------------------------------------
27572
27573 # -----------------------------------------------------------------
27574 # The following section of tests are primarily to spec behavior of
27575 # the selective serializer. All these tests have manual selser
27576 # changes. The automated selser changes for all tests handle the
27577 # wide variation of changes, but these tests here capture specs
27578 # deterministically.
27579 # ----------------------------------------------------------------
27580
27581 ## T90517
27582 !! test
27583 Selser: New comments should not be lost
27584 !! options
27585 parsoid={
27586 "modes": ["selser"],
27587 "changes": [
27588 [ "#a", "after", "<!--c1-->" ],
27589 [ "#b", "before", "<!--c2-->" ]
27590 ]
27591 }
27592 !! wikitext
27593 <span id="a">a</span>
27594
27595 <span id="b">b</span>
27596 !! wikitext/edited
27597 <span id="a">a</span><!--c1-->
27598
27599 <!--c2--><span id="b">b</span>
27600 !! end
27601
27602 ## T89383
27603 !! test
27604 Selser: Check for validity of DSR before using it
27605 !! options
27606 parsoid={
27607 "modes": ["selser"],
27608 "changes": [
27609 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27610 ]
27611 }
27612 !! wikitext
27613 <span id="a">a</span>
27614 !! wikitext/edited
27615 {{DISPLAYTITLE:foo}}
27616 <span id="a">a</span>
27617 !! end
27618
27619 !! test
27620 1. DOMDiff: Changes to <ref> content should be looked up using id
27621 !! options
27622 parsoid={
27623 "modes": ["selser"],
27624 "changes": [
27625 ["#X", "after", "bar"],
27626 ["#Y", "after", "baz"]
27627 ]
27628 }
27629 !! wikitext
27630 X <ref><span id="X">foo</span></ref>
27631 Y <ref name="a" />
27632 <references>
27633 <ref name="a"><span id="Y">foo</span></ref>
27634 </references>
27635 !! wikitext/edited
27636 X <ref><span id="X">foo</span>bar</ref>
27637 Y <ref name="a" />
27638 <references>
27639 <ref name="a"><span id="Y">foo</span>baz</ref>
27640 </references>
27641 !! end
27642
27643 !! test
27644 2. DOMDiff: Changes to <ref> content should be looked up using id
27645 !! options
27646 parsoid={
27647 "modes": ["selser"],
27648 "changes": [
27649 ["#Z", "after", "bar"]
27650 ]
27651 }
27652 !! wikitext
27653 A <ref>foo bar for a</ref>
27654 B <ref group="X" name="b" />
27655
27656 <references />
27657
27658 <references group="X">
27659 <ref name="b"><span id="Z">foo</span></ref>
27660 </references>
27661 !! wikitext/edited
27662 A <ref>foo bar for a</ref>
27663 B <ref group="X" name="b" />
27664
27665 <references />
27666
27667 <references group="X">
27668 <ref name="b"><span id="Z">foo</span>bar</ref>
27669 </references>
27670 !! end
27671
27672 !! test
27673 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27674 !! options
27675 parsoid={
27676 "modes": ["selser"],
27677 "changes": [
27678 [ "div:first-child", "text", "bar" ]
27679 ]
27680 }
27681 !! wikitext
27682 <div style="{{1x|color:red;}}%">foo</div>
27683 !! wikitext/edited
27684 <div style="{{1x|color:red;}}%">bar</div>
27685 !! end
27686
27687 !! test
27688 Empty LI (T49673)
27689 !! wikitext
27690 * a
27691 *
27692 *
27693 * b
27694 !! html/php+tidy
27695 <ul>
27696 <li>a</li>
27697 <li class="mw-empty-elt"></li>
27698 <li class="mw-empty-elt"></li>
27699 <li>b</li>
27700 </ul>
27701 !! end
27702
27703 !! test
27704 Thumbnail output
27705 !! wikitext
27706 [[File:Thumb.png|thumb]]
27707 !! html/php+tidy
27708 <div class="thumb tright">
27709 <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>
27710 <div class="thumbcaption">
27711 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27712 </div>
27713 </div>
27714 </div>
27715 !! end
27716
27717 !! test
27718 unclosed internal link XSS (T137264)
27719 !! wikitext
27720 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27721 !! html/php
27722 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27723 </p>
27724 !! html/parsoid
27725 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27726 !! end