505bc2d25f1d12039f78616759b0a21e642a6d68
[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 Heading with line break in nowiki
533 !! wikitext
534 == A <nowiki>B
535 C</nowiki> ==
536 !! html
537 <h2><span class="mw-headline" id="A_B.0AC">A B
538 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
539
540 !! end
541
542 !! test
543 Parsing an URL
544 !! wikitext
545 http://fr.wikipedia.org/wiki/🍺
546 <!-- EasterEgg we love beer, better be able be able to link to it -->
547 !! html
548 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
549 </p>
550 !! end
551
552 # Note that the html+tidy output removes the spaces after the <li>,
553 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
554 # This is an issue for all tests with lists. We intentionally do
555 # *not* add html+tidy clauses for these, as we don't want to
556 # document/test the broken behavior. (Parsoid matches the non-tidy
557 # output in these cases.)
558
559 !! test
560 Simple list
561 !! wikitext
562 * Item 1
563 * Item 2
564 !! html
565 <ul><li> Item 1</li>
566 <li> Item 2</li></ul>
567
568 !! end
569
570 !! test
571 Italics and bold
572 !! wikitext
573 * plain
574 * plain''italic''plain
575 * plain''italic''plain''italic''plain
576 * plain'''bold'''plain
577 * plain'''bold'''plain'''bold'''plain
578 * plain''italic''plain'''bold'''plain
579 * plain'''bold'''plain''italic''plain
580 * plain''italic'''bold-italic'''italic''plain
581 * plain'''bold''bold-italic''bold'''plain
582 * plain'''''bold-italic'''italic''plain
583 * plain'''''bold-italic''bold'''plain
584 * plain''italic'''bold-italic'''''plain
585 * plain'''bold''bold-italic'''''plain
586 * plain l'''italic''plain
587 * plain l''''bold''' plain
588 !! html
589 <ul><li> plain</li>
590 <li> plain<i>italic</i>plain</li>
591 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
592 <li> plain<b>bold</b>plain</li>
593 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
594 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
595 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
596 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
597 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
598 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
599 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
600 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
601 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
602 <li> plain l'<i>italic</i>plain</li>
603 <li> plain l'<b>bold</b> plain</li></ul>
604
605 !! end
606
607 # this example taken from the [[simple:Moon]] article (bug 47326)
608 !! test
609 Italics and possessives (1)
610 !! wikitext
611 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
612 !! html
613 <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
614 </p>
615 !! end
616
617 # this example taken from [[en:Flaming Pie]] (bug 49926)
618 !! test
619 Italics and possessives (2)
620 !! wikitext
621 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
622 !! html
623 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
624 </p>
625 !! end
626
627 # this example taken from [[en:Dictionary]] (bug 49926)
628 !! test
629 Italics and possessives (3)
630 !! wikitext
631 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''.
632 !! html
633 <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>.
634 </p>
635 !! end
636
637
638 ###
639 ### 2-quote opening sequence tests
640 ###
641 !! test
642 Italics and bold: 2-quote opening sequence: (2,2)
643 !! wikitext
644 ''foo''
645 !! html
646 <p><i>foo</i>
647 </p>
648 !!end
649
650 !! test
651 Italics and bold: 2-quote opening sequence: (2,3)
652 !! wikitext
653 ''foo'''
654 !! html/*
655 <p><i>foo'</i>
656 </p>
657 !!end
658
659 !! test
660 Italics and bold: 2-quote opening sequence: (2,4)
661 !! options
662 parsoid=wt2html
663 !! wikitext
664 ''foo''''
665 !! html/*
666 <p><i>foo''</i>
667 </p>
668 !!end
669
670 # same html as previous, but wikitext adjusted to match parsoid html2wt
671 !! test
672 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
673 !! wikitext
674 ''foo<nowiki>''</nowiki>''
675 !! html
676 <p><i>foo''</i>
677 </p>
678 !! end
679
680 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
681 !! test
682 Italics and bold: 2-quote opening sequence: (2,5)
683 !! options
684 parsoid=wt2html
685 !! wikitext
686 ''foo'''''
687 !! html/php
688 <p><i>foo</i>
689 </p>
690 !! html/parsoid
691 <p><i>foo</i><b></b>
692 </p>
693 !!end
694
695 # same html as previous, but wikitext adjusted to match parsoid html2wt
696 !! test
697 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
698 !! wikitext
699 ''foo'''''<nowiki/>'''
700 !! html/php
701 <p><i>foo</i>
702 </p>
703 !! html/parsoid
704 <p><i>foo</i><b></b>
705 </p>
706 !! end
707
708
709 ###
710 ### 3-quote opening sequence tests
711 ###
712
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,2)
715 !! wikitext
716 '''foo''
717 !! html/*
718 <p>'<i>foo</i>
719 </p>
720 !!end
721
722 !! test
723 Italics and bold: 3-quote opening sequence: (3,3)
724 !! wikitext
725 '''foo'''
726 !! html
727 <p><b>foo</b>
728 </p>
729 !!end
730
731 !! test
732 Italics and bold: 3-quote opening sequence: (3,4)
733 !! wikitext
734 '''foo''''
735 !! html/*
736 <p><b>foo'</b>
737 </p>
738 !!end
739
740 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
741 !! test
742 Italics and bold: 3-quote opening sequence: (3,5)
743 !! options
744 parsoid=wt2html
745 !! wikitext
746 '''foo'''''
747 !! html/php
748 <p><b>foo</b>
749 </p>
750 !! html/parsoid
751 <p><b>foo</b><i></i>
752 </p>
753 !!end
754
755 # same html as previous, but wikitext adjusted to match parsoid html2wt
756 !! test
757 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
758 !! wikitext
759 '''foo'''''<nowiki/>''
760 !! html/php
761 <p><b>foo</b>
762 </p>
763 !! html/parsoid
764 <p><b>foo</b><i></i>
765 </p>
766 !! end
767
768
769 ###
770 ### 4-quote opening sequence tests
771 ###
772
773 !! test
774 Italics and bold: 4-quote opening sequence: (4,2)
775 !! options
776 parsoid=wt2html
777 !! wikitext
778 ''''foo''
779 !! html/*
780 <p>''<i>foo</i>
781 </p>
782 !!end
783
784 # same html as previous, but wikitext adjusted to match parsoid html2wt
785 !! test
786 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
787 !! wikitext
788 <nowiki>''</nowiki>''foo''
789 !! html
790 <p>''<i>foo</i>
791 </p>
792 !! end
793
794 !! test
795 Italics and bold: 4-quote opening sequence: (4,3)
796 !! wikitext
797 ''''foo'''
798 !! html/*
799 <p>'<b>foo</b>
800 </p>
801 !!end
802
803 !! test
804 Italics and bold: 4-quote opening sequence: (4,4)
805 !! options
806 parsoid=wt2html
807 !! wikitext
808 ''''foo''''
809 !! html/*
810 <p>'<b>foo'</b>
811 </p>
812 !!end
813
814 # same html as previous, but wikitext adjusted to match parsoid html2wt
815 !! test
816 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
817 !! wikitext
818 '<nowiki/>'''foo''''
819 !! html
820 <p>'<b>foo'</b>
821 </p>
822 !! end
823
824 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
825 !! test
826 Italics and bold: 4-quote opening sequence: (4,5)
827 !! options
828 parsoid=wt2html
829 !! wikitext
830 ''''foo'''''
831 !! html/php
832 <p>'<b>foo</b>
833 </p>
834 !! html/parsoid
835 <p>'<b>foo</b><i></i>
836 </p>
837 !!end
838
839 # same html as previous, but wikitext adjusted to match parsoid html2wt
840 !! test
841 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
842 !! wikitext
843 '<nowiki/>'''foo'''''<nowiki/>''
844 !! html/php
845 <p>'<b>foo</b>
846 </p>
847 !! html/parsoid
848 <p>'<b>foo</b><i></i>
849 </p>
850 !! end
851
852
853 ###
854 ### 5-quote opening sequence tests
855 ###
856
857 !! test
858 Italics and bold: 5-quote opening sequence: (5,2)
859 !! options
860 parsoid=wt2html
861 !! wikitext
862 '''''foo''
863 !! html/*
864 <p><b><i>foo</i></b>
865 </p>
866 !!end
867
868 # same html as previous, but wikitext adjusted to match parsoid html2wt
869 !! test
870 Italics and bold: 5-quote opening sequence: (5,2+3)
871 !! wikitext
872 '''''foo'''''
873 !! html/*
874 <p><i><b>foo</b></i>
875 </p>
876 !! end
877
878 !! test
879 Italics and bold: 5-quote opening sequence: (5,3)
880 !! options
881 parsoid=wt2html
882 !! wikitext
883 '''''foo'''
884 !! html/*
885 <p><i><b>foo</b></i>
886 </p>
887 !!end
888
889 # same html as previous, but wikitext adjusted to match parsoid html2wt
890 !! test
891 Italics and bold: 5-quote opening sequence: (5,3+2)
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,4)
901 !! options
902 parsoid=wt2html
903 !! wikitext
904 '''''foo''''
905 !! html/*
906 <p><i><b>foo'</b></i>
907 </p>
908 !!end
909
910 !! test
911 Italics and bold: 5-quote opening sequence: (5,5)
912 !! wikitext
913 '''''foo'''''
914 !! html
915 <p><i><b>foo</b></i>
916 </p>
917 !!end
918
919 !! test
920 Italics and bold: 5-quote opening sequence: (5,6)
921 !! wikitext
922 '''''foo''''''
923 !! html/*
924 <p><i><b>foo'</b></i>
925 </p>
926 !! end
927
928 ###
929 ### multiple quote sequences in a line
930 ###
931 !! test
932 Italics and bold: multiple quote sequences: (2,4,2)
933 !! options
934 parsoid=wt2html
935 !! wikitext
936 ''foo''''bar''
937 !! html/*
938 <p><i>foo'<b>bar</b></i>
939 </p>
940 !!end
941
942
943 # same html as previous, but wikitext adjusted to match parsoid html2wt
944 !! test
945 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
946 !! wikitext
947 ''foo'<nowiki/>'''bar'''''
948 !! html
949 <p><i>foo'<b>bar</b></i>
950 </p>
951 !! end
952
953
954 !! test
955 Italics and bold: multiple quote sequences: (2,4,3)
956 !! options
957 parsoid=wt2html
958 !! wikitext
959 ''foo''''bar'''
960 !! html/*
961 <p><i>foo'<b>bar</b></i>
962 </p>
963 !!end
964
965
966 # same html as previous, but wikitext adjusted to match parsoid html2wt
967 !! test
968 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
969 !! wikitext
970 ''foo'<nowiki/>'''bar'''''
971 !! html
972 <p><i>foo'<b>bar</b></i>
973 </p>
974 !! end
975
976
977 !! test
978 Italics and bold: multiple quote sequences: (2,4,4)
979 !! options
980 parsoid=wt2html
981 !! wikitext
982 ''foo''''bar''''
983 !! html/*
984 <p><i>foo'<b>bar'</b></i>
985 </p>
986 !!end
987
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
992 !! wikitext
993 ''foo'<nowiki/>'''bar'<nowiki/>'''''
994 !! html
995 <p><i>foo'<b>bar'</b></i>
996 </p>
997 !! end
998
999
1000 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1001 !! test
1002 Italics and bold: multiple quote sequences: (3,4,2)
1003 !! options
1004 parsoid=wt2html
1005 !! wikitext
1006 '''foo''''bar''
1007 !! html/php
1008 <p><b>foo'</b>bar
1009 </p>
1010 !! html/parsoid
1011 <p><b>foo'</b>bar<i></i>
1012 </p>
1013 !!end
1014
1015 # same html as previous, but wikitext adjusted to match parsoid html2wt
1016 !! test
1017 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1018 !! options
1019 parsoid
1020 !! wikitext
1021 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1022 !! html/php
1023 <p><b>foo'</b>bar
1024 </p>
1025 !! html/parsoid
1026 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1027 </p>
1028 !! end
1029
1030
1031 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1032 !! test
1033 Italics and bold: multiple quote sequences: (3,4,3)
1034 !! options
1035 parsoid=wt2html
1036 !! wikitext
1037 '''foo''''bar'''
1038 !! html/php
1039 <p><b>foo'</b>bar
1040 </p>
1041 !! html/parsoid
1042 <p><b>foo'</b>bar<b></b>
1043 </p>
1044 !!end
1045
1046 # same html as previous, but wikitext adjusted to match parsoid html2wt
1047 !! test
1048 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1049 !! wikitext
1050 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1051 !! html/php
1052 <p><b>foo'</b>bar
1053 </p>
1054 !! html/parsoid
1055 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1056 </p>
1057 !! end
1058
1059 ###
1060 ### other quote tests
1061 ###
1062 !! test
1063 Italics and bold: other quote tests: (2,3,5)
1064 !! wikitext
1065 ''this is about '''foo's family'''''
1066 !! html
1067 <p><i>this is about <b>foo's family</b></i>
1068 </p>
1069 !!end
1070
1071
1072 !! test
1073 Italics and bold: other quote tests: (2,(3,3),2)
1074 !! wikitext
1075 ''this is about '''foo's''' family''
1076 !! html
1077 <p><i>this is about <b>foo's</b> family</i>
1078 </p>
1079 !!end
1080
1081
1082 !! test
1083 Italics and bold: other quote tests: (3,2,3,2)
1084 !! options
1085 parsoid=wt2html
1086 !! wikitext
1087 '''this is about ''foo'''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 # same html as previous, but wikitext adjusted to match parsoid html2wt
1095 !! test
1096 Italics and bold: other quote tests: (3,2,3+2+2,2)
1097 !! wikitext
1098 '''this is about ''foo'''''<nowiki/>''s family''
1099 !! html
1100 <p><b>this is about <i>foo</i></b><i>s family</i>
1101 </p>
1102 !! end
1103
1104
1105 !! test
1106 Italics and bold: other quote tests: (3,2,3,3)
1107 !! wikitext
1108 '''this is about ''foo'''s family'''
1109 !! html/*
1110 <p>'<i>this is about </i>foo<b>s family</b>
1111 </p>
1112 !!end
1113
1114
1115 !! test
1116 Italics and bold: other quote tests: (3,(2,2),3)
1117 !! wikitext
1118 '''this is about ''foo's'' family'''
1119 !! html
1120 <p><b>this is about <i>foo's</i> family</b>
1121 </p>
1122 !!end
1123
1124
1125 !! test
1126 Italicized possessive
1127 !! wikitext
1128 The ''[[Main Page]]'''s talk page.
1129 !! html/php
1130 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1131 </p>
1132 !! html/parsoid
1133 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1134 !! end
1135
1136 !! test
1137 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1138 (Requires tidy for PHP parser output to be fixed up)
1139 !! options
1140 parsoid=wt2html,wt2wt
1141 !! wikitext
1142 {|
1143 !''a!!''b
1144 |''a||''b
1145 |}
1146 !! html/php+tidy
1147 <table>
1148 <tr>
1149 <th><i>a</i></th>
1150 <th><i>b</i></th>
1151 <td><i>a</i></td>
1152 <td><i>b</i></td>
1153 </tr>
1154 </table>
1155 !! html/parsoid
1156 <table>
1157 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1158 <td><i>a</i></td><td><i>b</i></td></tr>
1159 </tbody></table>
1160 !! end
1161
1162 ###
1163 ### Non-html5 tags
1164 ###
1165
1166 !! test
1167 Non-html5 tags should be accepted
1168 !! wikitext
1169 <center>''foo''</center>
1170 <big>''foo''</big>
1171 <font>''foo''</font>
1172 <strike>''foo''</strike>
1173 <tt>''foo''</tt>
1174 !! html
1175 <center><i>foo</i></center>
1176 <p><big><i>foo</i></big>
1177 <font><i>foo</i></font>
1178 <strike><i>foo</i></strike>
1179 <tt><i>foo</i></tt>
1180 </p>
1181 !! end
1182
1183 !! test
1184 <wbr> is valid wikitext (bug 52468)
1185 !! wikitext
1186 <wbr>
1187 !! html
1188 <p><wbr />
1189 </p>
1190 !! end
1191
1192 # <strike> is HTML4, <s> is HTML4/5.
1193 !! test
1194 <s> or <strike> for strikethrough
1195 !! wikitext
1196 <strike>strike</strike>
1197
1198 <s>s</s>
1199 !! html
1200 <p><strike>strike</strike>
1201 </p><p><s>s</s>
1202 </p>
1203 !! end
1204
1205 ## a not permitted
1206 ## i,b,br omitted
1207 !! test
1208 Text-level semantic html elements in wikitext
1209 !! wikitext
1210 <em>text</em>
1211 <strong>text</strong>
1212 <small>text</small>
1213 <s>text</s>
1214 <cite>text</cite>
1215 <q>text</q>
1216 <dfn>text</dfn>
1217 <abbr>text</abbr>
1218 <data>text</data>
1219 <time>text</time>
1220 <code>text</code>
1221 <var>text</var>
1222 <samp>text</samp>
1223 <kbd>text</kbd>
1224 <sub>text</sub>
1225 <u>text</u>
1226 <mark>text</mark>
1227 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1228 <bdi>text</bdi>
1229 <bdo>text</bdo>
1230 <span>text</span>
1231 <wbr />
1232 !! html
1233 <p><em>text</em>
1234 <strong>text</strong>
1235 <small>text</small>
1236 <s>text</s>
1237 <cite>text</cite>
1238 <q>text</q>
1239 <dfn>text</dfn>
1240 <abbr>text</abbr>
1241 <data>text</data>
1242 <time>text</time>
1243 <code>text</code>
1244 <var>text</var>
1245 <samp>text</samp>
1246 <kbd>text</kbd>
1247 <sub>text</sub>
1248 <u>text</u>
1249 <mark>text</mark>
1250 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1251 <bdi>text</bdi>
1252 <bdo>text</bdo>
1253 <span>text</span>
1254 <wbr />
1255 </p>
1256 !! end
1257
1258 # test cases taken from
1259 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1260 !! test
1261 Ruby markup (W3C-style)
1262 !! wikitext
1263 ; Mono-ruby for individual base characters
1264 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1265 ; Group ruby
1266 : <ruby>今日<rt>きょう</rt></ruby>
1267 ; Jukugo ruby
1268 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1269 ; Inline ruby
1270 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1271 ; Double-sided ruby
1272 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1273 <ruby>
1274 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1275 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1276 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1277 </ruby>
1278 !! html
1279 <dl><dt> Mono-ruby for individual base characters</dt>
1280 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1281 <dt> Group ruby</dt>
1282 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1283 <dt> Jukugo ruby</dt>
1284 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1285 <dt> Inline ruby</dt>
1286 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1287 <dt> Double-sided ruby</dt>
1288 <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>
1289 <p><ruby>
1290 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1291 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1292 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1293 </ruby>
1294 </p>
1295 !! end
1296
1297 # The next two test different paths in the sanitizer.
1298 !! test
1299 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1300 !! wikitext
1301 <blockquote|>a</blockquote>
1302
1303 <b→> doesn't terminate </b→>
1304
1305 <bä> doesn't terminate </bä>
1306
1307 <boo> doesn't terminate </boo>
1308
1309 <s.foo> doesn't terminate </s.foo>
1310
1311 <sub-ID#1>
1312 !! html
1313 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1314 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1315 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1316 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1317 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1318 </p><p>&lt;sub-ID#1&gt;
1319 </p>
1320 !! end
1321
1322 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1323 # If the non-word-character tag made it through the sanitizer, tidy
1324 # would munge it up.
1325 !! test
1326 Non-word characters don't terminate tag names + tidy
1327 !! wikitext
1328 <blockquote|>a</blockquote>
1329
1330 <b→> doesn't terminate </b→>
1331
1332 <bä> doesn't terminate </bä>
1333
1334 <boo> doesn't terminate </boo>
1335
1336 <s.foo> doesn't terminate </s.foo>
1337
1338 <sub-ID#1>
1339 !! html+tidy
1340 <p>&lt;blockquote|&gt;a</p>
1341 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1342 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1343 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1344 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1345 <p>&lt;sub-ID#1&gt;</p>
1346 !! end
1347
1348 ###
1349 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1350 ### This checks that HTML5 tags (with non-word characters in the tag
1351 ### name) make it safely through the parser -- the Sanitizer will
1352 ### munge them later, as it should.
1353 ###
1354 !! test
1355 Non-word characters are valid in extension tags (T19663)
1356 !! wikitext
1357 <tåg>tåg</tåg>
1358 !! html/php
1359 <pre>
1360 'tåg'
1361 array (
1362 )
1363 </pre>
1364
1365 !! html/parsoid
1366 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1367 !! end
1368
1369 !! test
1370 Isolated close tags should be treated as literal text (bug 52760)
1371 !! options
1372 parsoid=wt2html
1373 !! wikitext
1374 </b>
1375
1376 <s.foo>s</s>
1377 !! html/php+tidy
1378 <p>&lt;s.foo&gt;s</p>
1379 !! html/parsoid
1380 <p>&lt;s.foo&gt;s</p>
1381 !! end
1382
1383 ###
1384 ### Special characters
1385 ###
1386
1387 !! test
1388 Bare pipe character (bug 52363)
1389 !! wikitext
1390 |
1391 !! html
1392 <p>|
1393 </p>
1394 !! end
1395
1396 !! test
1397 Bare pipe character from a template (bug 52363)
1398 !! wikitext
1399 {{pipe}}
1400 !! html
1401 <p>|
1402 </p>
1403 !! end
1404
1405 ###
1406 ### <nowiki> test cases
1407 ###
1408
1409 !! test
1410 <nowiki> unordered list
1411 !! wikitext
1412 <nowiki>* This is not an unordered list item.</nowiki>
1413 !! html/php
1414 <p>* This is not an unordered list item.
1415 </p>
1416 !! html/parsoid
1417 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1418 !! end
1419
1420 !! test
1421 <nowiki> spacing
1422 !! wikitext
1423 <nowiki>Lorem ipsum dolor
1424
1425 sed abit.
1426 sed nullum.
1427
1428 :and a colon
1429 </nowiki>
1430 !! html/php
1431 <p>Lorem ipsum dolor
1432
1433 sed abit.
1434 sed nullum.
1435
1436 :and a colon
1437
1438 </p>
1439 !! html/parsoid
1440 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1441
1442 sed abit.
1443 sed nullum.
1444
1445 :and a colon
1446 </span></p>
1447 !! end
1448
1449 !! test
1450 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1451 !! wikitext
1452 <nowiki><span class="error"></nowiki>
1453 !! html/php
1454 <p>&lt;span class="error"&gt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 nowiki 3
1460 !! wikitext
1461 :There is not nowiki.
1462 :There is <nowiki>nowiki</nowiki>.
1463
1464 #There is not nowiki.
1465 #There is <nowiki>nowiki</nowiki>.
1466
1467 *There is not nowiki.
1468 *There is <nowiki>nowiki</nowiki>.
1469 !! html/php
1470 <dl><dd>There is not nowiki.</dd>
1471 <dd>There is nowiki.</dd></dl>
1472 <ol><li>There is not nowiki.</li>
1473 <li>There is nowiki.</li></ol>
1474 <ul><li>There is not nowiki.</li>
1475 <li>There is nowiki.</li></ul>
1476
1477 !! html/parsoid
1478 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1479 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1480
1481 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1482 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1483
1484 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1485 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1486 !! end
1487
1488 !! test
1489 Entities inside <nowiki>
1490 !! wikitext
1491 <nowiki>&lt;</nowiki>
1492 !! html
1493 <p>&lt;
1494 </p>
1495 !! end
1496
1497 !! test
1498 Entities inside template parameters
1499 !! wikitext
1500 {{echo|&ndash;}}
1501 !! html/php+tidy
1502 <p>–</p>
1503 !! html/parsoid
1504 <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>
1505 !! end
1506
1507 !! test
1508 Properly escape nowiki when combined with other wiki markup
1509 !! options
1510 parsoid=html2wt
1511 !! html/parsoid
1512 <p>* &lt;/nowiki&gt; tag</p>
1513 !! wikitext
1514 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1515 !! end
1516
1517 !! test
1518 T93824: Put escaped HTML tags inside nowiki
1519 !! options
1520 parsoid=html2wt
1521 !! html/parsoid
1522 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1523 !! wikitext
1524 <nowiki><h2>foo</h2></nowiki>
1525 !! end
1526
1527 !! test
1528 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1529 !! options
1530 parsoid=html2wt
1531 !! html/parsoid
1532 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1533 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1534 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1535 !! wikitext
1536 This text: L'[[Foo]]
1537 This text: L<nowiki>''</nowiki>[[Foo]]
1538 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1539 !! end
1540
1541 # This test fails because wikitext whitespace is not normalized before comparing.
1542 !! test
1543 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1544 !! options
1545 parsoid=html2wt
1546 !! html/parsoid
1547 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1548 </p>
1549 !! wikitext
1550 This text : L<nowiki>''</nowiki>[[Foo]]
1551 !! end
1552
1553 # This test and the next one are html2wt only as they test that incorrect wikitext
1554 # passed in template arguments gets escaped or wrapped in nowikis where required.
1555 !! test
1556 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1557 !! options
1558 parsoid=html2wt
1559 !! html/parsoid
1560 <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>
1561 <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>
1562 !! wikitext
1563 {{echo|foo{{!}}bar}}
1564 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1565 !! end
1566
1567 !! test
1568 T53961: Output correct nowikis in template arguments
1569 !! options
1570 parsoid=html2wt
1571 !! html/parsoid
1572 <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>
1573 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1574 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1575 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1576 <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>
1577 !! wikitext
1578 {{echo|a [ b}}
1579 {{echo|<nowiki>a }} b</nowiki>}}
1580 {{echo|<nowiki>a [[ b</nowiki>}}
1581 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1582 {{echo|a <nowiki>}</nowiki>}}
1583 !! end
1584
1585 !! test
1586 Cases where "!!" needs nowiki protection
1587 !! options
1588 parsoid=html2wt
1589 !! html/parsoid
1590 <table>
1591 <tr><th>this needs protection !! here</th></tr>
1592 </table>
1593
1594 <table>
1595 <tr><th>this does not need
1596 protection !! here</th></tr>
1597 </table>
1598 !! wikitext
1599 {|
1600 !<nowiki>this needs protection !! here</nowiki>
1601 |}
1602
1603 {|
1604 !this does not need
1605 protection !! here
1606 |}
1607 !! end
1608
1609 ###
1610 ### Comments
1611 ###
1612 !! test
1613 Comments and Indent-Pre
1614 !! wikitext
1615 <!-- comment 1 --> asdf
1616
1617 <!-- comment 1 --> asdf
1618 <!-- comment 2 -->
1619
1620 <!-- comment 1 --> asdf
1621 <!-- comment 2 -->xyz
1622
1623 <!-- comment 1 --> asdf
1624 <!-- comment 2 --> xyz
1625 !! html
1626 <pre>asdf
1627 </pre>
1628 <pre>asdf
1629 </pre>
1630 <pre>asdf
1631 </pre>
1632 <p>xyz
1633 </p>
1634 <pre>asdf
1635 xyz
1636 </pre>
1637 !! end
1638
1639 !! test
1640 Comment test 2a
1641 !! wikitext
1642 asdf
1643 <!-- comment 1 -->
1644 jkl
1645 !! html
1646 <p>asdf
1647 jkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment test 2b
1653 !! wikitext
1654 asdf
1655 <!-- comment 1 -->
1656
1657 jkl
1658 !! html
1659 <p>asdf
1660 </p><p>jkl
1661 </p>
1662 !! end
1663
1664 !! test
1665 Comment test 3
1666 !! wikitext
1667 asdf
1668 <!-- comment 1 -->
1669 <!-- comment 2 -->
1670 jkl
1671 !! html
1672 <p>asdf
1673 jkl
1674 </p>
1675 !! end
1676
1677 !! test
1678 Comment test 4
1679 !! wikitext
1680 asdf<!-- comment 1 -->jkl
1681 !! html
1682 <p>asdfjkl
1683 </p>
1684 !! end
1685
1686 !! test
1687 Comment spacing
1688 !! wikitext
1689 a
1690 <!-- foo --> b <!-- bar -->
1691 c
1692 !! html
1693 <p>a
1694 </p>
1695 <pre> b
1696 </pre>
1697 <p>c
1698 </p>
1699 !! end
1700
1701 !! test
1702 Comment whitespace
1703 !! wikitext
1704 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1705 !! html
1706
1707 !! end
1708
1709 !! test
1710 Comment semantics and delimiters
1711 !! wikitext
1712 <!-- --><!----><!-----><!------>
1713 !! html/php
1714
1715 !! html/parsoid
1716 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1717 !! end
1718
1719 !! test
1720 Comment semantics and delimiters, redux
1721 !! wikitext
1722 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1723 -- foo -- funky huh? ... -->
1724 !! html/php
1725
1726 !! html/parsoid
1727 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1728 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1729 !! end
1730
1731 !! test
1732 Comment semantics and delimiters: directors cut
1733 !! wikitext
1734 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1735 everything starting with < followed by !-- until the first -- and > we see,
1736 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1737 -->-->
1738 !! html/php
1739 <p>--&gt;
1740 </p>
1741 !! html/parsoid
1742 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1743 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1744 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1745 --><p>--></p>
1746 !! end
1747
1748 !! test
1749 Comment semantics: nesting
1750 !! wikitext
1751 <!--<!-- no, we're not going to do anything fancy here -->-->
1752 !! html/php
1753 <p>--&gt;
1754 </p>
1755 !! html/parsoid
1756 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1757 !! end
1758
1759 # Parsoid closes the unclosed comment, even if it means a slight
1760 # round-trip diff.
1761 !! test
1762 Comment semantics: unclosed comment at end
1763 !! options
1764 parsoid=wt2html,html2html
1765 !! wikitext
1766 <!--This comment will run out to the end of the document
1767 !! html/php
1768
1769 !! html/parsoid
1770 <!--This comment will run out to the end of the document-->
1771 !! end
1772
1773 !! test
1774 Comment semantics: normalize comments to play nice with XML and browsers
1775 !! wikitext
1776 <!-- Browsers --!> think this is closed -->
1777 <!--> This would normally be text -->
1778 <!---> As would this -->
1779 <!-- XML doesn't like trailing dashes -------->
1780 <!-- Nor doubled hyphens -- anywhere in the data -->
1781 But this is not a comment.
1782 !! html/php
1783 <p>But this is not a comment.
1784 </p>
1785 !! html/parsoid
1786 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1787 <!--&#x3E; This would normally be text -->
1788 <!--&#x2D;&#x3E; As would this -->
1789 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1790 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1791 <p>But this is not a comment.</p>
1792 !! end
1793
1794 !! test
1795 Comment semantics: round-trip even text which contains encoded -->
1796 !! wikitext
1797 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1798 !! html/parsoid
1799 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1800 !! end
1801
1802 !! test
1803 Comment in template title
1804 !! wikitext
1805 {{f<!---->oo}}
1806 !! html
1807 <p>FOO
1808 </p>
1809 !! end
1810
1811 !! test
1812 Comment on its own line post-expand
1813 !! wikitext
1814 a
1815 {{blank}}<!---->
1816 b
1817 !! html
1818 <p>a
1819 </p><p>b
1820 </p>
1821 !! end
1822
1823 !! test
1824 Comment on its own line post-expand with non-significant whitespace
1825 !! wikitext
1826 a
1827 {{blank}} <!---->
1828 b
1829 !! html
1830 <p>a
1831 </p><p>b
1832 </p>
1833 !! end
1834
1835 !! test
1836 Multiple comments should still parse as SOL-transparent
1837 !! options
1838 parsoid=wt2html,wt2wt
1839 !! wikitext
1840 <!--c1-->*a
1841 <!--c2--><!--c3--><!--c4-->*b
1842 !! html/php
1843 <ul><li>a</li>
1844 <li>b</li></ul>
1845
1846 !! html/parsoid
1847 <!--c1--><ul>
1848 <li>a
1849 </li>
1850 <!--c2--><!--c3--><!--c4-->
1851 <li>b
1852 </li>
1853 </ul>
1854 !! end
1855
1856 ###
1857 ### paragraph wrapping tests
1858 ###
1859 !! test
1860 No block tags
1861 !! wikitext
1862 a
1863
1864 b
1865 !! html
1866 <p>a
1867 </p><p>b
1868 </p>
1869 !! end
1870
1871 !! test
1872 Block tag on one line (<div>)
1873 !! wikitext
1874 a <div>foo</div>
1875
1876 b
1877 !! html
1878 a <div>foo</div>
1879 <p>b
1880 </p>
1881 !! html+tidy
1882 <p>a</p>
1883 <div>foo</div>
1884 <p>b</p>
1885 !! end
1886
1887 !! test
1888 Block tag on one line (<blockquote>)
1889 !! wikitext
1890 a <blockquote>foo</blockquote>
1891
1892 b
1893 !! html
1894 a <blockquote>foo</blockquote>
1895 <p>b
1896 </p>
1897 !! html+tidy
1898 <p>a</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 <p>b</p>
1903 !! end
1904
1905 !! test
1906 Block tag on both lines (<div>)
1907 !! wikitext
1908 a <div>foo</div>
1909
1910 b <div>foo</div>
1911 !! html
1912 a <div>foo</div>
1913 b <div>foo</div>
1914
1915 !! html+tidy
1916 <p>a</p>
1917 <div>foo</div>
1918 <p>b</p>
1919 <div>foo</div>
1920 !! end
1921
1922 !! test
1923 Block tag on both lines (<blockquote>)
1924 !! wikitext
1925 a <blockquote>foo</blockquote>
1926
1927 b <blockquote>foo</blockquote>
1928 !! html
1929 a <blockquote>foo</blockquote>
1930 b <blockquote>foo</blockquote>
1931
1932 !! html+tidy
1933 <p>a</p>
1934 <blockquote>
1935 <p>foo</p>
1936 </blockquote>
1937 <p>b</p>
1938 <blockquote>
1939 <p>foo</p>
1940 </blockquote>
1941 !! end
1942
1943 !! test
1944 Multiple lines without block tags
1945 !! wikitext
1946 <div>foo</div> a
1947 b
1948 c
1949 d<!--foo--> e
1950 x <div>foo</div> z
1951 !! html
1952 <div>foo</div> a
1953 <p>b
1954 c
1955 d e
1956 </p>
1957 x <div>foo</div> z
1958
1959 !! html+tidy
1960 <div>foo</div>
1961 <p>a</p>
1962 <p>b c d e</p>
1963 <p>x</p>
1964 <div>foo</div>
1965 <p>z</p>
1966 !! end
1967
1968 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1969 # So, we have a separate section for Parsoid. We don't want
1970 # to mimic this stripping behavior in Parsoid. It affects
1971 # editing experience and also requires us to maintain additional
1972 # info for RT-ing.
1973 !! test
1974 Empty lines between lines with block tags
1975 !! wikitext
1976 <div></div>
1977
1978
1979 <div></div>a
1980
1981 b
1982 <div>a</div>b
1983
1984 <div>b</div>d
1985
1986
1987 <div>e</div>
1988 !! html
1989 <div></div>
1990 <p><br />
1991 </p>
1992 <div></div>a
1993 <p>b
1994 </p>
1995 <div>a</div>b
1996 <div>b</div>d
1997 <p><br />
1998 </p>
1999 <div>e</div>
2000
2001 !! html+tidy
2002 <p><br /></p>
2003 <p>a</p>
2004 <p>b</p>
2005 <div>a</div>
2006 <p>b</p>
2007 <div>b</div>
2008 <p>d</p>
2009 <p><br /></p>
2010 <div>e</div>
2011 !! html/parsoid
2012 <div data-parsoid='{"stx":"html"}'></div>
2013
2014 <p><br /></p>
2015 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2016
2017 <p>b</p>
2018 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2019
2020 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2021
2022 <p><br /></p>
2023 <div data-parsoid='{"stx":"html"}'>e</div>
2024 !! end
2025
2026 ## PHP parser emits output which is broken
2027 !! test
2028 Unclosed HTML p-tags should be handled properly
2029 !! wikitext
2030 <div><p>foo</div>
2031 a
2032
2033 b
2034 !! html/php+tidy
2035 <div>
2036 <p>foo</p>
2037 </div>
2038 <p>a</p>
2039 <p>b</p>
2040 !! html/parsoid
2041 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2042 <p>a</p>
2043 <p>b</p>
2044 !! end
2045
2046 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2047 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2048 ## them for now.
2049 !! test
2050 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2051 !! options
2052 parsoid=wt2html
2053 !! wikitext
2054 a [[Category:A1]] [[Category:A2]]
2055 [[Category:A3]]
2056 [[Category:A4]]
2057 !! html/parsoid
2058 <p>a</p>
2059 <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"/>
2060 !! end
2061
2062 !! test
2063 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2064 !! options
2065 parsoid=wt2html
2066 !! wikitext
2067 [[Category:A1]]a
2068 !! html/parsoid
2069 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2070 !! end
2071
2072 ###
2073 ### Preformatted text
2074 ###
2075 !! test
2076 Preformatted text
2077 !! wikitext
2078 This is some
2079 Preformatted text
2080 With ''italic''
2081 And '''bold'''
2082 And a [[Main Page|link]]
2083 !! html
2084 <pre>This is some
2085 Preformatted text
2086 With <i>italic</i>
2087 And <b>bold</b>
2088 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2089 </pre>
2090 !! end
2091
2092 !! test
2093 Tabs don't trigger preformatted text
2094 !! wikitext
2095 This is not
2096 preformatted text.
2097 This is preformatted text.
2098 So is this.
2099 !! html/php
2100 <p> This is not
2101 preformatted text.
2102 </p>
2103 <pre>This is preformatted text.
2104 So is this.
2105 </pre>
2106 !! html/parsoid
2107 <p> This is not
2108 preformatted text.</p>
2109 <pre>This is preformatted text.
2110 So is this.</pre>
2111 !! end
2112
2113 !! test
2114 Space before tab needs nowiki pre protection
2115 !! options
2116 parsoid=html2wt
2117 !! html/parsoid
2118 <p> a</p>
2119 !! wikitext
2120 <nowiki> </nowiki> a
2121 !! end
2122
2123 !! test
2124 Ident preformatting with inline content
2125 !! wikitext
2126 a
2127 ''b''
2128 !! html
2129 <pre>a
2130 <i>b</i>
2131 </pre>
2132 !! end
2133
2134 !! test
2135 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2136 !! wikitext
2137 <pre><nowiki>
2138 <b>
2139 <cite>
2140 <em>
2141 </nowiki></pre>
2142 !! html
2143 <pre>
2144 &lt;b&gt;
2145 &lt;cite&gt;
2146 &lt;em&gt;
2147 </pre>
2148
2149 !! end
2150
2151 !! test
2152 Regression with preformatted in <center>
2153 !! wikitext
2154 <center>
2155 Blah
2156 </center>
2157 !! html
2158 <center>
2159 <pre>Blah
2160 </pre>
2161 </center>
2162
2163 !! end
2164
2165 !! test
2166 Bug 52763: Preformatted in <blockquote>
2167 !! wikitext
2168 <blockquote>
2169 Blah
2170 {|
2171 |
2172 indented cell (no pre-wrapping!)
2173 |}
2174 </blockquote>
2175 !! html
2176 <blockquote>
2177 <p> Blah
2178 </p>
2179 <table>
2180 <tr>
2181 <td>
2182 <p> indented cell (no pre-wrapping!)
2183 </p>
2184 </td></tr></table>
2185 </blockquote>
2186
2187 !! end
2188
2189 !! test
2190 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2191 !! wikitext
2192 <blockquote>
2193 Foo
2194
2195 Bar
2196 </blockquote>
2197 !! html
2198 <blockquote>
2199 <p>Foo
2200 </p><p>Bar
2201 </p>
2202 </blockquote>
2203
2204 !! end
2205
2206 !! test
2207 Bug 15491: <ins>/<del> in blockquote
2208 !! wikitext
2209 <blockquote>
2210 Foo <del>bar</del> <ins>baz</ins> quux
2211 </blockquote>
2212 !! html
2213 <blockquote>
2214 <p>Foo <del>bar</del> <ins>baz</ins> quux
2215 </p>
2216 </blockquote>
2217
2218 !! end
2219
2220 # Note that the p-wrapping is newline sensitive, which could be
2221 # considered a bug: tidy will wrap only the 'Foo' in the example
2222 # below in a <p> tag. (see comment 23-25 of bug #6200)
2223 !! test
2224 Bug 15491: <ins>/<del> in blockquote (2)
2225 !! wikitext
2226 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2227 </blockquote>
2228 !! html
2229 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2230 </blockquote>
2231
2232 !! html+tidy
2233 <blockquote>
2234 <p>Foo</p>
2235 <del>bar</del> <ins>baz</ins> quux</blockquote>
2236 !! end
2237
2238 !! test
2239 <pre> with attributes (bug 3202)
2240 !! wikitext
2241 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2242 !! html
2243 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2244
2245 !! end
2246
2247 !! test
2248 <pre> with width attribute (bug 3202)
2249 !! wikitext
2250 <pre width="8">Narrow screen goodies</pre>
2251 !! html
2252 <pre width="8">Narrow screen goodies</pre>
2253
2254 !! end
2255
2256 !! test
2257 <pre> with forbidden attribute (bug 3202)
2258 !! wikitext
2259 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2260 !! html
2261 <pre width="8">Narrow screen goodies</pre>
2262
2263 !! end
2264
2265 !! test
2266 Entities inside <pre>
2267 !! wikitext
2268 <pre>&lt;</pre>
2269 !! html
2270 <pre>&lt;</pre>
2271
2272 !! end
2273
2274 !! test
2275 <pre> with forbidden attribute values (bug 3202)
2276 !! wikitext
2277 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2278 !! html
2279 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2280
2281 !! end
2282
2283 !! test
2284 <nowiki> inside <pre> (bug 13238)
2285 !! wikitext
2286 <pre>
2287 <nowiki>
2288 </pre>
2289 <pre>
2290 <nowiki></nowiki>
2291 </pre>
2292 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2293 !! html
2294 <pre>
2295 &lt;nowiki&gt;
2296 </pre>
2297 <pre>
2298
2299 </pre>
2300 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2301
2302 !! end
2303
2304 !! test
2305 <nowiki> inside of #tag:pre
2306 !! wikitext
2307 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2308 !! html/php
2309 <pre>Foo &#8594;bar</pre>
2310
2311 !! html/parsoid
2312 <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>
2313 !! end
2314
2315 !! test
2316 <nowiki> and <pre> preference (first one wins)
2317 !! wikitext
2318 <pre>
2319 <nowiki>
2320 </pre>
2321 </nowiki>
2322 </pre>
2323
2324 <nowiki>
2325 <pre>
2326 <nowiki>
2327 </pre>
2328 </nowiki>
2329 </pre>
2330
2331 !! html/php
2332 <pre>
2333 &lt;nowiki&gt;
2334 </pre>
2335 <p>&lt;/nowiki&gt;
2336 &lt;/pre&gt;
2337 </p><p>
2338 &lt;pre&gt;
2339 &lt;nowiki&gt;
2340 &lt;/pre&gt;
2341
2342 &lt;/pre&gt;
2343 </p>
2344 !! html/parsoid
2345 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2346 </pre>
2347 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2348 &lt;/pre></p>
2349
2350 <p><span typeof="mw:Nowiki">
2351 &lt;pre>
2352 &lt;nowiki>
2353 &lt;/pre>
2354 </span>
2355 &lt;/pre></p>
2356 !! end
2357
2358 !! test
2359 </pre> inside nowiki
2360 !! wikitext
2361 <nowiki></pre></nowiki>
2362 !! html
2363 <p>&lt;/pre&gt;
2364 </p>
2365 !! end
2366
2367 # Parsoid doesn't strip empty tags, like Tidy does.
2368 !! test
2369 Empty pre; pre inside other HTML tags (bug 54946)
2370 !! options
2371 parsoid=wt2html,wt2wt
2372 !! wikitext
2373 a
2374
2375 <div><pre>
2376 foo
2377 </pre></div>
2378 <pre></pre>
2379 !! html/php
2380 <p>a
2381 </p>
2382 <div><pre>
2383 foo
2384 </pre></div>
2385 <pre></pre>
2386
2387 !! html/php+tidy
2388 <p>a</p>
2389 <div>
2390 <pre>
2391 foo
2392 </pre></div>
2393 !! html/parsoid
2394 <p>a</p>
2395
2396 <div><pre>foo
2397 </pre></div>
2398 <pre></pre>
2399 !! end
2400
2401 !! test
2402 HTML pre followed by indent-pre
2403 !! wikitext
2404 <pre>foo</pre>
2405 bar
2406 !! html
2407 <pre>foo</pre>
2408 <pre>bar
2409 </pre>
2410 !! end
2411
2412 # Note that tidy removes the empty <p> tags from the start and end.
2413 # Parsoid does not, by design.
2414 !!test
2415 Block tag pre
2416 !! wikitext
2417 <p><pre>foo</pre></p>
2418 !! html/php+tidy
2419 <pre>
2420 foo
2421 </pre>
2422 !! html/parsoid
2423 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2424 !!end
2425
2426 !!test
2427 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2428 !! wikitext
2429 {{echo|}}
2430 !! html
2431
2432 !!end
2433
2434 !!test
2435 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2436 !! wikitext
2437 {{echo|
2438 foo}}
2439 !! html
2440 <p>foo
2441 </p>
2442 !!end
2443
2444 !! test
2445 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2446 !! wikitext
2447 {{echo|a
2448 b}}
2449 !! html
2450 <pre>a
2451 </pre>
2452 <p>b
2453 </p>
2454 !!end
2455
2456 !! test
2457 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2458 !! wikitext
2459 {{echo|a
2460 b
2461 c
2462 d
2463 e
2464 }}
2465 !! html
2466 <pre>a
2467 </pre>
2468 <p>b
2469 c
2470 </p>
2471 <pre>d
2472 </pre>
2473 <p>e
2474 </p>
2475 !!end
2476
2477 !!test
2478 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2479 !! wikitext
2480 {{echo| foo}}
2481
2482 {{echo| foo}}{{echo| bar}}
2483
2484 {{echo| foo}}
2485 {{echo| bar}}
2486
2487 {{echo|<!--cmt--> foo}}
2488
2489 <!--cmt-->{{echo| foo}}
2490
2491 {{echo|{{echo| }}bar}}
2492 !! html
2493 <pre>foo
2494 </pre>
2495 <pre>foo bar
2496 </pre>
2497 <pre>foo
2498 bar
2499 </pre>
2500 <pre>foo
2501 </pre>
2502 <pre>foo
2503 </pre>
2504 <pre>bar
2505 </pre>
2506 !!end
2507
2508 !! test
2509 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2510 !! wikitext
2511 {{echo| }}a
2512
2513 {{echo|
2514 }}a
2515
2516 {{echo|
2517 b}}
2518
2519 {{echo|a
2520 }}b
2521
2522 {{echo|a
2523 }} b
2524 !! html
2525 <pre>a
2526 </pre>
2527 <p><br />
2528 </p>
2529 <pre>a
2530 </pre>
2531 <p><br />
2532 </p>
2533 <pre>b
2534 </pre>
2535 <p>a
2536 </p>
2537 <pre>b
2538 </pre>
2539 <p>a
2540 </p>
2541 <pre>b
2542 </pre>
2543 !!end
2544
2545 !! test
2546 Pres with newline attributes
2547 !! wikitext
2548 <pre class="one
2549 two">hi</pre>
2550 !! html/php
2551 <pre class="one two">hi</pre>
2552
2553 !! html/parsoid
2554 <pre class="one
2555 two" data-parsoid='{"stx":"html"}'>hi</pre>
2556 !! end
2557
2558 !! test
2559 Things that look like <pre> tags aren't treated as such
2560 !! wikitext
2561 Barack Obama <President> of the United States
2562 <President></President>
2563 !! html
2564 <p>Barack Obama &lt;President&gt; of the United States
2565 &lt;President&gt;&lt;/President&gt;
2566 </p>
2567 !! end
2568
2569 !! test
2570 Handle broken pre-like tags (bug 64025)
2571 !! options
2572 parsoid=wt2html
2573 !! wikitext
2574 {{echo|<pre <pre>x</pre>}}
2575
2576 <table><pre </table>
2577 !! html/php
2578 <pre>x</pre>
2579 <table>&lt;pre </table>
2580
2581 !! html/php+tidy
2582 <pre>
2583 x
2584 </pre>
2585 <p>&lt;pre</p>
2586 !! html/parsoid
2587 <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>
2588
2589
2590 <p>&lt;pre </p>
2591
2592 <table></table>
2593 !! end
2594
2595 !! test
2596 Parsoid: handle pre with space after attribute
2597 !! options
2598 parsoid=wt2html
2599 !! wikitext
2600 <pre style="width:50%;" >{{echo|foo}}</pre>
2601 !! html/php
2602 <pre style="width:50%;">{{echo|foo}}</pre>
2603
2604 !! html/parsoid
2605 <pre style="width:50%;">{{echo|foo}}</pre>
2606 !! end
2607
2608 # TODO / maybe: fix wt2wt for this
2609 !! test
2610 Parsoid: Don't paragraph-wrap fosterable content
2611 !! options
2612 parsoid=wt2html
2613 !! wikitext
2614 {|
2615 <td></td>
2616 <td></td>
2617
2618
2619
2620 |}
2621 !! html
2622 <table>
2623
2624 <tbody>
2625 <tr>
2626 <td></td>
2627
2628 <td></td></tr>
2629
2630
2631
2632 </tbody></table>
2633 !! end
2634
2635 !! test
2636 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2637 !! options
2638 parsoid=wt2html
2639 !! wikitext
2640 {|
2641 <td>
2642 <td>
2643 </td>
2644
2645
2646
2647 |}
2648 !! html
2649 <table>
2650
2651 <tbody>
2652 <tr>
2653 <td></td>
2654
2655 <td>
2656 </td></tr>
2657
2658
2659
2660 </tbody></table>
2661 !! end
2662
2663
2664 #--------------------------------------------------------------------
2665 # Transclusion parameter whitespace stripping tests
2666 # Behavior is different for positional and named parameters
2667 #--------------------------------------------------------------------
2668 !! test
2669 Templates: Strip leading and trailing whitespace from named-param values
2670 !! wikitext
2671 {{echo|1= a }}
2672
2673 {{echo|1= {{echo|b}} }}
2674
2675 {{echo| 1 =
2676 c }}
2677
2678 {{echo| 1 =
2679 * d
2680 }}
2681 !! html
2682 <p>a
2683 </p><p>b
2684 </p><p>c
2685 </p>
2686 <ul><li> d</li></ul>
2687
2688 !! end
2689
2690 !! test
2691 Templates: Don't strip whitespace from positional-param values
2692 !! wikitext
2693 {{echo|a }}
2694
2695 {{echo|{{echo|b}} }}
2696
2697 {{echo| c
2698 }}
2699
2700 {{echo| {{echo|d}}
2701 }}
2702
2703 {{echo|
2704 e}}
2705
2706 {{echo|
2707 * f}}
2708
2709 {{echo|
2710 }}g
2711 !! html
2712 <p>a
2713 </p><p>b
2714 </p>
2715 <pre>c
2716 </pre>
2717 <p><br />
2718 </p>
2719 <pre>d
2720 </pre>
2721 <p><br />
2722 </p>
2723 <pre>e
2724 </pre>
2725 <p><br />
2726 </p>
2727 <ul><li> f</li></ul>
2728 <p><br />
2729 </p>
2730 <pre>g
2731 </pre>
2732 !! end
2733
2734 !! test
2735 Templates: Handle empty comment-and-ws-only lines correctly
2736 !! wikitext
2737 {{echo|foo
2738 <!--should be ignored-->
2739 <!--should be ignored as well-->
2740 bar}}
2741 !! html/php
2742 <p>foo
2743 bar
2744 </p>
2745 !! html/parsoid
2746 <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>
2747 !! end
2748
2749 !! test
2750 Templates: Handle comments in the target
2751 !! wikitext
2752 {{echo
2753 <!-- should be ignored -->
2754 |foo}}
2755
2756 {{echo
2757 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2758 |foo}}
2759
2760 {{echo<!-- should be ignored -->
2761 |foo}}
2762
2763 {{echo<!-- should be ignored -->|foo}}
2764
2765 {{<!-- should be ignored -->echo|foo}}
2766 !! html/php
2767 <p>foo
2768 </p><p>foo
2769 </p><p>foo
2770 </p><p>foo
2771 </p><p>foo
2772 </p>
2773 !! html/parsoid
2774 <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>
2775
2776 <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>
2777
2778 <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>
2779
2780 <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>
2781
2782 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2783 !!end
2784
2785 !! test
2786 Templates: Handle comments in parameter names (bug 67657)
2787 !! wikitext
2788 {{echo|1
2789 <!-- should be ignored -->
2790 =foo}}
2791
2792 {{echo|
2793 <!-- should be ignored -->
2794 1 = foo}}
2795
2796 {{echo|1<!-- should be ignored -->=foo}}
2797
2798 {{echo|<!-- should be ignored -->1=foo}}
2799 !! html/php
2800 <p>foo
2801 </p><p>foo
2802 </p><p>foo
2803 </p><p>foo
2804 </p>
2805 !! html/parsoid
2806 <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>
2807
2808 <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>
2809
2810 <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>
2811
2812 <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>
2813 !!end
2814
2815 !! test
2816 Templates: Other wikitext in parameter names (bug 67657)
2817 !! wikitext
2818 {{echo|''1''=foo}}
2819 !! html/php
2820 <p>{{{1}}}
2821 </p>
2822 !! html/parsoid
2823 <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>
2824 !!end
2825
2826 #--------------------------------------------------------------------
2827 # Transclusion parameter escaping tests
2828 #--------------------------------------------------------------------
2829 !! test
2830 Templates: Parsoid parameter escaping test 1
2831 !! wikitext
2832 {{echo|[foo]|{{echo|[bar]}}}}
2833 !! html/php+tidy
2834 <p>[foo]</p>
2835 !! html/parsoid
2836 <p about="#mwt1" typeof="mw:Transclusion"
2837 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2838 !! end
2839
2840 !! test
2841 Parsoid: Pipes in external links in template parameter
2842 !! wikitext
2843 {{echo|[{{echo|http://example.com}} link]}}
2844 !! html/php+tidy
2845 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2846 !! html/parsoid
2847 <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>
2848 !! end
2849
2850 !! test
2851 Parsoid: pipe in transclusion parameter
2852 !! wikitext
2853 {{echo|http://foo.com/a&#124;b}}
2854 !! html/php+tidy
2855 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2856 !! html/parsoid
2857 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2858 typeof="mw:Transclusion"
2859 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>
2860 !! end
2861
2862 !! test
2863 Parsoid: Pipe in external link target and content in template parameter
2864 !! options
2865 parsoid=html2wt,wt2wt
2866 !! wikitext
2867 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2868 !! html/php+tidy
2869 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2870 !! html/parsoid
2871 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2872 typeof="mw:Transclusion"
2873 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2874 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2875 !! end
2876
2877 !! test
2878 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2879 !! options
2880 parsoid
2881 !! wikitext
2882 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2883 !! html
2884 <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>
2885 !! end
2886
2887 !! test
2888 Templates: Don't escape already nowiki-escaped text in template parameters
2889 !! options
2890 parsoid=html2wt,wt2wt
2891 !! wikitext
2892 {{echo|foo<nowiki>|</nowiki>bar}}
2893 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2894 {{echo|<nowiki></nowiki>}}
2895 !! html/php+tidy
2896 <p>foo|bar &lt;div&gt;</p>
2897 !! html/parsoid
2898 <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>
2899 <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>
2900 <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>
2901 </p>
2902 !! end
2903
2904 ## Bug 52824
2905 !! test
2906 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2907 !! options
2908 parsoid=html2wt,wt2wt
2909 !! wikitext
2910 {{echo|{{echo|1=bar}}}}
2911 !! html/php+tidy
2912 <p>bar</p>
2913 !! html/parsoid
2914 <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>
2915 !! end
2916
2917 ## Bug 56733
2918 !! test
2919 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2920 !! wikitext
2921 {{echo|a : b}}
2922 !! html/php+tidy
2923 <p>a&#160;: b</p>
2924 !! html/parsoid
2925 <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>
2926 !! end
2927
2928 ## Bug T73412
2929 !! test
2930 Templates: Preserve blank parameter names
2931 !! wikitext
2932 {{echo|=foo}}
2933 !! html/php+tidy
2934 <p>{{{1}}}</p>
2935 !! html/parsoid
2936 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2937 !! end
2938
2939 !! test
2940 Templates: Preserve blank parameter names in other positions
2941 !! wikitext
2942 {{blank_param|bar|=foo}}
2943 !! html/php+tidy
2944 <p>bar foo</p>
2945 !! html/parsoid
2946 <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
2947 foo</p>
2948 !! end
2949
2950 ###
2951 ### Parsoid-centric tests for testing RT edge cases for pre
2952 ###
2953
2954 !!test
2955 1a. Indent-Pre and Comments
2956 !! wikitext
2957 a
2958 <!--a-->
2959 c
2960 !! html
2961 <pre>a
2962 </pre>
2963 <p>c
2964 </p>
2965 !!end
2966
2967 !!test
2968 1b. Indent-Pre and Comments
2969 !! wikitext
2970 a
2971 <!--a-->
2972 c
2973 !! html
2974 <pre>a
2975 </pre>
2976 <p>c
2977 </p>
2978 !!end
2979
2980 !!test
2981 1c. Indent-Pre and Comments
2982 !! wikitext
2983 <!--a--> a
2984
2985 <!--a--> a
2986 !! html
2987 <pre> a
2988 </pre>
2989 <pre> a
2990 </pre>
2991 !!end
2992
2993 !!test
2994 1d. Indent-Pre and Comments
2995 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2996 !! wikitext
2997 <!--a--> a
2998
2999 <!--b-->b
3000 !! html
3001 <pre>a
3002 </pre>
3003 <pre>b
3004 </pre>
3005 !!end
3006
3007 !!test
3008 2a. Indent-Pre and tables
3009 !! wikitext
3010 {|
3011 |-
3012 !h1!!h2
3013 |foo||bar
3014 |}
3015 !! html
3016 <table>
3017
3018 <tr>
3019 <th>h1</th>
3020 <th>h2
3021 </th>
3022 <td>foo</td>
3023 <td>bar
3024 </td></tr></table>
3025
3026 !!end
3027
3028 !!test
3029 2b. Indent-Pre and tables
3030 !! wikitext
3031 {|
3032 |-
3033 |foo
3034 |}
3035 !! html
3036 <table>
3037
3038 <tr>
3039 <td>foo
3040 </td></tr></table>
3041
3042 !!end
3043
3044 !!test
3045 2c. Indent-Pre and tables (bug 42252)
3046 !! wikitext
3047 {|
3048 |+ foo
3049 ! | bar
3050 |}
3051 !! html
3052 <table>
3053 <caption> foo
3054 </caption>
3055 <tr>
3056 <th> bar
3057 </th></tr></table>
3058
3059 !!end
3060
3061 !!test
3062 2d. Indent-Pre and tables
3063 !! wikitext
3064 a
3065 {|
3066 | b
3067 |}
3068 !! html/php
3069 <pre>a
3070 </pre>
3071 <table>
3072 <tr>
3073 <td> b
3074 </td></tr></table>
3075
3076 !! html/parsoid
3077 <pre>a</pre>
3078 <table>
3079 <tbody><tr><td> b</td></tr>
3080 </tbody></table>
3081 !!end
3082
3083 !!test
3084 2e. Indent-Pre and table-line syntax
3085 !! wikitext
3086 a
3087 | b
3088 | c
3089 !! html/php
3090 <pre>a
3091 | b
3092 | c
3093 </pre>
3094 !!end
3095
3096 !!test
3097 2f. Indent-pre started by table-line syntax
3098 !! wikitext
3099 a
3100 | b
3101 | c
3102 !! html/php
3103 <p>a
3104 </p>
3105 <pre>| b
3106 | c
3107 </pre>
3108 !! html/parsoid
3109 <p>a</p>
3110 <pre>
3111 | b
3112 | c</pre>
3113 !!end
3114
3115 !! test
3116 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3117 !! wikitext
3118 <table>
3119 <tr>
3120 <td>
3121 Text that should be rendered preformatted
3122 </td>
3123 </tr>
3124 </table>
3125 !! html
3126 <table>
3127 <tr>
3128 <td>
3129 <pre>Text that should be rendered preformatted
3130 </pre>
3131 </td>
3132 </tr>
3133 </table>
3134
3135 !! end
3136
3137 !!test
3138 3a. Indent-Pre and block tags (single-line html)
3139 !! wikitext
3140 a <p> foo </p>
3141 b <div> foo </div>
3142 c <blockquote> foo </blockquote>
3143 <span> foo </span>
3144 !! html
3145 a <p> foo </p>
3146 b <div> foo </div>
3147 c <blockquote> foo </blockquote>
3148 <pre><span> foo </span>
3149 </pre>
3150 !! html/parsoid
3151 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3152 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3153 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3154 <pre><span> foo </span>
3155 </pre>
3156 !! html+tidy
3157 <p>a</p>
3158 <p>foo</p>
3159 <p>b</p>
3160 <div>foo</div>
3161 <p>c</p>
3162 <blockquote>
3163 <p>foo</p>
3164 </blockquote>
3165 <pre>
3166 <span> foo </span>
3167 </pre>
3168 !! end
3169
3170 !!test
3171 3b. Indent-Pre and block tags (multi-line html)
3172 !! wikitext
3173 a <span>foo</span>
3174 b <div> foo </div>
3175 !! html
3176 <pre>a <span>foo</span>
3177 </pre>
3178 b <div> foo </div>
3179
3180 !! html/parsoid
3181 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3182 b <div data-parsoid='{"stx":"html"}'> foo </div>
3183 !! html+tidy
3184 <pre>
3185 a <span>foo</span>
3186 </pre>
3187 <p>b</p>
3188 <div>foo</div>
3189 !!end
3190
3191 !!test
3192 3c. Indent-Pre and block tags (pre-content on separate line)
3193 !! wikitext
3194 <p>
3195 foo
3196 </p>
3197
3198 <div>
3199 foo
3200 </div>
3201
3202 <center>
3203 foo
3204 </center>
3205
3206 <blockquote>
3207 foo
3208 </blockquote>
3209
3210 <blockquote>
3211 <pre>
3212 foo
3213 </pre>
3214 </blockquote>
3215
3216 <table><tr><td>
3217 foo
3218 </td></tr></table>
3219
3220 <ul><li>
3221 foo
3222 </li></ul>
3223
3224 !! html
3225 <p>
3226 foo
3227 </p>
3228 <div>
3229 <pre>foo
3230 </pre>
3231 </div>
3232 <center>
3233 <pre>foo
3234 </pre>
3235 </center>
3236 <blockquote>
3237 <p> foo
3238 </p>
3239 </blockquote>
3240 <blockquote>
3241 <pre>
3242 foo
3243 </pre>
3244 </blockquote>
3245 <table><tr><td>
3246 <pre>foo
3247 </pre>
3248 </td></tr></table>
3249 <ul><li>
3250 foo
3251 </li></ul>
3252
3253 !!end
3254
3255 !! test
3256 4. Indent-Pre and extension tags
3257 !! wikitext
3258 a <tag />
3259 !! html/php
3260 a <pre>
3261 NULL
3262 array (
3263 )
3264 </pre>
3265
3266 !! html/parsoid
3267 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3268 !! end
3269
3270 !!test
3271 Render paragraphs when indent-pre is suppressed in blocklevels
3272 !! wikitext
3273 <blockquote>
3274 foo
3275
3276 bar
3277 </blockquote>
3278 !! html
3279 <blockquote>
3280 <p> foo
3281 </p><p> bar
3282 </p>
3283 </blockquote>
3284
3285 !!end
3286
3287 !!test
3288 4. Multiple spaces at start-of-line
3289 !! wikitext
3290 <p> foo </p>
3291 foo
3292 {|
3293 |foo
3294 |}
3295 !! html
3296 <p> foo </p>
3297 <pre> foo
3298 </pre>
3299 <table>
3300 <tr>
3301 <td>foo
3302 </td></tr></table>
3303
3304 !!end
3305
3306 ## NOTE: the leading white-space chars on empty line are significant
3307 !! test
3308 5a. White-space in indent-pre
3309 !! wikitext
3310 a<br />
3311
3312 b
3313 !! html
3314 <pre>a<br />
3315
3316 b
3317 </pre>
3318 !! end
3319
3320 ## NOTE: the leading white-space chars on empty line are significant
3321 !! test
3322 5b. White-space in indent-pre
3323 !! wikitext
3324 a
3325
3326 b
3327
3328
3329 c
3330 !! html
3331 <pre>a
3332
3333 b
3334
3335
3336 c
3337 </pre>
3338 !! end
3339
3340 !! test
3341 5c. White-space in indent-pre
3342 !! wikitext
3343 ''a''
3344 ''b''
3345 ''c''
3346 !! html
3347 <pre><i>a</i>
3348 <i>b</i>
3349 <i>c</i>
3350 </pre>
3351 !! end
3352
3353 !! test
3354 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3355 !! wikitext
3356 a
3357
3358 <!-- continue -->
3359 b
3360
3361 c
3362
3363 d
3364 !! html
3365 <pre>a
3366
3367 b
3368 </pre>
3369 <pre>c
3370
3371 </pre>
3372 <p>d
3373 </p>
3374 !! end
3375
3376 !! test
3377 7a. Indent-pre and category links
3378 !! options
3379 parsoid=wt2html,wt2wt
3380 !! wikitext
3381 [[Category:foo]] <!-- No pre-wrapping -->
3382 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3383 !! html/php+tidy
3384 !! html/parsoid
3385 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3386 <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 -->
3387 !! end
3388
3389 ## We used to, but no longer wt2wt this test since the default serializer
3390 ## will normalize all categories to serialize on their own line.
3391 ## This wikitext usage is going to be fairly uncommon in production and
3392 ## selser will take care of preserving formatting in those scenarios.
3393 !! test
3394 7b. Indent-pre and category links
3395 !! options
3396 parsoid=wt2html
3397 !! wikitext
3398 [[Category:foo]] a
3399 [[Category:foo]] {{echo|b}}
3400 !! html/parsoid
3401 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3402 <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>
3403 !! end
3404
3405 !! test
3406 Indent-Pre: Newlines in comments shouldn't affect sol state
3407 !! wikitext
3408 a <!--
3409 foo
3410 --> b
3411 !! html/php+tidy
3412 <p>a b</p>
3413 !! html/parsoid
3414 <p>a <!--
3415 foo
3416 --> b</p>
3417 !! end
3418
3419 ###
3420 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3421 ###
3422
3423 !!test
3424 HTML-pre: 1. embedded newlines
3425 !! wikitext
3426 <pre>foo</pre>
3427
3428 <pre>
3429 foo
3430 </pre>
3431
3432 <pre>
3433
3434 foo
3435 </pre>
3436
3437 <pre>
3438
3439
3440 foo
3441 </pre>
3442 !! html/php+tidy
3443 <pre>
3444 foo
3445 </pre>
3446 <pre>
3447 foo
3448 </pre>
3449 <pre>
3450
3451 foo
3452 </pre>
3453 <pre>
3454
3455
3456 foo
3457 </pre>
3458 !! html/parsoid
3459 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3460
3461 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3462 foo
3463 </pre>
3464
3465 <pre data-parsoid='{"stx":"html"}'>
3466
3467 foo
3468 </pre>
3469
3470 <pre data-parsoid='{"stx":"html"}'>
3471
3472
3473 foo
3474 </pre>
3475 !!end
3476
3477 !! test
3478 HTML-pre: big spaces
3479 !! wikitext
3480 <pre>
3481
3482
3483
3484
3485 haha
3486
3487
3488
3489
3490 haha
3491
3492
3493
3494
3495 </pre>
3496 !! html/php+tidy
3497 <pre>
3498
3499
3500
3501
3502 haha
3503
3504
3505
3506
3507 haha
3508
3509
3510
3511
3512 </pre>
3513 !! html/parsoid
3514 <pre data-parsoid='{"stx":"html"}'>
3515
3516
3517
3518
3519 haha
3520
3521
3522
3523
3524 haha
3525
3526
3527
3528
3529 </pre>
3530 !! end
3531
3532 !!test
3533 HTML-pre: 2: indented text
3534 !! wikitext
3535 <pre>
3536 foo
3537 </pre>
3538 !! html
3539 <pre>
3540 foo
3541 </pre>
3542
3543 !!end
3544
3545 !!test
3546 HTML-pre: 3: other wikitext
3547 !! wikitext
3548 <pre>
3549 * foo
3550 # bar
3551 = no-h =
3552 '' no-italic ''
3553 [[ NoLink ]]
3554 </pre>
3555 !! html/php
3556 <pre>
3557 * foo
3558 # bar
3559 = no-h =
3560 '' no-italic ''
3561 [[ NoLink ]]
3562 </pre>
3563
3564 !! html/parsoid
3565 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3566 # bar
3567 = no-h =
3568 '' no-italic ''
3569 [[ NoLink ]]
3570 </pre>
3571 !!end
3572
3573 ###
3574 ### Definition lists
3575 ###
3576 !! test
3577 Simple definition
3578 !! wikitext
3579 ; name : Definition
3580 !! html
3581 <dl><dt> name&#160;</dt>
3582 <dd> Definition</dd></dl>
3583
3584 !! end
3585
3586 !! test
3587 Definition list for indentation only
3588 !! wikitext
3589 : Indented text
3590 !! html
3591 <dl><dd> Indented text</dd></dl>
3592
3593 !! end
3594
3595 !! test
3596 Definition list with no space
3597 !! wikitext
3598 ;name:Definition
3599 !! html
3600 <dl><dt>name</dt>
3601 <dd>Definition</dd></dl>
3602
3603 !!end
3604
3605 !! test
3606 Definition list with URL link
3607 !! wikitext
3608 ; http://example.com/ : definition
3609 !! html
3610 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3611 <dd> definition</dd></dl>
3612
3613 !! end
3614
3615 !! test
3616 Definition list with bracketed URL link
3617 !! wikitext
3618 ;[http://www.example.com/ Example]:Something about it
3619 !! html
3620 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3621 <dd>Something about it</dd></dl>
3622
3623 !! end
3624
3625 !! test
3626 Definition list with wikilink containing colon
3627 !! wikitext
3628 ; [[Help:FAQ]]: The least-read page on Wikipedia
3629 !! html
3630 <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>
3631 <dd> The least-read page on Wikipedia</dd></dl>
3632
3633 !! end
3634
3635 # At Brion's and JeLuF's insistence... :)
3636 !! test
3637 Definition list with news link containing colon
3638 !! wikitext
3639 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3640 !! html/php
3641 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3642 <dd> This isn't even a real newsgroup!</dd></dl>
3643
3644 !! html/parsoid
3645 <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>
3646 !! end
3647
3648 !! test
3649 Malformed definition list with colon
3650 !! wikitext
3651 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3652 !! html
3653 <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>
3654
3655 !! end
3656
3657 !! test
3658 Definition lists: colon in external link text
3659 !! wikitext
3660 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3661 !! html
3662 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3663 <dd> OK, I made that up</dd></dl>
3664
3665 !! end
3666
3667 !! test
3668 Definition lists: colon in HTML attribute
3669 !! wikitext
3670 ;<b style="display: inline">bold</b>
3671 !! html
3672 <dl><dt><b style="display: inline">bold</b></dt></dl>
3673
3674 !! end
3675
3676 !! test
3677 Definition lists: self-closed tag
3678 !! wikitext
3679 ;one<br/>two : two-line fun
3680 !! html
3681 <dl><dt>one<br />two&#160;</dt>
3682 <dd> two-line fun</dd></dl>
3683
3684 !! end
3685
3686 !! test
3687 Bug 11748: Literal closing tags
3688 !! wikitext
3689 <dl>
3690 <dt>test 1</dt>
3691 <dd>test test test test test</dd>
3692 <dt>test 2</dt>
3693 <dd>test test test test test</dd>
3694 </dl>
3695 !! html
3696 <dl>
3697 <dt>test 1</dt>
3698 <dd>test test test test test</dd>
3699 <dt>test 2</dt>
3700 <dd>test test test test test</dd>
3701 </dl>
3702
3703 !! end
3704
3705 !! test
3706 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3707 !! wikitext
3708 <ul><li>
3709 ; term : description
3710 * unordered
3711 </li></ul>
3712 !! html
3713 <ul><li>
3714 <dl><dt> term&#160;</dt>
3715 <dd> description</dd></dl>
3716 <ul><li> unordered</li></ul>
3717 </li></ul>
3718
3719 !! end
3720
3721 !! test
3722 Definition list with empty definition and following paragraph
3723 !! wikitext
3724 ; term:
3725 Paragraph text
3726 !! html
3727 <dl><dt> term</dt>
3728 <dd></dd></dl>
3729 <p>Paragraph text
3730 </p>
3731 !! end
3732
3733 !! test
3734 Nested definition lists using html syntax
3735 !! wikitext
3736 <dl><dt>x</dt>
3737 <dd>a</dd>
3738 <dd>b</dd></dl>
3739 !! html
3740 <dl><dt>x</dt>
3741 <dd>a</dd>
3742 <dd>b</dd></dl>
3743
3744 !! end
3745
3746 !! test
3747 Definition Lists: No nesting: Multiple dd's
3748 !! wikitext
3749 ;x
3750 :a
3751 :b
3752 !! html
3753 <dl><dt>x</dt>
3754 <dd>a</dd>
3755 <dd>b</dd></dl>
3756
3757 !! end
3758
3759 !! test
3760 Definition Lists: Indentation: Regular
3761 !! wikitext
3762 :i1
3763 ::i2
3764 :::i3
3765 !! html
3766 <dl><dd>i1
3767 <dl><dd>i2
3768 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3769
3770 !! end
3771
3772 !! test
3773 Definition Lists: Indentation: Missing 1st level
3774 !! wikitext
3775 ::i2
3776 :::i3
3777 !! html
3778 <dl><dd><dl><dd>i2
3779 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3780
3781 !! end
3782
3783 !! test
3784 Definition Lists: Indentation: Multi-level indent
3785 !! wikitext
3786 :::i3
3787 !! html
3788 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3789
3790 !! end
3791
3792 !! test
3793 Definition Lists: Hacky use to indent tables
3794 !! wikitext
3795 ::{|
3796 |foo
3797 |bar
3798 |}
3799 this text
3800 should be left alone
3801 !! html
3802 <dl><dd><dl><dd><table>
3803 <tr>
3804 <td>foo
3805 </td>
3806 <td>bar
3807 </td></tr></table></dd></dl></dd></dl>
3808 <p>this text
3809 should be left alone
3810 </p>
3811 !! end
3812
3813 !! test
3814 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3815 !! wikitext
3816 <!-- foo -->
3817 ::{|
3818 |foo
3819 |bar
3820 |}<!-- bar -->
3821 this text
3822 should be left alone
3823 !! html/parsoid
3824 <!-- foo -->
3825 <dl><dd><dl><dd><table><tr>
3826 <td>foo</td>
3827 <td>bar</td>
3828 </tr></table><!-- bar --></dd></dl></dd></dl>
3829 <p>this text
3830 should be left alone</p>
3831 !! end
3832
3833 !! test
3834 Definition Lists: Hacky use to indent tables, with comment before table
3835 !! wikitext
3836 ::<!-- foo -->{|
3837 |foo
3838 |}
3839 !! html/parsoid
3840 <dl><dd><dl><dd><!-- foo --><table><tr>
3841 <td>foo</td>
3842 </tr></table></dd></dl></dd></dl>
3843 !! end
3844
3845 # The trailing whitespace in this test is to catch a regression in
3846 # Parsoid after T54473.
3847 !! test
3848 Definition Lists: Hacky use to indent tables (WS-insensitive)
3849 !! wikitext
3850 : {|
3851 |a
3852 |}
3853 !! html/php
3854 <dl><dd><table>
3855 <tr>
3856 <td>a
3857 </td></tr></table></dd></dl>
3858
3859 !! html/parsoid
3860 <dl><dd> <table>
3861 <tbody><tr><td>a</td></tr>
3862 </tbody></table> </dd></dl>
3863 !! end
3864
3865 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3866 ## as an empty dt item. It also ignores all but the last ";" when followed
3867 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3868 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3869 ## ";"s.
3870 ##
3871 ## Ex: ";;t2 ::d2" is transformed into:
3872 ##
3873 ## <dl>
3874 ## <dt>t2 </dt>
3875 ## <dd>
3876 ## <dl>
3877 ## <dt></dt>
3878 ## <dd>d2</dd>
3879 ## </dl>
3880 ## </dd>
3881 ## </dl>
3882 ##
3883 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3884 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3885 ##
3886 ## <dl>
3887 ## <dt>
3888 ## <dl>
3889 ## <dt>t2 </dt>
3890 ## <dd>:d2</dd>
3891 ## </dl>
3892 ## </dt>
3893 ## </dl>
3894 ##
3895 ## All Parsoid only definition list tests have this difference.
3896 ##
3897 ## See also: https://phabricator.wikimedia.org/T8569
3898 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3899
3900 !! test
3901 Table / list interaction: indented table with lists in table contents
3902 !! wikitext
3903 :{|
3904 |-
3905 | a
3906 * b
3907 |-
3908 | c
3909 * d
3910 |}
3911 !! html
3912 <dl><dd><table>
3913
3914 <tr>
3915 <td> a
3916 <ul><li> b</li></ul>
3917 </td></tr>
3918 <tr>
3919 <td> c
3920 <ul><li> d</li></ul>
3921 </td></tr></table></dd></dl>
3922
3923 !! end
3924
3925 !!test
3926 Table / list interaction: lists nested in tables nested in indented lists
3927 !! wikitext
3928 :{|
3929 |
3930 :a
3931 :b
3932 |
3933 *c
3934 *d
3935 |}
3936
3937 *e
3938 *f
3939 !! html
3940 <dl><dd><table>
3941 <tr>
3942 <td>
3943 <dl><dd>a</dd>
3944 <dd>b</dd></dl>
3945 </td>
3946 <td>
3947 <ul><li>c</li>
3948 <li>d</li></ul>
3949 </td></tr></table></dd></dl>
3950 <ul><li>e</li>
3951 <li>f</li></ul>
3952
3953 !!end
3954
3955 !! test
3956 Definition Lists: Nesting: Multi-level (Parsoid only)
3957 !! options
3958 parsoid
3959 !! wikitext
3960 ;t1 :d1
3961 ;;t2 ::d2
3962 ;;;t3 :::d3
3963 !! html
3964 <dl>
3965 <dt>t1 </dt>
3966 <dd>d1</dd>
3967 <dt>
3968 <dl>
3969 <dt>t2 </dt>
3970 <dd>:d2</dd>
3971 <dt>
3972 <dl>
3973 <dt>t3 </dt>
3974 <dd>::d3</dd>
3975 </dl>
3976 </dt>
3977 </dl>
3978 </dt>
3979 </dl>
3980
3981
3982 !! end
3983
3984
3985 !! test
3986 Definition Lists: Nesting: Test 2 (Parsoid only)
3987 !! wikitext
3988 ;t1
3989 ::d2
3990 !! html/php+tidy
3991 <dl>
3992 <dt>t1</dt>
3993 <dd>
3994 <dl>
3995 <dd>d2</dd>
3996 </dl>
3997 </dd>
3998 </dl>
3999 !! html/parsoid
4000 <dl>
4001 <dt>t1</dt>
4002 <dd>
4003 <dl>
4004 <dd>d2</dd>
4005 </dl>
4006 </dd>
4007 </dl>
4008
4009 !! end
4010
4011
4012 !! test
4013 Definition Lists: Nesting: Test 3 (Parsoid only)
4014 !! wikitext
4015 :;t1
4016 ::::d2
4017 !! html/php+tidy
4018 <dl>
4019 <dd>
4020 <dl>
4021 <dt>t1</dt>
4022 <dd>
4023 <dl>
4024 <dd>
4025 <dl>
4026 <dd>d2</dd>
4027 </dl>
4028 </dd>
4029 </dl>
4030 </dd>
4031 </dl>
4032 </dd>
4033 </dl>
4034 !! html/parsoid
4035 <dl>
4036 <dd>
4037 <dl>
4038 <dt>t1</dt>
4039 <dd>
4040 <dl>
4041 <dd>
4042 <dl>
4043 <dd>d2</dd>
4044 </dl>
4045 </dd>
4046 </dl>
4047 </dd>
4048 </dl>
4049 </dd>
4050 </dl>
4051
4052 !! end
4053
4054
4055 !! test
4056 Definition Lists: Nesting: Test 4
4057 !! wikitext
4058 ::;t3
4059 :::d3
4060 !! html
4061 <dl><dd><dl><dd><dl><dt>t3</dt>
4062 <dd>d3</dd></dl></dd></dl></dd></dl>
4063
4064 !! end
4065
4066
4067 ## The Parsoid team believes the following three test exposes a
4068 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4069 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4070 ## It also exposes a "misfeature" in tidy, which doesn't like
4071 ## <dl> tags with a single <dt> child; it converts the <dt> into
4072 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4073 !! test
4074 Definition Lists: Mixed Lists: Test 1
4075 !! wikitext
4076 :;* foo
4077 ::* bar
4078 :; baz
4079 !! html/php
4080 <dl><dd><dl><dt><ul><li> foo</li>
4081 <li> bar</li></ul></dt></dl>
4082 <dl><dt> baz</dt></dl></dd></dl>
4083
4084 !! html/php+tidy
4085 <dl>
4086 <dd>
4087 <dl>
4088 <dd>
4089 <ul>
4090 <li>foo</li>
4091 <li>bar</li>
4092 </ul>
4093 </dd>
4094 </dl>
4095 <dl>
4096 <dt>baz</dt>
4097 </dl>
4098 </dd>
4099 </dl>
4100 !! html/parsoid
4101 <dl>
4102 <dd><dl>
4103 <dt><ul>
4104 <li> foo
4105 </li>
4106 </ul></dt>
4107 <dd><ul>
4108 <li> bar
4109 </li>
4110 </ul></dd>
4111 <dt> baz</dt>
4112 </dl></dd>
4113 </dl>
4114 !! end
4115
4116 !! test
4117 Definition Lists: Mixed Lists: Test 2
4118 !! wikitext
4119 *: d1
4120 *: d2
4121 !! html
4122 <ul><li><dl><dd> d1</dd>
4123 <dd> d2</dd></dl></li></ul>
4124
4125 !! end
4126
4127
4128 !! test
4129 Definition Lists: Mixed Lists: Test 3
4130 !! wikitext
4131 *::: d1
4132 *::: d2
4133 !! html
4134 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4135 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4136
4137 !! end
4138
4139
4140 !! test
4141 Definition Lists: Mixed Lists: Test 4
4142 !! wikitext
4143 *;d1 :d2
4144 *;d3 :d4
4145 !! html
4146 <ul><li><dl><dt>d1&#160;</dt>
4147 <dd>d2</dd>
4148 <dt>d3&#160;</dt>
4149 <dd>d4</dd></dl></li></ul>
4150
4151 !! end
4152
4153
4154 !! test
4155 Definition Lists: Mixed Lists: Test 5
4156 !! wikitext
4157 *:d1
4158 *:: d2
4159 !! html
4160 <ul><li><dl><dd>d1
4161 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4162
4163 !! end
4164
4165
4166 !! test
4167 Definition Lists: Mixed Lists: Test 6
4168 !! wikitext
4169 #*:d1
4170 #*::: d3
4171 !! html
4172 <ol><li><ul><li><dl><dd>d1
4173 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4174
4175 !! end
4176
4177
4178 !! test
4179 Definition Lists: Mixed Lists: Test 7
4180 !! wikitext
4181 :* d1
4182 :* d2
4183 !! html
4184 <dl><dd><ul><li> d1</li>
4185 <li> d2</li></ul></dd></dl>
4186
4187 !! end
4188
4189
4190 !! test
4191 Definition Lists: Mixed Lists: Test 8
4192 !! wikitext
4193 :* d1
4194 ::* d2
4195 !! html
4196 <dl><dd><ul><li> d1</li></ul>
4197 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4198
4199 !! end
4200
4201
4202 !! test
4203 Definition Lists: Mixed Lists: Test 9
4204 !! wikitext
4205 *;foo :bar
4206 !! html
4207 <ul><li><dl><dt>foo&#160;</dt>
4208 <dd>bar</dd></dl></li></ul>
4209
4210 !! end
4211
4212
4213 !! test
4214 Definition Lists: Mixed Lists: Test 10
4215 !! wikitext
4216 *#;foo :bar
4217 !! html
4218 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4219 <dd>bar</dd></dl></li></ol></li></ul>
4220
4221 !! end
4222
4223 # The Parsoid team disagrees with the PHP parser's seemingly-random
4224 # rules regarding dd/dt on the next two tests. Parsoid is more
4225 # consistent, and recognizes the shared nesting and keeps the
4226 # still-open tags around until the nesting is complete.
4227 # (And tidy again converts <dt> to <dd> before 'bar'.)
4228
4229 !! test
4230 Definition Lists: Mixed Lists: Test 11
4231 !! wikitext
4232 *#*#;*;;foo :bar
4233 *#*#;boo :baz
4234 !! html/php
4235 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4236 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4237 <dl><dt>boo&#160;</dt>
4238 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4239
4240 !! html/php+tidy
4241 <ul>
4242 <li>
4243 <ol>
4244 <li>
4245 <ul>
4246 <li>
4247 <ol>
4248 <li>
4249 <dl>
4250 <dt>foo&#160;</dt>
4251 <dd>
4252 <ul>
4253 <li>
4254 <dl>
4255 <dd>
4256 <dl>
4257 <dt>bar</dt>
4258 </dl>
4259 </dd>
4260 </dl>
4261 </li>
4262 </ul>
4263 </dd>
4264 </dl>
4265 <dl>
4266 <dt>boo&#160;</dt>
4267 <dd>baz</dd>
4268 </dl>
4269 </li>
4270 </ol>
4271 </li>
4272 </ul>
4273 </li>
4274 </ol>
4275 </li>
4276 </ul>
4277 !! html/parsoid
4278 <ul>
4279 <li>
4280 <ol>
4281 <li>
4282 <ul>
4283 <li>
4284 <ol>
4285 <li>
4286 <dl>
4287 <dt>
4288 <ul>
4289 <li>
4290 <dl>
4291 <dt>
4292 <dl>
4293 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4294 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4295 </dl></dt>
4296 </dl></li>
4297 </ul></dt>
4298 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4299 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4300 </dl></li>
4301 </ol></li>
4302 </ul></li>
4303 </ol></li>
4304 </ul>
4305 !! end
4306
4307
4308 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4309 # From whitelist:
4310 # * The test is wrong, there are two colons where there should be :;
4311 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4312 !! test
4313 Definition Lists: Weird Ones: Test 1
4314 !! wikitext
4315 *#;*::;; foo : bar (who uses this?)
4316 !! html/php
4317 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4318 <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>
4319
4320 !! html/php+tidy
4321 <ul>
4322 <li>
4323 <ol>
4324 <li>
4325 <dl>
4326 <dt>foo&#160;</dt>
4327 <dd>
4328 <ul>
4329 <li>
4330 <dl>
4331 <dd>
4332 <dl>
4333 <dd>
4334 <dl>
4335 <dd>
4336 <dl>
4337 <dt>bar (who uses this?)</dt>
4338 </dl>
4339 </dd>
4340 </dl>
4341 </dd>
4342 </dl>
4343 </dd>
4344 </dl>
4345 </li>
4346 </ul>
4347 </dd>
4348 </dl>
4349 </li>
4350 </ol>
4351 </li>
4352 </ul>
4353 !! html/parsoid
4354 <ul>
4355 <li>
4356 <ol>
4357 <li>
4358 <dl>
4359 <dt>
4360 <ul>
4361 <li>
4362 <dl>
4363 <dd>
4364 <dl>
4365 <dd>
4366 <dl>
4367 <dt>
4368 <dl>
4369 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4370 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4371 </dl></dt>
4372 </dl></dd>
4373 </dl></dd>
4374 </dl></li>
4375 </ul></dt>
4376 </dl></li>
4377 </ol></li>
4378 </ul>
4379 !! end
4380
4381 !! test
4382 Definition Lists: colons occurring in tags
4383 !! wikitext
4384 ;a:b
4385 ;'''a:b'''
4386 ;<i>a:b</i>
4387 ;<span>a:b</span>
4388 ;<div>a:b</div>
4389 ;<div>a
4390 :b</div>
4391 ;{{echo|a:b}}
4392 ;{{echo|''a:b''}}
4393 ;;;''a:b''
4394 !! html+tidy
4395 <dl>
4396 <dt>a</dt>
4397 <dd>b</dd>
4398 <dt><b>a:b</b></dt>
4399 <dt><i>a:b</i></dt>
4400 <dt><span>a:b</span></dt>
4401 <dd>
4402 <div>a:b</div>
4403 </dd>
4404 <dd>
4405 <div>a
4406 <dl>
4407 <dd>b</dd>
4408 </dl>
4409 </div>
4410 </dd>
4411 <dt>a</dt>
4412 <dd>b</dd>
4413 <dt><i>a:b</i></dt>
4414 </dl>
4415 <dl>
4416 <dd>
4417 <dl>
4418 <dd>
4419 <dl>
4420 <dt><i>a:b</i></dt>
4421 </dl>
4422 </dd>
4423 </dl>
4424 </dd>
4425 </dl>
4426 !! html/parsoid
4427 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4428 <dt><b>a:b</b></dt>
4429 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4430 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4431 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4432 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4433 <dd>b</dd>
4434 <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>
4435 <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>
4436 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4437 !! end
4438
4439 !! test
4440 Definition Lists: colons and tables 1
4441 !! wikitext
4442 :{|
4443 | x
4444 |}
4445 :{|
4446 | y
4447 |}
4448 !! html
4449 <dl><dd><table>
4450 <tr>
4451 <td> x
4452 </td></tr></table></dd></dl>
4453 <dl><dd><table>
4454 <tr>
4455 <td> y
4456 </td></tr></table></dd></dl>
4457
4458 !! end
4459
4460 # Parsoid's output (as documented below) differs from php's in this case.
4461 # This is probably a bug. If we fixup parsoid to match php's output, the
4462 # above test should pass and the below test case can be removed. It is
4463 # unclear which output is more desirable.
4464
4465 !! test
4466 Definition Lists: colons and tables 2
4467 !! wikitext
4468 :{|
4469 | x
4470 |}
4471 :{|
4472 | y
4473 |}
4474 !! html/parsoid
4475 <dl><dd><table>
4476 <tr>
4477 <td> x
4478 </td></tr></table></dd>
4479 <dd><table>
4480 <tr>
4481 <td> y
4482 </td></tr></table></dd></dl>
4483 !! end
4484
4485 !! test
4486 Definition Lists: template interaction
4487 !! wikitext
4488 ::{{definition_list}}
4489
4490 :one
4491 ::{{definition_list}}
4492 :::two
4493 :::three
4494 ::four
4495 !! html/parsoid
4496 <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">
4497 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4498
4499 <dl><dd data-parsoid='{}'>one
4500 <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">
4501 </span><dd about="#mwt2">two
4502 <dl><dd>two</dd>
4503 <dd>three</dd></dl></dd>
4504 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4505 !! end
4506
4507
4508 ###
4509 ### External links
4510 ###
4511 !! test
4512 External links: non-bracketed
4513 !! wikitext
4514 Non-bracketed: http://example.com
4515 !! html
4516 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4517 </p>
4518 !! end
4519
4520 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4521 !! test
4522 External links: numbered
4523 !! wikitext
4524 Numbered: [http://example.com]
4525 Numbered: [http://example.net]
4526 Numbered: [http://example.com]
4527 !! html/php
4528 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4529 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4530 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4531 </p>
4532 !! html/parsoid
4533 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4534 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4535 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4536 !!end
4537
4538 !! test
4539 External links: specified text
4540 !! wikitext
4541 Specified text: [http://example.com link]
4542 !! html
4543 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4544 </p>
4545 !!end
4546
4547 !! test
4548 External links: trail
4549 !! wikitext
4550 Linktrails should not work for external links: [http://example.com link]s
4551 !! html
4552 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4553 </p>
4554 !! end
4555
4556 !! test
4557 External links: dollar sign in URL
4558 !! wikitext
4559 http://example.com/1$2345
4560 !! html
4561 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4562 </p>
4563 !! end
4564
4565 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4566 !! test
4567 External links: dollar sign in URL (autonumber)
4568 !! wikitext
4569 [http://example.com/1$2345]
4570 !! html/php
4571 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4572 </p>
4573 !! html/parsoid
4574 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4575 !!end
4576
4577 !! test
4578 External links: open square bracket forbidden in URL (bug 4377)
4579 !! options
4580 parsoid=wt2html,wt2wt,html2html
4581 !! wikitext
4582 http://example.com/1[2345
4583 !! html/php
4584 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4585 </p>
4586 !! html/parsoid
4587 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4588 !! end
4589
4590 !! test
4591 External links: open square bracket forbidden in URL (named) (bug 4377)
4592 !! options
4593 parsoid=wt2html,html2html
4594 !! wikitext
4595 [http://example.com/1[2345]
4596 !! html/php
4597 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4598 </p>
4599 !! html/parsoid
4600 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4601 !!end
4602
4603 # parsoid adds a space before the link name
4604 !! test
4605 External links: open square bracket forbidden in URL (named) (bug 4377)
4606 Parsoid variant.
4607 !! wikitext
4608 [http://example.com/1 [2345]
4609 !! html
4610 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4611 </p>
4612 !!end
4613
4614 !! test
4615 External links: nowiki in URL link text (bug 6230)
4616 !! wikitext
4617 [http://example.com/ <nowiki>''example site''</nowiki>]
4618 !! html
4619 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4620 </p>
4621 !! end
4622
4623 !! test
4624 External links: newline forbidden in text (bug 6230 regression check)
4625 !! wikitext
4626 [http://example.com/ first
4627 second]
4628 !! html
4629 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4630 second]
4631 </p>
4632 !!end
4633
4634 !! test
4635 External links: Pipe char between url and text
4636 !! wikitext
4637 [http://example.com | link]
4638 !! html
4639 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4640 </p>
4641 !!end
4642
4643 !! test
4644 External links: protocol-relative URL in brackets
4645 !! wikitext
4646 [//example.com/ Test]
4647 !! html
4648 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4649 </p>
4650 !! end
4651
4652 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4653 !! test
4654 External links: protocol-relative URL in brackets without text
4655 !! wikitext
4656 [//example.com]
4657 !! html/php
4658 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4659 </p>
4660 !! html/parsoid
4661 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4662 !! end
4663
4664 !! test
4665 External links: protocol-relative URL in free text is left alone
4666 !! wikitext
4667 //example.com/Foo
4668 !! html
4669 <p>//example.com/Foo
4670 </p>
4671 !!end
4672
4673 !! test
4674 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4675 !! wikitext
4676 foo//example.com/Foo
4677 !! html
4678 <p>foo//example.com/Foo
4679 </p>
4680 !! end
4681
4682 !! test
4683 External links: with no contents
4684 !! wikitext
4685 [http://en.wikipedia.org/wiki/Foo]
4686
4687 [[wikipedia:Foo|Bar]]
4688
4689 [[wikipedia:Foo|<span>Bar</span>]]
4690 !! html/php
4691 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4692 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4693 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4694 </p>
4695 !! html/parsoid
4696 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4697 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4698 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4699 !! end
4700
4701 !! test
4702 External links: Free with trailing punctuation
4703 !! wikitext
4704 http://example.com,
4705 http://example.com;
4706 http://example.com\
4707 http://example.com.
4708 http://example.com:
4709 http://example.com!
4710 http://example.com?
4711 http://example.com)
4712 http://example.com/url_with_(brackets)
4713 (http://example.com/url_without_brackets)
4714 http://example.com/url_with_entity&amp;
4715 http://example.com/url_with_entity&#x26;
4716 http://example.com/url_with_entity&#038;
4717 http://example.com/url_with_entity&nbsp;
4718 http://example.com/url_with_entity&#xA0;
4719 http://example.com/url_with_entity&#160;
4720 http://example.com/url_with_entity&lt;
4721 http://example.com/url_with_entity&#x3C;
4722 http://example.com/url_with_entity&#60;
4723 !! html/php
4724 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4725 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4726 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4727 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4728 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4729 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4730 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4731 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4732 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4733 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4734 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4735 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4736 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4737 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4738 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4740 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4743 </p>
4744 !! html/parsoid
4745 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4746 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4747 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4748 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4749 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4750 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4751 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4752 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4753 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4754 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4755 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4756 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4757 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4758 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4759 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4760 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4761 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4762 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4763 <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>
4764 !! end
4765
4766 !! test
4767 External links: tricky Parsoid html2html case
4768 !! options
4769 parsoid=wt2html,wt2wt,html2html
4770 !! wikitext
4771 http://example.com/url_with_entity&amp;amp;
4772 !! html/php
4773 <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>;
4774 </p>
4775 !! html/parsoid
4776 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4777 !! end
4778
4779 !! test
4780 External links: Free with trailing quotes (T113666)
4781 !! wikitext
4782 '''News:''' Stuff here
4783
4784 news:'a'b''c''d e
4785 !! html/php
4786 <p><b>News:</b> Stuff here
4787 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4788 </p>
4789 !! html/parsoid
4790 <p><b>News:</b> Stuff here</p>
4791 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4792 !! end
4793
4794 !! test
4795 External links: Lone protocols are never linked (T105697)
4796 !! wikitext
4797 http://
4798 http://;
4799 (http://)
4800 bitcoin:
4801 bitcoin:;
4802 (bitcoin:)
4803 !! html
4804 <p>http://
4805 http://;
4806 (http://)
4807 bitcoin:
4808 bitcoin:;
4809 (bitcoin:)
4810 </p>
4811 !! end
4812
4813 !! test
4814 External links: No preceding word characters allowed (bug 65278)
4815 !! wikitext
4816 NOPEhttp://example.com
4817 N0http://example.com
4818 ok:http://example.com
4819 ok-http://example.com
4820 !! html
4821 <p>NOPEhttp://example.com
4822 N0http://example.com
4823 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4824 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4825 </p>
4826 !! end
4827
4828 !! test
4829 External links: nofollow domain exception
4830 !! wikitext
4831 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4832 !! html
4833 <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>.
4834 </p>
4835 !!end
4836
4837 !! test
4838 External image
4839 !! wikitext
4840 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4841 !! html
4842 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4843 </p>
4844 !! end
4845
4846 !! test
4847 External image from https
4848 !! wikitext
4849 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4850 !! html
4851 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4852 </p>
4853 !! end
4854
4855 !! test
4856 External image (when not allowed)
4857 !! options
4858 wgAllowExternalImages=0
4859 !! wikitext
4860 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4861 !! html
4862 <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>
4863 </p>
4864 !! end
4865
4866 !! test
4867 Link to non-http image, no img tag
4868 !! wikitext
4869 Link to non-http image, no img tag: ftp://example.com/test.jpg
4870 !! html
4871 <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>
4872 </p>
4873 !! end
4874
4875 !! test
4876 External links: terminating separator
4877 !! wikitext
4878 Terminating separator: http://example.com/thing,
4879 !! html
4880 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4881 </p>
4882 !! end
4883
4884 !! test
4885 External links: intervening separator
4886 !! wikitext
4887 Intervening separator: http://example.com/1,2,3
4888 !! html
4889 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4890 </p>
4891 !! end
4892
4893 !! test
4894 External links: old bug with URL in query
4895 !! wikitext
4896 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4897 !! html
4898 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4899 </p>
4900 !! end
4901
4902 !! test
4903 External links: old URL-in-URL bug, mixed protocols
4904 !! wikitext
4905 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4906 !! html
4907 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4908 </p>
4909 !!end
4910
4911 # Since Parsoid is starting to emit canonical wikitext for links,
4912 # [http://example.com http://example.com] will not RT back to that
4913 # form anymore.
4914 !! test
4915 External links: URL in text
4916 !! options
4917 parsoid=wt2html
4918 !! wikitext
4919 URL in text: [http://example.com http://example.com]
4920 !! html/php
4921 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4922 </p>
4923 !! html/parsoid
4924 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4925 !! end
4926
4927 !! test
4928 External links: Clickable images
4929 !! wikitext
4930 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4931 !! html/php
4932 <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>
4933 </p>
4934 !! html/parsoid
4935 <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>
4936 !! end
4937
4938 !! test
4939 External links: raw ampersand
4940 !! wikitext
4941 Old &amp; use: http://x&y
4942 !! html
4943 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4944 </p>
4945 !! end
4946
4947 !! test
4948 External links: encoded ampersand
4949 !! wikitext
4950 Old &amp; use: http://x&amp;y
4951 !! html/php
4952 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4953 </p>
4954 !! html/parsoid
4955 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4956 !! end
4957
4958 !! test
4959 External links: encoded equals (bug 6102)
4960 !! wikitext
4961 http://example.com/?foo&#61;bar
4962 !! html/php
4963 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4964 </p>
4965 !! html/parsoid
4966 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4967 !! end
4968
4969 ##
4970 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4971 ## does it number them. As discussed in bug 53505, we can identify
4972 ## autonumbered links via CSS.
4973 ##
4974
4975 !! test
4976 External links: [raw ampersand]
4977 !! wikitext
4978 Old &amp; use: [http://x&y]
4979 !! html/php
4980 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4981 </p>
4982 !! html/parsoid
4983 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4984 !! end
4985
4986 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4987 # mode will return the [raw ampersand] wikitext
4988 !! test
4989 External links: [encoded ampersand]
4990 !! options
4991 parsoid=wt2html,wt2wt,html2html
4992 !! wikitext
4993 Old &amp; use: [http://x&amp;y]
4994 !! html/php
4995 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4996 </p>
4997 !! html/parsoid
4998 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4999 !! end
5000
5001 !! test
5002 External links: [raw equals]
5003 !! wikitext
5004 [http://example.com/?foo=bar]
5005 !! html/php
5006 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5007 </p>
5008 !! html/parsoid
5009 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5010 !! end
5011
5012 # note that parsoid html is identical to [raw equals] case; so html2wt
5013 # mode will return the [raw equals] wikitext
5014 !! test
5015 External links: [encoded equals] (bug 6102)
5016 !! options
5017 parsoid=wt2html,wt2wt,html2html
5018 !! wikitext
5019 [http://example.com/?foo&#61;bar]
5020 !! html/php
5021 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5022 </p>
5023 !! html/parsoid
5024 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5025 !! end
5026
5027 # xxx parsoid strips the IDN character, so the round-trip tests will
5028 # obviously fail and are disabled. --cscott
5029 !! test
5030 External links: [IDN ignored character reference in hostname; strip it right off]
5031 !! options
5032 parsoid=wt2html,wt2wt,html2html
5033 !! wikitext
5034 [http://e&zwnj;xample.com/]
5035 !! html/php
5036 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5037 </p>
5038 !! html/parsoid
5039 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5040 !! end
5041
5042 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5043 # Where an external link could easily circumvent the sanitization of the text of
5044 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5045 # test demands a higher standard. That's a bit strange.
5046 #
5047 # Example:
5048 #
5049 # http://e‌xample.com -> [http://example.com|http://example.com]
5050 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5051 #
5052 # The first example is sanitized, but the second is not. Any security benefits
5053 # from this production are trivial to circumvent. Either remove this test and
5054 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5055 # the test accordingly.
5056 #
5057 # All our love,
5058 # The Parsoid team.
5059 # xxx parsoid strips the IDN character, so the round-trip tests will
5060 # obviously fail and are disabled. --cscott
5061 !! test
5062 External links: IDN ignored character reference in hostname; strip it right off
5063 !! options
5064 parsoid=wt2html,html2html
5065 !! wikitext
5066 http://e&zwnj;xample.com/
5067 !! html/php
5068 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5069 </p>
5070 !! html/parsoid
5071 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5072 !! end
5073
5074 !! test
5075 External links: www.jpeg.org (bug 554)
5076 !! wikitext
5077 http://www.jpeg.org
5078 !! html
5079 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5080 </p>
5081 !! end
5082
5083 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5084 !! test
5085 External links: URL within URL (original bug 2)
5086 !! wikitext
5087 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5088 !! html/php
5089 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5090 </p>
5091 !! html/parsoid
5092 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5093 !! end
5094
5095 !! test
5096 BUG 361: URL inside bracketed URL
5097 !! wikitext
5098 [http://www.example.com/foo http://www.example.com/bar]
5099 !! html
5100 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5101 </p>
5102 !! end
5103
5104 !! test
5105 BUG 361: URL within URL, not bracketed
5106 !! wikitext
5107 http://www.example.com/foo?=http://www.example.com/bar
5108 !! html
5109 <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>
5110 </p>
5111 !! end
5112
5113 !! test
5114 BUG 289: ">"-token in URL-tail
5115 !! wikitext
5116 http://www.example.com/<hello>
5117 !! html
5118 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5119 </p>
5120 !!end
5121
5122 !! test
5123 BUG 289: literal ">"-token in URL-tail
5124 !! wikitext
5125 http://www.example.com/<b>html</b>
5126 !! html/php
5127 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5128 </p>
5129 !! html/parsoid
5130 <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>
5131 !! end
5132
5133 !! test
5134 BUG 289: ">"-token in bracketed URL
5135 !! wikitext
5136 [http://www.example.com/<hello> stuff]
5137 !! html
5138 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5139 </p>
5140 !!end
5141
5142 !! test
5143 BUG 289: literal ">"-token in bracketed URL
5144 !! wikitext
5145 [http://www.example.com/<b>html</b> stuff]
5146 !! html
5147 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5148 </p>
5149 !!end
5150
5151 !! test
5152 BUG 289: literal double quote at end of URL
5153 !! wikitext
5154 http://www.example.com/"hello"
5155 !! html
5156 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5157 </p>
5158 !!end
5159
5160 !! test
5161 BUG 289: literal double quote in bracketed URL
5162 !! wikitext
5163 [http://www.example.com/"hello" stuff]
5164 !! html
5165 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5166 </p>
5167 !!end
5168
5169 !! test
5170 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5171 !! wikitext
5172 [http://www.example.com test]
5173 !! html
5174 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5175 </p>
5176 !! end
5177
5178 !! test
5179 External links: link text with spaces
5180 !! wikitext
5181 [http://www.example.com a b c]
5182 [http://www.example.com ''a'' ''b'']
5183 !! html
5184 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5185 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5186 </p>
5187 !! end
5188
5189 !! test
5190 External links: wiki links within external link (Bug 3695)
5191 !! options
5192 parsoid=wt2html,html2html
5193 !! wikitext
5194 [http://example.com [[wikilink]] embedded in ext link]
5195 !! html/php
5196 <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>
5197 </p>
5198 !! html/parsoid
5199 <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>
5200 !! end
5201
5202 !! test
5203 BUG 787: Links with one slash after the url protocol are invalid
5204 !! wikitext
5205 http:/example.com
5206
5207 [http:/example.com title]
5208 !! html
5209 <p>http:/example.com
5210 </p><p>[http:/example.com title]
5211 </p>
5212 !! end
5213
5214 !! test
5215 Bracketed external links with template-generated invalid target
5216 !! wikitext
5217 [{{echo|http:/example.com}} title]
5218 !! html
5219 <p>[http:/example.com title]
5220 </p>
5221 !! end
5222
5223 !! test
5224 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5225 !! wikitext
5226 ''[http://example.com text'']
5227 [http://example.com '''text]'''
5228 ''Something [http://example.com in italic'']
5229 ''Something [http://example.com mixed''''', even bold]'''
5230 '''''Now [http://example.com both''''']
5231 !! html
5232 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5233 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5234 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5235 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5236 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5237 </p>
5238 !! end
5239
5240
5241 !! test
5242 Bug 4781: %26 in URL
5243 !! wikitext
5244 http://www.example.com/?title=AT%26T
5245 !! html/php
5246 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5250 !! end
5251
5252 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5253 # % is actually legal in HTML5. Any change in output would need testing though.
5254 !! test
5255 Bug 4781, 5267: %25 in URL
5256 !! wikitext
5257 http://www.example.com/?title=100%25_Bran
5258 !! html/php
5259 <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>
5260 </p>
5261 !! html/parsoid
5262 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5263 !! end
5264
5265 !! test
5266 Bug 4781, 5267: %28, %29 in URL
5267 !! wikitext
5268 http://www.example.com/?title=Ben-Hur_%281959_film%29
5269 !! html/php
5270 <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>
5271 </p>
5272 !! html/parsoid
5273 <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>
5274 !! end
5275
5276
5277 !! test
5278 Bug 4781: %26 in autonumber URL
5279 !! wikitext
5280 [http://www.example.com/?title=AT%26T]
5281 !! html/php
5282 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5283 </p>
5284 !! html/parsoid
5285 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5286 !! end
5287
5288 !! test
5289 Bug 4781, 5267: %26 in autonumber URL
5290 !! wikitext
5291 [http://www.example.com/?title=100%25_Bran]
5292 !! html/php
5293 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5294 </p>
5295 !! html/parsoid
5296 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5297 !! end
5298
5299 !! test
5300 Bug 4781, 5267: %28, %29 in autonumber URL
5301 !! wikitext
5302 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5303 !! html/php
5304 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5305 </p>
5306 !! html/parsoid
5307 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5308 !! end
5309
5310
5311 !! test
5312 Bug 4781: %26 in bracketed URL
5313 !! wikitext
5314 [http://www.example.com/?title=AT%26T link]
5315 !! html/php
5316 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5317 </p>
5318 !! html/parsoid
5319 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5320 !! end
5321
5322 !! test
5323 Bug 4781, 5267: %25 in bracketed URL
5324 !! wikitext
5325 [http://www.example.com/?title=100%25_Bran link]
5326 !! html
5327 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5328 </p>
5329 !! end
5330
5331 !! test
5332 Bug 4781, 5267: %28, %29 in bracketed URL
5333 !! wikitext
5334 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5335 !! html/php
5336 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5337 </p>
5338 !! html/parsoid
5339 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5340 !! end
5341
5342 !! test
5343 External link containing a period in the anchor. (bug 63947)
5344 !! wikitext
5345 [//foo.org/bar#baz. bang]
5346
5347 [//foo.org/bar. bang]
5348 !! html/php
5349 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5350 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5351 </p>
5352 !! html/parsoid
5353 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5354 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5355 !! end
5356
5357 !! test
5358 External link containing a single quote. (bug 63947)
5359 !! wikitext
5360 [//foo.org/bar'baz]
5361
5362 [//foo.org/bar'baz bang]
5363 !! html/php
5364 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5365 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5366 </p>
5367 !! html/parsoid
5368 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5369 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5370 !! end
5371
5372 !! test
5373 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5374 !! wikitext
5375 Some [http://example.com/ pretty ''italics'' and stuff]!
5376 !! html
5377 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5378 </p>
5379 !! end
5380
5381 !! test
5382 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5383 !! wikitext
5384 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5385 !! html
5386 <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>
5387 </p>
5388 !! end
5389
5390 !! test
5391 External link containing double-single-quotes with no space separating the url from text in italics
5392 !! wikitext
5393 [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]].]
5394 !! html/php
5395 <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>
5396 </p>
5397 !! html/php+tidy
5398 <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>
5399 !! html/parsoid
5400 <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>
5401 !! end
5402
5403 !! test
5404 External link with comments in link text
5405 !! wikitext
5406 [http://www.google.com Google <!-- comment -->]
5407 !! html/php
5408 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5409 </p>
5410 !! html/parsoid
5411 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5412 !! end
5413
5414 !! test
5415 External link to bare IPv4 address
5416 !! wikitext
5417 [http://192.168.0.1 Link]
5418 !! html/php
5419 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5420 </p>
5421 !! html/parsoid
5422 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5423 !! end
5424
5425 !! test
5426 URL-encoding in URL functions (single parameter)
5427 !! wikitext
5428 {{localurl:Some page|amp=&}}
5429 !! html
5430 <p>/index.php?title=Some_page&amp;amp=&amp;
5431 </p>
5432 !! end
5433
5434 !! test
5435 URL-encoding in URL functions (multiple parameters)
5436 !! wikitext
5437 {{localurl:Some page|q=?&amp=&}}
5438 !! html
5439 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5440 </p>
5441 !! end
5442
5443 !! test
5444 Brackets in urls
5445 !! wikitext
5446 http://example.com/index.php?foozoid%5B%5D=bar
5447
5448 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5449 !! html/php
5450 <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>
5451 </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>
5452 </p>
5453 !! html/parsoid
5454 <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>
5455
5456 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5457 !! end
5458
5459 !! test
5460 IPv6 urls, autolink format (T23261)
5461 !! wikitext
5462 http://[2404:130:0:1000::187:2]/index.php
5463
5464 Examples from RFC 2373, section 2.2:
5465 * http://[1080::8:800:200C:417A]/unicast
5466 * http://[FF01::101]/multicast
5467 * http://[::1]/loopback
5468 * http://[::]/unspecified
5469 * http://[::13.1.68.3]/ipv4compat
5470 * http://[::FFFF:129.144.52.38]/ipv4compat
5471
5472 Examples from RFC 2732, section 2:
5473 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5474 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5475 * http://[3ffe:2a00:100:7031::1]
5476 * http://[1080::8:800:200C:417A]/foo
5477 * http://[::192.9.5.5]/ipng
5478 * http://[::FFFF:129.144.52.38]:80/index.html
5479 * http://[2010:836B:4179::836B:4179]
5480
5481 !! html/php
5482 <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>
5483 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5484 </p>
5485 <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>
5486 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5487 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5488 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5489 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5490 <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>
5491 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5492 </p>
5493 <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>
5494 <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>
5495 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5496 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5497 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5498 <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>
5499 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5500
5501 !! html/parsoid
5502 <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>
5503
5504 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5505 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5511
5512 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5513 <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>
5514 <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>
5515 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5518 <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>
5519 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5520 !! end
5521
5522 !! test
5523 IPv6 urls, bracketed format (T23261)
5524 !! wikitext
5525 [http://[2404:130:0:1000::187:2]/index.php test]
5526
5527 Examples from RFC 2373, section 2.2:
5528 * [http://[1080::8:800:200C:417A] unicast]
5529 * [http://[FF01::101] multicast]
5530 * [http://[::1]/ loopback]
5531 * [http://[::] unspecified]
5532 * [http://[::13.1.68.3] ipv4compat]
5533 * [http://[::FFFF:129.144.52.38] ipv4compat]
5534
5535 Examples from RFC 2732, section 2:
5536 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5537 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5538 * [http://[3ffe:2a00:100:7031::1] 3]
5539 * [http://[1080::8:800:200C:417A]/foo 4]
5540 * [http://[::192.9.5.5]/ipng 5]
5541 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5542 * [http://[2010:836B:4179::836B:4179] 7]
5543
5544 !! html/php
5545 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5546 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5547 </p>
5548 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5549 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5550 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5551 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5552 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5553 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5554 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5555 </p>
5556 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5557 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5558 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5561 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5562 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5563
5564 !! html/parsoid
5565 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5566
5567 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5568 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5569 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5570 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5571 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5572 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5573 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5574
5575 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5576 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5577 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5578 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5581 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5582 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5583 !! end
5584
5585 !! test
5586 Non-extlinks in brackets
5587 !! wikitext
5588 [foo]
5589 [foo bar]
5590 [foo ''bar'']
5591 [fool's] errand
5592 [fool's errand]
5593 [{{echo|foo}}]
5594 [{{echo|foo}} bar]
5595 [{{echo|foo}} ''bar'']
5596 [{{echo|foo}}l's] errand
5597 [{{echo|foo}}l's errand]
5598 [url={{echo|foo}}]
5599 [url=http://example.com]
5600 [http:// bare protocols don't count]
5601 !! html/php
5602 <p>[foo]
5603 [foo bar]
5604 [foo <i>bar</i>]
5605 [fool's] errand
5606 [fool's errand]
5607 [foo]
5608 [foo bar]
5609 [foo <i>bar</i>]
5610 [fool's] errand
5611 [fool's errand]
5612 [url=foo]
5613 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5614 [http:// bare protocols don't count]
5615 </p>
5616 !! html/parsoid
5617 <p>[foo]
5618 [foo bar]
5619 [foo <i>bar</i>]
5620 [fool's] errand
5621 [fool's errand]
5622 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5623 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5624 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5625 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5626 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5627 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5628 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5629 [http:// bare protocols don't count]</p>
5630 !! end
5631
5632 !! test
5633 Percent encoding in external links
5634 !! wikitext
5635 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5636 !! html/php
5637 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5638 </p>
5639 !! html/parsoid
5640 <p><a rel="mw:ExtLink"
5641 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5642 !! end
5643
5644 !! test
5645 Use url link syntax for links where the content is equal the link target
5646 !! wikitext
5647 http://example.com
5648 !! html/php
5649 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5650 </p>
5651 !! html/parsoid
5652 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5653 !! end
5654
5655 !! test
5656 Parenthesis in external links, especially URL links
5657 !! wikitext
5658 http://example.com)
5659
5660 http://example.com/test)
5661
5662 http://example.com/(test)
5663
5664 http://example.com/((test)
5665
5666 (http://example.com/(test))
5667
5668 (http://example.com/(test)))))
5669
5670 http://example.com/a)b
5671
5672 [http://example.com) foo]
5673 !! html/php
5674 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5675 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5676 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5677 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5678 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5679 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5680 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5681 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5682 </p>
5683 !! html/parsoid
5684 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5685 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5686 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5687 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5688 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5689 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5690 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5691 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5692 !! end
5693
5694 !! test
5695 Parenthesis in external links, w/ transclusion or comment
5696 !! wikitext
5697 (http://example.com/{{echo|hi}})
5698
5699 (http://example.com<!-- hi -->)
5700 !! html/php
5701 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5702 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5703 </p>
5704 !! html/parsoid
5705 <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>
5706
5707 <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>
5708 !! end
5709
5710 !! test
5711 Serialize <a> tags with invalid link targets as plain text
5712 !! options
5713 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5714 !! html/parsoid
5715 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5716 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5717 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5718 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5719 !! wikitext
5720 text
5721 <nowiki>*</nowiki>text
5722 <nowiki>[[foo]]</nowiki>
5723 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5724 !! end
5725
5726 !! test
5727 mw:ExtLink -vs- mw:WikiLink (T94723)
5728 !! options
5729 parsoid=html2wt
5730 !! html/parsoid
5731 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5732 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5733 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5734 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5735 <p>
5736 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5737 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5738 </p>
5739 !! wikitext
5740 [[Foo|Bar]]
5741 [[Foo|Bar]]
5742 [[wikipedia:Foo|Bar]]
5743 [[wikipedia:Foo|Bar]]
5744
5745 [[wikipedia:European_Robin|European Robin]]
5746 [[wikipedia:European_Robin|European Robin]]
5747 !! end
5748
5749 !! test
5750 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5751 !! options
5752 parsoid=wt2wt
5753 !! wikitext
5754 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5755 !! html/parsoid
5756 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5757 !! end
5758
5759
5760 ###
5761 ### Quotes
5762 ###
5763
5764 !! test
5765 Quotes
5766 !! wikitext
5767 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5768
5769 Normal text. '''''Bold italic text.''''' Normal text.
5770 !! html
5771 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5772 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5773 </p>
5774 !! end
5775
5776
5777 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5778 # parser strips. The wikitext contains just the first half of the bold
5779 # quote pair.
5780 !! test
5781 Unclosed and unmatched quotes
5782 !! wikitext
5783 '''''Bold italic text '''with bold deactivated''' in between.'''''
5784
5785 '''''Bold italic text ''with italic deactivated'' in between.'''''
5786
5787 '''Bold text..
5788
5789 ..spanning two paragraphs (should not work).'''
5790
5791 '''Bold tag left open
5792
5793 ''Italic tag left open
5794
5795 Normal text.
5796
5797 <!-- Unmatching number of opening, closing tags: -->
5798 '''This year''''s election ''should'' beat '''last year''''s.
5799
5800 ''Tom'''s car is bigger than ''Susan'''s.
5801
5802 Plain ''italic'''s plain
5803 !! html/php
5804 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5805 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5806 </p><p><b>Bold text..</b>
5807 </p><p>..spanning two paragraphs (should not work).
5808 </p><p><b>Bold tag left open</b>
5809 </p><p><i>Italic tag left open</i>
5810 </p><p>Normal text.
5811 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5812 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5813 </p><p>Plain <i>italic'</i>s plain
5814 </p>
5815 !! html/parsoid
5816 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5817 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5818 </p><p><b>Bold text..</b>
5819 </p><p>..spanning two paragraphs (should not work).<b></b>
5820 </p><p><b>Bold tag left open</b>
5821 </p><p><i>Italic tag left open</i>
5822 </p><p>Normal text.
5823 </p>
5824 <!-- Unmatching number of opening, closing tags: -->
5825 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5826 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5827 </p><p>Plain <i>italic'</i>s plain
5828 </p>
5829 !! end
5830
5831 ###
5832 ### Tables
5833 ###
5834 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5835 ###
5836
5837 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5838 # is the bare minimum required by the spec, see:
5839 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5840 # Parsoid team replies: empty table tags are legal in HTML5
5841 !! test
5842 A table with no data.
5843 !! options
5844 parsoid=wt2html
5845 !! wikitext
5846 {||}
5847 !! html/php
5848
5849 !! html/parsoid
5850 <table></table>
5851
5852 !! end
5853
5854 !! test
5855 A table with stray table end tags on start tag line (wt2html)
5856 !! options
5857 parsoid=wt2html
5858 !! wikitext
5859 {|style="color: red;"|}
5860
5861 {|style="color: red;" |}
5862 |foo
5863 |}
5864
5865 {|style="color: red;"|} id="foo"
5866 |foo
5867 |}
5868
5869 {|style="color: red;" |} id="foo"
5870 |foo
5871 |}
5872 !! html
5873 <table style="color: red;"></table>
5874
5875 <table style="color: red;">
5876 <tbody><tr>
5877 <td>foo</td>
5878 </tr></tbody>
5879 </table>
5880
5881 <table style="color: red;" id="foo">
5882 <tbody><tr>
5883 <td>foo</td>
5884 </tr></tbody>
5885 </table>
5886
5887 <table style="color: red;" id="foo">
5888 <tbody><tr>
5889 <td>foo</td>
5890 </tr></tbody>
5891 </table>
5892
5893 !! end
5894
5895 !! test
5896 A table with no data (take 2)
5897 !! wikitext
5898 {|
5899 |}
5900 !! html/parsoid
5901 <table></table>
5902 !! end
5903
5904 # A table with nothing but a caption is invalid XHTML, we might want to render
5905 # this as <p>caption</p>
5906 # Parsoid team replies: table with only a caption is legal in HTML5
5907 !! test
5908 A table with nothing but a caption
5909 !! wikitext
5910 {|
5911 |+ caption
5912 |}
5913 !! html/php
5914 <table>
5915 <caption> caption
5916 </caption><tr><td></td></tr></table>
5917
5918 !! html/parsoid
5919 <table><caption> caption</caption></table>
5920 !! end
5921
5922 !! test
5923 A table with caption with default-spaced attributes and a table row
5924 !! wikitext
5925 {|
5926 |+ style="color: red;" | caption1
5927 |-
5928 | foo
5929 |}
5930 !! html
5931 <table>
5932 <caption style="color: red;"> caption1
5933 </caption>
5934 <tr>
5935 <td> foo
5936 </td></tr></table>
5937
5938 !! end
5939
5940 !! test
5941 A table with captions with non-default spaced attributes and a table row
5942 !! wikitext
5943 {|
5944 |+style="color: red;"|caption2
5945 |+ style="color: red;"| caption3
5946 |-
5947 | foo
5948 |}
5949 !! html
5950 <table>
5951 <caption style="color: red;">caption2
5952 </caption>
5953 <caption style="color: red;"> caption3
5954 </caption>
5955 <tr>
5956 <td> foo
5957 </td></tr></table>
5958
5959 !! end
5960
5961 !! test
5962 Table td-cell syntax variations
5963 !! wikitext
5964 {|
5965 | foo bar foo | baz
5966 | foo bar foo || baz
5967 | style='color:red;' | baz
5968 | style='color:red;' || baz
5969 |}
5970 !! html
5971 <table>
5972 <tr>
5973 <td> baz
5974 </td>
5975 <td> foo bar foo </td>
5976 <td> baz
5977 </td>
5978 <td style="color:red;"> baz
5979 </td>
5980 <td> style='color:red;' </td>
5981 <td> baz
5982 </td></tr></table>
5983
5984 !! end
5985
5986 !! test
5987 Simple table
5988 !! wikitext
5989 {|
5990 | 1 || 2
5991 |-
5992 | 3 || 4
5993 |}
5994 !! html
5995 <table>
5996 <tr>
5997 <td> 1 </td>
5998 <td> 2
5999 </td></tr>
6000 <tr>
6001 <td> 3 </td>
6002 <td> 4
6003 </td></tr></table>
6004
6005 !! end
6006
6007 !! test
6008 Simple table but with multiple dashes for row wikitext
6009 !! wikitext
6010 {|
6011 | foo
6012 |-----
6013 | bar
6014 |}
6015 !! html
6016 <table>
6017 <tr>
6018 <td> foo
6019 </td></tr>
6020 <tr>
6021 <td> bar
6022 </td></tr></table>
6023
6024 !! end
6025
6026 !! test
6027 Multiplication table
6028 !! wikitext
6029 {| border="1" cellpadding="2"
6030 |+Multiplication table
6031 |-
6032 ! &times; !! 1 !! 2 !! 3
6033 |-
6034 ! 1
6035 | 1 || 2 || 3
6036 |-
6037 ! 2
6038 | 2 || 4 || 6
6039 |-
6040 ! 3
6041 | 3 || 6 || 9
6042 |-
6043 ! 4
6044 | 4 || 8 || 12
6045 |-
6046 ! 5
6047 | 5 || 10 || 15
6048 |}
6049 !! html
6050 <table border="1" cellpadding="2">
6051 <caption>Multiplication table
6052 </caption>
6053 <tr>
6054 <th> &#215; </th>
6055 <th> 1 </th>
6056 <th> 2 </th>
6057 <th> 3
6058 </th></tr>
6059 <tr>
6060 <th> 1
6061 </th>
6062 <td> 1 </td>
6063 <td> 2 </td>
6064 <td> 3
6065 </td></tr>
6066 <tr>
6067 <th> 2
6068 </th>
6069 <td> 2 </td>
6070 <td> 4 </td>
6071 <td> 6
6072 </td></tr>
6073 <tr>
6074 <th> 3
6075 </th>
6076 <td> 3 </td>
6077 <td> 6 </td>
6078 <td> 9
6079 </td></tr>
6080 <tr>
6081 <th> 4
6082 </th>
6083 <td> 4 </td>
6084 <td> 8 </td>
6085 <td> 12
6086 </td></tr>
6087 <tr>
6088 <th> 5
6089 </th>
6090 <td> 5 </td>
6091 <td> 10 </td>
6092 <td> 15
6093 </td></tr></table>
6094
6095 !! end
6096
6097 !! test
6098 Accept "||" in table headings
6099 !! wikitext
6100 {|
6101 !h1 || h2
6102 |}
6103 !! html
6104 <table>
6105 <tr>
6106 <th>h1 </th>
6107 <th> h2
6108 </th></tr></table>
6109
6110 !! end
6111
6112 !! test
6113 Accept "!!" in table data
6114 !! wikitext
6115 {|
6116 | Foo!! ||
6117 |}
6118 !! html
6119 <table>
6120 <tr>
6121 <td> Foo!! </td>
6122 <td>
6123 </td></tr></table>
6124
6125 !! html/parsoid
6126 <table>
6127 <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>
6128 </tbody></table>
6129 !! end
6130
6131 !! test
6132 Accept "||" in indented table headings
6133 !! wikitext
6134 :{|
6135 !h1 || h2
6136 |}
6137 !! html
6138 <dl><dd><table>
6139 <tr>
6140 <th>h1 </th>
6141 <th> h2
6142 </th></tr></table></dd></dl>
6143
6144 !! end
6145
6146 !! test
6147 Accept "!!" in templates
6148 !! wikitext
6149 {|
6150 !a {{echo|b!!c}}
6151 |}
6152 !! html/php
6153 <table>
6154 <tr>
6155 <th>a b</th>
6156 <th>c
6157 </th></tr></table>
6158
6159 !! html/parsoid
6160 <table>
6161 <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>
6162 !! end
6163
6164 !! test
6165 Accept "!!" in table headings after newline
6166 !! wikitext
6167 {|
6168 !a
6169 b!!c
6170 |}
6171 !! html/php
6172 <table>
6173 <tr>
6174 <th>a
6175 <p>b!!c
6176 </p>
6177 </th></tr></table>
6178
6179 !! html/parsoid
6180 <table>
6181 <tbody><tr><th>a
6182 <p>b!!c</p></th></tr>
6183 </tbody></table>
6184 !! end
6185
6186 !! test
6187 Accept "!!" in table data of mixed wikitext / html syntax
6188 !! wikitext
6189 {|
6190 !a
6191 <tr><td>b!!c</td></tr>
6192 |}
6193 !! html+tidy
6194 <table>
6195 <tr>
6196 <th>a</th>
6197 </tr>
6198 <tr>
6199 <td>b!!c</td>
6200 </tr>
6201 </table>
6202 !! html/parsoid
6203 <table>
6204 <tbody><tr><th>a</th></tr>
6205 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6206 </tbody></table>
6207 !! end
6208
6209 !! test
6210 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6211 !! wikitext
6212 {|
6213 !| h1
6214 || a
6215 |}
6216 !! html
6217 <table>
6218 <tr>
6219 <th> h1
6220 </th>
6221 <td> a
6222 </td></tr></table>
6223
6224 !! end
6225
6226 !!test
6227 Accept "| !" at start of line in tables (ignore !-attribute)
6228 !! wikitext
6229 {|
6230 |-
6231 | !style="color:red" | bar
6232 |}
6233 !! html
6234 <table>
6235
6236 <tr>
6237 <td> bar
6238 </td></tr></table>
6239
6240 !!end
6241
6242 !!test
6243 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 +/-
6244 !! wikitext
6245 {|
6246 |-
6247 |style='color:red;'|+1
6248 |style='color:blue;'|-1
6249 |-
6250 | 1 || 2 || 3
6251 | 1 ||+2 ||-3
6252 |-
6253 | +1
6254 | -1
6255 |}
6256 !! html
6257 <table>
6258
6259 <tr>
6260 <td style="color:red;">+1
6261 </td>
6262 <td style="color:blue;">-1
6263 </td></tr>
6264 <tr>
6265 <td> 1 </td>
6266 <td> 2 </td>
6267 <td> 3
6268 </td>
6269 <td> 1 </td>
6270 <td>+2 </td>
6271 <td>-3
6272 </td></tr>
6273 <tr>
6274 <td> +1
6275 </td>
6276 <td> -1
6277 </td></tr></table>
6278
6279 !!end
6280
6281 !! test
6282 Table rowspan
6283 !! wikitext
6284 {| border=1
6285 | Cell 1, row 1
6286 |rowspan=2| Cell 2, row 1 (and 2)
6287 | Cell 3, row 1
6288 |-
6289 | Cell 1, row 2
6290 | Cell 3, row 2
6291 |}
6292 !! html
6293 <table border="1">
6294 <tr>
6295 <td> Cell 1, row 1
6296 </td>
6297 <td rowspan="2"> Cell 2, row 1 (and 2)
6298 </td>
6299 <td> Cell 3, row 1
6300 </td></tr>
6301 <tr>
6302 <td> Cell 1, row 2
6303 </td>
6304 <td> Cell 3, row 2
6305 </td></tr></table>
6306
6307 !! end
6308
6309 !! test
6310 Nested table
6311 !! wikitext
6312 {| border=1
6313 | &alpha;
6314 |
6315 {| bgcolor=#ABCDEF border=2
6316 |nested
6317 |-
6318 |table
6319 |}
6320 |the original table again
6321 |}
6322 !! html
6323 <table border="1">
6324 <tr>
6325 <td> &#945;
6326 </td>
6327 <td>
6328 <table bgcolor="#ABCDEF" border="2">
6329 <tr>
6330 <td>nested
6331 </td></tr>
6332 <tr>
6333 <td>table
6334 </td></tr></table>
6335 </td>
6336 <td>the original table again
6337 </td></tr></table>
6338
6339 !! end
6340
6341 !! test
6342 Invalid attributes in table cell (bug 1830)
6343 !! wikitext
6344 {|
6345 |Cell:|broken
6346 |}
6347 !! html
6348 <table>
6349 <tr>
6350 <td>broken
6351 </td></tr></table>
6352
6353 !! end
6354
6355 !! test
6356 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6357 !! wikitext
6358 {|
6359 | title="foo" |bar
6360 | title="foo<nowiki>|</nowiki>" |bar
6361 | title="foo<nowiki>|</nowiki>" bar
6362 |}
6363 !! html/php
6364 <table>
6365 <tr>
6366 <td title="foo">bar
6367 </td>
6368 <td title="foo&#124;">bar
6369 </td>
6370 <td> title="foo|" bar
6371 </td></tr></table>
6372
6373 !! html/parsoid
6374 <table>
6375 <tbody><tr><td title="foo">bar</td>
6376 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6377 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6378 </tbody></table>
6379 !! end
6380
6381 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6382 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6383 # *2wt modes will fail.
6384 !! test
6385 Table security: embedded pipes
6386 !! options
6387 parsoid=wt2html,html2html
6388 !! wikitext
6389 {|
6390 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6391 !! html/php
6392 <table>
6393 <tr>
6394 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6395 <td>]" onmouseover="alert(document.cookie)"&gt;test
6396 </td>
6397 </tr>
6398 </table>
6399
6400 !! html/parsoid
6401 <table><tbody>
6402 <tr>
6403 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6404 !! end
6405
6406 !! test
6407 Element attributes with double ! should not be broken up by <th>
6408 !! wikitext
6409 {|
6410 ! hi <div class="!!">ha</div> ho
6411 |}
6412 !! html/php
6413 <table>
6414 <tr>
6415 <th> hi <div class="!!">ha</div> ho
6416 </th></tr></table>
6417
6418 !! html/parsoid
6419 <table>
6420 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6421 </tbody></table>
6422 !! end
6423
6424 !! test
6425 ! and || in element attributes should not be parsed as <th>/<td>
6426 !! wikitext
6427 {|
6428 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6429 |}
6430 !! html/php
6431 <table>
6432 <tr>
6433 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6434 </td></tr></table>
6435
6436 !! html/parsoid
6437 <table>
6438 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6439 </tbody></table>
6440 !! end
6441
6442 # FIXME: The output seems broken. Filed as T110268.
6443 !! test
6444 ! and || in td attributes should not be parsed as <th>/<td>
6445 !! options
6446 parsoid=wt2html
6447 !! wikitext
6448 {|
6449 | style="color: red !important;" data-contrived="put this here ||" | foo
6450 |}
6451 !! html/php
6452 <table>
6453 <tr>
6454 <td> style="color: red !important;" data-contrived="put this here </td>
6455 <td> foo
6456 </td></tr></table>
6457
6458 !! html/parsoid
6459 <table>
6460 <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>
6461 </tbody></table>
6462 !! end
6463
6464 !! test
6465 Break on | in element attribute in template
6466 !! options
6467 parsoid=wt2html,html2html
6468 !! wikitext
6469 {{echo|1=<div class="hi|ho">ha</div>}}
6470 !! html/php
6471 <p>ho"&gt;ha&lt;/div&gt;
6472 </p>
6473 !! html/parsoid
6474 <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>
6475 !! end
6476
6477 ## We don't support roundtripping of these attributes in Parsoid.
6478 ## Selective serialization takes care of preventing dirty diffs.
6479 ## But, on edits, we dirty-diff the invalid attribute text.
6480 !! test
6481 Invalid text in table attributes should be discarded
6482 !! options
6483 parsoid=wt2html
6484 !! wikitext
6485 {| <span>boo</span> style='border:1px solid black'
6486 | <span>boo</span> style='color:blue' | 1
6487 |<span>boo</span> style='color:blue'| 2
6488 |}
6489 !! html/php
6490 <table style="border:1px solid black">
6491 <tr>
6492 <td style="color:blue"> 1
6493 </td>
6494 <td style="color:blue"> 2
6495 </td></tr></table>
6496
6497 !! html/parsoid
6498 <table style="border:1px solid black">
6499 <tr>
6500 <td style="color:blue"> 1</td>
6501 <td style="color:blue"> 2</td>
6502 </tr>
6503 </table>
6504 !! end
6505
6506 !! test
6507 Invalid text in table attributes should be preserved by selective serializer
6508 !! options
6509 parsoid={
6510 "modes": ["selser"],
6511 "changes": [
6512 ["td:first-child", "text", "abc"],
6513 ["td + td", "text", "xyz"]
6514 ]
6515 }
6516 !! wikitext
6517 {| <span>boo</span> style='border:1px solid black'
6518 | <span>boo</span> style='color:blue' | 1
6519 |<span>boo</span> style='color:blue'| 2
6520 |}
6521 !! wikitext/edited
6522 {| <span>boo</span> style='border:1px solid black'
6523 | <span>boo</span> style='color:blue' |abc
6524 |<span>boo</span> style='color:blue'|xyz
6525 |}
6526 !! end
6527
6528 !! test
6529 1. Template-generated table cell attributes and cell content
6530 !! wikitext
6531 {|
6532 |{{table_attribs}}
6533 | {{table_attribs}}
6534 || {{table_attribs_5}}
6535 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6536 |align=center {{table_attribs}}
6537 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6538 |}
6539 !! html
6540 <table>
6541 <tr>
6542 <td style="color:red;">Foo
6543 </td>
6544 <td style="color:red;">Foo
6545 </td>
6546 <td> style="color:red;"</td>
6547 <td>Bar
6548 </td>
6549 <td style="color:red;">Foo
6550 </td>
6551 <td align="center" style="color:red;">Foo
6552 </td>
6553 <td align="center" style="color:red;">Foo
6554 </td></tr></table>
6555
6556 !! end
6557
6558 !! test
6559 2. Template-generated table cell attributes and cell content
6560 !! wikitext
6561 {|
6562 |{{table_attribs_2}}
6563 |}
6564 !! html/php
6565 <table>
6566 <tr>
6567 <td style="color:red;">Foo
6568 </td>
6569 <td>Bar</td>
6570 <td>Baz
6571 </td></tr></table>
6572
6573 !! html/parsoid
6574 <table>
6575 <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>
6576 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6577 </tbody></table>
6578 !! end
6579
6580 !! test
6581 3. Template-generated table cell attributes and cell content
6582 !! wikitext
6583 {|
6584 !align=center {{table_header_cells}}
6585 |-
6586 |align=center {{table_cells}}
6587 |}
6588 !! html/php
6589 <table>
6590 <tr>
6591 <th align="center" style="color:red;">Foo</th>
6592 <th style="color:red;"><i>Bar</i></th>
6593 <th style="color:brown;"><i>Foo</i> and Baz
6594 </th></tr>
6595 <tr>
6596 <td align="center" style="color:red;">Foo</td>
6597 <td style="color:red;"><i>Bar</i></td>
6598 <td style="color:brown;"><i>Foo</i> and Baz
6599 </td></tr></table>
6600
6601 !! html/parsoid
6602 <table>
6603 <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>
6604 <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>
6605 </tbody></table>
6606 !! end
6607
6608 !! test
6609 4. Template-generated table cell attributes and cell content inside a templated table
6610 !! wikitext
6611 {{tbl-start}}
6612 !align=center {{table_header_cells}}
6613 |-
6614 |align=center {{table_cells}}
6615 {{tbl-end}}
6616 !! html/php
6617 <table>
6618 <tr>
6619 <th align="center" style="color:red;">Foo</th>
6620 <th style="color:red;"><i>Bar</i></th>
6621 <th style="color:brown;"><i>Foo</i> and Baz
6622 </th></tr>
6623 <tr>
6624 <td align="center" style="color:red;">Foo</td>
6625 <td style="color:red;"><i>Bar</i></td>
6626 <td style="color:brown;"><i>Foo</i> and Baz
6627 </td></tr></table>
6628
6629 !! html/parsoid
6630 <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}}]}'>
6631 <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>
6632 <tr>
6633 <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>
6634 </tbody></table>
6635 !! end
6636
6637 ## Edge case fix to prevent future regressions
6638 !! test
6639 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6640 !! wikitext
6641 {|
6642 |{{table_attribs_7}}
6643 |}
6644 <references />
6645 !! html/parsoid
6646 <table>
6647 <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>
6648 </tbody></table>
6649 <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>
6650 !! end
6651
6652 !! test
6653 Table with row followed by newlines and table heading
6654 !! options
6655 parsoid=wt2html,html2html
6656 !! wikitext
6657 {|
6658 |-
6659
6660 ! foo
6661 |}
6662 !! html/*
6663 <table>
6664
6665
6666 <tr>
6667 <th> foo
6668 </th></tr></table>
6669
6670 !! end
6671
6672 !! test
6673 Table with empty line following the start tag
6674 !! options
6675 parsoid=wt2html,html2html
6676 !! wikitext
6677 {|
6678
6679 |-
6680 | foo
6681 |}
6682 !! html/*
6683 <table>
6684
6685
6686 <tr>
6687 <td> foo
6688 </td></tr></table>
6689
6690 !! end
6691
6692 !! test
6693 Table attributes with empty value
6694 !! options
6695 parsoid=wt2html,html2html
6696 !! wikitext
6697 {|
6698 | style=| hello
6699 |}
6700 !! html/php
6701 <table>
6702 <tr>
6703 <td style=""> hello
6704 </td></tr></table>
6705
6706 !! html/parsoid
6707 <table>
6708 <tbody><tr><td style=""> hello</td></tr>
6709 </tbody></table>
6710 !! end
6711
6712 !! test
6713 Wikitext table with a lot of comments
6714 !! wikitext
6715 {|
6716 <!-- c0 -->
6717 | foo
6718 <!-- c1 -->
6719 |-<!-- c2 -->
6720 <!-- c3 -->
6721 |<!-- c4 -->
6722 <!-- c5 -->
6723 |}
6724 !! html
6725 <table>
6726 <tr>
6727 <td> foo
6728 </td></tr>
6729 <tr>
6730 <td>
6731 </td></tr></table>
6732
6733 !! end
6734
6735 !! test
6736 Wikitext table comments represented in parsoid dom
6737 !! wikitext
6738 {|<!--c1--><!--c2-->
6739 |-<!--c3-->
6740 | x
6741 |}
6742 !! html/php+tidy
6743 <table>
6744 <tr>
6745 <td>x</td>
6746 </tr>
6747 </table>
6748 !! html/parsoid
6749 <table><!--c1--><!--c2-->
6750 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6751 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6752 </tbody></table>
6753 !! end
6754
6755 !! test
6756 Wikitext table with double-line table cell
6757 !! wikitext
6758 {|
6759 |a
6760 b
6761 |}
6762 !! html
6763 <table>
6764 <tr>
6765 <td>a
6766 <p>b
6767 </p>
6768 </td></tr></table>
6769
6770 !! end
6771
6772 !! test
6773 Table cell with a single comment
6774 !! wikitext
6775 {|
6776 | <!-- c1 -->
6777 | a
6778 |}
6779 !! html
6780 <table>
6781 <tr>
6782 <td>
6783 </td>
6784 <td> a
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Table-cell after a comment-only-empty-line
6791 !! wikitext
6792 {|
6793 |a
6794 <!--c1-->
6795 <!--c2-->| b
6796 |}
6797 !! html
6798 <table>
6799 <tr>
6800 <td>a
6801 </td>
6802 <td> b
6803 </td></tr></table>
6804
6805 !! html/parsoid
6806 <table>
6807 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6808 <!--c1-->
6809 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6810 </tbody></table>
6811
6812 !! end
6813
6814 !! test
6815 Build table with {{!}}
6816 !! wikitext
6817 {{{!}} class="wikitable"
6818 ! header
6819 ! second header
6820 {{!}}- style="color:red;"
6821 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6822 {{!}}}
6823 !! html
6824 <table class="wikitable">
6825 <tr>
6826 <th> header
6827 </th>
6828 <th> second header
6829 </th></tr>
6830 <tr style="color:red;">
6831 <td> data </td>
6832 <td style="color:red;"> second data
6833 </td></tr></table>
6834
6835 !! end
6836
6837 !! test
6838 Build table with pipe as data
6839 !! wikitext
6840 {| class="wikitable"
6841 ! header
6842 ! second header
6843 |- style="color:red;"
6844 | data || style="color:red;" | second data
6845 |-
6846 | style="color:red;" | data with | || style="color:red;" | second data with |
6847 |-
6848 || data with | ||| second data with |
6849 |}
6850 !! html
6851 <table class="wikitable">
6852 <tr>
6853 <th> header
6854 </th>
6855 <th> second header
6856 </th></tr>
6857 <tr style="color:red;">
6858 <td> data </td>
6859 <td style="color:red;"> second data
6860 </td></tr>
6861 <tr>
6862 <td style="color:red;"> data with | </td>
6863 <td style="color:red;"> second data with |
6864 </td></tr>
6865 <tr>
6866 <td> data with | </td>
6867 <td> second data with |
6868 </td></tr></table>
6869
6870 !! end
6871
6872 !! test
6873 Build table with wikilink
6874 !! wikitext
6875 {| class="wikitable"
6876 ! header || second header
6877 |- style="color:red;"
6878 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6879 |-
6880 | data || second data [[Main Page|link|text with pipe]]
6881 |}
6882 !! html
6883 <table class="wikitable">
6884 <tr>
6885 <th> header </th>
6886 <th> second header
6887 </th></tr>
6888 <tr style="color:red;">
6889 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6890 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6891 </td></tr>
6892 <tr>
6893 <td> data </td>
6894 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6895 </td></tr></table>
6896
6897 !! end
6898
6899 # The expected HTML structure in this test is debatable. The PHP parser does
6900 # not parse this kind of table at all. The main focus for Parsoid is on
6901 # round-tripping, so this output is ok for now. TODO: revisit!
6902 !! test
6903 Wikitext table with html-syntax row
6904 !! wikitext
6905 {|
6906 |-
6907 <td>foo</td>
6908 |}
6909 !! html/parsoid
6910 <table>
6911 <tbody>
6912 <tr>
6913 <td>foo</td></tr></tbody></table>
6914 !! end
6915
6916 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6917 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6918 ## PHP parser, which tidy then compounds by fostering the content
6919 ## entirely out of the table. Parsoid recognizes the table context
6920 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6921 ## depends on PHP's treatment of broken table markup!
6922 !! test
6923 Implicit <td> after a |-
6924 !! options
6925 parsoid=wt2html,html2html
6926 !! wikitext
6927 {|
6928 |-
6929 a
6930 |}
6931 !! html/php
6932 <table>
6933
6934 a
6935 </table>
6936
6937 !! html/php+tidy
6938 <p>a</p>
6939 !! html/parsoid
6940 <table>
6941 <tr><td>a</td></tr>
6942 </table>
6943 !! end
6944
6945 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6946 !! test
6947 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6948 !! options
6949 parsoid=wt2html,html2html
6950 !! wikitext
6951 {|
6952 |-
6953 |
6954 a
6955 |-
6956 b
6957 |}
6958 !! html/php
6959 <table>
6960
6961 <tr>
6962 <td>
6963 <pre>a
6964 </pre>
6965 </td></tr>
6966 b
6967 </table>
6968
6969 !! html/php+tidy
6970 <p>b</p>
6971 <table>
6972 <tr>
6973 <td>
6974 <pre>
6975 a
6976 </pre></td>
6977 </tr>
6978 </table>
6979 !! html/parsoid
6980 <table>
6981 <tbody>
6982 <tr><td><pre>a</pre></td></tr>
6983 <tr><td> b</td></tr>
6984 </tbody>
6985 </table>
6986 !! end
6987
6988 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6989 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6990 !! test
6991 Lists should be recognized in an implicit <td> context
6992 !! options
6993 parsoid=wt2html,html2html
6994 !! wikitext
6995 {|
6996 |-
6997 *a
6998 |}
6999 !! html/php
7000 <table>
7001
7002 <ul><li>a</li></ul>
7003 </table>
7004
7005 !! html/php+tidy
7006 <ul>
7007 <li>a</li>
7008 </ul>
7009 !! html/parsoid
7010 <table>
7011 <tr>
7012 <td><ul>
7013 <li>a</li>
7014 </ul></td>
7015 </tr>
7016 </table>
7017 !! end
7018
7019 !! test
7020 Table cells not properly parsed in an implicit-td context
7021 !! wikitext
7022 {|
7023 |-
7024 {{table_attribs_4}} || a || b
7025 |}
7026 !! html/php+tidy
7027 <table>
7028 <tr>
7029 <td style="background-color:#DC241f;" width="10px"></td>
7030 <td>a</td>
7031 <td>b</td>
7032 </tr>
7033 </table>
7034 !! html/parsoid
7035 <table>
7036 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7037 <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>
7038 </tbody></table>
7039 !! end
7040
7041 !! test
7042 Parsoid: Round-trip tables directly followed by content (bug 51219)
7043 !! options
7044 parsoid=wt2html,wt2wt
7045 !! wikitext
7046 {|
7047 |foo
7048 |} bar
7049
7050 {|
7051 |baz
7052 |}<b>quux</b>
7053 !! html+tidy
7054 <table>
7055 <tr>
7056 <td>foo</td>
7057 </tr>
7058 </table>
7059 <p>bar</p>
7060 <table>
7061 <tr>
7062 <td>baz</td>
7063 </tr>
7064 </table>
7065 <p><b>quux</b></p>
7066 !! end
7067
7068 !! test
7069 Parsoid: Default to a newline after tables in new content (bug 51219)
7070 !! options
7071 parsoid=html2wt
7072 !! html/parsoid
7073 <table><tbody>
7074 <tr><td>foo</td></tr></tbody></table> bar
7075 <table><tbody>
7076 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7077 !! wikitext
7078 {|
7079 |foo
7080 |}
7081 <nowiki> </nowiki>bar
7082 {|
7083 |baz
7084 |}
7085 '''quux'''
7086 !! end
7087
7088 !! test
7089 Parsoid: newline inducing block nodes don't suppress <nowiki>
7090 !! options
7091 parsoid=html2wt
7092 !! html/parsoid
7093 a<h1>foo</h1>
7094 !! wikitext
7095 <nowiki> </nowiki>a
7096
7097 = foo =
7098 !! end
7099
7100 !! test
7101 Parsoid: Row-syntax table headings followed by comment & table cells
7102 !! options
7103 parsoid=wt2html,wt2wt
7104 !! wikitext
7105 {|
7106 ! foo || bar
7107 <!-- foo --> || baz || quux
7108 |}
7109 !! html/php
7110 <table>
7111 <tr>
7112 <th> foo </th>
7113 <th> bar
7114 </th>
7115 <td> baz </td>
7116 <td> quux
7117 </td></tr></table>
7118
7119 !! html/parsoid
7120 <table>
7121 <tbody><tr><th> foo </th><th> bar
7122 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7123 </tbody></table>
7124 !! end
7125
7126 !!test
7127 Parsoid: Recover better from broken table attributes
7128 !!options
7129 parsoid=wt2html
7130 !!wikitext
7131 {| class="foo
7132 | class="bar" |
7133 foo
7134 |}
7135 !!html/php+tidy
7136 <table class="foo">
7137 <tr>
7138 <td class="bar">
7139 <p>foo</p>
7140 </td>
7141 </tr>
7142 </table>
7143 !!html/parsoid
7144 <table class="foo">
7145 <tr>
7146 <td class="bar">
7147 <p>foo</p></td></tr>
7148 </tbody></table>
7149 !!end
7150
7151 !! test
7152 Tables: Digest broken attributes on table and tr tag
7153 !! options
7154 parsoid=wt2html
7155 !! wikitext
7156 {| || |} ++
7157 |- || || ++ --
7158 |- > [
7159 |}
7160 !! html
7161 <table>
7162 <tbody>
7163 <tr></tr>
7164 <tr></tr>
7165 </tbody></table>
7166 !! end
7167
7168 # T137406: Whitespace in the HTML
7169 !! test
7170 1. Generate correct wikitext for tables with thead/tbody/tfoot
7171 !! options
7172 parsoid=html2wt
7173 !! html/parsoid
7174 <table>
7175 <caption>Test</caption>
7176 <thead>
7177 <tr>
7178 <th>Month</th>
7179 <th>Savings</th>
7180 </tr>
7181 </thead>
7182 <tbody>
7183 <tr>
7184 <td>January</td>
7185 <td>$100</td>
7186 </tr>
7187 <tr>
7188 <td>February</td>
7189 <td>$80</td>
7190 </tr>
7191 </tbody>
7192 <tfoot>
7193 <tr>
7194 <td>Sum</td>
7195 <td>$180</td>
7196 </tr>
7197 </tfoot>
7198 </table>
7199 !! wikitext
7200 {|
7201 |+Test
7202 !Month
7203 !Savings
7204 |-
7205 |January
7206 |$100
7207 |-
7208 |February
7209 |$80
7210 |-
7211 |Sum
7212 |$180
7213 |}
7214 !! html/php+tidy
7215 <table>
7216 <caption>Test</caption>
7217 <tr>
7218 <th>Month</th>
7219 <th>Savings</th>
7220 </tr>
7221 <tr>
7222 <td>January</td>
7223 <td>$100</td>
7224 </tr>
7225 <tr>
7226 <td>February</td>
7227 <td>$80</td>
7228 </tr>
7229 <tr>
7230 <td>Sum</td>
7231 <td>$180</td>
7232 </tr>
7233 </table>
7234 !! end
7235
7236 # T137406: No whitespace in the HTML
7237 !! test
7238 2. Generate correct wikitext for tables with thead/tbody/tfoot
7239 !! options
7240 parsoid=html2wt
7241 !! html/parsoid
7242 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7243 !! wikitext
7244 {|
7245 !heading
7246 |-
7247 |foo
7248 |}
7249 !! end
7250
7251 !! test
7252 Testing serialization after deletion in references
7253 !! options
7254 parsoid={
7255 "modes": ["wt2wt"],
7256 "changes": [
7257 ["#x", "remove"]
7258 ]
7259 }
7260 !! wikitext
7261 hi <ref><div id="x">ho</div></ref>
7262
7263 <references />
7264 !! wikitext/edited
7265 hi <ref></ref>
7266
7267 <references />
7268 !! end
7269
7270 !!test
7271 Testing serialization after deletion of table cells
7272 !!options
7273 parsoid={
7274 "modes": ["wt2wt", "selser"],
7275 "changes": [
7276 ["#x", "remove"]
7277 ]
7278 }
7279 !!wikitext
7280 {|
7281 !h1 !!h2 !!h3
7282 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7283 |}
7284 !! wikitext/edited
7285 {|
7286 !h1 !!h2 !!h3
7287 |c2 |||c3
7288 |}
7289 !!end
7290
7291 !! test
7292 Testing selser after addition of new row before first row (T125419)
7293 !! options
7294 parsoid={
7295 "modes": ["wt2wt", "selser"],
7296 "changes": [
7297 [ "tr", "before", "<tr><td>X</td></tr>" ]
7298 ]
7299 }
7300 !! wikitext
7301 {|
7302 |a
7303 |}
7304 !! wikitext/edited
7305 {|
7306 |X
7307 |-
7308 |a
7309 |}
7310 !! end
7311
7312 !! test
7313 Serialize new table rows in a HTML table using HTML tags
7314 !! options
7315 parsoid={
7316 "modes": ["wt2wt", "selser"],
7317 "changes": [
7318 [ "tr", "before", "<tr><td>X</td></tr>" ]
7319 ]
7320 }
7321 !! wikitext
7322 <table><tr><td>a</td></tr></table>
7323 !! wikitext/edited
7324 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7325 !! end
7326
7327 !! test
7328 Serialize new table cells in a HTML row using HTML tags
7329 !! options
7330 parsoid={
7331 "modes": ["wt2wt", "selser"],
7332 "changes": [
7333 [ "td", "before", "<td>X</td>" ]
7334 ]
7335 }
7336 !! wikitext
7337 <table><tr><td>a</td></tr></table>
7338 !! wikitext/edited
7339 <table><tr><td>X</td><td>a</td></tr></table>
7340 !! end
7341
7342 !! test
7343 Wikitext tables can be nested inside HTML tables
7344 !! options
7345 parsoid=html2wt
7346 !! html
7347 <table data-parsoid='{"stx":"html"}'>
7348 <tr><td>
7349 <table>
7350 <tr><td>foo</td></tr>
7351 </table>
7352 </td></tr>
7353 </table>
7354 !! wikitext
7355 <table>
7356 <tr><td>
7357 {|
7358 |foo
7359 |}
7360 </td></tr>
7361 </table>
7362 !! end
7363
7364 !! test
7365 Serialize wikitext list items as HTML list items when embedded in a HTML list
7366 !! options
7367 parsoid=html2wt
7368 !! html
7369 <ul data-parsoid='{"stx": "html"}'>
7370 <li data-parsoid='{}'>a</li>
7371 <li>b</li>
7372 </ul>
7373 !! wikitext
7374 <ul>
7375 <li>a</li>
7376 <li>b</li>
7377 </ul>
7378 !! end
7379
7380 # SSS FIXME: Is this actually a good thing given the
7381 # odd nested list output that is generated by MW?
7382 # <ul><li>foo<ul>..</ul></li></ul> instead of
7383 # <ul><li>foo</li><ul>..</ul></ul>
7384 !! test
7385 Wikitext lists can be nested inside HTML lists
7386 !! options
7387 parsoid=html2wt
7388 !! html
7389 <ul data-parsoid='{"stx": "html"}'>
7390 <li data-parsoid='{"stx": "html"}'>a
7391 <ul><li>b</li></ul>
7392 </li>
7393 </ul>
7394
7395 <ul data-parsoid='{"stx": "html"}'>
7396 <li>x
7397 <ul><li>y</li></ul>
7398 </li>
7399 </ul>
7400 !! wikitext
7401 <ul>
7402 <li>a
7403 * b
7404 </li>
7405 </ul>
7406
7407 <ul>
7408 <li>x
7409 * y
7410 </li>
7411 </ul>
7412 !! end
7413
7414 ###
7415 ### Internal links
7416 ###
7417 !! test
7418 Plain link, capitalized
7419 !! wikitext
7420 [[Main Page]]
7421 !! html
7422 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7423 </p>
7424 !! end
7425
7426 !! test
7427 Plain link, uncapitalized
7428 !! wikitext
7429 [[main Page]]
7430 !! html
7431 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7432 </p>
7433 !! end
7434
7435 !! test
7436 Piped link
7437 !! wikitext
7438 [[Main Page|The Main Page]]
7439 !! html
7440 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7441 </p>
7442 !! end
7443
7444 !! test
7445 Piped link with comment in link text
7446 !! wikitext
7447 [[Main Page|The Main<!--front--> Page]]
7448 !! html
7449 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7450 </p>
7451 !! end
7452
7453 !! test
7454 Piped link with multiple pipe characters in link text
7455 !! wikitext
7456 [[Main Page||The|Main|Page|]]
7457 !! html/php
7458 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7459 </p>
7460 !! html/parsoid
7461 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7462 !! end
7463
7464 !! test
7465 Piped link with no link text
7466 !! wikitext
7467 [[Thomas Bek (bishop of St David's)|]]
7468 !! html/php
7469 <p>[[Thomas Bek (bishop of St David's)|]]
7470 </p>
7471 !! html/parsoid
7472 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7473 !! end
7474
7475 !! test
7476 Piped link with empty link text
7477 !! wikitext
7478 [[Main Page|<nowiki />]] - empty nowiki
7479 [[Main Page| ]] - empty space
7480 [[Main Page|&nbsp;]] - empty non breaking space
7481 !! html/php
7482 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7483 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7484 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7485 </p>
7486 !! html/parsoid
7487 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7488 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7489 <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>
7490 !! end
7491
7492 !! test
7493 Broken link
7494 !! wikitext
7495 [[Zigzagzogzagzig]]
7496 !! html
7497 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7498 </p>
7499 !! end
7500
7501 !! test
7502 Broken link with fragment
7503 !! wikitext
7504 [[Zigzagzogzagzig#zug]]
7505 !! html
7506 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7507 </p>
7508 !! end
7509
7510 !! test
7511 Special page link with fragment
7512 !! wikitext
7513 [[Special:Version#anchor]]
7514 !! html
7515 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7516 </p>
7517 !! end
7518
7519 !! test
7520 Nonexistent special page link with fragment
7521 !! wikitext
7522 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7523 !! html
7524 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7525 </p>
7526 !! end
7527
7528 !! test
7529 Link with prefix
7530 !! wikitext
7531 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7532 !! html
7533 <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>
7534 </p>
7535 !! end
7536
7537 !! test
7538 Link with suffix
7539 !! wikitext
7540 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7541 !! html
7542 <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>!!!
7543 </p>
7544 !! end
7545
7546 !! article
7547 prefixed article
7548 !! text
7549 Some text
7550 !! endarticle
7551
7552 !! test
7553 Bug 43661: Piped links with identical prefixes
7554 !! wikitext
7555 [[prefixed article|prefixed articles with spaces]]
7556
7557 [[prefixed article|prefixed articlesaoeu]]
7558
7559 [[Main Page|Main Page test]]
7560 !! html
7561 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7562 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7563 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7564 </p>
7565 !! end
7566
7567
7568 !! test
7569 Link with HTML entity in suffix / tail
7570 !! wikitext
7571 [[Main Page]]&quot;, [[Main Page]]&#97;
7572 !! html/php
7573 <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;
7574 </p>
7575 !! html/parsoid
7576 <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>
7577 !! end
7578
7579 !! test
7580 Link with 3 brackets
7581 !! wikitext
7582 [[[Main Page]]]
7583 Foo [[[Main Page]]]
7584 !! html
7585 <p>[[[Main Page]]]
7586 Foo [[[Main Page]]]
7587 </p>
7588 !! end
7589
7590 !! test
7591 Link with 4 brackets
7592 !! wikitext
7593 [[[[Main Page]]]]
7594 !! html
7595 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7596 </p>
7597 !! end
7598
7599 !! test
7600 Piped link with 3 brackets
7601 !! wikitext
7602 [[[main page|the main page]]]
7603 !! html
7604 <p>[[[main page|the main page]]]
7605 </p>
7606 !! end
7607
7608 !! test
7609 Piped link with extlink-like text
7610 !! wikitext
7611 [[Main Page|[bar]]]
7612 [[Main Page|This is a [bar]]]
7613 !! html/php
7614 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7615 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7616 </p>
7617 !! html/parsoid
7618 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7619 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7620 !! end
7621
7622 !! test
7623 Link with multiple pipes
7624 !! wikitext
7625 [[Main Page|The|Main|Page]]
7626 !! html
7627 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7628 </p>
7629 !! end
7630
7631 !! test
7632 Anchor containing a #. (bug 63430)
7633 !! wikitext
7634 [[Main Page#And#Link]]
7635 !! html/php
7636 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7637 </p>
7638 !! html/parsoid
7639 <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>
7640 !! end
7641
7642 !! test
7643 Link to namespaces
7644 !! wikitext
7645 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7646 !! html
7647 <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>
7648 </p>
7649 !! end
7650
7651 !! test
7652 Link with space in namespace
7653 !! wikitext
7654 [[User talk:Foo bar]]
7655 !! html
7656 <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>
7657 </p>
7658 !! end
7659
7660 !! article
7661 MemoryAlpha:AlphaTest
7662 !! text
7663 This is an article in the MemoryAlpha namespace
7664 (which shadows the memoryalpha interwiki link).
7665 !! endarticle
7666
7667 !! test
7668 Namespace takes precedence over interwiki link (bug 51680)
7669 !! wikitext
7670 [[MemoryAlpha:AlphaTest]]
7671 !! html
7672 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7673 </p>
7674 !! end
7675
7676 # The previous test doesn't work correctly in html2*, due to not recognizing the
7677 # link as an internal one. This one checks for the correct behavior.
7678 !! test
7679 Link to namespace preferred over interwiki with correct rel attribute
7680 !! options
7681 parsoid=html2wt,html2html
7682 !! html/parsoid
7683 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7684 !! wikitext
7685 [[MemoryAlpha:AlphaTest]]
7686 !! end
7687
7688 !! test
7689 Piped link to namespace
7690 !! wikitext
7691 [[Meta:Disclaimers|The disclaimers]]
7692 !! html
7693 <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>
7694 </p>
7695 !! end
7696
7697 !! test
7698 Link containing }
7699 !! wikitext
7700 [[Usually caused by a typo (oops}]]
7701 !! html
7702 <p>[[Usually caused by a typo (oops}]]
7703 </p>
7704 !! end
7705
7706 !! article
7707 7% Solution
7708 !! text
7709 Just a test of an article title containing a percent.
7710 !! endarticle
7711
7712 !! test
7713 Link containing % (not as a hex sequence)
7714 !! wikitext
7715 [[7% Solution]]
7716 [[7% Solution|7%25 Solution]]
7717 !! html/php
7718 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7719 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7720 </p>
7721 !! html/parsoid
7722 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7723 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7724 !! end
7725
7726 # note that the parsoid HTML is identical to the previous test output,
7727 # so the previous test ensures that the html2wt mode will generate the
7728 # "not as a hex sequence" wikitext.
7729 !! test
7730 Link containing % as a single hex sequence interpreted to char
7731 !! options
7732 parsoid=wt2wt,wt2html,html2html
7733 !! wikitext
7734 [[7%25 Solution]]
7735 [[7%25 Solution|7%25 Solution]]
7736 !! html/php
7737 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7738 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7739 </p>
7740 !! html/parsoid
7741 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7742 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7743 !!end
7744
7745 !! test
7746 Link containing % as a double hex sequence interpreted to hex sequence
7747 !! wikitext
7748 [[7%2525 Solution]]
7749 !! html
7750 <p>[[7%2525 Solution]]
7751 </p>
7752 !!end
7753
7754 ## Example for such a section: == < ==
7755 !! test
7756 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7757 !! wikitext
7758 [[%23%3c]][[%23%3e]]
7759 !! html/php
7760 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7761 </p>
7762 !! html/parsoid
7763 <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>
7764 !! end
7765
7766 !! test
7767 Link containing "<#" and ">#" as a hex sequences
7768 !! wikitext
7769 [[%3c%23]][[%3e%23]]
7770 !! html
7771 <p>[[%3c%23]][[%3e%23]]
7772 </p>
7773 !! end
7774
7775 !! test
7776 Link containing an equals sign
7777 !! wikitext
7778 [[Special:BookSources/isbn=4-00-026157-6]]
7779 !! html/php
7780 <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>
7781 </p>
7782 !! html/parsoid
7783 <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>
7784 !! end
7785
7786 !! article
7787 Foo~bar
7788 !! text
7789 Just a test of an article title containing a tilde.
7790 !! endarticle
7791
7792 # note that links containing signatures, like [[Foo~~~~]], are
7793 # massaged by the pre-save transform (PST) and so the tildes are never
7794 # seen by the parser.
7795 !! test
7796 Link containing a tilde
7797 !! wikitext
7798 [[Foo~bar]]
7799 !! html/php
7800 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7801 </p>
7802 !! html/parsoid
7803 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7804 !! end
7805
7806 !! test
7807 Link containing double-single-quotes '' (bug 4598)
7808 !! wikitext
7809 [[Lista d''e paise d''o munno]]
7810 !! html/php
7811 <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>
7812 </p>
7813 !! html/parsoid
7814 <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>
7815 !! end
7816
7817 !! test
7818 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7819 !! wikitext
7820 Some [[Link|pretty ''italics'' and stuff]]!
7821 !! html/php
7822 <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>!
7823 </p>
7824 !! html/parsoid
7825 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7826 !! end
7827
7828 !! test
7829 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7830 !! wikitext
7831 ''Some [[Link|pretty ''italics'' and stuff]]!''
7832 !! html
7833 <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>
7834 </p>
7835 !! end
7836
7837 !! test
7838 Link with double quotes in title part (literal) and alternate part (interpreted)
7839 !! wikitext
7840 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7841
7842 [[''Pentecoste'']]
7843
7844 [[''Pentecoste''|Pentecoste]]
7845
7846 [[''Pentecoste''|''Pentecoste'']]
7847 !! html/php
7848 <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>
7849 </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>
7850 </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>
7851 </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>
7852 </p>
7853 !! html/parsoid
7854 <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>
7855 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7856 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7857 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7858 !! end
7859
7860 !! test
7861 Broken image links with HTML captions (bug 39700)
7862 !! wikitext
7863 [[File:Nonexistent|<script></script>]]
7864 [[File:Nonexistent|100x100px|<script></script>]]
7865 [[File:Nonexistent|&lt;]]
7866 [[File:Nonexistent|a<i>b</i>c]]
7867 !! html/php
7868 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7869 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7870 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7871 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7872 </p>
7873 !! html/parsoid
7874 <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>
7875 <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>
7876 <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>
7877 <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>
7878 !! end
7879
7880 !! test
7881 Plain link to URL
7882 !! wikitext
7883 [[http://www.example.com]]
7884 !! html/php
7885 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7886 </p>
7887 !! html/parsoid
7888 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7889 !! end
7890
7891 !! test
7892 Plain link to URL with link text
7893 !! wikitext
7894 [[http://www.example.com Link text]]
7895 !! html
7896 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7897 </p>
7898 !! end
7899
7900 !! test
7901 Plain link to protocol-relative URL
7902 !! wikitext
7903 [[//www.example.com]]
7904 !! html/php
7905 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7906 </p>
7907 !! html/parsoid
7908 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7909 !! end
7910
7911 !! test
7912 Plain link to protocol-relative URL with link text
7913 !! wikitext
7914 [[//www.example.com Link text]]
7915 !! html
7916 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7917 </p>
7918 !! end
7919
7920 !! test
7921 Plain link to page with question mark in title
7922 !! wikitext
7923 [[A?b]]
7924
7925 [[A?b|Baz]]
7926 !! html
7927 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7928 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7929 </p>
7930 !! end
7931
7932
7933 # I'm fairly sure the expected result here is wrong.
7934 # We want these to be URL links, not pseudo-pages with URLs for titles....
7935 # However the current output is also pretty screwy.
7936 #
7937 # ----
7938 # I'm changing it to match the current output--it arguably makes more
7939 # sense in the light of the test above. Old expected result was:
7940 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7941 #</p>
7942 # But I think this test is bordering on "garbage in, garbage out" anyway.
7943 # -- wtm
7944 !! test
7945 Piped link to URL
7946 !! wikitext
7947 Piped link to URL: [[http://www.example.com|an example URL]]
7948 !! html/php
7949 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7950 </p>
7951 !! html/parsoid
7952 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7953 !! end
7954
7955 !! test
7956 BUG 2: [[page|http://url/]] should link to page, not http://url/
7957 !! wikitext
7958 [[Main Page|http://url/]]
7959 !! html/php
7960 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7961 </p>
7962 !! html/parsoid
7963 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7964 !! end
7965
7966 # Parsoid does not mark self-links, by design.
7967 !! test
7968 BUG 337: Escaped self-links should be bold
7969 !! options
7970 title=[[Bug462]]
7971 !! wikitext
7972 [[Bu&#103;462]] [[Bug462]]
7973 !! html/php
7974 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7975 </p>
7976 !! html/php+tidy
7977 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7978 !! html/parsoid
7979 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7980 !! end
7981
7982 !! test
7983 Self-link to section should not be bold
7984 !! options
7985 title=[[Main Page]]
7986 !! wikitext
7987 [[Main Page#section]]
7988 !! html
7989 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7990 </p>
7991 !! end
7992
7993 !! article
7994 00
7995 !! text
7996 This is 00.
7997 !! endarticle
7998
7999 !!test
8000 Self-link to numeric title
8001 !!options
8002 title=[[0]]
8003 !! wikitext
8004 [[0]]
8005 !! html
8006 <p><strong class="selflink">0</strong>
8007 </p>
8008 !!end
8009
8010 !!test
8011 Link to numeric-equivalent title
8012 !!options
8013 title=[[0]]
8014 !! wikitext
8015 [[00]]
8016 !! html
8017 <p><a href="/wiki/00" title="00">00</a>
8018 </p>
8019 !!end
8020
8021 !! test
8022 <nowiki> inside a link
8023 !! wikitext
8024 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8025 !! html
8026 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8027 </p>
8028 !! end
8029
8030 !! test
8031 Non-breaking spaces in title
8032 !! wikitext
8033 [[&nbsp; Main &nbsp; Page &nbsp;]]
8034 !! html
8035 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8036 </p>
8037 !!end
8038
8039 !! test
8040 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8041 !! options
8042 language=ca
8043 !! wikitext
8044 '''[[Main Page]]'''
8045 !! html
8046 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8047 </p>
8048 !! end
8049
8050 !! test
8051 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8052 !! options
8053 language=ca
8054 !! wikitext
8055 ''[[Main Page]]''
8056 !! html
8057 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8058 </p>
8059 !! end
8060
8061 !! test
8062 Internal link with en linktrail: no apostrophes (bug 27473)
8063 !! options
8064 language=en
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 (page does not exist)">Something</a>'nice
8069 </p>
8070 !! end
8071
8072 !! test
8073 Internal link with ca linktrail with apostrophes (bug 27473)
8074 !! options
8075 language=ca
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 (encara no existeix)">Something'nice</a>
8080 </p>
8081 !! end
8082
8083 !! test
8084 Internal link with kaa linktrail with apostrophes (bug 27473)
8085 !! options
8086 language=kaa
8087 !! wikitext
8088 [[Something]]'nice
8089 !! html
8090 <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>
8091 </p>
8092 !! end
8093
8094 !! test
8095 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8096 !! wikitext
8097 [[User:Foo/Test/63636:Bar|Test]]
8098 !! html/php
8099 <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>
8100 </p>
8101 !! html/parsoid
8102 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8103 !! end
8104
8105 ## Mainly a sanity check for Parsoid
8106 !! test
8107 Handle title parsing for subpages
8108 !! options
8109 title=[[/123123]]
8110 !! wikitext
8111 123
8112 !! html/parsoid
8113 <p>123</p>
8114 !! end
8115
8116 ## FIXME: Add a working php section here
8117 !! test
8118 Link to a subpage from a namespace other than main
8119 !! options
8120 title=[[User:test]]
8121 !! wikitext
8122 [[/123]]
8123 !! html/parsoid
8124 <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>
8125 !! end
8126
8127 !! test
8128 Ensure that transclusion titles are not url-decoded
8129 !! options
8130 subpage title=[[Test]]
8131 parsoid=wt2html
8132 !! wikitext
8133 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8134 !! html/php
8135 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8136 </p>
8137 !! html/parsoid
8138 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8139 !! end
8140
8141 !! test
8142 Purely hash wikilink
8143 !! options
8144 title=[[User:test/123]]
8145 !! wikitext
8146 [[#a|b]]
8147 !! html/php
8148 <p><a href="#a">b</a>
8149 </p>
8150 !! html/parsoid
8151 <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>
8152 !! end
8153
8154 !! test
8155 1. Interaction of linktrail and template encapsulation
8156 !! options
8157 parsoid
8158 !! wikitext
8159 {{echo|[[Foo]]}}l
8160 !! html
8161 <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>
8162 !! end
8163
8164 !! test
8165 2. Interaction of linktrail and template encapsulation
8166 !! options
8167 parsoid
8168 !! wikitext
8169 {{echo|Some [[Fool]]}}s
8170 !! html
8171 <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>
8172 !! end
8173
8174 !! test
8175 3. Interaction of linktrail and template encapsulation
8176 !! options
8177 parsoid
8178 !! wikitext
8179 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8180 !! html
8181 <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>
8182 !! end
8183
8184 !! article
8185 Söfnuður
8186 !! text
8187 Test.
8188 !! endarticle
8189
8190 !! test
8191 Internal link with is link prefix
8192 !! options
8193 language=is
8194 !! wikitext
8195 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8196 !! html
8197 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8198 </p>
8199 !! end
8200
8201 !! article
8202 Mótmælendatrú
8203 !! text
8204 Test.
8205 !! endarticle
8206
8207 !! test
8208 Internal link with is link trail and link prefix
8209 !! options
8210 language=is
8211 !! wikitext
8212 [[mótmælendatrú|xxx]]ar
8213 [[mótmælendatrú]]ar
8214 mótmælenda[[söfnuður]]
8215 mótmælenda[[söfnuður|söfnuðir]]
8216 mótmælenda[[söfnuður|söfnuðir]]xxx
8217 !! html
8218 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8219 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8220 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8221 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8222 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8223 </p>
8224 !! end
8225
8226 !! test
8227 Parsoid link trail escaping
8228 !! options
8229 parsoid=html2wt,html2html
8230 !! html/parsoid
8231 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8232 !! wikitext
8233 [[apple]]<nowiki/>s
8234 !! end
8235
8236 !! test
8237 Parsoid link prefix escaping
8238 !! options
8239 language=is
8240 parsoid=html2wt,html2html
8241 !! html/parsoid
8242 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8243 !! wikitext
8244 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8245 !! end
8246
8247 !! test
8248 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8249 !! wikitext
8250 [[Foo| bar]]
8251
8252 [[Foo| ''bar'']]
8253
8254 [http://wp.org foo]
8255
8256 [http://wp.org ''foo'']
8257 !! html
8258 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8259 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8260 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8261 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8262 </p>
8263 !! end
8264
8265 !! test
8266 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8267 !! options
8268 parsoid
8269 !! wikitext
8270 [[Foo|{{echo|a}} b {{echo|c}}]]
8271 !! html
8272 <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>
8273 !! end
8274
8275 !! test
8276 Link with angle bracket after anchor
8277 !! wikitext
8278 [[Foo#<bar>]]
8279 !! html/php
8280 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8281 </p>
8282 !! html/parsoid
8283 <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>
8284 !! end
8285
8286 ###
8287 ### Interwiki links (see maintenance/interwiki.sql)
8288 ###
8289
8290 !! test
8291 Inline interwiki link
8292 !! options
8293 parsoid=wt2html,wt2wt,html2html
8294 !! wikitext
8295 [[MeatBall:SoftSecurity]]
8296 !! html/php
8297 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8298 </p>
8299 !! html/parsoid
8300 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8301 !! end
8302
8303 !! test
8304 Inline interwiki link with empty title (bug 2372)
8305 !! options
8306 parsoid=wt2html,wt2wt,html2html
8307 !! wikitext
8308 [[MeatBall:]]
8309 !! html/php
8310 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8311 </p>
8312 !! html/parsoid
8313 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8314 !! end
8315
8316 !! test
8317 Interwiki link encoding conversion (bug 1636)
8318 !! wikitext
8319 *[[Wikipedia:ro:Olteni&#0355;a]]
8320 *[[Wikipedia:ro:Olteni&#355;a]]
8321 !! html
8322 <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>
8323 <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>
8324
8325 !! html+tidy
8326 <ul>
8327 <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>
8328 <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>
8329 </ul>
8330 !! end
8331
8332 !! test
8333 Interwiki link with fragment (bug 2130)
8334 !! wikitext
8335 [[MeatBall:SoftSecurity#foo]]
8336 !! html
8337 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8338 </p>
8339 !! end
8340
8341 !! test
8342 Link scenarios with escaped fragments
8343 !! wikitext
8344 [[#Is this great?]]
8345 [[Foo#Is this great?]]
8346 [[meatball:Foo#Is this great?]]
8347 !! html/php
8348 <p><a href="#Is_this_great.3F">#Is this great?</a>
8349 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8350 <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>
8351 </p>
8352 !! html/parsoid
8353 <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>
8354 <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>
8355 <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>
8356 !! end
8357
8358 # Ideally the wikipedia: prefix here should be proto-relative too
8359 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8360 # define the 'en' prefix, and originally the test used 'wikipedia',
8361 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8362 # article.
8363 !! test
8364 Different interwiki prefixes mapping to the same URL
8365 !! wikitext
8366 [[:en:Foo]]
8367
8368 [[:en:Foo|Foo]]
8369
8370 [[wikipedia:Foo]]
8371
8372 [[:wikipedia:Foo|Foo]]
8373
8374 [[wikipedia:en:Foo]]
8375
8376 [[:wikipedia:en:Foo]]
8377
8378 [[ wikiPEdia :Foo]]
8379 !! html/parsoid
8380 <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>
8381
8382 <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>
8383
8384 <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>
8385
8386 <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>
8387
8388 <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>
8389
8390 <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>
8391
8392 <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>
8393 !! end
8394
8395 !! test
8396 Interwiki links that cannot be represented in wiki syntax
8397 !! wikitext
8398 [[meatball:ok]]
8399 [[meatball:ok#foo|ok with fragment]]
8400 [[meatball:ok_as_well?|ok ending with ? mark]]
8401 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8402 [http://de.wikipedia.org/wiki/#foo is just fragment]
8403
8404 !! html/php
8405 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8406 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8407 <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>
8408 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8409 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8410 </p>
8411 !! html/parsoid
8412 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8413 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8414 <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>
8415 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8416 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8417 !! end
8418
8419 !! test
8420 Interwiki links: trail
8421 !! wikitext
8422 [[wikipedia:Foo|Ba]]r
8423 !! html/php
8424 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8425 </p>
8426 !! html/parsoid
8427 <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>
8428 !! end
8429
8430 !! test
8431 Local interwiki link
8432 !! options
8433 parsoid=wt2html,wt2wt,html2html
8434 !! wikitext
8435 [[local:Template:Foo]]
8436 !! html/php
8437 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8438 </p>
8439 !! html/parsoid
8440 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8441 !! end
8442
8443 # Parsoid does not mark self-links, by design.
8444 !! test
8445 Local interwiki link: self-link to current page
8446 !! options
8447 title=[[Main Page]]
8448 parsoid=wt2html,wt2wt,html2html
8449 !! wikitext
8450 [[local:Main Page]]
8451 !! html/php
8452 <p><strong class="selflink">local:Main Page</strong>
8453 </p>
8454 !! html/parsoid
8455 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8456 !! end
8457
8458 !! test
8459 Local interwiki link: prefix only (bug 64167)
8460 !! options
8461 parsoid=wt2html,wt2wt,html2html
8462 !! wikitext
8463 [[local:]]
8464 !! html/php
8465 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8466 </p>
8467 !! html/parsoid
8468 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8469 !! end
8470
8471 !! test
8472 Local interwiki link: with additional interwiki prefix (bug 61357)
8473 !! options
8474 parsoid=wt2html,wt2wt,html2html
8475 !! wikitext
8476 [[local:meatball:Hello]]
8477 !! html/php
8478 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8479 </p>
8480 !! html/parsoid
8481 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8482 !! end
8483
8484 !! test
8485 Multiple local interwiki link prefixes
8486 !! wikitext
8487 [[local:local:local:local:mi:local:Foo]]
8488 !! options
8489 parsoid=wt2html,wt2wt,html2html
8490 !! html/php
8491 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8492 </p>
8493 !! html/parsoid
8494 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8495 !! end
8496
8497 ###
8498 ### Interlanguage links
8499 ### Language links (so that searching for '### language' matches..)
8500 ###
8501
8502 !! test
8503 Interlanguage link
8504 !! wikitext
8505 Blah blah blah
8506 [[zh:Chinese]]
8507 !! html/php
8508 <p>Blah blah blah
8509 </p>
8510 !! html/parsoid
8511 <p>Blah blah blah</p>
8512 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8513 !! end
8514
8515 ## parsoid html2wt will lose the space variations
8516 !! test
8517 Interlanguage link with spacing
8518 !! options
8519 parsoid=wt2html,wt2wt,html2html
8520 !! wikitext
8521 Blah blah blah
8522 [[ zh : Chinese ]]
8523 !! html/php
8524 <p>Blah blah blah
8525 </p>
8526 !! html/parsoid
8527 <p>Blah blah blah</p>
8528 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8529 !! end
8530
8531 !! test
8532 Double interlanguage link
8533 !! wikitext
8534 Blah blah blah
8535 [[es:Spanish]]
8536 [[zh:Chinese]]
8537 !! html/php
8538 <p>Blah blah blah
8539 </p>
8540 !! html/parsoid
8541 <p>Blah blah blah</p>
8542 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8543 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8544 !! end
8545
8546 ## parsoid html2wt will lose the space variations
8547 !! test
8548 Interlanguage link variations
8549 !! options
8550 parsoid=wt2html,wt2wt,html2html
8551 !! wikitext
8552 Blah blah blah
8553 [[ es :Spanish]]
8554 [[ ZH :Chinese]]
8555 [[es:Foo_bar]]
8556 !! html/php
8557 <p>Blah blah blah
8558 </p>
8559 !! html/parsoid
8560 <p>Blah blah blah</p>
8561 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8562 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8563 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8564 !! end
8565
8566 ## parsoid html2wt will normalize the space to _
8567 !! test
8568 Space and question mark encoding in interlanguage links (T95473)
8569 !! options
8570 parsoid=wt2html,wt2wt,html2html
8571 !! wikitext
8572 Blah blah blah
8573 [[es:Foo bar?]]
8574 !! html/php
8575 <p>Blah blah blah
8576 </p>
8577 !! html/parsoid
8578 <p>Blah blah blah</p>
8579 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8580 !! end
8581
8582 !! test
8583 Interlanguage link, with prefix links
8584 !! options
8585 language=ln
8586 !! wikitext
8587 Blah blah blah
8588 [[zh:Chinese]]
8589 !! html/php
8590 <p>Blah blah blah
8591 </p>
8592 !! html/parsoid
8593 <p>Blah blah blah</p>
8594 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8595 !! end
8596
8597 !! test
8598 Double interlanguage link, with prefix links (bug 8897)
8599 !! options
8600 language=ln
8601 !! wikitext
8602 Blah blah blah
8603 [[es:Spanish]]
8604 [[zh:Chinese]]
8605 !! html/php
8606 <p>Blah blah blah
8607 </p>
8608 !! html/parsoid
8609 <p>Blah blah blah</p>
8610 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8611 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8612 !! end
8613
8614 !! test
8615 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8616 !! wikitext
8617 Blah blah blah
8618 [[mul:Article]]
8619 !! html/php
8620 <p>Blah blah blah
8621 </p>
8622 !! html/parsoid
8623 <p>Blah blah blah</p>
8624 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8625 !! end
8626
8627 ## PHP parser tests script needs an update
8628 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8629 !! test
8630 Language links render as inline links if $wgInterwikiMagic=false
8631 !! options
8632 wgInterwikiMagic=false
8633 parsoid=wt2html,wt2wt,html2html
8634 !! wikitext
8635 Blah blah blah
8636 [[zh:Chinese]]
8637 !! html/parsoid
8638 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8639 !! end
8640
8641 ## PHP parser tests script needs an update
8642 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8643 !! test
8644 Language links render as inline links in the Talk namespace
8645 !! options
8646 title=Talk:Foo
8647 parsoid=wt2html,wt2wt,html2html
8648 !! wikitext
8649 Blah blah blah
8650 [[zh:Chinese]]
8651 !! html/parsoid
8652 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8653 !! end
8654
8655 !! test
8656 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8657 !! options
8658 language=ln
8659 !! wikitext
8660 [[WW&nbsp;II]]
8661 !! html
8662 <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>
8663 </p>
8664 !! end
8665
8666 !! test
8667 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8668 !! options
8669 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8670 !! html/parsoid
8671 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8672 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8673 !! wikitext
8674 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8675
8676 He&amp;nbsp;llo He&amp;nbsp;llo
8677 !! html/php
8678 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8679 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8680 </p>
8681 !! end
8682
8683 # html2wt will fail because of title normalization without data-parsoid
8684 !! test
8685 Parsoid: handle constructor well
8686 !! options
8687 parsoid=wt2html,wt2wt
8688 !! wikitext
8689 [[constructor]]
8690
8691 [[constructor:foo]]
8692 !! html/php
8693 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8694 </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>
8695 </p>
8696 !! html/parsoid
8697 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8698
8699 <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>
8700 !! end
8701
8702 !! article
8703 ko:
8704 !! text
8705 Test.
8706 !! endarticle
8707
8708 # Note that `ko` isn't a known interlanguage prefix
8709 !! test
8710 Parsoid: recognize interlanguage links without a target page
8711 !! options
8712 ill
8713 !! wikitext
8714 [[es:]]
8715
8716 [[ko:]]
8717 !! html/php
8718 es:
8719 !! html/parsoid
8720 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8721
8722 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8723 !! end
8724
8725 # Note that `ko` isn't a known interwiki prefix
8726 !! test
8727 Parsoid: recognize interwiki links without a target page
8728 !! options
8729 parsoid=wt2html,wt2wt,html2html
8730 !! wikitext
8731 [[:es:]]
8732
8733 [[:ko:]]
8734 !! html/php
8735 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8736 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8737 </p>
8738 !! html/parsoid
8739 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8740 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8741 !! end
8742
8743 !! test
8744 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8745 !! wikitext
8746 [[mi:Foo]]
8747 !! html/php
8748 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8749 </p>
8750 !! html/parsoid
8751 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8752 !! end
8753
8754 !! test
8755 Interlanguage link with preceding local interwiki link (bug 68085)
8756 !! options
8757 parsoid=wt2html,wt2wt,html2html
8758 !! wikitext
8759 Blah blah blah
8760 [[local:es:Spanish]]
8761 !! html/php
8762 <p>Blah blah blah
8763 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8764 </p>
8765 !! html/parsoid
8766 <p>Blah blah blah
8767 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8768 !! end
8769
8770 !! test
8771 Looks like an interlanguage link, but is actually a local interwiki
8772 !! options
8773 parsoid=wt2html,wt2wt,html2html
8774 !! wikitext
8775 Blah blah blah
8776 [[mi:Template:Foo]]
8777 !! html/php
8778 <p>Blah blah blah
8779 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8780 </p>
8781 !! html/parsoid
8782 <p>Blah blah blah
8783 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8784 !! end
8785
8786 ###
8787 ### Redirects, Parsoid-only
8788 ###
8789
8790 !! test
8791 1. Simple redirect to page
8792 !! wikitext
8793 #REDIRECT [[Main Page]]
8794 !! html/parsoid
8795 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8796 !! end
8797
8798 !! test
8799 2. Other redirect variants
8800 !! wikitext
8801 #REDIRECT [[Main_Page]]
8802 !! html/parsoid
8803 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8804 !! end
8805
8806 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8807 # This tests the Parsoid bail-out code.
8808 !! test
8809 3. Other redirect variants
8810 !! wikitext
8811 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8812 !! html/parsoid
8813 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8814 !! end
8815
8816 !! test
8817 4. Redirect to a templated destination
8818 !! wikitext
8819 #REDIRECT [[{{echo|Foo}}bar]]
8820 !! html/parsoid
8821 <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"}]]}'/>
8822 !! end
8823
8824 !! test
8825 Empty redirect
8826 !! options
8827 parsoid=wt2html,wt2wt
8828 !! wikitext
8829 #REDIRECT [[]]
8830 !! html/parsoid
8831 <ol>
8832 <li>REDIRECT [[]]</li></ol>
8833 !! end
8834
8835 !! test
8836 Optional colon in #REDIRECT
8837 !! options
8838 # the colon is archaic syntax. we support it for wt2html, but we
8839 # don't care that it roundtrips back to the modern syntax.
8840 parsoid=wt2html,html2html
8841 !! wikitext
8842 #REDIRECT:[[Main Page]]
8843 !! html/parsoid
8844 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8845 !! end
8846
8847 !! test
8848 Whitespace in #REDIRECT with optional colon
8849 !! options
8850 # the colon and gratuitous whitespace is archaic syntax. we support
8851 # it for wt2html, but we don't care that it roundtrips back to the
8852 # modern syntax (without extra whitespace)
8853 parsoid=wt2html,html2html
8854 !! wikitext
8855
8856 #REDIRECT
8857 :
8858 [[Main Page]]
8859 !! html/parsoid
8860 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8861 !! end
8862
8863 !! test
8864 Piped link in #REDIRECT
8865 !! options
8866 # content after piped link is ignored. we support this syntax,
8867 # but don't care that the piped link is lost when we roundtrip this.
8868 parsoid=wt2html
8869 !! wikitext
8870 #REDIRECT [[Main Page|bar]]
8871 !! html/parsoid
8872 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8873 !! end
8874
8875 !! test
8876 Redirect to category (T104502)
8877 !! options
8878 parsoid=wt2html,wt2wt
8879 !! wikitext
8880 #REDIRECT [[Category:Foo]]
8881 !! html/parsoid
8882 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8883 !! end
8884
8885 !! test
8886 Redirect to category with URL encoding (T104502)
8887 !! options
8888 parsoid=wt2html
8889 !! wikitext
8890 #REDIRECT [[Category%3AFoo]]
8891 !! html/parsoid
8892 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8893 !! end
8894
8895 !! test
8896 Redirect to category page
8897 !! wikitext
8898 #REDIRECT [[:Category:Foo]]
8899 !! html/parsoid
8900 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8901 !! end
8902
8903 !! test
8904 Redirect to image page (1)
8905 !! wikitext
8906 #REDIRECT [[File:Wiki.png]]
8907 !! html/parsoid
8908 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8909 !! end
8910
8911 !! test
8912 Redirect to image page (2)
8913 !! wikitext
8914 #REDIRECT [[Image:Wiki.png]]
8915 !! html/parsoid
8916 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8917 !! end
8918
8919 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8920 # Next test confirms this.
8921 !! test
8922 Redirect to language (1) (T104918)
8923 !! options
8924 parsoid=wt2html,wt2wt,html2html
8925 !! wikitext
8926 #REDIRECT [[en:File:Wiki.png]]
8927 !! html/parsoid
8928 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8929 !! end
8930
8931 !! test
8932 Redirect to language (2) (T104918)
8933 !! wikitext
8934 #REDIRECT [[:en:File:Wiki.png]]
8935 !! html/parsoid
8936 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8937 !! end
8938
8939 !! test
8940 Redirect to interwiki (T104918)
8941 !! wikitext
8942 #REDIRECT [[meatball:File:Wiki.png]]
8943 !! html/parsoid
8944 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8945 !! end
8946
8947 !! test
8948 Non-English #REDIRECT
8949 !! options
8950 language=is
8951 !! wikitext
8952 #TILVÍSUN [[Main Page]]
8953 !! html/parsoid
8954 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8955 !! end
8956
8957 !! test
8958 Redirect syntax under text isn't considered a redirect
8959 !! wikitext
8960 some text
8961 #redirect [[Main Page]]
8962 !! html/parsoid
8963 <p>some text</p>
8964 <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>
8965 !! end
8966
8967 # FIXME: Should hoist the redirect to the top of the page and ensure there
8968 # is only one.
8969 !! test
8970 New redirect
8971 !! options
8972 parsoid=html2wt
8973 !! html/parsoid
8974 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8975 !! wikitext
8976 Foo
8977 #REDIRECT [[Foo]]
8978 !! end
8979
8980 ##
8981 ## XHTML tidiness
8982 ###
8983
8984 !! test
8985 <br> to <br />
8986 !! wikitext
8987 1<br>2<br />3
8988 !! html
8989 <p>1<br />2<br />3
8990 </p>
8991 !! end
8992
8993 !! test
8994 Broken br tag sanitization
8995 !! wikitext
8996 </br>
8997 !! html/php
8998 <p>&lt;/br&gt;
8999 </p>
9000 !! end
9001
9002 # TODO: Fix html2html mode (bug 51055)!
9003 !! test
9004 Parsoid: Broken br tag recognition
9005 !! options
9006 parsoid=wt2html
9007 !! wikitext
9008 </br>
9009
9010 <br/ >
9011 !! html+tidy
9012 <p><br /></p>
9013 <p><br /></p>
9014 !! end
9015
9016 !! test
9017 Incorrecly removing closing slashes from correctly formed XHTML
9018 !! wikitext
9019 <br style="clear:both;" />
9020 !! html
9021 <p><br style="clear:both;" />
9022 </p>
9023 !! end
9024
9025 !! test
9026 Failing to transform badly formed HTML into correct XHTML
9027 !! wikitext
9028 <br style="clear: left;">
9029 <br style="clear: right;">
9030 <br style="clear: both;">
9031 !! html
9032 <p><br style="clear: left;" />
9033 <br style="clear: right;" />
9034 <br style="clear: both;" />
9035 </p>
9036 !!end
9037
9038 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9039 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9040 !! test
9041 Handling html with a div self-closing tag
9042 !! wikitext
9043 <div title />
9044 <div title/>
9045 <div title/ >
9046 <div title=bar />
9047 <div title=bar/>
9048 <div title=bar/ >
9049 !! html/php
9050 <p>&lt;div title /&gt;
9051 &lt;div title/&gt;
9052 </p>
9053 <div>
9054 <p>&lt;div title=bar /&gt;
9055 &lt;div title=bar/&gt;
9056 </p>
9057 <div title="bar/"></div>
9058 </div>
9059
9060 !! html/parsoid
9061 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9062 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9063 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9064 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9065 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9066 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9067 !! end
9068
9069 !! test
9070 Handling html with a br self-closing tag
9071 !! wikitext
9072 <br title />
9073 <br title/>
9074 <br title/ >
9075 <br title=bar />
9076 <br title=bar/>
9077 <br title=bar/ >
9078 !! html/php
9079 <p><br title="" />
9080 <br title="" />
9081 <br />
9082 <br title="bar" />
9083 <br title="bar" />
9084 <br title="bar/" />
9085 </p>
9086 !! html/parsoid
9087 <p><br title="" />
9088 <br title="" />
9089 <br title="" />
9090 <br title="bar" />
9091 <br title="bar" />
9092 <br title="bar/" />
9093 </p>
9094 !! end
9095
9096 !! test
9097 Horizontal ruler (should it add that extra space?)
9098 !! wikitext
9099 <hr>
9100 <hr >
9101 foo <hr
9102 > bar
9103 !! html+tidy
9104 <hr />
9105 <hr />
9106 <p>foo</p>
9107 <hr />
9108 <p>bar</p>
9109 !! end
9110
9111 !! test
9112 Horizontal ruler -- 4+ dashes render hr
9113 !! wikitext
9114 ----
9115 !! html
9116 <hr />
9117
9118 !! end
9119
9120 !! test
9121 Horizontal ruler -- eats additional dashes on the same line
9122 !! wikitext
9123 ---------
9124 !! html
9125 <hr />
9126
9127 !! end
9128
9129 !! test
9130 Horizontal ruler -- does not collapse dashes on consecutive lines
9131 !! wikitext
9132 ----
9133 ----
9134 !! html
9135 <hr />
9136 <hr />
9137
9138 !! end
9139
9140 !! test
9141 Horizontal ruler -- <4 dashes render as plain text
9142 !! wikitext
9143 ---
9144 !! html
9145 <p>---
9146 </p>
9147 !! end
9148
9149 !! test
9150 Horizontal ruler -- Supports content following dashes on same line
9151 !! wikitext
9152 ---- Foo
9153 !! html
9154 <hr /> Foo
9155
9156 !! html+tidy
9157 <hr />
9158 <p>Foo</p>
9159 !! end
9160
9161 ###
9162 ### Block-level elements
9163 ###
9164 !! test
9165 Common list
9166 !! wikitext
9167 *Common list
9168 * item 2
9169 *item 3
9170 !! html
9171 <ul><li>Common list</li>
9172 <li> item 2</li>
9173 <li>item 3</li></ul>
9174
9175 !! end
9176
9177 !! test
9178 Numbered list
9179 !! wikitext
9180 #Numbered list
9181 #item 2
9182 # item 3
9183 !! html
9184 <ol><li>Numbered list</li>
9185 <li>item 2</li>
9186 <li> item 3</li></ol>
9187
9188 !! end
9189
9190 !! test
9191 Mixed list
9192 !! wikitext
9193 *Mixed list
9194 *# with numbers
9195 ** and bullets
9196 *# and numbers
9197 *bullets again
9198 **bullet level 2
9199 ***bullet level 3
9200 ***#Number on level 4
9201 **bullet level 2
9202 **#Number on level 3
9203 **#Number on level 3
9204 *#number level 2
9205 *Level 1
9206 *** Level 3
9207 #** Level 3, but ordered
9208 !! html
9209 <ul><li>Mixed list
9210 <ol><li> with numbers</li></ol>
9211 <ul><li> and bullets</li></ul>
9212 <ol><li> and numbers</li></ol></li>
9213 <li>bullets again
9214 <ul><li>bullet level 2
9215 <ul><li>bullet level 3
9216 <ol><li>Number on level 4</li></ol></li></ul></li>
9217 <li>bullet level 2
9218 <ol><li>Number on level 3</li>
9219 <li>Number on level 3</li></ol></li></ul>
9220 <ol><li>number level 2</li></ol></li>
9221 <li>Level 1
9222 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9223 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9224
9225 !! end
9226
9227 !! test
9228 1. Nested mixed wikitext and html list
9229 !! wikitext
9230 * hi
9231 * <ul><li>ho</li></ul>
9232 * hi
9233 ** ho
9234 !! html/php
9235 <ul><li> hi</li>
9236 <li> <ul><li>ho</li></ul></li>
9237 <li> hi
9238 <ul><li> ho</li></ul></li></ul>
9239
9240 !! html/parsoid
9241 <ul><li> hi</li>
9242 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9243 <li> hi
9244 <ul><li> ho</li></ul></li></ul>
9245 !! end
9246
9247 !! test
9248 2. Nested mixed wikitext and html list (incompatible)
9249 !! wikitext
9250 ; hi
9251 : {{echo|<li>ho</li>}}
9252 !! html/php
9253 <dl><dt> hi</dt>
9254 <dd> <li>ho</li></dd></dl>
9255
9256 !! html/parsoid
9257 <dl><dt> hi</dt>
9258 <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>
9259 !! end
9260
9261 !! test
9262 Nested lists 1
9263 !! wikitext
9264 *foo
9265 **bar
9266 !! html
9267 <ul><li>foo
9268 <ul><li>bar</li></ul></li></ul>
9269
9270 !! end
9271
9272 !! test
9273 Nested lists 2
9274 !! wikitext
9275 **foo
9276 *bar
9277 !! html
9278 <ul><li><ul><li>foo</li></ul></li>
9279 <li>bar</li></ul>
9280
9281 !! end
9282
9283 !! test
9284 Nested lists 3 (first element empty)
9285 !! wikitext
9286 *
9287 **bar
9288 !! html
9289 <ul><li>
9290 <ul><li>bar</li></ul></li></ul>
9291
9292 !! end
9293
9294 !! test
9295 Nested lists 4 (first element empty)
9296 !! wikitext
9297 **
9298 *bar
9299 !! html
9300 <ul><li><ul><li></li></ul></li>
9301 <li>bar</li></ul>
9302
9303 !! end
9304
9305 !! test
9306 Nested lists 5 (both elements empty)
9307 !! wikitext
9308 **
9309 *
9310 !! html
9311 <ul><li><ul><li></li></ul></li>
9312 <li></li></ul>
9313
9314 !! end
9315
9316 !! test
9317 Nested lists 6 (both elements empty)
9318 !! wikitext
9319 *
9320 **
9321 !! html
9322 <ul><li>
9323 <ul><li></li></ul></li></ul>
9324
9325 !! end
9326
9327 !! test
9328 Nested lists 7 (skip initial nesting levels)
9329 !! wikitext
9330 *** foo
9331 !! html
9332 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9333
9334 !! end
9335
9336 !! test
9337 Nested lists 8 (multiple nesting transitions)
9338 !! wikitext
9339 * foo
9340 *** bar
9341 ** baz
9342 * boo
9343 !! html
9344 <ul><li> foo
9345 <ul><li><ul><li> bar</li></ul></li>
9346 <li> baz</li></ul></li>
9347 <li> boo</li></ul>
9348
9349 !! end
9350
9351 !! test
9352 Nested lists 9 (extension interaction)
9353 !! options
9354 parsoid
9355 !! wikitext
9356 *<references />
9357 !! html/parsoid
9358 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9359 !! end
9360
9361 !! test
9362 1. Lists with start-of-line-transparent tokens before bullets: Comments
9363 !! wikitext
9364 *foo
9365 *<!--cmt-->bar
9366 <!--cmt-->*baz
9367 !! html
9368 <ul><li>foo</li>
9369 <li>bar</li>
9370 <li>baz</li></ul>
9371
9372 !! end
9373
9374 !! test
9375 2. Lists with start-of-line-transparent tokens before bullets: Template close
9376 !! wikitext
9377 *foo {{echo|bar
9378 }}*baz
9379 !! html
9380 <ul><li>foo bar</li>
9381 <li>baz</li></ul>
9382
9383 !! end
9384
9385 !! test
9386 List items are not parsed correctly following a <pre> block (bug 785)
9387 !! wikitext
9388 * <pre>foo</pre>
9389 * <pre>bar</pre>
9390 * zar
9391 !! html/php
9392 <ul><li> <pre>foo</pre></li>
9393 <li> <pre>bar</pre></li>
9394 <li> zar</li></ul>
9395
9396 !! html/parsoid
9397 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9398 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9399 <li> zar</li></ul>
9400 !! end
9401
9402 !! test
9403 List items from template
9404 !! wikitext
9405
9406 {{inner list}}
9407 * item 2
9408
9409 * item 0
9410 {{inner list}}
9411 * item 2
9412
9413 * item 0
9414 * notSOL{{inner list}}
9415 * item 2
9416 !! html
9417 <ul><li> item 1</li>
9418 <li> item 2</li></ul>
9419 <ul><li> item 0</li>
9420 <li> item 1</li>
9421 <li> item 2</li></ul>
9422 <ul><li> item 0</li>
9423 <li> notSOL</li>
9424 <li> item 1</li>
9425 <li> item 2</li></ul>
9426
9427 !! end
9428
9429 !! test
9430 List interrupted by empty line or heading
9431 !! wikitext
9432 * foo
9433
9434 ** bar
9435 == A heading ==
9436 * Another list item
9437 !! html
9438 <ul><li> foo</li></ul>
9439 <ul><li><ul><li> bar</li></ul></li></ul>
9440 <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>
9441 <ul><li> Another list item</li></ul>
9442
9443 !!end
9444
9445 !!test
9446 Multiple list tags generated by templates
9447 !! wikitext
9448 {{echo|<li>}}a
9449 {{echo|<li>}}b
9450 {{echo|<li>}}c
9451 !! html
9452 <li>a
9453 <li>b
9454 <li>c</li>
9455 </li>
9456 </li>
9457
9458 !! html+tidy
9459 <ul>
9460 <li>a</li>
9461 <li>b</li>
9462 <li>c</li>
9463 </ul>
9464 !!end
9465
9466 !!test
9467 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9468 !! wikitext
9469 *a
9470 <!--This line will NOT split the list-->
9471 *b
9472 <!--This line will NOT split the list either-->
9473 *c
9474 <!--foo--> <!----> <!--This line NOT split the list either-->
9475 *d
9476 !! html
9477 <ul><li>a</li>
9478 <li>b</li>
9479 <li>c</li>
9480 <li>d</li></ul>
9481
9482 !!end
9483
9484 !!test
9485 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9486 !! wikitext
9487 *a
9488 <!--This line will NOT split the list-->
9489 *b
9490 <!--This line will NOT split the list either-->
9491 *c
9492 <!--foo--> <!----> <!--This line NOT split the list
9493 either-->
9494 *d
9495 !! html
9496 <ul><li>a</li>
9497 <li>b</li>
9498 <li>c</li>
9499 <li>d</li></ul>
9500
9501 !!end
9502
9503 !!test
9504 Test the li-hack
9505 (The PHP parser relies on Tidy for the hack)
9506 !!options
9507 parsoid=wt2html,wt2wt
9508 !! wikitext
9509 * foo
9510 * <li>li-hack
9511 * {{echo|<li>templated li-hack}}
9512 * <!--foo--> <li> unsupported li-hack with preceding comments
9513
9514 <ul>
9515 <li><li>not a li-hack
9516 </li>
9517 </ul>
9518 !! html+tidy
9519 <ul>
9520 <li>foo</li>
9521 <li>li-hack</li>
9522 <li>templated li-hack</li>
9523 <li>unsupported li-hack with preceding comments</li>
9524 </ul>
9525 <ul>
9526 <li>not a li-hack</li>
9527 </ul>
9528 !!end
9529
9530 !! test
9531 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9532 !! options
9533 parsoid
9534 !! wikitext
9535 # foo
9536 ## bar
9537 * foo
9538 ** bar
9539 : foo
9540 :: bar
9541 !! html
9542 <ol>
9543 <li> foo<ol>
9544 <li> bar</li>
9545 </ol></li>
9546 </ol><ul>
9547 <li> foo<ul>
9548 <li> bar</li>
9549 </ul></li>
9550 </ul><dl>
9551 <dd> foo<dl>
9552 <dd> bar</dd>
9553 </dl></dd>
9554 </dl>
9555 !! end
9556
9557 !! test
9558 Parsoid: Test of whitespace serialization with Templated bullets
9559 !! options
9560 parsoid
9561 !! wikitext
9562 * {{bullet}}
9563 !! html
9564 <ul>
9565 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9566 </ul>
9567 !! end
9568
9569 # ------------------------------------------------------------------------
9570 # The next set of tests are about Parsoid's ability to handle badly nested
9571 # tags (parse, minimize scope of fixup, and roundtrip back)
9572 # ------------------------------------------------------------------------
9573
9574 !! test
9575 Unbalanced closing block tags break a list
9576 (php parser relies on Tidy to fix up)
9577 !! wikitext
9578 <div>
9579 *a</div><div>
9580 *b</div>
9581 !! html+tidy
9582 <div>
9583 <ul>
9584 <li>a</li>
9585 </ul>
9586 </div>
9587 <div>
9588 <ul>
9589 <li>b</li>
9590 </ul>
9591 </div>
9592 !! end
9593
9594 # Parsoid fails this test, but it might be tricky to support properly.
9595 # See bug 68395.
9596 !! test
9597 Unbalanced closing non-block tags don't break a list
9598 (php parser relies on Tidy to fix up)
9599 !! wikitext
9600 <span>
9601 *a</span><span>
9602 *b</span>
9603 !! html/php+tidy
9604 <ul>
9605 <li><span>a</span></li>
9606 <li><span>b</span></li>
9607 </ul>
9608 !! html/parsoid
9609 <span>
9610 <ul>
9611 <li>a<span></span>
9612 </li>
9613 <li>b
9614 </li>
9615 </ul>
9616 </span>
9617 !! end
9618
9619 !! test
9620 Unclosed formatting tags that straddle lists are closed and reopened
9621 (php parser relies on Tidy to fix up)
9622 !! options
9623 parsoid=wt2html,wt2wt,html2html
9624 !! wikitext
9625 # <s> a
9626 # b </s>
9627 !! html/php+tidy
9628 <ol>
9629 <li><s>a</s></li>
9630 <li><s>b</s></li>
9631 </ol>
9632 !! html/parsoid
9633 <ol><li> <s> a</s></li>
9634 <li><s> b </s></li></ol>
9635 !! end
9636
9637 # See bug 68395.
9638 !!test
9639 1. List embedded in a formatting tag
9640 !! wikitext
9641 <small>
9642 * foo
9643 </small>
9644 !! html/php+tidy
9645 <ul>
9646 <li><small>foo</small></li>
9647 </ul>
9648 !! html/parsoid
9649 <small>
9650 <ul>
9651 <li> foo</li>
9652 </ul>
9653 </small>
9654 !!end
9655
9656 ## Ugly Parsoid output here
9657 ## Not sure what the right output is.
9658 !!test
9659 2. List embedded in a formatting tag
9660 !! wikitext
9661 <small>
9662 *a
9663 *b</small>
9664 !! html/php+tidy
9665 <ul>
9666 <li><small>a</small></li>
9667 <li><small>b</small></li>
9668 </ul>
9669 !! html/parsoid
9670 <small></small>
9671 <ul><small>
9672 <li>a</li>
9673 </small>
9674 <li><small>b</small></li>
9675 </ul>
9676 !!end
9677
9678 # Ugly Parsoid and PHP parser output here
9679 # Not sure if we want to make this a test!
9680 #
9681 ## !!test
9682 ## 3. Unclosed formatting tags in list elements
9683 ## !! wikitext
9684 ## *<small>a
9685 ## *<small>b
9686 ## !! html/php+tidy
9687 ## <ul>
9688 ## <li><small>a</small></li>
9689 ## <li><small><small>b</small></small></li>
9690 ## </ul>
9691 ## !! html/parsoid
9692 ## <ul>
9693 ## <li><small>a</small></li>
9694 ## <small>
9695 ## <li><small>b</small></li>
9696 ## </small></ul>
9697 ## !!end
9698
9699 # This is a bug in the PHP parser + tidy combination.
9700 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9701 # and then fostered out of the table by tidy.)
9702 # We believe the Parsoid output to be correct.
9703 !! test
9704 Table with missing opening <tr> tag
9705 !! options
9706 parsoid=wt2html,wt2wt
9707 !! wikitext
9708 <table>
9709 <td>foo</td>
9710 </tr>
9711 </table>
9712 !! html+tidy
9713 <table>
9714 <tr>
9715 <td>foo</td>
9716 </tr>
9717 </table>
9718 !! end
9719
9720 ###
9721 ### Magic Words
9722 ###
9723
9724 # Note that the current date is hard-coded as
9725 # 1970-01-01T00:02:03Z (a Thursday)
9726 # when running parser tests. The timezone is also fixed to GMT, so
9727 # local date will be identical to current date.
9728
9729 !! test
9730 Magic Word: {{CURRENTDAY}}
9731 !! wikitext
9732 {{CURRENTDAY}}
9733 !! html
9734 <p>1
9735 </p>
9736 !! end
9737
9738 !! test
9739 Magic Word: {{CURRENTDAY2}}
9740 !! wikitext
9741 {{CURRENTDAY2}}
9742 !! html
9743 <p>01
9744 </p>
9745 !! end
9746
9747 !! test
9748 Magic Word: {{CURRENTDAYNAME}}
9749 !! wikitext
9750 {{CURRENTDAYNAME}}
9751 !! html
9752 <p>Thursday
9753 </p>
9754 !! end
9755
9756 !! test
9757 Magic Word: {{CURRENTDOW}}
9758 !! wikitext
9759 {{CURRENTDOW}}
9760 !! html
9761 <p>4
9762 </p>
9763 !! end
9764
9765 !! test
9766 Magic Word: {{CURRENTMONTH}}
9767 !! wikitext
9768 {{CURRENTMONTH}}
9769 !! html
9770 <p>01
9771 </p>
9772 !! end
9773
9774 !! test
9775 Magic Word: {{CURRENTMONTH1}}
9776 !! wikitext
9777 {{CURRENTMONTH1}}
9778 !! html
9779 <p>1
9780 </p>
9781 !! end
9782
9783 !! test
9784 Magic Word: {{CURRENTMONTHABBREV}}
9785 !! wikitext
9786 {{CURRENTMONTHABBREV}}
9787 !! html
9788 <p>Jan
9789 </p>
9790 !! end
9791
9792 !! test
9793 Magic Word: {{CURRENTMONTHNAME}}
9794 !! wikitext
9795 {{CURRENTMONTHNAME}}
9796 !! html
9797 <p>January
9798 </p>
9799 !! end
9800
9801 !! test
9802 Magic Word: {{CURRENTMONTHNAMEGEN}}
9803 !! wikitext
9804 {{CURRENTMONTHNAMEGEN}}
9805 !! html
9806 <p>January
9807 </p>
9808 !! end
9809
9810 !! test
9811 Magic Word: {{CURRENTTIME}}
9812 !! wikitext
9813 {{CURRENTTIME}}
9814 !! html
9815 <p>00:02
9816 </p>
9817 !! end
9818
9819 !! test
9820 Magic Word: {{CURRENTHOUR}}
9821 !! wikitext
9822 {{CURRENTHOUR}}
9823 !! html
9824 <p>00
9825 </p>
9826 !! end
9827
9828 !! test
9829 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9830 !! wikitext
9831 {{CURRENTWEEK}}
9832 !! html
9833 <p>1
9834 </p>
9835 !! end
9836
9837 !! test
9838 Magic Word: {{CURRENTYEAR}}
9839 !! wikitext
9840 {{CURRENTYEAR}}
9841 !! html
9842 <p>1970
9843 </p>
9844 !! end
9845
9846 !! test
9847 Magic Word: {{CURRENTTIMESTAMP}}
9848 !! wikitext
9849 {{CURRENTTIMESTAMP}}
9850 !! html
9851 <p>19700101000203
9852 </p>
9853 !! end
9854
9855 !! test
9856 Magic Words LOCAL (UTC)
9857 !! wikitext
9858 * {{LOCALMONTH}}
9859 * {{LOCALMONTH1}}
9860 * {{LOCALMONTHNAME}}
9861 * {{LOCALMONTHNAMEGEN}}
9862 * {{LOCALMONTHABBREV}}
9863 * {{LOCALDAY}}
9864 * {{LOCALDAY2}}
9865 * {{LOCALDAYNAME}}
9866 * {{LOCALYEAR}}
9867 * {{LOCALTIME}}
9868 * {{LOCALHOUR}}
9869 * {{LOCALWEEK}}
9870 * {{LOCALDOW}}
9871 * {{LOCALTIMESTAMP}}
9872 !! html
9873 <ul><li> 01</li>
9874 <li> 1</li>
9875 <li> January</li>
9876 <li> January</li>
9877 <li> Jan</li>
9878 <li> 1</li>
9879 <li> 01</li>
9880 <li> Thursday</li>
9881 <li> 1970</li>
9882 <li> 00:02</li>
9883 <li> 00</li>
9884 <li> 1</li>
9885 <li> 4</li>
9886 <li> 19700101000203</li></ul>
9887
9888 !! end
9889
9890 !! test
9891 Magic Word: {{FULLPAGENAME}}
9892 !! options
9893 title=[[User:Ævar Arnfjörð Bjarmason]]
9894 !! wikitext
9895 {{FULLPAGENAME}}
9896 !! html
9897 <p>User:Ævar Arnfjörð Bjarmason
9898 </p>
9899 !! end
9900
9901 !! test
9902 Magic Word: {{FULLPAGENAMEE}}
9903 !! options
9904 title=[[User:Ævar Arnfjörð Bjarmason]]
9905 !! wikitext
9906 {{FULLPAGENAMEE}}
9907 !! html
9908 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9909 </p>
9910 !! end
9911
9912 !! test
9913 Magic Word: {{TALKSPACE}}
9914 !! options
9915 title=[[User:Æ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}}, same namespace
9925 !! options
9926 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9927 !! wikitext
9928 {{TALKSPACE}}
9929 !! html
9930 <p>User talk
9931 </p>
9932 !! end
9933
9934 !! test
9935 Magic Word: {{TALKSPACE}}, main namespace
9936 !! options
9937 title=[[Parser Test]]
9938 !! wikitext
9939 {{TALKSPACE}}
9940 !! html
9941 <p>Talk
9942 </p>
9943 !! end
9944
9945 !! test
9946 Magic Word: {{TALKSPACEE}}
9947 !! options
9948 title=[[User:Ævar Arnfjörð Bjarmason]]
9949 !! wikitext
9950 {{TALKSPACEE}}
9951 !! html
9952 <p>User_talk
9953 </p>
9954 !! end
9955
9956 !! test
9957 Magic Word: {{SUBJECTSPACE}}
9958 !! options
9959 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9960 !! wikitext
9961 {{SUBJECTSPACE}}
9962 !! html
9963 <p>User
9964 </p>
9965 !! end
9966
9967 !! test
9968 Magic Word: {{SUBJECTSPACE}}, same namespace
9969 !! options
9970 title=[[User:Ævar Arnfjörð Bjarmason]]
9971 !! wikitext
9972 {{SUBJECTSPACE}}
9973 !! html
9974 <p>User
9975 </p>
9976 !! end
9977
9978 !! test
9979 Magic Word: {{SUBJECTSPACE}}, main namespace
9980 !! options
9981 title=[[Parser Test]]
9982 !! wikitext
9983 {{SUBJECTSPACE}}
9984 !! html
9985
9986 !! end
9987
9988 !! test
9989 Magic Word: {{SUBJECTSPACEE}}
9990 !! options
9991 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9992 !! wikitext
9993 {{SUBJECTSPACEE}}
9994 !! html
9995 <p>User
9996 </p>
9997 !! end
9998
9999 !! test
10000 Magic Word: {{NAMESPACE}}
10001 !! options
10002 title=[[User:Ævar Arnfjörð Bjarmason]]
10003 !! wikitext
10004 {{NAMESPACE}}
10005 !! html
10006 <p>User
10007 </p>
10008 !! end
10009
10010 !! test
10011 Magic Word: {{NAMESPACEE}}
10012 !! options
10013 title=[[User:Ævar Arnfjörð Bjarmason]]
10014 !! wikitext
10015 {{NAMESPACEE}}
10016 !! html
10017 <p>User
10018 </p>
10019 !! end
10020
10021 !! test
10022 Magic Word: {{NAMESPACENUMBER}}
10023 !! options
10024 title=[[User:Ævar Arnfjörð Bjarmason]]
10025 !! wikitext
10026 {{NAMESPACENUMBER}}
10027 !! html
10028 <p>2
10029 </p>
10030 !! end
10031
10032 !! test
10033 Magic Word: {{SUBPAGENAME}}
10034 !! options
10035 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10036 !! wikitext
10037 {{SUBPAGENAME}}
10038 !! html
10039 <p>sub ö
10040 </p>
10041 !! end
10042
10043 !! test
10044 Magic Word: {{SUBPAGENAMEE}}
10045 !! options
10046 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10047 !! wikitext
10048 {{SUBPAGENAMEE}}
10049 !! html
10050 <p>sub_%C3%B6
10051 </p>
10052 !! end
10053
10054 !! test
10055 Magic Word: {{ROOTPAGENAME}}
10056 !! options
10057 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10058 !! wikitext
10059 {{ROOTPAGENAME}}
10060 !! html
10061 <p>Ævar Arnfjörð Bjarmason
10062 </p>
10063 !! end
10064
10065 !! test
10066 Magic Word: {{ROOTPAGENAMEE}}
10067 !! options
10068 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10069 !! wikitext
10070 {{ROOTPAGENAMEE}}
10071 !! html
10072 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10073 </p>
10074 !! end
10075
10076 !! test
10077 Magic Word: {{BASEPAGENAME}}
10078 !! options
10079 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10080 !! wikitext
10081 {{BASEPAGENAME}}
10082 !! html
10083 <p>Ævar Arnfjörð Bjarmason
10084 </p>
10085 !! end
10086
10087 !! test
10088 Magic Word: {{BASEPAGENAMEE}}
10089 !! options
10090 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10091 !! wikitext
10092 {{BASEPAGENAMEE}}
10093 !! html
10094 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{TALKPAGENAME}}
10100 !! options
10101 title=[[User:Ævar Arnfjörð Bjarmason]]
10102 !! wikitext
10103 {{TALKPAGENAME}}
10104 !! html
10105 <p>User talk:Ævar Arnfjörð Bjarmason
10106 </p>
10107 !! end
10108
10109 !! test
10110 Magic Word: {{TALKPAGENAMEE}}
10111 !! options
10112 title=[[User:Ævar Arnfjörð Bjarmason]]
10113 !! wikitext
10114 {{TALKPAGENAMEE}}
10115 !! html
10116 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10117 </p>
10118 !! end
10119
10120 !! test
10121 Magic Word: {{SUBJECTPAGENAME}}
10122 !! options
10123 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10124 !! wikitext
10125 {{SUBJECTPAGENAME}}
10126 !! html
10127 <p>User:Ævar Arnfjörð Bjarmason
10128 </p>
10129 !! end
10130
10131 !! test
10132 Magic Word: {{SUBJECTPAGENAMEE}}
10133 !! options
10134 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10135 !! wikitext
10136 {{SUBJECTPAGENAMEE}}
10137 !! html
10138 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10139 </p>
10140 !! end
10141
10142 !! test
10143 Magic Word: {{NUMBEROFFILES}}
10144 !! wikitext
10145 {{NUMBEROFFILES}}
10146 !! html
10147 <p>7
10148 </p>
10149 !! end
10150
10151 !! test
10152 Magic Word: {{PAGENAME}}
10153 !! options
10154 title=[[User:Ævar Arnfjörð Bjarmason]]
10155 !! wikitext
10156 {{PAGENAME}}
10157 !! html
10158 <p>Ævar Arnfjörð Bjarmason
10159 </p>
10160 !! end
10161
10162 !! test
10163 Magic Word: {{PAGENAME}} with metacharacters
10164 !! options
10165 title=[['foo & bar = baz']]
10166 !! wikitext
10167 ''{{PAGENAME}}''
10168 !! html/php
10169 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10170 </p>
10171 !! html+tidy
10172 <p><i>'foo &amp; bar = baz'</i></p>
10173 !! end
10174
10175 !! test
10176 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10177 !! options
10178 title=[[*RFC 1234 http://example.com/]]
10179 !! wikitext
10180 {{PAGENAME}}
10181 !! html/php
10182 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10183 </p>
10184 !! html+tidy
10185 <p>*RFC 1234 http://example.com/</p>
10186 !! end
10187
10188 !! test
10189 Magic Word: {{PAGENAMEE}}
10190 !! options
10191 title=[[User:Ævar Arnfjörð Bjarmason]]
10192 !! wikitext
10193 {{PAGENAMEE}}
10194 !! html
10195 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10196 </p>
10197 !! end
10198
10199 !! test
10200 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10201 !! options
10202 title=[[*RFC 1234 http://example.com/]]
10203 !! wikitext
10204 {{PAGENAMEE}}
10205 !! html/php
10206 <p>&#42;RFC_1234_http&#58;//example.com/
10207 </p>
10208 !! html+tidy
10209 <p>*RFC_1234_http://example.com/</p>
10210 !! end
10211
10212 !! test
10213 Magic Word: {{REVISIONID}}
10214 !! wikitext
10215 {{REVISIONID}}
10216 !! html
10217 <p>1337
10218 </p>
10219 !! end
10220
10221 !! test
10222 Magic Word: {{SCRIPTPATH}}
10223 !! wikitext
10224 {{SCRIPTPATH}}
10225 !! html
10226
10227 !! end
10228
10229 !! test
10230 Magic Word: {{STYLEPATH}}
10231 !! wikitext
10232 {{STYLEPATH}}
10233 !! html
10234 <p>/skins
10235 </p>
10236 !! end
10237
10238 !! test
10239 Magic Word: {{SERVER}}
10240 !! wikitext
10241 {{SERVER}}
10242 !! html
10243 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10244 </p>
10245 !! end
10246
10247 !! test
10248 Magic Word: {{SERVERNAME}}
10249 !! wikitext
10250 {{SERVERNAME}}
10251 !! html
10252 <p>example.org
10253 </p>
10254 !! end
10255
10256 !! test
10257 Magic Word: {{SITENAME}}
10258 !! wikitext
10259 {{SITENAME}}
10260 !! html
10261 <p>MediaWiki
10262 </p>
10263 !! end
10264
10265 !! test
10266 Case-sensitive magic words, when cased differently, should just be template transclusions
10267 !! wikitext
10268 {{CurrentMonth}}
10269 {{currentday}}
10270 {{cURreNTweEK}}
10271 {{currentHour}}
10272 !! html
10273 <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>
10274 <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>
10275 <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>
10276 <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>
10277 </p>
10278 !! end
10279
10280 !! test
10281 Case-insensitive magic words should still work with weird casing.
10282 !! wikitext
10283 {{sErVeRNaMe}}
10284 {{LCFirst:AOEU}}
10285 {{ucFIRST:aoeu}}
10286 {{SERver}}
10287 !! html
10288 <p>example.org
10289 aOEU
10290 Aoeu
10291 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10292 </p>
10293 !! end
10294
10295 # From plwiki:PLOS_ONE
10296 !! test
10297 Parsoid: Page property magic word with magic word contents
10298 !! wikitext
10299 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10300 !! html/parsoid
10301 <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>"}]]}'/>
10302 !! end
10303
10304 !! test
10305 Parsoid: Template-generated DISPLAYTITLE
10306 !! wikitext
10307 {{{{echo|DISPLAYTITLE}}:Foo}}
10308 !! html/parsoid
10309 <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}}]}'/>
10310 !! end
10311
10312 !! test
10313 Namespace 1 {{ns:1}}
10314 !! wikitext
10315 {{ns:1}}
10316 !! html
10317 <p>Talk
10318 </p>
10319 !! end
10320
10321 !! test
10322 Namespace 1 {{ns:01}}
10323 !! wikitext
10324 {{ns:01}}
10325 !! html
10326 <p>Talk
10327 </p>
10328 !! end
10329
10330 !! test
10331 Namespace 0 {{ns:0}} (bug 4783)
10332 !! wikitext
10333 {{ns:0}}
10334 !! html
10335
10336 !! end
10337
10338 !! test
10339 Namespace 0 {{ns:00}} (bug 4783)
10340 !! wikitext
10341 {{ns:00}}
10342 !! html
10343
10344 !! end
10345
10346 !! test
10347 Namespace -1 {{ns:-1}}
10348 !! wikitext
10349 {{ns:-1}}
10350 !! html
10351 <p>Special
10352 </p>
10353 !! end
10354
10355 !! test
10356 Namespace User {{ns:User}}
10357 !! wikitext
10358 {{ns:User}}
10359 !! html
10360 <p>User
10361 </p>
10362 !! end
10363
10364 !! test
10365 Namespace User talk {{ns:User_talk}}
10366 !! wikitext
10367 {{ns:User_talk}}
10368 !! html
10369 <p>User talk
10370 </p>
10371 !! end
10372
10373 !! test
10374 Namespace User talk {{ns:uSeR tAlK}}
10375 !! wikitext
10376 {{ns:uSeR tAlK}}
10377 !! html
10378 <p>User talk
10379 </p>
10380 !! end
10381
10382 !! test
10383 Namespace File {{ns:File}}
10384 !! wikitext
10385 {{ns:File}}
10386 !! html
10387 <p>File
10388 </p>
10389 !! end
10390
10391 !! test
10392 Namespace File {{ns:Image}}
10393 !! wikitext
10394 {{ns:Image}}
10395 !! html
10396 <p>File
10397 </p>
10398 !! end
10399
10400 !! test
10401 Namespace (lang=de) Benutzer {{ns:User}}
10402 !! options
10403 language=de
10404 !! wikitext
10405 {{ns:User}}
10406 !! html
10407 <p>Benutzer
10408 </p>
10409 !! end
10410
10411 !! test
10412 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10413 !! options
10414 language=de
10415 !! wikitext
10416 {{ns:3}}
10417 !! html
10418 <p>Benutzer Diskussion
10419 </p>
10420 !! end
10421
10422 !! test
10423 Urlencode
10424 !! wikitext
10425 {{urlencode:hi world?!}}
10426 {{urlencode:hi world?!|WIKI}}
10427 {{urlencode:hi world?!|PATH}}
10428 {{urlencode:hi world?!|QUERY}}
10429 !! html/php
10430 <p>hi+world%3F%21
10431 hi_world%3F!
10432 hi%20world%3F%21
10433 hi+world%3F%21
10434 </p>
10435 !! end
10436
10437 !! test
10438 Magic Word: prioritize type info over data-parsoid
10439 !! options
10440 parsoid=html2wt
10441 !! html/parsoid
10442 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10443 !! wikitext
10444 __FORCETOC__
10445 !! end
10446
10447 !! test
10448 Magic Word: serialize on separate line (parsoid)
10449 !! options
10450 parsoid=wt2wt,html2wt
10451 !! wikitext
10452 foo
10453 __NOTOC__
10454 bar
10455 !! html/parsoid
10456 foo<meta property="mw:PageProp/notoc"/>bar
10457 !! end
10458
10459 !! test
10460 Magic Word: rt non-english wikis
10461 !! options
10462 parsoid=wt2wt
10463 language=de
10464 !! wikitext
10465 __NOEDITSECTION__
10466 !! html/parsoid
10467 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10468 !! end
10469
10470 !!test
10471 __proto__ is treated as normal wikitext (T105997)
10472 !!wikitext
10473 __proto__
10474 !!html
10475 <p>__proto__
10476 </p>
10477 !!end
10478
10479 ###
10480 ### Magic links
10481 ###
10482 !! test
10483 Magic links: internal link to RFC (bug 479)
10484 !! wikitext
10485 [[RFC 123]]
10486 !! html/php
10487 <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>
10488 </p>
10489 !! html/parsoid
10490 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10491 !! end
10492
10493 !! test
10494 Magic links: RFC (bug 479)
10495 !! wikitext
10496 RFC 822
10497 !! html/php
10498 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10499 </p>
10500 !! html/parsoid
10501 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10502 !! end
10503
10504 !! test
10505 Magic links: RFC (bug 65278)
10506 !! wikitext
10507 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10508 !! html/php
10509 <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.
10510 </p>
10511 !! html/parsoid
10512 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10513 !! end
10514
10515 !! test
10516 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10517 !! wikitext
10518 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10519 RFC
10520 822
10521 !! html/php
10522 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10523 RFC
10524 822
10525 </p>
10526 !! html/parsoid
10527 <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>
10528 RFC
10529 822</p>
10530 !! end
10531
10532 !! test
10533 Magic links: ISBN (bug 1937)
10534 !! wikitext
10535 ISBN 0-306-40615-2
10536 !! html/php
10537 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10538 </p>
10539 !! html/parsoid
10540 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10541 !! end
10542
10543 !! test
10544 Magic links: ISBN (bug 65278)
10545 !! wikitext
10546 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10547 !! html/php
10548 <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.
10549 </p>
10550 !! html/parsoid
10551 <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>
10552 !! end
10553
10554 !! test
10555 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10556 !! wikitext
10557 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10558 ISBN
10559 9780316098113
10560 ISBN 978
10561 0316098113
10562 !! html/php
10563 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10564 ISBN
10565 9780316098113
10566 ISBN 978
10567 0316098113
10568 </p>
10569 !! html/parsoid
10570 <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>
10571 ISBN
10572 9780316098113
10573 ISBN 978
10574 0316098113</p>
10575 !! end
10576
10577 !! test
10578 Magic links: PMID incorrectly converts space to underscore
10579 !! wikitext
10580 PMID 1234
10581 !! html/php
10582 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10583 </p>
10584 !! html/parsoid
10585 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10586 !! end
10587
10588 !! test
10589 Magic links: PMID (bug 65278)
10590 !! wikitext
10591 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10592 !! html/php
10593 <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.
10594 </p>
10595 !! html/parsoid
10596 <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>
10597 !! end
10598
10599 !! test
10600 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10601 !! wikitext
10602 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10603 PMID
10604 1234
10605 !! html/php
10606 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10607 PMID
10608 1234
10609 </p>
10610 !! html/parsoid
10611 <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>
10612 PMID
10613 1234</p>
10614 !! end
10615
10616 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10617 # since these are ExtLinkText, not MagicLinkText
10618 !! test
10619 Magic links: use appropriate serialization for "almost" magic links.
10620 !! wikitext
10621 X[[Special:BookSources/0978739256|foo]]
10622
10623 X[//tools.ietf.org/html/rfc1234 foo]
10624 !! html/php
10625 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10626 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10627 </p>
10628 !! html/parsoid
10629 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10630 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10631 !! end
10632
10633 !! test
10634 Magic links: All disabled (T47942)
10635 !! options
10636 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10637 !! wikitext
10638 ISBN 0-306-40615-2
10639 PMID 1234
10640 RFC 4321
10641 !! html/php
10642 <p>ISBN 0-306-40615-2
10643 PMID 1234
10644 RFC 4321
10645 </p>
10646 !! end
10647
10648 ###
10649 ### Templates
10650 ####
10651
10652 !! test
10653 Nonexistent template
10654 !! wikitext
10655 {{thistemplatedoesnotexist}}
10656 !! html
10657 <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>
10658 </p>
10659 !! end
10660
10661 !! test
10662 Template with invalid target containing tags
10663 !! wikitext
10664 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10665 !! html
10666 <p>{{a<b>b</b>|foo|a=b|a = b}}
10667 </p>
10668 !! end
10669
10670 !! test
10671 Template with invalid target containing unclosed tag
10672 !! wikitext
10673 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10674 !! html
10675 <p>{{a<b>|foo|a=b|a = b}}</b>
10676 </p>
10677 !! end
10678
10679 !! test
10680 Template with invalid target containing wikilink
10681 !! wikitext
10682 {{[[Main Page]]}}
10683 !! html/php
10684 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10685 </p>
10686 !! html/parsoid
10687 <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>
10688 !! end
10689
10690 !! test
10691 Template with just whitespace in it, bug #68421
10692 !! wikitext
10693 {{echo|{{ }}}}
10694 !! html/parsoid
10695 <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>
10696 !! end
10697
10698 !! article
10699 Template:test
10700 !! text
10701 This is a test template
10702 !! endarticle
10703
10704 !! test
10705 Simple template
10706 !! wikitext
10707 {{test}}
10708 !! html
10709 <p>This is a test template
10710 </p>
10711 !! end
10712
10713 !! test
10714 Template with explicit namespace
10715 !! wikitext
10716 {{Template:test}}
10717 !! html
10718 <p>This is a test template
10719 </p>
10720 !! end
10721
10722
10723 !! article
10724 Template:paramtest
10725 !! text
10726 This is a test template with parameter {{{param}}}
10727 !! endarticle
10728
10729 !! test
10730 Template parameter
10731 !! wikitext
10732 {{paramtest|param=foo}}
10733 !! html
10734 <p>This is a test template with parameter foo
10735 </p>
10736 !! end
10737
10738 !! article
10739 Template:paramtestnum
10740 !! text
10741 [[{{{1}}}|{{{2}}}]]
10742 !! endarticle
10743
10744 !! test
10745 Template unnamed parameter
10746 !! wikitext
10747 {{paramtestnum|Main Page|the main page}}
10748 !! html
10749 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10750 </p>
10751 !! end
10752
10753 !! article
10754 Template:templatesimple
10755 !! text
10756 (test)
10757 !! endarticle
10758
10759 !! article
10760 Template:templateredirect
10761 !! text
10762 #redirect [[Template:templatesimple]]
10763 !! endarticle
10764
10765 !! article
10766 Template:templateasargtestnum
10767 !! text
10768 {{{{{1}}}}}
10769 !! endarticle
10770
10771 !! article
10772 Template:templateasargtest
10773 !! text
10774 {{template{{{templ}}}}}
10775 !! endarticle
10776
10777 !! article
10778 Template:templateasargtest2
10779 !! text
10780 {{{{{templ}}}}}
10781 !! endarticle
10782
10783 !! test
10784 Template with template name as unnamed argument
10785 !! wikitext
10786 {{templateasargtestnum|templatesimple}}
10787 !! html
10788 <p>(test)
10789 </p>
10790 !! end
10791
10792 !! test
10793 Template with template name as argument
10794 !! wikitext
10795 {{templateasargtest|templ=simple}}
10796 !! html
10797 <p>(test)
10798 </p>
10799 !! end
10800
10801 !! test
10802 Template with template name as argument (2)
10803 !! wikitext
10804 {{templateasargtest2|templ=templatesimple}}
10805 !! html
10806 <p>(test)
10807 </p>
10808 !! end
10809
10810 !! article
10811 Template:templateasargtestdefault
10812 !! text
10813 {{{{{templ|templatesimple}}}}}
10814 !! endarticle
10815
10816 !! article
10817 Template:templa
10818 !! text
10819 '''templ'''
10820 !! endarticle
10821
10822 !! test
10823 Template with default value
10824 !! wikitext
10825 {{templateasargtestdefault}}
10826 !! html
10827 <p>(test)
10828 </p>
10829 !! end
10830
10831 !! test
10832 Template with default value (value set)
10833 !! wikitext
10834 {{templateasargtestdefault|templ=templa}}
10835 !! html
10836 <p><b>templ</b>
10837 </p>
10838 !! end
10839
10840 !! test
10841 Template redirect
10842 !! wikitext
10843 {{templateredirect}}
10844 !! html/php
10845 <p>(test)
10846 </p>
10847 !! html/parsoid
10848 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10849 !! end
10850
10851 !! test
10852 Template with argument in separate line
10853 !! wikitext
10854 {{ templateasargtest |
10855 templ = simple }}
10856 !! html
10857 <p>(test)
10858 </p>
10859 !! end
10860
10861 !! test
10862 Template with complex template as argument
10863 !! wikitext
10864 {{paramtest|
10865 param ={{ templateasargtest |
10866 templ = simple }}}}
10867 !! html
10868 <p>This is a test template with parameter (test)
10869 </p>
10870 !! end
10871
10872 !! test
10873 Template with thumb image (with link in description)
10874 !! wikitext
10875 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10876 !! html/php
10877 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>
10878
10879 !! html+tidy
10880 <p>This is a test template with parameter</p>
10881 <div class="thumb tright">
10882 <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>
10883 <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>
10884 </div>
10885 </div>
10886 !! html/parsoid
10887 <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>
10888 !! end
10889
10890 !! article
10891 Template:complextemplate
10892 !! text
10893 {{{1}}} {{paramtest|
10894 param ={{{param}}}}}
10895 !! endarticle
10896
10897 !! test
10898 Template with complex arguments
10899 !! wikitext
10900 {{complextemplate|
10901 param ={{ templateasargtest |
10902 templ = simple }}|[[Template:complextemplate|link]]}}
10903 !! html
10904 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10905 </p>
10906 !! end
10907
10908 !! test
10909 BUG 553: link with two variables in a piped link
10910 !! wikitext
10911 {|
10912 |[[{{{1}}}|{{{2}}}]]
10913 |}
10914 !! html/php
10915 <table>
10916 <tr>
10917 <td>[[{{{1}}}|{{{2}}}]]
10918 </td></tr></table>
10919
10920 !! html/parsoid
10921 <table>
10922 <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>
10923 !! end
10924
10925 # See: T2553
10926 !! test
10927 Abort table cell attribute parsing on wikilink
10928 !! wikitext
10929 {|
10930 | testing [[one|two]] | three || four
10931 | testing one two | three || four
10932 | testing="[[one|two]]" | three || four
10933 |}
10934 !! html/php
10935 <table>
10936 <tr>
10937 <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>
10938 <td> four
10939 </td>
10940 <td> three </td>
10941 <td> four
10942 </td>
10943 <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>
10944 <td> four
10945 </td></tr></table>
10946
10947 !! html/parsoid
10948 <table>
10949 <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>
10950 <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>
10951 <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>
10952 </tbody></table>
10953 !! end
10954
10955 !! test
10956 Don't abort table cell attribute parsing if wikilink is found in template arg
10957 !! wikitext
10958 {|
10959 | Test {{#tag:ref|One two "[[three]]" four}}
10960 |}
10961 !! html/parsoid
10962 <table>
10963 <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>
10964 </tbody></table>
10965 !! end
10966
10967 !! test
10968 Magic variable as template parameter
10969 !! wikitext
10970 {{paramtest|param={{SITENAME}}}}
10971 !! html
10972 <p>This is a test template with parameter MediaWiki
10973 </p>
10974 !! end
10975
10976 !! article
10977 Template:linktest
10978 !! text
10979 [[{{{param}}}|link]]
10980 !! endarticle
10981
10982 !! test
10983 Template parameter as link source
10984 !! wikitext
10985 {{linktest|param=Main Page}}
10986 !! html
10987 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10988 </p>
10989 !! end
10990
10991 !!article
10992 Template:paramtest2
10993 !! text
10994 including another template, {{paramtest|param={{{arg}}}}}
10995 !! endarticle
10996
10997 !! test
10998 Template passing argument to another template
10999 !! wikitext
11000 {{paramtest2|arg='hmm'}}
11001 !! html
11002 <p>including another template, This is a test template with parameter 'hmm'
11003 </p>
11004 !! end
11005
11006 !! article
11007 Template:Linktest2
11008 !! text
11009 Main Page
11010 !! endarticle
11011
11012 !! test
11013 Template as link source
11014 !! wikitext
11015 [[{{linktest2}}]]
11016
11017 [[{{linktest2}}|Main Page]]
11018
11019 [[{{linktest2}}]]Page
11020 !! html
11021 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11022 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11023 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11024 </p>
11025 !! end
11026
11027
11028 !! article
11029 Template:loop1
11030 !! text
11031 {{loop2}}
11032 !! endarticle
11033
11034 !! article
11035 Template:loop2
11036 !! text
11037 {{loop1}}
11038 !! endarticle
11039
11040 !! test
11041 Template infinite loop
11042 !! wikitext
11043 {{loop1}}
11044 !! html
11045 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11046 </p>
11047 !! end
11048
11049 !! test
11050 Template from main namespace
11051 !! wikitext
11052 {{:Main Page}}
11053 !! html
11054 <p>blah blah
11055 </p>
11056 !! end
11057
11058 !! article
11059 Template:table
11060 !! text
11061 {|
11062 | 1 || 2
11063 |-
11064 | 3 || 4
11065 |}
11066 !! endarticle
11067
11068 !! test
11069 BUG 529: Template with table, not included at beginning of line
11070 !! wikitext
11071 foo {{table}}
11072 !! html
11073 <p>foo
11074 </p>
11075 <table>
11076 <tr>
11077 <td> 1 </td>
11078 <td> 2
11079 </td></tr>
11080 <tr>
11081 <td> 3 </td>
11082 <td> 4
11083 </td></tr></table>
11084
11085 !! end
11086
11087 !! test
11088 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11089 !! wikitext
11090 foo
11091 {{table}}
11092 !! html
11093 <p>foo
11094 </p>
11095 <table>
11096 <tr>
11097 <td> 1 </td>
11098 <td> 2
11099 </td></tr>
11100 <tr>
11101 <td> 3 </td>
11102 <td> 4
11103 </td></tr></table>
11104
11105 !! end
11106
11107 !! test
11108 BUG 41: Template parameters shown as broken links
11109 !! wikitext
11110 {{{parameter}}}
11111 !! html
11112 <p>{{{parameter}}}
11113 </p>
11114 !! end
11115
11116 !! test
11117 Template with targets containing wikilinks
11118 !! wikitext
11119 {{[[foo]]}}
11120
11121 {{[[{{echo|foo}}]]}}
11122
11123 {{{{echo|[[foo}}]]}}
11124 !! html
11125 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11126 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11127 </p><p>{{[[foo}}]]
11128 </p>
11129 !! end
11130
11131 !! article
11132 Template:''
11133 !! text
11134 bar
11135 !! endarticle
11136
11137 !! test
11138 Templates: Double quotes as template target
11139 !! wikitext
11140 foo {{''}} baz
11141 !! html/php
11142 <p>foo bar baz
11143 </p>
11144 !! html/parsoid
11145 <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
11146 </p>
11147 !! end
11148
11149 ## This test is about making sure Parsoid's data-mw is well formed in the
11150 ## face of multiple templates with intersecting and overlapping ranges. The
11151 ## wikitext itself is wretched.
11152 !! test
11153 Templates with intersecting and overlapping ranges
11154 !! wikitext
11155 {|{{echo|
11156 <p>ha</p>}}
11157 {|{{echo|
11158 <p>ho</p>}}
11159 {{echo|{{!}}hi}}
11160 |}
11161 !! html/php+tidy
11162 <p>ha</p>
11163 <p>ho</p>
11164 <table>
11165 <tr>
11166 <td></td>
11167 </tr>
11168 <tr>
11169 <td>hi</td>
11170 </tr>
11171 </table>
11172 <table>
11173 <tr>
11174 <td></td>
11175 </tr>
11176 </table>
11177 !! html/parsoid
11178 <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":""}]]}'>
11179
11180 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11181
11182 <tbody><tr><td>hi</td></tr>
11183 </tbody></table>
11184 !! end
11185
11186 !! article
11187 Template:MSGNW test
11188 !! text
11189 ''None'' of '''this''' should be
11190 * interpreted
11191 but rather passed unmodified
11192 {{test}}
11193 <gallery>
11194 File:Foobar.jpg
11195 </gallery>
11196 <!-- comment -->
11197 !! endarticle
11198
11199 # hmm, fix this or just deprecate msgnw and document its behavior?
11200 !! test
11201 msgnw keyword
11202 !! wikitext
11203 {{msgnw:MSGNW test}}
11204 !! html/php
11205 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11206 &#42; interpreted
11207 &#32;but rather passed unmodified
11208 &#123;&#123;test&#125;&#125;
11209 &#60;gallery&#62;
11210 File:Foobar.jpg
11211 &#60;/gallery&#62;
11212 &#60;!-- comment --&#62;
11213 </p>
11214 !! end
11215
11216 !! test
11217 int keyword
11218 !! wikitext
11219 {{int:youhavenewmessages|lots of money|not!}}
11220 !! html
11221 <p>You have lots of money (not!).
11222 </p>
11223 !! end
11224
11225 !! test
11226 int keyword - non-existing message
11227 !! wikitext
11228 {{int:var}}
11229 !! html
11230 <p>⧼var⧽
11231 </p>
11232 !! end
11233
11234 !! article
11235 Template:Includes
11236 !! text
11237 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11238 !! endarticle
11239
11240 !! test
11241 <includeonly> and <noinclude> being included
11242 !! wikitext
11243 {{Includes}}
11244 !! html
11245 <p>Foobar
11246 </p>
11247 !! end
11248
11249 !! article
11250 Template:Includes2
11251 !! text
11252 <onlyinclude>Foo</onlyinclude>bar
11253 !! endarticle
11254
11255 !! test
11256 <onlyinclude> being included
11257 !! wikitext
11258 {{Includes2}}
11259 !! html
11260 <p>Foo
11261 </p>
11262 !! end
11263
11264
11265 !! article
11266 Template:Includes3
11267 !! text
11268 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11269 !! endarticle
11270
11271 !! test
11272 <onlyinclude> and <includeonly> being included
11273 !! wikitext
11274 {{Includes3}}
11275 !! html
11276 <p>Foo
11277 </p>
11278 !! end
11279
11280 !! test
11281 <includeonly> and <noinclude> on a page
11282 !! wikitext
11283 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11284 !! html
11285 <p>Foozar
11286 </p>
11287 !! end
11288
11289 !! test
11290 Un-closed <noinclude>
11291 !! wikitext
11292 <noinclude>
11293 !! html
11294 !! end
11295
11296 !! test
11297 <onlyinclude> on a page
11298 !! wikitext
11299 <onlyinclude>Foo</onlyinclude>bar
11300 !! html
11301 <p>Foobar
11302 </p>
11303 !! end
11304
11305 !! test
11306 Un-closed <onlyinclude>
11307 !! wikitext
11308 <onlyinclude>
11309 !! html
11310 !! end
11311
11312 !!test
11313 Self-closed noinclude, includeonly, onlyinclude tags
11314 !! wikitext
11315 <noinclude />
11316 <includeonly />
11317 <onlyinclude />
11318 !! html
11319 <p><br />
11320 </p>
11321 !!end
11322
11323 !!test
11324 Unbalanced includeonly and noinclude tags
11325 !! wikitext
11326 {|
11327 |a</noinclude>
11328 |b</noinclude></noinclude>
11329 |c</noinclude></includeonly>
11330 |d</includeonly></includeonly>
11331 |}
11332 !! html
11333 <table>
11334 <tr>
11335 <td>a
11336 </td>
11337 <td>b
11338 </td>
11339 <td>c&lt;/includeonly&gt;
11340 </td>
11341 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11342 </td></tr></table>
11343
11344 !!end
11345
11346 !! article
11347 Template:Includeonly section
11348 !! text
11349 <includeonly>
11350 ==Includeonly section==
11351 </includeonly>
11352 ==Section T-1==
11353 !!endarticle
11354
11355 !! test
11356 Bug 6563: Edit link generation for section shown by <includeonly>
11357 !! wikitext
11358 {{includeonly section}}
11359 !! html
11360 <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>
11361 <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>
11362
11363 !! end
11364
11365 # Uses same input as the contents of [[Template:Includeonly section]]
11366 !! test
11367 Bug 6563: Section extraction for section shown by <includeonly>
11368 !! options
11369 section=T-2
11370 !! wikitext
11371 <includeonly>
11372 ==Includeonly section==
11373 </includeonly>
11374 ==Section T-2==
11375 !! html
11376 ==Section T-2==
11377 !! end
11378
11379 !! test
11380 Bug 6563: Edit link generation for section suppressed by <includeonly>
11381 !! wikitext
11382 <includeonly>
11383 ==Includeonly section==
11384 </includeonly>
11385 ==Section 1==
11386 !! html
11387 <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>
11388
11389 !! end
11390
11391 !! test
11392 Bug 6563: Section extraction for section suppressed by <includeonly>
11393 !! options
11394 section=1
11395 !! wikitext
11396 <includeonly>
11397 ==Includeonly section==
11398 </includeonly>
11399 ==Section 1==
11400 !! html
11401 ==Section 1==
11402 !! end
11403
11404 !! test
11405 Un-closed <includeonly>
11406 !! wikitext
11407 <includeonly>
11408 !! html/php
11409 !! html/parsoid
11410 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11411 !! end
11412
11413 ## We used to, but no longer wt2wt this test since the default serializer
11414 ## will normalize the include directives to serialize on their own line.
11415 ## Selser will take care of preserving formatting in scenarios where they
11416 ## intermingled with other wikitext.
11417 !! test
11418 Includes and comments at SOL
11419 !! options
11420 parsoid=wt2html,html2html
11421 !! wikitext
11422 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11423
11424 <noinclude>
11425 some
11426 </noinclude>* stuff
11427 * here
11428
11429 <includeonly>can have stuff</includeonly>=== here ===
11430
11431 !! html/php
11432 <h2><span class="mw-headline" id="hu">hu</span></h2>
11433 <p>some
11434 </p>
11435 <ul><li> stuff</li>
11436 <li> here</li></ul>
11437 <h3><span class="mw-headline" id="here">here</span></h3>
11438
11439 !! html/parsoid
11440 <!-- 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>
11441
11442 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11443 <p>some</p>
11444 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11445 <li> here</li></ul>
11446
11447 <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>
11448
11449 !! end
11450
11451 # TODO: test with DOM fragment reuse!
11452 !! test
11453 Parsoid: DOM fragment reuse
11454 !! options
11455 parsoid=wt2wt,wt2html
11456 !! wikitext
11457 a{{echo|b<table></table>c}}d
11458
11459 a{{echo|b
11460 <table></table>
11461 c}}d
11462
11463 {{echo|a
11464
11465 <table></table>
11466
11467 b}}
11468 !! html
11469 <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>
11470
11471 <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">
11472 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11473 </span><p about="#mwt2">cd</p>
11474
11475 <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">
11476
11477 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11478
11479 </span><p about="#mwt3">b</p>
11480 !! end
11481
11482 !! test
11483 Parsoid: Merge double tds (T52603)
11484 !! options
11485 parsoid
11486 !! wikitext
11487 {|
11488 |{{echo|{{!}} foo}}
11489 |}
11490 !! html
11491 <table><tbody>
11492 <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>
11493 </tbody></table>
11494 !! end
11495
11496 !! test
11497 Parsoid: Merge double tds in nested transclusion content (T52603)
11498 !! options
11499 parsoid
11500 !! wikitext
11501 {{echo|<div>}}
11502 {|
11503 |{{echo|{{!}} foo}}
11504 |}
11505 {{echo|</div>}}
11506 !! html
11507 <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}}]}'>
11508 <table><tbody>
11509 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11510 </tbody></table>
11511 </div>
11512 !! end
11513
11514 ###
11515 ### <includeonly> and <noinclude> in attributes
11516 ###
11517 !!test
11518 0. includeonly around the entire attribute
11519 !! wikitext
11520 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11521 !! html
11522 <p><span id="v2">bar</span>
11523 </p>
11524 !!end
11525
11526 !!test
11527 1. includeonly in html attr key
11528 !! wikitext
11529 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11530 !! html
11531 <p><span id="foo">bar</span>
11532 </p>
11533 !!end
11534
11535 !!test
11536 2. includeonly in html attr value
11537 !! wikitext
11538 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11539 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11540 !! html
11541 <p><span id="v1">bar</span>
11542 <span id="v1">bar</span>
11543 </p>
11544 !!end
11545
11546 !!test
11547 3. includeonly in part of an attr value
11548 !! wikitext
11549 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11550 !! html
11551 <p><span style="color:red;">bar</span>
11552 </p>
11553 !!end
11554
11555 !!test
11556 4. includeonly in table attributes
11557 !! wikitext
11558 {|
11559 |- <noinclude>
11560 |-
11561 |a
11562 </noinclude>
11563 |- <includeonly>
11564 |-
11565 |b
11566 </includeonly>
11567 |}
11568 !! html
11569 <table>
11570
11571
11572 <tr>
11573 <td>a
11574 </td></tr>
11575 </table>
11576
11577 !!end
11578
11579 ###
11580 ### Token Stream Patcher tests
11581 ###
11582 ### These tests won't always pass wt2wt and other modes because
11583 ### on serialization, the table will be output on a new line.
11584 ### For now, we are blacklisting them, and using this to test selser.
11585 ###
11586
11587 !!test
11588 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11589 !!options
11590 parsoid=wt2html,wt2wt
11591 !!wikitext
11592 {{echo|}}{| width = '100%'
11593 |foo
11594 |}
11595 !!html/parsoid
11596 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11597 <tbody><tr><td>foo</td></tr>
11598 </tbody></table>
11599 !!end
11600
11601 ## We used to, but no longer wt2wt this test since the default serializer
11602 ## will normalize the include directives to serialize on their own line.
11603 ## Selser will take care of preserving formatting in scenarios where they
11604 ## intermingled with other wikitext.
11605 !!test
11606 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11607 !!options
11608 parsoid=wt2html
11609 !!wikitext
11610 <includeonly>a</includeonly>{| {{{b}}}
11611 |c
11612 |}
11613 !!html/parsoid
11614 <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":""}]]}'>
11615 <tbody><tr><td>c</td></tr>
11616 </tbody></table>
11617 !!end
11618
11619 !! test
11620 Table wikitext syntax outside wiki-tables
11621 !! wikitext
11622 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 !! html
11633 <p>a
11634 |+ not a caption
11635 ! not a table heading
11636 |- not a table row
11637 | not a table cell
11638 | class="foo bar" | baz
11639 b
11640 |}
11641 |-
11642 c
11643 </p>
11644 !! end
11645
11646 ###
11647 ### Testing parsing of templates where a template arg
11648 ### has the same name as the template itself.
11649 ###
11650
11651 !! article
11652 Template:quote
11653 !! text
11654 {{{quote|{{{1}}}}}}
11655 !! endarticle
11656
11657 !!test
11658 Templates: Template Name/Arg clash: 1. Use of positional param
11659 !! wikitext
11660 {{quote|foo}}
11661 !! html
11662 <p>foo
11663 </p>
11664 !!end
11665
11666 !!test
11667 Templates: Template Name/Arg clash: 2. Use of named param
11668 !! wikitext
11669 {{quote|quote=foo}}
11670 !! html
11671 <p>foo
11672 </p>
11673 !!end
11674
11675 !!test
11676 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11677 !! wikitext
11678 {{quote|quote}}
11679 !! html
11680 <p>quote
11681 </p>
11682 !!end
11683
11684 ###
11685 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11686 ###
11687
11688 !!test
11689 Templates: 1. Simple use
11690 !! wikitext
11691 {{echo|Foo}}
11692 !! html
11693 <p>Foo
11694 </p>
11695 !!end
11696
11697 !!test
11698 Templates: 2. Inside a block tag
11699 !! wikitext
11700 <div>{{echo|Foo}}</div>
11701 <blockquote>{{echo|Foo}}</blockquote>
11702 !! html
11703 <div>Foo</div>
11704 <blockquote>Foo</blockquote>
11705
11706 !! html+tidy
11707 <div>Foo</div>
11708 <blockquote>
11709 <p>Foo</p>
11710 </blockquote>
11711 !!end
11712
11713 !!test
11714 Templates: P-wrapping: 1a. Templates on consecutive lines
11715 !! wikitext
11716 {{echo|Foo}}
11717 {{echo|bar}}
11718 !! html
11719 <p>Foo
11720 bar
11721 </p>
11722 !!end
11723
11724 !!test
11725 Templates: P-wrapping: 1b. Templates on consecutive lines
11726 !! wikitext
11727 Foo
11728
11729 {{echo|bar}}
11730 {{echo|baz}}
11731 !! html
11732 <p>Foo
11733 </p><p>bar
11734 baz
11735 </p>
11736 !!end
11737
11738 !!test
11739 Templates: P-wrapping: 1c. Templates on consecutive lines
11740 !! wikitext
11741 {{echo|Foo}}
11742 {{echo|bar}} <div>baz</div>
11743 !! html
11744 <p>Foo
11745 </p>
11746 bar <div>baz</div>
11747
11748 !! html+tidy
11749 <p>Foo</p>
11750 <p>bar</p>
11751 <div>baz</div>
11752 !! end
11753
11754 !!test
11755 Templates: P-wrapping: 1d. Template preceded by comment-only line
11756 !!options
11757 parsoid
11758 !! wikitext
11759 <!-- foo -->
11760 {{echo|Bar}}
11761 !! html
11762 <!-- foo -->
11763
11764 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11765 !!end
11766
11767 !!test
11768 Templates: Inline Text: 1. Multiple template uses
11769 !! wikitext
11770 {{echo|Foo}}bar{{echo|baz}}
11771 !! html
11772 <p>Foobarbaz
11773 </p>
11774 !!end
11775
11776 !!test
11777 Templates: Inline Text: 2. Back-to-back template uses
11778 !! wikitext
11779 {{echo|Foo}}{{echo|bar}}
11780 !! html
11781 <p>Foobar
11782 </p>
11783 !!end
11784
11785 !!test
11786 Templates: Block Tags: 1. Multiple template uses
11787 !! wikitext
11788 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11789 !! html
11790 <div>Foo</div><div>bar</div><div>baz</div>
11791
11792 !!end
11793
11794 !!test
11795 Templates: Block Tags: 2. Back-to-back template uses
11796 !! wikitext
11797 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11798 !! html
11799 <div>Foo</div><div>bar</div>
11800
11801 !!end
11802
11803 # This is an edge case relating to paragraph wrapping.
11804 !!test
11805 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11806 !! wikitext
11807 {{echo|a
11808 b</p>}}
11809 !! html/parsoid
11810 <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
11811 b</p>
11812 !!end
11813
11814 !!test
11815 Templates: Links: 1. Simple example
11816 !! wikitext
11817 {{echo|[[Foo|bar]]}}
11818 !! html
11819 <p><a href="/wiki/Foo" title="Foo">bar</a>
11820 </p>
11821 !!end
11822
11823 !!test
11824 Templates: Links: 2. Generation of link href
11825 !! wikitext
11826 [[{{echo|Foo}}|bar]]
11827 !! html
11828 <p><a href="/wiki/Foo" title="Foo">bar</a>
11829 </p>
11830 !!end
11831
11832 !!test
11833 Templates: Links: 3. Generation of part of a link href
11834 !! wikitext
11835 [[Fo{{echo|o}}|bar]]
11836
11837 [[Foo{{echo|bar}}]]
11838
11839 [[Foo{{echo|bar}}baz]]
11840
11841 [[Foo{{echo|bar}}|bar]]
11842
11843 [[:Foo{{echo|bar}}]]
11844
11845 [[:Foo{{echo|bar}}|bar]]
11846 !! html
11847 <p><a href="/wiki/Foo" title="Foo">bar</a>
11848 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11849 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11850 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11851 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11852 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11853 </p>
11854 !!end
11855
11856 !!test
11857 Templates: Links: 4. Multiple templates generating link href
11858 !! wikitext
11859 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11860 !! html
11861 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11862 </p>
11863 !!end
11864
11865 !!test
11866 Templates: Links: 5. Generation of link text
11867 !! wikitext
11868 [[Foo|{{echo|bar}}]]
11869 !! html
11870 <p><a href="/wiki/Foo" title="Foo">bar</a>
11871 </p>
11872 !!end
11873
11874 !!test
11875 Templates: Links: 5. Nested templates (only outermost template should be marked)
11876 !! wikitext
11877 {{echo|[[{{echo|Foo}}|bar]]}}
11878 !! html
11879 <p><a href="/wiki/Foo" title="Foo">bar</a>
11880 </p>
11881 !!end
11882
11883 !!test
11884 Templates: HTML Tag: 1. Generation of HTML attr. key
11885 !! wikitext
11886 <div {{echo|style}}="color:red;">foo</div>
11887 !! html
11888 <div style="color:red;">foo</div>
11889
11890 !!end
11891
11892 !!test
11893 Templates: HTML Tag: 2. Generation of HTML attr. value
11894 !! wikitext
11895 <div style={{echo|'color:red;'}}>foo</div>
11896 !! html
11897 <div style="color:red;">foo</div>
11898
11899 !!end
11900
11901 !!test
11902 Templates: HTML Tag: 3. Generation of HTML attr key and value
11903 !! wikitext
11904 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11905 !! html
11906 <div style="color:red;">foo</div>
11907
11908 !!end
11909
11910 !!test
11911 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11912 !! wikitext
11913 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11914 !! html
11915 <div title="This is a long title with just one piece templated">foo</div>
11916
11917 !!end
11918
11919 !!test
11920 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11921 !! wikitext
11922 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11923 !! html
11924 <div title="This is a long title with just one piece templated">foo</div>
11925
11926 !!end
11927
11928 !!test
11929 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11930 !! wikitext
11931 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11932 !! html
11933 <div title="This is a long title with just one piece templated">foo</div>
11934
11935 !!end
11936
11937 # SSS FIXME: While it is great we added support for all this,
11938 # do we want to make this part of the spec? Maybe we want to
11939 # deprecate this kind of usage in the future?
11940 !!test
11941 Templates: HTML Tag: 7. Generation of partial attribute key string
11942 !! wikitext
11943 <div st{{echo|yle}}="color:red;">foo</div>
11944 !! html
11945 <div style="color:red;">foo</div>
11946
11947 !!end
11948
11949 !! test
11950 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11951 !! wikitext
11952 <div {{echo|1=id="v1"}}>bar</div>
11953 !! html
11954 <div id="v1">bar</div>
11955
11956 !!end
11957
11958 !! test
11959 Templates: HTML Tag: 9. Multiple template-generated attributes
11960 !! wikitext
11961 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11962 !! html
11963 <div id="v1" title="foo">bar</div>
11964
11965 !!end
11966
11967 !! test
11968 Templates: Support for templates generating attributes and content
11969 !! wikitext
11970 {| {{mixed_attr_content_template}}
11971 |-
11972 |bar
11973 |}
11974 !! html/php
11975 <table style="color:red;" title="T48811">
11976
11977 <tr>
11978 <td>foo
11979 </td></tr>
11980 <tr>
11981 <td>bar
11982 </td></tr></table>
11983
11984 !! html/parsoid
11985 <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|}"]}'>
11986 <tbody><tr>
11987 <td>foo</td></tr>
11988 <tr>
11989 <td>bar</td></tr>
11990 </tbody></table>
11991 !!end
11992
11993 !! test
11994 1. Entities and nowikis inside templated attributes should be handled correctly
11995 !! wikitext
11996 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11997 !! html/php
11998 <div style="background:#f9f9f9;">foo</div>
11999
12000 !! html/parsoid
12001 <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>
12002 !! end
12003
12004 !! test
12005 2. Entities and nowikis inside templated attributes should be handled correctly
12006 !! wikitext
12007 {|
12008 |{{table_attribs_3}}
12009 |}
12010 !! html/php
12011 <table>
12012 <tr>
12013 <td style="background:#f9f9f9;">Foo
12014 </td></tr></table>
12015
12016 !! html/parsoid
12017 <table>
12018 <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>
12019 </tbody></table>
12020 !! end
12021
12022 !! test
12023 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12024 !! wikitext
12025 {{tbl-start}}
12026 |{{table_attribs_3}}
12027 {{tbl-end}}
12028 !! html/php
12029 <table>
12030 <tr>
12031 <td style="background:#f9f9f9;">Foo
12032 </td></tr></table>
12033
12034 !! html/parsoid
12035 <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}}]}'>
12036 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12037 </tbody></table>
12038 !! end
12039
12040 # T107622
12041 !! test
12042 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12043 !! wikitext
12044 {|
12045 | {{table_attribs_6}} hi
12046 |}
12047 !! html/php
12048 <table>
12049 <tr>
12050 <td style="background: red;"> hi
12051 </td></tr></table>
12052
12053 !! html/parsoid
12054 <table>
12055 <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>
12056 </tbody></table>
12057 !! end
12058
12059 !!test
12060 Templates: HTML Tables: 1. Generating start of a HTML table
12061 !! wikitext
12062 {{echo|<table><tr><td>foo</td>}}</tr></table>
12063 !! html
12064 <table><tr><td>foo</td></tr></table>
12065
12066 !!end
12067
12068 !!test
12069 Templates: HTML Tables: 2a. Generating middle of a HTML table
12070 !! wikitext
12071 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12072 !! html
12073 <table><tr><td>foo</td></tr></table>
12074
12075 !!end
12076
12077 !!test
12078 Templates: HTML Tables: 2b. Generating middle of a HTML table
12079 !! wikitext
12080 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12081 !! html
12082 <table><tr><td>foo</td></tr></table>
12083
12084 !!end
12085
12086 !!test
12087 Templates: HTML Tables: 3. Generating end of a HTML table
12088 !! wikitext
12089 <table><tr>{{echo|<td>foo</td></tr></table>}}
12090 !! html
12091 <table><tr><td>foo</td></tr></table>
12092
12093 !!end
12094
12095 !!test
12096 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12097 !! wikitext
12098 {{echo|<table>}}<tr><td>foo</td></tr></table>
12099 !! html
12100 <table><tr><td>foo</td></tr></table>
12101
12102 !!end
12103
12104 !!test
12105 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12106 !! wikitext
12107 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12108 !! html
12109 <table><tr><td>foo</td></tr></table>
12110
12111 !!end
12112
12113 !!test
12114 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12115 !! wikitext
12116 <table><tr>{{echo|<td>}}foo</td></tr></table>
12117 !! html
12118 <table><tr><td>foo</td></tr></table>
12119
12120 !!end
12121
12122 !!test
12123 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12124 !! wikitext
12125 <table><tr><td>foo{{echo|</td>}}</tr></table>
12126 !! html
12127 <table><tr><td>foo</td></tr></table>
12128
12129 !!end
12130
12131 !!test
12132 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12133 !! wikitext
12134 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12135 !! html
12136 <table><tr><td>foo</td></tr></table>
12137
12138 !!end
12139
12140 !!test
12141 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12142 !! wikitext
12143 <table><tr><td>foo</td></tr>{{echo|</table>}}
12144 !! html
12145 <table><tr><td>foo</td></tr></table>
12146
12147 !!end
12148
12149 !!test
12150 Templates: HTML Tables: 5. Proper fostering of categories from inside
12151 !!options
12152 parsoid=wt2html,wt2wt
12153 !! wikitext
12154 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12155 <!--Two categories (Bug 50330)-->
12156 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12157 !! html
12158 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12159 <!--Two categories (Bug 50330)-->
12160 <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>
12161 !!end
12162
12163 !!test
12164 Templates: Wiki Tables: 1a. Fostering of entire template content
12165 !! wikitext
12166 {|
12167 {{echo|a}}
12168 |}
12169 !! html
12170 <table>
12171 a
12172 <tr><td></td></tr></table>
12173
12174 !! html+tidy
12175 <p>a</p>
12176 <table>
12177 <tr>
12178 <td></td>
12179 </tr>
12180 </table>
12181 !! end
12182
12183 !!test
12184 Templates: Wiki Tables: 1b. Fostering of entire template content
12185 !! wikitext
12186 {|
12187 {{echo|<div>}}
12188 foo
12189 {{echo|</div>}}
12190 |}
12191 !! html
12192 <table>
12193 <div>
12194 <p>foo
12195 </p>
12196 </div>
12197 <tr><td></td></tr></table>
12198
12199 !! html+tidy
12200 <div>
12201 <p>foo</p>
12202 </div>
12203 <table>
12204 <tr>
12205 <td></td>
12206 </tr>
12207 </table>
12208 !! end
12209
12210 !!test
12211 Templates: Wiki Tables: 2. Fostering of partial template content
12212 !! wikitext
12213 {|
12214 {{echo|a
12215 <div>b</div>}}
12216 |}
12217 !! html
12218 <table>
12219 a
12220 <div>b</div>
12221 <tr><td></td></tr></table>
12222
12223 !! html+tidy
12224 <p>a</p>
12225 <div>b</div>
12226 <table>
12227 <tr>
12228 <td></td>
12229 </tr>
12230 </table>
12231 !! end
12232
12233 !!test
12234 Templates: Wiki Tables: 3. td-content via multiple templates
12235 !! wikitext
12236 {|
12237 {{echo|{{pipe}}a}}{{echo|b}}
12238 |}
12239 !! html
12240 <table>
12241 <tr>
12242 <td>ab
12243 </td></tr></table>
12244
12245 !!end
12246
12247 !!test
12248 Templates: Wiki Tables: 4. Templated tags, no content
12249 !! wikitext
12250 {{tbl-start}}
12251 {{tbl-end}}
12252 !! html
12253 <table>
12254 <tr><td></td></tr></table>
12255
12256 !!end
12257
12258 !!test
12259 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12260 !! wikitext
12261 {{tbl-start}}
12262 |foo
12263 {{tbl-end}}
12264 !! html
12265 <table>
12266 <tr>
12267 <td>foo
12268 </td></tr></table>
12269
12270 !!end
12271
12272 !!test
12273 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12274 !! wikitext
12275 {{tbl-start}}
12276 {{!}}foo
12277 {{tbl-end}}
12278 !! html
12279 <table>
12280 <tr>
12281 <td>foo
12282 </td></tr></table>
12283
12284 !!end
12285
12286 ## This test case is very specific to Parsoid's internals
12287 ## and is hence only tested for Parsoid's code. Parsoid uses
12288 ## a <meta> marker tag for <ref> tags and they are expanded
12289 ## much later. We are verifying that this <meta> tag usage
12290 ## doesn't prevent foster parenting.
12291 !!test
12292 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12293 !!wikitext
12294 {{PartialTable}}<ref>foo</ref>
12295 |}
12296
12297 <references />
12298 !!html/parsoid
12299 <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">
12300 <tbody>
12301 </tbody></table>
12302
12303 <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>
12304 !!end
12305
12306 !! test
12307 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12308 !! wikitext
12309 {{echo|
12310 {{{!}}
12311 {{!}}-}}
12312 <onlyinclude>
12313 |foo
12314 </onlyinclude>
12315 {{!}}}
12316 !! html/parsoid
12317 <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{{!}}}"]}'>
12318 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12319 <tbody><tr>
12320
12321 <td>foo
12322 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12323 </tbody></table>
12324 !! end
12325
12326 !!test
12327 Templates: Lists: Multi-line list-items via templates
12328 !! wikitext
12329 *{{echo|a {{nonexistent|
12330 unused}}}}
12331 *{{echo|b {{nonexistent|
12332 unused}}}}
12333 !! html
12334 <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>
12335 <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>
12336
12337 !!end
12338
12339 !!test
12340 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12341 !! wikitext
12342 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12343 !! html
12344 <p><i>ab</i>c<i>d</i>e
12345 </p>
12346 !!end
12347
12348 !!test
12349 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12350 (PHP parser generates misnested html)
12351 !! wikitext
12352 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12353 !! html/parsoid
12354 <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>
12355 !!end
12356
12357 !!test
12358 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12359 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12360 !! options
12361 parsoid=wt2html,wt2wt
12362 !! wikitext
12363 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12364 !! html
12365 <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>
12366 <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>
12367 <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>
12368 !!end
12369
12370 !!test
12371 Templates: Ugly nesting: 4. Divs opened/closed across templates
12372 !! wikitext
12373 a<div>b{{echo|c</div>d}}e
12374 !! html
12375 a<div>bc</div>de
12376
12377 !! html+tidy
12378 <p>a</p>
12379 <div>bc</div>
12380 <p>de</p>
12381 !! end
12382
12383 !!test
12384 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12385 (Parsoid-centric)
12386 !! options
12387 parsoid
12388 !! wikitext
12389 {|
12390 |{{echo|foo</table>}}
12391 |bar
12392 |}
12393 !! html
12394 <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|}"]}'>
12395
12396 <tbody>
12397 <tr>
12398 <td>foo</td></tr></tbody></table><span about="#mwt1">
12399 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12400 |}</span>
12401 !!end
12402
12403 !!test
12404 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12405 (Parsoid-centric)
12406 !! options
12407 parsoid
12408 !! wikitext
12409 <table>
12410 <tr>
12411 <td>
12412 <table>
12413 <tr>
12414 <td>1. {{echo|foo </table>}}</td>
12415 <td> bar </td>
12416 <td>2. {{echo|baz </table>}}</td>
12417 </tr>
12418 <tr>
12419 <td>abc</td>
12420 </tr>
12421 </table>
12422 </td>
12423 </tr>
12424 <tr>
12425 <td>xyz</td>
12426 </tr>
12427 </table>
12428 !! html
12429 <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>"]}'>
12430 <tbody><tr>
12431 <td>
12432 <table>
12433 <tbody><tr>
12434 <td>1. foo </td></tr></tbody></table></td>
12435 <td> bar </td>
12436 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12437 </span><span about="#mwt2">
12438 </span><span about="#mwt2">
12439 </span><span about="#mwt2">abc</span><span about="#mwt2">
12440 </span><span about="#mwt2">
12441 </span><span about="#mwt2">
12442 </span><span about="#mwt2">
12443 </span><span about="#mwt2">
12444 </span><span about="#mwt2">
12445 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12446 </span><span about="#mwt2">
12447 </span>
12448 !!end
12449
12450 !! test
12451 Templates: Ugly templates: 3. newline-only template parameter
12452 !! wikitext
12453 foo {{echo|
12454 }}
12455 !! html
12456 <p>foo
12457 </p>
12458 !! end
12459
12460 # This looks like a bug: a single newline triggers p/br for some reason.
12461 !! test
12462 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12463 !! wikitext
12464 {{echo|
12465 }}
12466 !! html
12467 <p><br />
12468 </p>
12469 !! end
12470
12471 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12472 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12473 !! test
12474 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12475 !! wikitext
12476 {{echo|<table>}}
12477 {{echo|<div>foo}}
12478 {{echo|</table>}}
12479 !! html/parsoid
12480 <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
12481 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12482 </table>
12483 !! end
12484
12485 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12486 # that are "identical" and generate nesting cycles in the algorithm
12487 !! test
12488 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12489 !! wikitext
12490 {{echo|<table><tr><td><table>}}
12491 {{echo|<div>}}
12492 {{echo|</div>}}
12493 !! html/parsoid
12494 <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"}'>
12495 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12496 </table></td></tr></tbody></table>
12497 !! end
12498
12499 !! test
12500 Templates: Parameters substituted at the top-level
12501 !! wikitext
12502 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12503 !! html/php
12504 <p><i>who</i> me? <b>never!</b>
12505 </p>
12506 !! html/parsoid
12507 <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>
12508 !! end
12509
12510 !!test
12511 Parser Functions: 1. Simple example
12512 !! wikitext
12513 {{uc:foo}}
12514 !! html
12515 <p>FOO
12516 </p>
12517 !!end
12518
12519 !!test
12520 Parser Functions: 2. Nested use (only outermost should be marked up)
12521 !! wikitext
12522 {{uc:{{lc:FOO}}}}
12523 !! html
12524 <p>FOO
12525 </p>
12526 !!end
12527
12528 ###
12529 ### Pre-save transform tests
12530 ###
12531 !! test
12532 pre-save transform: subst:
12533 !! options
12534 pst
12535 !! wikitext
12536 {{subst:test}}
12537 !! html/php
12538 This is a test template
12539 !! end
12540
12541 !! test
12542 pre-save transform: normal template
12543 !! options
12544 pst
12545 !! wikitext
12546 {{test}}
12547 !! html/php
12548 {{test}}
12549 !! end
12550
12551 !! test
12552 pre-save transform: nonexistent template
12553 !! options
12554 pst
12555 !! wikitext
12556 {{thistemplatedoesnotexist}}
12557 !! html/php
12558 {{thistemplatedoesnotexist}}
12559 !! end
12560
12561 !! test
12562 pre-save transform: subst magic variables
12563 !! options
12564 pst
12565 !! wikitext
12566 {{subst:SITENAME}}
12567 !! html/php
12568 MediaWiki
12569 !! end
12570
12571 # This is bug 89, which I fixed. -- wtm
12572 !! test
12573 pre-save transform: subst: templates with parameters
12574 !! options
12575 pst
12576 !! wikitext
12577 {{subst:paramtest|param="something else"}}
12578 !! html/php
12579 This is a test template with parameter "something else"
12580 !! end
12581
12582 !! article
12583 Template:nowikitest
12584 !! text
12585 <nowiki>'''not wiki'''</nowiki>
12586 !! endarticle
12587
12588 !! test
12589 pre-save transform: nowiki in subst (bug 1188)
12590 !! options
12591 pst
12592 !! wikitext
12593 {{subst:nowikitest}}
12594 !! html/php
12595 <nowiki>'''not wiki'''</nowiki>
12596 !! end
12597
12598 !! article
12599 Template:commenttest
12600 !! text
12601 This template has <!-- a comment --> in it.
12602 !! endarticle
12603
12604 !! test
12605 pre-save transform: comment in subst (bug 1936)
12606 !! options
12607 pst
12608 !! wikitext
12609 {{subst:commenttest}}
12610 !! html/php
12611 This template has <!-- a comment --> in it.
12612 !! end
12613
12614 !! test
12615 pre-save transform: unclosed tag
12616 !! options
12617 pst
12618 !! wikitext
12619 <nowiki>'''not wiki'''
12620 !! html/php
12621 <nowiki>'''not wiki'''
12622 !! end
12623
12624 !! test
12625 pre-save transform: mixed tag case
12626 !! options
12627 pst
12628 !! wikitext
12629 <NOwiki>'''not wiki'''</noWIKI>
12630 !! html/php
12631 <NOwiki>'''not wiki'''</noWIKI>
12632 !! end
12633
12634 !! test
12635 pre-save transform: unclosed comment in <nowiki>
12636 !! options
12637 pst
12638 !! wikitext
12639 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12640 !! html/php
12641 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12642 !!end
12643
12644 # Leading @ in this template definition works around a limitation
12645 # in parsoid's parserTests which otherwise strips the <span> from the
12646 # result (confusing it for a template wrapper)
12647 !! article
12648 Template:dangerous
12649 !!text
12650 @<span onmouseover="alert('crap')">Oh no</span>
12651 !!endarticle
12652
12653 !!test
12654 (confirming safety of fix for subst bug 1936)
12655 !! wikitext
12656 {{Template:dangerous}}
12657 !! html
12658 <p>@<span>Oh no</span>
12659 </p>
12660 !! end
12661
12662 !! test
12663 pre-save transform: comment containing gallery (bug 5024)
12664 !! options
12665 pst
12666 !! wikitext
12667 <!-- <gallery>data</gallery> -->
12668 !! html/php
12669 <!-- <gallery>data</gallery> -->
12670 !!end
12671
12672 !! test
12673 pre-save transform: comment containing extension
12674 !! options
12675 pst
12676 !! wikitext
12677 <!-- <tag>data</tag> -->
12678 !! html/php
12679 <!-- <tag>data</tag> -->
12680 !!end
12681
12682 !! test
12683 pre-save transform: comment containing nowiki
12684 !! options
12685 pst
12686 !! wikitext
12687 <!-- <nowiki>data</nowiki> -->
12688 !! html/php
12689 <!-- <nowiki>data</nowiki> -->
12690 !!end
12691
12692 !! test
12693 pre-save transform: <noinclude> in subst (bug 3298)
12694 !! options
12695 pst
12696 !! wikitext
12697 {{subst:Includes}}
12698 !! html/php
12699 Foobar
12700 !! end
12701
12702 !! test
12703 pre-save transform: <onlyinclude> in subst (bug 3298)
12704 !! options
12705 pst
12706 !! wikitext
12707 {{subst:Includes2}}
12708 !! html/php
12709 Foo
12710 !! end
12711
12712 !! article
12713 Template:SubstTest
12714 !!text
12715 {{<includeonly>subst:</includeonly>Includes}}
12716 !! endarticle
12717
12718 !! article
12719 Template:SafeSubstTest
12720 !! text
12721 {{<includeonly>safesubst:</includeonly>Includes}}
12722 !! endarticle
12723
12724 !! test
12725 bug 22297: safesubst: works during PST
12726 !! options
12727 pst
12728 !! wikitext
12729 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12730 !! html/php
12731 FoobarFoobar
12732 !! end
12733
12734 !! test
12735 bug 22297: safesubst: works during normal parse
12736 !! wikitext
12737 {{SafeSubstTest}}
12738 !! html
12739 <p>Foobar
12740 </p>
12741 !! end
12742
12743 !! test
12744 subst: does not work during normal parse
12745 !! wikitext
12746 {{SubstTest}}
12747 !! html
12748 <p>{{subst:Includes}}
12749 </p>
12750 !! end
12751
12752 !! test
12753 pre-save transform: context links ("pipe trick")
12754 !! options
12755 pst
12756 !! wikitext
12757 [[Article (context)|]]
12758 [[Bar:Article|]]
12759 [[:Bar:Article|]]
12760 [[Bar:Article (context)|]]
12761 [[:Bar:Article (context)|]]
12762 [[|Article]]
12763 [[|Article (context)]]
12764 [[Bar:X (Y) Z|]]
12765 [[:Bar:X (Y) Z|]]
12766 !! html/php
12767 [[Article (context)|Article]]
12768 [[Bar:Article|Article]]
12769 [[:Bar:Article|Article]]
12770 [[Bar:Article (context)|Article]]
12771 [[:Bar:Article (context)|Article]]
12772 [[Article]]
12773 [[Article (context)]]
12774 [[Bar:X (Y) Z|X (Y) Z]]
12775 [[:Bar:X (Y) Z|X (Y) Z]]
12776 !! end
12777
12778 !! test
12779 pre-save transform: context links ("pipe trick") with interwiki prefix
12780 !! options
12781 pst
12782 !! wikitext
12783 [[interwiki:Article|]]
12784 [[:interwiki:Article|]]
12785 [[interwiki:Bar:Article|]]
12786 [[:interwiki:Bar:Article|]]
12787 !! html/php
12788 [[interwiki:Article|Article]]
12789 [[:interwiki:Article|Article]]
12790 [[interwiki:Bar:Article|Bar:Article]]
12791 [[:interwiki:Bar:Article|Bar:Article]]
12792 !! end
12793
12794 !! test
12795 pre-save transform: context links ("pipe trick") with parens in title
12796 !! options
12797 pst title=[[Somearticle (context)]]
12798 !! wikitext
12799 [[|Article]]
12800 !! html/php
12801 [[Article (context)|Article]]
12802 !! end
12803
12804 !! test
12805 pre-save transform: context links ("pipe trick") with comma in title
12806 !! options
12807 pst title=[[Someplace, Somewhere]]
12808 !! wikitext
12809 [[|Otherplace]]
12810 [[Otherplace, Elsewhere|]]
12811 [[Otherplace, Elsewhere, Anywhere|]]
12812 !! html/php
12813 [[Otherplace, Somewhere|Otherplace]]
12814 [[Otherplace, Elsewhere|Otherplace]]
12815 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12816 !! end
12817
12818 !! test
12819 pre-save transform: context links ("pipe trick") with parens and comma
12820 !! options
12821 pst title=[[Someplace (IGNORED), Somewhere]]
12822 !! wikitext
12823 [[|Otherplace]]
12824 [[Otherplace (place), Elsewhere|]]
12825 !! html/php
12826 [[Otherplace, Somewhere|Otherplace]]
12827 [[Otherplace (place), Elsewhere|Otherplace]]
12828 !! end
12829
12830 !! test
12831 pre-save transform: context links ("pipe trick") with comma and parens
12832 !! options
12833 pst title=[[Who, me? (context)]]
12834 !! wikitext
12835 [[|Yes, you.]]
12836 [[Me, Myself, and I (1937 song)|]]
12837 !! html/php
12838 [[Yes, you. (context)|Yes, you.]]
12839 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12840 !! end
12841
12842 !! test
12843 pre-save transform: context links ("pipe trick") with namespace
12844 !! options
12845 pst title=[[Ns:Somearticle]]
12846 !! wikitext
12847 [[|Article]]
12848 !! html/php
12849 [[Ns:Article|Article]]
12850 !! end
12851
12852 !! test
12853 pre-save transform: context links ("pipe trick") with namespace and parens
12854 !! options
12855 pst title=[[Ns:Somearticle (context)]]
12856 !! wikitext
12857 [[|Article]]
12858 !! html/php
12859 [[Ns:Article (context)|Article]]
12860 !! end
12861
12862 !! test
12863 pre-save transform: context links ("pipe trick") with namespace and comma
12864 !! options
12865 pst title=[[Ns:Somearticle, Context, Whatever]]
12866 !! wikitext
12867 [[|Article]]
12868 !! html/php
12869 [[Ns:Article, Context, Whatever|Article]]
12870 !! end
12871
12872 !! test
12873 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12874 !! options
12875 pst title=[[Ns:Somearticle, Context (context)]]
12876 !! wikitext
12877 [[|Article]]
12878 !! html/php
12879 [[Ns:Article (context)|Article]]
12880 !! end
12881
12882 !! test
12883 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12884 !! options
12885 pst title=[[Ns:Somearticle (IGNORED), Context]]
12886 !! wikitext
12887 [[|Article]]
12888 !! html/php
12889 [[Ns:Article, Context|Article]]
12890 !! end
12891
12892 !! test
12893 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12894 !! options
12895 pst
12896 !! wikitext
12897 [[Article(context)|]]
12898 [[Bar:Article(context)|]]
12899 [[:Bar:Article(context)|]]
12900 [[|Article(context)]]
12901 [[Bar:X(Y)Z|]]
12902 [[:Bar:X(Y)Z|]]
12903 !! html/php
12904 [[Article(context)|Article]]
12905 [[Bar:Article(context)|Article]]
12906 [[:Bar:Article(context)|Article]]
12907 [[Article(context)]]
12908 [[Bar:X(Y)Z|X(Y)Z]]
12909 [[:Bar:X(Y)Z|X(Y)Z]]
12910 !! end
12911
12912 !! test
12913 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12914 !! options
12915 pst
12916 !! wikitext
12917 [[Article (context)|]]
12918 [[Bar:Article (context)|]]
12919 [[:Bar:Article (context)|]]
12920 [[|Article (context)]]
12921 [[Bar:X (Y) Z|]]
12922 [[:Bar:X (Y) Z|]]
12923 !! html/php
12924 [[Article (context)|Article]]
12925 [[Bar:Article (context)|Article]]
12926 [[:Bar:Article (context)|Article]]
12927 [[Article (context)]]
12928 [[Bar:X (Y) Z|X (Y) Z]]
12929 [[:Bar:X (Y) Z|X (Y) Z]]
12930 !! end
12931
12932 !! test
12933 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12934 !! options
12935 pst
12936 !! wikitext
12937 [[Article(context)|]]
12938 [[Bar:Article(context)|]]
12939 [[:Bar:Article(context)|]]
12940 [[|Article(context)]]
12941 [[Bar:X(Y)Z|]]
12942 [[:Bar:X(Y)Z|]]
12943 !! html/php
12944 [[Article(context)|Article]]
12945 [[Bar:Article(context)|Article]]
12946 [[:Bar:Article(context)|Article]]
12947 [[Article(context)]]
12948 [[Bar:X(Y)Z|X(Y)Z]]
12949 [[:Bar:X(Y)Z|X(Y)Z]]
12950 !! end
12951
12952 !! test
12953 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12954 !! options
12955 pst
12956 !! wikitext
12957 [[Article (context), context|]]
12958 [[Article (context),context|]]
12959 [[Bar:Article (context), context|]]
12960 [[Bar:Article (context),context|]]
12961 [[:Bar:Article (context), context|]]
12962 [[:Bar:Article (context),context|]]
12963 !! html/php
12964 [[Article (context), context|Article]]
12965 [[Article (context),context|Article]]
12966 [[Bar:Article (context), context|Article]]
12967 [[Bar:Article (context),context|Article]]
12968 [[:Bar:Article (context), context|Article]]
12969 [[:Bar:Article (context),context|Article]]
12970 !! end
12971
12972 !! test
12973 pre-save transform: trim trailing empty lines
12974 !! options
12975 pst
12976 !! wikitext
12977 Empty lines are trimmed
12978
12979
12980
12981
12982 !! html/php
12983 Empty lines are trimmed
12984 !! end
12985
12986 !! test
12987 pre-save transform: Signature expansion
12988 !! options
12989 pst
12990 !! wikitext
12991 * ~~~
12992 * <noinclude>~~~</noinclude>
12993 * <includeonly>~~~</includeonly>
12994 * <onlyinclude>~~~</onlyinclude>
12995 !! html/php
12996 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12997 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12998 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12999 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13000 !! end
13001
13002
13003 !! test
13004 pre-save transform: Signature expansion in nowiki tags (bug 93)
13005 !! options
13006 pst disabled
13007 !! wikitext
13008 Shall not expand:
13009
13010 <nowiki>~~~~</nowiki>
13011
13012 <includeonly><nowiki>~~~~</nowiki></includeonly>
13013
13014 <noinclude><nowiki>~~~~</nowiki></noinclude>
13015
13016 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13017
13018 {{subst:Foo}} shall be converted to FOO
13019
13020 As well as inside noinclude/onlyinclude
13021 <noinclude>{{subst:Foo}}</noinclude>
13022 <onlyinclude>{{subst:Foo}}</onlyinclude>
13023
13024 But not inside includeonly
13025 <includeonly>{{subst:Foo}}</includeonly>
13026 !! html/php
13027 Shall not expand:
13028
13029 <nowiki>~~~~</nowiki>
13030
13031 <includeonly><nowiki>~~~~</nowiki></includeonly>
13032
13033 <noinclude><nowiki>~~~~</nowiki></noinclude>
13034
13035 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13036
13037 FOO shall be converted to FOO
13038
13039 As well as inside noinclude/onlyinclude
13040 <noinclude>FOO</noinclude>
13041 <onlyinclude>FOO</onlyinclude>
13042
13043 But not inside includeonly
13044 <includeonly>{{subst:Foo}}</includeonly>
13045 !! end
13046
13047 !! test
13048 Parsoid: Recognize nowiki with trailing space in tags
13049 !! options
13050 parsoid=wt2html
13051 !! wikitext
13052 <nowiki ><div>[[foo]]</nowiki >
13053
13054 a<nowiki / >b
13055
13056 c<nowiki />d
13057
13058 e<nowiki/ >f
13059 !! html
13060 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13061 <p>ab</p>
13062 <p>cd</p>
13063 <p>ef</p>
13064 !! end
13065
13066 !! test
13067 Parsoid: Recognize nowiki with odd capitalization
13068 !! options
13069 parsoid=wt2html
13070 !! wikitext
13071 <noWikI ><div>[[foo]]</Nowiki >
13072 !! html
13073 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13074 !! end
13075
13076
13077 !! test
13078 Parsoid: Escape nowiki with trailing space in tags
13079 !! options
13080 parsoid=html2wt
13081 !! html/parsoid
13082 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13083 <p>a&lt;nowiki /&gt;b</p>
13084 <p>c&lt;nowiki/ &gt;d</p>
13085 !! wikitext
13086 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13087
13088 a&lt;nowiki /&gt;b
13089
13090 c&lt;nowiki/ &gt;d
13091 !! end
13092
13093 !! test
13094 Parsoid: Escape weird noWikI capitalizations
13095 !! options
13096 parsoid=html2wt
13097 !! html/parsoid
13098 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13099 !! wikitext
13100 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13101 !! end
13102
13103 ###
13104 ### Message transform tests
13105 ###
13106 !! test
13107 message transform: magic variables
13108 !! options
13109 msg
13110 !! wikitext
13111 {{SITENAME}}
13112 !! html
13113 MediaWiki
13114 !! end
13115
13116 !! test
13117 message transform: should not transform wiki markup
13118 !! options
13119 msg
13120 !! wikitext
13121 ''test''
13122 !! html
13123 ''test''
13124 !! end
13125
13126 !! test
13127 message transform: <noinclude> in transcluded template (bug 4926)
13128 !! options
13129 msg
13130 !! wikitext
13131 {{Includes}}
13132 !! html
13133 Foobar
13134 !! end
13135
13136 !! test
13137 message transform: <onlyinclude> in transcluded template (bug 4926)
13138 !! options
13139 msg
13140 !! wikitext
13141 {{Includes2}}
13142 !! html
13143 Foo
13144 !! end
13145
13146 !! test
13147 {{#special:}} page name, known
13148 !! options
13149 msg
13150 !! wikitext
13151 {{#special:Recentchanges}}
13152 !! html
13153 Special:RecentChanges
13154 !! end
13155
13156 !! test
13157 {{#special:}} page name with subpage, known
13158 !! options
13159 msg
13160 !! wikitext
13161 {{#special:Recentchanges/param}}
13162 !! html
13163 Special:RecentChanges/param
13164 !! end
13165
13166 !! test
13167 {{#special:}} page name, unknown
13168 !! options
13169 msg
13170 !! wikitext
13171 {{#special:foobar nonexistent}}
13172 !! html
13173 Special:Foobar nonexistent
13174 !! end
13175
13176 !! test
13177 {{#speciale:}} page name, known
13178 !! options
13179 msg
13180 !! wikitext
13181 {{#speciale:Recentchanges}}
13182 !! html
13183 Special:RecentChanges
13184 !! end
13185
13186 !! test
13187 {{#speciale:}} page name with subpage, known
13188 !! options
13189 msg
13190 !! wikitext
13191 {{#speciale:Recentchanges/param}}
13192 !! html
13193 Special:RecentChanges/param
13194 !! end
13195
13196 !! test
13197 {{#speciale:}} page name, unknown
13198 !! options
13199 msg
13200 !! wikitext
13201 {{#speciale:foobar nonexistent}}
13202 !! html
13203 Special:Foobar_nonexistent
13204 !! end
13205
13206 ###
13207 ### Images
13208 ###
13209 ### For Parsoid-specific tests, see
13210 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13211
13212 !! test
13213 Simple image
13214 !! options
13215 parsoid=wt2html,wt2wt,html2html
13216 !! wikitext
13217 [[Image: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 Simple image (using File: namespace, now canonical)
13227 !! wikitext
13228 [[File:Foobar.jpg]]
13229 !! html/php
13230 <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>
13231 </p>
13232 !! html/parsoid
13233 <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>
13234 !! end
13235
13236 !! test
13237 Right-aligned image
13238 !! wikitext
13239 [[File:Foobar.jpg|right]]
13240 !! html/php
13241 <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>
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></figure>
13245 !! end
13246
13247 !! test
13248 Image with caption
13249 !! wikitext
13250 [[File:Foobar.jpg|right|Caption text]]
13251 !! html/php
13252 <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>
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 text</figcaption></figure>
13256 !! end
13257
13258 !! test
13259 Image with caption, bug 53312 #1
13260 !! wikitext
13261 [[File:Foobar.jpg|right|Caption page stuff]]
13262 !! html/php
13263 <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>
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 stuff</figcaption></figure>
13267 !! end
13268
13269 !! test
13270 Image with caption, bug 53312 #2
13271 !! wikitext
13272 [[File:Foobar.jpg|right|Caption page=]]
13273 !! html/php
13274 <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>
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=</figcaption></figure>
13278 !! end
13279
13280 !! test
13281 Image with caption, bug 53312 #3
13282 !! wikitext
13283 [[File:Foobar.jpg|right|Caption page=stuff]]
13284 !! html/php
13285 <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>
13286
13287 !! html/parsoid
13288 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
13289 !! end
13290
13291 !! test
13292 Allow empty links in image captions (Bug 60753)
13293 !! options
13294 thumbsize=220
13295 !! wikitext
13296 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13297 [[]]
13298 [[Link2]]
13299 ]]
13300 !! html/php
13301 <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>
13302
13303 !! html/parsoid
13304 <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>
13305 [[]]
13306 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13307 </figcaption></figure>
13308 !! end
13309
13310 !! test
13311 Titles in unlinked images (T23454)
13312 !! wikitext
13313 [[File:Foobar.jpg|link=|stuff]]
13314 !! html/php
13315 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13316 </p>
13317 !! end
13318
13319 !! test
13320 Link with empty target
13321 !! wikitext
13322 [[]]
13323 !! html
13324 <p>[[]]
13325 </p>
13326 !! end
13327
13328 !! test
13329 Image with link trail
13330 !! wikitext
13331 Linktrails should not work for images: [[File:Foobar.jpg]]s
13332 !! html/php
13333 <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
13334 </p>
13335 !! html/parsoid
13336 <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>
13337 !! end
13338
13339 !! test
13340 Image with empty attribute
13341 !! options
13342 parsoid=wt2html,wt2wt,html2html
13343 !! wikitext
13344 [[File:Foobar.jpg|right||Caption text]]
13345 !! html/php
13346 <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>
13347
13348 !! html/parsoid
13349 <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>
13350 !! end
13351
13352 !! test
13353 1. Block image with individual attributes from templates
13354 !! wikitext
13355 [[File:Foobar.jpg|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="#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>
13361 !! end
13362
13363 !! test
13364 2. Block Image with individual attributes from templates
13365 !! wikitext
13366 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13367 !! html/php
13368 <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>
13369
13370 !! html/parsoid
13371 <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>
13372 !! end
13373
13374 !! test
13375 3. Inline image with individual attributes from templates
13376 !! wikitext
13377 [[File:Foobar.jpg|{{echo|50px}}]]
13378 !! html/php
13379 <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>
13380 </p>
13381 !! html/parsoid
13382 <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>
13383 !! end
13384
13385 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13386 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13387 !! test
13388 Image with multiple attributes from the same template
13389 !! wikitext
13390 [[File:Foobar.jpg|{{image_attribs}}]]
13391 !! html/php
13392 <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>
13393
13394 !! html/parsoid
13395 <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>
13396 !! end
13397
13398 !! test
13399 Image with link tails
13400 !! options
13401 thumbsize=220
13402 !! wikitext
13403 123[[File:Foobar.jpg]]456
13404 123[[File:Foobar.jpg|right]]456
13405 123[[File:Foobar.jpg|thumb]]456
13406 !! html/php
13407 <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
13408 </p>
13409 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
13410 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
13411
13412 !! html/php+tidy
13413 <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>
13414 <p>123</p>
13415 <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>
13416 <p>456 123</p>
13417 <div class="thumb tright">
13418 <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>
13419 <div class="thumbcaption">
13420 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13421 </div>
13422 </div>
13423 </div>
13424 <p>456</p>
13425 !! html/parsoid
13426 <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>
13427 <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>
13428 <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>
13429 !! end
13430
13431 !! test
13432 Image with multiple captions -- only last one is accepted
13433 !! wikitext
13434 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13435 !! html/php
13436 <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>
13437
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 !! test
13443 Image with multiple widths -- use last
13444 !! wikitext
13445 [[File:Foobar.jpg|200px|300px|caption]]
13446 !! html/php
13447 <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>
13448 </p>
13449 !! html/parsoid
13450 <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>
13451 !! end
13452
13453 !! test
13454 Image with multiple alignments -- use first (bug 48664)
13455 !! options
13456 thumbsize=220
13457 !! wikitext
13458 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13459
13460 [[File:Foobar.jpg|middle|text-top|caption]]
13461 !! html/php
13462 <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>
13463 <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>
13464 </p>
13465 !! html/parsoid
13466 <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>
13467 <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>
13468 !! end
13469
13470 !! test
13471 Image with width attribute at different positions
13472 !! wikitext
13473 [[File:Foobar.jpg|200px|right|Caption]]
13474 [[File:Foobar.jpg|right|200px|Caption]]
13475 [[File:Foobar.jpg|right|Caption|200px]]
13476 !! html/php
13477 <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>
13478 <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>
13479 <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>
13480
13481 !! html/parsoid
13482 <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>
13483 <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>
13484 <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>
13485 !! end
13486
13487 # a sad bit of backward-compatibility
13488 !! test
13489 Image with size specified with pxpx (bug 13500, 51628)
13490 !! options
13491 parsoid=wt2html,wt2wt,html2html
13492 !! wikitext
13493 [[File:Foobar.jpg|20pxpx]]
13494 [[File:Foobar.jpg|200x20pxpx]]
13495 !! html/php
13496 <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>
13497 <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>
13498 </p>
13499 !! html/parsoid
13500 <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>
13501 !! end
13502
13503 !! test
13504 Image with link parameter, wiki target
13505 !! wikitext
13506 [[File:Foobar.jpg|link=Main Page]]
13507 !! html/php
13508 <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>
13509 </p>
13510 !! html/parsoid
13511 <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>
13512 !! end
13513
13514 # parsoid bug 49293 (part 1)
13515 !! test
13516 Image with link parameter, URL target
13517 !! wikitext
13518 [[File:Foobar.jpg|link=http://example.com/]]
13519 !! html/php
13520 <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>
13521 </p>
13522 !! html/parsoid
13523 <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>
13524 !! end
13525
13526 # parsoid bug 49293 (part 2)
13527 !! test
13528 Image with link parameter, protocol-less URL target
13529 !! wikitext
13530 [[File:Foobar.jpg|link=//example.com/]]
13531 !! html/php
13532 <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>
13533 </p>
13534 !! html/parsoid
13535 <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>
13536 !! end
13537
13538 !! test
13539 Escaping non-block captions (T107435)
13540 !! options
13541 parsoid={
13542 "modes": ["wt2wt"],
13543 "changes": [
13544 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13545 ]
13546 }
13547 !! wikitext
13548 [[Image:Foobar.jpg|caption]]
13549 !! wikitext/edited
13550 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13551 !! end
13552
13553 # wgExternalLinkTarget not supported by Parsoid
13554 !! test
13555 Image with link parameter, wgExternalLinkTarget
13556 !! wikitext
13557 [[Image:foobar.jpg|link=http://example.com/]]
13558 !! config
13559 wgExternalLinkTarget='foobar'
13560 !! html/php
13561 <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>
13562 </p>
13563 !! end
13564
13565 !! test
13566 Image with link parameter, wgNoFollowLinks set to false
13567 !! wikitext
13568 [[Image:foobar.jpg|link=http://example.com/]]
13569 !! config
13570 wgNoFollowLinks=false
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 !! test
13577 Image with link parameter, wgNoFollowDomainExceptions
13578 !! wikitext
13579 [[Image:foobar.jpg|link=http://example.com/]]
13580 !! config
13581 wgNoFollowDomainExceptions='example.com'
13582 !! html
13583 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13584 </p>
13585 !! end
13586
13587 # wgExternalLinkTarget not supported by Parsoid
13588 !! test
13589 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13590 !! wikitext
13591 [[Image:foobar.jpg|link=http://example.com/|Title]]
13592 !! config
13593 wgExternalLinkTarget='foobar'
13594 !! html/php
13595 <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>
13596 </p>
13597 !! end
13598
13599 !! test
13600 Image with empty link parameter
13601 !! wikitext
13602 [[File:Foobar.jpg|link=]]
13603 !! html/php
13604 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13605 </p>
13606 !! html/parsoid
13607 <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>
13608 !! end
13609
13610 !! test
13611 Image with link parameter (wiki target) and unnamed parameter
13612 !! wikitext
13613 [[File:Foobar.jpg|link=Main_Page|Title]]
13614 !! html/php
13615 <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>
13616 </p>
13617 !! html/parsoid
13618 <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>
13619 !! end
13620
13621 !! test
13622 Image with link parameter (URL target) and unnamed parameter
13623 !! wikitext
13624 [[File:Foobar.jpg|link=http://example.com/|Title]]
13625 !! html/php
13626 <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>
13627 </p>
13628 !! html/parsoid
13629 <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>
13630 !! end
13631
13632 !! test
13633 Thumbnail image with link parameter
13634 !! options
13635 thumbsize=220
13636 parsoid=wt2html,wt2wt,html2html
13637 !! wikitext
13638 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13639 !! html/php
13640 <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>
13641
13642 !! html/parsoid
13643 <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>
13644 !! end
13645
13646 !! test
13647 Manually-specified thumbnail image
13648 !! options
13649 thumbsize=220
13650 !! wikitext
13651 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13652 !! html/php
13653 <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>
13654
13655 !! html/parsoid
13656 <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>
13657 !! end
13658
13659 !! test
13660 Manually-specified thumbnail image with explicit link to wiki page
13661 !! options
13662 thumbsize=220
13663 parsoid=wt2html,wt2wt,html2html
13664 !! wikitext
13665 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13666 !! html/php
13667 <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>
13668
13669 !! html/parsoid
13670 <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>
13671 !! end
13672
13673 !! test
13674 Manually-specified thumbnail image with explicit link to url
13675 !! options
13676 thumbsize=220
13677 parsoid=wt2html,wt2wt,html2html
13678 !! wikitext
13679 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13680 !! html/php
13681 <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>
13682
13683 !! html/parsoid
13684 <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>
13685 !! end
13686
13687 !! test
13688 Manually-specified thumbnail image with explicit no link
13689 !! options
13690 thumbsize=220
13691 parsoid=wt2html,wt2wt,html2html
13692 !! wikitext
13693 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13694 !! html/php
13695 <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>
13696
13697 !! html/parsoid
13698 <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>
13699 !! end
13700
13701 !! test
13702 Manually-specified thumbnail image with explicit link and alt text
13703 !! options
13704 thumbsize=220
13705 parsoid=wt2html,wt2wt,html2html
13706 !! wikitext
13707 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13708 !! html/php
13709 <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>
13710
13711 !! html/parsoid
13712 <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>
13713 !! end
13714
13715 !! test
13716 Image with frame and link
13717 !! options
13718 parsoid=wt2html,wt2wt,html2html
13719 !! wikitext
13720 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13721 !! html/php
13722 <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>
13723
13724 !! html/parsoid
13725 <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>
13726 !! end
13727
13728 !! test
13729 Image with frame and link and explicit alt
13730 !! options
13731 parsoid=wt2html,wt2wt,html2html
13732 !! wikitext
13733 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13734 !! html/php
13735 <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>
13736
13737 !! html/parsoid
13738 <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>
13739 !! end
13740
13741 !! test
13742 Image with wiki markup in implicit alt
13743 !! wikitext
13744 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13745
13746 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13747 !! html/php
13748 <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>
13749 </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>
13750 </p>
13751 !! html/parsoid
13752 <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>
13753
13754 <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>
13755 !! end
13756
13757 !! test
13758 Alt image option should handle most kinds of wikitext without barfing
13759 !! wikitext
13760 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13761 !! html/php
13762 <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>
13763
13764 !! html/parsoid
13765 <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>
13766 !! end
13767
13768 ###################
13769 # Conflicting image format options.
13770 # First option specified should 'win'.
13771 # All three cases in each test should be identical.
13772
13773 !! test
13774 Image with 'frameless' first.
13775 !! options
13776 parsoid=wt2html,wt2wt,html2html
13777 !! wikitext
13778 [[File:Foobar.jpg|frameless|caption]]
13779
13780 [[File:Foobar.jpg|frameless|frame|caption]]
13781
13782 [[File:Foobar.jpg|frameless|thumb|caption]]
13783 !! html/php
13784 <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>
13785 </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>
13786 </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>
13787 </p>
13788 !! html/parsoid
13789 <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>
13790 <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>
13791 <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>
13792 !! end
13793
13794 !! test
13795 Image with 'frame' first.
13796 !! options
13797 parsoid=wt2html,wt2wt,html2html
13798 !! wikitext
13799 [[File:Foobar.jpg|frame|caption]]
13800 [[File:Foobar.jpg|frame|frameless|caption]]
13801 [[File:Foobar.jpg|frame|thumb|caption]]
13802 !! html/php
13803 <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>
13804 <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>
13805 <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>
13806
13807 !! html/parsoid
13808 <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>
13809 <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>
13810 <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>
13811 !! end
13812
13813 !! test
13814 Image with 'thumb' first.
13815 !! options
13816 parsoid=wt2html,wt2wt,html2html
13817 !! wikitext
13818 [[File:Foobar.jpg|thumb|caption]]
13819 [[File:Foobar.jpg|thumb|frameless|caption]]
13820 [[File:Foobar.jpg|thumb|frame|caption]]
13821 !! html/php
13822 <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>
13823 <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>
13824 <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>
13825
13826 !! html/parsoid
13827 <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>
13828 <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>
13829 <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>
13830 !! end
13831
13832 ###################
13833 # Image sizing.
13834 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13835 # and https://phabricator.wikimedia.org/T64258
13836 # Foobar has actual size of 1941x220
13837 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13838 # a scalable format.
13839 # 2. Framed images always ignore size options; always render at default size.
13840 # 3. "Unspecified format" and border are the only types which can be
13841 # enlarged.
13842
13843 !! test
13844 Image: "unspecified format" and border enlarge
13845 !! options
13846 parsoid=wt2html,wt2wt,html2html
13847 !! wikitext
13848 [[File:Foobar.jpg|2000px]]
13849
13850 [[File:Foobar.jpg|border|2000px]]
13851 !! html/php
13852 <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>
13853 </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>
13854 </p>
13855 !! html/parsoid
13856 <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>
13857 <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>
13858 !! end
13859
13860 !! test
13861 Image: "unspecified format" and border reduce
13862 !! options
13863 parsoid=wt2html,wt2wt,html2html
13864 !! wikitext
13865 [[File:Foobar.jpg|1000px]]
13866
13867 [[File:Foobar.jpg|border|1000px]]
13868 !! html/php
13869 <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>
13870 </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>
13871 </p>
13872 !! html/parsoid
13873 <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>
13874 <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>
13875 !! end
13876
13877 !! test
13878 Image: thumbs reduce
13879 !! options
13880 parsoid=wt2html,wt2wt,html2html
13881 !! wikitext
13882 [[File:Foobar.jpg|thumb|50px]]
13883 !! html/php
13884 <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>
13885
13886 !! html/parsoid
13887 <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>
13888 !! end
13889
13890 !! test
13891 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13892 !! options
13893 parsoid=wt2html,wt2wt,html2html
13894 !! wikitext
13895 [[File:Foobar.jpg|thumb|2000px]]
13896
13897 [[File:Foobar.svg|thumb|2000px]]
13898 !! html/php
13899 <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>
13900 <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>
13901
13902 !! html/parsoid
13903 <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>
13904 <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>
13905 !! end
13906
13907 !! test
13908 Image: frameless can reduce in size
13909 !! options
13910 parsoid=wt2html,wt2wt,html2html
13911 !! wikitext
13912 [[File:Foobar.jpg|frameless|50px]]
13913 !! html/php
13914 <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>
13915 </p>
13916 !! html/parsoid
13917 <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>
13918 !! end
13919
13920 !! test
13921 Image: bitmap frameless can't be enlarged past original size, but vector can
13922 !! options
13923 parsoid=wt2html,wt2wt,html2html
13924 !! wikitext
13925 [[File:Foobar.jpg|frameless|2000px]]
13926
13927 [[File:Foobar.svg|frameless|2000px]]
13928 !! html/php
13929 <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>
13930 </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>
13931 </p>
13932 !! html/parsoid
13933 <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>
13934 <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>
13935 !! end
13936
13937 !! test
13938 Image: framed images are always unscaled.
13939 !! options
13940 parsoid=wt2html,wt2wt,html2html
13941 !! wikitext
13942 [[File:Foobar.jpg|frame]]
13943
13944 [[File:Foobar.jpg|frame|50px]]
13945
13946 [[File:Foobar.jpg|frame|50x50px]]
13947
13948 [[File:Foobar.jpg|frame|2000px]]
13949 !! html/php
13950 <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>
13951 <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>
13952 <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>
13953 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13954
13955 !! html/parsoid
13956 <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>
13957 <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>
13958 <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>
13959 <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>
13960 !! end
13961
13962 ###################
13963
13964 !! test
13965 Link to image page- image page normally doesn't exists, hence edit link
13966 Add test with existing image page
13967 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13968 !! wikitext
13969 [[:Image:test]]
13970 !! html
13971 <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>
13972 </p>
13973 !! end
13974
13975 !! test
13976 bug 18784 Link to non-existent image page with caption should use caption as link text
13977 !! wikitext
13978 [[:Image:test|caption]]
13979 !! html
13980 <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>
13981 </p>
13982 !! end
13983
13984 !! test
13985 Frameless image caption with a free URL
13986 !! wikitext
13987 [[File:Foobar.jpg|http://example.com]]
13988 !! html/php
13989 <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>
13990 </p>
13991 !! html/parsoid
13992 <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>
13993 !! end
13994
13995 !! test
13996 Thumbnail image caption with a free URL
13997 !! options
13998 thumbsize=220
13999 !! wikitext
14000 [[File:Foobar.jpg|thumb|http://example.com]]
14001 !! html/php
14002 <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>
14003
14004 !! html/parsoid
14005 <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>
14006 !! end
14007
14008 !! test
14009 Thumbnail image caption with a free URL and explicit alt
14010 !! options
14011 thumbsize=220
14012 parsoid=wt2html,wt2wt,html2html
14013 !! wikitext
14014 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14015 !! html/php
14016 <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>
14017
14018 !! html/parsoid
14019 <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>
14020 !! end
14021
14022 !! test
14023 SVG thumbnails with no language set
14024 !! options
14025 !! wikitext
14026 [[File:Foobar.svg|thumb|caption]]
14027 !! html/php
14028 <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>
14029
14030 !! html/parsoid
14031 <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>
14032 !! end
14033
14034 !! test
14035 SVG thumbnails with language de
14036 !! options
14037 parsoid=wt2html,wt2wt,html2html
14038 !! wikitext
14039 [[File:Foobar.svg|thumb|caption|lang=de]]
14040 !! html/php
14041 <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>
14042
14043 !! html/parsoid
14044 <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>
14045 !! end
14046
14047 !! test
14048 SVG thumbnails with invalid language code
14049 !! options
14050 parsoid=wt2html,wt2wt,html2html
14051 !! wikitext
14052 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14053 !! html/php
14054 <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>
14055
14056 !! html/parsoid
14057 <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>
14058 !! end
14059
14060 !! test
14061 BUG 1887: A ISBN with a thumbnail
14062 !! wikitext
14063 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
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><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</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><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
14069 !! end
14070
14071 !! test
14072 BUG 1887: A RFC with a thumbnail
14073 !! wikitext
14074 [[File:Foobar.jpg|thumb|This is RFC 12354]]
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>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</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>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
14080 !! end
14081
14082 !! test
14083 BUG 1887: A mailto link with a thumbnail
14084 !! wikitext
14085 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14086 !! html/php
14087 <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>
14088
14089 !! html/parsoid
14090 <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>
14091 !! end
14092
14093 # Pending resolution to bug 368
14094 !! test
14095 BUG 648: Frameless image caption with a link
14096 !! wikitext
14097 [[File:Foobar.jpg|text with a [[link]] in it]]
14098 !! html/php
14099 <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>
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]] 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>
14103 !! end
14104
14105 !! test
14106 BUG 648: Frameless image caption with a link (suffix)
14107 !! wikitext
14108 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14109 !! html/php
14110 <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>
14111 </p>
14112 !! html/parsoid
14113 <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>
14114 !! end
14115
14116 !! test
14117 BUG 648: Frameless image caption with an interwiki link
14118 !! wikitext
14119 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14120 !! html/php
14121 <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>
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]] 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>
14125 !! end
14126
14127 !! test
14128 BUG 648: Frameless image caption with a piped interwiki link
14129 !! wikitext
14130 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14131 !! html/php
14132 <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>
14133 </p>
14134 !! html/parsoid
14135 <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>
14136 !! end
14137
14138 !! test
14139 T107474: Frameless image caption with <nowiki>
14140 !! wikitext
14141 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14142 !! html/parsoid
14143 <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>
14144 !! end
14145
14146 !! test
14147 Escape HTML special chars in image alt text
14148 !! wikitext
14149 [[File:Foobar.jpg|& < > "]]
14150 !! html/php
14151 <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>
14152 </p>
14153 !! html/parsoid
14154 <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>
14155 !! end
14156
14157 !! test
14158 Entities in file name and attributes
14159 !! wikitext
14160 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14161 !! html/php
14162 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14163 </p>
14164 !! html/parsoid
14165 <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>
14166 !! end
14167
14168 !! test
14169 BUG 499: Alt text should have &#1234;, not &amp;1234;
14170 !! wikitext
14171 [[File:Foobar.jpg|&#9792;]]
14172 !! html/php
14173 <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>
14174 </p>
14175 !! html/parsoid
14176 <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>
14177 !! end
14178
14179 !! test
14180 Broken image caption with link
14181 !! options
14182 parsoid=wt2html,wt2wt,html2html
14183 !! wikitext
14184 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14185 !! html/php
14186 <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.
14187 </p>
14188 !! html/parsoid
14189 <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>
14190 !! end
14191
14192 !! test
14193 Image caption containing another image
14194 !! wikitext
14195 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14196 !! html/php
14197 <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>
14198
14199 !! html/parsoid
14200 <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>
14201 !! end
14202
14203 !! test
14204 Image: caption containing a newline
14205 !! wikitext
14206 [[File:Foobar.jpg|This
14207 *is some text]]
14208 !! html/php
14209 <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>
14210 </p>
14211 !! html/parsoid
14212 <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>
14213 !!end
14214
14215 !!test
14216 Image: caption containing leading space
14217 (The leading space should not trigger nowiki escaping in wt2wt mode)
14218 !! wikitext
14219 [[File:Foobar.jpg|thumb| bar]]
14220 !! html/php
14221 <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>
14222
14223 !! html/parsoid
14224 <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>
14225 !!end
14226
14227 !! test
14228 Image: caption containing a table
14229 !! options
14230 parsoid=wt2html,wt2wt,html2html
14231 !! wikitext
14232 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14233 {|
14234 ! Foo !! Bar
14235 |-
14236 | Foo1 || Bar1
14237 |}
14238 and some more text.]]
14239 !! html/php
14240 <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>
14241
14242 !! html/parsoid
14243 <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
14244 <table>
14245 <tbody>
14246 <tr><th>Foo </th><th>Bar</th></tr>
14247 <tr>
14248 <td>Foo1 </td>
14249 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14250 !! end
14251
14252 !! test
14253 Bug 3090: External links other than http: in image captions
14254 !! wikitext
14255 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14256 !! html/php
14257 <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>
14258
14259 !! html/parsoid
14260 <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>
14261 !! end
14262
14263 !! test
14264 Custom class
14265 !! options
14266 parsoid=wt2html,wt2wt,html2html
14267 !! wikitext
14268 [[Image:foobar.jpg|a|class=b]]
14269 !! html/php
14270 <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>
14271 </p>
14272 !! html/parsoid
14273 <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>
14274 !! end
14275
14276 !! test
14277 Localized image handling (1).
14278 !! options
14279 parsoid=wt2html,wt2wt,html2html
14280 language=es
14281 !! wikitext
14282 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14283 !! html/php
14284 <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>
14285
14286 !! html/parsoid
14287 <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>
14288 !! end
14289
14290 !! test
14291 Localized image handling (2).
14292 !! options
14293 thumbsize=220
14294 parsoid=wt2html,wt2wt,html2html
14295 language=es
14296 !! wikitext
14297 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14298 !! html/php
14299 <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>
14300
14301 !! html/parsoid
14302 <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>
14303 !! end
14304
14305 !! test
14306 Localized image handling (3).
14307 !! options
14308 language=fa
14309 parsoid=html2wt
14310 !! html/parsoid
14311 <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>
14312 !! wikitext
14313 [[File:Foobar.jpg|بندانگشتی]]
14314 !! end
14315
14316 !! test
14317 "border", "frameless" and "class" attributes on an image.
14318 !! options
14319 thumbsize=220
14320 parsoid=wt2html,wt2wt,html2html
14321 !! wikitext
14322 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14323 !! html/php
14324 <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>
14325 </p>
14326 !! html/parsoid
14327 <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>
14328 !! end
14329
14330 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14331 !! test
14332 Invalid image attributes (bug 62500)
14333 !! options
14334 thumbsize=220
14335 parsoid=wt2html,wt2wt,html2html
14336 !! wikitext
14337 [[File:Foobar.jpg|thumb|float|left|caption]]
14338
14339 [[File:Foobar.jpg|thumb|righ|caption]]
14340
14341 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14342 !! html/php
14343 <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>
14344 <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>
14345 <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>
14346
14347 !! html/parsoid
14348 <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>
14349 <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>
14350 <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>
14351 !! end
14352
14353 !! article
14354 File:Barfoo.jpg
14355 !! text
14356 #REDIRECT [[File:Barfoo.jpg]]
14357 !! endarticle
14358
14359 # FIXME: Parsoid should run this test -- but we'd need to teach the
14360 # mockAPI about the redirected Barfoo.jpg image.
14361 !! test
14362 Redirected image
14363 !! wikitext
14364 [[Image:Barfoo.jpg]]
14365 !! html/php
14366 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14367 </p>
14368 !! end
14369
14370 !! test
14371 Missing image with uploads disabled
14372 !! options
14373 wgEnableUploads=0
14374 !! wikitext
14375 [[File:Foobaz.jpg]]
14376 !! html/php
14377 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14378 </p>
14379 !! html/parsoid
14380 <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>
14381 !! end
14382
14383 # Parsoid-specific testing for images
14384 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14385 # Currently imperfect due to a flaw in the Parsoid testrunner
14386 # Work in progress
14387 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14388 # image tests.
14389
14390 !! test
14391 Parsoid-specific image handling - simple image with size and middle alignment
14392 !! wikitext
14393 [[File: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, middle alignment,
14400 non-standard namespace alias
14401 !! options
14402 parsoid=wt2wt,wt2html,html2html
14403 !! wikitext
14404 [[Image:Foobar.jpg|middle|50px]]
14405 !! html/parsoid
14406 <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>
14407 !! end
14408
14409 !! test
14410 Parsoid-specific image handling - simple image with size and middle alignment
14411 (existing content)
14412 !! wikitext
14413 [[File:Foobar.jpg|50px|middle]]
14414 !! html/parsoid
14415 <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>
14416 !! end
14417
14418 !! test
14419 Parsoid-specific image handling - simple image with size and middle alignment
14420 and non-standard namespace name
14421 !! options
14422 parsoid=wt2html,wt2wt,html2html
14423 !! wikitext
14424 [[Image:Foobar.jpg|50px|middle]]
14425 !! html/parsoid
14426 <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>
14427 !! end
14428
14429 !! test
14430 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14431 !! wikitext
14432 [[File:Foobar.jpg|500x10px|baseline|caption]]
14433 !! html/parsoid
14434 <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>
14435 !! end
14436
14437 !! test
14438 Parsoid-specific image handling - simple image with border and size spec
14439 !! wikitext
14440 [[File:Foobar.jpg|50px|border|caption]]
14441 !! html/parsoid
14442 <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>
14443 !! end
14444
14445 !! test
14446 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14447 !! wikitext
14448 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14449 !! html/parsoid
14450 <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>
14451 !! end
14452
14453 !! test
14454 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14455 (existing content)
14456 !! wikitext
14457 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14458 !! html/parsoid
14459 <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>
14460 !! end
14461
14462 !! test
14463 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14464 !! wikitext
14465 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14466 !! html/parsoid
14467 <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>
14468 !! end
14469
14470 !! test
14471 Parsoid-specific image handling - thumbnail with specific size, halign,
14472 valign, and caption (existing content)
14473 !! wikitext
14474 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14475 !! html/parsoid
14476 <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>
14477 !! end
14478
14479 !! test
14480 Parsoid-specific image handling - framed image with specific size and caption
14481 (size is ignored)
14482 !! options
14483 parsoid=wt2html,wt2wt,html2html
14484 !! wikitext
14485 [[File:Foobar.jpg|frame|500x50px|caption]]
14486 !! html/parsoid
14487 <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>
14488 !! end
14489
14490 !! test
14491 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14492 (size is ignored)
14493 !! options
14494 parsoid=wt2html,wt2wt,html2html
14495 !! wikitext
14496 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14497 !! html/parsoid
14498 <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>
14499 !! end
14500
14501 !! test
14502 Parsoid-specific image handling - frameless image with specific size, border, and caption
14503 !! wikitext
14504 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14505 !! html/parsoid
14506 <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>
14507 !! end
14508
14509 !! test
14510 Parsoid-specific image handling - simple image with a formatted caption
14511 !! wikitext
14512 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14513 !! html/parsoid
14514 <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>
14515 !! end
14516
14517 !! test
14518 Parsoid-specific image handling - caption with a template in it
14519 !! wikitext
14520 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14521 !! html/parsoid
14522 <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>
14523 !! end
14524
14525 !! test
14526 Parsoid-specific image handling - caption with unbalanced tags in it
14527 !! options
14528 parsoid=wt2html,wt2wt,html2html
14529 !! wikitext
14530 foo
14531 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14532 bar
14533 !! html/parsoid
14534 <p>foo</p>
14535 <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>
14536 <p>bar</p>
14537 !! end
14538
14539 !! test
14540 Parsoid-specific image handling - empty caption (1)
14541 !! options
14542 parsoid=wt2html,wt2wt
14543 !! wikitext
14544 [[File:Foobar.jpg|thumb|]]
14545 !! html/parsoid
14546 <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>
14547 !! end
14548
14549 # empty captions don't get serialized unless we're in the "round trip" case
14550 !! test
14551 Parsoid-specific image handling - empty caption (2)
14552 !! options
14553 parsoid=html2wt
14554 !! html/parsoid
14555 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14556 <a href="./File:Foobar.jpg">
14557 <img resource="./File:Foobar.jpg"
14558 src="//example.com/images/3/3a/Foobar.jpg"
14559 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14560 height="25" width="220"/>
14561 </a>
14562 <figcaption></figcaption>
14563 </figure>
14564 !! wikitext
14565 [[File:Foobar.jpg|thumb]]
14566 !! end
14567
14568 !! test
14569 Parsoid-specific image handling - whitespace caption
14570 !! wikitext
14571 [[File:Foobar.jpg|thumb| ]]
14572 !! html/parsoid
14573 <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>
14574 !! end
14575
14576 !! test
14577 Parsoid-specific image handling - lang option
14578 !! wikitext
14579 foo
14580 [[File:Foobar.svg|lang=de|caption]]
14581 bar
14582 !! html/parsoid
14583 <p>foo
14584 <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>
14585 bar</p>
14586 !! end
14587
14588 ## Edge case bugs in Parsoid from T93580
14589 !! test
14590 T93580: 1. Templated <ref> inside block images
14591 !! wikitext
14592 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14593
14594 <references />
14595 !! html/parsoid
14596 <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>
14597
14598 <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>
14599 !! end
14600
14601 !! test
14602 T93580: 2. <ref> inside inline images
14603 !! wikitext
14604 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14605
14606 <references />
14607 !! html/parsoid
14608 <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>
14609
14610 <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>
14611 !! end
14612
14613 !! test
14614 T93580: 3. Templated <ref> inside inline images
14615 !! wikitext
14616 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14617
14618 <references />
14619 !! html/parsoid
14620 <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>
14621
14622 <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>
14623 !! end
14624
14625 ###
14626 ### Subpages
14627 ###
14628 !! article
14629 Subpage test/subpage
14630 !! text
14631 foo
14632 !! endarticle
14633
14634 !! test
14635 Subpage 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 !! test
14646 Subpage noslash link
14647 !! options
14648 subpage title=[[Subpage test]]
14649 !! wikitext
14650 [[/subpage/]]
14651 !! html
14652 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14653 </p>
14654 !! end
14655
14656 !! article
14657 Subpage test/1/2/subpage
14658 !! text
14659 blah
14660 !! endarticle
14661
14662 !! test
14663 Relative subpage noslash link
14664 !! options
14665 parsoid=wt2wt,wt2html,html2html
14666 subpage title=[[Subpage test/1/2/3/4]]
14667 !! wikitext
14668 [[../../subpage/]]
14669
14670 [[../../subpage]]
14671 !! html/php
14672 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14673 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14674 </p>
14675 !! html/parsoid
14676 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14677 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14678 !! end
14679
14680 !! test
14681 Parsoid: dot-slash prefixed wikilinks
14682 !! wikitext
14683 [[./foo]]
14684
14685 [[././bar]]
14686
14687 [[././baz/]]
14688 !! html/php
14689 <p>[[./foo]]
14690 </p><p>[[././bar]]
14691 </p><p>[[././baz/]]
14692 </p>
14693 !! html/parsoid
14694 <p>[[./foo]]
14695 </p><p>[[././bar]]
14696 </p><p>[[././baz/]]
14697 </p>
14698 !! end
14699
14700 !! test
14701 Render invalid page names as plain text (bug 51090)
14702 !! wikitext
14703 [[./../foo|bar]]
14704 [[foo�|bar]]
14705 [[foo/.|bar]]
14706 [[foo/..|bar]]
14707 [[foo~~~bar]]
14708 [[foo>bar]]
14709 [[foo[bar]]
14710 [[.]]
14711 [[..]]
14712 [[foo././bar]]
14713
14714 [[{{echo|./../foo}}|bar]]
14715 [[{{echo|foo/.}}|bar]]
14716 [[{{echo|foo/..}}|bar]]
14717 [[{{echo|foo~~~~bar}}]]
14718 [[{{echo|foo>bar}}]]
14719 [[{{echo|foo././bar}}]]
14720 [[{{echo|foo{bar}}]]
14721 [[{{echo|foo}bar}}]]
14722 [[{{echo|foo[bar}}]]
14723 [[{{echo|foo]bar}}]]
14724 [[{{echo|foo<bar}}]]
14725 !!html/php
14726 <p>[[./../foo|bar]]
14727 [[foo�|bar]]
14728 [[foo/.|bar]]
14729 [[foo/..|bar]]
14730 [[foo~~~bar]]
14731 [[foo&gt;bar]]
14732 [[foo[bar]]
14733 [[.]]
14734 [[..]]
14735 [[foo././bar]]
14736 </p><p>[[./../foo|bar]]
14737 [[foo/.|bar]]
14738 [[foo/..|bar]]
14739 [[foo~~~~bar]]
14740 [[foo&gt;bar]]
14741 [[foo././bar]]
14742 [[foo{bar]]
14743 [[foo}bar]]
14744 [[foo[bar]]
14745 [[foo]bar]]
14746 [[foo&lt;bar]]
14747 </p>
14748 !!html/parsoid
14749 <p>[[./../foo|bar]]
14750 [[foo�|bar]]
14751 [[foo/.|bar]]
14752 [[foo/..|bar]]
14753 [[foo~~~bar]]
14754 [[foo>bar]]
14755 [[foo[bar]]
14756 [[.]]
14757 [[..]]
14758 [[foo././bar]]</p>
14759
14760 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14761 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14762 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14763 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14764 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14765 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14766 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14767 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14768 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14769 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14770 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
14771 !!end
14772
14773 !! test
14774 Disabled subpages
14775 !! wikitext
14776 [[/subpage]]
14777 !! html
14778 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14779 </p>
14780 !! end
14781
14782 !! test
14783 BUG 561: {{/Subpage}}
14784 !! options
14785 subpage title=[[Page]]
14786 !! wikitext
14787 {{/Subpage}}
14788 !! html
14789 <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>
14790 </p>
14791 !! end
14792
14793 ###
14794 ### Categories
14795 ###
14796 !! article
14797 Category:MediaWiki User's Guide
14798 !! text
14799 blah
14800 !! endarticle
14801
14802 !! test
14803 Link to category
14804 !! wikitext
14805 [[:Category:MediaWiki User's Guide]]
14806 !! html
14807 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14808 </p>
14809 !! end
14810
14811 !! test
14812 Simple category
14813 !! options
14814 cat
14815 !! wikitext
14816 [[Category:MediaWiki User's Guide]]
14817 !! html/php
14818 cat=MediaWiki_User's_Guide sort=
14819 !! html/parsoid
14820 <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"}}'/>
14821 !! end
14822
14823 !! test
14824 PAGESINCATEGORY invalid title fatal (r33546 fix)
14825 !! wikitext
14826 {{PAGESINCATEGORY:<bogus>}}
14827 !! html
14828 <p>0
14829 </p>
14830 !! end
14831
14832 !! test
14833 Category with different sort key
14834 !! options
14835 cat
14836 !! wikitext
14837 [[Category:MediaWiki User's Guide|Foo]]
14838 !! html/php
14839 cat=MediaWiki_User's_Guide sort=Foo
14840 !! html/parsoid
14841 <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"}}'/>
14842 !! end
14843
14844 !! test
14845 Category with identical sort key
14846 !! options
14847 cat
14848 !! wikitext
14849 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14850 !! html/php
14851 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14852 !! html/parsoid
14853 <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"}}'/>
14854 !! end
14855
14856 !! test
14857 Category with empty sort key
14858 !! options
14859 cat
14860 pst
14861 !! wikitext
14862 [[Category:MediaWiki User's Guide|]]
14863 !! html/php
14864 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14865 !! end
14866
14867 !! test
14868 Category with empty sort key and parentheses
14869 !! options
14870 cat
14871 pst
14872 !! wikitext
14873 [[Category:Foo (bar)|]]
14874 !! html/php
14875 [[Category:Foo (bar)|Foo]]
14876 !! end
14877
14878 !! test
14879 Category with link tail
14880 !! options
14881 cat
14882 pst
14883 !! wikitext
14884 123[[Category:Foo]]456
14885 !! html/php
14886 123[[Category:Foo]]456
14887 !! end
14888
14889 !! test
14890 Category with template
14891 !! options
14892 cat
14893 pst
14894 !! wikitext
14895 [[Category:{{echo|Foo}}]]
14896 !! html/php
14897 [[Category:{{echo|Foo}}]]
14898 !! end
14899
14900 !! test
14901 Category with template in sort key
14902 !! options
14903 cat
14904 pst
14905 !! wikitext
14906 [[Category:Foo|{{echo|Bar}}]]
14907 !! html/php
14908 [[Category:Foo|{{echo|Bar}}]]
14909 !! end
14910
14911 !! test
14912 Category with template in sort key and title
14913 !! options
14914 cat
14915 pst
14916 !! wikitext
14917 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14918 !! html/php
14919 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14920 !! end
14921
14922 ## We used to, but no longer wt2wt this test since the default serializer
14923 ## will normalize all categories to serialize on their own line.
14924 ## This wikitext usage is going to be fairly uncommon in production and
14925 ## selser will take care of preserving formatting in those scenarios.
14926 !! test
14927 Category / paragraph interactions
14928 !! options
14929 parsoid=wt2html
14930 !! wikitext
14931 Foo [[Category:Baz]] Bar
14932
14933 Foo [[Category:Baz]]
14934 Bar
14935
14936 Foo
14937 [[Category:Baz]]
14938 Bar
14939
14940 Foo
14941 [[Category:Baz]] Bar
14942
14943 Foo
14944 [[Category:Baz]]
14945 [[Category:Baz]]
14946 [[Category:Baz]]
14947 Bar
14948
14949 [[Category:Baz]]
14950 [[Category:Baz]]
14951 [[Category:Baz]]
14952
14953 [[Category:Baz]]
14954 {{echo|[[Category:Baz]]}}
14955 [[Category:Baz]]
14956 !! html/php
14957 <p>Foo Bar
14958 </p><p>Foo
14959 Bar
14960 </p><p>Foo
14961 Bar
14962 </p><p>Foo Bar
14963 </p><p>Foo
14964 Bar
14965 </p>
14966 !! html/parsoid
14967 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14968 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14969 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14970 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14971 <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>
14972 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14973 !! end
14974
14975 ## We used to, but no longer wt2wt this test since the default serializer
14976 ## will normalize all categories to serialize on their own line.
14977 ## This wikitext usage is going to be fairly uncommon in production and
14978 ## selser will take care of preserving formatting in those scenarios.
14979 ##
14980 ## The whitespace on the empty line is part of the test. Please do not delete
14981 !! test
14982 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14983 !! options
14984 parsoid=wt2html
14985 !! wikitext
14986 This
14987
14988 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14989
14990 {{echo|[[Category:Foo]] and so should this!}}
14991 !! html/php
14992 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14993 </p>
14994 !! html/parsoid
14995 <p>This
14996
14997 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14998
14999 <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>
15000 !! end
15001
15002 ## Parsoid will not try to wt2wt this while preserving newlines because
15003 ## it suppresses excess newlines within list items -- and we don't want to
15004 ## introduce a special case just for categories, which is, in reality somewhat
15005 ## odd behavior -- categories are unlikely to be used in list items like this
15006 ## in top-level pages and are only likely to show up in template-generated
15007 ## list items where this RT-ing is a non-issue.
15008 ##
15009 ## The whitespace on the empty line is part of the test. Please do not delete
15010 !! test
15011 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15012 !! options
15013 parsoid=wt2html
15014 !! wikitext
15015 * This
15016
15017 [[Category:Foo]] and this should be part of the same list item
15018 * So should this
15019
15020 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15021 !! html
15022 <ul><li>This and this should be part of the same list item</li>
15023 <li>So should this and this should be part of the same list item</li></ul>
15024 !! html/parsoid
15025 <ul>
15026 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15027 <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>
15028 </ul>
15029 !! end
15030
15031 ## Newlines and categories that follow the last item of a list
15032 ## are treated differently because this (list followed by categories)
15033 ## is an extremely common pattern on wikis.
15034 !! test
15035 3. Categories and newlines: newline suppression for last list item should RT properly
15036 !! wikitext
15037 * a
15038 * b
15039
15040 [[Category:Foo]]
15041
15042 [[Category:Bar]]
15043 [[Category:Baz]]
15044 !! html/parsoid
15045 <ul><li> a</li>
15046 <li> b</li></ul>
15047
15048 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15049
15050 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15051 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15052 !! end
15053
15054 !! test
15055 4. Categories and newlines: newline suppression for last list item should RT properly
15056 !! wikitext
15057 * a
15058 **** b
15059
15060 [[Category:Foo]]
15061 !! html/parsoid
15062 <ul><li> a
15063 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15064
15065 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15066 !! end
15067
15068 ## only wt2html for this to make sure the algo only applies to the rightmost path
15069 !! test
15070 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15071 !! options
15072 parsoid=wt2html
15073 !! wikitext
15074 * a
15075 ** b
15076 [[Category:Foo]]
15077 * c
15078 ** d
15079 [[Category:Foo]]
15080 !! html/parsoid
15081 <ul><li> a
15082 <ul><li> b
15083 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15084 <li> c
15085 <ul><li> d</li></ul></li></ul>
15086 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15087 !! end
15088
15089 ## We used to, but no longer wt2wt this test since the default serializer
15090 ## will normalize all categories to serialize on their own line.
15091 ## This wikitext usage is going to be fairly uncommon in production and
15092 ## selser will take care of preserving formatting in those scenarios.
15093 !! test
15094 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15095 !! options
15096 parsoid=wt2html
15097 !! wikitext
15098 * a [[Category:Foo]]
15099 !! html/parsoid
15100 <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>
15101 !! end
15102
15103 # This test also demonstrates because of newline+category tunneling
15104 # through the list hander, template wrapping doesn't expand to the
15105 # containing list when the list item swallows the category.
15106 !! test
15107 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15108 !! wikitext
15109 * {{echo|a
15110 [[Category:Foo]]}}
15111 !! html/parsoid
15112 <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
15113 </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>
15114 !! end
15115
15116 !! test
15117 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15118 !! wikitext
15119 * a
15120
15121 {{echo|[[Category:Foo]]
15122 [[Category:Bar]]}}
15123 [[Category:Baz]]
15124 !! html/parsoid
15125 <ul><li> a</li></ul>
15126
15127 <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">
15128 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15129 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15130 !! end
15131
15132 !! test
15133 Category links with multiple namespaces
15134 !! wikitext
15135 [[Category:Project:Foo]]
15136 !! html/parsoid
15137 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15138 !! end
15139
15140 !! test
15141 Parsoid: Serialize link to category page with colon escape
15142 !! options
15143 parsoid
15144 !! wikitext
15145
15146 [[:Category:Foo]]
15147 [[:Category:Foo|Bar]]
15148 !! html
15149 <p>
15150 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15151 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15152 </p>
15153 !! end
15154
15155 # We used to, but no longer wt2wt this test since the default serializer
15156 # will normalize all categories to serialize on their own line.
15157 # This wikitext usage is going to be fairly uncommon in production and
15158 # selser will take care of preventing whitespace insertion if this
15159 # occurs in an article.
15160 #
15161 # html2html disabled for the same reason (whitespace insertion between
15162 # x and y).
15163 #
15164 # html2wt disabled because it localizes the "Category" namespace.
15165 !! test
15166 Link prefix/suffixes aren't applied to category links
15167 !! options
15168 parsoid=wt2html
15169 language=is
15170 !! wikitext
15171 x[[Category:Foo]]y
15172 !! html/php
15173 <p>xy
15174 </p>
15175 !! html/parsoid
15176 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15177 !! end
15178
15179 !! test
15180 Parsoid: Serialize link to file page with colon escape
15181 !! options
15182 parsoid
15183 !! wikitext
15184
15185 [[:File:Foo.png]]
15186 [[:File:Foo.png|Bar]]
15187 !! html
15188 <p>
15189 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15190 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15191 </p>
15192 !! end
15193
15194 !! test
15195 Parsoid: Serialize a genuine category link without colon escape
15196 !! options
15197 parsoid
15198 !! wikitext
15199 [[Category:Foo]]
15200 [[Category:Foo|Bar]]
15201 !! html
15202 <link rel="mw:PageProp/Category" href="./Category:Foo">
15203 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15204 !! end
15205
15206 !! test
15207 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15208 !! options
15209 parsoid=html2wt
15210 !! html/parsoid
15211 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15212 !! wikitext
15213 [[Category:Toxine bactérienne]]
15214 !! end
15215
15216 !! test
15217 Parsoid: Defaultsort
15218 !! wikitext
15219 {{DEFAULTSORT:Foo}}
15220 !! html/parsoid
15221 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15222 !! end
15223
15224 !! test
15225 Parsoid: Defaultsort (template-generated)
15226 !! wikitext
15227 {{{{echo|DEFAULTSORT}}:Foo}}
15228 !! html/parsoid
15229 <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}}]}'/>
15230 !! end
15231
15232 ###
15233 ### Inter-language links
15234 ###
15235 !! test
15236 Interlanguage links
15237 !! options
15238 ill
15239 !! wikitext
15240 [[es:Alimento]]
15241 [[fr:Nourriture]]
15242 [[zh:食品]]
15243 !! html/php
15244 es:Alimento fr:Nourriture zh:食品
15245 !! html/parsoid
15246 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15247 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15248 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15249 !! end
15250
15251 !! test
15252 Duplicate interlanguage links (bug 24502)
15253 !! options
15254 ill
15255 !! wikitext
15256 [[es:1]]
15257 [[es:2]]
15258 [[fr:1]]
15259 [[fr:2]]
15260 !! html/php
15261 es:1 fr:1
15262 !! html/parsoid
15263 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15264 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15265 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15266 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15267 !! end
15268
15269 ###
15270 ### Sections
15271 ###
15272 !! test
15273 Basic section headings
15274 !! wikitext
15275 == Headline 1 ==
15276 Some text
15277
15278 ==Headline 2==
15279 More
15280 ===Smaller headline===
15281 Blah blah
15282 !! html
15283 <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>
15284 <p>Some text
15285 </p>
15286 <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>
15287 <p>More
15288 </p>
15289 <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>
15290 <p>Blah blah
15291 </p>
15292 !! end
15293
15294 !! test
15295 Section headings with TOC
15296 !! wikitext
15297 == Headline 1 ==
15298 === Subheadline 1 ===
15299 ===== Skipping a level =====
15300 ====== Skipping a level ======
15301
15302 == Headline 2 ==
15303 Some text
15304 ===Another headline===
15305 !! html
15306 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15307 <ul>
15308 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15309 <ul>
15310 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15311 <ul>
15312 <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>
15313 <ul>
15314 <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>
15315 </ul>
15316 </li>
15317 </ul>
15318 </li>
15319 </ul>
15320 </li>
15321 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15322 <ul>
15323 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15324 </ul>
15325 </li>
15326 </ul>
15327 </div>
15328
15329 <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>
15330 <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>
15331 <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>
15332 <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>
15333 <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>
15334 <p>Some text
15335 </p>
15336 <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>
15337
15338 !! end
15339
15340 !! test
15341 TOC anchors don't collide
15342 !! wikitext
15343 __FORCETOC__
15344 == Headline 2 ==
15345 == Headline ==
15346 == Headline 2 ==
15347 == Headline ==
15348 !! html/php
15349 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15350 <ul>
15351 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15352 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15353 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15354 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15355 </ul>
15356 </div>
15357
15358 <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>
15359 <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>
15360 <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>
15361 <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>
15362
15363 !! end
15364
15365 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15366 !! test
15367 Handling of sections up to level 6 and beyond
15368 !! wikitext
15369 = Level 1 Heading=
15370 == Level 2 Heading==
15371 === Level 3 Heading===
15372 ==== Level 4 Heading====
15373 ===== Level 5 Heading=====
15374 ====== Level 6 Heading======
15375 ======= Level 7 Heading=======
15376 ======== Level 8 Heading========
15377 ========= Level 9 Heading=========
15378 ========== Level 10 Heading==========
15379 !! html
15380 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15381 <ul>
15382 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15383 <ul>
15384 <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>
15385 <ul>
15386 <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>
15387 <ul>
15388 <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>
15389 <ul>
15390 <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>
15391 <ul>
15392 <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>
15393 <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>
15394 <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>
15395 <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>
15396 <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>
15397 </ul>
15398 </li>
15399 </ul>
15400 </li>
15401 </ul>
15402 </li>
15403 </ul>
15404 </li>
15405 </ul>
15406 </li>
15407 </ul>
15408 </div>
15409
15410 <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>
15411 <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>
15412 <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>
15413 <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>
15414 <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>
15415 <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>
15416 <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>
15417 <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>
15418 <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>
15419 <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>
15420
15421 !! end
15422
15423 !! test
15424 TOC regression (T11764)
15425 !! wikitext
15426 == title 1 ==
15427 === title 1.1 ===
15428 ==== title 1.1.1 ====
15429 === title 1.2 ===
15430 == title 2 ==
15431 === title 2.1 ===
15432 !! html
15433 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15434 <ul>
15435 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15436 <ul>
15437 <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>
15438 <ul>
15439 <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>
15440 </ul>
15441 </li>
15442 <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>
15443 </ul>
15444 </li>
15445 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15446 <ul>
15447 <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>
15448 </ul>
15449 </li>
15450 </ul>
15451 </div>
15452
15453 <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>
15454 <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>
15455 <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>
15456 <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>
15457 <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>
15458 <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>
15459
15460 !! end
15461
15462 !! test
15463 TOC for heading containing <span id="..."></span> (T96153)
15464 !! wikitext
15465 __FORCETOC__
15466 ==<span id="old-anchor"></span>New title==
15467 !! html/php
15468 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15469 <ul>
15470 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15471 </ul>
15472 </div>
15473
15474 <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>
15475
15476 !! end
15477
15478 !! test
15479 TOC with wgMaxTocLevel=3 (bug 6204)
15480 !! options
15481 wgMaxTocLevel=3
15482 !! wikitext
15483 == title 1 ==
15484 === title 1.1 ===
15485 ==== title 1.1.1 ====
15486 === title 1.2 ===
15487 == title 2 ==
15488 === title 2.1 ===
15489 !! html
15490 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15491 <ul>
15492 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15493 <ul>
15494 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
15495 <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>
15496 </ul>
15497 </li>
15498 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15499 <ul>
15500 <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>
15501 </ul>
15502 </li>
15503 </ul>
15504 </div>
15505
15506 <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>
15507 <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>
15508 <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>
15509 <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>
15510 <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>
15511 <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>
15512
15513 !! end
15514
15515 !! test
15516 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15517 !! options
15518 wgMaxTocLevel=3
15519 !! wikitext
15520 ==Section 1==
15521 ===Section 1.1===
15522 ====Section 1.1.1====
15523 ====Section 1.1.1.1====
15524 ==Section 2==
15525 !! html
15526 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15527 <ul>
15528 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15529 <ul>
15530 <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>
15531 </ul>
15532 </li>
15533 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15534 </ul>
15535 </div>
15536
15537 <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>
15538 <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>
15539 <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>
15540 <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>
15541 <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>
15542
15543 !! end
15544
15545
15546 !! test
15547 Resolving duplicate section names
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 !! test
15558 Resolving duplicate section names with differing case (bug 10721)
15559 !! wikitext
15560 == Foo bar ==
15561 == Foo Bar ==
15562 !! html
15563 <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>
15564 <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>
15565
15566 !! end
15567
15568 !! article
15569 Template:sections
15570 !! text
15571 ===Section 1===
15572 ==Section 2==
15573 !! endarticle
15574
15575 !! test
15576 Template with sections, __NOTOC__
15577 !! wikitext
15578 __NOTOC__
15579 ==Section 0==
15580 {{sections}}
15581 ==Section 4==
15582 !! html
15583 <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>
15584 <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>
15585 <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>
15586 <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>
15587
15588 !! end
15589
15590 !! test
15591 __NOEDITSECTION__ keyword
15592 !! wikitext
15593 __NOEDITSECTION__
15594 ==Section 1==
15595 ==Section 2==
15596 !! html
15597 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15598 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15599
15600 !! end
15601
15602 !! test
15603 Link inside a section heading
15604 !! wikitext
15605 ==Section with a [[Main Page|link]] in it==
15606 !! html
15607 <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>
15608
15609 !! end
15610
15611 !! test
15612 TOC regression (T14077)
15613 !! wikitext
15614 __TOC__
15615 == title 1 ==
15616 === title 1.1 ===
15617 == title 2 ==
15618 !! html
15619 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15620 <ul>
15621 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15622 <ul>
15623 <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>
15624 </ul>
15625 </li>
15626 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15627 </ul>
15628 </div>
15629
15630 <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>
15631 <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>
15632 <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>
15633
15634 !! end
15635
15636 !! test
15637 BUG 1219 URL next to image (good)
15638 !! wikitext
15639 http://example.com [[File:Foobar.jpg]]
15640 !! html/php
15641 <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>
15642 </p>
15643 !! html/parsoid
15644 <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>
15645 !!end
15646
15647 !! test
15648 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15649 !! wikitext
15650 ===
15651 The line above must have a trailing space!
15652 === <!--
15653 --> <!-- -->
15654 But just in case it doesn't...
15655 !! html
15656 <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>
15657 <p>The line above must have a trailing space!
15658 </p>
15659 <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>
15660 <p>But just in case it doesn't...
15661 </p>
15662 !! end
15663
15664 !! test
15665 Header with special characters (bug 25462)
15666 !! wikitext
15667 The tooltips shall not show entities to the user (ie. be double escaped)
15668
15669 == text > text ==
15670 section 1
15671
15672 == text < text ==
15673 section 2
15674
15675 == text & text ==
15676 section 3
15677
15678 == text ' text ==
15679 section 4
15680
15681 == text " text ==
15682 section 5
15683 !! html
15684 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15685 </p>
15686 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15687 <ul>
15688 <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>
15689 <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>
15690 <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>
15691 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15692 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15693 </ul>
15694 </div>
15695
15696 <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>
15697 <p>section 1
15698 </p>
15699 <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>
15700 <p>section 2
15701 </p>
15702 <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>
15703 <p>section 3
15704 </p>
15705 <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>
15706 <p>section 4
15707 </p>
15708 <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>
15709 <p>section 5
15710 </p>
15711 !! end
15712
15713 !! test
15714 Header with space, plus and underscore as entity
15715 !! wikitext
15716 Id should not contain + for spaces
15717
15718 == Space between Text ==
15719 section 1
15720
15721 == Space-Entity&#32;between&#32;Text ==
15722 section 2
15723
15724 == Plus+between+Text ==
15725 section 3
15726
15727 == Plus-Entity&#43;between&#43;Text ==
15728 section 4
15729
15730 == Underscore_between_Text ==
15731 section 5
15732
15733 == Underscore-Entity&#95;between&#95;Text ==
15734 section 6
15735
15736 [[#Space between Text]]
15737 [[#Space-Entity&#32;between&#32;Text]]
15738 [[#Plus+between+Text]]
15739 [[#Plus-Entity&#43;between&#43;Text]]
15740 [[#Underscore_between_Text]]
15741 [[#Underscore-Entity&#95;between&#95;Text]]
15742 !! html
15743 <p>Id should not contain + for spaces
15744 </p>
15745 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15746 <ul>
15747 <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>
15748 <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>
15749 <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>
15750 <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>
15751 <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>
15752 <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>
15753 </ul>
15754 </div>
15755
15756 <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>
15757 <p>section 1
15758 </p>
15759 <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>
15760 <p>section 2
15761 </p>
15762 <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>
15763 <p>section 3
15764 </p>
15765 <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>
15766 <p>section 4
15767 </p>
15768 <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>
15769 <p>section 5
15770 </p>
15771 <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>
15772 <p>section 6
15773 </p><p><a href="#Space_between_Text">#Space between Text</a>
15774 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15775 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15776 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15777 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15778 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15779 </p>
15780 !! end
15781
15782 !! test
15783 Headers with excess '=' characters
15784 (Are similar tests necessary beyond the 1st level?)
15785 !! wikitext
15786 =foo==
15787 ==foo=
15788 =''italic'' heading==
15789 ==''italic'' heading=
15790 !! html
15791 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15792 <ul>
15793 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15794 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15795 <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>
15796 <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>
15797 </ul>
15798 </div>
15799
15800 <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>
15801 <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>
15802 <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>
15803 <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>
15804
15805 !! end
15806
15807 !! test
15808 HTML headers vs TOC (bug 23393)
15809 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15810 !! wikitext
15811 <h1>Header 1</h1>
15812 == Header 1.1 ==
15813 == Header 1.2 ==
15814
15815 <h1>Header 2
15816 </h1>
15817 == Header 2.1 ==
15818 == Header 2.2 ==
15819 __NOEDITSECTION__
15820 !! html
15821 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15822 <ul>
15823 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15824 <ul>
15825 <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>
15826 <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>
15827 </ul>
15828 </li>
15829 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15830 <ul>
15831 <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>
15832 <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>
15833 </ul>
15834 </li>
15835 </ul>
15836 </div>
15837
15838 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15839 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15840 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15841 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15842 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15843 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15844
15845 !! end
15846
15847 !! test
15848 Single-line or multiline-comments can follow headings
15849 !! options
15850 parsoid=wt2html,wt2wt
15851 !! wikitext
15852 ==foo==<!---->
15853 ==bar==<!--c1-->
15854 ==baz==<!--
15855 c2
15856 c3-->
15857 !! html
15858 <h2><span class="mw-headline" id="foo">foo</span></h2>
15859 <h2><span class="mw-headline" id="bar">bar</span></h2>
15860 <h2><span class="mw-headline" id="baz">baz</span></h2>
15861
15862 !! end
15863
15864 !! test
15865 BUG 1219 URL next to image (broken)
15866 !! wikitext
15867 http://example.com[[File:Foobar.jpg]]
15868 !! html/php
15869 <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>
15870 </p>
15871 !! html/parsoid
15872 <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>
15873 !!end
15874
15875 !! test
15876 Bug 1186 news: in the middle of text
15877 !! wikitext
15878 http://en.wikinews.org/wiki/Wikinews:Workplace
15879 !! html
15880 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15881 </p>
15882 !!end
15883
15884
15885 !! test
15886 Namespaced link must have a title
15887 !! wikitext
15888 [[Project:]]
15889 !! html
15890 <p>[[Project:]]
15891 </p>
15892 !!end
15893
15894 !! test
15895 Namespaced link must have a title (bad fragment version)
15896 !! wikitext
15897 [[Project:#fragment]]
15898 !! html
15899 <p>[[Project:#fragment]]
15900 </p>
15901 !!end
15902
15903
15904 ###
15905 ### HTML tags and HTML attributes
15906 ###
15907
15908 !! test
15909 div with no attributes
15910 !! wikitext
15911 <div>HTML rocks</div>
15912 !! html
15913 <div>HTML rocks</div>
15914
15915 !! end
15916
15917 !! test
15918 div with double-quoted attribute
15919 !! wikitext
15920 <div id="rock">HTML rocks</div>
15921 !! html
15922 <div id="rock">HTML rocks</div>
15923
15924 !! end
15925
15926 !! test
15927 div with single-quoted attribute
15928 !! wikitext
15929 <div id='rock'>HTML rocks</div>
15930 !! html
15931 <div id="rock">HTML rocks</div>
15932
15933 !! end
15934
15935 !! test
15936 div with unquoted attribute
15937 !! wikitext
15938 <div id=rock>HTML rocks</div>
15939 !! html
15940 <div id="rock">HTML rocks</div>
15941
15942 !! end
15943
15944 !! test
15945 div with illegal double attributes
15946 !! wikitext
15947 <div id="a" id="b">HTML rocks</div>
15948 !! html
15949 <div id="b">HTML rocks</div>
15950
15951 !!end
15952
15953 !! test
15954 div with empty attribute value, space before equals
15955 !! options
15956 parsoid=wt2html,html2html
15957 !! wikitext
15958 <div class =>HTML rocks</div>
15959 !! html/php
15960 <div class="">HTML rocks</div>
15961
15962 !! html/parsoid
15963 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15964 !! end
15965
15966 !! test
15967 div with multiple empty attribute values
15968 !! options
15969 parsoid=wt2html,html2html
15970 !! wikitext
15971 <div id= title=>HTML rocks</div>
15972 !! html/php
15973 <div id="title.3D">HTML rocks</div>
15974
15975 !! html/parsoid
15976 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15977 !! end
15978
15979 !! test
15980 table with multiple empty attribute values
15981 !! options
15982 parsoid=wt2html,html2html
15983 !! wikitext
15984 {| title= id=
15985 | hi
15986 |}
15987 !! html/php
15988 <table title="id=">
15989 <tr>
15990 <td> hi
15991 </td></tr></table>
15992
15993 !! html/parsoid
15994 <table title="id=">
15995 <tbody><tr><td> hi</td></tr>
15996 </tbody></table>
15997 !! end
15998
15999 !! test
16000 div with braces in attribute value
16001 !! wikitext
16002 <div title="{}">Foo</div>
16003 !! html/php
16004 <div title="&#123;}">Foo</div>
16005
16006 !! html/parsoid
16007 <div title="{}">Foo</div>
16008 !! end
16009
16010 !! test
16011 div with empty attribute value, no space before equals
16012 !! options
16013 parsoid=wt2html,html2html
16014 !! wikitext
16015 <div class=>HTML rocks</div>
16016 !! html/php
16017 <div class="">HTML rocks</div>
16018
16019 !! html/parsoid
16020 <div class="">HTML rocks</div>
16021 !! end
16022
16023 !! test
16024 HTML multiple attributes correction
16025 !! wikitext
16026 <p class="error" class="awesome">Awesome!</p>
16027 !! html
16028 <p class="awesome">Awesome!</p>
16029
16030 !!end
16031
16032 !! test
16033 Table multiple attributes correction
16034 !! wikitext
16035 {|
16036 !+ class="error" class="awesome"| status
16037 |}
16038 !! html
16039 <table>
16040 <tr>
16041 <th class="awesome"> status
16042 </th></tr></table>
16043
16044 !!end
16045
16046 !! test
16047 DIV IN UPPERCASE
16048 !! wikitext
16049 <DIV ID="x">HTML ROCKS</DIV>
16050 !! html
16051 <div id="x">HTML ROCKS</div>
16052
16053 !!end
16054
16055 !! test
16056 Non-ASCII pseudo-tags are rendered as text
16057 !! wikitext
16058 <khyô>
16059 !! html
16060 <p>&lt;khyô&gt;
16061 </p>
16062 !! end
16063
16064 !! test
16065 Pseudo-tag with URL 'name' renders as url link
16066 !! wikitext
16067 <http://example.com/>
16068 !! html
16069 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16070 </p>
16071 !! end
16072
16073 !! test
16074 text with amp in the middle of nowhere
16075 !! wikitext
16076 Remember AT&T?
16077 !! html
16078 <p>Remember AT&amp;T?
16079 </p>
16080 !! end
16081
16082 !! test
16083 text with character entity: eacute
16084 !! wikitext
16085 I always thought &eacute; was a cute letter.
16086 !! html
16087 <p>I always thought &#233; was a cute letter.
16088 </p>
16089 !! html+tidy
16090 <p>I always thought é was a cute letter.</p>
16091 !! end
16092
16093 !! test
16094 text with entity-escaped character entity-like string: eacute
16095 !! wikitext
16096 I always thought &amp;eacute; was a cute letter.
16097 !! html
16098 <p>I always thought &amp;eacute; was a cute letter.
16099 </p>
16100 !! end
16101
16102 !! test
16103 text with undefined character entity: xacute
16104 !! wikitext
16105 I always thought &xacute; was a cute letter.
16106 !! html
16107 <p>I always thought &amp;xacute; was a cute letter.
16108 </p>
16109 !! end
16110
16111 !! test
16112 HTML5 tags
16113 !! wikitext
16114 <data value="5">five</data>
16115 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16116 <mark>This highlighted text</mark>
16117 !! html
16118 <p><data value="5">five</data>
16119 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16120 <mark>This highlighted text</mark>
16121 </p>
16122 !! end
16123
16124 !! test
16125 HTML tag with leading space is parsed as text
16126 !! wikitext
16127 < div>foo< /div>
16128 !! html
16129 <p>&lt; div&gt;foo&lt; /div&gt;
16130 </p>
16131 !! end
16132
16133 ###
16134 ### Nesting tests (see bug 41545, 50604, 51081)
16135 ###
16136
16137 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16138 # Note that html2wt is considerably more difficult if we use <b> in
16139 # the test case, instead of <big>
16140 !! test
16141 Ensure that HTML adoption agency algorithm is properly implemented.
16142 !! wikitext
16143 <big>X<big>Y</big>Z</big>
16144 !! html
16145 <p><big>X<big>Y</big>Z</big>
16146 </p>
16147 !! end
16148
16149 # This was bug 41545 in the PHP parser.
16150 # Note that tidy doesn't handle this correctly.
16151 !! test
16152 Nesting of <kbd>
16153 !! wikitext
16154 <kbd>X<kbd>Y</kbd>Z</kbd>
16155 !! html
16156 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16157 </p>
16158 !! end
16159
16160 # The following cases were bug 51081 in the PHP parser.
16161 # Note that there are some other nestable tags (b, i, etc) which are
16162 # not covered; see bug 51081 for discussion.
16163
16164 # Note that tidy doesn't handle this correctly.
16165 !! test
16166 Nesting of <em>
16167 !! wikitext
16168 <em>X<em>Y</em>Z</em>
16169 !! html
16170 <p><em>X<em>Y</em>Z</em>
16171 </p>
16172 !! end
16173
16174 # Note that tidy doesn't handle this correctly.
16175 !! test
16176 Nesting of <strong>
16177 !! wikitext
16178 <strong>X<strong>Y</strong>Z</strong>
16179 !! html
16180 <p><strong>X<strong>Y</strong>Z</strong>
16181 </p>
16182 !! end
16183
16184 !! test
16185 Nesting of <q>
16186 !! wikitext
16187 <q>X<q>Y</q>Z</q>
16188 !! html+tidy
16189 <p><q>X<q>Y</q>Z</q></p>
16190 !! end
16191
16192 # Note that tidy doesn't handle this correctly.
16193 !! test
16194 Nesting of <ruby>
16195 !! wikitext
16196 <ruby>X<ruby>Y</ruby>Z</ruby>
16197 !! html
16198 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16199 </p>
16200 !! end
16201
16202 # Note that tidy doesn't handle this correctly.
16203 !! test
16204 Nesting of <bdo>
16205 !! wikitext
16206 <bdo>X<bdo>Y</bdo>Z</bdo>
16207 !! html
16208 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16209 </p>
16210 !! end
16211
16212
16213 ###
16214 ### Media links
16215 ###
16216
16217 !! test
16218 Media link
16219 !! wikitext
16220 [[Media:Foobar.jpg]]
16221 !! html
16222 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16223 </p>
16224 !! end
16225
16226 !! test
16227 Media link with text
16228 !! wikitext
16229 [[Media:Foobar.jpg|A neat file to look at]]
16230 !! html
16231 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16232 </p>
16233 !! end
16234
16235 # FIXME: this is still bad HTML tag nesting
16236 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16237 !! test
16238 Media link with nasty text
16239 !! wikitext
16240 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16241 !! html
16242 <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>
16243
16244 !! html+tidy
16245 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16246 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16247 !! end
16248
16249 !! test
16250 Media link to nonexistent file (bug 1702)
16251 !! wikitext
16252 [[Media:No such.jpg]]
16253 !! html
16254 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16255 </p>
16256 !! end
16257
16258 !! test
16259 Image link to nonexistent file (bug 1850 - good)
16260 !! wikitext
16261 [[File:No_such.jpg]]
16262 !! html/php
16263 <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>
16264 </p>
16265 !! html/parsoid
16266 <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>
16267 !! end
16268
16269 !! test
16270 :Image link to nonexistent file (bug 1850 - bad)
16271 !! wikitext
16272 [[:Image:No such.jpg]]
16273 !! html/php
16274 <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>
16275 </p>
16276 !! html/parsoid
16277 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16278 !! end
16279
16280
16281
16282 !! test
16283 Character reference normalization in link text (bug 1938)
16284 !! wikitext
16285 [[Main Page|this&that]]
16286 !! html
16287 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16288 </p>
16289 !!end
16290
16291 !! article
16292 אַ
16293 !! text
16294 Test for unicode normalization
16295
16296 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16297 !! endarticle
16298
16299 !! test
16300 (bug 19451) Links should refer to the normalized form.
16301 !! wikitext
16302 [[&#xFB2E;]]
16303 [[&#x5d0;&#x5b7;]]
16304 [[&#x5d0;ַ]]
16305 [[א&#x5b7;]]
16306 [[אַ]]
16307 !! html
16308 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16309 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16310 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16311 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16312 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16313 </p>
16314 !! end
16315
16316 !! test
16317 Empty attribute crash test (bug 2067)
16318 !! wikitext
16319 <font color="">foo</font>
16320 !! html
16321 <p><font color="">foo</font>
16322 </p>
16323 !! end
16324
16325 !! test
16326 Empty attribute crash test single-quotes (bug 2067)
16327 !! wikitext
16328 <font color=''>foo</font>
16329 !! html
16330 <p><font color="">foo</font>
16331 </p>
16332 !! end
16333
16334 !! test
16335 Attribute test: equals, then nothing
16336 !! options
16337 parsoid=wt2html,html2html
16338 !! wikitext
16339 <font color=>foo</font>
16340 !! html/php
16341 <p><font color="">foo</font>
16342 </p>
16343 !! html/parsoid
16344 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16345 !! end
16346
16347 !! test
16348 Attribute test: unquoted value
16349 !! options
16350 parsoid=wt2html,html2html
16351 !! wikitext
16352 <font color=x>foo</font>
16353 !! html/php
16354 <p><font color="x">foo</font>
16355 </p>
16356 !! html/parsoid
16357 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16358 !! end
16359
16360 !! test
16361 Attribute test: unquoted but illegal value (hash)
16362 !! wikitext
16363 <font color=#x>foo</font>
16364 !! html
16365 <p><font color="#x">foo</font>
16366 </p>
16367 !! end
16368
16369 # Parsoid does not serialize to empty attribute syntax,
16370 # so wt2wt and html2wt cases are skipped
16371 !! test
16372 Attribute test: no value (T54330)
16373 !! options
16374 parsoid=wt2html,html2html
16375 !! wikitext
16376 <font color>foo</font>
16377 !! html/php
16378 <p><font color="">foo</font>
16379 </p>
16380 !! html/parsoid
16381 <p><font color="">foo</font></p>
16382 !! end
16383
16384 !! test
16385 Bug 2095: link with three closing brackets
16386 !! wikitext
16387 [[Main Page]]]
16388 !! html/php
16389 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16390 </p>
16391 !! html/parsoid
16392 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16393 !! end
16394
16395 !! test
16396 Bug 2095: link with pipe and three closing brackets
16397 !! wikitext
16398 [[Main Page|link]]]
16399 !! html/php
16400 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16401 </p>
16402 !! html/parsoid
16403 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16404 !! end
16405
16406 !! test
16407 Bug 2095: link with pipe and three closing brackets, version 2
16408 !! wikitext
16409 [[Main Page|[http://example.com/]]]
16410 !! html/php
16411 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16412 </p>
16413 !! html/parsoid
16414 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16415 !! end
16416
16417
16418 ###
16419 ### Safety
16420 ###
16421
16422 !! article
16423 Template:Dangerous attribute
16424 !! text
16425 " onmouseover="alert(document.cookie)
16426 !! endarticle
16427
16428 !! article
16429 Template:Dangerous style attribute
16430 !! text
16431 border-size: expression(alert(document.cookie))
16432 !! endarticle
16433
16434 !! article
16435 Template:Div style
16436 !! text
16437 <div style="float: right; {{{1}}}">Magic div</div>
16438 !! endarticle
16439
16440 !! test
16441 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16442 !! wikitext
16443 <div title="{{test}}"></div>
16444 !! html
16445 <div title="This is a test template"></div>
16446
16447 !! end
16448
16449 # Parsoid has enough context to handle this case
16450 !! test
16451 Bug 2304: HTML attribute safety (dangerous template; 2309)
16452 !! wikitext
16453 <div title="{{dangerous attribute}}"></div>
16454 !! html/php
16455 <div title=""></div>
16456
16457 !! html/parsoid
16458 <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>
16459 !! end
16460
16461 !! test
16462 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16463 !! wikitext
16464 <div style="{{dangerous style attribute}}"></div>
16465 !! html
16466 <div style="/* insecure input */"></div>
16467
16468 !! end
16469
16470 !! test
16471 Bug 2304: HTML attribute safety (safe parameter; 2309)
16472 !! wikitext
16473 {{div style|width: 200px}}
16474 !! html
16475 <div style="float: right; width: 200px">Magic div</div>
16476
16477 !! end
16478
16479 !! test
16480 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16481 !! wikitext
16482 {{div style|width: expression(alert(document.cookie))}}
16483 !! html
16484 <div style="/* insecure input */">Magic div</div>
16485
16486 !! end
16487
16488 !! test
16489 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16490 !! wikitext
16491 {{div style|"><script>alert(document.cookie)</script>}}
16492 !! html
16493 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16494
16495 !! end
16496
16497 !! test
16498 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16499 !! wikitext
16500 {{div style|" ><script>alert(document.cookie)</script>}}
16501 !! html
16502 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16503
16504 !! end
16505
16506 !! test
16507 Bug 2304: HTML attribute safety (link)
16508 !! wikitext
16509 <div title="[[Main Page]]"></div>
16510 !! html
16511 <div title="&#91;&#91;Main Page]]"></div>
16512
16513 !! end
16514
16515 !! test
16516 Bug 2304: HTML attribute safety (italics)
16517 !! wikitext
16518 <div title="''foobar''"></div>
16519 !! html
16520 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16521
16522 !! end
16523
16524 !! test
16525 Bug 2304: HTML attribute safety (bold)
16526 !! wikitext
16527 <div title="'''foobar'''"></div>
16528 !! html
16529 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16530
16531 !! end
16532
16533
16534 !! test
16535 Bug 2304: HTML attribute safety (ISBN)
16536 !! wikitext
16537 <div title="ISBN 1234567890"></div>
16538 !! html
16539 <div title="&#73;SBN 1234567890"></div>
16540
16541 !! end
16542
16543 !! test
16544 Bug 2304: HTML attribute safety (RFC)
16545 !! wikitext
16546 <div title="RFC 1234"></div>
16547 !! html
16548 <div title="&#82;FC 1234"></div>
16549
16550 !! end
16551
16552 !! test
16553 Bug 2304: HTML attribute safety (PMID)
16554 !! wikitext
16555 <div title="PMID 1234567890"></div>
16556 !! html
16557 <div title="&#80;MID 1234567890"></div>
16558
16559 !! end
16560
16561 !! test
16562 Bug 2304: HTML attribute safety (web link)
16563 !! wikitext
16564 <div title="http://example.com/"></div>
16565 !! html
16566 <div title="http&#58;//example.com/"></div>
16567
16568 !! end
16569
16570 !! test
16571 Bug 2304: HTML attribute safety (named web link)
16572 !! wikitext
16573 <div title="[http://example.com/ link]"></div>
16574 !! html
16575 <div title="&#91;http&#58;//example.com/ link]"></div>
16576
16577 !! end
16578
16579 !! test
16580 Bug 3244: HTML attribute safety (extension; safe)
16581 !! wikitext
16582 <div style="<nowiki>background:blue</nowiki>"></div>
16583 !! html
16584 <div style="background:blue"></div>
16585
16586 !! end
16587
16588 !! test
16589 Bug 3244: HTML attribute safety (extension; unsafe)
16590 !! wikitext
16591 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16592 !! html
16593 <div style="/* insecure input */"></div>
16594
16595 !! end
16596
16597 # More MSIE fun discovered by Tom Gilder
16598
16599 !! test
16600 MSIE CSS safety test: spurious slash
16601 !! wikitext
16602 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16603 !! html
16604 <div style="/* insecure input */">evil</div>
16605
16606 !! end
16607
16608 !! test
16609 MSIE CSS safety test: hex code
16610 !! wikitext
16611 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16612 !! html
16613 <div style="/* insecure input */">evil</div>
16614
16615 !! end
16616
16617 !! test
16618 MSIE CSS safety test: comment in url
16619 !! wikitext
16620 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16621 !! html
16622 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16623
16624 !! end
16625
16626 !! test
16627 MSIE CSS safety test: comment in expression
16628 !! wikitext
16629 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16630 !! html
16631 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16632
16633 !! end
16634
16635 !! test
16636 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16637 !! wikitext
16638 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16639 !! html
16640 <p style="/* invalid control char */">A</p>
16641
16642 !! end
16643
16644 !! test
16645 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16646 !! wikitext
16647 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16648 <div style="top:EXPRESSION(alert())">B</div>
16649 !! html
16650 <p style="/* insecure input */">A</p>
16651 <div style="/* insecure input */">B</div>
16652
16653 !! end
16654
16655 !! test
16656 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16657 !! wikitext
16658 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16659 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16660 !! html
16661 <div style="/* insecure input */">A</div>
16662 <p style="/* insecure input */">B</p>
16663
16664 !! end
16665
16666 !! test
16667 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16668 !! wikitext
16669 <div style="background-image:url⁽javascript:alert())">A</div>
16670 <div style="background-image:url₍javascript:alert())">B</div>
16671 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16672 !! html
16673 <div style="/* insecure input */">A</div>
16674 <div style="/* insecure input */">B</div>
16675 <p style="/* insecure input */">C</p>
16676
16677 !! end
16678
16679 # FIXME: Parsoid fails to sanitize this! See T58846.
16680 !! test
16681 Opera -o-link CSS
16682 !! wikitext
16683 <div
16684 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;"
16685 style="-o-link:attr(title);-o-link-source:current">X</div>
16686 !! html
16687 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16688
16689 !! end
16690
16691 !! test
16692 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16693 !! wikitext
16694 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16695 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16696 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16697 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16698 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16699 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16700 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16701 !! html
16702 <p style="/* insecure input */">A</p>
16703 <p style="/* insecure input */">B</p>
16704 <p style="/* insecure input */">C</p>
16705 <p style="/* insecure input */">D</p>
16706 <p style="/* insecure input */">E</p>
16707 <p style="/* insecure input */">F</p>
16708 <p style="/* insecure input */">G</p>
16709
16710 !! end
16711
16712 !! test
16713 Table attribute legitimate extension
16714 !! wikitext
16715 {|
16716 !+ style="<nowiki>color:blue</nowiki>"| status
16717 |}
16718 !! html
16719 <table>
16720 <tr>
16721 <th style="color:blue"> status
16722 </th></tr></table>
16723
16724 !!end
16725
16726 !! test
16727 Table attribute safety
16728 !! wikitext
16729 {|
16730 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16731 |}
16732 !! html
16733 <table>
16734 <tr>
16735 <th style="/* insecure input */"> status
16736 </th></tr></table>
16737
16738 !! end
16739
16740 !! test
16741 CSS line continuation 1
16742 !! wikitext
16743 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16744 !! html
16745 <div style="/* insecure input */"></div>
16746
16747 !! end
16748
16749 !! test
16750 CSS line continuation 2
16751 !! wikitext
16752 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16753 !! html
16754 <div style="/* invalid control char */"></div>
16755
16756 !! end
16757
16758 !! article
16759 Template:Identity
16760 !! text
16761 {{{1}}}
16762 !! endarticle
16763
16764 !! test
16765 Expansion of multi-line templates in attribute values (bug 6255)
16766 !! wikitext
16767 <div style="background: {{identity|#00FF00}}">-</div>
16768 !! html
16769 <div style="background: #00FF00">-</div>
16770
16771 !! end
16772
16773
16774 !! test
16775 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16776 !! wikitext
16777 <div style="background:
16778 #00FF00">-</div>
16779 !! html/php
16780 <div style="background: #00FF00">-</div>
16781
16782 !! html/parsoid
16783 <div style="background:
16784 #00FF00">-</div>
16785 !! end
16786
16787 !! test
16788 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16789 !! wikitext
16790 <div style="background: &#10;#00FF00">-</div>
16791 !! html
16792 <div style="background: &#10;#00FF00">-</div>
16793
16794 !! end
16795
16796 !! test
16797 Tags which are hidden from Tidy cannot pass through the Sanitizer
16798 !! wikitext
16799 <mw:toc><script>alert();</script></mw:toc>
16800 !! html+tidy
16801 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16802 !! end
16803
16804 ###
16805 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16806 ###
16807 !! test
16808 Parser hook: empty input
16809 !! wikitext
16810 <tag></tag>
16811 !! html/php
16812 <pre>
16813 ''
16814 array (
16815 )
16816 </pre>
16817
16818 !! html/parsoid
16819 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16820 !! end
16821
16822 ## Don't expect parsoid to rt this form.
16823 !! test
16824 Parser hook: empty input using terminated empty elements
16825 !! options
16826 parsoid=wt2html,html2html
16827 !! wikitext
16828 <tag/>
16829 !! html/php
16830 <pre>
16831 NULL
16832 array (
16833 )
16834 </pre>
16835
16836 !! html/parsoid
16837 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16838 !! end
16839
16840 !! test
16841 Parser hook: empty input using terminated empty elements (space before)
16842 !! wikitext
16843 <tag />
16844 !! html/php
16845 <pre>
16846 NULL
16847 array (
16848 )
16849 </pre>
16850
16851 !! html/parsoid
16852 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16853 !! end
16854
16855 !! test
16856 Parser hook: basic input
16857 !! wikitext
16858 <tag>input</tag>
16859 !! html/php
16860 <pre>
16861 'input'
16862 array (
16863 )
16864 </pre>
16865
16866 !! html/parsoid
16867 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16868 !! end
16869
16870 ## Don't expect parsoid to rt this form.
16871 !! test
16872 Parser hook: case insensitive
16873 !! options
16874 parsoid=wt2html,html2html
16875 !! wikitext
16876 <TAG>input</TAG>
16877 !! html/php
16878 <pre>
16879 'input'
16880 array (
16881 )
16882 </pre>
16883
16884 !! html/parsoid
16885 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16886 !! end
16887
16888 ## Don't expect parsoid to rt this form.
16889 !! test
16890 Parser hook: case insensitive, redux
16891 !! options
16892 parsoid=wt2html,html2html
16893 !! wikitext
16894 <TaG>input</TAg>
16895 !! html/php
16896 <pre>
16897 'input'
16898 array (
16899 )
16900 </pre>
16901
16902 !! html/parsoid
16903 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16904 !! end
16905
16906 !! test
16907 Parser hook: nested tags
16908 !! wikitext
16909 <tag><tag></tag></tag>
16910 !! html/php
16911 <pre>
16912 '<tag>'
16913 array (
16914 )
16915 </pre>&lt;/tag&gt;
16916
16917 !! html/parsoid
16918 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16919 !! end
16920
16921 !! test
16922 Parser hook: basic arguments
16923 !! wikitext
16924 <tag width="200" height="100" depth="50" square=""></tag>
16925 !! html/php
16926 <pre>
16927 ''
16928 array (
16929 'width' => '200',
16930 'height' => '100',
16931 'depth' => '50',
16932 'square' => '',
16933 )
16934 </pre>
16935
16936 !! html/parsoid
16937 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16938 !! end
16939
16940 ## Don't expect parsoid to rt this form.
16941 !! test
16942 Parser hook: basic arguments, variations
16943 !! options
16944 parsoid=wt2html,html2html
16945 !! wikitext
16946 <tag width=200 height = "100" depth = '50' square></tag>
16947 !! html/php
16948 <pre>
16949 ''
16950 array (
16951 'width' => '200',
16952 'height' => '100',
16953 'depth' => '50',
16954 'square' => '',
16955 )
16956 </pre>
16957
16958 !! html/parsoid
16959 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16960 !! end
16961
16962 !! test
16963 Parser hook: argument containing a forward slash (bug 5344)
16964 !! wikitext
16965 <tag filename="/tmp/bla"></tag>
16966 !! html/php
16967 <pre>
16968 ''
16969 array (
16970 'filename' => '/tmp/bla',
16971 )
16972 </pre>
16973
16974 !! html/parsoid
16975 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16976 !! end
16977
16978 ## Don't expect parsoid to rt this form.
16979 !! test
16980 Parser hook: empty input using terminated empty elements (bug 2374)
16981 !! options
16982 parsoid=wt2html,html2html
16983 !! wikitext
16984 <tag foo=bar/>text
16985 !! html/php
16986 <pre>
16987 NULL
16988 array (
16989 'foo' => 'bar',
16990 )
16991 </pre>text
16992
16993 !! html/parsoid
16994 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16995 !! end
16996
16997 ## </tag> should be output literally since there is no matching tag that begins it
16998 ## Don't expect parsoid to rt this form.
16999 !! test
17000 Parser hook: basic arguments using terminated empty elements (bug 2374)
17001 !! options
17002 parsoid=wt2html
17003 !! wikitext
17004 <tag width=200 height = "100" depth = '50' square/>
17005 other stuff
17006 </tag>
17007 !! html/php
17008 <pre>
17009 NULL
17010 array (
17011 'width' => '200',
17012 'height' => '100',
17013 'depth' => '50',
17014 'square' => '',
17015 )
17016 </pre>
17017 <p>other stuff
17018 &lt;/tag&gt;
17019 </p>
17020 !! html/parsoid
17021 <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
17022 &lt;/tag></p>
17023 !! end
17024
17025 ## Don't expect parsoid to rt this form.
17026 !! test
17027 Parser hook: Don't allow unclosed extension tags
17028 !! options
17029 parsoid=wt2html
17030 !! wikitext
17031 test <tag>123
17032
17033 this is a '''test'''
17034 !! html/php
17035 <p>test &lt;tag&gt;123
17036 </p><p>this is a <b>test</b>
17037 </p>
17038 !! html/parsoid
17039 <p>test &lt;tag>123</p>
17040
17041 <p>this is a <b>test</b></p>
17042 !! end
17043
17044 ###
17045 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17046 ###
17047
17048 !! test
17049 Parser hook: static parser hook not inside a comment
17050 !! wikitext
17051 <statictag>hello, world</statictag>
17052
17053 <statictag action="flush" />
17054 !! html/php
17055 <p><br />
17056 hello, world
17057 </p>
17058 !! html/parsoid
17059 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17060 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17061 !! end
17062
17063 !! test
17064 Parser hook: static parser hook inside a comment
17065 !! wikitext
17066 <!-- <statictag>hello, world</statictag> -->
17067 <statictag action="flush" />
17068 !! html/php
17069 <p><br />
17070 </p>
17071 !! html/parsoid
17072 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17073 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17074 !! end
17075
17076 # Nested template calls; this case was broken by Parser.php rev 1.506,
17077 # since reverted.
17078
17079 !! article
17080 Template:One-parameter
17081 !! text
17082 (My parameter is: {{{1}}})
17083 !! endarticle
17084
17085 !! article
17086 Template:Map-one-parameter
17087 !! text
17088 {{{{{1}}}|{{{2}}}}}
17089 !! endarticle
17090
17091 !! test
17092 Nested template calls
17093 !! wikitext
17094 {{Map-one-parameter|One-parameter|param}}
17095 !! html
17096 <p>(My parameter is: param)
17097 </p>
17098 !! end
17099
17100
17101 ###
17102 ### Sanitizer
17103 ###
17104
17105 # HTML+Tidy effectively strips out the empty tags completely
17106 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17107 # which Tidy would have done for the PHP parser had there been content inside it.
17108 !! test
17109 Sanitizer: Closing of open tags
17110 !! wikitext
17111 <s></s><table></table>
17112 !! html
17113 <s></s><table></table>
17114
17115 !! html/parsoid
17116 <p><s></s></p><table></table>
17117 !! end
17118
17119 !! test
17120 Sanitizer: Closing of open but not closed tags
17121 !! wikitext
17122 <s>foo
17123 !! html
17124 <p><s>foo</s>
17125 </p>
17126 !! end
17127
17128 !! test
17129 Sanitizer: Closing of closed but not open tags
17130 !! options
17131 parsoid=wt2html
17132 !! wikitext
17133 </s>
17134 !! html/php+tidy
17135 !! html/parsoid
17136 !! end
17137
17138 !! test
17139 Sanitizer: Closing of closed but not open table tags
17140 !! options
17141 parsoid=wt2html
17142 !! wikitext
17143 Table not started</td></tr></table>
17144 !! html/php+tidy
17145 <p>Table not started</p>
17146 !! html/parsoid
17147 <p>Table not started</p>
17148 !! end
17149
17150 !! test
17151 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17152 !! wikitext
17153 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17154 !! html/php
17155 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17156 </p>
17157 !! html/parsoid
17158 <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>
17159 !! end
17160
17161 # In HTML5, the restrictions are that id must contain at least one character,
17162 # and must not contain any space characters.
17163 !! test
17164 Sanitizer: Validating the contents of the id attribute (bug 4515)
17165 !! options
17166 disabled
17167 !! wikitext
17168 <br id="" /><br id="a space" />
17169 !! html
17170 Something ...
17171 !! end
17172
17173 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17174 !! test
17175 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17176 !! options
17177 disabled
17178 !! wikitext
17179 <br id="foo" /><br id="foo" />
17180 !! html
17181 Something need to be done. foo-2 ?
17182 !! end
17183
17184 !! test
17185 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17186 !! wikitext
17187 <div itemscope>
17188 <meta itemprop="hello" content="world">
17189 <meta http-equiv="refresh" content="5">
17190 <meta itemprop="hello" http-equiv="refresh" content="5">
17191 <link itemprop="hello" href="{{SERVER}}">
17192 <link rel="stylesheet" href="{{SERVER}}">
17193 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17194 </div>
17195 !! html
17196 <div itemscope="">
17197 <p> <meta itemprop="hello" content="world" />
17198 &lt;meta http-equiv="refresh" content="5"&gt;
17199 <meta itemprop="hello" content="5" />
17200 </p>
17201 <link itemprop="hello" href="http&#58;//example.org" />
17202 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17203 <link itemprop="hello" href="http&#58;//example.org" />
17204 </div>
17205
17206 !! end
17207
17208 !! test
17209 Language converter: output gets cut off unexpectedly (bug 5757)
17210 !! options
17211 language=zh
17212 !! wikitext
17213 this bit is safe: }-
17214
17215 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17216
17217 then we get cut off here: }-
17218
17219 all additional text is vanished
17220 !! html
17221 <p>this bit is safe: }-
17222 </p><p>but if we add a conversion instance: xxx
17223 </p><p>then we get cut off here: }-
17224 </p><p>all additional text is vanished
17225 </p>
17226 !! end
17227
17228 !! test
17229 Self closed html pairs (bug 5487)
17230 !! options
17231 !! wikitext
17232 <center><font id="bug" />Centered text</center>
17233 <div><font id="bug2" />In div text</div>
17234 !! html
17235 <center>&lt;font id="bug" /&gt;Centered text</center>
17236 <div>&lt;font id="bug2" /&gt;In div text</div>
17237
17238 !! end
17239
17240 #
17241 #
17242 #
17243
17244 !! test
17245 Punctuation: nbsp before exclamation
17246 !! wikitext
17247 C'est grave !
17248 !! html
17249 <p>C'est grave&#160;!
17250 </p>
17251 !! end
17252
17253 !! test
17254 Punctuation: CSS !important (bug 11874)
17255 !! wikitext
17256 <div style="width:50% !important">important</div>
17257 !! html
17258 <div style="width:50% !important">important</div>
17259
17260 !!end
17261
17262 !! test
17263 Punctuation: CSS ! important (bug 11874; with space after)
17264 !! wikitext
17265 <div style="width:50% ! important">important</div>
17266 !! html
17267 <div style="width:50% ! important">important</div>
17268
17269 !!end
17270
17271 !! test
17272 HTML bullet list, closed tags (bug 5497)
17273 !! wikitext
17274 <ul>
17275 <li>One</li>
17276 <li>Two</li>
17277 </ul>
17278 !! html/php
17279 <ul>
17280 <li>One</li>
17281 <li>Two</li>
17282 </ul>
17283
17284 !! html/parsoid
17285 <ul data-parsoid='{"stx":"html"}'>
17286 <li data-parsoid='{"stx":"html"}'>One</li>
17287 <li data-parsoid='{"stx":"html"}'>Two</li>
17288 </ul>
17289
17290 !! end
17291
17292 !! test
17293 HTML bullet list, unclosed tags (bug 5497)
17294 !! wikitext
17295 <ul>
17296 <li>One
17297 <li>Two
17298 </ul>
17299 !! html/php+tidy
17300 <ul>
17301 <li>One</li>
17302 <li>Two</li>
17303 </ul>
17304 !! html/parsoid
17305 <ul data-parsoid='{"stx":"html"}'>
17306 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17307 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17308 </ul>
17309
17310 !! end
17311
17312 !! test
17313 HTML ordered list, closed tags (bug 5497)
17314 !! wikitext
17315 <ol>
17316 <li>One</li>
17317 <li>Two</li>
17318 </ol>
17319 !! html/php
17320 <ol>
17321 <li>One</li>
17322 <li>Two</li>
17323 </ol>
17324
17325 !! html/parsoid
17326 <ol data-parsoid='{"stx":"html"}'>
17327 <li data-parsoid='{"stx":"html"}'>One</li>
17328 <li data-parsoid='{"stx":"html"}'>Two</li>
17329 </ol>
17330
17331 !! end
17332
17333 !! test
17334 HTML ordered list, unclosed tags (bug 5497)
17335 !! options
17336 !! wikitext
17337 <ol>
17338 <li>One
17339 <li>Two
17340 </ol>
17341 !! html/php+tidy
17342 <ol>
17343 <li>One</li>
17344 <li>Two</li>
17345 </ol>
17346 !! html/parsoid
17347 <ol data-parsoid='{"stx":"html"}'>
17348 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17349 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17350 </ol>
17351
17352 !! end
17353
17354 !! test
17355 HTML nested bullet list, closed tags (bug 5497)
17356 !! wikitext
17357 <ul>
17358 <li>One</li>
17359 <li>Two:
17360 <ul>
17361 <li>Sub-one</li>
17362 <li>Sub-two</li>
17363 </ul>
17364 </li>
17365 </ul>
17366 !! html/php
17367 <ul>
17368 <li>One</li>
17369 <li>Two:
17370 <ul>
17371 <li>Sub-one</li>
17372 <li>Sub-two</li>
17373 </ul>
17374 </li>
17375 </ul>
17376
17377 !! html/parsoid
17378 <ul data-parsoid='{"stx":"html"}'>
17379 <li data-parsoid='{"stx":"html"}'>One</li>
17380 <li data-parsoid='{"stx":"html"}'>Two:
17381 <ul data-parsoid='{"stx":"html"}'>
17382 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17383 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17384 </ul>
17385 </li>
17386 </ul>
17387 !! end
17388
17389 !! test
17390 HTML nested bullet list, open tags (bug 5497)
17391 !! wikitext
17392 <ul>
17393 <li>One
17394 <li>Two:
17395 <ul>
17396 <li>Sub-one
17397 <li>Sub-two
17398 </ul>
17399 </ul>
17400 !! html/php+tidy
17401 <ul>
17402 <li>One</li>
17403 <li>Two:
17404 <ul>
17405 <li>Sub-one</li>
17406 <li>Sub-two</li>
17407 </ul>
17408 </li>
17409 </ul>
17410 !! html/parsoid
17411 <ul>
17412 <li>One
17413 </li>
17414 <li>Two:
17415 <ul>
17416 <li>Sub-one
17417 </li>
17418 <li>Sub-two
17419 </li>
17420 </ul>
17421 </li>
17422 </ul>
17423
17424 !! end
17425
17426 !! test
17427 HTML nested ordered list, closed tags (bug 5497)
17428 !! wikitext
17429 <ol>
17430 <li>One</li>
17431 <li>Two:
17432 <ol>
17433 <li>Sub-one</li>
17434 <li>Sub-two</li>
17435 </ol>
17436 </li>
17437 </ol>
17438 !! html
17439 <ol>
17440 <li>One</li>
17441 <li>Two:
17442 <ol>
17443 <li>Sub-one</li>
17444 <li>Sub-two</li>
17445 </ol>
17446 </li>
17447 </ol>
17448
17449 !! end
17450
17451 !! test
17452 HTML nested ordered list, open tags (bug 5497)
17453 !! wikitext
17454 <ol>
17455 <li>One
17456 <li>Two:
17457 <ol>
17458 <li>Sub-one
17459 <li>Sub-two
17460 </ol>
17461 </ol>
17462 !! html/php
17463 <ol>
17464 <li>One
17465 <li>Two:
17466 <ol>
17467 <li>Sub-one
17468 <li>Sub-two
17469 </ol>
17470 </ol>
17471
17472 !! html/parsoid
17473 <ol>
17474 <li>One
17475 </li>
17476 <li>Two:
17477 <ol>
17478 <li>Sub-one
17479 </li>
17480 <li>Sub-two
17481 </li>
17482 </ol>
17483 </li>
17484 </ol>
17485
17486 !! end
17487
17488 !! test
17489 HTML ordered list item with parameters oddity
17490 !! wikitext
17491 <ol><li id="fragment">One</li>
17492 </ol>
17493 !! html
17494 <ol><li id="fragment">One</li>
17495 </ol>
17496
17497 !! end
17498
17499 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17500 !!test
17501 bug 5918: autonumbering
17502 !! wikitext
17503 [http://first/] [http://second] [ftp://ftp]
17504
17505 ftp://inlineftp
17506
17507 [mailto:enclosed@mail.tld With target]
17508
17509 [mailto:enclosed@mail.tld]
17510
17511 mailto:inline@mail.tld
17512 !! html/php
17513 <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>
17514 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17515 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17516 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17517 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17518 </p>
17519 !! html/parsoid
17520 <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>
17521 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17522 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17523 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17524 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17525 !! end
17526
17527
17528 #
17529 # Security and HTML correctness
17530 # From Nick Jenkins' fuzz testing
17531 #
17532
17533 !! test
17534 Fuzz testing: Parser13
17535 !! wikitext
17536 {|
17537 | http://a|
17538 !! html
17539 <table>
17540 <tr>
17541 <td>
17542 </td>
17543 </tr>
17544 </table>
17545
17546 !! end
17547
17548 !! test
17549 Fuzz testing: Parser14
17550 !! wikitext
17551 == onmouseover= ==
17552 http://__TOC__
17553 !! html
17554 <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>
17555 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17556 <ul>
17557 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17558 </ul>
17559 </div>
17560
17561
17562 !! html+tidy
17563 <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>
17564 <p>http://</p>
17565 <div id="toc" class="toc">
17566 <div id="toctitle">
17567 <h2>Contents</h2>
17568 </div>
17569 <ul>
17570 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17571 </ul>
17572 </div>
17573 <p></p>
17574 !! end
17575
17576 !! test
17577 Fuzz testing: Parser14-table
17578 !! options
17579 parsoid=wt2html,html2html
17580 !! wikitext
17581 ==a==
17582 {| STYLE=__TOC__
17583 !! html
17584 <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>
17585 <table style="&#95;_TOC&#95;_">
17586 <tr><td></td></tr>
17587 </table>
17588
17589 !! html+tidy
17590 <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>
17591 <table style="__TOC__">
17592 <tr>
17593 <td></td>
17594 </tr>
17595 </table>
17596 !! html/parsoid
17597 <h2>a</h2>
17598 <table style="__TOC__"></table>
17599 !! end
17600
17601 # Known to produce bogus xml (extra </td>)
17602 !! test
17603 Fuzz testing: Parser16
17604 !! wikitext
17605 {|
17606 !https://||||||
17607 !! html
17608 <table>
17609 <tr>
17610 <th>https://</th>
17611 <th></th>
17612 <th></th>
17613 <th>
17614 </td>
17615 </tr>
17616 </table>
17617
17618 !! html+tidy
17619 <table>
17620 <tr>
17621 <th>https://</th>
17622 <th></th>
17623 <th></th>
17624 <th></th>
17625 </tr>
17626 </table>
17627 !! end
17628
17629 !! test
17630 Fuzz testing: Parser21
17631 !! wikitext
17632 {|
17633 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17634 |
17635 !! html
17636 <table>
17637 <tr>
17638 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17639 </th>
17640 <td>
17641 </td>
17642 </tr>
17643 </table>
17644
17645 !! end
17646
17647 !! test
17648 Fuzz testing: Parser22
17649 !! wikitext
17650 http://===r:::https://b
17651
17652 {|
17653 !! html
17654 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17655 </p>
17656 <table>
17657 <tr><td></td></tr>
17658 </table>
17659
17660 !! end
17661
17662 # Known to produce bad XML for now
17663 !! test
17664 Fuzz testing: Parser24
17665 !! wikitext
17666 {|
17667 {{{|
17668 <u CLASS=
17669 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17670 <br style="onmouseover='alert(document.cookie);' " />
17671
17672 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17673 |
17674 !! html
17675 <table>
17676 {{{|
17677 <u class="&#124;">}}}} &gt;
17678 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17679
17680 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17681 <tr>
17682 <td></u>
17683 </td>
17684 </tr>
17685 </table>
17686
17687 !! end
17688
17689 # Note: the current result listed for this is not what the original one was,
17690 # but the original bug was JavaScript injection, which is fixed in any case.
17691 # It's not clear that the original result listed was any more correct than the
17692 # current one. Original result:
17693 # <p>{{{|
17694 # </p>
17695 # <li class="&#124;&#124;">
17696 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17697 !!test
17698 Fuzz testing: Parser25 (bug 6055)
17699 !! wikitext
17700 {{{
17701 |
17702 <LI CLASS=||
17703 >
17704 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17705 !! html
17706 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17707 </p>
17708 !! end
17709
17710 !!test
17711 Fuzz testing: URL adjacent extension (with space, clean)
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; nowiki)
17723 !! wikitext
17724 http://example.com<nowiki>junk</nowiki>
17725 !! html/php
17726 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17727 </p>
17728 !! html/parsoid
17729 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17730 !! end
17731
17732 !!test
17733 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17734 !! wikitext
17735 http://example.com<pre>junk</pre>
17736 !! html/php
17737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17738
17739 !! html/php+tidy
17740 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17741 <pre>
17742 junk
17743 </pre>
17744 !! html/parsoid
17745 <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>
17746 !!end
17747
17748 !!test
17749 Fuzz testing: image with bogus manual thumbnail
17750 !! wikitext
17751 [[Image:foobar.jpg|thumbnail= ]]
17752 !! html/php
17753 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17754
17755 !! html/parsoid
17756 <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>
17757 !!end
17758
17759 !! test
17760 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17761 !! wikitext
17762 <pre dir="&#10;"></pre>
17763 !! html
17764 <pre dir="&#10;"></pre>
17765
17766 !! end
17767
17768 !! test
17769 Parsing optional HTML elements (Bug 6171)
17770 !! options
17771 !! wikitext
17772 <table>
17773 <tr>
17774 <td> Some tabular data</td>
17775 <td> More tabular data ...
17776 <td> And yet som tabular data</td>
17777 </tr>
17778 </table>
17779 !! html
17780 <table>
17781 <tr>
17782 <td> Some tabular data</td>
17783 <td> More tabular data ...
17784 </td><td> And yet som tabular data</td>
17785 </tr>
17786 </table>
17787
17788 !! end
17789
17790 !! test
17791 Correct handling of <td>, <tr> (Bug 6171)
17792 !! options
17793 !! wikitext
17794 <table>
17795 <tr>
17796 <td> Some tabular data</td>
17797 <td> More tabular data ...</td>
17798 <td> And yet som tabular data</td>
17799 </tr>
17800 </table>
17801 !! html
17802 <table>
17803 <tr>
17804 <td> Some tabular data</td>
17805 <td> More tabular data ...</td>
17806 <td> And yet som tabular data</td>
17807 </tr>
17808 </table>
17809
17810 !! end
17811
17812
17813 !! test
17814 Parsing crashing regression (fr:JavaScript)
17815 !! wikitext
17816 </body></x>
17817 !! html
17818 <p>&lt;/body&gt;&lt;/x&gt;
17819 </p>
17820 !! end
17821
17822 !! test
17823 Inline wiki vs wiki block nesting
17824 !! wikitext
17825 '''Bold paragraph
17826
17827 New wiki paragraph
17828 !! html
17829 <p><b>Bold paragraph</b>
17830 </p><p>New wiki paragraph
17831 </p>
17832 !! end
17833
17834 # FIXME: The current php output is documented
17835 # and desired output is the parsoid target.
17836 !! test
17837 Inline HTML vs wiki block nesting
17838 !! wikitext
17839 <b>Bold paragraph
17840
17841 New wiki paragraph
17842 !! html/php
17843 <p><b>Bold paragraph
17844 </p><p>New wiki paragraph</b>
17845 </p>
17846 !! html/parsoid
17847 <p><b>Bold paragraph</b>
17848 </p><p>New wiki paragraph
17849 </p>
17850 !! end
17851
17852 # Original result was this:
17853 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17854 # </p>
17855 # While that might be marginally more intuitive, maybe, the six-apostrophe
17856 # construct is clearly pathological and the result stated here (which is what
17857 # the parser actually does) is about as reasonable as anything.
17858 !!test
17859 Mixing markup for italics and bold
17860 !! options
17861 !! wikitext
17862 '''bold''''''bold''bolditalics'''''
17863 !! html
17864 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17865 </p>
17866 !! end
17867
17868
17869 !! article
17870 Xyzzyx
17871 !! text
17872 Article for special page transclusion test
17873 !! endarticle
17874
17875 !! test
17876 Special page transclusion
17877 !! options
17878 !! wikitext
17879 {{Special:Prefixindex/Xyzzyx}}
17880 !! html
17881 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17882 </ul>
17883
17884 !! end
17885
17886 !! test
17887 Special page transclusion twice (bug 5021)
17888 !! options
17889 !! wikitext
17890 {{Special:Prefixindex/Xyzzyx}}
17891 {{Special:Prefixindex/Xyzzyx}}
17892 !! html
17893 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17894 </ul>
17895 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17896 </ul>
17897
17898 !! end
17899
17900 !! test
17901 Transclusion of default MediaWiki message
17902 !! wikitext
17903 {{MediaWiki:Mainpage}}
17904 !! html
17905 <p>Main Page
17906 </p>
17907 !! end
17908
17909 !! test
17910 Transclusion of nonexistent MediaWiki message
17911 !! wikitext
17912 {{MediaWiki:Mainpagexxx}}
17913 !! html
17914 <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>
17915 </p>
17916 !! end
17917
17918 !! test
17919 Transclusion of MediaWiki message with underscore
17920 !! wikitext
17921 {{MediaWiki:history_short}}
17922 !! html
17923 <p>History
17924 </p>
17925 !! end
17926
17927 !! test
17928 Transclusion of MediaWiki message with space
17929 !! wikitext
17930 {{MediaWiki:history short}}
17931 !! html
17932 <p>History
17933 </p>
17934 !! end
17935
17936 !! test
17937 Invalid header with following text
17938 !! wikitext
17939 = x = y
17940 !! html
17941 <p>= x = y
17942 </p>
17943 !! end
17944
17945
17946 !! test
17947 Section extraction test (section 0)
17948 !! options
17949 section=0
17950 !! wikitext
17951 start
17952 ==a==
17953 ===aa===
17954 ====aaa====
17955 ==b==
17956 ===ba===
17957 ===bb===
17958 ====bba====
17959 ===bc===
17960 ==c==
17961 ===ca===
17962 !! html/php
17963 start
17964 !! end
17965
17966 !! test
17967 Section extraction test (section 1)
17968 !! options
17969 section=1
17970 !! wikitext
17971 start
17972 ==a==
17973 ===aa===
17974 ====aaa====
17975 ==b==
17976 ===ba===
17977 ===bb===
17978 ====bba====
17979 ===bc===
17980 ==c==
17981 ===ca===
17982 !! html/php
17983 ==a==
17984 ===aa===
17985 ====aaa====
17986 !! end
17987
17988 !! test
17989 Section extraction test (section 2)
17990 !! options
17991 section=2
17992 !! wikitext
17993 start
17994 ==a==
17995 ===aa===
17996 ====aaa====
17997 ==b==
17998 ===ba===
17999 ===bb===
18000 ====bba====
18001 ===bc===
18002 ==c==
18003 ===ca===
18004 !! html/php
18005 ===aa===
18006 ====aaa====
18007 !! end
18008
18009 !! test
18010 Section extraction test (section 3)
18011 !! options
18012 section=3
18013 !! wikitext
18014 start
18015 ==a==
18016 ===aa===
18017 ====aaa====
18018 ==b==
18019 ===ba===
18020 ===bb===
18021 ====bba====
18022 ===bc===
18023 ==c==
18024 ===ca===
18025 !! html/php
18026 ====aaa====
18027 !! end
18028
18029 !! test
18030 Section extraction test (section 4)
18031 !! options
18032 section=4
18033 !! wikitext
18034 start
18035 ==a==
18036 ===aa===
18037 ====aaa====
18038 ==b==
18039 ===ba===
18040 ===bb===
18041 ====bba====
18042 ===bc===
18043 ==c==
18044 ===ca===
18045 !! html/php
18046 ==b==
18047 ===ba===
18048 ===bb===
18049 ====bba====
18050 ===bc===
18051 !! end
18052
18053 !! test
18054 Section extraction test (section 5)
18055 !! options
18056 section=5
18057 !! wikitext
18058 start
18059 ==a==
18060 ===aa===
18061 ====aaa====
18062 ==b==
18063 ===ba===
18064 ===bb===
18065 ====bba====
18066 ===bc===
18067 ==c==
18068 ===ca===
18069 !! html/php
18070 ===ba===
18071 !! end
18072
18073 !! test
18074 Section extraction test (section 6)
18075 !! options
18076 section=6
18077 !! wikitext
18078 start
18079 ==a==
18080 ===aa===
18081 ====aaa====
18082 ==b==
18083 ===ba===
18084 ===bb===
18085 ====bba====
18086 ===bc===
18087 ==c==
18088 ===ca===
18089 !! html/php
18090 ===bb===
18091 ====bba====
18092 !! end
18093
18094 !! test
18095 Section extraction test (section 7)
18096 !! options
18097 section=7
18098 !! wikitext
18099 start
18100 ==a==
18101 ===aa===
18102 ====aaa====
18103 ==b==
18104 ===ba===
18105 ===bb===
18106 ====bba====
18107 ===bc===
18108 ==c==
18109 ===ca===
18110 !! html/php
18111 ====bba====
18112 !! end
18113
18114 !! test
18115 Section extraction test (section 8)
18116 !! options
18117 section=8
18118 !! wikitext
18119 start
18120 ==a==
18121 ===aa===
18122 ====aaa====
18123 ==b==
18124 ===ba===
18125 ===bb===
18126 ====bba====
18127 ===bc===
18128 ==c==
18129 ===ca===
18130 !! html/php
18131 ===bc===
18132 !! end
18133
18134 !! test
18135 Section extraction test (section 9)
18136 !! options
18137 section=9
18138 !! wikitext
18139 start
18140 ==a==
18141 ===aa===
18142 ====aaa====
18143 ==b==
18144 ===ba===
18145 ===bb===
18146 ====bba====
18147 ===bc===
18148 ==c==
18149 ===ca===
18150 !! html/php
18151 ==c==
18152 ===ca===
18153 !! end
18154
18155 !! test
18156 Section extraction test (section 10)
18157 !! options
18158 section=10
18159 !! wikitext
18160 start
18161 ==a==
18162 ===aa===
18163 ====aaa====
18164 ==b==
18165 ===ba===
18166 ===bb===
18167 ====bba====
18168 ===bc===
18169 ==c==
18170 ===ca===
18171 !! html/php
18172 ===ca===
18173 !! end
18174
18175 !! test
18176 Section extraction test (nonexistent section 11)
18177 !! options
18178 section=11
18179 !! wikitext
18180 start
18181 ==a==
18182 ===aa===
18183 ====aaa====
18184 ==b==
18185 ===ba===
18186 ===bb===
18187 ====bba====
18188 ===bc===
18189 ==c==
18190 ===ca===
18191 !! html/php
18192 !! end
18193
18194 !! test
18195 Section extraction test with bogus heading (section 1)
18196 !! options
18197 section=1
18198 !! wikitext
18199 ==a==
18200 ==bogus== not a legal section
18201 ==b==
18202 !! html/php
18203 ==a==
18204 ==bogus== not a legal section
18205 !! end
18206
18207 !! test
18208 Section extraction test with bogus heading (section 2)
18209 !! options
18210 section=2
18211 !! wikitext
18212 ==a==
18213 ==bogus== not a legal section
18214 ==b==
18215 !! html/php
18216 ==b==
18217 !! end
18218
18219 !! test
18220 Section extraction test with comment after heading (section 1)
18221 !! options
18222 section=1
18223 !! wikitext
18224 ==a==
18225 ==b== <!-- -->
18226 ==c==
18227 !! html/php
18228 ==a==
18229 !! end
18230
18231 !! test
18232 Section extraction test with comment after heading (section 2)
18233 !! options
18234 section=2
18235 !! wikitext
18236 ==a==
18237 ==b== <!-- -->
18238 ==c==
18239 !! html/php
18240 ==b== <!-- -->
18241 !! end
18242
18243 !! test
18244 Section extraction test with bogus <nowiki> heading (section 1)
18245 !! options
18246 section=1
18247 !! wikitext
18248 ==a==
18249 ==bogus== <nowiki>not a legal section</nowiki>
18250 ==b==
18251 !! html/php
18252 ==a==
18253 ==bogus== <nowiki>not a legal section</nowiki>
18254 !! end
18255
18256 !! test
18257 Section extraction test with bogus <nowiki> heading (section 2)
18258 !! options
18259 section=2
18260 !! wikitext
18261 ==a==
18262 ==bogus== <nowiki>not a legal section</nowiki>
18263 ==b==
18264 !! html/php
18265 ==b==
18266 !! end
18267
18268 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18269 # instead of respecting commented sections
18270 !! test
18271 Section extraction prefixed by comment (section 1)
18272 !! options
18273 section=1
18274 !! wikitext
18275 <!-- -->==sec1==
18276 ==sec2==
18277 !! html/php
18278 ==sec2==
18279 !!end
18280
18281 !! test
18282 Section extraction prefixed by comment (section 2)
18283 !! options
18284 section=2
18285 !! wikitext
18286 <!-- -->==sec1==
18287 ==sec2==
18288 !! html/php
18289
18290 !!end
18291
18292 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18293 # instead of respecting HTML-style headings
18294 !! test
18295 Section extraction, mixed wiki and html (section 1)
18296 !! options
18297 section=1
18298 !! wikitext
18299 <h2>unmarked</h2>
18300 unmarked
18301 ==1==
18302 one
18303 ==2==
18304 two
18305 !! html/php
18306 ==1==
18307 one
18308 !! end
18309
18310 !! test
18311 Section extraction, mixed wiki and html (section 2)
18312 !! options
18313 section=2
18314 !! wikitext
18315 <h2>unmarked</h2>
18316 unmarked
18317 ==1==
18318 one
18319 ==2==
18320 two
18321 !! html/php
18322 ==2==
18323 two
18324 !! end
18325
18326
18327 # Formerly testing for bug 3342
18328 !! test
18329 Section extraction, heading surrounded by <noinclude>
18330 !! options
18331 section=1
18332 !! wikitext
18333 <noinclude>==unmarked==</noinclude>
18334 ==marked==
18335 !! html/php
18336 ==marked==
18337 !!end
18338
18339 # Test behavior of bug 19910
18340 !! test
18341 Sectiion with all-equals
18342 !! options
18343 section=2
18344 !! wikitext
18345 ===
18346 The line above must have a trailing space
18347 === <!--
18348 --> <!-- -->
18349 But just in case it doesn't...
18350 !! html/php
18351 === <!--
18352 --> <!-- -->
18353 But just in case it doesn't...
18354 !! end
18355
18356 !! test
18357 Section replacement test (section 0)
18358 !! options
18359 replace=0,"xxx"
18360 !! wikitext
18361 start
18362 ==a==
18363 ===aa===
18364 ====aaa====
18365 ==b==
18366 ===ba===
18367 ===bb===
18368 ====bba====
18369 ===bc===
18370 ==c==
18371 ===ca===
18372 !! html/php
18373 xxx
18374
18375 ==a==
18376 ===aa===
18377 ====aaa====
18378 ==b==
18379 ===ba===
18380 ===bb===
18381 ====bba====
18382 ===bc===
18383 ==c==
18384 ===ca===
18385 !! end
18386
18387 !! test
18388 Section replacement test (section 1)
18389 !! options
18390 replace=1,"xxx"
18391 !! wikitext
18392 start
18393 ==a==
18394 ===aa===
18395 ====aaa====
18396 ==b==
18397 ===ba===
18398 ===bb===
18399 ====bba====
18400 ===bc===
18401 ==c==
18402 ===ca===
18403 !! html/php
18404 start
18405 xxx
18406
18407 ==b==
18408 ===ba===
18409 ===bb===
18410 ====bba====
18411 ===bc===
18412 ==c==
18413 ===ca===
18414 !! end
18415
18416 !! test
18417 Section replacement test (section 2)
18418 !! options
18419 replace=2,"xxx"
18420 !! wikitext
18421 start
18422 ==a==
18423 ===aa===
18424 ====aaa====
18425 ==b==
18426 ===ba===
18427 ===bb===
18428 ====bba====
18429 ===bc===
18430 ==c==
18431 ===ca===
18432 !! html/php
18433 start
18434 ==a==
18435 xxx
18436
18437 ==b==
18438 ===ba===
18439 ===bb===
18440 ====bba====
18441 ===bc===
18442 ==c==
18443 ===ca===
18444 !! end
18445
18446 !! test
18447 Section replacement test (section 3)
18448 !! options
18449 replace=3,"xxx"
18450 !! wikitext
18451 start
18452 ==a==
18453 ===aa===
18454 ====aaa====
18455 ==b==
18456 ===ba===
18457 ===bb===
18458 ====bba====
18459 ===bc===
18460 ==c==
18461 ===ca===
18462 !! html/php
18463 start
18464 ==a==
18465 ===aa===
18466 xxx
18467
18468 ==b==
18469 ===ba===
18470 ===bb===
18471 ====bba====
18472 ===bc===
18473 ==c==
18474 ===ca===
18475 !! end
18476
18477 !! test
18478 Section replacement test (section 4)
18479 !! options
18480 replace=4,"xxx"
18481 !! wikitext
18482 start
18483 ==a==
18484 ===aa===
18485 ====aaa====
18486 ==b==
18487 ===ba===
18488 ===bb===
18489 ====bba====
18490 ===bc===
18491 ==c==
18492 ===ca===
18493 !! html/php
18494 start
18495 ==a==
18496 ===aa===
18497 ====aaa====
18498 xxx
18499
18500 ==c==
18501 ===ca===
18502 !! end
18503
18504 !! test
18505 Section replacement test (section 5)
18506 !! options
18507 replace=5,"xxx"
18508 !! wikitext
18509 start
18510 ==a==
18511 ===aa===
18512 ====aaa====
18513 ==b==
18514 ===ba===
18515 ===bb===
18516 ====bba====
18517 ===bc===
18518 ==c==
18519 ===ca===
18520 !! html/php
18521 start
18522 ==a==
18523 ===aa===
18524 ====aaa====
18525 ==b==
18526 xxx
18527
18528 ===bb===
18529 ====bba====
18530 ===bc===
18531 ==c==
18532 ===ca===
18533 !! end
18534
18535 !! test
18536 Section replacement test (section 6)
18537 !! options
18538 replace=6,"xxx"
18539 !! wikitext
18540 start
18541 ==a==
18542 ===aa===
18543 ====aaa====
18544 ==b==
18545 ===ba===
18546 ===bb===
18547 ====bba====
18548 ===bc===
18549 ==c==
18550 ===ca===
18551 !! html/php
18552 start
18553 ==a==
18554 ===aa===
18555 ====aaa====
18556 ==b==
18557 ===ba===
18558 xxx
18559
18560 ===bc===
18561 ==c==
18562 ===ca===
18563 !! end
18564
18565 !! test
18566 Section replacement test (section 7)
18567 !! options
18568 replace=7,"xxx"
18569 !! wikitext
18570 start
18571 ==a==
18572 ===aa===
18573 ====aaa====
18574 ==b==
18575 ===ba===
18576 ===bb===
18577 ====bba====
18578 ===bc===
18579 ==c==
18580 ===ca===
18581 !! html/php
18582 start
18583 ==a==
18584 ===aa===
18585 ====aaa====
18586 ==b==
18587 ===ba===
18588 ===bb===
18589 xxx
18590
18591 ===bc===
18592 ==c==
18593 ===ca===
18594 !! end
18595
18596 !! test
18597 Section replacement test (section 8)
18598 !! options
18599 replace=8,"xxx"
18600 !! wikitext
18601 start
18602 ==a==
18603 ===aa===
18604 ====aaa====
18605 ==b==
18606 ===ba===
18607 ===bb===
18608 ====bba====
18609 ===bc===
18610 ==c==
18611 ===ca===
18612 !! html/php
18613 start
18614 ==a==
18615 ===aa===
18616 ====aaa====
18617 ==b==
18618 ===ba===
18619 ===bb===
18620 ====bba====
18621 xxx
18622
18623 ==c==
18624 ===ca===
18625 !!end
18626
18627 !! test
18628 Section replacement test (section 9)
18629 !! options
18630 replace=9,"xxx"
18631 !! wikitext
18632 start
18633 ==a==
18634 ===aa===
18635 ====aaa====
18636 ==b==
18637 ===ba===
18638 ===bb===
18639 ====bba====
18640 ===bc===
18641 ==c==
18642 ===ca===
18643 !! html/php
18644 start
18645 ==a==
18646 ===aa===
18647 ====aaa====
18648 ==b==
18649 ===ba===
18650 ===bb===
18651 ====bba====
18652 ===bc===
18653 xxx
18654 !! end
18655
18656 !! test
18657 Section replacement test (section 10)
18658 !! options
18659 replace=10,"xxx"
18660 !! wikitext
18661 start
18662 ==a==
18663 ===aa===
18664 ====aaa====
18665 ==b==
18666 ===ba===
18667 ===bb===
18668 ====bba====
18669 ===bc===
18670 ==c==
18671 ===ca===
18672 !! html/php
18673 start
18674 ==a==
18675 ===aa===
18676 ====aaa====
18677 ==b==
18678 ===ba===
18679 ===bb===
18680 ====bba====
18681 ===bc===
18682 ==c==
18683 xxx
18684 !! end
18685
18686 !! test
18687 Section replacement test with initial whitespace (bug 13728)
18688 !! options
18689 replace=2,"xxx"
18690 !! wikitext
18691 Preformatted initial line
18692 ==a==
18693 ===a===
18694 !! html/php
18695 Preformatted initial line
18696 ==a==
18697 xxx
18698 !! end
18699
18700
18701 !! test
18702 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18703 !! options
18704 section=1
18705 !! wikitext
18706 ==a==
18707 a
18708 !! html/php
18709 ==a==
18710 a
18711 !! end
18712
18713 !! test
18714 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18715 !! options
18716 section=1
18717 !! wikitext
18718 ==a==
18719 a
18720 !! html/php
18721 ==a==
18722 a
18723 !! end
18724
18725
18726 !! test
18727 Section extraction, <pre> around bogus header (bug 10309)
18728 !! options
18729 section=2
18730 !! wikitext
18731 == Section One ==
18732 <pre>
18733 =======
18734 </pre>
18735
18736 == Section Two ==
18737 stuff
18738 !! html/php
18739 == Section Two ==
18740 stuff
18741 !! end
18742
18743 !! test
18744 Section replacement, <pre> around bogus header (bug 10309)
18745 !! options
18746 replace=2,"xxx"
18747 !! wikitext
18748 == Section One ==
18749 <pre>
18750 =======
18751 </pre>
18752
18753 == Section Two ==
18754 stuff
18755 !! html/php
18756 == Section One ==
18757 <pre>
18758 =======
18759 </pre>
18760
18761 xxx
18762 !! end
18763
18764
18765 !! test
18766 Handling of &#x0A; in URLs
18767 !! wikitext
18768 ** irc://&#x0A;a
18769 !! html/php
18770 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18771
18772 !! html/parsoid
18773 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18774 a">irc://
18775 a</a></li></ul></li></ul>
18776 !! end
18777
18778 !! test
18779 Handling of %0A in URLs
18780 !! wikitext
18781 ** irc://%0Aa
18782 !! html/php
18783 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18784
18785 !! html/parsoid
18786 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18787 !! end
18788
18789
18790 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18791 !! test
18792 5 quotes, code coverage +1 line
18793 !! options
18794 parsoid=wt2html
18795 !! wikitext
18796 '''''
18797 !! html/php
18798 !! html/parsoid
18799 <p><b><i></i></b></p>
18800 !! end
18801
18802 # same html as previous, but wikitext adjusted to match parsoid html2wt
18803 # note that wt2html and html2html will put the <i> before the <b>
18804 !! test
18805 5 quotes, code coverage +1 line w/ nowiki (1)
18806 !! options
18807 parsoid=wt2wt,html2wt
18808 !! wikitext
18809 '''''<nowiki/>'''''
18810 !! html/php
18811 <p><i></i>
18812 </p>
18813 !! html/parsoid
18814 <p><b><i></i></b></p>
18815 !! end
18816
18817 # same as previous, just swapping the <i> and <b>
18818 !! test
18819 5 quotes, code coverage +1 line w/ nowiki (2)
18820 !! wikitext
18821 '''''<nowiki/>'''''
18822 !! html/php
18823 <p><i></i>
18824 </p>
18825 !! html/parsoid
18826 <p><i><b></b></i></p>
18827 !! end
18828
18829 !! test
18830 Special:Search page linking.
18831 !! wikitext
18832 {{Special:search}}
18833 !! html
18834 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18835 </p>
18836 !! end
18837
18838 !! test
18839 {{!}} is a magic word
18840 !! wikitext
18841 {{!}} is a magic word there and {{!}} is still a magic word here
18842 | is not a magic word here but {{!}} is still a magic word here
18843 !! html/php
18844 <p>| is a magic word there and | is still a magic word here
18845 | is not a magic word here but | is still a magic word here
18846 </p>
18847 !! html/parsoid
18848 <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
18849 | 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>
18850
18851 !! end
18852
18853 !! test
18854 Say the magic word
18855 !! options
18856 title=[[Parser test]]
18857 !! wikitext
18858 * {{PAGENAME}}
18859 * {{PAGENAMEE}}
18860 * {{FULLPAGENAME}}
18861 * {{FULLPAGENAMEE}}
18862 * {{BASEPAGENAME}}
18863 * {{BASEPAGENAMEE}}
18864 * {{SUBPAGENAME}}
18865 * {{SUBPAGENAMEE}}
18866 * {{ROOTPAGENAME}}
18867 * {{ROOTPAGENAMEE}}
18868 * {{TALKPAGENAME}}
18869 * {{TALKPAGENAMEE}}
18870 * {{SUBJECTPAGENAME}}
18871 * {{SUBJECTPAGENAMEE}}
18872 * {{NAMESPACEE}}
18873 * {{NAMESPACE}}
18874 * {{NAMESPACENUMBER}}
18875 * {{TALKSPACE}}
18876 * {{TALKSPACEE}}
18877 * {{SUBJECTSPACE}}
18878 * {{SUBJECTSPACEE}}
18879 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18880 !! html
18881 <ul><li> Parser test</li>
18882 <li> Parser_test</li>
18883 <li> Parser test</li>
18884 <li> Parser_test</li>
18885 <li> Parser test</li>
18886 <li> Parser_test</li>
18887 <li> Parser test</li>
18888 <li> Parser_test</li>
18889 <li> Parser test</li>
18890 <li> Parser_test</li>
18891 <li> Talk:Parser test</li>
18892 <li> Talk:Parser_test</li>
18893 <li> Parser test</li>
18894 <li> Parser_test</li>
18895 <li> </li>
18896 <li> </li>
18897 <li> 0</li>
18898 <li> Talk</li>
18899 <li> Talk</li>
18900 <li> </li>
18901 <li> </li>
18902 <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>
18903
18904 !! end
18905 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18906
18907 ## Parsoid thinks the "centre" here is a property, not a caption.
18908 !! test
18909 Gallery
18910 !! options
18911 parsoid={
18912 "modes": ["wt2html"],
18913 "nativeGallery": true
18914 }
18915 !! wikitext
18916 <gallery>
18917 image1.png |
18918 image2.gif|||||
18919
18920 image3|
18921 image4 |300px| centre
18922 image5.svg| http://///////
18923 [[x|xx]]]]
18924 * image6
18925 </gallery>
18926 !! html/php
18927 <ul class="gallery mw-gallery-traditional">
18928 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18929 <div class="thumb" style="height: 150px;">Image1.png</div>
18930 <div class="gallerytext">
18931 </div>
18932 </div></li>
18933 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18934 <div class="thumb" style="height: 150px;">Image2.gif</div>
18935 <div class="gallerytext">
18936 </div>
18937 </div></li>
18938 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18939 <div class="thumb" style="height: 150px;">Image3</div>
18940 <div class="gallerytext">
18941 </div>
18942 </div></li>
18943 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18944 <div class="thumb" style="height: 150px;">Image4</div>
18945 <div class="gallerytext">
18946 <pre>centre
18947 </pre>
18948 </div>
18949 </div></li>
18950 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18951 <div class="thumb" style="height: 150px;">Image5.svg</div>
18952 <div class="gallerytext">
18953 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18954 </p>
18955 </div>
18956 </div></li>
18957 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18958 <div class="thumb" style="height: 150px;">* image6</div>
18959 <div class="gallerytext">
18960 </div>
18961 </div></li>
18962 </ul>
18963
18964 !! html/parsoid
18965 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
18966 <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>
18967 <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>
18968 <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>
18969 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image4 </span></div><div class="gallerytext"></div></li>
18970 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;"> image5.svg</span></div><div class="gallerytext"> <a rel="mw:ExtLink" href="http://///////">http://///////</a></div></li>
18971 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">* image6</span></div><div class="gallerytext"></div></li>
18972 </ul>
18973 !! end
18974
18975 !! test
18976 Gallery (with options, html)
18977 !! options
18978 parsoid={
18979 "modes": ["wt2html", "html2html"],
18980 "nativeGallery": true
18981 }
18982 !! wikitext
18983 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
18984 File:Nonexistent.jpg|caption
18985 File:Nonexistent.jpg
18986 image:foobar.jpg|some '''caption''' [[Main Page]]
18987 image:foobar.jpg
18988 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18989 </gallery>
18990 !! html/php
18991 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18992 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18993 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18994 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18995 <div class="gallerytext">
18996 <p>caption
18997 </p>
18998 </div>
18999 </div></li>
19000 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19001 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19002 <div class="gallerytext">
19003 </div>
19004 </div></li>
19005 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19006 <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>
19007 <div class="gallerytext">
19008 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19009 </p>
19010 </div>
19011 </div></li>
19012 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19013 <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>
19014 <div class="gallerytext">
19015 </div>
19016 </div></li>
19017 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19018 <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>
19019 <div class="gallerytext">
19020 <p>blabla.
19021 </p>
19022 </div>
19023 </div></li>
19024 </ul>
19025
19026 !! html/parsoid
19027 <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":{}}'>
19028 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19029 <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>
19030 <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>
19031 <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>
19032 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19033 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19034 </ul>
19035 !! end
19036
19037 !! test
19038 Gallery (with options, extsrc)
19039 !! options
19040 parsoid={
19041 "nativeGallery": false
19042 }
19043 !! wikitext
19044 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19045 File:Nonexistent.jpg|caption
19046 File:Nonexistent.jpg
19047 image:foobar.jpg|some '''caption''' [[Main Page]]
19048 image:foobar.jpg
19049 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19050 </gallery>
19051 !! html/php
19052 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19053 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19054 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19055 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19056 <div class="gallerytext">
19057 <p>caption
19058 </p>
19059 </div>
19060 </div></li>
19061 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19062 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19063 <div class="gallerytext">
19064 </div>
19065 </div></li>
19066 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19067 <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>
19068 <div class="gallerytext">
19069 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19070 </p>
19071 </div>
19072 </div></li>
19073 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19074 <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>
19075 <div class="gallerytext">
19076 </div>
19077 </div></li>
19078 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19079 <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>
19080 <div class="gallerytext">
19081 <p>blabla.
19082 </p>
19083 </div>
19084 </div></li>
19085 </ul>
19086
19087 !! html/parsoid
19088 <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"}}'>
19089 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19090 <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>
19091 <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>
19092 <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>
19093 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19094 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19095 </ul>
19096 !! end
19097
19098 !! test
19099 Gallery with link that has fragment
19100 !! options
19101 parsoid={
19102 "modes": ["wt2html", "html2html"],
19103 "nativeGallery": true
19104 }
19105 !! wikitext
19106 <gallery>
19107 image:foobar.jpg|link=Main_Page
19108 image:foobar.jpg|link=Main_Page#section
19109 image:foobar.jpg|link=Main Page#section|caption
19110 </gallery>
19111 !! html/php
19112 <ul class="gallery mw-gallery-traditional">
19113 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19114 <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>
19115 <div class="gallerytext">
19116 </div>
19117 </div></li>
19118 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19119 <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>
19120 <div class="gallerytext">
19121 </div>
19122 </div></li>
19123 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19124 <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>
19125 <div class="gallerytext">
19126 <p>caption
19127 </p>
19128 </div>
19129 </div></li>
19130 </ul>
19131
19132 !! html/parsoid
19133 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19134 <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>
19135 <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>
19136 <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>
19137 </ul>
19138 !! end
19139
19140 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19141 !! test
19142 Gallery with template inside caption
19143 !! options
19144 parsoid={
19145 "nativeGallery": true
19146 }
19147 !! wikitext
19148 <gallery caption="{{echo|hi}}">
19149 File:Foobar.jpg|{{echo|ho}}
19150 </gallery>
19151 !! html/php
19152 <ul class="gallery mw-gallery-traditional">
19153 <li class='gallerycaption'>{{echo|hi}}</li>
19154 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19155 <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>
19156 <div class="gallerytext">
19157 <p>ho
19158 </p>
19159 </div>
19160 </div></li>
19161 </ul>
19162
19163 !! html/parsoid
19164 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19165 <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>
19166 <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>
19167 </ul>
19168 !! end
19169
19170 !! test
19171 Gallery with wikitext inside caption
19172 !! options
19173 parsoid={
19174 "nativeGallery": true
19175 }
19176 !! wikitext
19177 <gallery>
19178 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19179 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19180 </gallery>
19181 !! html/php
19182 <ul class="gallery mw-gallery-traditional">
19183 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19184 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
19185 <div class="gallerytext">
19186 <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>
19187 </p>
19188 </div>
19189 </div></li>
19190 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19191 <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>
19192 <div class="gallerytext">
19193 <p>This is a test template
19194 </p>
19195 </div>
19196 </div></li>
19197 </ul>
19198
19199 !! html/parsoid
19200 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19201 <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>
19202 <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>
19203 </ul>
19204 !! end
19205
19206 !! test
19207 Gallery (with showfilename option)
19208 !! options
19209 parsoid={
19210 "nativeGallery": true
19211 }
19212 !! wikitext
19213 <gallery showfilename="">
19214 File:Nonexistent.jpg|caption
19215 File:Nonexistent.jpg
19216 File:Foobar.jpg|some '''caption''' [[Main Page]]
19217 File:Foobar.jpg
19218 </gallery>
19219 !! html/php
19220 <ul class="gallery mw-gallery-traditional">
19221 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19222 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19223 <div class="gallerytext">
19224 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19225 caption
19226 </p>
19227 </div>
19228 </div></li>
19229 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19230 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19231 <div class="gallerytext">
19232 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19233 </p>
19234 </div>
19235 </div></li>
19236 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19237 <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>
19238 <div class="gallerytext">
19239 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19240 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19241 </p>
19242 </div>
19243 </div></li>
19244 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19245 <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>
19246 <div class="gallerytext">
19247 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19248 </p>
19249 </div>
19250 </div></li>
19251 </ul>
19252
19253 !! html/parsoid
19254 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19255 <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>
19256 <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>
19257 <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>
19258 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19259 </ul>
19260 !! end
19261
19262 ## Should Parsoid be preserving these variations?
19263 !! test
19264 Gallery (with namespace-less filenames)
19265 !! options
19266 parsoid={
19267 "modes": ["wt2html", "html2html"],
19268 "nativeGallery": true
19269 }
19270 !! wikitext
19271 <gallery>
19272 File:Nonexistent.jpg
19273 Nonexistent.jpg
19274 image:foobar.jpg
19275 foobar.jpg
19276 </gallery>
19277 !! html/php
19278 <ul class="gallery mw-gallery-traditional">
19279 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19280 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19281 <div class="gallerytext">
19282 </div>
19283 </div></li>
19284 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19285 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19286 <div class="gallerytext">
19287 </div>
19288 </div></li>
19289 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19290 <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>
19291 <div class="gallerytext">
19292 </div>
19293 </div></li>
19294 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19295 <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>
19296 <div class="gallerytext">
19297 </div>
19298 </div></li>
19299 </ul>
19300
19301 !! html/parsoid
19302 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19303 <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>
19304 <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>
19305 <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>
19306 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span 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>
19307 </ul>
19308 !! end
19309
19310 !! test
19311 Gallery override link with WikiLink (T36852)
19312 !! options
19313 parsoid={
19314 "nativeGallery": true
19315 }
19316 !! wikitext
19317 <gallery>
19318 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19319 </gallery>
19320 !! html/php
19321 <ul class="gallery mw-gallery-traditional">
19322 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19323 <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>
19324 <div class="gallerytext">
19325 </div>
19326 </div></li>
19327 </ul>
19328
19329 !! html/parsoid
19330 <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":{}}'>
19331 <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>
19332 </ul>
19333 !! end
19334
19335 !! test
19336 Gallery override link with absolute external link (T36852)
19337 !! options
19338 parsoid={
19339 "nativeGallery": true
19340 }
19341 !! wikitext
19342 <gallery>
19343 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19344 </gallery>
19345 !! html/php
19346 <ul class="gallery mw-gallery-traditional">
19347 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19348 <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>
19349 <div class="gallerytext">
19350 </div>
19351 </div></li>
19352 </ul>
19353
19354 !! html/parsoid
19355 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19356 <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>
19357 </ul>
19358 !! end
19359
19360 !! test
19361 Gallery override link with malicious javascript (T36852)
19362 !! options
19363 parsoid={
19364 "modes": ["wt2html", "html2html"],
19365 "nativeGallery": true
19366 }
19367 !! wikitext
19368 <gallery>
19369 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19370 </gallery>
19371 !! html/php
19372 <ul class="gallery mw-gallery-traditional">
19373 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19374 <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>
19375 <div class="gallerytext">
19376 </div>
19377 </div></li>
19378 </ul>
19379
19380 !! html/parsoid
19381 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19382 <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>
19383 </ul>
19384 !! end
19385
19386 !! test
19387 Gallery with invalid title as link (T45964)
19388 !! options
19389 parsoid={
19390 "modes": ["wt2html", "html2html"],
19391 "nativeGallery": true
19392 }
19393 !! wikitext
19394 <gallery>
19395 File:Foobar.jpg|link=<
19396 </gallery>
19397 !! html/php
19398 <ul class="gallery mw-gallery-traditional">
19399 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19400 <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>
19401 <div class="gallerytext">
19402 </div>
19403 </div></li>
19404 </ul>
19405
19406 !! html/parsoid
19407 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19408 <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>
19409 </ul>
19410 !! end
19411
19412 !! test
19413 HTML Hex character encoding (spells the word "JavaScript")
19414 !! options
19415 parsoid=wt2html,wt2wt,html2html
19416 !! wikitext
19417 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19418 !! html/php
19419 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19420 </p>
19421 !! html/php+tidy
19422 <p>JavaScript</p>
19423 !! html/parsoid
19424 <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>
19425 !! end
19426
19427 !! test
19428 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19429 !! wikitext
19430 &#xsee;&#XSEE;
19431 !! html/php
19432 <p>&amp;#xsee;&amp;#XSEE;
19433 </p>
19434 !! html/parsoid
19435 <p>&amp;#xsee;&amp;#XSEE;</p>
19436 !! end
19437
19438 !! test
19439 HTML Hex character encoding mixed case
19440 !! options
19441 parsoid=wt2html,wt2wt,html2html
19442 !! wikitext
19443 &#xEE;&#Xee;
19444 !! html/php
19445 <p>&#xee;&#xee;
19446 </p>
19447 !! html/php+tidy
19448 <p>îî</p>
19449 !! html/parsoid
19450 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19451 !! end
19452
19453 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19454 # Note that U+000C (form feed) is not a valid XML character, so
19455 # it is banned even though allowed in HTML5.
19456 !! test
19457 Illegal character references (T106578)
19458 !! wikitext
19459 ; Null: &#00;
19460 ; FF: &#xC;
19461 ; CR: &#xD;
19462 ; Control (low): &#8;
19463 ; Control (high): &#x7F; &#x9F;
19464 ; Surrogate: &#xD83D;&#xDCA9;
19465 ; This is an okay astral character: &#x1F4A9;
19466 !! html+tidy
19467 <dl>
19468 <dt>Null</dt>
19469 <dd>&amp;#00;</dd>
19470 <dt>FF</dt>
19471 <dd>&amp;#xC;</dd>
19472 <dt>CR</dt>
19473 <dd>&amp;#xD;</dd>
19474 <dt>Control (low)</dt>
19475 <dd>&amp;#8;</dd>
19476 <dt>Control (high)</dt>
19477 <dd>&amp;#x7F; &amp;#x9F;</dd>
19478 <dt>Surrogate</dt>
19479 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19480 <dt>This is an okay astral character</dt>
19481 <dd>💩</dd>
19482 </dl>
19483 !! end
19484
19485 !! test
19486 __FORCETOC__ override
19487 !! wikitext
19488 __NEWSECTIONLINK__
19489 __FORCETOC__
19490 !! html/php
19491 <p><br />
19492 </p>
19493 !! end
19494
19495 !! test
19496 ISBN code coverage
19497 !! wikitext
19498 ISBN 978-0-1234-56&#x20;789
19499 !! html
19500 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19501 </p>
19502 !! html+tidy
19503 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19504 !! html/parsoid
19505 <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>
19506 !! end
19507
19508 !! test
19509 ISBN followed by 5 spaces
19510 !! wikitext
19511 ISBN
19512 !! html
19513 <p>ISBN
19514 </p>
19515 !! end
19516
19517 !! test
19518 Double ISBN
19519 !! wikitext
19520 ISBN ISBN 1234567890
19521 !! html/php
19522 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19523 </p>
19524 !! html/parsoid
19525 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19526 !! end
19527
19528 # Uppercase X and lowercase x as well
19529 !! test
19530 ISBN with an X
19531 !! wikitext
19532 ISBN 3-462-04561-X
19533 ISBN 3-462-04561-x
19534 ISBN 080442957X
19535 ISBN 080442957x
19536 ISBN 978080442957X
19537 ISBN 978080442957x
19538 !! html/php
19539 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19540 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19541 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19542 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19543 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19544 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19545 </p>
19546 !! html/parsoid
19547 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19548 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19549 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19550 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19551 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19552 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19553 !! end
19554
19555 !! test
19556 ISBN with empty prefix (parsoid test)
19557 !! wikitext
19558 ISBN 1234567890
19559 !! html/php
19560 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19561 </p>
19562 !! html/parsoid
19563 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19564 !! end
19565
19566 !! test
19567 Bug 22905: <abbr> followed by ISBN followed by </a>
19568 !! wikitext
19569 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19570 !! html/php
19571 <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>
19572 </p>
19573 !! html/parsoid
19574 <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>
19575 !! end
19576
19577 !! test
19578 Double RFC
19579 !! wikitext
19580 RFC RFC 1234
19581 !! html
19582 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19583 </p>
19584 !! end
19585
19586 !! test
19587 Double RFC with a wiki link
19588 !! wikitext
19589 RFC [[RFC 1234]]
19590 !! html
19591 <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>
19592 </p>
19593 !! end
19594
19595 !! test
19596 RFC code coverage
19597 !! wikitext
19598 RFC 983&#x20;987
19599 !! html
19600 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19601 </p>
19602 !! html+tidy
19603 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19604 !! end
19605
19606 !! test
19607 Centre-aligned image
19608 !! wikitext
19609 [[Image:foobar.jpg|centre]]
19610 !! html
19611 <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>
19612
19613 !!end
19614
19615 !! test
19616 None-aligned image
19617 !! wikitext
19618 [[Image:foobar.jpg|none]]
19619 !! html
19620 <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>
19621
19622 !!end
19623
19624 !! test
19625 Width + Height sized image (using px) (height is ignored)
19626 !! wikitext
19627 [[Image:foobar.jpg|640x480px]]
19628 !! html
19629 <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>
19630 </p>
19631 !!end
19632
19633 !! test
19634 Width-sized image (using px, no following whitespace)
19635 !! wikitext
19636 [[Image:foobar.jpg|640px]]
19637 !! html
19638 <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>
19639 </p>
19640 !!end
19641
19642 !! test
19643 Width-sized image (using px, with following whitespace - test regression from r39467)
19644 !! wikitext
19645 [[Image:foobar.jpg|640px ]]
19646 !! html
19647 <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>
19648 </p>
19649 !!end
19650
19651 !! test
19652 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19653 !! wikitext
19654 [[Image:foobar.jpg| 640px]]
19655 !! html
19656 <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>
19657 </p>
19658 !!end
19659
19660 !! test
19661 Image with page parameter
19662 !! options
19663 djvu
19664 !! wikitext
19665 [[File:LoremIpsum.djvu|page=2]]
19666 !! html/php
19667 <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>
19668 </p>
19669 !! html/parsoid
19670 <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>
19671 !! end
19672
19673 !! test
19674 Another italics / bold test
19675 !! wikitext
19676 ''' ''x'
19677 !! html
19678 <pre>'<i> </i>x'
19679 </pre>
19680 !!end
19681
19682 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19683 !! test
19684 dt/dd/dl test
19685 !! wikitext
19686 :;;;::
19687 !! html/php
19688 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19689
19690 !! html/parsoid
19691 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19692
19693 !!end
19694
19695
19696 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19697 !! test
19698 Images with the "|" character in the comment
19699 !! wikitext
19700 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19701 !! html/php
19702 <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>
19703
19704 !! html/parsoid
19705 <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>
19706 !! end
19707
19708 !! test
19709 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19710 !! wikitext
19711 <html><script>alert(1);</script></html>
19712 !! html
19713 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19714 </p>
19715 !! end
19716
19717 !! test
19718 HTML with raw HTML ($wgRawHtml==true)
19719 !! options
19720 wgRawHtml=1
19721 !! wikitext
19722 <html><script>alert(1);</script></html>
19723 !! html
19724 <p><script>alert(1);</script>
19725 </p>
19726 !! end
19727
19728 !! test
19729 Parents of subpages, one level up
19730 !! options
19731 subpage title=[[Subpage test/L1/L2/L3]]
19732 !! wikitext
19733 [[../|L2]]
19734 !! html
19735 <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>
19736 </p>
19737 !! end
19738
19739
19740 !! test
19741 Parents of subpages, one level up, not named
19742 !! options
19743 subpage title=[[Subpage test/L1/L2/L3]]
19744 !! wikitext
19745 [[../]]
19746 !! html
19747 <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>
19748 </p>
19749 !! end
19750
19751
19752
19753 !! test
19754 Parents of subpages, two levels up
19755 !! options
19756 subpage title=[[Subpage test/L1/L2/L3]]
19757 !! wikitext
19758 [[../../|L1]]2
19759
19760 [[../../|L1]]l
19761 !! html
19762 <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
19763 </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>
19764 </p>
19765 !! end
19766
19767 !! test
19768 Parents of subpages, two levels up, without trailing slash or name.
19769 !! options
19770 subpage title=[[Subpage test/L1/L2/L3]]
19771 !! wikitext
19772 [[../..]]
19773 !! html
19774 <p>[[../..]]
19775 </p>
19776 !! end
19777
19778 !! test
19779 Parents of subpages, two levels up, with lots of extra trailing slashes.
19780 !! options
19781 subpage title=[[Subpage test/L1/L2/L3]]
19782 !! wikitext
19783 [[../../////]]
19784 !! html
19785 <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>
19786 </p>
19787 !! end
19788
19789 !! article
19790 Subpage test/L1/L2/L3Sibling
19791 !! text
19792 Sibling article
19793 !! endarticle
19794
19795 !! test
19796 Transclusion of a sibling page (one level up)
19797 !! options
19798 subpage title=[[Subpage test/L1/L2/L3]]
19799 !! wikitext
19800 {{../L3Sibling}}
19801 !! html
19802 <p>Sibling article
19803 </p>
19804 !! end
19805
19806 !! test
19807 Transclusion of a child page
19808 !! options
19809 subpage title=[[Subpage test/L1/L2]]
19810 !! wikitext
19811 {{/L3Sibling}}
19812 !! html
19813 <p>Sibling article
19814 </p>
19815 !! end
19816
19817 # This is wt2html only in Parsoid because we add <nowiki>
19818 # because of {{..}} and we don't expect to fix that to
19819 # eliminate the nowikis selective for {{..}} markup.
19820 !! test
19821 Non-transclusion because of too many up levels
19822 !! options
19823 subpage title=[[Subpage test/L1/L2/L3]]
19824 parsoid=wt2html
19825 !! wikitext
19826 {{../../../../More than parent}}
19827 !! html/php
19828 <p>{{../../../../More than parent}}
19829 </p>
19830 !! html/parsoid
19831 <p>{{../../../../More than parent}}</p>
19832 !! end
19833
19834 !! test
19835 Definition list code coverage
19836 !! wikitext
19837 ; title : def
19838 ; title : def
19839 ;title: def
19840 !! html/php
19841 <dl><dt> title &#160;</dt>
19842 <dd> def</dd>
19843 <dt> title&#160;</dt>
19844 <dd> def</dd>
19845 <dt>title</dt>
19846 <dd> def</dd></dl>
19847
19848 !! html/parsoid
19849 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19850 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19851 <dt>title</dt><dd> def</dd></dl>
19852 !! end
19853
19854 !! test
19855 Don't fall for the self-closing div
19856 !! wikitext
19857 <div>hello world</div/>
19858 !! html
19859 <div>hello world</div>
19860
19861 !! end
19862
19863 !! test
19864 MSGNW magic word
19865 !! wikitext
19866 {{MSGNW:msg}}
19867 !! html/php
19868 <p>&#91;&#91;:Template:Msg&#93;&#93;
19869 </p>
19870 !! end
19871
19872 !! test
19873 RAW magic word
19874 !! wikitext
19875 {{RAW:QUERTY}}
19876 !! html
19877 <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>
19878 </p>
19879 !! end
19880
19881 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19882 !! test
19883 Always escape literal '>' in output, not just after '<'
19884 !! wikitext
19885 ><>
19886 !! html
19887 <p>&gt;&lt;&gt;
19888 </p>
19889 !! end
19890
19891 !! test
19892 Template caching
19893 !! wikitext
19894 {{Test}}
19895 {{Test}}
19896 !! html
19897 <p>This is a test template
19898 This is a test template
19899 </p>
19900 !! end
19901
19902
19903 !! article
19904 MediaWiki:Fake
19905 !! text
19906 ==header==
19907 !! endarticle
19908
19909 !! test
19910 Inclusion of !userCanEdit() content
19911 !! wikitext
19912 {{MediaWiki:Fake}}
19913 !! html
19914 <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>
19915
19916 !! end
19917
19918
19919 !! test
19920 Out-of-order TOC heading levels
19921 !! wikitext
19922 ==2==
19923 ======6======
19924 ===3===
19925 =1=
19926 =====5=====
19927 ==2==
19928 !! html
19929 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19930 <ul>
19931 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19932 <ul>
19933 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19934 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19935 </ul>
19936 </li>
19937 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19938 <ul>
19939 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19940 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19941 </ul>
19942 </li>
19943 </ul>
19944 </div>
19945
19946 <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>
19947 <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>
19948 <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>
19949 <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>
19950 <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>
19951 <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>
19952
19953 !! end
19954
19955
19956 !! test
19957 ISBN with a dummy number
19958 !! wikitext
19959 ISBN ---
19960 !! html
19961 <p>ISBN ---
19962 </p>
19963 !! end
19964
19965
19966 !! test
19967 ISBN with space-delimited number
19968 !! wikitext
19969 ISBN 92 9017 032 8
19970 !! html
19971 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19972 </p>
19973 !! end
19974
19975
19976 !! test
19977 ISBN with multiple spaces, no number
19978 !! wikitext
19979 ISBN foo
19980 !! html
19981 <p>ISBN foo
19982 </p>
19983 !! end
19984
19985
19986 !! test
19987 ISBN length
19988 !! wikitext
19989 ISBN 123456789
19990
19991 ISBN 1234567890
19992
19993 ISBN 12345678901
19994 !! html
19995 <p>ISBN 123456789
19996 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19997 </p><p>ISBN 12345678901
19998 </p>
19999 !! end
20000
20001
20002 !! test
20003 ISBN with trailing year (bug 8110)
20004 !! wikitext
20005 ISBN 1-234-56789-0 - 2006
20006
20007 ISBN 1 234 56789 0 - 2006
20008 !! html
20009 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20010 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20011 </p>
20012 !! end
20013
20014
20015 !! test
20016 anchorencode
20017 !! wikitext
20018 {{anchorencode:foo bar©#%n}}
20019 !! html
20020 <p>foo_bar.C2.A9.23.25n
20021 </p>
20022 !! end
20023
20024 !! test
20025 anchorencode trims spaces
20026 !! wikitext
20027 {{anchorencode: __pretty__please__}}
20028 !! html
20029 <p>pretty_please
20030 </p>
20031 !! end
20032
20033 !! test
20034 anchorencode deals with links
20035 !! wikitext
20036 {{anchorencode: [[hello|world]] [[hi]]}}
20037 !! html
20038 <p>world_hi
20039 </p>
20040 !! end
20041
20042 !! test
20043 anchorencode deals with templates
20044 !! wikitext
20045 {{anchorencode: {{Foo}} }}
20046 !! html
20047 <p>FOO
20048 </p>
20049 !! end
20050
20051 !! test
20052 anchorencode encodes like the TOC generator: (bug 18431)
20053 !! wikitext
20054 === _ +:.3A%3A&&amp;]] ===
20055 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20056 __NOEDITSECTION__
20057 !! html
20058 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20059 <p>.2B:.3A.253A.26.26.5D.5D
20060 </p>
20061 !! end
20062
20063 !! test
20064 Bug 6200: blockquotes and paragraph formatting
20065 !! wikitext
20066 <blockquote>
20067 foo
20068 </blockquote>
20069
20070 bar
20071
20072 baz
20073 !! html
20074 <blockquote>
20075 <p>foo
20076 </p>
20077 </blockquote>
20078 <p>bar
20079 </p>
20080 <pre>baz
20081 </pre>
20082 !! end
20083
20084 !! test
20085 Bug 8293: Use of center tag ruins paragraph formatting
20086 !! wikitext
20087 <center>
20088 foo
20089 </center>
20090
20091 bar
20092
20093 baz
20094 !! html
20095 <center>
20096 <p>foo
20097 </p>
20098 </center>
20099 <p>bar
20100 </p>
20101 <pre>baz
20102 </pre>
20103 !! end
20104
20105 !!test
20106 Parsing of overlapping (improperly nested) inline html tags
20107 !! wikitext
20108 <span><s>x</span></s>
20109 !! html/php
20110 <p><span><s>x&lt;/span&gt;</s></span>
20111 </p>
20112 !! html/parsoid
20113 <p><span><s>x</s></span>
20114 </p>
20115 !!end
20116
20117 ###
20118 ### Language variants related tests
20119 ###
20120 !! test
20121 Self-link in language variants
20122 !! options
20123 title=[[Dunav]] language=sr
20124 !! wikitext
20125 Both [[Dunav]] and [[Дунав]] are names for this river.
20126 !! html
20127 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20128 </p>
20129 !!end
20130
20131 !! article
20132 Дуна
20133 !! text
20134 content
20135 !! endarticle
20136
20137 !! test
20138 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20139 !! options
20140 title=[[Duna]] language=sr
20141 !! wikitext
20142 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20143 !! html
20144 <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.
20145 </p>
20146 !! end
20147
20148 !! test
20149 Link to a section of a variant of this title shouldn't be parsed as self-link
20150 !! options
20151 title=[[Duna]] language=sr
20152 !! wikitext
20153 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20154 !! html
20155 <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.
20156 </p>
20157 !! end
20158
20159 !! test
20160 Link to pages in language variants
20161 !! options
20162 language=sr
20163 !! wikitext
20164 Main Page can be written as [[Маин Паге]]
20165 !! html
20166 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20167 </p>
20168 !!end
20169
20170
20171 !! test
20172 Multiple links to pages in language variants
20173 !! options
20174 language=sr
20175 !! wikitext
20176 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20177 !! html
20178 <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>.
20179 </p>
20180 !!end
20181
20182
20183 !! test
20184 Simple template in language variants
20185 !! options
20186 language=sr
20187 !! wikitext
20188 {{тест}}
20189 !! html
20190 <p>This is a test template
20191 </p>
20192 !! end
20193
20194
20195 !! test
20196 Template with explicit namespace in language variants
20197 !! options
20198 language=sr
20199 !! wikitext
20200 {{Template:тест}}
20201 !! html
20202 <p>This is a test template
20203 </p>
20204 !! end
20205
20206
20207 !! test
20208 Basic test for template parameter in language variants
20209 !! options
20210 language=sr
20211 !! wikitext
20212 {{парамтест|param=foo}}
20213 !! html
20214 <p>This is a test template with parameter foo
20215 </p>
20216 !! end
20217
20218 !! test
20219 Simple category in language variants
20220 !! options
20221 language=sr cat
20222 !! wikitext
20223 [[Category:МедиаWики Усер'с Гуиде]]
20224 !! html/php
20225 cat=МедиаWики_Усер'с_Гуиде sort=
20226 !! html/parsoid
20227 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20228 !! end
20229
20230 !! article
20231 Category:分类
20232 !! text
20233 blah
20234 !! endarticle
20235
20236 !! article
20237 Category:分類
20238 !! text
20239 blah
20240 !! endarticle
20241
20242 ## We used to, but no longer wt2wt this test since the default serializer
20243 ## will normalize all categories to serialize on their own line.
20244 ## This wikitext usage is going to be fairly uncommon in production and
20245 ## selser will take care of preserving formatting in those scenarios.
20246 !! test
20247 Don't convert blue categorylinks to another variant (bug 33210)
20248 !! options
20249 cat
20250 language=zh
20251 parsoid=wt2html
20252 !! wikitext
20253 [[A]][[Category:分类]]
20254 !! html/php
20255 cat=分类 sort=
20256 !! html/parsoid
20257 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20258 <link rel="mw:PageProp/Category" href="Category:分类"/>
20259 !! end
20260
20261 !! test
20262 Stripping -{}- tags (language variants)
20263 !! options
20264 language=sr
20265 !! wikitext
20266 Latin proverb: -{Ne nuntium necare}-
20267 !! html
20268 <p>Latin proverb: Ne nuntium necare
20269 </p>
20270 !! end
20271
20272
20273 !! test
20274 Prevent conversion with -{}- tags (language variants)
20275 !! options
20276 language=sr variant=sr-ec
20277 !! wikitext
20278 Latinski: -{Ne nuntium necare}-
20279 !! html
20280 <p>Латински: Ne nuntium necare
20281 </p>
20282 !! end
20283
20284
20285 !! test
20286 Prevent conversion of text with -{}- tags (language variants)
20287 !! options
20288 language=sr variant=sr-ec
20289 !! wikitext
20290 Latinski: -{Ne nuntium necare}-
20291 !! html
20292 <p>Латински: Ne nuntium necare
20293 </p>
20294 !! end
20295
20296
20297 !! test
20298 Prevent conversion of links with -{}- tags (language variants)
20299 !! options
20300 language=sr variant=sr-ec
20301 !! wikitext
20302 -{[[Main Page]]}-
20303 !! html
20304 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20305 </p>
20306 !! end
20307
20308
20309 !! test
20310 -{}- tags within headlines (within html for parserConvert())
20311 !! options
20312 language=sr variant=sr-ec
20313 !! wikitext
20314 == -{Naslov}- ==
20315 !! html
20316 <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>
20317
20318 !! end
20319
20320
20321 !! test
20322 Explicit definition of language variant alternatives
20323 !! options
20324 language=zh variant=zh-tw
20325 !! wikitext
20326 -{zh:China;zh-tw:Taiwan}-, not China
20327 !! html
20328 <p>Taiwan, not China
20329 </p>
20330 !! end
20331
20332
20333 !! test
20334 Conversion around HTML tags
20335 !! options
20336 language=sr variant=sr-ec
20337 !! wikitext
20338 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20339 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20340 !! html
20341 <p>
20342 <span title="ЛаCтин">ски</span>
20343 </p>
20344 !! end
20345
20346
20347 !! test
20348 Explicit session-wise language variant mapping (A flag and - flag)
20349 !! options
20350 language=zh variant=zh-tw
20351 !! wikitext
20352 Taiwan is not China.
20353 But -{A|zh:China;zh-tw:Taiwan}- is China,
20354 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20355 and -{China}- is China.
20356 !! html
20357 <p>Taiwan is not China.
20358 But Taiwan is Taiwan,
20359 (This should be stripped!)
20360 and China is China.
20361 </p>
20362 !! end
20363
20364 !! test
20365 Explicit session-wise language variant mapping (H flag for hide)
20366 !! options
20367 language=zh variant=zh-tw
20368 !! wikitext
20369 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20370 Taiwan is China.
20371 !! html
20372 <p>(This should be stripped!)
20373 Taiwan is Taiwan.
20374 </p>
20375 !! end
20376
20377 !! test
20378 Adding explicit conversion rule for title (T flag)
20379 !! options
20380 language=zh variant=zh-tw showtitle
20381 !! wikitext
20382 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20383 !! html
20384 Taiwan
20385 <p>Should be stripped!
20386 </p>
20387 !! end
20388
20389 !! test
20390 Testing that changing the language variant here in the tests actually works
20391 !! options
20392 language=zh variant=zh showtitle
20393 !! wikitext
20394 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20395 !! html
20396 China
20397 <p>Should be stripped!
20398 </p>
20399 !! end
20400
20401 !! test
20402 Recursive conversion of alt and title attrs shouldn't clear converter state
20403 !! options
20404 language=zh variant=zh-cn showtitle
20405 !! wikitext
20406 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20407 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20408 !! html
20409 China
20410 <p>
20411 Should be stripped<span title="Exclamation">!</span>
20412 </p>
20413 !! end
20414
20415 !! test
20416 Bug 24072: more test on conversion rule for title
20417 !! options
20418 language=zh variant=zh-tw showtitle
20419 !! wikitext
20420 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20421 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20422 !! html
20423 Taiwan
20424 <p>This should be stripped!
20425 This won't take interferes with the title rule.
20426 </p>
20427 !! end
20428
20429 !! test
20430 Partly disable title conversion if variant == main language code
20431 !! options
20432 language=zh variant=zh title=[[ZH]] showtitle
20433 !! wikitext
20434 -{T|zh-cn:CN;zh-tw:TW}-
20435 !! html
20436 ZH
20437 <p>
20438 </p>
20439 !! end
20440
20441 !! test
20442 Partly disable title conversion if variant == main language code, more
20443 !! options
20444 language=zh variant=zh title=[[ZH]] showtitle
20445 !! wikitext
20446 -{T|TW}-
20447 !! html
20448 ZH
20449 <p>
20450 </p>
20451 !! end
20452
20453 !! test
20454 Raw output of variant escape tags (R flag)
20455 !! options
20456 language=zh variant=zh-tw
20457 !! wikitext
20458 Raw: -{R|zh:China;zh-tw:Taiwan}-
20459 !! html
20460 <p>Raw: zh:China;zh-tw:Taiwan
20461 </p>
20462 !! end
20463
20464 !! test
20465 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20466 !! options
20467 language=zh variant=zh-cn
20468 !! input
20469 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20470 !! result
20471 <p>0
20472 </p>
20473 !! end
20474
20475 !! test
20476 Conversion rules from [numeric-only string] to [something else] (T48634)
20477 !! options
20478 language=zh variant=zh-cn
20479 !! input
20480 -{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
20481 !! result
20482 <p>D12345EE12345
20483 </p>
20484 !! end
20485
20486 !! test
20487 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20488 !! options
20489 language=zh variant=zh-cn
20490 !! input
20491 -{H|zh-cn:foo;zh-tw:;}-foobar
20492 !! result
20493 <p>foobar
20494 </p>
20495 !! end
20496
20497 !! test
20498 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20499 !! options
20500 language=zh variant=zh-cn
20501 !! input
20502 -{H|=>zh-cn:foo;}-foobar
20503 !! result
20504 <p>foobar
20505 </p>
20506 !! end
20507
20508 !! test
20509 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20510 !! options
20511 language=zh variant=zh-cn
20512 !! input
20513 -{H|}-foobar
20514 !! result
20515 <p>foobar
20516 </p>
20517 !! end
20518
20519 !! test
20520 Nested using of manual convert syntax
20521 !! options
20522 language=zh variant=zh-hk
20523 !! wikitext
20524 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20525 !! html
20526 <p>Nested: Hello Hong Kong!
20527 </p>
20528 !! end
20529
20530 # Since Parsoid is starting to emit canonical wikitext for links,
20531 # [http://example.com http://example.com] will not RT back to that
20532 # form anymore.
20533 !! test
20534 Proper conversion of text in external links
20535 !! options
20536 language=sr variant=sr-ec
20537 parsoid=wt2html
20538 !! wikitext
20539 http://www.google.com
20540 gopher://www.google.com
20541 [http://www.google.com http://www.google.com]
20542 [gopher://www.google.com gopher://www.google.com]
20543 [https://www.google.com irc://www.google.com]
20544 [ftp://www.google.com www.google.com/ftp://dir]
20545 [//www.google.com www.google.com]
20546 !! html/php
20547 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20548 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20549 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20550 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20551 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20552 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20553 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20554 </p>
20555 !! html/parsoid
20556 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20557 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20558 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20559 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20560 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20561 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20562 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20563 !! end
20564
20565 !! test
20566 Do not convert roman numbers to language variants
20567 !! options
20568 language=sr variant=sr-ec
20569 !! wikitext
20570 Fridrih IV je car.
20571 !! html
20572 <p>Фридрих IV је цар.
20573 </p>
20574 !! end
20575
20576 !! test
20577 Unclosed language converter markup "-{"
20578 !! options
20579 language=sr
20580 !! wikitext
20581 -{T|hello
20582 !! html
20583 <p>-{T|hello
20584 </p>
20585 !! end
20586
20587 !! test
20588 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20589 !! options
20590 language=sr
20591 !! wikitext
20592 -{R|=&gt;}-
20593 !! html
20594 <p>=&gt;
20595 </p>
20596 !!end
20597
20598 !! test
20599 Don't break link parsing if language converter markup is in the caption.
20600 !! options
20601 language=sr variant=sr-ec
20602 !! wikitext
20603 [[Main Page|-{R|main page}-]]
20604 !! html
20605 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20606 </p>
20607 !! end
20608
20609 !! test
20610 T146304: Don't break template parsing if language converter markup is in the parameter.
20611 !! options
20612 language=sr variant=sr-ec
20613 !! wikitext
20614 {{echo|-{R|foo}-}}
20615 !! html/php
20616 <p>foo
20617 </p>
20618 !! end
20619
20620 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20621 !! test
20622 Don't break image parsing if language converter markup is in the caption.
20623 !! options
20624 language=sr
20625 !! wikitext
20626 [[File:Foobar.jpg|-{R|caption}-]]
20627 !! html/parsoid
20628 <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>
20629 </p>
20630 !! end
20631
20632 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20633 !! test
20634 Don't break list handling if language converter markup is in the item.
20635 !! options
20636 language=zh variant=zh-cn
20637 !! wikitext
20638 ;-{zh-cn:AAA;zh-tw:BBB}-
20639 !! html/php
20640 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20641
20642 !! html/parsoid
20643 <dl><dt>AAA
20644 </dt></dl>
20645 !! end
20646
20647 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20648 !! test
20649 Don't break table handling if language converter markup is in the cell.
20650 !! options
20651 language=sr variant=sr-ec
20652 !! wikitext
20653 {|
20654 |-
20655 | -{R|B}-
20656 |}
20657 !! html/php
20658 <table>
20659
20660 <tr>
20661 <td>Б}-
20662 </td></tr></table>
20663
20664 !! html/parsoid
20665 <table>
20666
20667 <tr>
20668 <td> B
20669 </td></tr></table>
20670
20671 !! end
20672
20673 !! test
20674 Bug 529: Uncovered bullet
20675 !! wikitext
20676 * Foo {{bullet}}
20677 !! html
20678 <ul><li> Foo </li>
20679 <li> Bar</li></ul>
20680
20681 !! end
20682
20683 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20684 # Templates in Wikipedia rely on this behavior, as tidy has always been
20685 # enabled there. These tests are normally run *without* tidy, so specify the
20686 # full output here.
20687 # To test realistic parsing behavior, apply a tidy-like transformation to both
20688 # the expected output and your parser's output.
20689 !! test
20690 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20691 !! wikitext
20692 ******* Foo {{bullet}}
20693 !! html
20694 <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>
20695 <li> Bar</li></ul>
20696
20697 !! end
20698
20699 !! test
20700 Bug 529: Uncovered table already at line-start
20701 !! wikitext
20702 x
20703
20704 {{table}}
20705 y
20706 !! html
20707 <p>x
20708 </p>
20709 <table>
20710 <tr>
20711 <td> 1 </td>
20712 <td> 2
20713 </td></tr>
20714 <tr>
20715 <td> 3 </td>
20716 <td> 4
20717 </td></tr></table>
20718 <p>y
20719 </p>
20720 !! end
20721
20722 !! test
20723 Bug 529: Uncovered bullet in parser function result
20724 !! wikitext
20725 * Foo {{lc:{{bullet}} }}
20726 !! html
20727 <ul><li> Foo </li>
20728 <li> bar</li></ul>
20729
20730 !! end
20731
20732 !! test
20733 Bug 5678: Double-parsed template argument
20734 !! wikitext
20735 {{lc:{{{1}}}|hello}}
20736 !! html
20737 <p>{{{1}}}
20738 </p>
20739 !! end
20740
20741 !! test
20742 Bug 5678: Double-parsed template invocation
20743 !! wikitext
20744 {{lc:{{paramtest {{!}} param = hello }} }}
20745 !! html
20746 <p>{{paramtest | param = hello }}
20747 </p>
20748 !! end
20749
20750 !! test
20751 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20752 !! options
20753 language=cs
20754 title=[[Main Page]]
20755 !! wikitext
20756 {{PRVNÍVELKÉ:ěščř}}
20757 {{prvnívelké:ěščř}}
20758 {{PRVNÍMALÉ:ěščř}}
20759 {{prvnímalé:ěščř}}
20760 {{MALÁ:ěščř}}
20761 {{malá:ěščř}}
20762 {{VELKÁ:ěščř}}
20763 {{velká:ěščř}}
20764 !! html
20765 <p>Ěščř
20766 Ěščř
20767 ěščř
20768 ěščř
20769 ěščř
20770 ěščř
20771 ĚŠČŘ
20772 ĚŠČŘ
20773 </p>
20774 !! end
20775
20776 !! test
20777 Morwen/13: Unclosed link followed by heading
20778 !! wikitext
20779 [[link
20780 ==heading==
20781 !! html
20782 <p>[[link
20783 </p>
20784 <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>
20785
20786 !! end
20787
20788 !! test
20789 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20790 !! wikitext
20791 {{foo|
20792 =heading=
20793 !! html
20794 <p>{{foo|
20795 </p>
20796 <h1><span class="mw-headline" id="heading">heading</span></h1>
20797
20798 !! end
20799
20800 !! test
20801 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20802 !! wikitext
20803 {{foo|
20804 ==heading==
20805 !! html
20806 <p>{{foo|
20807 </p>
20808 <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>
20809
20810 !! end
20811
20812 !! test
20813 Tildes in comments
20814 !! options
20815 pst
20816 !! wikitext
20817 <!-- ~~~~ -->
20818 !! html/php
20819 <!-- ~~~~ -->
20820 !! end
20821
20822 !! test
20823 Paragraphs inside divs (no extra line breaks)
20824 !! wikitext
20825 <div>Line one
20826
20827 Line two</div>
20828 !! html
20829 <div>Line one
20830 Line two</div>
20831
20832 !! end
20833
20834 !! test
20835 Paragraphs inside divs (extra line break on open)
20836 !! wikitext
20837 <div>
20838 Line one
20839
20840 Line two</div>
20841 !! html
20842 <div>
20843 <p>Line one
20844 </p>
20845 Line two</div>
20846
20847 !! end
20848
20849 !! test
20850 Paragraphs inside divs (extra line break on close)
20851 !! wikitext
20852 <div>Line one
20853
20854 Line two
20855 </div>
20856 !! html
20857 <div>Line one
20858 <p>Line two
20859 </p>
20860 </div>
20861
20862 !! end
20863
20864 !! test
20865 Paragraphs inside divs (extra line break on open and close)
20866 !! wikitext
20867 <div>
20868 Line one
20869
20870 Line two
20871 </div>
20872 !! html
20873 <div>
20874 <p>Line one
20875 </p><p>Line two
20876 </p>
20877 </div>
20878
20879 !! end
20880
20881 !! test
20882 Nesting tags, paragraphs on lines which begin with <div>
20883 !! wikitext
20884 <div></div><strong>A
20885 B</strong>
20886 !! html/php+tidy
20887 <p><strong>A</strong></p>
20888 <p><strong>B</strong></p>
20889 !! html/parsoid
20890 <div></div>
20891 <p><strong>A
20892 B</strong>
20893 </p>
20894 !! end
20895
20896 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20897 !! test
20898 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20899 !! wikitext
20900 <blockquote>Line one
20901
20902 Line two</blockquote>
20903 !! html
20904 <blockquote>Line one
20905 Line two</blockquote>
20906
20907 !! html+tidy
20908 <blockquote>
20909 <p>Line one Line two</p>
20910 </blockquote>
20911 !! end
20912
20913 !! test
20914 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20915 !! wikitext
20916 <blockquote>
20917 Line one
20918
20919 Line two</blockquote>
20920 !! html
20921 <blockquote>
20922 <p>Line one
20923 </p>
20924 Line two</blockquote>
20925
20926 !! html+tidy
20927 <blockquote>
20928 <p>Line one</p>
20929 Line two</blockquote>
20930 !! end
20931
20932 !! test
20933 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20934 !! wikitext
20935 <blockquote>Line one
20936
20937 Line two
20938 </blockquote>
20939 !! html
20940 <blockquote>Line one
20941 <p>Line two
20942 </p>
20943 </blockquote>
20944
20945 !! html+tidy
20946 <blockquote>
20947 <p>Line one</p>
20948 <p>Line two</p>
20949 </blockquote>
20950 !! end
20951
20952 !! test
20953 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20954 !! wikitext
20955 <blockquote>
20956 Line one
20957
20958 Line two
20959 </blockquote>
20960 !! html
20961 <blockquote>
20962 <p>Line one
20963 </p><p>Line two
20964 </p>
20965 </blockquote>
20966
20967 !! html+tidy
20968 <blockquote>
20969 <p>Line one</p>
20970 <p>Line two</p>
20971 </blockquote>
20972 !! end
20973
20974 !! test
20975 Paragraphs inside blockquotes/divs (no extra line breaks)
20976 !! wikitext
20977 <blockquote><div>Line one
20978
20979 Line two</div></blockquote>
20980 !! html
20981 <blockquote><div>Line one
20982 Line two</div></blockquote>
20983
20984 !! end
20985
20986 !! test
20987 Paragraphs inside blockquotes/divs (extra line break on open)
20988 !! wikitext
20989 <blockquote><div>
20990 Line one
20991
20992 Line two</div></blockquote>
20993 !! html
20994 <blockquote><div>
20995 <p>Line one
20996 </p>
20997 Line two</div></blockquote>
20998
20999 !! end
21000
21001 !! test
21002 Paragraphs inside blockquotes/divs (extra line break on close)
21003 !! wikitext
21004 <blockquote><div>Line one
21005
21006 Line two
21007 </div></blockquote>
21008 !! html
21009 <blockquote><div>Line one
21010 <p>Line two
21011 </p>
21012 </div></blockquote>
21013
21014 !! end
21015
21016 !! test
21017 Paragraphs inside blockquotes/divs (extra line break on open and close)
21018 !! wikitext
21019 <blockquote><div>
21020 Line one
21021
21022 Line two
21023 </div></blockquote>
21024 !! html
21025 <blockquote><div>
21026 <p>Line one
21027 </p><p>Line two
21028 </p>
21029 </div></blockquote>
21030
21031 !! end
21032
21033 !! test
21034 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21035 !! options
21036 wgLinkHolderBatchSize=0
21037 !! wikitext
21038 [[meatball:1]]
21039 [[meatball:2]]
21040 [[meatball:3]]
21041 !! html
21042 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21043 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21044 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21045 </p>
21046 !! end
21047
21048 !! test
21049 Free external link invading image caption
21050 !! wikitext
21051 [[Image:Foobar.jpg|thumb|http://x|hello]]
21052 !! html
21053 <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>
21054
21055 !! end
21056
21057 !! test
21058 Bug 15196: localised external link numbers
21059 !! options
21060 language=fa
21061 !! wikitext
21062 [http://en.wikipedia.org/]
21063 !! html/php
21064 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21065 </p>
21066 !! html/parsoid
21067 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21068 !! end
21069
21070 !! test
21071 Multibyte character in padleft
21072 !! wikitext
21073 {{padleft:-Hello|7|Æ}}
21074 !! html
21075 <p>Æ-Hello
21076 </p>
21077 !! end
21078
21079 !! test
21080 Multibyte character in padright
21081 !! wikitext
21082 {{padright:Hello-|7|Æ}}
21083 !! html
21084 <p>Hello-Æ
21085 </p>
21086 !! end
21087
21088 !!test
21089 formatdate parser function
21090 !! wikitext
21091 {{#formatdate:2009-03-24}}
21092 !! html
21093 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21094 </p>
21095 !! end
21096
21097 !!test
21098 formatdate parser function, with default format
21099 !! wikitext
21100 {{#formatdate:2009-03-24|mdy}}
21101 !! html
21102 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21103 </p>
21104 !! end
21105
21106 !! test
21107 Spacing of numbers in formatted dates
21108 !! wikitext
21109 {{#formatdate:January 15}}
21110 !! html
21111 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21112 </p>
21113 !! end
21114
21115 !! test
21116 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
21117 !! options
21118 language=nl title=[[MediaWiki:Common.css]]
21119 !! wikitext
21120 {{#formatdate:2009-03-24|dmy}}
21121 !! html
21122 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21123 </p>
21124 !! end
21125
21126 #
21127 #
21128 #
21129
21130 #
21131 # Edit comments
21132 #
21133
21134 !! test
21135 Edit comment with link
21136 !! options
21137 comment
21138 !! wikitext
21139 I like the [[Main Page]] a lot
21140 !! html/php
21141 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21142 !!end
21143
21144 !! test
21145 Edit comment with link and link text
21146 !! options
21147 comment
21148 !! wikitext
21149 I like the [[Main Page|best pages]] a lot
21150 !! html/php
21151 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21152 !!end
21153
21154 !! test
21155 Edit comment with link and link text with suffix
21156 !! options
21157 comment
21158 !! wikitext
21159 I like the [[Main Page|best page]]s a lot
21160 !! html/php
21161 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21162 !!end
21163
21164 !! test
21165 Edit comment with section link (non-local, eg in history list)
21166 !! options
21167 comment title=[[Main Page]]
21168 !! wikitext
21169 /* External links */ removed bogus entries
21170 !! html/php
21171 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21172 !!end
21173
21174 !! test
21175 Edit comment with section link and text before it (non-local, eg in history list)
21176 !! options
21177 comment title=[[Main Page]]
21178 !! wikitext
21179 pre-comment text /* External links */ removed bogus entries
21180 !! html/php
21181 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>
21182 !!end
21183
21184 !! test
21185 Edit comment with section link (local, eg in diff view)
21186 !! options
21187 comment local title=[[Main Page]]
21188 !! wikitext
21189 /* External links */ removed bogus entries
21190 !! html/php
21191 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21192 !!end
21193
21194 !! test
21195 Edit comment with subpage link (bug 14080)
21196 !! options
21197 comment
21198 subpage
21199 title=[[Subpage test]]
21200 !! wikitext
21201 Poked at a [[/subpage]] here...
21202 !! html/php
21203 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21204 !!end
21205
21206 !! test
21207 Edit comment with subpage link and link text (bug 14080)
21208 !! options
21209 comment
21210 subpage
21211 title=[[Subpage test]]
21212 !! wikitext
21213 Poked at a [[/subpage|neat little page]] here...
21214 !! html/php
21215 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21216 !!end
21217
21218 !! test
21219 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21220 !! options
21221 comment
21222 title=[[Subpage test]]
21223 !! wikitext
21224 Poked at a [[/subpage]] here...
21225 !! html/php
21226 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...
21227 !!end
21228
21229 !! test
21230 Edit comment with bare anchor link (local, as on diff)
21231 !! options
21232 comment
21233 local
21234 title=[[Main Page]]
21235 !! wikitext
21236 [[#section]]
21237 !! html/php
21238 <a href="#section">#section</a>
21239 !! end
21240
21241 !! test
21242 Edit comment with bare anchor link (non-local, as on history)
21243 !! options
21244 comment
21245 title=[[Main Page]]
21246 !! wikitext
21247 [[#section]]
21248 !! html/php
21249 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21250 !! end
21251
21252 !! test
21253 Anchor starting with underscore
21254 !! options
21255 title=[[Foo]]
21256 !! wikitext
21257 [[#_ref|One]]
21258 !! html/php
21259 <p><a href="#_ref">One</a>
21260 </p>
21261 !! html/parsoid
21262 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21263 !! end
21264
21265 !! test
21266 Id starting with underscore
21267 !! wikitext
21268 <div id="_ref"></div>
21269 !! html/*
21270 <div id="_ref"></div>
21271
21272 !! end
21273
21274 !! test
21275 Edit comment with link with more than one pipe (T99346)
21276 !! options
21277 comment
21278 !! wikitext
21279 [[Main Page|Many|pipes]]
21280 !! html/php
21281 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21282 !! end
21283
21284 !! test
21285 Complex edit comment with link with more than one pipe (T99346)
21286 !! options
21287 comment
21288 !! wikitext
21289 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21290 !! html/php
21291 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;
21292 !! end
21293
21294 !! test
21295 Space normalisation on autocomment (bug 22784)
21296 !! options
21297 comment
21298 title=[[Main Page]]
21299 !! wikitext
21300 /* __hello__world__ */
21301 !! html/php
21302 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21303 !! end
21304
21305 !! test
21306 percent-encoding and + signs in comments (Bug 26410)
21307 !! options
21308 comment
21309 !! wikitext
21310 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21311 !! html/php
21312 <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>
21313 !! end
21314
21315 # Parsoid doesn't support this yet: see bug 73581
21316 # but it *should* omit the 'src' attribute if the image is bad.
21317 # PHP side of tests was disabled in
21318 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21319 # because of issues in the PHP parserTests infrastructure
21320 # (but the output below is indeed what the PHP side emits)
21321 !! test
21322 Bad images - basic functionality
21323 !! wikitext
21324 [[File:Bad.jpg]]
21325 !! DISABLED/html/php
21326 !! html/parsoid
21327 <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>
21328 !! end
21329
21330 !! test
21331 Bad images - bug 16039: text after bad image disappears
21332 !! wikitext
21333 Foo bar
21334 [[File:Bad.jpg]]
21335 Bar foo
21336 !! DISABLED/html/php
21337 <p>Foo bar
21338 </p><p>Bar foo
21339 </p>
21340 !! html/parsoid
21341 <p>Foo bar
21342 <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>
21343 Bar foo</p>
21344 !! end
21345
21346 !! test
21347 Verify that displaytitle works (bug #22501) no displaytitle
21348 !! options
21349 showtitle
21350 !! config
21351 wgAllowDisplayTitle=true
21352 wgRestrictDisplayTitle=false
21353 !! wikitext
21354 this is not the the title
21355 !! html/php
21356 Parser test
21357 <p>this is not the the title
21358 </p>
21359 !! end
21360
21361 !! test
21362 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21363 !! options
21364 showtitle
21365 title=[[Screen]]
21366 !! config
21367 wgAllowDisplayTitle=true
21368 wgRestrictDisplayTitle=false
21369 !! wikitext
21370 this is not the the title
21371 {{DISPLAYTITLE:whatever}}
21372 !! html/php
21373 whatever
21374 <p>this is not the the title
21375 </p>
21376 !! end
21377
21378 !! test
21379 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21380 !! options
21381 showtitle
21382 title=[[Screen]]
21383 !! config
21384 wgAllowDisplayTitle=true
21385 wgRestrictDisplayTitle=true
21386 !! wikitext
21387 this is not the the title
21388 {{DISPLAYTITLE:whatever}}
21389 !! html/php
21390 Screen
21391 <p>this is not the the title
21392 </p>
21393 !! end
21394
21395 !! test
21396 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21397 !! options
21398 showtitle
21399 title=[[Screen]]
21400 !! config
21401 wgAllowDisplayTitle=true
21402 wgRestrictDisplayTitle=true
21403 !! wikitext
21404 this is not the the title
21405 {{DISPLAYTITLE:screen}}
21406 !! html/php
21407 screen
21408 <p>this is not the the title
21409 </p>
21410 !! end
21411
21412 !! test
21413 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21414 !! options
21415 showtitle
21416 title=[[Screen]]
21417 !! config
21418 wgAllowDisplayTitle=false
21419 !! wikitext
21420 this is not the the title
21421 {{DISPLAYTITLE:screen}}
21422 !! html/php
21423 Screen
21424 <p>this is not the the title
21425 <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>
21426 </p>
21427 !! end
21428
21429 !! test
21430 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21431 !! options
21432 showtitle
21433 title=[[Screen]]
21434 !! config
21435 wgAllowDisplayTitle=false
21436 !! wikitext
21437 this is not the the title
21438 !! html/php
21439 Screen
21440 <p>this is not the the title
21441 </p>
21442 !! end
21443
21444 !! test
21445 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21446 !! options
21447 showtitle
21448 title=[[Screen]]
21449 !! config
21450 wgAllowDisplayTitle=true
21451 wgRestrictDisplayTitle=true
21452 !! wikitext
21453 this is not the the title
21454 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21455 !! html/php
21456 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21457 <p>this is not the the title
21458 </p>
21459 !! end
21460
21461 !! test
21462 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21463 !! options
21464 showtitle
21465 title=[[Screen]]
21466 !! config
21467 wgAllowDisplayTitle=true
21468 wgRestrictDisplayTitle=true
21469 !! wikitext
21470 this is not the the title
21471 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21472 !! html/php
21473 <span style="color: red;">s</span>creen
21474 <p>this is not the the title
21475 </p>
21476 !! end
21477
21478 !! test
21479 Page status indicators: Empty name is invalid
21480 !! options
21481 showindicators
21482 !! wikitext
21483 <indicator name=" "></indicator>
21484 <indicator></indicator>
21485 !! html
21486 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21487 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21488 </p>
21489 !! end
21490
21491 !! test
21492 Page status indicators: Weird syntaxes that are okay
21493 !! options
21494 showindicators
21495 !! wikitext
21496 <indicator name="empty" />
21497 <indicator name="name"></indicator>
21498 !! html
21499 empty=
21500 name=
21501 <p><br />
21502 </p>
21503 !! end
21504
21505 !! test
21506 Page status indicators: Torture test
21507 !! options
21508 showindicators
21509 !! wikitext
21510 <indicator name="01">hello world</indicator>
21511 <indicator name="02">[[Main Page]]</indicator>
21512 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21513 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21514 <indicator name="05">* foo
21515 * bar</indicator>
21516 <indicator name="06"><nowiki>foo</nowiki></indicator>
21517 <indicator name="07"> Preformatted</indicator>
21518 <indicator name="08"><div>Broken tag</indicator>
21519 <indicator name="09">{| class=wikitable
21520 | cell
21521 |}</indicator>
21522 <indicator name="10">Two
21523
21524 paragraphs</indicator>
21525 !! html
21526 01=hello world
21527 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21528 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" />
21529 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>
21530 05=<ul><li> foo</li>
21531 <li> bar</li></ul>
21532
21533 06=foo
21534 07=<pre>Preformatted
21535 </pre>
21536 08=<div>Broken tag</div>
21537
21538 09=<table class="wikitable">
21539 <tr>
21540 <td> cell
21541 </td></tr></table>
21542
21543 10=<p>Two
21544 </p><p>paragraphs
21545 </p>
21546 <p><br />
21547 </p><p><br />
21548 </p><p><br />
21549 </p><p><br />
21550 </p><p><br />
21551 </p>
21552 !! end
21553
21554 !! test
21555 preload: check <noinclude> and <includeonly>
21556 !! options
21557 preload
21558 !! wikitext
21559 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21560 !! html/php
21561 Hello kind world.
21562 !! end
21563
21564 !! test
21565 preload: check <onlyinclude>
21566 !! options
21567 preload
21568 !! wikitext
21569 Goodbye <onlyinclude>Hello world</onlyinclude>
21570 !! html/php
21571 Hello world
21572 !! end
21573
21574 !! test
21575 preload: can pass tags through if we want to
21576 !! options
21577 preload
21578 !! wikitext
21579 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21580 !! html/php
21581 <includeonly>Hello world</includeonly>
21582 !! end
21583
21584 !! test
21585 preload: check that it doesn't try to do tricks
21586 !! options
21587 preload
21588 !! wikitext
21589 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21590 !! html/php
21591 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21592 !! end
21593
21594 !! test
21595 Play a bit with r67090 and bug 3158
21596 !! wikitext
21597 <div style="width:50% !important">&nbsp;</div>
21598 <div style="width:50%&nbsp;!important">&nbsp;</div>
21599 <div style="width:50%&#160;!important">&nbsp;</div>
21600 <div style="border : solid;">&nbsp;</div>
21601 !! html/php
21602 <div style="width:50% !important">&#160;</div>
21603 <div style="width:50% !important">&#160;</div>
21604 <div style="width:50% !important">&#160;</div>
21605 <div style="border&#160;: solid;">&#160;</div>
21606
21607 !! html/parsoid
21608 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21609 <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>
21610 <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>
21611 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21612
21613 !! end
21614
21615 !! test
21616 HTML5 data attributes
21617 !! wikitext
21618 <span data-foo="bar">Baz</span>
21619 <p data-abc-def_hij="">Quuz</p>
21620 !! html/php
21621 <p><span data-foo="bar">Baz</span>
21622 </p>
21623 <p data-abc-def_hij="">Quuz</p>
21624
21625 !! html/parsoid
21626 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21627 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21628 !! end
21629
21630 !! test
21631 Strip reserved data attributes
21632 !! wikitext
21633 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21634 !! html/php
21635 <div data-ok="fred">d</div>
21636
21637 !! html/parsoid
21638 <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>
21639 !! end
21640
21641 !! test
21642 percent-encoding and + signs in internal links (Bug 26410)
21643 !! wikitext
21644 [[User:+%]] [[Page+title%]]
21645 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21646 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21647 [[%33%45]] [[%33%45+]]
21648 !! html/php
21649 <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>
21650 <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>
21651 <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>
21652 <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>
21653 </p>
21654 !! html/parsoid
21655 <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>
21656 <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>
21657 <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>
21658 <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>
21659 !! end
21660
21661 !! test
21662 Special characters in embedded file links (bug 27679)
21663 !! wikitext
21664 [[File:Contains & ampersand.jpg]]
21665 [[File:Does not exist.jpg|Title with & ampersand]]
21666 !! html/php
21667 <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>
21668 <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>
21669 </p>
21670 !! html/parsoid
21671 <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>
21672 <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>
21673 !! end
21674
21675 !! test
21676 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21677 !! wikitext
21678 Text&apos;s been normalized?
21679 !! html
21680 <p>Text&#39;s been normalized?
21681 </p>
21682 !! end
21683
21684 !! test
21685 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21686 !! wikitext
21687 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21688 !! html
21689 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21690 </p>
21691 !! end
21692
21693 !! test
21694 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21695 !! wikitext
21696 [http://www.example.org/ ideograms]
21697 !! html
21698 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21699 </p>
21700 !! end
21701
21702 !! test
21703 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21704 !! wikitext
21705 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21706 !! html
21707 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21708 </p>
21709 !! end
21710
21711 !! article
21712 Mediawiki:loop1
21713 !! text
21714 {{Identical|A}}
21715 !! endarticle
21716
21717 !! article
21718 Mediawiki:loop2
21719 !! text
21720 {{Identical|B}}
21721 !! endarticle
21722
21723 !! article
21724 Template:Identical
21725 !! text
21726 {{int:loop1}}
21727 {{int:loop2}}
21728 !! endarticle
21729
21730 !! test
21731 Bug 31098 Template which includes system messages which includes the template
21732 !! wikitext
21733 {{Identical}}
21734 !! html
21735 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21736 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21737 </p>
21738 !! end
21739
21740 !! test
21741 Bug31490 Turkish: ucfirst 'blah'
21742 !! options
21743 language=tr
21744 !! wikitext
21745 {{ucfirst:blah}}
21746 !! html
21747 <p>Blah
21748 </p>
21749 !! end
21750
21751 !! test
21752 Bug31490 Turkish: ucfirst 'ix'
21753 !! options
21754 language=tr
21755 !! wikitext
21756 {{ucfirst:ix}}
21757 !! html
21758 <p>İx
21759 </p>
21760 !! end
21761
21762 !! test
21763 Bug31490 Turkish: lcfirst 'BLAH'
21764 !! options
21765 language=tr
21766 !! wikitext
21767 {{lcfirst:BLAH}}
21768 !! html
21769 <p>bLAH
21770 </p>
21771 !! end
21772
21773 !! test
21774 Bug31490 Turkish: ucfırst (with a dotless i)
21775 !! options
21776 language=tr
21777 !! wikitext
21778 {{ucfırst:blah}}
21779 !! html
21780 <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>
21781 </p>
21782 !! end
21783
21784 !! test
21785 Bug31490 ucfırst (with a dotless i) with English language
21786 !! options
21787 language=en
21788 !! wikitext
21789 {{ucfırst:blah}}
21790 !! html
21791 <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>
21792 </p>
21793 !! end
21794
21795 !! test
21796 Bug 26375: TOC with italics
21797 !! options
21798 title=[[Main Page]]
21799 !! wikitext
21800 __TOC__
21801 == ''Lost'' episodes ==
21802 !! html
21803 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21804 <ul>
21805 <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>
21806 </ul>
21807 </div>
21808
21809 <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>
21810
21811 !! end
21812
21813 !! test
21814 Bug 26375: TOC with bold
21815 !! options
21816 title=[[Main Page]]
21817 !! wikitext
21818 __TOC__
21819 == '''should be bold''' then normal text ==
21820 !! html
21821 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21822 <ul>
21823 <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>
21824 </ul>
21825 </div>
21826
21827 <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>
21828
21829 !! end
21830
21831 !! test
21832 Bug 33845: Headings become cursive in TOC when they contain an image
21833 !! options
21834 title=[[Main Page]]
21835 !! wikitext
21836 __TOC__
21837 == Image [[Image:foobar.jpg]] ==
21838 !! html
21839 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21840 <ul>
21841 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21842 </ul>
21843 </div>
21844
21845 <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>
21846
21847 !! end
21848
21849 !! test
21850 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21851 !! options
21852 title=[[Main Page]]
21853 !! wikitext
21854 __TOC__
21855 == <blockquote>Quote</blockquote> ==
21856 !! html
21857 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21858 <ul>
21859 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21860 </ul>
21861 </div>
21862
21863 <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>
21864
21865 !! html+tidy
21866 <p></p>
21867 <div id="toc" class="toc">
21868 <div id="toctitle">
21869 <h2>Contents</h2>
21870 </div>
21871 <ul>
21872 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21873 </ul>
21874 </div>
21875 <p></p>
21876 <h2><span class="mw-headline" id="Quote"></span></h2>
21877 <blockquote>
21878 <p><span class="mw-headline" id="Quote">Quote</span></p>
21879 </blockquote>
21880 <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>
21881 !! end
21882
21883 !! test
21884 Unclosed tags in TOC
21885 !! options
21886 title=[[Main Page]]
21887 !! wikitext
21888 __TOC__
21889 == Proof: 2 < 3 ==
21890 <small>Hanc marginis exiguitas non caperet.</small>
21891 QED
21892 !! html
21893 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21894 <ul>
21895 <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>
21896 </ul>
21897 </div>
21898
21899 <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>
21900 <p><small>Hanc marginis exiguitas non caperet.</small>
21901 QED
21902 </p>
21903 !! end
21904
21905 !! test
21906 Multiple tags in TOC
21907 !! wikitext
21908 __TOC__
21909 == <i>Foo</i> <b>Bar</b> ==
21910
21911 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21912 !! html
21913 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21914 <ul>
21915 <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>
21916 <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>
21917 </ul>
21918 </div>
21919
21920 <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>
21921 <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>
21922
21923 !! html+tidy
21924 <p></p>
21925 <div id="toc" class="toc">
21926 <div id="toctitle">
21927 <h2>Contents</h2>
21928 </div>
21929 <ul>
21930 <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>
21931 <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>
21932 </ul>
21933 </div>
21934 <p></p>
21935 <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>
21936 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21937 <blockquote>
21938 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21939 </blockquote>
21940 <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>
21941 !! end
21942
21943 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21944 # html5 tag parsing.
21945 !! test
21946 Tags with parameters in TOC
21947 !! options
21948 parsoid=wt2html
21949 !! wikitext
21950 __TOC__
21951 == <sup class="in-h2">Hello</sup> ==
21952
21953 == <sup class="a > b">Evilbye</sup> ==
21954 !! html/php
21955 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21956 <ul>
21957 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21958 <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>
21959 </ul>
21960 </div>
21961
21962 <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>
21963 <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>
21964
21965 !! html/parsoid
21966 <meta property="mw:PageProp/toc" />
21967 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21968
21969 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21970 !! end
21971
21972 !! test
21973 span tags with directionality in TOC
21974 !! wikitext
21975 __TOC__
21976 == <span dir="ltr">C++</span> ==
21977
21978 == <span dir="rtl">זבנג!</span> ==
21979
21980 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21981
21982 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21983
21984 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21985 !! html
21986 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21987 <ul>
21988 <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>
21989 <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>
21990 <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>
21991 <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>
21992 <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>
21993 </ul>
21994 </div>
21995
21996 <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>
21997 <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>
21998 <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>
21999 <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>
22000 <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>
22001
22002 !! end
22003
22004 !! test
22005 Bug 72884: bdi element in ToC
22006 !! wikitext
22007 __TOC__
22008 == <bdi>test</bdi> ==
22009 !! html
22010 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22011 <ul>
22012 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22013 </ul>
22014 </div>
22015
22016 <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>
22017
22018 !! end
22019
22020 !! test
22021 T35715: s/strike element in ToC
22022 !! wikitext
22023 __TOC__
22024 == <s>test</s> test <strike>test</strike> ==
22025 !! html
22026 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22027 <ul>
22028 <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>
22029 </ul>
22030 </div>
22031
22032 <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>
22033
22034 !! end
22035
22036 # Note that the html output does not have the <p></p>, but the
22037 # html+tidy output *does*. This is because the empty <p></p> is
22038 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22039 !! test
22040 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22041 !! wikitext
22042 __TOC__
22043 == x ==
22044 !! html
22045 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22046 <ul>
22047 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22048 </ul>
22049 </div>
22050
22051 <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>
22052
22053 !! html+tidy
22054 <p></p>
22055 <div id="toc" class="toc">
22056 <div id="toctitle">
22057 <h2>Contents</h2>
22058 </div>
22059 <ul>
22060 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22061 </ul>
22062 </div>
22063 <p></p>
22064 <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>
22065 !! end
22066
22067 !! article
22068 MediaWiki:Bug32057
22069 !! text
22070 == {{int:headline_sample}} ==
22071 !! endarticle
22072
22073 !! test
22074 Bug 32057: Title needed when expanding <h> nodes.
22075 !! options
22076 title=[[Main Page]]
22077 !! wikitext
22078 {{int:Bug32057}}
22079 !! html
22080 <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>
22081
22082 !! end
22083
22084 !! test
22085 Strip marker in urlencode
22086 !! wikitext
22087 {{urlencode:x<nowiki/>y}}
22088 {{urlencode:x<nowiki/>y|wiki}}
22089 {{urlencode:x<nowiki/>y|path}}
22090 {{urlencode:x<pre id="one">two</pre>y}}
22091 !! html/php
22092 <p>xy
22093 xy
22094 xy
22095 xy
22096 </p>
22097 !! end
22098
22099 !! test
22100 Strip marker in lc
22101 !! wikitext
22102 {{lc:x<nowiki/>y}}
22103 !! html
22104 <p>xy
22105 </p>
22106 !! end
22107
22108 !! test
22109 Strip marker in uc
22110 !! wikitext
22111 {{uc:x<nowiki/>y}}
22112 !! html
22113 <p>XY
22114 </p>
22115 !! end
22116
22117 !! test
22118 Strip marker in formatNum
22119 !! wikitext
22120 {{formatnum:1<nowiki/>2}}
22121 {{formatnum:1<nowiki/>2|R}}
22122 !! html
22123 <p>12
22124 12
22125 </p>
22126 !! end
22127
22128 !! test
22129 Check noCommafy in formatNum
22130 !! options
22131 language=be-tarask
22132 !! wikitext
22133 {{formatnum:123456.78}}
22134 {{formatnum:123456.78|NOSEP}}
22135 !! html
22136 <p>123 456,78
22137 123456.78
22138 </p>
22139 !! end
22140
22141 !! test
22142 Wrong option for formatNum (bug 56199)
22143 !! wikitext
22144 {{formatnum:1,234.56|Random}}
22145 {{formatnum:1,234.56|EVERYTHING}}
22146 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22147 !! html
22148 <p>1,234.56
22149 1,234.56
22150 1,234.56
22151 </p>
22152 !! end
22153
22154 !! test
22155 Strip marker in grammar
22156 !! options
22157 language=fi
22158 !! wikitext
22159 {{grammar:elative|foo<nowiki/>bar}}
22160 !! html
22161 <p>foobarista
22162 </p>
22163 !! end
22164
22165 !! test
22166 Strip marker in padleft
22167 !! wikitext
22168 {{padleft:|2|x<nowiki/>y}}
22169 !! html
22170 <p>xy
22171 </p>
22172 !! end
22173
22174 !! test
22175 Strip marker in padright
22176 !! wikitext
22177 {{padright:|2|x<nowiki/>y}}
22178 !! html
22179 <p>xy
22180 </p>
22181 !! end
22182
22183 !! test
22184 Strip marker in anchorencode
22185 !! wikitext
22186 {{anchorencode:x<nowiki/>y}}
22187 !! html
22188 <p>xy
22189 </p>
22190 !! end
22191
22192 !! test
22193 nowiki inside link inside heading (bug 18295)
22194 !! wikitext
22195 ==[[foo|x<nowiki>y</nowiki>z]]==
22196 !! html
22197 <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>
22198
22199 !! end
22200
22201 !! test
22202 new support for bdi element (bug 31817)
22203 !! wikitext
22204 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22205 !! html
22206 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22207
22208 !!end
22209
22210 !! test
22211 Ignore pipe between table row attributes
22212 !! wikitext
22213 {|
22214 | quux
22215 |- id=foo | style='color: red'
22216 | bar
22217 |}
22218 !! html
22219 <table>
22220 <tr>
22221 <td> quux
22222 </td></tr>
22223 <tr id="foo" style="color: red">
22224 <td> bar
22225 </td></tr></table>
22226
22227 !! end
22228
22229 !! test
22230 Language parser function
22231 !! wikitext
22232 {{#language:ar}}
22233 !! html
22234 <p>العربية
22235 </p>
22236 !! end
22237
22238 !!test
22239 Padleft and padright as substr
22240 !! wikitext
22241 {{padleft:|3|abcde}}
22242 {{padright:|3|abcde}}
22243 !! html
22244 <p>abc
22245 abc
22246 </p>
22247 !! end
22248
22249 !!test
22250 Special parser function
22251 !! wikitext
22252 {{#special:RandomPage}}
22253 {{#special:BaDtItLe}}
22254 {{#special:Foobar}}
22255 !! html
22256 <p>Special:Random
22257 Special:Badtitle
22258 Special:Foobar
22259 </p>
22260 !! end
22261
22262 !!test
22263 Bug 34939 - Case insensitive link parsing ([HttP://])
22264 !! wikitext
22265 [HttP://MediaWiki.Org/]
22266 !! html/php
22267 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22268 </p>
22269 !! html/parsoid
22270 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22271 !! end
22272
22273 !!test
22274 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22275 !! wikitext
22276 [HttP://MediaWiki.Org/ MediaWiki]
22277 !! html
22278 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22279 </p>
22280 !! end
22281
22282 !!test
22283 Bug 34939 - Case insensitive link parsing (HttP://)
22284 !! wikitext
22285 HttP://MediaWiki.Org/
22286 !! html/php
22287 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22288 </p>
22289 !! html/parsoid
22290 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22291 !! end
22292
22293 !!test
22294 Disable TOC
22295 !! options
22296 notoc
22297 !! wikitext
22298 Lead
22299 == Section 1 ==
22300 == Section 2 ==
22301 == Section 3 ==
22302 == Section 4 ==
22303 == Section 5 ==
22304 !! html
22305 <p>Lead
22306 </p>
22307
22308 <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>
22309 <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>
22310 <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>
22311 <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>
22312 <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>
22313
22314 !! end
22315
22316
22317 ###
22318 ### Parsoid-specific tests
22319 ### Parsoid-PHP parser incompatibilities
22320 ###
22321 !!test
22322 1. SOL-sensitive wikitext tokens as template-args
22323 !!options
22324 parsoid=wt2html,wt2wt
22325 !! wikitext
22326 {{echo|*a}}
22327 {{echo|#a}}
22328 {{echo|:a}}
22329 !! html
22330 <span about="#mwt1" typeof="mw:Transclusion">
22331 </span><ul about="#mwt1"><li>a</li>
22332 </ul>
22333 <span about="#mwt2" typeof="mw:Transclusion">
22334 </span><ol about="#mwt2"><li>a</li>
22335 </ol>
22336 <span about="#mwt3" typeof="mw:Transclusion">
22337 </span><dl about="#mwt3"><dd>a</dd>
22338 </dl>
22339 !!end
22340
22341 #### -----------------------------------------------------------------
22342 #### Parsoid-specific functionality tests
22343 #### -----------------------------------------------------------------
22344
22345 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22346 # We know wt2wt will fail, but we expect selser to pass.
22347 # Due to the nature of our testing, wt2wt and selser tests will enter the
22348 # blacklist and we'll catch selser regressions based on changes to the
22349 # blacklist entries for selser tests.
22350 !! test
22351 1. Bad treebuilder fixup of formatting elt is cleaned up
22352 !! options
22353 parsoid=wt2html,wt2wt
22354 !! wikitext
22355 {|
22356 |
22357 <small>
22358 [[Image:Foobar.jpg|right|Test]]
22359 </small>
22360 |}
22361 !! html/parsoid
22362 <table>
22363 <tbody><tr><td>
22364 <small>
22365 <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>
22366 </small>
22367 </td></tr>
22368 </tbody></table>
22369 !! end
22370
22371 !! test
22372 2. Bad treebuilder fixup of formatting elt is cleaned up
22373 !! options
22374 parsoid=wt2html,wt2wt
22375 !! wikitext
22376 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22377
22378 <small>[[Image:Foobar.jpg|right|300px]]</small>
22379 !! html/parsoid
22380
22381 <p><b>foo</b></p>
22382 <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>
22383 <p><b>bar</b></p>
22384 <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>
22385 !! end
22386
22387 !! test
22388 3. Bad treebuilder fixup of formatting elt is cleaned up
22389 !! options
22390 parsoid=wt2html,wt2wt
22391 !! wikitext
22392 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22393 !! html/parsoid
22394 <p><small><b>foo</b></small></p>
22395 <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>
22396 <p><small><b>bar</b></small></p>
22397 !! end
22398
22399 !! test
22400 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22401 !! options
22402 parsoid=wt2html,wt2wt
22403 !! wikitext
22404 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22405 !! html/parsoid
22406 <p><b><small></small></b></p>
22407 <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>
22408 <p></p>
22409 !! end
22410
22411 #### ----------------------------------------------------------------
22412 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22413 #### tags. Parsoid's output for these tags differs from that of the
22414 #### PHP parser.
22415 #### ----------------------------------------------------------------
22416
22417 !!test
22418 Ref: 1. ref-location should be replaced with an index span
22419 !! wikitext
22420 A <ref>foo</ref>
22421 B <ref name="x">foo</ref>
22422 C <ref name="y" />
22423 <references />
22424 !! html/parsoid
22425 <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>
22426 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>
22427 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>
22428 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22429 <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>
22430 <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>
22431 <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>
22432 </ol>
22433 !!end
22434
22435 !!test
22436 Ref: 2. ref-tags with identical names should all get the same index
22437 !! wikitext
22438 A <ref name="x">foo</ref>
22439 B <ref name="x" />
22440 <references />
22441 !! html/parsoid
22442 <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>
22443 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>
22444 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22445 <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>
22446 </ol>
22447 !!end
22448
22449 !!test
22450 Ref: 3. spaces in ref-names should be ignored
22451 !! wikitext
22452 A <ref name="x">foo</ref>
22453 B <ref name=" x " />
22454 C <ref name= x />
22455 <references />
22456 !! html/parsoid
22457 <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>
22458 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>
22459 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>
22460 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22461 <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>
22462 </ol>
22463 !!end
22464
22465 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22466 !!test
22467 Ref: 4. 'constructor' should be accepted as a valid ref-name
22468 !! wikitext
22469 A <ref name="constructor">foo</ref>
22470 <references />
22471 !! html/parsoid
22472 <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>
22473 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22474 <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>
22475 </ol>
22476 !!end
22477
22478 !!test
22479 Ref: 5. body should accept generic wikitext
22480 !! wikitext
22481 A <ref>
22482 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22483 </ref>
22484
22485 <references />
22486 !! html/parsoid
22487 <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>
22488
22489 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22490 <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>
22491 </span></li>
22492 </ol>
22493 !!end
22494
22495 !!test
22496 Ref: 6. indent-pres should not be output in ref-body
22497 !! wikitext
22498 A <ref>
22499 foo
22500 bar
22501 baz
22502 </ref>
22503
22504 <references />
22505 !! html/parsoid
22506 <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>
22507
22508 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22509 <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
22510 bar
22511 baz
22512 </span></li>
22513 </ol>
22514 !!end
22515
22516 !!test
22517 Ref: 7. No p-wrapping in ref-body
22518 !! wikitext
22519 A <ref>
22520 foo
22521
22522 bar
22523
22524
22525 baz
22526
22527
22528
22529 booz
22530 </ref>
22531
22532 <references />
22533 !! html/parsoid
22534 <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>
22535
22536 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22537 <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
22538
22539 bar
22540
22541
22542 baz
22543
22544
22545
22546 booz
22547 </span></li>
22548 </ol>
22549 !!end
22550
22551 !!test
22552 Ref: 8. transclusion wikitext has lower precedence
22553 !! wikitext
22554 A <ref> foo {{echo|</ref> B C}}
22555
22556 <references />
22557 !! html/parsoid
22558 <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>
22559 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22560 <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>
22561 </ol>
22562 !!end
22563
22564 !!test
22565 Ref: 9. unclosed comments should not leak out of ref-body
22566 !! wikitext
22567 A <ref> foo <!--</ref> B C
22568 <references />
22569 !! html/parsoid
22570 <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>
22571 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22572 <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>
22573 </ol>
22574 !!end
22575
22576 !!test
22577 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22578 !! wikitext
22579 A <ref> <b> foo </ref> B C
22580
22581 <references />
22582 !! html/parsoid
22583 <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>
22584
22585
22586 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22587 <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>
22588 </ol>
22589 !!end
22590
22591 !!test
22592 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22593 !! wikitext
22594 A <ref>foo</ref> B
22595 C <ref>bar</ref> D
22596 <references />
22597 !! html/parsoid
22598 <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
22599 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>
22600 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22601 <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>
22602 <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>
22603 </ol>
22604 !!end
22605
22606 !!test
22607 Ref: 12. ref-tags act as trailing newline migration barrier
22608 !! wikitext
22609 <!--the newline at the end of this line moves out of the p tag-->a
22610
22611 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22612 <ref />
22613
22614 c
22615 <references />
22616 !! html/parsoid
22617 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22618
22619
22620 <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>
22621 <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>
22622
22623 <p>c</p>
22624 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22625 <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>
22626 <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>
22627 !!end
22628
22629 !!test
22630 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22631 !! wikitext
22632 <ref>foo</ref> A
22633 <ref>bar
22634 </ref> B
22635 <references />
22636 !! html/parsoid
22637 <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
22638 <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>
22639 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22640 <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>
22641 <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
22642 </span></li>
22643 </ol>
22644 !!end
22645
22646 ## Roundtripping fails because of nowiki'ing
22647 !! test
22648 Ref: 14. A nested ref-tag should be emitted as plain text
22649 !! options
22650 parsoid=wt2html
22651 !! wikitext
22652 <ref>foo <ref>bar</ref> baz</ref>
22653
22654 <references />
22655 !! html/parsoid
22656 <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>
22657
22658 <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>
22659 !! end
22660
22661 !!test
22662 Ref: 15. ref-tags with identical names should get identical indexes
22663 !! wikitext
22664 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22665 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22666
22667 <references />
22668 !! html/parsoid
22669 <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>
22670 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>
22671
22672 <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>
22673 </ol>
22674 !!end
22675
22676 ## We don't bother wt2wt-ing non-standard whitespace
22677 !!test
22678 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22679 !!options
22680 parsoid=wt2html
22681 !! wikitext
22682 A <ref >foo</ref >
22683
22684 <references />
22685 !! html/parsoid
22686 <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>
22687 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22688 <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>
22689 !!end
22690
22691 !!test
22692 Ref: 17. Generate valid HTML5 id/about attributes
22693 !!wikitext
22694 <ref name="a b">foo</ref>
22695
22696 <references />
22697 !!html/parsoid
22698 <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>
22699 </p>
22700
22701 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22702 <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>
22703 </ol>
22704 !!end
22705
22706 !!test
22707 Ref: 18. T58916: Extension attributes should be parsed as plain text
22708 !!wikitext
22709 <ref name="{{echo|a}}">foo</ref>
22710
22711 <references />
22712 !!html/parsoid
22713 <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>
22714 </p>
22715
22716 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22717 <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>
22718 </ol>
22719 !!end
22720
22721 !!test
22722 Ref: 19. ref-tags with identical name encodings should get identical indexes
22723 !! wikitext
22724 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22725
22726 <references />
22727 !! html/parsoid
22728 <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>
22729 </p>
22730 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22731 <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>
22732 </ol>
22733 !!end
22734
22735 !!test
22736 Ref: 20. ref-tags with identical names but different content should keep it
22737 !! wikitext
22738 A <ref name="foo">Foo one</ref>
22739 B <ref name="foo">Foo two</ref>
22740 C <ref name="foo" />
22741
22742 <references />
22743 !! html/parsoid
22744 <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>
22745 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>
22746 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>
22747
22748 <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>
22749 </ol>
22750 !!end
22751
22752 !!test
22753 References: 1. references tag without any refs should be handled properly
22754 !! wikitext
22755 <references />
22756 !! html/parsoid
22757 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22758 !!end
22759
22760 !!test
22761 References: 2. references tag with group only outputs references from that group
22762 !! wikitext
22763 A <ref group="a">foo</ref>
22764 B <ref group="b">bar</ref>
22765 C <ref>baz</ref>
22766
22767 <references group="a" />
22768 <references />
22769 <references group="b" />
22770 !! html/parsoid
22771 <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>
22772 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>
22773 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>
22774
22775 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22776 <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>
22777 </ol>
22778 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22779 <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>
22780 </ol>
22781 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22782 <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>
22783 </ol>
22784 !!end
22785
22786 !!test
22787 References: 3. ref list should be cleared after processing references
22788 !! wikitext
22789 A <ref>foo</ref>
22790
22791 <references />
22792
22793 B <ref>bar</ref>
22794
22795 <references />
22796 !! html/parsoid
22797 <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>
22798
22799 <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>
22800 </ol>
22801
22802 <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>
22803
22804 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22805 <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>
22806 </ol>
22807 !!end
22808
22809 !!test
22810 References: 4. only referenced group should be cleared after processing references
22811 !! wikitext
22812 A <ref group="a">afoo</ref>
22813 B <ref>bfoo</ref>
22814
22815 <references group="a" />
22816
22817 C <ref>cfoo</ref>
22818
22819 <references />
22820 !! html/parsoid
22821 <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>
22822 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>
22823
22824 <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>
22825 </ol>
22826
22827 <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>
22828
22829 <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>
22830 </ol>
22831 !!end
22832
22833 ## Don't expect this to rt since we're dropping content
22834 !! test
22835 References: 5. ref tags in references should be processed while ignoring all other content
22836 !! options
22837 parsoid=wt2html,html2html
22838 !! wikitext
22839 A <ref name="a" />
22840 B <ref name="b">bar</ref>
22841
22842 <references>
22843 <ref name="a">foo</ref>
22844 This should just get lost.
22845 </references>
22846 !! html/parsoid
22847 <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>
22848 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>
22849
22850
22851 <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>
22852 </ol>
22853 !! end
22854
22855 !! test
22856 References: 6. <references /> from a transclusion
22857 !! wikitext
22858 <ref>Foo</ref> {{echo|<references />}}
22859 !! html/parsoid
22860 <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>
22861 </ol>
22862 !! end
22863
22864 !! test
22865 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22866 !! wikitext
22867 A <ref>foo bar for a</ref>
22868 B <ref group="X" name="b" />
22869
22870 <references />
22871
22872 <references group="X">
22873 <ref name="b">foo</ref>
22874 </references>
22875 !! html/parsoid
22876 <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>
22877 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>
22878 </p>
22879
22880 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22881 <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>
22882 </ol>
22883
22884 <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"}}'>
22885 <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>
22886 </ol>
22887 !! end
22888
22889 !! test
22890 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22891 !! wikitext
22892 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22893 <references />
22894 !! html/parsoid
22895 <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>
22896 <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>
22897 </ol>
22898 !!end
22899
22900 # This test only works in wt2html now as the <references /> are always generated
22901 # unless selser is active. Once T72722 is fixed, we should add a changes test
22902 # here to ensure that unrelated changes don't add the new <references />
22903 # when selser is active.
22904 !! test
22905 References: 9. Generate missing references list at the end
22906 !! wikitext
22907 A <ref>foo</ref>
22908 B <ref group="inexistent">bar</ref>
22909 !! html/parsoid
22910 <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>
22911 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22912 <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>
22913 </ol>
22914 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22915 <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>
22916 </ol>
22917 !! end
22918
22919 !! test
22920 References: 10. New <references/> shouldn't be added for unrelated edits.
22921 !! options
22922 parsoid={
22923 "modes": ["selser"],
22924 "changes": [["#x", "remove"]],
22925 "selser": "noauto"
22926 }
22927 !! wikitext
22928 Unrelated text<span id="x"> that's going to disappear</span>.
22929 A <ref>foo</ref>
22930 !! wikitext/edited
22931 Unrelated text.
22932 A <ref>foo</ref>
22933 !!end
22934
22935 !! test
22936 Entities in ref name
22937 !! wikitext
22938 <ref name="test &amp; me">hi</ref>
22939 <references />
22940 !! html/parsoid
22941 <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>
22942 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22943 <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>
22944 </ol>
22945 !! end
22946
22947 ## The output here may look funny, but it's what the php parser will do. The
22948 ## unclosed references tag becomes escaped text, and then a new references
22949 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22950 ## nowiki tags, and the auto-generated references tag is only dropped in
22951 ## rtTestMode.
22952 !! test
22953 Generate references for unclosed references tag
22954 !! options
22955 parsoid=wt2html
22956 !! wikitext
22957 a<ref>foo</ref>
22958
22959 <references>
22960 !! html/parsoid
22961 <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>
22962
22963 <p>&lt;references></p>
22964 <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>
22965 !! end
22966
22967 !! test
22968 New reference serializes on its own line
22969 !! options
22970 parsoid=wt2wt,html2wt
22971 !! wikitext
22972 foo
22973 <references />
22974 !! html/parsoid
22975 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22976 !! end
22977
22978 #--------- Test stripping of empty nodes in template content ----------
22979 !!test
22980 Empty LI and TR nodes should be stripped from template content
22981 !!wikitext
22982 {{EmptyLITest}}
22983 {{EmptyTRTest}}
22984 !!html/parsoid
22985 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22986 <li>a</li>
22987 <li>b</li>
22988 </ul>
22989 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22990 <tbody>
22991 <tr>
22992 <td>foo</td>
22993 </tr>
22994 <tr>
22995 <td>bar</td>
22996 </tr>
22997 </tbody>
22998 </table>
22999 !!end
23000
23001 !!test
23002 Empty LI and TR nodes should not be stripped from top-level content
23003 !!wikitext
23004 * a
23005 *
23006 * b
23007 {|
23008 |-
23009 |-
23010 |foo
23011 |}
23012 !!html/parsoid
23013 <ul>
23014 <li> a</li>
23015 <li></li>
23016 <li> b</li>
23017 </ul>
23018 <table>
23019 <tbody>
23020 <tr></tr>
23021 <tr>
23022 <td>foo</td>
23023 </tr>
23024 </tbody>
23025 </table>
23026 !!end
23027
23028 !!test
23029 Empty TR nodes should not be stripped if they have any attributes set
23030 !!wikitext
23031 {{EmptyTRWithHTMLAttrTest}}
23032 !!html/parsoid
23033 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23034 <tr align="center"></tr>
23035 <tr><td>foo</td></tr>
23036 <tr align="center"></tr>
23037 <tr><td>bar</td></tr>
23038 </table>
23039 !!end
23040
23041 #### ----------------------------------------------------------------
23042 #### The following section of tests are primarily to test
23043 #### wikitext escaping capabilities of Parsoid. Given that
23044 #### escaping can be done any number of ways, the wikitext (input)
23045 #### is always adjusted to reflect how Parsoid adds nowiki
23046 #### escape tags.
23047 ####
23048 #### We are marking several tests as parsoid-only since the
23049 #### HTML in the result section is different from what the
23050 #### PHP parser generates for it.
23051 #### ----------------------------------------------------------------
23052
23053
23054 #### --------------- Headings ---------------
23055 #### 0. Unnested
23056 #### 1. Nested inside html <h1>=foo=</h1>
23057 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23058 #### 3. Nested inside html with wikitext split by html tags
23059 #### 4. No escape needed
23060 #### 5. Empty headings <h1></h1>
23061 #### 6. Heading chars in SOL context
23062 #### ----------------------------------------
23063 !! test
23064 Headings: 0. Unnested
23065 !! options
23066 parsoid=html2wt
23067 !! html/parsoid
23068 <p>=foo=</p>
23069
23070 <p> =foo=
23071 <!--cmt-->
23072 =foo=</p>
23073
23074 <p>=foo<i>a</i>=</p>
23075 !! wikitext
23076 <nowiki>=foo=</nowiki>
23077
23078 <nowiki> </nowiki>=foo=
23079 <!--cmt-->
23080 <nowiki>=foo=</nowiki>
23081
23082 =foo''a''<nowiki>=</nowiki>
23083 !!end
23084
23085 # New headings and existing headings are handled differently
23086 !! test
23087 Headings: 1. Nested inside html
23088 !! options
23089 parsoid=html2wt
23090 !! html/parsoid
23091 <h1>=foo=</h1>
23092 <h2>=foo=</h2>
23093 <h3>=foo=</h3>
23094
23095 <h1 data-parsoid=''>=foo=</h1>
23096 <h2 data-parsoid=''>=foo=</h2>
23097 <h3 data-parsoid=''>=foo=</h3>
23098 <h4 data-parsoid=''>=foo=</h4>
23099 <h5 data-parsoid=''>=foo=</h5>
23100 <h6 data-parsoid=''>=foo=</h6>
23101 !! wikitext
23102 = =foo= =
23103
23104 == =foo= ==
23105
23106 === =foo= ===
23107
23108 =<nowiki>=foo=</nowiki>=
23109 ==<nowiki>=foo=</nowiki>==
23110 ===<nowiki>=foo=</nowiki>===
23111 ====<nowiki>=foo=</nowiki>====
23112 =====<nowiki>=foo=</nowiki>=====
23113 ======<nowiki>=foo=</nowiki>======
23114
23115 !!end
23116
23117 !! test
23118 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23119 !! options
23120 parsoid=html2wt
23121 !! html/parsoid
23122 <h1>foo</h1>*bar
23123 <h1>foo</h1>=bar
23124 <h1>foo</h1>=bar=
23125 !! wikitext
23126 = foo =
23127 <nowiki>*</nowiki>bar
23128
23129 = foo =
23130 =bar
23131
23132 = foo =
23133 <nowiki>=bar=</nowiki>
23134 !!end
23135
23136 !! test
23137 Headings: 3. Nested inside html with wikitext split by html tags
23138 !! options
23139 parsoid=html2wt
23140 !! html/parsoid
23141 <h1>=<b>bold</b>foo=</h1>
23142 !! wikitext
23143 = ='''bold'''foo= =
23144 !!end
23145
23146 !! test
23147 Headings: 4a. No escaping needed (testing just h1 and h2)
23148 !! options
23149 parsoid=html2wt
23150 !! html/parsoid
23151 <h1>=foo</h1>
23152 <h1>foo=</h1>
23153 <h1> =foo= </h1>
23154 <h1>=foo= bar</h1>
23155 <h2>=foo</h2>
23156 <h2>foo=</h2>
23157 <h1>=</h1>
23158 <h1><i>=</i>foo=</h1>
23159 !! wikitext
23160 = =foo =
23161
23162 = foo= =
23163
23164 = =foo= =
23165
23166 = =foo= bar =
23167
23168 == =foo ==
23169
23170 == foo= ==
23171
23172 = = =
23173
23174 = ''=''foo= =
23175 !!end
23176
23177 !! test
23178 Headings: 4b. No escaping needed (inside p-tags)
23179 !! options
23180 parsoid=html2wt
23181 !! html/parsoid
23182 <p>===
23183 =foo= x
23184 =foo= <s></s>
23185 </p>
23186 !! wikitext
23187 ===
23188 =foo= x
23189 =foo= <s></s>
23190 !!end
23191
23192 !! test
23193 Headings: 5. Empty headings
23194 !! options
23195 parsoid=html2wt
23196 !! html/parsoid
23197 <h1 data-parsoid='{}'></h1>
23198
23199 <h2 data-parsoid='{}'></h2>
23200
23201 <h3 data-parsoid='{}'></h3>
23202
23203 <h4 data-parsoid='{}'></h4>
23204
23205 <h5 data-parsoid='{}'></h5>
23206
23207 <h6 data-parsoid='{}'></h6>
23208 !! wikitext
23209 =<nowiki/>=
23210
23211 ==<nowiki/>==
23212
23213 ===<nowiki/>===
23214
23215 ====<nowiki/>====
23216
23217 =====<nowiki/>=====
23218
23219 ======<nowiki/>======
23220 !!end
23221
23222 !! test
23223 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23224 !! options
23225 parsoid=html2wt
23226 !! html/parsoid
23227 <p>=a=</p>
23228
23229 <p>=a=</p>
23230
23231 <p>=a=</p>
23232 !! wikitext
23233 <nowiki>=a=</nowiki>
23234
23235 <nowiki>=a=</nowiki>
23236
23237 <nowiki>=a=</nowiki>
23238 !!end
23239
23240 !! test
23241 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23242 !! options
23243 parsoid=html2wt
23244 !! html/parsoid
23245 <p>=a=
23246 b</p>
23247
23248 <p>=a=
23249 b</p>
23250
23251 <p>=a=
23252 b</p>
23253 !! wikitext
23254 <nowiki>=a=</nowiki>
23255 b
23256
23257 <nowiki>=a=</nowiki>
23258 b
23259
23260 <nowiki>=a=</nowiki>
23261 b
23262 !!end
23263
23264 !! test
23265 Headings: 6c. Heading chars in SOL context (leading newline break)
23266 !! options
23267 parsoid=html2wt
23268 !! html/parsoid
23269 <p>a
23270 =b=</p>
23271 !! wikitext
23272 a
23273 <nowiki>=b=</nowiki>
23274 !!end
23275
23276 !! test
23277 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23278 !! options
23279 parsoid=html2wt
23280 !! html/parsoid
23281 <!--c0--><p>=a=</p>
23282
23283 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23284 !! wikitext
23285 <!--c0--><nowiki>=a=</nowiki>
23286
23287 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23288 !!end
23289
23290 !! test
23291 Headings: 6d. Heading chars in SOL context (No escaping needed)
23292 !! options
23293 parsoid=html2wt
23294 !! html/parsoid
23295 =a=<div>b</div>
23296 !! wikitext
23297 =a=<div>b</div>
23298 !!end
23299
23300 !! test
23301 Headings: 7. Insert a newline between new content and headings
23302 !! options
23303 parsoid=html2wt
23304 !! html/parsoid
23305 <h2>NEW</h2>
23306 <p>new</p>
23307 <h2 data-parsoid='{}'>A</h2>
23308 <p data-parsoid='{}'>a</p>
23309 !! wikitext
23310 == NEW ==
23311 new
23312
23313 ==A==
23314 a
23315
23316 !! end
23317
23318 #### --------------- Lists ---------------
23319 #### 0. Outside nests (*foo, etc.)
23320 #### 1. Nested inside html <ul><li>*foo</li></ul>
23321 #### 2. Inside definition lists
23322 #### 3. Only bullets at start should be escaped
23323 #### 4. No escapes needed
23324 #### 5. No unnecessary escapes
23325 #### 6. Escape bullets in SOL position
23326 #### 7. Escape bullets in a multi-line context
23327 #### ----------------------------------------
23328
23329 !! test
23330 Lists: 0. Outside nests
23331 !! options
23332 parsoid=html2wt
23333 !! html/parsoid
23334 <p>*foo</p>
23335
23336 <p>#foo</p>
23337
23338 <p>;Foo:bar</p>
23339 !! wikitext
23340 <nowiki>*</nowiki>foo
23341
23342 <nowiki>#</nowiki>foo
23343
23344 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23345 !!end
23346
23347 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23348 ## to test wikitext escaping, and insignificant whitespace diffs
23349 ## cause PHP parser tests to barf
23350 !! test
23351 Lists: 1. Nested inside html (No unnecessary escapes)
23352 !! options
23353 parsoid=html2wt
23354 !! html/parsoid
23355 <ul>
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 </ul>
23365
23366 <ol>
23367 <li>*foo</li>
23368 <li>#foo</li>
23369 <li>:foo</li>
23370 <li>;foo</li>
23371 <li data-parsoid='{}'>*foo</li>
23372 <li data-parsoid='{}'>#foo</li>
23373 <li data-parsoid='{}'>:foo</li>
23374 <li data-parsoid='{}'>;foo</li>
23375 </ol>
23376 !! wikitext
23377 * *foo
23378 * #foo
23379 * :foo
23380 * ;foo
23381 *<nowiki>*foo</nowiki>
23382 *<nowiki>#foo</nowiki>
23383 *<nowiki>:foo</nowiki>
23384 *<nowiki>;foo</nowiki>
23385
23386 # *foo
23387 # #foo
23388 # :foo
23389 # ;foo
23390 #<nowiki>*foo</nowiki>
23391 #<nowiki>#foo</nowiki>
23392 #<nowiki>:foo</nowiki>
23393 #<nowiki>;foo</nowiki>
23394 !!end
23395
23396 !! test
23397 Lists: 2. Inside definition lists
23398 !! options
23399 parsoid=html2wt
23400 !! html/parsoid
23401 <dl><dt>;foo</dt></dl>
23402 <dl><dt>:foo</dt></dl>
23403 <dl><dt>:foo</dt>
23404 <dd>bar</dd></dl>
23405 <dl><dd>:foo</dd></dl>
23406 !! wikitext
23407 ; ;foo
23408
23409 ; <nowiki>:foo</nowiki>
23410
23411 ; <nowiki>:foo</nowiki>
23412 : bar
23413
23414 : :foo
23415 !!end
23416
23417 !! test
23418 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23419 !! options
23420 parsoid=html2wt
23421 !! html/parsoid
23422 <ul>
23423 <li>*foo*bar</li>
23424 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23425 </ul>
23426 !! wikitext
23427 * *foo*bar
23428 *<nowiki>*foo</nowiki>''it''*bar
23429 !!end
23430
23431 !! test
23432 Lists: 4. No escapes needed
23433 !! options
23434 parsoid=html2wt
23435 !! html/parsoid
23436 <ul>
23437 <li>foo*bar
23438 </li>
23439 </ul>
23440 <ul>
23441 <li><i>foo</i>*bar
23442 </li>
23443 </ul>
23444 <ul>
23445 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23446 </li>
23447 </ul>
23448 <ul>
23449 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23450 </li>
23451 </ul>
23452 !! wikitext
23453 *foo*bar
23454
23455 *''foo''*bar
23456
23457 *[[Foo]]: bar
23458
23459 *[[Foo]]*bar
23460 !!end
23461
23462 !! test
23463 Lists: 5. No unnecessary escapes
23464 !! options
23465 parsoid=html2wt
23466 !! html/parsoid
23467 <ul><li> bar <span>[[foo]]</span></li></ul>
23468 <ul><li> =bar <span>[[foo]]</span></li></ul>
23469 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23470 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23471 <ul><li> =bar <span>foo]]</span>=</li></ul>
23472 <ul><li> <s></s>: a</li></ul>
23473 <ul><li> <i>* foo</i></li></ul>
23474
23475 !! wikitext
23476 * bar <span><nowiki>[[foo]]</nowiki></span>
23477
23478 * =bar <span><nowiki>[[foo]]</nowiki></span>
23479
23480 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23481
23482 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23483
23484 * =bar <span>foo]]</span>=
23485
23486 * <s></s>: a
23487
23488 * ''* foo''
23489 !!end
23490
23491 !! test
23492 Lists: 6. Escape bullets in SOL position
23493 !! options
23494 parsoid=html2wt
23495 !! html/parsoid
23496 <p><!--cmt-->*foo</p>
23497 !! wikitext
23498 <!--cmt--><nowiki>*</nowiki>foo
23499 !!end
23500
23501 !! test
23502 Lists: 7. Escape bullets in a multi-line context
23503 !! options
23504 parsoid=html2wt
23505 !! html/parsoid
23506 <p>a
23507 *b
23508 </p>
23509 !! wikitext
23510 a
23511 <nowiki>*</nowiki>b
23512 !!end
23513
23514 !! test
23515 Lists: 8. Escape colons only if not present in tags
23516 !! options
23517 parsoid=html2wt
23518 !! html/parsoid
23519 <dl><dt>a:b<i>c:d</i></dt></dl>
23520 !! wikitext
23521 ; <nowiki>a:b</nowiki>''c:d''
23522 !! end
23523
23524 #### --------------- HRs ---------------
23525 #### 1. Single line
23526 #### -----------------------------------
23527
23528 !! test
23529 HRs: 1. Single line
23530 !! options
23531 parsoid=html2wt
23532 !! html/parsoid
23533 <hr />----
23534 <hr />=foo=
23535 <hr />*foo
23536 !! wikitext
23537 ----<nowiki>----</nowiki>
23538 ----=foo=
23539 ----*foo
23540 !! end
23541
23542 #### --------------- Tables ---------------
23543 #### 1a. Simple example
23544 #### 1b. No escaping needed (!foo)
23545 #### 1c. No escaping needed (|foo)
23546 #### 1d. No escaping needed (|}foo)
23547 ####
23548 #### 2a. Nested in td (<td>foo|bar</td>)
23549 #### 2b. Nested in td (<td>foo||bar</td>)
23550 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23551 ####
23552 #### 3a. Nested in th (<th>foo!bar</th>)
23553 #### 3b. Nested in th (<th>foo!!bar</th>)
23554 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23555 ####
23556 #### 4a. Escape -
23557 #### 4b. Escape +
23558 #### 4c. No escaping needed
23559 #### --------------------------------------
23560
23561 !! test
23562 Tables: 1a. Simple example
23563 !! options
23564 parsoid=html2wt
23565 !! html/parsoid
23566 <p>{|
23567 |}
23568 </p>
23569 !! wikitext
23570 <nowiki>{|</nowiki>
23571 |}
23572 !! end
23573
23574 !! test
23575 Tables: 1b. 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: 1c. 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: 1d. No escaping needed
23598 !! options
23599 parsoid=html2wt
23600 !! html/parsoid
23601 <p>|}foo
23602 </p>
23603 !! wikitext
23604 |}foo
23605 !! end
23606
23607 !! test
23608 Tables: 2a. Nested in td
23609 !! options
23610 parsoid=html2wt
23611 !! html/parsoid
23612 <table><tbody><tr>
23613 <td>foo|bar</td></tr>
23614 <tr><td>x<div>a|b</div></td>
23615 </tbody></table>
23616 !! wikitext
23617 {|
23618 |<nowiki>foo|bar</nowiki>
23619 |-
23620 |x<div><nowiki>a|b</nowiki></div>
23621 |}
23622 !! html/php+tidy
23623 <table>
23624 <tr>
23625 <td>foo|bar</td>
23626 </tr>
23627 <tr>
23628 <td>x
23629 <div>a|b</div>
23630 </td>
23631 </tr>
23632 </table>
23633 !! end
23634
23635 !! test
23636 Tables: 2b. Nested in td
23637 !! options
23638 parsoid=html2wt
23639 !! html/parsoid
23640 <table><tbody><tr>
23641 <td>foo||bar</td>
23642 <td>a<i>b||c</i></td>
23643 <td>a<i><div>b||c</div></i></td>
23644 </tr></tbody></table>
23645 !! wikitext
23646 {|
23647 |<nowiki>foo||bar</nowiki>
23648 |a''<nowiki>b||c</nowiki>''
23649 |a''<div><nowiki>b||c</nowiki></div>''
23650 |}
23651 !! html/php
23652 <table>
23653 <tr>
23654 <td>foo||bar
23655 </td>
23656 <td>a<i>b||c</i>
23657 </td>
23658 <td>a<i><div>b||c</div></i>
23659 </td></tr></table>
23660
23661 !! end
23662
23663 !! test
23664 Tables: 2c. Nested in td -- no escaping needed
23665 !! options
23666 parsoid=html2wt
23667 !! html/*
23668 <table>
23669 <tr>
23670 <td>foo!!bar
23671 </td></tr></table>
23672
23673 !! wikitext
23674 {|
23675 |foo!!bar
23676 |}
23677 !! end
23678
23679 !! test
23680 Tables: 3a. Nested in th
23681 !! options
23682 parsoid=html2wt
23683 !! html/*
23684 <table>
23685 <tr>
23686 <th>foo!bar
23687 </th></tr></table>
23688
23689 !! wikitext
23690 {|
23691 !foo!bar
23692 |}
23693 !! end
23694
23695 !! test
23696 Tables: 3b. Nested in th
23697 !! options
23698 parsoid=html2wt
23699 !! html/parsoid
23700 <table><tbody>
23701 <tr><th>foo!!bar</th>
23702 <th><i>foo|bar</i></th>
23703 <th><i>foo!!bar</i></th>
23704 <th><i><span>foo!!bar</span></i></th>
23705 </tr></tbody></table>
23706 !! wikitext
23707 {|
23708 !<nowiki>foo!!bar</nowiki>
23709 !''<nowiki>foo|bar</nowiki>''
23710 !''<nowiki>foo!!bar</nowiki>''
23711 !''<span><nowiki>foo!!bar</nowiki></span>''
23712 |}
23713 !! html/php
23714 <table>
23715 <tr>
23716 <th>foo!!bar
23717 </th>
23718 <th><i>foo|bar</i>
23719 </th>
23720 <th><i>foo!!bar</i>
23721 </th>
23722 <th><i><span>foo!!bar</span></i>
23723 </th></tr></table>
23724
23725 !! end
23726
23727 !! test
23728 Tables: 3c. Nested in th
23729 !! options
23730 parsoid=html2wt
23731 !! html/parsoid
23732 <table><tbody>
23733 <tr><th>foo||bar</th>
23734 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23735 </tr></tbody></table>
23736 !! wikitext
23737 {|
23738 !<nowiki>foo||bar</nowiki>
23739 !<nowiki>foo||bar</nowiki>
23740 |}
23741 !! html/php
23742 <table>
23743 <tr>
23744 <th>foo||bar
23745 </th>
23746 <th>foo||bar
23747 </th></tr></table>
23748
23749 !! end
23750
23751 !! test
23752 Tables: 4a. Escape -
23753 !! options
23754 parsoid=html2wt
23755 !! html/*
23756 <table>
23757 <tr>
23758 <th>-bar
23759 </th></tr>
23760 <tr>
23761 <td>-bar
23762 </td></tr></table>
23763
23764 !! wikitext
23765 {|
23766 !-bar
23767 |-
23768 |<nowiki>-bar</nowiki>
23769 |}
23770 !! end
23771
23772 !! test
23773 Tables: 4b. Escape +
23774 !! options
23775 parsoid=html2wt
23776 !! html/*
23777 <table>
23778 <tr>
23779 <th>+bar
23780 </th></tr>
23781 <tr>
23782 <td>+bar
23783 </td></tr></table>
23784
23785 !! wikitext
23786 {|
23787 !+bar
23788 |-
23789 |<nowiki>+bar</nowiki>
23790 |}
23791 !! end
23792
23793 !! test
23794 Tables: 4c. No escaping needed
23795 !! options
23796 parsoid=html2wt
23797 !! html/parsoid
23798 <table><tbody>
23799 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23800 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23801 <tr><td>foo
23802 <p>bar|baz
23803 +bar
23804 -bar</p></td></tr>
23805 <tr><td>x
23806 <div>a|b</div></td>
23807 </tbody></table>
23808 !! wikitext
23809 {|
23810 |foo-bar
23811 |foo+bar
23812 |-
23813 |''foo''-bar
23814 |''foo''+bar
23815 |-
23816 |foo
23817 bar|baz
23818 +bar
23819 -bar
23820 |-
23821 |x
23822 <div>a|b</div>
23823 |}
23824 !! html/php
23825 <table>
23826 <tr>
23827 <td>foo-bar
23828 </td>
23829 <td>foo+bar
23830 </td></tr>
23831 <tr>
23832 <td><i>foo</i>-bar
23833 </td>
23834 <td><i>foo</i>+bar
23835 </td></tr>
23836 <tr>
23837 <td>foo
23838 <p>bar|baz
23839 +bar
23840 -bar
23841 </p>
23842 </td></tr>
23843 <tr>
23844 <td>x
23845 <div>a|b</div>
23846 </td></tr></table>
23847
23848 !! end
23849
23850 !! test
23851 Tables: 4d. No escaping needed
23852 !! options
23853 parsoid=html2wt
23854 !! html/parsoid
23855 <table>
23856 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23857 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23858 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23859 </tbody></table>
23860 !! wikitext
23861 {|
23862 |[[Foo]]-bar
23863 ||+1
23864 ||-2
23865 |}
23866 !! html/php
23867 <table>
23868 <tr>
23869 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23870 </td>
23871 <td>+1
23872 </td>
23873 <td>-2
23874 </td></tr></table>
23875
23876 !! end
23877
23878 !! test
23879 T97430: Don't emit empty nowiki pairs around marker meta tags
23880 !! options
23881 parsoid=html2wt
23882 !! html/parsoid
23883 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23884 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23885 !! wikitext
23886 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23887 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23888 !! end
23889
23890 !! test
23891 Unclosed xmlish element in table line shouldn't eat end delimiters
23892 !! options
23893 parsoid=html2wt
23894 !! html/parsoid
23895 <table>
23896 <tbody><tr><td> &lt;foo</td>
23897 <td> bar></td></tr>
23898 </tbody></table>
23899 !! wikitext
23900 {|
23901 | <foo
23902 | bar>
23903 |}
23904 !! html/php
23905 <table>
23906 <tr>
23907 <td> &lt;foo
23908 </td>
23909 <td> bar&gt;
23910 </td></tr></table>
23911
23912 !! end
23913
23914 #### --------------- Links ----------------
23915 #### 1. Quote marks in link text
23916 #### 2. Wikilinks: Escapes needed
23917 #### 3. Wikilinks: No escapes needed
23918 #### 4. Extlinks: Escapes needed
23919 #### 5. Extlinks: No escapes needed
23920 #### --------------------------------------
23921 !! test
23922 Links 1. WikiLinks: No escapes needed
23923 !! options
23924 parsoid=html2wt
23925 !! html/parsoid
23926 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23927 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23928 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23929 !! wikitext
23930 [[Foo|Foo''boo'']]
23931 [[Foo|[Foobar]]]
23932 [[Foo|x [Foobar] x]]
23933 !! html/php
23934 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23935 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23936 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23937 </p>
23938 !! end
23939
23940 !! test
23941 Links 2. WikiLinks: Escapes needed
23942 !! options
23943 parsoid=html2wt
23944 !! html/parsoid
23945 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23946 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23947 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23948 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23949 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23950 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23951 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23952 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23953 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23954 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23955 !! wikitext
23956 [[Foo|<nowiki>Foobar]</nowiki>]]
23957 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23958 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23959 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23960 [[Foo|<nowiki>|Bar</nowiki>]]
23961 [[Foo|<nowiki>]]bar</nowiki>]]
23962 [[Foo|<nowiki>[[bar</nowiki>]]
23963 [[Foo|<nowiki>x [[ y</nowiki>]]
23964 [[Foo|<nowiki>x ]] y</nowiki>]]
23965 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23966 !! html/php
23967 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23968 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23969 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23970 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23971 <a href="/wiki/Foo" title="Foo">|Bar</a>
23972 <a href="/wiki/Foo" title="Foo">]]bar</a>
23973 <a href="/wiki/Foo" title="Foo">[[bar</a>
23974 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23975 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23976 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23977 </p>
23978 !! end
23979
23980 !! test
23981 Links 3. WikiLinks: No escapes needed
23982 !! options
23983 parsoid=html2wt
23984 !! html/parsoid
23985 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23986 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23987 !! wikitext
23988 [[Foo|[Foobar]]
23989 [[Foo|foo|bar]]
23990 !! html/php
23991 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23992 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23993 </p>
23994 !! end
23995
23996 !! test
23997 Links 4. ExtLinks: Escapes needed
23998 !! options
23999 parsoid=html2wt
24000 !! html/parsoid
24001 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24002 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24003 <p>[http://google.com]</p>
24004 <p>[http://google.com google]</p>
24005 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24006 <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>
24007 !! wikitext
24008 [http://google.com <nowiki>[google]</nowiki>]
24009 [http://google.com <nowiki>google]</nowiki>]
24010
24011 <nowiki>[http://google.com]</nowiki>
24012
24013 <nowiki>[http://google.com google]</nowiki>
24014
24015 [http://google.com<nowiki>]</nowiki>
24016
24017 [{{echo|http://google.com}}<nowiki>]</nowiki>
24018 !! html/php
24019 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24020 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24021 </p><p>[http://google.com]
24022 </p><p>[http://google.com google]
24023 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24024 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24025 </p>
24026 !! end
24027
24028 !! test
24029 Links 5. ExtLinks: No escapes needed
24030 !! options
24031 parsoid=html2wt
24032 !! html/parsoid
24033 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24034 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24035 !! wikitext
24036 [http://google.com [google]
24037
24038 [[http://google.com]]
24039 !! html/php
24040 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24041 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24042 </p>
24043 !! end
24044
24045 !! test
24046 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24047 !! options
24048 parsoid=html2wt
24049 !! html/parsoid
24050 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24051 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24052 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24053 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24054 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24055 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24056 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24057 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24058 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24059 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24060 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24061 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24062 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24063 </p>
24064 !! wikitext
24065 x<nowiki/>http://example.com<nowiki/>y
24066 http://example.com<nowiki/>?x
24067 http://example.com<nowiki/>&x
24068 http://example.com<nowiki/>'x
24069 http://example.com<nowiki/>,x
24070 http://example.com<nowiki/>.x
24071 http://example.com<nowiki/>;x
24072 http://example.com<nowiki/>:x
24073 http://example.com<nowiki/>;x
24074 http://example.com<nowiki/>!x
24075 http://example.com<nowiki/>=x
24076 http://example.com<nowiki/>(x)
24077 http://example.com(x<nowiki/>)
24078 !! end
24079
24080 !! test
24081 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24082 !! options
24083 parsoid=html2wt
24084 !! html/parsoid
24085 <p>x
24086 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24087 y
24088 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24089 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24090 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24091 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24092 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24093 </p>
24094 !! wikitext
24095 x
24096 http://example.com
24097 y
24098 "http://example.com"
24099 (http://example.com)
24100 (http://example.com) foo
24101 http://example.com,
24102 http://example.com, foo
24103 !! html/php
24104 <p>x
24105 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24106 y
24107 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24108 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24109 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24110 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24111 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24112 </p>
24113 !! end
24114
24115 !! test
24116 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24117 !! options
24118 parsoid=html2wt
24119 !! html/parsoid
24120 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24121 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24122 !! wikitext
24123 http://example.com.,;:!?\
24124 -http://example.com:
24125 !! html/php
24126 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24127 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24128 </p>
24129 !! end
24130
24131 !! test
24132 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24133 !! options
24134 parsoid=html2wt
24135 !! html/parsoid
24136 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24137 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24138 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24139 !! wikitext
24140 RFC 123<nowiki/>4
24141 RFC 123<nowiki/>y
24142 X<nowiki/>RFC 123<nowiki/>y
24143 !! end
24144
24145 !! test
24146 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24147 !! options
24148 parsoid=html2wt
24149 !! html/parsoid
24150 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24151 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24152 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24153 </p>
24154 !! wikitext
24155 RFC 123?foo
24156 RFC 123&foo
24157 -RFC 123-
24158 !! html/php
24159 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24160 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24161 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24162 </p>
24163 !! end
24164
24165 !! test
24166 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24167 !! options
24168 parsoid=html2wt
24169 !! html/parsoid
24170 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24171 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24172 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24173 !! wikitext
24174 PMID 123<nowiki/>4
24175 PMID 123<nowiki/>y
24176 X<nowiki/>PMID 123<nowiki/>y
24177 !! end
24178
24179 !! test
24180 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24181 !! options
24182 parsoid=html2wt
24183 !! html/parsoid
24184 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24185 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24186 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24187 </p>
24188 !! wikitext
24189 PMID 123?foo
24190 PMID 123&foo
24191 -PMID 123-
24192 !! html/php
24193 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24194 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24195 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24196 </p>
24197 !! end
24198
24199 !! test
24200 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24201 !! options
24202 parsoid=html2wt
24203 !! html/parsoid
24204 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24205 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24206 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24207 </p>
24208 !! wikitext
24209 ISBN 1234567890<nowiki/>1
24210 ISBN 1234567890<nowiki/>x
24211 a<nowiki/>ISBN 1234567890<nowiki/>b
24212 !! end
24213
24214 !! test
24215 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24216 !! options
24217 parsoid=html2wt
24218 !! html/parsoid
24219 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24220 !! wikitext
24221 -ISBN 1234567890's
24222 !! html/php
24223 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24224 </p>
24225 !! end
24226
24227 !! test
24228 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24229 !! options
24230 parsoid=html2wt
24231 !! html/*
24232 <p>this is not a link: http://example.com
24233 </p>
24234 !! wikitext
24235 this is not a link: <nowiki>http://example.com</nowiki>
24236 !! end
24237
24238 !! test
24239 Links 15. Link trails can't become link prefixes.
24240 !! options
24241 language=is
24242 parsoid=html2wt
24243 !! html/parsoid
24244 <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>
24245 !! wikitext
24246 [[Söfnuður]]-[[00]]
24247 !! html/php
24248 <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>
24249 </p>
24250 !! end
24251
24252 #### --------------- Quotes ---------------
24253 #### 1. Quotes inside <b> and <i>
24254 #### 2. Link fragments separated by <i> and <b> tags
24255 #### 3. Link fragments inside <i> and <b>
24256 #### 4. No escaping needed
24257 #### --------------------------------------
24258 !! test
24259 1a. Quotes inside <b> and <i>
24260 !! options
24261 parsoid=html2wt
24262 !! html/*
24263 <p><i>'foo'</i>
24264 <i>''foo''</i>
24265 <i>'''foo'''</i>
24266 <i>foo</i>'s
24267 <b>'foo'</b>
24268 <b>''foo''</b>
24269 <b>'''foo'''</b>
24270 <b>foo'<i>bar'</i>baz</b>
24271 <b>foo</b>'s
24272 '<i>foo</i>
24273 <i>foo</i>'
24274 <i>foo'</i>'
24275 '<i>foo</i>'
24276 '<b>foo</b>
24277 <b>foo</b>'
24278 '<b>foo</b>'
24279 <i>fools'<span> errand</span></i>
24280 <i><span>fool</span>'s errand</i>
24281 '<i>foo</i> bar '<i>baz</i>
24282 a|!*#-:;+-~[]{}b'<i>x</i>
24283 </p>
24284 !! wikitext
24285 ''<nowiki/>'foo'''
24286 ''<nowiki>''foo''</nowiki>''
24287 ''<nowiki>'''foo'''</nowiki>''
24288 ''foo''<nowiki/>'s
24289 '''<nowiki/>'foo''''
24290 '''<nowiki>''foo''</nowiki>'''
24291 '''<nowiki>'''foo'''</nowiki>'''
24292 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24293 '''foo'''<nowiki/>'s
24294 '''foo''
24295 ''foo''<nowiki/>'
24296 ''foo'''<nowiki/>'
24297 '''foo''<nowiki/>'
24298 ''''foo'''
24299 '''foo'''<nowiki/>'
24300 ''''foo'''<nowiki/>'
24301 ''fools'<span> errand</span>''
24302 ''<span>fool</span>'s errand''
24303 '<nowiki/>''foo'' bar '''baz''
24304 a|!*#-:;+-~[]{}b'''x''
24305 !! end
24306
24307 !! test
24308 1b. Quotes inside <b> and <i> with other tags on same line
24309 !! options
24310 parsoid=html2wt
24311 !! html/parsoid
24312 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24313 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24314 <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>
24315 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24316 '<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>
24317 '<i>foo</i> <div title="name">test</div>
24318 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24319 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24320 <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>
24321 </ol>
24322 !! wikitext
24323 '''a'' foo ''[[bar]]''
24324 ''a''' foo ''[[bar]]''
24325 ''a''' foo '''{{echo|[[bar]]}}'''
24326 [[foo]] x'''[[bar]]''
24327 '''foo'' <ref>test</ref>
24328 '''foo'' <div title="name">test</div>
24329 '''foo'' and <br> bar
24330 <references />
24331 !! end
24332
24333 !! test
24334 2. Link fragments separated by <i> and <b> tags
24335 !! options
24336 parsoid=html2wt
24337 !! html/parsoid
24338 <p>[[<i>foo</i>hello]]</p>
24339 <p>[[<b>foo</b>hello]]</p>
24340 !! wikitext
24341 [[''foo''<nowiki>hello]]</nowiki>
24342
24343 [['''foo'''<nowiki>hello]]</nowiki>
24344 !! end
24345
24346 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24347 # this is one of the shortcomings of this format
24348 !! test
24349 3. Link fragments inside <i> and <b>
24350 !! options
24351 parsoid=html2wt
24352 !! html/parsoid
24353 <p><i>[[foo</i>]]</p>
24354 <p><b>[[foo</b>]]</p>
24355 !! wikitext
24356 ''[[foo''<nowiki>]]</nowiki>
24357
24358 '''[[foo'''<nowiki>]]</nowiki>
24359 !! end
24360
24361 !! test
24362 4. No escaping needed
24363 !! options
24364 options=html2wt
24365 !! html/parsoid
24366 <p>'<span><i>bar</i></span>'
24367 '<span><b>bar</b></span>'
24368 'a:b'foo
24369 </p>
24370 !! wikitext
24371 '<span>''bar''</span>'
24372 '<span>'''bar'''</span>'
24373 'a:b'foo
24374 !! end
24375
24376 #### ----------- Paragraphs ---------------
24377 #### 1. No unnecessary escapes
24378 #### --------------------------------------
24379
24380 !! test
24381 1. No unnecessary escapes
24382 !! options
24383 parsoid=html2wt
24384 !! html/parsoid
24385 <p>bar <span>[[foo]]</span>
24386 </p><p>=bar <span>[[foo]]</span>
24387 </p><p>[[bar <span>[[foo]]</span>
24388 </p><p>]]bar <span>[[foo]]</span>
24389 </p><p>=bar <span>foo]]</span>=
24390 </p>
24391 !! wikitext
24392 bar <span><nowiki>[[foo]]</nowiki></span>
24393
24394 =bar <span><nowiki>[[foo]]</nowiki></span>
24395
24396 [[bar <span><nowiki>[[foo]]</nowiki></span>
24397
24398 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24399
24400 =bar <span>foo]]</span><nowiki>=</nowiki>
24401 !!end
24402
24403 #### ----------------------- PRE --------------------------
24404 #### 1. Leading whitespace in SOL context should be escaped
24405 #### ------------------------------------------------------
24406 !! test
24407 1. Leading whitespace in SOL context should be escaped
24408 !! options
24409 parsoid=html2wt
24410 !! html/parsoid
24411 <p> a</p>
24412
24413 <p> a</p>
24414
24415 <p> a(tab)</p>
24416
24417 <p> a
24418 <!--cmt-->
24419 a</p>
24420
24421 <p>a
24422 b</p>
24423
24424 <p>a
24425 b</p>
24426
24427 <p>a
24428 b</p>
24429 !! wikitext
24430 <nowiki> </nowiki>a
24431
24432 <nowiki> </nowiki> a
24433
24434 a(tab)
24435
24436 <nowiki> </nowiki> a
24437 <!--cmt-->
24438 <nowiki> </nowiki>a
24439
24440 a
24441 <nowiki> </nowiki>b
24442
24443 a
24444 b
24445
24446 a
24447 b
24448 !! html/php
24449 <p> a
24450 </p><p> a
24451 </p><p> a(tab)
24452 </p><p> a
24453 a
24454 </p><p>a
24455 b
24456 </p><p>a
24457 b
24458 </p><p>a
24459 b
24460 </p>
24461 !! end
24462
24463 !! test
24464 2. Leading whitespace in non-indent-pre contexts should not be escaped
24465 !! options
24466 parsoid=html2wt
24467 !! html/parsoid
24468 <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>
24469 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24470 <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>
24471 b</span></li>
24472 </ol>
24473 !! wikitext
24474 foo <ref>''a''
24475 b</ref>
24476 <references />
24477 !! end
24478
24479 !! test
24480 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24481 !! options
24482 parsoid=html2wt
24483 !! html/parsoid
24484 <blockquote>
24485 <p>
24486 a
24487 <span>b</span>
24488 c</p>
24489 </blockquote>
24490 !! wikitext
24491 <blockquote>
24492 a
24493 <span>b</span>
24494 c
24495 </blockquote>
24496 !! end
24497
24498 !! test
24499 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24500 !! options
24501 options=html2wt
24502 !! html/parsoid
24503 <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>
24504 !! wikitext
24505 [[File:Foobar.jpg|thumb|caption]]
24506 !! end
24507
24508 !! test
24509 5. Nowiki escaping should account for indent-pres
24510 !! options
24511 parsoid=html2wt
24512 !! html/parsoid
24513 <pre>==foo==</pre>
24514 !! wikitext
24515 ==foo==
24516 !! end
24517
24518 !!test
24519 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24520 !! options
24521 parsoid=html2wt
24522 !! html/parsoid
24523 <pre>
24524 * foo
24525 * bar
24526 </pre>
24527 !! wikitext
24528 * foo
24529 * bar
24530 !! end
24531
24532 #### --------------- Behavior Switches --------------------
24533
24534 !! test
24535 1. Valid behavior switches should be escaped
24536 !! options
24537 parsoid=html2wt
24538 !! html/parsoid
24539 __TOC__
24540 <i>__TOC__</i>
24541 !! wikitext
24542 <nowiki>__TOC__</nowiki>
24543 ''<nowiki>__TOC__</nowiki>''
24544 !! end
24545
24546 !! test
24547 2. Invalid behavior switches should not be escaped
24548 !! options
24549 parsoid=html2wt
24550 !! html/parsoid
24551 __TOO__
24552 __|__
24553 !! wikitext
24554 __TOO__
24555 __|__
24556 !! end
24557
24558 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24559 !! test
24560 Behavior switches should be SOL-transparent
24561 !! options
24562 parsoid=html2wt
24563 !! html/parsoid
24564 <meta property="mw:PageProp/toc" />
24565
24566 <!-- this one's bogus -->
24567 <pre>__TOO__</pre>
24568
24569 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24570
24571 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24572 !! wikitext
24573 __TOC__
24574
24575 <!-- this one's bogus -->
24576 __TOO__
24577
24578 __TOC__ foo
24579
24580 __TOC__
24581 bar
24582 !! end
24583
24584 #### --------------- HTML tags ---------------
24585 #### 1. a tags
24586 #### 2. other tags
24587 #### 3. multi-line html tag
24588 #### 4. extension tags
24589 #### -----------------------------------------
24590 !! test
24591 1. a tags
24592 !! options
24593 parsoid=html2wt
24594 !! html/parsoid
24595 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24596 !! wikitext
24597 <a href="http://google.com">google</a>
24598 !! end
24599
24600 !! test
24601 2. other tags
24602 !! options
24603 parsoid=html2wt
24604 !! html/parsoid
24605 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24606 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24607 <li> &lt;td&gt;</li></ul>
24608
24609 !! wikitext
24610 * <nowiki><div>foo</div></nowiki>
24611 * <nowiki><div style="color:red">foo</div></nowiki>
24612 * <nowiki><td></nowiki>
24613 !! end
24614
24615 !! test
24616 3. multi-line html tag
24617 !! options
24618 parsoid=html2wt
24619 !! html/parsoid
24620 <p>&lt;div
24621 &gt;foo&lt;/div
24622 &gt;
24623 </p>
24624 !! wikitext
24625 <nowiki><div
24626 >foo</div
24627 ></nowiki>
24628 !! end
24629
24630 !! test
24631 4. extension tags
24632 !! options
24633 parsoid=html2wt
24634 !! html/parsoid
24635 <p>&lt;ref&gt;foo&lt;/ref&gt;
24636 </p><p>&lt;ref&gt;bar
24637 </p><p>baz&lt;/ref&gt;
24638 </p>
24639 !! wikitext
24640 <nowiki><ref>foo</ref></nowiki>
24641
24642 <nowiki><ref>bar</nowiki>
24643
24644 baz<nowiki></ref></nowiki>
24645 !! end
24646
24647 #### --------------- Others ---------------
24648 !! test
24649 Escaping nowikis
24650 !! options
24651 parsoid=html2wt
24652 !! html/parsoid
24653 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24654 </p>
24655 !! wikitext
24656 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24657 !! end
24658
24659 ## The quote-char in the input is necessary for triggering the bug
24660 !! test
24661 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24662 !! options
24663 parsoid=html2wt
24664 !! html/parsoid
24665 <p>foo's bar :</p>
24666 !! wikitext
24667 foo's bar :
24668 !! end
24669
24670 #----------- End of wikitext escaping tests --------------
24671
24672 !! test
24673
24674 Tag-like HTML structures are passed through as text
24675 !! wikitext
24676 <x y>
24677
24678 <x.y>
24679
24680 <x-y>
24681
24682 1>2
24683
24684 x<y
24685
24686 a>b
24687
24688 1<d e>f
24689 !! html
24690 <p>&lt;x y&gt;
24691 </p><p>&lt;x.y&gt;
24692 </p><p>&lt;x-y&gt;
24693 </p><p>1&gt;2
24694 </p><p>x&lt;y
24695 </p><p>a&gt;b
24696 </p><p>1&lt;d e&gt;f
24697 </p>
24698 !! end
24699
24700 !! test
24701 HTML tag with necessary entities in attributes
24702 !! wikitext
24703 <span title="&amp;amp;">foo</span>
24704 !! html
24705 <p><span title="&amp;amp;">foo</span>
24706 </p>
24707 !! end
24708
24709 !! test
24710 HTML tag with 'unnecessary' entity encoding in attributes
24711 !! wikitext
24712 <span title="&amp;">foo</span>
24713 !! html
24714 <p><span title="&amp;">foo</span>
24715 </p>
24716 !! end
24717
24718 !! test
24719 HTML tag with broken attribute value quoting
24720 !! options
24721 parsoid=wt2html,html2html
24722 !! wikitext
24723 <span title="Hello world>Foo</span>
24724 !! html/php
24725 <p><span title="Hello world">Foo</span>
24726 </p>
24727 !! html/parsoid
24728 <p><span title="Hello world">Foo</span></p>
24729 !! end
24730
24731 !! test
24732 Self-closed tag with broken attribute value quoting
24733 !! options
24734 parsoid=wt2html,html2html
24735 !! wikitext
24736 <div title="Hello world />Foo
24737 !! html/php+tidy
24738 <div title="Hello world"></div>
24739 <p>Foo</p>
24740 !! html/parsoid
24741 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24742 !! end
24743
24744 !! test
24745 Table with broken attribute value quoting
24746 !! options
24747 parsoid=wt2html,html2html
24748 !! wikitext
24749 {|
24750 | title="Hello world|Foo
24751 |}
24752 !! html/php
24753 <table>
24754 <tr>
24755 <td title="Hello world">Foo
24756 </td></tr></table>
24757
24758 !! html/parsoid
24759 <table>
24760 <tr>
24761 <td title="Hello world">Foo
24762 </td></tr></table>
24763
24764 !! end
24765
24766 !! test
24767 Table with broken attribute value quoting on consecutive lines
24768 !! options
24769 parsoid=wt2html,html2html
24770 !! wikitext
24771 {|
24772 | title="Hello world|Foo
24773 | style="color:red|Bar
24774 |}
24775 !! html/php
24776 <table>
24777 <tr>
24778 <td title="Hello world">Foo
24779 </td>
24780 <td style="color:red">Bar
24781 </td></tr></table>
24782
24783 !! html/parsoid
24784 <table><tbody>
24785 <tr>
24786 <td title="Hello world">Foo
24787 </td><td style="color: red">Bar
24788 </td></tr></tbody></table>
24789
24790 !! end
24791
24792 !!test
24793 Accept empty td cell attribute
24794 !! wikitext
24795 {|
24796 | align="center" | foo || |
24797 |}
24798 !! html
24799 <table>
24800 <tr>
24801 <td align="center"> foo </td>
24802 <td>
24803 </td></tr></table>
24804
24805 !!end
24806
24807 !!test
24808 Non-empty attributes in th-cells
24809 !! wikitext
24810 {|
24811 ! Foo !! style="color: red" | Bar
24812 |}
24813 !! html
24814 <table>
24815 <tr>
24816 <th> Foo </th>
24817 <th style="color: red"> Bar
24818 </th></tr></table>
24819
24820 !!end
24821
24822 !!test
24823 Accept empty attributes in th-cells
24824 !! wikitext
24825 {|
24826 !| foo !!| bar
24827 |}
24828 !! html
24829 <table>
24830 <tr>
24831 <th> foo </th>
24832 <th> bar
24833 </th></tr></table>
24834
24835 !!end
24836
24837 !!test
24838 Empty table rows go away
24839 !! wikitext
24840 {|
24841 | Hello
24842 | there
24843 |- class="foo"
24844 |-
24845 |}
24846 !! html
24847 <table>
24848 <tr>
24849 <td> Hello
24850 </td>
24851 <td> there
24852 </td></tr>
24853
24854 </table>
24855
24856 !! end
24857
24858 ###
24859 ### Parsoid-centric tests for testing RTing of inter-element separators
24860 ### Edge cases not tested by existing parser tests and specific to
24861 ### Parsoid-specific serialization strategies.
24862 ###
24863
24864 !!test
24865 RT-ed inter-element separators should be valid separators
24866 !! wikitext
24867 {|
24868 |- [[foo]]
24869 |}
24870 !! html/php
24871 <table>
24872
24873 </table>
24874
24875 !! html/parsoid
24876 <table>
24877 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24878 </tbody></table>
24879 !!end
24880
24881 # Parsoid-only since PHP parser relies on Tidy for correct output
24882 !!test
24883 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24884 !!options
24885 parsoid
24886 !! wikitext
24887 {|
24888 |<small>foo
24889 bar
24890 |}
24891
24892 {|
24893 |<small>foo<small>
24894 |}
24895 !! html
24896 <table>
24897 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24898 <p>bar</p></small></td></tr>
24899 </tbody></table>
24900
24901 <table>
24902 <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>
24903 </tbody></table>
24904 !!end
24905
24906 # Note that the "style" attribute is really a template parameter here.
24907 # The = would have to be {{=}} if you wanted the literal.
24908 !!test
24909 Empty TD followed by TD with tpl-generated attribute
24910 !! wikitext
24911 {|
24912 |-
24913 |
24914 |{{echo|style='color:red'}}|foo
24915 |}
24916 !! html
24917 <table>
24918
24919 <tr>
24920 <td>
24921 </td>
24922 <td>foo
24923 </td></tr></table>
24924
24925 !!end
24926
24927 !!test
24928 Indented table with an empty td
24929 !! wikitext
24930 {|
24931 |-
24932 |
24933 |foo
24934 |}
24935 !! html
24936 <table>
24937
24938 <tr>
24939 <td>
24940 </td>
24941 <td>foo
24942 </td></tr></table>
24943
24944 !!end
24945
24946 ## We have some newline diffs RT-ing this edge case
24947 ## and it is not important enough -- we seem to be emitting
24948 ## at most 2 newlines after a </tr> and this is unrelated to
24949 ## the issue from T85627 that this is testing.
24950 !!test
24951 Indented table with blank lines in between (T85627)
24952 !! options
24953 parsoid=wt2html
24954 !! wikitext
24955 {|
24956 |foo
24957
24958
24959 |}
24960 !! html
24961 <table>
24962
24963 <tr>
24964 <td>foo
24965 </td></tr></table>
24966
24967 !!end
24968
24969 !!test
24970 Indented block & table
24971 !! wikitext
24972 <div>foo</div>
24973 {|
24974 |foo
24975 |}
24976 !! html/php
24977 <div>foo</div>
24978 <table>
24979 <tr>
24980 <td>foo
24981 </td></tr></table>
24982
24983 !! html/parsoid
24984 <div data-parsoid='{"stx":"html"}'>foo</div>
24985 <table><tbody>
24986 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24987 </tbody></table>
24988 !!end
24989
24990 !! test
24991 Indent and comment before table row
24992 !! wikitext
24993 {|
24994 <!--hi-->|-
24995 | there
24996 |}
24997 !! html/php
24998 <table>
24999
25000 <tr>
25001 <td> there
25002 </td></tr></table>
25003
25004 !! html/parsoid
25005 <table>
25006 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25007 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25008 </tbody></table>
25009 !! end
25010
25011 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25012 !!test
25013 Empty TR followed by a template-generated TR
25014 !!options
25015 parsoid
25016 !! wikitext
25017 {|
25018 |-
25019 {{echo|<tr><td>foo</td></tr>}}
25020 |}
25021 !! html
25022 <table>
25023 <tbody>
25024 <tr></tr>
25025 <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}}]}'>
25026 <td>foo</td></tr>
25027 </tbody></table>
25028 !!end
25029
25030 ## PHP and parsoid output differ for this, and since this is primarily
25031 ## for testing Parsoid's serializer, marking this Parsoid only
25032 !!test
25033 Empty TR followed by mixed-ws-comment line should RT correctly
25034 !!options
25035 parsoid
25036 !! wikitext
25037 {|
25038 |-
25039 <!--c-->
25040 |-
25041 <!--c--> <!--d-->
25042 |}
25043 !! html
25044 <table>
25045 <tbody>
25046 <tr></tr>
25047 <!--c-->
25048 <tr>
25049 <!--c--> </tr><!--d-->
25050 </tbody></table>
25051
25052 !!end
25053
25054 !!test
25055 Multi-line image caption generated by templates with/without trailing newlines
25056 !! wikitext
25057 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25058 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25059 !! html/parsoid
25060 <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>
25061 <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>
25062 !!end
25063
25064 !! test
25065 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25066 !! options
25067 parsoid=html2wt
25068 !! html/parsoid
25069 <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>
25070
25071 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25072 !! wikitext
25073 <includeonly>foo</includeonly>
25074 new para
25075
25076 [[Category:Foo]]
25077
25078 = new heading =
25079 !! end
25080
25081 ## PHP emits broken html for this, and since this is primarily
25082 ## a Parsoid serializer test, marking this Parsoid only
25083 !!test
25084 Improperly nested inline or quotes tags with whitespace in between
25085 !! wikitext
25086 <span> <s>x</span> </s>
25087 ''' ''x''' ''
25088 !! html/parsoid
25089 <p><span> <s>x</s></span><s> </s>
25090 <b> <i>x</i></b><i> </i>
25091 </p>
25092 !!end
25093
25094 !!test
25095 Encapsulate protected attributes from wt
25096 !! wikitext
25097 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25098
25099 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25100 | ok
25101 |}
25102 !! html/parsoid
25103 <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>
25104
25105 <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">
25106 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25107 </tbody></table>
25108 !!end
25109
25110 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25111 ## Having nested or stray pre tags results in the attempt to add duplicates,
25112 ## causing an assertion fail. This test tries to prevent that situation.
25113 !!test
25114 Ensure ParagraphWrapper can deal with stray closing pre tags
25115 !!options
25116 parsoid=wt2html
25117 !! wikitext
25118 plain text</pre>
25119 !! html/parsoid
25120 plain text
25121 !!end
25122
25123 !!test
25124 1. Ensure fostered text content is wrapped in element nodes
25125 !!options
25126 parsoid=wt2html
25127 !! wikitext
25128 <table>hi</table><table>ho</table>
25129 !! html/parsoid
25130 <p>hi</p>
25131 <table></table>
25132 <p>ho</p>
25133 <table></table>
25134 !!end
25135
25136 !!test
25137 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25138 !!options
25139 parsoid=wt2html,wt2wt
25140 !! wikitext
25141 <table>
25142 <tr> || ||
25143 <td> a
25144 </table>
25145 !! html/parsoid
25146 <p> || ||
25147 </p><table>
25148 <tbody><tr><td> a</td></tr>
25149 </tbody></table>
25150 !!end
25151
25152 !!test
25153 Encapsulation properly handles null DSR information from foster box
25154 !!options
25155 parsoid=wt2html,wt2wt
25156 !! wikitext
25157 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25158 !! html/parsoid
25159 <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>
25160 !!end
25161
25162 !!test
25163 1. Encapsulate foster-parented transclusion content
25164 !!options
25165 parsoid=wt2wt,wt2html
25166 !! wikitext
25167 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25168 !! html/parsoid
25169 <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>
25170 <tbody>
25171 <tr>
25172 <td>bar</td>
25173 </tr>
25174 </tbody>
25175 </table>
25176 !!end
25177
25178 !!test
25179 2. Encapsulate foster-parented transclusion content
25180 !!options
25181 parsoid=wt2wt,wt2html
25182 !! wikitext
25183 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25184 !! html/parsoid
25185 <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>
25186 <table>
25187 <tbody>
25188 <tr>
25189 <td>bar</td>
25190 </tr>
25191 </tbody>
25192 </table>
25193 !!end
25194
25195 !!test
25196 3. Encapsulate foster-parented transclusion content
25197 !!options
25198 parsoid=wt2wt,wt2html
25199 !! wikitext
25200 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25201 !! html/parsoid
25202 <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;]}">
25203 <p>foo</p>
25204 </div>
25205 <table>
25206 <tbody>
25207 <tr>
25208 <td>bar</td>
25209 </tr>
25210 </tbody>
25211 </table>
25212 !!end
25213
25214 !!test
25215 4. Encapsulate foster-parented transclusion content
25216 !!options
25217 parsoid=wt2wt,wt2html
25218 !! wikitext
25219 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25220 !! html/parsoid
25221 <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;]}">
25222 <p>foo</p>
25223 </div>
25224 <table>
25225 <tbody>
25226 <tr>
25227 <td>bar</td>
25228 </tr>
25229 </tbody>
25230 </table>
25231 !!end
25232
25233 !!test
25234 5. Encapsulate foster-parented transclusion content
25235 !!options
25236 parsoid=wt2wt,wt2html
25237 !! wikitext
25238 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25239 !! html/parsoid
25240 <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>
25241 <table>
25242 <tbody>
25243 <tr>
25244 <td>
25245 <div>
25246 <p>foo</p>
25247 </div>
25248 </td>
25249 </tr>
25250 </tbody>
25251 </table>
25252 !!end
25253
25254 !!test
25255 6. Encapsulate foster-parented transclusion content
25256 !!options
25257 parsoid=wt2wt,wt2html
25258 !! wikitext
25259 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25260 !! html/parsoid
25261 <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>
25262 <table>
25263 <tbody>
25264 <tr>
25265 <td>
25266 <div>
25267 <p>foo</p>
25268 </div>
25269 </td>
25270 </tr>
25271 </tbody>
25272 </table>
25273 <p>ok</p>
25274 !!end
25275
25276 !!test
25277 7. Encapsulate foster-parented transclusion content
25278 !!options
25279 parsoid=wt2wt,wt2html
25280 !! wikitext
25281 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25282 !! html/parsoid
25283 <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>
25284 <table>
25285 <tbody>
25286 <tr>
25287 <td>bar</td>
25288 </tr>
25289 </tbody>
25290 </table>
25291 !!end
25292
25293 # Note that the wt is broken on purpose: the = should be {{=}} if you
25294 # don't want it to be a template parameter key.
25295 !!test
25296 8. Encapsulate foster-parented transclusion content
25297 !!options
25298 parsoid=wt2wt,wt2html
25299 !! wikitext
25300 {{echo|a
25301 }}{|{{echo|style='color:red'}}
25302 |-
25303 |b
25304 |}
25305 !! html/parsoid
25306 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25307 <span> </span>
25308 <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>
25309 <table>
25310 <tbody>
25311 <tr>
25312 <td>b</td>
25313 </tr>
25314 </tbody>
25315 </table>
25316 !!end
25317
25318 !!test
25319 9. Encapsulate foster-parented transclusion content
25320 !!options
25321 parsoid=wt2wt,wt2html
25322 !! wikitext
25323 <table>{{echo|hi</table>hello}}
25324 !! html/parsoid
25325 <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>
25326 !!end
25327
25328 !!test
25329 Table in fosterable position
25330 !!options
25331 parsoid=wt2html
25332 !! wikitext
25333 {{OpenTable}}
25334 <div>
25335 {|
25336 |}
25337 </div>
25338 |}
25339 !! html/parsoid
25340 <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">
25341 </span>
25342 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25343
25344 <table>
25345 </table>
25346 !!end
25347
25348 # Parsoid only for bug 64747
25349 !! test
25350 Properly encapsulate empty-content transclusions in fosterable positions
25351 !! wikitext
25352 <table>
25353 {{#if:|
25354 <td>foo</td>
25355 }}
25356 </table>
25357 !! html/parsoid
25358 <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"}]]}'>
25359
25360 </table>
25361 !! end
25362
25363 !! test
25364 Always encapsulate foster box when template range is expanded to table
25365 !! options
25366 parsoid=wt2wt
25367 !! wikitext
25368 {|
25369 hello
25370 {{OpenTable}}
25371 |}
25372 !! html/parsoid
25373
25374 !! end
25375
25376 !! test
25377 T115289: Unclosed table
25378 !! wikitext
25379 {{echo|<table>}}<!--c-->[[Category:Two]]
25380 !! html/parsoid
25381 <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>
25382 !! end
25383
25384 !! test
25385 T115289: Don't migrate newlines out of tables with fostered content
25386 !! wikitext
25387 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25388 !! html/parsoid
25389 <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>
25390 !! end
25391
25392 !! test
25393 T73074: More fostering fun
25394 !! wikitext
25395 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25396 !! html/parsoid
25397 <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>
25398 !! end
25399
25400 !!test
25401 Support <object> element with .data attribute
25402 !!options
25403 parsoid=html2wt
25404 !! html/parsoid
25405 <object data="test.swf"></object>
25406 !! wikitext
25407 <object data="test.swf"></object>
25408 !!end
25409
25410 !! test
25411 Don't block XML namespace declaration
25412 !! wikitext
25413 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25414 !! html/php
25415 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25416 </p>
25417 !! html/parsoid
25418 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25419 !! end
25420
25421 # -----------------------------------------------------------------
25422 # The following section of tests are primarily to spec requirements
25423 # around Parsoid's serialization (old, new, edited content)
25424 #
25425 # All these tests are marked Parsoid html2wt and html2html only
25426 # ----------------------------------------------------------------
25427
25428 !! test
25429 Ignore rel attribute in a-tags during serialization to url-links
25430 !! options
25431 parsoid=html2wt
25432 !! html/parsoid
25433 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25434 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25435 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25436 !! wikitext
25437 http://en.wikipedia.org/wiki/Foobar
25438 http://en.wikipedia.org/wiki/Foobar
25439 http://en.wikipedia.org/wiki/Foobar
25440 !! end
25441
25442 # 'mi' is a localinterwiki prefix as well as a language
25443 !! test
25444 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25445 !! options
25446 parsoid=html2wt
25447 !! html/parsoid
25448 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25449 !! wikitext
25450 [[Foo]]
25451 !! end
25452
25453 # See T93839
25454 !! test
25455 New wikilinks should be serialized properly
25456 !! options
25457 parsoid=html2wt
25458 !! html/parsoid
25459 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25460 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25461 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25462 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25463 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25464 !! wikitext
25465 [[Foo]]
25466 [[Foo]]
25467 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25468 http://en.wikipedia.org/wiki/Foo
25469 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25470 !! end
25471
25472 !! test
25473 New wiki links (href variations)
25474 !! options
25475 parsoid=html2wt
25476 !! html/parsoid
25477 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25478 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25479 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25480 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25481 !! wikitext
25482 [[Foo_bar]]
25483 [[Foo_bar]]
25484 [[Foo_bar]]
25485 [[Toxine bactérienne]]
25486 !! end
25487
25488 !! test
25489 New wiki links (content string variations)
25490 !! options
25491 parsoid=html2wt
25492 !! html/parsoid
25493 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25494 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25495 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25496 !! wikitext
25497 [[Foo_bar]]
25498 [[Foo bar]]
25499 [[Foo_bar|./Foo_bar]]
25500 !! end
25501
25502 !! test
25503 New category links (href variations)
25504 !! options
25505 parsoid=html2wt
25506 !! html/parsoid
25507 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25508 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25509 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25510 !! wikitext
25511 [[Category:Toxine bactérienne]]
25512 [[Category:Toxine bactérienne]]
25513 [[Category:Toxine bactérienne]]
25514 !! end
25515
25516 !! test
25517 New sol transparent links don't need indent-pre nowiki protection
25518 !! options
25519 parsoid=html2wt
25520 language=de
25521 !! html/parsoid
25522 <link rel="mw:PageProp/redirect" href="./Main_Page">
25523 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25524 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25525 !! wikitext
25526 #WEITERLEITUNG [[Main Page]]
25527 <!-- this is good --> [[Category:Good]]
25528 <!-- this is great --> [[Kategorie:Great]]
25529 !! end
25530
25531 !! test
25532 New interlanguage links (href variations)
25533 !! options
25534 parsoid=html2wt
25535 !! html/parsoid
25536 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25537 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25538 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25539 !! wikitext
25540 [[es:Toxine bactérienne]]
25541 [[es:Toxine_bactérienne]]
25542 [[es:Toxine_bactérienne]]
25543 !! end
25544
25545 !! test
25546 Image: Modifying size of an image (1)
25547 !! options
25548 parsoid={
25549 "modes": ["wt2wt"],
25550 "changes": [
25551 ["img[height]", "attr", "height", "22"],
25552 ["img[width]", "attr", "width", "200"]
25553 ]
25554 }
25555 !! wikitext
25556 [[Image:Foobar.jpg|230x230px]]
25557 !! wikitext/edited
25558 [[Image:Foobar.jpg|200x200px]]
25559 !!end
25560
25561 !! test
25562 Image: Modifying size of an image (2)
25563 !! options
25564 parsoid={
25565 "modes": ["wt2wt"],
25566 "changes": [
25567 ["img[height]", "attr", "height", "100"],
25568 ["img[width]", "attr", "width", "500"]
25569 ]
25570 }
25571 !! wikitext
25572 [[Image:Foobar.jpg|230x230px]]
25573 !! wikitext/edited
25574 [[Image:Foobar.jpg|500x500px]]
25575 !!end
25576
25577 # Change in size is ignored so long as class='mw-default-size'
25578 !! test
25579 Image: Modifying size of an image (3)
25580 !! options
25581 parsoid={
25582 "modes": ["wt2wt"],
25583 "changes": [
25584 ["figure[class]", "removeClass", "mw-default-size"],
25585 ["figure img", "attr", "height", "19"],
25586 ["figure img", "attr", "width", "170"]
25587 ]
25588 }
25589 !! wikitext
25590 [[Image:Foobar.jpg|thumb]]
25591 !! wikitext/edited
25592 [[Image:Foobar.jpg|thumb|170x170px]]
25593 !!end
25594
25595 !! test
25596 Image: Modifying alignment of an image (bug 48665)
25597 !! options
25598 parsoid={
25599 "modes": ["wt2wt"],
25600 "changes": [
25601 ["figure[class]", "removeClass", "mw-halign-right"],
25602 ["figure[class]", "addClass", "mw-halign-left"]
25603 ]
25604 }
25605 !! wikitext
25606 [[Image:Foobar.jpg|thumb|caption|right]]
25607 !! wikitext/edited
25608 [[Image:Foobar.jpg|thumb|caption|left]]
25609 !! end
25610
25611 !! test
25612 Image: Modifying mw-default-size of an frameless image (bug 62805)
25613 !! options
25614 parsoid={
25615 "modes": ["wt2wt"],
25616 "changes": [
25617 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25618 ]
25619 }
25620 !! wikitext
25621 [[Image:Foobar.jpg|frameless|right]]
25622 !! wikitext/edited
25623 [[Image:Foobar.jpg|frameless|right|220x220px]]
25624 !! end
25625
25626 !! test
25627 Image: Modifying valign of an image (bug 49221)
25628 !! options
25629 parsoid={
25630 "modes": ["wt2wt"],
25631 "changes": [
25632 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25633 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25634 ]
25635 }
25636 !! wikitext
25637 [[File:Foobar.jpg|20px|middle]]
25638 !! wikitext/edited
25639 [[File:Foobar.jpg|20px|text-top]]
25640 !! end
25641
25642 !! test
25643 Image: Modifying alt attribute of an image (bug 56400)
25644 !! options
25645 parsoid={
25646 "modes": ["wt2wt"],
25647 "changes": [
25648 ["img[alt]", "attr", "alt", "some alternate edited text"]
25649 ]
25650 }
25651 !! wikitext
25652 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25653 !! wikitext/edited
25654 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25655 !!end
25656
25657 !! test
25658 Image: Modifying caption of an image
25659 !! options
25660 parsoid={
25661 "modes": ["wt2wt"],
25662 "changes": [
25663 ["figcaption", "text", "new caption"]
25664 ]
25665 }
25666 !! wikitext
25667 [[Image:Foobar.jpg|thumb|original caption]]
25668 !! wikitext/edited
25669 [[Image:Foobar.jpg|thumb|new caption]]
25670 !!end
25671
25672 !! test
25673 Image: empty alt attribute (bug 48924)
25674 !! options
25675 parsoid
25676 !! wikitext
25677 [[File:Foobar.jpg|thumb|alt=|bar]]
25678 !! html
25679 <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>
25680 !! end
25681
25682 !! test
25683 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25684 !! options
25685 parsoid=html2wt
25686 language=ar
25687 disabled
25688 !! html/parsoid
25689 <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>
25690 !! wikitext
25691 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25692 !! end
25693
25694 !! test
25695 Image: Block level image should have \n before and after
25696 !! wikitext
25697 123
25698 [[File:Foobar.jpg|right|thumb|150x150px]]
25699 456
25700 !! html/parsoid
25701 <p>123</p>
25702 <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>
25703 <p>456</p>
25704 !!end
25705
25706 !! test
25707 Image: New block level image should have \n before and after (existing content)
25708 !! wikitext
25709 123
25710 [[File:Foobar.jpg|right|thumb|150x150px]]
25711 456
25712 !! html/parsoid
25713 <p>123</p>
25714 <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>
25715 <p>456</p>
25716 !!end
25717
25718 !! test
25719 Image: upright option (parsoid)
25720 !! wikitext
25721 [[File:Foobar.jpg|thumb|upright|caption]]
25722 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25723 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25724 !! html/parsoid
25725 <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>
25726 <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>
25727 <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>
25728 !!end
25729
25730 !! test
25731 Image: upright option is ignored on inline and frame images (parsoid)
25732 !! wikitext
25733 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25734 !! html/parsoid
25735 <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>
25736 !!end
25737
25738 !! test
25739 Image: from basic HTML (1)
25740 !! options
25741 parsoid=html2wt
25742 !! html/parsoid
25743 <span typeof="mw:Image">
25744 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25745 </span>
25746 !! wikitext
25747 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25748 !! end
25749
25750 !! test
25751 Image: from basic HTML (2)
25752 !! options
25753 parsoid=html2wt
25754 !! html/parsoid
25755 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25756 !! wikitext
25757 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25758 !! end
25759
25760 !! test
25761 Image: from basic HTML (3)
25762 !! options
25763 parsoid=html2wt
25764 !! html/parsoid
25765 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25766 !! wikitext
25767 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25768 !! end
25769
25770 !! test
25771 Image: from basic HTML (4)
25772 !! options
25773 parsoid=html2wt
25774 !! html/parsoid
25775 <img src="./File:Foobar.jpg">
25776 !! wikitext
25777 [[File:Foobar.jpg|link=]]
25778 !! end
25779
25780 !! test
25781 Image: Invalid title as link
25782 !! wikitext
25783 [[File:Foobar.jpg|link=<]]
25784 !! html/php
25785 <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>
25786 </p>
25787 !! html/parsoid
25788 <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>
25789 !! end
25790
25791 !! test
25792 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25793 !! options
25794 parsoid=html2wt
25795 !! html/parsoid
25796 <ul>
25797 <li><p>foo</p></li>
25798 </ul>
25799 !! wikitext
25800 * foo
25801 !! end
25802
25803 !! test
25804 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25805 !! options
25806 parsoid=html2wt
25807 !! html/parsoid
25808 <ul> <li>foo</li></ul>
25809 !! wikitext
25810 * foo
25811 !! end
25812
25813 !! test
25814 Don't strip leading whitespace when handling indent-pre suppressing tags
25815 !! options
25816 parsoid=html2wt
25817 !! html/parsoid
25818 <table>
25819 <tr><td> indented row</td></tr>
25820 </table>
25821 <blockquote><p>
25822 <b>This is very bold of you!</b>
25823 </p>
25824 <table><tr><td>
25825 indented cell (no pre-wrapping!)
25826 </td></tr></table>
25827 </blockquote>
25828 <p>foo</p>
25829 <div>bar</div>
25830 !! wikitext
25831 {|
25832 | indented row
25833 |}
25834 <blockquote>
25835 '''This is very bold of you!'''
25836
25837 {|
25838 |
25839 indented cell (no pre-wrapping!)
25840 |}
25841 </blockquote>
25842 foo
25843 <div>bar</div>
25844 !! end
25845
25846 !! test
25847 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25848 !! options
25849 parsoid=html2wt
25850 !! html/parsoid
25851 <p>foo</p>
25852 <span>bar</span>
25853
25854 <span>foo2
25855 </span>bar2
25856
25857 <div>foo</div>
25858 <span>bar</span>
25859
25860 <div>
25861 <span>foo</span>
25862 </div>
25863 !! wikitext
25864 foo
25865
25866 <span>bar</span>
25867
25868 <span>foo2
25869 <nowiki> </nowiki></span>bar2
25870
25871 <div>foo</div>
25872 <nowiki> </nowiki><span>bar</span>
25873
25874 <div>
25875 <nowiki> </nowiki><span>foo</span>
25876 </div>
25877 !! end
25878
25879 !! test
25880 Lists: Dont insert newlines in a serialized list item.
25881 !! options
25882 parsoid=html2wt
25883 !! html/parsoid
25884 <ul><li>a<br>b</li><li>c</li></ul>
25885 !! wikitext
25886 * a<br>b
25887 * c
25888 !! end
25889
25890 !! test
25891 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25892 !! options
25893 parsoid={
25894 "modes": ["html2wt"],
25895 "scrubWikitext": false
25896 }
25897 !! html/parsoid
25898 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25899 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25900
25901 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25902 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25903
25904 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25905
25906 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25907 !! wikitext
25908 == hello there [[Category:A1]] ==
25909
25910 == [[Category:A2]] hi pal ==
25911
25912 == <!--foo--> [[Category:A3]] how goes it ==
25913
25914 == it goes well [[Category:A4]] <!--bar--> ==
25915
25916 ==howdy [[Category:A5]]==
25917
25918 == __TOC__ ok ==
25919 !! end
25920
25921 !! test
25922 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25923 !! options
25924 parsoid={
25925 "modes": ["html2wt"],
25926 "scrubWikitext": true
25927 }
25928 !! html/parsoid
25929 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25930 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25931
25932 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25933 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25934
25935 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25936 !! wikitext
25937 == hello there ==
25938 [[Category:A1]]
25939 [[Category:A2]]
25940
25941 == hi pal ==
25942
25943 <!--foo--> [[Category:A3]]
25944
25945 == how goes it ==
25946
25947 == it goes well ==
25948 [[Category:A4]] <!--bar-->
25949
25950 __TOC__
25951
25952 == ok ==
25953 !! end
25954
25955 !! test
25956 Headings: Don't hoist metas that come from templates
25957 !! options
25958 parsoid={
25959 "modes": ["html2wt"],
25960 "scrubWikitext": true
25961 }
25962 !! html/parsoid
25963 <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>
25964 !! wikitext
25965 == {{echo|foo [[Category:Foo]]}} ==
25966 !! end
25967
25968 !! test
25969 Headings: Category in ref isn't hoisted
25970 !! options
25971 parsoid={
25972 "modes": ["html2wt"],
25973 "scrubWikitext": true
25974 }
25975 !! html/parsoid
25976 <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>
25977
25978 <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>
25979 !! wikitext
25980 == foo <ref>bar
25981 [[Category:Baz]] </ref> ==
25982
25983 <references />
25984 !! end
25985
25986 !! test
25987 Parsoid: Serialize positional parameters with = in them as named parameter
25988 !! options
25989 parsoid=html2wt
25990 !! html/parsoid
25991 <p about="#mwt1" typeof="mw:Transclusion"
25992 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25993
25994 <p about="#mwt1" typeof="mw:Transclusion"
25995 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25996
25997 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25998 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25999 <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>
26000 !! wikitext
26001 {{echo|1=f=oo}}
26002
26003 {{echo|1=f=oo|2=bar}}
26004
26005 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26006 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26007 {{echo|<nowiki>f=oo</nowiki>|bar}}
26008 !! end
26009
26010 !! test
26011 Parsoid: Serialize positional parameters with = in extlink as named parameter
26012 !! options
26013 parsoid=html2wt
26014 !! html/parsoid
26015 <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>
26016 !! wikitext
26017 {{echo|1=http://stuff?is=ok}}
26018 !! end
26019
26020 !! test
26021 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26022 !! options
26023 parsoid=html2wt
26024 !! html/parsoid
26025 <div>a<p>b</p></div>
26026 <div>a
26027 <p>b</p></div>
26028 <div>
26029 a
26030 <p>b</p></div>
26031 !! wikitext
26032 <div>a
26033 b
26034 </div>
26035 <div>a
26036 b
26037 </div>
26038 <div>
26039 a
26040
26041 b
26042 </div>
26043 !! end
26044
26045 !! test
26046 Substrings resembling wikitext in hrefs should not get nowiki escapes
26047 !! options
26048 parsoid=html2wt
26049 !! html/parsoid
26050 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26051 !! wikitext
26052 [[Foo''bar''baz]]
26053 !! end
26054
26055 !! test
26056 Enforce single-line context in the serializer
26057 !! options
26058 parsoid=html2wt
26059 !! html/parsoid
26060 <h2>testing
26061 123</h2>
26062
26063 <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">
26064 </span><span about="#mwt1">you</span> </h2>
26065
26066 <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>
26067
26068 <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
26069 there</span></li></ol>
26070
26071 <ul><li>asd
26072 sdf</li></ul>
26073
26074 <ul><li>foo
26075 bar
26076 baz</li>
26077 <li>foo <b>bar</b>
26078 baz</li></ul>
26079
26080 <dl><dt>hi
26081 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26082 ho</dd></dl>
26083
26084 <dl><dd> <table>
26085 <tbody><tr><td> ha
26086 ha
26087 ha</td></tr>
26088 </tbody></table></dd></dl>
26089 !! wikitext
26090 == testing 123 ==
26091
26092 == hi {{bogus|there
26093 you}} ==
26094
26095 == foo <ref>hello
26096 there</ref> ==
26097
26098 <references />
26099
26100 * asd sdf
26101
26102 * foo bar baz
26103 * foo '''bar''' baz
26104
26105 ; hi ho : hi ho
26106
26107 : {|
26108 | ha
26109 ha
26110 ha
26111 |}
26112 !! end
26113
26114 !! test
26115 Serialize new placeholder space without spans
26116 !! options
26117 parsoid=html2wt
26118 !! html/parsoid
26119 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26120
26121 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26122
26123 <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>
26124 !! wikitext
26125 foo : bar
26126
26127 foo : bar
26128
26129 <ref>foo : bar</ref>ok
26130 !! end
26131
26132
26133 #-----------------------
26134 # Tag minimization tests
26135 #-----------------------
26136
26137 !! test
26138 1. I/B quote minimization: wikitext-only tags should be combined
26139 !! options
26140 parsoid=html2wt
26141 !! html/parsoid
26142 <p><i>A</i><i>B</i></p>
26143 <p><b>A</b><b>B</b></p>
26144 <p><i>A</i><b><i>B</i></b></p>
26145 <p><b>A</b><i><b>B</b></i></p>
26146 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26147 <p><i><b>A</b></i><i><b>B</b></i></p>
26148 <p><i><b>A</b></i><b><i>B</i></b></p>
26149 <p><b><i>A</i></b><i><b>B</b></i></p>
26150 !! wikitext
26151 ''AB''
26152
26153 '''AB'''
26154
26155 ''A'''B'''''
26156
26157 '''A''B'''''
26158
26159 '''A''BC''D'''
26160
26161 '''''AB'''''
26162
26163 '''''AB'''''
26164
26165 '''''AB'''''
26166 !! end
26167
26168 !! test
26169 2. I/B quote minimization: wikitext and html tags should not be combined
26170 !! options
26171 parsoid=html2wt
26172 !! html/parsoid
26173 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26174 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26175 !! wikitext
26176 ''A''<i>B</i>
26177
26178 ''A''<nowiki/>'''<i>B</i>'''
26179 !! end
26180
26181 !! test
26182 3. I/B quote minimization: templated content stops minimization
26183 !! options
26184 parsoid=html2wt
26185 !! html/parsoid
26186 <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>
26187 <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>
26188 !! wikitext
26189 ''A''{{echo|''B''}}
26190
26191 ''A''{{echo|'''''B'''''}}
26192 !! end
26193
26194 !! test
26195 4. I/B quote minimization: new content should be mimimized with adjacent old content
26196 !! options
26197 parsoid=html2wt
26198 !! html/parsoid
26199 <p><i>A</i><i>B</i></p>
26200 <p><b>A</b><b>B</b></p>
26201 <p><i>A</i><b><i>B</i></b></p>
26202 !! wikitext
26203 ''AB''
26204
26205 '''AB'''
26206
26207 ''A'''B'''''
26208 !! end
26209
26210 !! test
26211 5a. Merge adjacent quote nodes if they've been edited
26212 !! options
26213 parsoid={
26214 "modes": ["wt2wt", "selser"],
26215 "changes": [
26216 ["p", "contents", "remove", ":contains('b')"]
26217 ]
26218 }
26219 !! wikitext
26220 ''a''b''c''
26221 !! wikitext/edited
26222 ''ac''
26223 !! end
26224
26225 !! test
26226 5b. Merge adjacent quote nodes if they've been edited
26227 !! options
26228 parsoid={
26229 "modes": ["wt2wt", "selser"],
26230 "changes": [
26231 ["#x", "remove"]
26232 ]
26233 }
26234 !! wikitext
26235 ''a''<span id="x">b</span>''c''
26236 !! wikitext/edited
26237 ''ac''
26238 !! end
26239
26240 !! test
26241 1. Merge adjacent link nodes as long as at least one element is new
26242 !! options
26243 parsoid={
26244 "modes": ["html2wt"],
26245 "scrubWikitext": true
26246 }
26247 !! html/parsoid
26248 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26249 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26250 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26251 !! wikitext
26252 [[Football]]
26253 [[Football]]
26254 [[Football|Foot]][[Football|ball]]
26255 !! end
26256
26257 !! test
26258 2. Merge adjacent link nodes and enable additional normalizations
26259 !! options
26260 parsoid={
26261 "modes": ["html2wt"],
26262 "scrubWikitext": true
26263 }
26264 !! html/parsoid
26265 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26266 !! wikitext
26267 [[Football|''Football'']]
26268 !! end
26269
26270 !! test
26271 3. Don't merge adjacent link nodes if scrubWikitext is false
26272 !! options
26273 parsoid={
26274 "modes": ["html2wt"],
26275 "scrubWikitext": false
26276 }
26277 !! html/parsoid
26278 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26279 !! wikitext
26280 [[Football|Foot]][[Football|ball]]
26281 !! end
26282
26283 #------------------------------
26284 # End of tag minimization tests
26285 #------------------------------
26286
26287 !!test
26288 Bug 54262: New entities
26289 !! options
26290 parsoid=html2wt
26291 !! html/parsoid
26292 <span typeof="mw:Entity">&nbsp;</span>
26293 !! wikitext
26294 &nbsp;
26295 !! end
26296
26297 ## Note that there is no wikitext output for 'unknownproperty' ##
26298 ## Unknown magic words are silently dropped ##
26299
26300 !! test
26301 Magic words
26302 !! options
26303 parsoid=html2wt
26304 !! html/parsoid
26305 <meta property='mw:PageProp/toc' />
26306 <meta property='mw:PageProp/notoc' />
26307 <meta property='mw:PageProp/forcetoc' />
26308 <meta property='mw:PageProp/index' />
26309 <meta property='mw:PageProp/noindex' />
26310 <meta property='mw:PageProp/nogallery' />
26311 <meta property='mw:PageProp/noeditsection' />
26312 <meta property='mw:PageProp/notitleconvert' />
26313 <meta property='mw:PageProp/nocontentconvert' />
26314 <meta property='mw:PageProp/unknownproperty' />
26315 !! wikitext
26316 __TOC__
26317 __NOTOC__
26318 __FORCETOC__
26319 __INDEX__
26320 __NOINDEX__
26321 __NOGALLERY__
26322 __NOEDITSECTION__
26323 __NOTITLECONVERT__
26324 __NOCONTENTCONVERT__
26325 !! end
26326
26327 !! test
26328 Consecutive <pre>s should not get merged
26329 !! options
26330 parsoid=html2wt,html2html
26331 !! html/parsoid
26332 <pre>a</pre><pre>b</pre>
26333
26334 <pre>c
26335 </pre><pre>
26336 d</pre>
26337
26338 <pre>e
26339
26340 </pre><pre>
26341
26342 f</pre>
26343 !! wikitext
26344 a
26345
26346 b
26347
26348 c
26349
26350 d
26351
26352 e
26353
26354
26355
26356 f
26357 !! end
26358
26359 !! test
26360 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26361 !! options
26362 parsoid=html2wt
26363 !! html/parsoid
26364 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26365 !! wikitext
26366 [[Special:BookSources/1234567890|ISBN 1234567895]]
26367 !! end
26368
26369 !! test
26370 Edited RFC links not serializable as RFC links should serialize as extlinks
26371 !! options
26372 parsoid=html2wt
26373 !! html/parsoid
26374 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26375 !! wikitext
26376 [//tools.ietf.org/html/rfc123 New RFC]
26377 !! end
26378
26379 !! test
26380 Edited PMID links not serializable as PMID links should serialize as extlinks
26381 !! options
26382 parsoid=html2wt
26383 !! html/parsoid
26384 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26385 !! wikitext
26386 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26387 !! end
26388
26389 !! test
26390 WTS of autolinks with trailing/surrounding context
26391 !! options
26392 parsoid=html2wt
26393 !! html/parsoid
26394 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26395 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26396 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26397 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26398 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26399 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26400 !! wikitext
26401 http://cscott.net'''foo'''
26402
26403 http://cscott.net<b>foo</b>
26404
26405 '''http://cscott.net'''
26406
26407 '''http://cscott.net '''
26408
26409 '''http://cscott.net<nowiki/>x'''
26410
26411 http://cscott.net<nowiki/>x
26412 !! end
26413
26414 !! test
26415 WTS of autolinks with nowikis (round-trip)
26416 !! wikitext
26417 x<nowiki/>http://cscott.net<nowiki/>x
26418 !! html/parsoid
26419 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26420 !! end
26421
26422 # this is the "easy" test because it leaves in place all the
26423 # data-parsoid information indicating this is an autolink
26424 !! test
26425 WTS of autolinks with escapes (editing)
26426 !! options
26427 parsoid={
26428 "modes": ["wt2wt"],
26429 "changes": [
26430 [ "meta", "remove" ]
26431 ]
26432 }
26433 !! wikitext
26434 x<nowiki/>http://cscott.net<nowiki/>x
26435 !! wikitext/edited
26436 x<nowiki/>http://cscott.net<nowiki/>x
26437 !! end
26438
26439 !! test
26440 WTS of edited autolink-like text (T103364)
26441 !! options
26442 parsoid={
26443 "modes": ["wt2wt"],
26444 "changes": [
26445 [ "span[typeof]", "removeAttr", "typeof" ]
26446 ]
26447 }
26448 !! wikitext
26449 Not a link: <nowiki>http://example.com</nowiki>.
26450 !! wikitext/edited
26451 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26452 !! end
26453
26454 !! test
26455 WTS of newly-authored autolink-like text (T103364)
26456 !! options
26457 parsoid=html2wt
26458 !! html/parsoid
26459 <p>http://example.com is not a link.</p>
26460 !! wikitext
26461 <nowiki>http://example.com</nowiki> is not a link.
26462 !! end
26463
26464 !! test
26465 WTS of autolink-like text after an autolink (T108563)
26466 !! options
26467 parsoid=html2wt
26468 !! html/parsoid
26469 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26470 !! wikitext
26471 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26472 !! end
26473
26474 !! test
26475 Magic links inside links (not autolinked)
26476 !! wikitext
26477 [[Foo|http://example.com]]
26478 [[Foo|RFC 1234]]
26479 [[Foo|PMID 1234]]
26480 [[Foo|ISBN 123456789x]]
26481
26482 [http://foo.com http://example.com]
26483 [http://foo.com RFC 1234]
26484 [http://foo.com PMID 1234]
26485 [http://foo.com ISBN 123456789x]
26486 !! html+tidy
26487 <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>
26488 <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>
26489 !! html/parsoid
26490 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26491 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26492 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26493 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26494
26495 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26496 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26497 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26498 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26499 !! end
26500
26501 !! test
26502 Magic links inside image captions (autolinked)
26503 !! wikitext
26504 [[File:Foobar.jpg|thumb|http://example.com]]
26505 [[File:Foobar.jpg|thumb|RFC 1234]]
26506 [[File:Foobar.jpg|thumb|PMID 1234]]
26507 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26508 !! html+tidy
26509 <div class="thumb tright">
26510 <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>
26511 <div class="thumbcaption">
26512 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26513 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26514 </div>
26515 </div>
26516 <div class="thumb tright">
26517 <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>
26518 <div class="thumbcaption">
26519 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26520 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26521 </div>
26522 </div>
26523 <div class="thumb tright">
26524 <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>
26525 <div class="thumbcaption">
26526 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26527 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26528 </div>
26529 </div>
26530 <div class="thumb tright">
26531 <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>
26532 <div class="thumbcaption">
26533 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26534 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26535 </div>
26536 </div>
26537 !! html/parsoid
26538 <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>
26539 <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>
26540 <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>
26541 <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>
26542 !! end
26543
26544 !! test
26545 WTS of magic word text (T109371)
26546 !! options
26547 parsoid=html2wt
26548 !! html/parsoid
26549 <p>RFC 1234</p>
26550 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26551 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26552 !! wikitext
26553 <nowiki>RFC 1234</nowiki>
26554
26555 [http://foo.com RFC 1234]
26556
26557 [[Foo|RFC 1234]]
26558 !! end
26559
26560 !! test
26561 Edited Redirect link should emit a non-piped wikitext link
26562 !! options
26563 parsoid=html2wt
26564 !! html/parsoid
26565 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26566 !! wikitext
26567 #REDIRECT [[Bar]]
26568 !! end
26569
26570 !! test
26571 T75121: Infer extension name from typeOf if data-mw is not present
26572 !! options
26573 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26574 !! html/parsoid
26575 <div typeOf="mw:Extension/foo"></div>
26576 !! wikitext
26577 <foo />
26578 !! end
26579
26580 # Note that the <p> wrapping isn't present in PHP parser output
26581 # The important thing for this test is that P-wrapping doesn't
26582 # interfere with the <nowiki> protection for leading - in <td>
26583 # (which isn't necessary for <th>).
26584 !! test
26585 T88318: p-wrapped dash in table.
26586 !! options
26587 parsoid=html2wt,wt2wt
26588 !! html/parsoid
26589 <table><tbody>
26590 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26591 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26592 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26593 </tbody></table>
26594 !! wikitext
26595 {|
26596 !-
26597 !-
26598 |-
26599 |<nowiki>-</nowiki>
26600 |<nowiki>- </nowiki>
26601 |-
26602 |<small>-</small>
26603 |<br>
26604 -
26605 |<br>
26606 -
26607 |}
26608 !! html/php+tidy
26609 <table>
26610 <tr>
26611 <th>-</th>
26612 <th>-</th>
26613 </tr>
26614 <tr>
26615 <td>-</td>
26616 <td>-</td>
26617 </tr>
26618 <tr>
26619 <td><small>-</small></td>
26620 <td><br />
26621 <p>-</p>
26622 </td>
26623 <td><br />
26624 <p>-</p>
26625 </td>
26626 </tr>
26627 </table>
26628 !! end
26629
26630 !! test
26631 T149209: WTS: Handle newlines in table cells properly
26632 !! options
26633 parsoid=html2wt
26634 !! html/parsoid
26635 <table>
26636 <tbody>
26637 <tr><td>a
26638 b
26639 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26640 <tr><td><p>x</p>
26641 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26642 </tbody></table>
26643 <table>
26644 <tbody>
26645 <tr><th>a
26646 b
26647 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26648 <tr><th><p>x</h>
26649 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26650 </tbody></table>
26651 !! wikitext
26652 {|
26653 |a
26654 b
26655 |c
26656 |-
26657 |x
26658 {{!}}y
26659 |}
26660 {|
26661 !a
26662 b
26663 !c
26664 |-
26665 !x
26666 !y
26667 |}
26668 !! end
26669
26670 !! test
26671 T149209: Selser: Handle newlines in table cells properly
26672 !! options
26673 parsoid={
26674 "modes": ["selser"],
26675 "changes": [
26676 [ "#h1", "html", "a\nb\n" ],
26677 [ "#h2", "html", "a\nb\n" ],
26678 [ "#c1", "html", "a\nb\n" ],
26679 [ "#c2", "html", "<p>a</p>" ],
26680 [ "#c3", "html", "<p>a</p>" ]
26681 ]
26682 }
26683 !! wikitext
26684 {|
26685 ! id="h1" |edit-me!!1
26686 |-
26687 ! id="h2" |edit-me||2
26688 |-
26689 | id="c1" |edit-me||3
26690 |-
26691 | id="c2" |edit-me||4
26692 |-
26693 | id="c3" |edit-me||p||q||r
26694 |}
26695 !! wikitext/edited
26696 {|
26697 ! id="h1" |a
26698 b
26699 !1
26700 |-
26701 ! id="h2" |a
26702 b
26703 !2
26704 |-
26705 | id="c1" |a
26706 b
26707 |3
26708 |-
26709 | id="c2" |a
26710 |4
26711 |-
26712 | id="c3" |a
26713 |p||q||r
26714 |}
26715 !! end
26716
26717 !! test
26718 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26719 !! options
26720 parsoid=html2wt
26721 !! html/parsoid
26722 <table id='mwAb'>
26723 <td id='mwAc'>foo</td>
26724 <td id='serialize-this'>bar</td>
26725 </table>
26726 !! wikitext
26727 {|
26728 |foo
26729 | id="serialize-this" |bar
26730 |}
26731 !! end
26732
26733 !! test
26734 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26735 !! options
26736 parsoid=html2wt
26737 !! html/parsoid
26738 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26739 !! wikitext
26740 <div id="hello">ok</div>
26741 !! end
26742
26743 !! test
26744 WTS change modes
26745 !! options
26746 parsoid={
26747 "modes": ["wt2wt"],
26748 "changes": [
26749 [ "#xyz", "before", "<b>before</b> stuff " ],
26750 [ "#xyz", "after", " stuff <i>after</i>" ],
26751 [ "#xyz", "html", "x <b>y</b> z" ]
26752 ]
26753 }
26754 !! wikitext
26755 <span id="xyz">hello</span>
26756 !! wikitext/edited
26757 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26758 !! end
26759
26760 !! test
26761 Never serialize a-tag as html, regardless of what data-parsoid has to say
26762 !! options
26763 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26764 !! html/parsoid
26765 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26766 !! wikitext
26767 [[Foo]]
26768 !! end
26769
26770 ## SSS FIXME: This is broken output nevertheless.
26771 ## What might be a reasonable non-broken output for this?
26772 ## This is an edge case unlikely to be seen in production
26773 ## that I am not wasting more time on this right now.
26774 !! test
26775 Never serialize a-tag as html, no matter what attributes it has
26776 !! options
26777 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26778 !! html/parsoid
26779 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26780 !! wikitext
26781 [http://boo.org http://boohoo.org]
26782 !! end
26783
26784 # Misnested is an indication that selser can reuse the source but these have
26785 # shown to sneak through on occasion. See T101768.
26786 # The original wikitext here is: [http://test.com [[one]] two three]
26787 !! test
26788 Strip span tags added to mark misnested links
26789 !! options
26790 parsoid=html2wt
26791 !! html/parsoid
26792 <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>
26793 !! wikitext
26794 [http://test.com][[one]] two three
26795 !! end
26796
26797 !! test
26798 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26799 !! options
26800 parsoid=html2wt
26801 !! html/parsoid
26802 <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|}"]}'>
26803 <tbody><tr><td>d
26804 </td></tr>
26805 </tbody></table>
26806 !! wikitext
26807 {{echo|a}}
26808 {|{{echo|c
26809 {{!}}d
26810 }}
26811 |}
26812 !! end
26813
26814 ## This test verifies the presence and computation of this attribute indirectly
26815 ## by making an edit and ensuring that the serialization is correct (which it would be
26816 ## only if firstWikitextNode is properly set).
26817 !! test
26818 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26819 !! options
26820 parsoid= {
26821 "modes": ["wt2wt"],
26822 "changes": [
26823 [ "div#x", "remove" ],
26824 [ "div", "before", "<div>new</div>" ]
26825 ]
26826 }
26827 !! wikitext
26828 <div id="x">foo</div>
26829 {|
26830 {{echo|<div>boo</div>
26831 {{!}}b}}
26832 |c
26833 |}
26834 !! wikitext/edited
26835
26836 <div>new</div>
26837 {|
26838 {{echo|<div>boo</div>
26839 {{!}}b}}
26840 |c
26841 |}
26842 !! end
26843
26844 # --------------------------------------------
26845 # Tests spec'ing wikitext serialization norms |
26846 # --------------------------------------------
26847
26848 !! test
26849 1. Categories should always be serialized on their own line
26850 !! options
26851 parsoid=html2wt
26852 !! html/parsoid
26853 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26854 !! wikitext
26855 foo
26856 [[Category:Foo]]
26857 bar
26858 !! end
26859
26860 !! test
26861 2. Categories that are part of templates should not introduce a line break
26862 !! wikitext
26863 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26864 !! html/parsoid
26865 <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>
26866 !! end
26867
26868 # Careful while editing these next 2 tests. There are \u200f characters
26869 # before and after the <link> tags in the HTML and following some
26870 # of the categories in wikitext
26871 # Do not remove these characters in edits.
26872 #
26873 # As part of the serialization, these bidi characters will get stripped.
26874 !! test
26875 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26876 !! options
26877 parsoid={
26878 "modes": ["html2wt"],
26879 "scrubWikitext": true
26880 }
26881 !! html/parsoid
26882 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26883 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26884 !! wikitext
26885 [[קטגוריה:טקסים]]
26886 [[קטגוריה: שיטות משפט]]
26887 !! end
26888
26889 !! test
26890 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26891 !! options
26892 parsoid={
26893 "modes": ["html2wt"],
26894 "scrubWikitext": true
26895 }
26896 !! html/parsoid
26897 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26898 !! wikitext
26899 [[קטגוריה:טקסים]]
26900 ‏y
26901 !! end
26902
26903 !! test
26904 Lists: Add space after bullets
26905 !! options
26906 parsoid=html2wt
26907 !! html/parsoid
26908 <ul>
26909 <li>foo</li>
26910 <li> bar</li>
26911 <li><span> baz</span></li>
26912 </ul>
26913 !! wikitext
26914 * foo
26915 * bar
26916 * <span> baz</span>
26917 !! end
26918
26919 !! test
26920 1. Headings: Add space before/after == (T53744)
26921 !! options
26922 parsoid=html2wt
26923 !! html/parsoid
26924 <h2>foo</h2>
26925 <h2> bar</h2>
26926 <h2>baz </h2>
26927 <h2><span> baz</span></h2>
26928 !! wikitext
26929 == foo ==
26930
26931 == bar ==
26932
26933 == baz ==
26934
26935 == <span> baz</span> ==
26936 !! end
26937
26938 !! test
26939 2. Headings: Add space before/after == even after hoisted content
26940 !! options
26941 parsoid={
26942 "modes": ["html2wt"],
26943 "scrubWikitext": true
26944 }
26945 !! html/parsoid
26946 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26947 !! wikitext
26948 [[Category:A2]]
26949
26950 == ok ==
26951 !! end
26952
26953 !! test
26954 1. Headings: suppress newly created empty headings
26955 !! options
26956 parsoid={
26957 "modes": ["html2wt"],
26958 "scrubWikitext": true
26959 }
26960 !! html/parsoid
26961 <h2></h2>
26962 !! wikitext
26963 !! end
26964
26965 !! test
26966 2. Headings: don't suppress empty headings if scrubWikitext is false
26967 !! options
26968 parsoid=html2wt
26969 !! html/parsoid
26970 <h2></h2>
26971 !! wikitext
26972 ==<nowiki/>==
26973 !! end
26974
26975 !! test
26976 3. Headings: suppress empty headings on edits
26977 !! options
26978 parsoid={
26979 "modes": ["selser"],
26980 "scrubWikitext": true,
26981 "changes": [
26982 [ "#x", "remove"]
26983 ]
26984 }
26985 !! wikitext
26986 ==<span id="x">foo</span>==
26987 !! wikitext/edited
26988 !! end
26989
26990 !! test
26991 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26992 !! options
26993 parsoid={
26994 "modes": ["html2wt"],
26995 "scrubWikitext": true
26996 }
26997 !! html/parsoid
26998 <h2>foo<br/>bar</h2>
26999 <h2>foo <span><br/>bar</span> baz</h2>
27000 !! wikitext
27001 == foo bar ==
27002
27003 == foo <span> bar</span> baz ==
27004 !! end
27005
27006 !! test
27007 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27008 !! options
27009 parsoid={
27010 "modes": ["html2wt"],
27011 "scrubWikitext": false
27012 }
27013 !! html/parsoid
27014 <h2>foo<br/>bar</h2>
27015 !! wikitext
27016 == foo<br> bar ==
27017 !! end
27018
27019 !! test
27020 1. WT Quote Tags: suppress newly created empty style tags
27021 !! options
27022 parsoid={
27023 "modes": ["html2wt"],
27024 "scrubWikitext": true
27025 }
27026 !! html/parsoid
27027 <i></i><b></b>
27028 !! wikitext
27029 !! end
27030
27031 !! test
27032 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27033 !! options
27034 parsoid=html2wt
27035 !! html/parsoid
27036 <i></i><b></b>
27037 !! wikitext
27038 ''<nowiki/>'''''<nowiki/>'''
27039 !! end
27040
27041 !! test
27042 3. WT Quote Tags: suppress empty style tags on edits
27043 !! options
27044 parsoid={
27045 "modes": ["selser"],
27046 "scrubWikitext": true,
27047 "changes": [
27048 [ "#x", "remove"]
27049 ]
27050 }
27051 !! wikitext
27052 '''<span id="x">foo</span>'''
27053 !! wikitext/edited
27054 !! end
27055
27056 !! test
27057 1. Anchors: suppress newly created empty anchors
27058 !! options
27059 parsoid={
27060 "modes": ["html2wt"],
27061 "scrubWikitext": true
27062 }
27063 !! html/parsoid
27064 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27065 !! wikitext
27066 !! end
27067
27068 !! test
27069 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27070 !! options
27071 parsoid={
27072 "modes": ["html2wt"],
27073 "scrubWikitext": false
27074 }
27075 !! html/parsoid
27076 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27077 !! wikitext
27078 [[Test|<nowiki/>]]
27079 !! end
27080
27081 !! test
27082 3. Anchors: suppress empty anchors on edits
27083 !! options
27084 parsoid={
27085 "modes": ["selser"],
27086 "scrubWikitext": true,
27087 "changes": [
27088 [ "#x", "remove"]
27089 ]
27090 }
27091 !! wikitext
27092 [[Test|<span id="x">foo</span>]]
27093 !! wikitext/edited
27094 !! end
27095
27096 !! test
27097 3a. Anchors: do not suppress numbered extlinks
27098 !! options
27099 parsoid={
27100 "modes": ["wt2wt"],
27101 "scrubWikitext": true
27102 }
27103 !! wikitext
27104 [http://foo.com]
27105 !! html/parsoid
27106 <a rel="mw:ExtLink" href="http://foo.com"></a>
27107 !! end
27108
27109 !! test
27110 3b. Anchors: do not suppress numbered extlinks
27111 !! options
27112 parsoid={
27113 "modes": ["wt2wt"],
27114 "scrubWikitext": true,
27115 "changes": [
27116 [ "#x", "remove"]
27117 ]
27118 }
27119 !! wikitext
27120 [http://foo.com <span id="x">foo</span>]
27121 !! wikitext/edited
27122 [http://foo.com]
27123 !! end
27124
27125 !!test
27126 Normalizations should be restricted to edited content
27127 !!options
27128 parsoid={
27129 "modes": ["selser"],
27130 "scrubWikitext": true,
27131 "changes": [
27132 [ "h1", "before", "<i></i>"]
27133 ]
27134 }
27135 !!wikitext
27136 a
27137 = =
27138 b
27139 !!wikitext/edited
27140 a
27141 = =
27142 b
27143 !!end
27144
27145 !! test
27146 1. Multiple normalizations (html2wt)
27147 !! options
27148 parsoid={
27149 "modes": ["html2wt"],
27150 "scrubWikitext": true
27151 }
27152 !! html
27153 <h2><i></i></h2>
27154 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27155 </a><b><i></i></b>x</p>
27156 !! wikitext
27157
27158 [[foo]]
27159 x
27160
27161 !! end
27162
27163 !! test
27164 2. Multiple normalizations (selser)
27165 !! options
27166 parsoid={
27167 "modes": ["selser"],
27168 "scrubWikitext": true,
27169 "changes": [
27170 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27171 ]
27172 }
27173 !! wikitext
27174 <span id="x">foo</span>
27175 !! wikitext/edited
27176 <span id="x">foo</span>
27177
27178 x
27179 !! end
27180
27181 !! test
27182 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27183 !! options
27184 parsoid={
27185 "modes": ["html2wt"],
27186 "scrubWikitext": true
27187 }
27188 !! html/parsoid
27189 <p> hi</p>
27190 <p> hello</p>
27191 !! wikitext
27192 hi
27193
27194 hello
27195 !! end
27196
27197 !! test
27198 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27199 !! options
27200 parsoid=html2wt
27201 !! html/parsoid
27202 <p> hi</p>
27203 <p> hello</p>
27204 !! wikitext
27205 <nowiki> </nowiki>hi
27206
27207 <nowiki> </nowiki> hello
27208 !! end
27209
27210 !! test
27211 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27212 !! options
27213 parsoid={
27214 "modes": ["html2wt"],
27215 "scrubWikitext": true
27216 }
27217 !! html/parsoid
27218 <p>Foo
27219 bar
27220 baz</p>
27221
27222 <table><tr><td>Foo
27223 bar
27224 baz bang</td></tr></table>
27225
27226 <p><!--boo--> foo
27227 bar</p>
27228
27229 <p> foo
27230 bar<span>boo</span></p>
27231 !! wikitext
27232 Foo
27233 bar
27234 baz
27235
27236 {|
27237 |Foo
27238 bar
27239 baz bang
27240 |}
27241
27242 <!--boo-->foo
27243 bar
27244
27245 foo
27246 bar<span>boo</span>
27247 !! end
27248
27249 !! test
27250 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27251 !! options
27252 parsoid={
27253 "modes": ["selser"],
27254 "scrubWikitext": true,
27255 "changes": [
27256 [ "p", "html", " a\n b" ]
27257 ]
27258 }
27259 !! wikitext
27260 xyz
27261 !! wikitext/edited
27262 a
27263 b
27264 !! end
27265
27266 !! test
27267 1. New links that end in spaces
27268 !! options
27269 parsoid={
27270 "modes": ["html2wt"],
27271 "scrubWikitext": false
27272 }
27273 !! html/parsoid
27274 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27275 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27276 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27277 !! wikitext
27278 [[Berlin ]]<nowiki/>is the capital of Germany.
27279
27280 [[Foo ]]'''bar'''
27281
27282 [[Boston ]] is a city.
27283 !! end
27284
27285 !! test
27286 2. New links that end in spaces
27287 !! options
27288 parsoid={
27289 "modes": ["html2wt"],
27290 "scrubWikitext": true
27291 }
27292 !! html/parsoid
27293 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27294 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27295 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27296 !! wikitext
27297 [[Berlin]] is the capital of Germany.
27298
27299 [[Foo]] '''bar'''
27300
27301 [[Boston]] is a city.
27302 !! end
27303
27304 !! test
27305 1. Table cells with escapable prefixes
27306 !! options
27307 parsoid={
27308 "modes": ["html2wt"],
27309 "scrubWikitext": false
27310 }
27311 !! html
27312 <table>
27313 <tr><td>a</td></tr>
27314 <tr><td>-</td></tr>
27315 <tr><td>+</td></tr>
27316 </table>
27317 !! wikitext
27318 {|
27319 |a
27320 |-
27321 |<nowiki>-</nowiki>
27322 |-
27323 |<nowiki>+</nowiki>
27324 |}
27325 !! end
27326
27327 !! test
27328 2. Table cells with escapable prefixes
27329 !! options
27330 parsoid={
27331 "modes": ["html2wt"],
27332 "scrubWikitext": true
27333 }
27334 !! html
27335 <table>
27336 <tr><td>a</td></tr>
27337 <tr><td>-</td></tr>
27338 <tr><td>+</td></tr>
27339 </table>
27340 !! wikitext
27341 {|
27342 |a
27343 |-
27344 | -
27345 |-
27346 | +
27347 |}
27348 !! end
27349
27350 !! test
27351 3a. Table cells with escapable prefixes after edits
27352 !! options
27353 parsoid={
27354 "modes": ["selser"],
27355 "scrubWikitext": true,
27356 "changes": [
27357 [ "table tbody tr:first-child td:first-child", "remove"]
27358 ]
27359 }
27360 !! wikitext
27361 {|
27362 |a||-
27363 |}
27364 !! wikitext/edited
27365 {|
27366 | -
27367 |}
27368 !! end
27369
27370 !! test
27371 3b. Table cells with escapable prefixes after edits
27372 !! options
27373 parsoid={
27374 "modes": ["selser"],
27375 "scrubWikitext": true,
27376 "changes": [
27377 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27378 [ "#x", "remove" ]
27379 ]
27380 }
27381 !! wikitext
27382 {|
27383 |pqr
27384 |<span id="x">foo</span>+
27385 |}
27386 !! wikitext/edited
27387 {|
27388 | -
27389 | +
27390 |}
27391 !! end
27392
27393 # FIXME: This test will fail because
27394 # normalization doesn't realize that the id attribute
27395 # will eliminate the escapable scenario
27396 !! test
27397 4a. Table cells without escapable prefixes after edits
27398 !! options
27399 parsoid={
27400 "modes": ["selser"],
27401 "scrubWikitext": true,
27402 "changes": [
27403 [ "#x", "html", "-" ]
27404 ]
27405 }
27406 !! wikitext
27407 {|
27408 | id="x" |abcd
27409 |}
27410 !! wikitext/edited
27411 {|
27412 | id="x" |-
27413 |}
27414 !! end
27415
27416 ## This tests normalizer's ability to discriminate between
27417 ## cells having identical content.
27418 !! test
27419 4b. Table cells without escapable prefixes after edits
27420 !! options
27421 parsoid={
27422 "modes": ["selser"],
27423 "scrubWikitext": true,
27424 "changes": [
27425 [ "td", "html", "-" ]
27426 ]
27427 }
27428 !! wikitext
27429 {|
27430 |a||b
27431 |}
27432 !! wikitext/edited
27433 {|
27434 | -||-
27435 |}
27436 !! end
27437
27438 ## This tests normalizer's ability to not be tripped by
27439 ## comments (and whitespace)
27440 !! test
27441 4c. Table cells without escapable prefixes after edits
27442 !! options
27443 parsoid={
27444 "modes": ["selser"],
27445 "scrubWikitext": true,
27446 "changes": [
27447 [ "table tbody tr td:first-child", "remove" ]
27448 ]
27449 }
27450 !! wikitext
27451 {|
27452 |-
27453 <!--foo--> |a||-
27454 |}
27455 !! wikitext/edited
27456 {|
27457 |-
27458 <!--foo--> | -
27459 |}
27460 !! end
27461
27462 ## This tests normalizer's ability to handle HTML cells
27463 !! test
27464 4d. Table cells without escapable prefixes after edits
27465 !! options
27466 parsoid={
27467 "modes": ["selser"],
27468 "scrubWikitext": true,
27469 "changes": [
27470 [ "td", "html", "-" ]
27471 ]
27472 }
27473 !! wikitext
27474 <table>
27475 <tr><td>a</td></tr>
27476 </table>
27477 !! wikitext/edited
27478 <table>
27479 <tr><td>-</td></tr>
27480 </table>
27481 !! end
27482
27483 ## T111151 Remove font elements without attributes
27484 !! test
27485 5a. font tags without attributes should be dropped in scrubWikitext mode
27486 !! options
27487 parsoid={
27488 "modes": ["html2wt"],
27489 "scrubWikitext": true
27490 }
27491 !! html
27492 <font>foo</font>
27493 <font><font>bar</font></font>
27494 <font class="x">boo</font>
27495 !! wikitext
27496 foo
27497 bar
27498 <font class="x">boo</font>
27499 !! end
27500
27501 !! test
27502 5b. font tags should not be dropped without scrubWikitext being enabled
27503 !! options
27504 parsoid={
27505 "modes": ["html2wt"],
27506 "scrubWikitext": false
27507 }
27508 !! html
27509 <font>foo</font>
27510 !! wikitext
27511 <font>foo</font>
27512 !! end
27513
27514 !! test
27515 Escape nowiki DOM elements
27516 !! options
27517 parsoid=html2wt
27518 !! html/parsoid
27519 <nowiki><i>foo</i></nowiki>
27520 !! wikitext
27521 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27522 !! end
27523
27524 # This is meant to be an interim fix while we go about figuring out
27525 # how to not introduce these trailing <nowiki/>s in the first place.
27526 !! test
27527 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27528 !! options
27529 parsoid=html2wt
27530 !! html/parsoid
27531 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27532 y</p>
27533 <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>
27534 <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>
27535 !! wikitext
27536 x
27537 y
27538
27539 {{echo|
27540 1 = <nowiki/>}}
27541
27542 {{echo|
27543 1 = <nowiki/>
27544 }}
27545 !! end
27546
27547 # ---------------------------------------------------
27548 # End of tests spec'ing wikitext serialization norms |
27549 # ---------------------------------------------------
27550
27551 # T104032
27552 !! test
27553 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27554 !! options
27555 parsoid=html2wt
27556 !! html/parsoid
27557 a<p>b</p>
27558 <b>c</b><p>d</p>
27559 <table><tr>
27560 <td>a<p>b</p></td>
27561 <td><b>c</b><p>d</p></td>
27562 </tr></table>
27563 !! wikitext
27564 a
27565
27566 b
27567
27568 '''c'''
27569
27570 d
27571 {|
27572 |a
27573 b
27574 |'''c'''
27575 d
27576 |}
27577 !! end
27578
27579 # -----------------------------------------------------------------
27580 # End of section for Parsoid-only html2wt tests for serialization
27581 # of new content
27582 # -----------------------------------------------------------------
27583
27584 # -----------------------------------------------------------------
27585 # The following section of tests are primarily to spec behavior of
27586 # the selective serializer. All these tests have manual selser
27587 # changes. The automated selser changes for all tests handle the
27588 # wide variation of changes, but these tests here capture specs
27589 # deterministically.
27590 # ----------------------------------------------------------------
27591
27592 ## T90517
27593 !! test
27594 Selser: New comments should not be lost
27595 !! options
27596 parsoid={
27597 "modes": ["selser"],
27598 "changes": [
27599 [ "#a", "after", "<!--c1-->" ],
27600 [ "#b", "before", "<!--c2-->" ]
27601 ]
27602 }
27603 !! wikitext
27604 <span id="a">a</span>
27605
27606 <span id="b">b</span>
27607 !! wikitext/edited
27608 <span id="a">a</span><!--c1-->
27609
27610 <!--c2--><span id="b">b</span>
27611 !! end
27612
27613 ## T89383
27614 !! test
27615 Selser: Check for validity of DSR before using it
27616 !! options
27617 parsoid={
27618 "modes": ["selser"],
27619 "changes": [
27620 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27621 ]
27622 }
27623 !! wikitext
27624 <span id="a">a</span>
27625 !! wikitext/edited
27626 {{DISPLAYTITLE:foo}}
27627 <span id="a">a</span>
27628 !! end
27629
27630 !! test
27631 1. DOMDiff: Changes to <ref> content should be looked up using id
27632 !! options
27633 parsoid={
27634 "modes": ["selser"],
27635 "changes": [
27636 ["#X", "after", "bar"],
27637 ["#Y", "after", "baz"]
27638 ]
27639 }
27640 !! wikitext
27641 X <ref><span id="X">foo</span></ref>
27642 Y <ref name="a" />
27643 <references>
27644 <ref name="a"><span id="Y">foo</span></ref>
27645 </references>
27646 !! wikitext/edited
27647 X <ref><span id="X">foo</span>bar</ref>
27648 Y <ref name="a" />
27649 <references>
27650 <ref name="a"><span id="Y">foo</span>baz</ref>
27651 </references>
27652 !! end
27653
27654 !! test
27655 2. DOMDiff: Changes to <ref> content should be looked up using id
27656 !! options
27657 parsoid={
27658 "modes": ["selser"],
27659 "changes": [
27660 ["#Z", "after", "bar"]
27661 ]
27662 }
27663 !! wikitext
27664 A <ref>foo bar for a</ref>
27665 B <ref group="X" name="b" />
27666
27667 <references />
27668
27669 <references group="X">
27670 <ref name="b"><span id="Z">foo</span></ref>
27671 </references>
27672 !! wikitext/edited
27673 A <ref>foo bar for a</ref>
27674 B <ref group="X" name="b" />
27675
27676 <references />
27677
27678 <references group="X">
27679 <ref name="b"><span id="Z">foo</span>bar</ref>
27680 </references>
27681 !! end
27682
27683 !! test
27684 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27685 !! options
27686 parsoid={
27687 "modes": ["selser"],
27688 "changes": [
27689 [ "div:first-child", "text", "bar" ]
27690 ]
27691 }
27692 !! wikitext
27693 <div style="{{1x|color:red;}}%">foo</div>
27694 !! wikitext/edited
27695 <div style="{{1x|color:red;}}%">bar</div>
27696 !! end
27697
27698 !! test
27699 Empty LI (T49673)
27700 !! wikitext
27701 * a
27702 *
27703 *
27704 * b
27705 !! html/php+tidy
27706 <ul>
27707 <li>a</li>
27708 <li class="mw-empty-elt"></li>
27709 <li class="mw-empty-elt"></li>
27710 <li>b</li>
27711 </ul>
27712 !! end
27713
27714 !! test
27715 Thumbnail output
27716 !! wikitext
27717 [[File:Thumb.png|thumb]]
27718 !! html/php+tidy
27719 <div class="thumb tright">
27720 <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>
27721 <div class="thumbcaption">
27722 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27723 </div>
27724 </div>
27725 </div>
27726 !! end
27727
27728 !! test
27729 unclosed internal link XSS (T137264)
27730 !! wikitext
27731 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27732 !! html/php
27733 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27734 </p>
27735 !! html/parsoid
27736 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27737 !! end