Prevent unexpected }- in converter output
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 !! article
275 Template:CircularRef
276 !! text
277 <ref>{{CircularRef}}</ref>
278 !! endarticle
279
280 ###
281 ### Basic tests
282 ###
283 !! test
284 Blank input
285 !! wikitext
286 !! html
287 !! end
288
289 !! test
290 CircularRef
291 !! wikitext
292 {{CircularRef}}
293 <references />
294 !! html/parsoid
295 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
297 !! end
298
299 !! test
300 Simple paragraph
301 !! wikitext
302 This is a simple paragraph.
303 !! html
304 <p>This is a simple paragraph.
305 </p>
306 !! end
307
308 !! test
309 Paragraphs with extra newline spacing
310 !! wikitext
311 foo
312
313 bar
314
315
316 baz
317
318
319
320 booz
321 !! html
322 <p>foo
323 </p><p>bar
324 </p><p><br />
325 baz
326 </p><p><br />
327 </p><p>booz
328 </p>
329 !! end
330
331 !! test
332 Paragraphs with newline spacing with comment lines in between
333 !! wikitext
334 ----
335 a
336 <!--foo-->
337 b
338 ----
339 a
340 <!--foo--><!--More than 1 comment, still stripped-->
341 b
342 ----
343 a
344 <!--foo--> <!----> <!-- bar -->
345 b
346 ----
347 a
348 <!--foo-->
349
350 b
351 ----
352 a
353
354 <!--foo-->
355 b
356 ----
357 a
358 <!--foo-->
359
360
361 b
362 ----
363 a
364
365
366 <!--foo-->
367 b
368 ----
369 !! html
370 <hr />
371 <p>a
372 b
373 </p>
374 <hr />
375 <p>a
376 b
377 </p>
378 <hr />
379 <p>a
380 b
381 </p>
382 <hr />
383 <p>a
384 </p><p>b
385 </p>
386 <hr />
387 <p>a
388 </p><p>b
389 </p>
390 <hr />
391 <p>a
392 </p><p><br />
393 b
394 </p>
395 <hr />
396 <p>a
397 </p><p><br />
398 b
399 </p>
400 <hr />
401
402 !! end
403
404 !! test
405 Paragraphs with newline spacing with non-empty white-space lines in between
406 !! wikitext
407 ----
408 a
409
410 b
411 ----
412 a
413
414
415 b
416 ----
417 !! html
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
433 !! wikitext
434 ----
435 a
436 <!--foo-->
437 b
438 ----
439 a
440 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
441 b
442 ----
443 a
444
445 <!--foo-->
446 <!--bar-->
447 b
448 ----
449 a
450
451 <!--foo-->
452 <!--bar-->
453
454 b
455 ----
456 !! html
457 <hr />
458 <p>a
459 b
460 </p>
461 <hr />
462 <p>a
463 b
464 </p>
465 <hr />
466 <p>a
467 </p><p>b
468 </p>
469 <hr />
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 <hr />
475
476 !! end
477
478 !! test
479 Extra newlines: More paragraphs with indented comment
480 !! wikitext
481 a
482
483 <!--boo-->
484
485 b
486 !! html
487 <p>a
488 </p><p><br />
489 b
490 </p>
491 !!end
492
493 !! test
494 Extra newlines followed by heading
495 !! wikitext
496 a
497
498
499
500 =b=
501 [[a]]
502
503
504 =b=
505 !! html
506 <p>a
507 </p><p><br />
508 </p>
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p><p><br />
512 </p>
513 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
514
515 !! end
516
517 !! test
518 Extra newlines between heading and content are swallowed
519 !! wikitext
520 =b=
521
522
523
524 [[a]]
525 !! html
526 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
527 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
528 </p>
529 !! end
530
531 !! test
532 Heading with line break in nowiki
533 !! options
534 parsoid=wt2html
535 !! wikitext
536 == A <nowiki>B
537 C</nowiki> ==
538 !! html
539 <h2><span class="mw-headline" id="A_B.0AC">A B
540 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
541
542 !! html/parsoid
543 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
544 C</span> </h2>
545 !! end
546
547 !! test
548 Parsing an URL
549 !! wikitext
550 http://fr.wikipedia.org/wiki/🍺
551 <!-- EasterEgg we love beer, better be able be able to link to it -->
552 !! html
553 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
554 </p>
555 !! end
556
557 # Note that the html+tidy output removes the spaces after the <li>,
558 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
559 # This is an issue for all tests with lists. We intentionally do
560 # *not* add html+tidy clauses for these, as we don't want to
561 # document/test the broken behavior. (Parsoid matches the non-tidy
562 # output in these cases.)
563
564 !! test
565 Simple list
566 !! wikitext
567 * Item 1
568 * Item 2
569 !! html
570 <ul><li> Item 1</li>
571 <li> Item 2</li></ul>
572
573 !! end
574
575 !! test
576 Italics and bold
577 !! wikitext
578 * plain
579 * plain''italic''plain
580 * plain''italic''plain''italic''plain
581 * plain'''bold'''plain
582 * plain'''bold'''plain'''bold'''plain
583 * plain''italic''plain'''bold'''plain
584 * plain'''bold'''plain''italic''plain
585 * plain''italic'''bold-italic'''italic''plain
586 * plain'''bold''bold-italic''bold'''plain
587 * plain'''''bold-italic'''italic''plain
588 * plain'''''bold-italic''bold'''plain
589 * plain''italic'''bold-italic'''''plain
590 * plain'''bold''bold-italic'''''plain
591 * plain l'''italic''plain
592 * plain l''''bold''' plain
593 !! html
594 <ul><li> plain</li>
595 <li> plain<i>italic</i>plain</li>
596 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
597 <li> plain<b>bold</b>plain</li>
598 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
599 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
600 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
601 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
602 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
603 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
604 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
605 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
606 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
607 <li> plain l'<i>italic</i>plain</li>
608 <li> plain l'<b>bold</b> plain</li></ul>
609
610 !! end
611
612 # this example taken from the [[simple:Moon]] article (bug 47326)
613 !! test
614 Italics and possessives (1)
615 !! wikitext
616 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
617 !! html
618 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
619 </p>
620 !! end
621
622 # this example taken from [[en:Flaming Pie]] (bug 49926)
623 !! test
624 Italics and possessives (2)
625 !! wikitext
626 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
627 !! html
628 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
629 </p>
630 !! end
631
632 # this example taken from [[en:Dictionary]] (bug 49926)
633 !! test
634 Italics and possessives (3)
635 !! wikitext
636 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
637 !! html
638 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
639 </p>
640 !! end
641
642
643 ###
644 ### 2-quote opening sequence tests
645 ###
646 !! test
647 Italics and bold: 2-quote opening sequence: (2,2)
648 !! wikitext
649 ''foo''
650 !! html
651 <p><i>foo</i>
652 </p>
653 !!end
654
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,3)
657 !! wikitext
658 ''foo'''
659 !! html/*
660 <p><i>foo'</i>
661 </p>
662 !!end
663
664 !! test
665 Italics and bold: 2-quote opening sequence: (2,4)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''foo''''
670 !! html/*
671 <p><i>foo''</i>
672 </p>
673 !!end
674
675 # same html as previous, but wikitext adjusted to match parsoid html2wt
676 !! test
677 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
678 !! wikitext
679 ''foo<nowiki>''</nowiki>''
680 !! html
681 <p><i>foo''</i>
682 </p>
683 !! end
684
685 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
686 !! test
687 Italics and bold: 2-quote opening sequence: (2,5)
688 !! options
689 parsoid=wt2html
690 !! wikitext
691 ''foo'''''
692 !! html/php
693 <p><i>foo</i>
694 </p>
695 !! html/parsoid
696 <p><i>foo</i><b></b>
697 </p>
698 !!end
699
700 # same html as previous, but wikitext adjusted to match parsoid html2wt
701 !! test
702 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
703 !! wikitext
704 ''foo'''''<nowiki/>'''
705 !! html/php
706 <p><i>foo</i>
707 </p>
708 !! html/parsoid
709 <p><i>foo</i><b></b>
710 </p>
711 !! end
712
713
714 ###
715 ### 3-quote opening sequence tests
716 ###
717
718 !! test
719 Italics and bold: 3-quote opening sequence: (3,2)
720 !! wikitext
721 '''foo''
722 !! html/*
723 <p>'<i>foo</i>
724 </p>
725 !!end
726
727 !! test
728 Italics and bold: 3-quote opening sequence: (3,3)
729 !! wikitext
730 '''foo'''
731 !! html
732 <p><b>foo</b>
733 </p>
734 !!end
735
736 !! test
737 Italics and bold: 3-quote opening sequence: (3,4)
738 !! wikitext
739 '''foo''''
740 !! html/*
741 <p><b>foo'</b>
742 </p>
743 !!end
744
745 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
746 !! test
747 Italics and bold: 3-quote opening sequence: (3,5)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 '''foo'''''
752 !! html/php
753 <p><b>foo</b>
754 </p>
755 !! html/parsoid
756 <p><b>foo</b><i></i>
757 </p>
758 !!end
759
760 # same html as previous, but wikitext adjusted to match parsoid html2wt
761 !! test
762 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
763 !! wikitext
764 '''foo'''''<nowiki/>''
765 !! html/php
766 <p><b>foo</b>
767 </p>
768 !! html/parsoid
769 <p><b>foo</b><i></i>
770 </p>
771 !! end
772
773
774 ###
775 ### 4-quote opening sequence tests
776 ###
777
778 !! test
779 Italics and bold: 4-quote opening sequence: (4,2)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 ''''foo''
784 !! html/*
785 <p>''<i>foo</i>
786 </p>
787 !!end
788
789 # same html as previous, but wikitext adjusted to match parsoid html2wt
790 !! test
791 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
792 !! wikitext
793 <nowiki>''</nowiki>''foo''
794 !! html
795 <p>''<i>foo</i>
796 </p>
797 !! end
798
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,3)
801 !! wikitext
802 ''''foo'''
803 !! html/*
804 <p>'<b>foo</b>
805 </p>
806 !!end
807
808 !! test
809 Italics and bold: 4-quote opening sequence: (4,4)
810 !! options
811 parsoid=wt2html
812 !! wikitext
813 ''''foo''''
814 !! html/*
815 <p>'<b>foo'</b>
816 </p>
817 !!end
818
819 # same html as previous, but wikitext adjusted to match parsoid html2wt
820 !! test
821 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
822 !! wikitext
823 '<nowiki/>'''foo''''
824 !! html
825 <p>'<b>foo'</b>
826 </p>
827 !! end
828
829 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
830 !! test
831 Italics and bold: 4-quote opening sequence: (4,5)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 ''''foo'''''
836 !! html/php
837 <p>'<b>foo</b>
838 </p>
839 !! html/parsoid
840 <p>'<b>foo</b><i></i>
841 </p>
842 !!end
843
844 # same html as previous, but wikitext adjusted to match parsoid html2wt
845 !! test
846 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
847 !! wikitext
848 '<nowiki/>'''foo'''''<nowiki/>''
849 !! html/php
850 <p>'<b>foo</b>
851 </p>
852 !! html/parsoid
853 <p>'<b>foo</b><i></i>
854 </p>
855 !! end
856
857
858 ###
859 ### 5-quote opening sequence tests
860 ###
861
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,2)
864 !! options
865 parsoid=wt2html
866 !! wikitext
867 '''''foo''
868 !! html/*
869 <p><b><i>foo</i></b>
870 </p>
871 !!end
872
873 # same html as previous, but wikitext adjusted to match parsoid html2wt
874 !! test
875 Italics and bold: 5-quote opening sequence: (5,2+3)
876 !! wikitext
877 '''''foo'''''
878 !! html/*
879 <p><i><b>foo</b></i>
880 </p>
881 !! end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,3)
885 !! options
886 parsoid=wt2html
887 !! wikitext
888 '''''foo'''
889 !! html/*
890 <p><i><b>foo</b></i>
891 </p>
892 !!end
893
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: 5-quote opening sequence: (5,3+2)
897 !! wikitext
898 '''''foo'''''
899 !! html
900 <p><i><b>foo</b></i>
901 </p>
902 !! end
903
904 !! test
905 Italics and bold: 5-quote opening sequence: (5,4)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 '''''foo''''
910 !! html/*
911 <p><i><b>foo'</b></i>
912 </p>
913 !!end
914
915 !! test
916 Italics and bold: 5-quote opening sequence: (5,5)
917 !! wikitext
918 '''''foo'''''
919 !! html
920 <p><i><b>foo</b></i>
921 </p>
922 !!end
923
924 !! test
925 Italics and bold: 5-quote opening sequence: (5,6)
926 !! wikitext
927 '''''foo''''''
928 !! html/*
929 <p><i><b>foo'</b></i>
930 </p>
931 !! end
932
933 ###
934 ### multiple quote sequences in a line
935 ###
936 !! test
937 Italics and bold: multiple quote sequences: (2,4,2)
938 !! options
939 parsoid=wt2html
940 !! wikitext
941 ''foo''''bar''
942 !! html/*
943 <p><i>foo'<b>bar</b></i>
944 </p>
945 !!end
946
947
948 # same html as previous, but wikitext adjusted to match parsoid html2wt
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'''''
953 !! html
954 <p><i>foo'<b>bar</b></i>
955 </p>
956 !! end
957
958
959 !! test
960 Italics and bold: multiple quote sequences: (2,4,3)
961 !! options
962 parsoid=wt2html
963 !! wikitext
964 ''foo''''bar'''
965 !! html/*
966 <p><i>foo'<b>bar</b></i>
967 </p>
968 !!end
969
970
971 # same html as previous, but wikitext adjusted to match parsoid html2wt
972 !! test
973 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
974 !! wikitext
975 ''foo'<nowiki/>'''bar'''''
976 !! html
977 <p><i>foo'<b>bar</b></i>
978 </p>
979 !! end
980
981
982 !! test
983 Italics and bold: multiple quote sequences: (2,4,4)
984 !! options
985 parsoid=wt2html
986 !! wikitext
987 ''foo''''bar''''
988 !! html/*
989 <p><i>foo'<b>bar'</b></i>
990 </p>
991 !!end
992
993
994 # same html as previous, but wikitext adjusted to match parsoid html2wt
995 !! test
996 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
997 !! wikitext
998 ''foo'<nowiki/>'''bar'<nowiki/>'''''
999 !! html
1000 <p><i>foo'<b>bar'</b></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,2)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<i></i>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1023 !! options
1024 parsoid
1025 !! wikitext
1026 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1027 !! html/php
1028 <p><b>foo'</b>bar
1029 </p>
1030 !! html/parsoid
1031 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1032 </p>
1033 !! end
1034
1035
1036 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1037 !! test
1038 Italics and bold: multiple quote sequences: (3,4,3)
1039 !! options
1040 parsoid=wt2html
1041 !! wikitext
1042 '''foo''''bar'''
1043 !! html/php
1044 <p><b>foo'</b>bar
1045 </p>
1046 !! html/parsoid
1047 <p><b>foo'</b>bar<b></b>
1048 </p>
1049 !!end
1050
1051 # same html as previous, but wikitext adjusted to match parsoid html2wt
1052 !! test
1053 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1054 !! wikitext
1055 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1056 !! html/php
1057 <p><b>foo'</b>bar
1058 </p>
1059 !! html/parsoid
1060 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1061 </p>
1062 !! end
1063
1064 ###
1065 ### other quote tests
1066 ###
1067 !! test
1068 Italics and bold: other quote tests: (2,3,5)
1069 !! wikitext
1070 ''this is about '''foo's family'''''
1071 !! html
1072 <p><i>this is about <b>foo's family</b></i>
1073 </p>
1074 !!end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (2,(3,3),2)
1079 !! wikitext
1080 ''this is about '''foo's''' family''
1081 !! html
1082 <p><i>this is about <b>foo's</b> family</i>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,2,3,2)
1089 !! options
1090 parsoid=wt2html
1091 !! wikitext
1092 '''this is about ''foo'''s family''
1093 !! html/*
1094 <p><b>this is about <i>foo</i></b><i>s family</i>
1095 </p>
1096 !!end
1097
1098
1099 # same html as previous, but wikitext adjusted to match parsoid html2wt
1100 !! test
1101 Italics and bold: other quote tests: (3,2,3+2+2,2)
1102 !! wikitext
1103 '''this is about ''foo'''''<nowiki/>''s family''
1104 !! html
1105 <p><b>this is about <i>foo</i></b><i>s family</i>
1106 </p>
1107 !! end
1108
1109
1110 !! test
1111 Italics and bold: other quote tests: (3,2,3,3)
1112 !! wikitext
1113 '''this is about ''foo'''s family'''
1114 !! html/*
1115 <p>'<i>this is about </i>foo<b>s family</b>
1116 </p>
1117 !!end
1118
1119
1120 !! test
1121 Italics and bold: other quote tests: (3,(2,2),3)
1122 !! wikitext
1123 '''this is about ''foo's'' family'''
1124 !! html
1125 <p><b>this is about <i>foo's</i> family</b>
1126 </p>
1127 !!end
1128
1129
1130 !! test
1131 Italicized possessive
1132 !! wikitext
1133 The ''[[Main Page]]'''s talk page.
1134 !! html/php
1135 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1136 </p>
1137 !! html/parsoid
1138 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1139 !! end
1140
1141 !! test
1142 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1143 (Requires tidy for PHP parser output to be fixed up)
1144 !! options
1145 parsoid=wt2html,wt2wt
1146 !! wikitext
1147 {|
1148 !''a!!''b
1149 |''a||''b
1150 |}
1151 !! html/php+tidy
1152 <table>
1153 <tr>
1154 <th><i>a</i></th>
1155 <th><i>b</i></th>
1156 <td><i>a</i></td>
1157 <td><i>b</i></td>
1158 </tr>
1159 </table>
1160 !! html/parsoid
1161 <table>
1162 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1163 <td><i>a</i></td><td><i>b</i></td></tr>
1164 </tbody></table>
1165 !! end
1166
1167 ###
1168 ### Non-html5 tags
1169 ###
1170
1171 !! test
1172 Non-html5 tags should be accepted
1173 !! wikitext
1174 <center>''foo''</center>
1175 <big>''foo''</big>
1176 <font>''foo''</font>
1177 <strike>''foo''</strike>
1178 <tt>''foo''</tt>
1179 !! html
1180 <center><i>foo</i></center>
1181 <p><big><i>foo</i></big>
1182 <font><i>foo</i></font>
1183 <strike><i>foo</i></strike>
1184 <tt><i>foo</i></tt>
1185 </p>
1186 !! end
1187
1188 !! test
1189 <wbr> is valid wikitext (bug 52468)
1190 !! wikitext
1191 <wbr>
1192 !! html
1193 <p><wbr />
1194 </p>
1195 !! end
1196
1197 # <strike> is HTML4, <s> is HTML4/5.
1198 !! test
1199 <s> or <strike> for strikethrough
1200 !! wikitext
1201 <strike>strike</strike>
1202
1203 <s>s</s>
1204 !! html
1205 <p><strike>strike</strike>
1206 </p><p><s>s</s>
1207 </p>
1208 !! end
1209
1210 ## a not permitted
1211 ## i,b,br omitted
1212 !! test
1213 Text-level semantic html elements in wikitext
1214 !! wikitext
1215 <em>text</em>
1216 <strong>text</strong>
1217 <small>text</small>
1218 <s>text</s>
1219 <cite>text</cite>
1220 <q>text</q>
1221 <dfn>text</dfn>
1222 <abbr>text</abbr>
1223 <data>text</data>
1224 <time>text</time>
1225 <code>text</code>
1226 <var>text</var>
1227 <samp>text</samp>
1228 <kbd>text</kbd>
1229 <sub>text</sub>
1230 <u>text</u>
1231 <mark>text</mark>
1232 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1233 <bdi>text</bdi>
1234 <bdo>text</bdo>
1235 <span>text</span>
1236 <wbr />
1237 !! html
1238 <p><em>text</em>
1239 <strong>text</strong>
1240 <small>text</small>
1241 <s>text</s>
1242 <cite>text</cite>
1243 <q>text</q>
1244 <dfn>text</dfn>
1245 <abbr>text</abbr>
1246 <data>text</data>
1247 <time>text</time>
1248 <code>text</code>
1249 <var>text</var>
1250 <samp>text</samp>
1251 <kbd>text</kbd>
1252 <sub>text</sub>
1253 <u>text</u>
1254 <mark>text</mark>
1255 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1256 <bdi>text</bdi>
1257 <bdo>text</bdo>
1258 <span>text</span>
1259 <wbr />
1260 </p>
1261 !! end
1262
1263 # test cases taken from
1264 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1265 !! test
1266 Ruby markup (W3C-style)
1267 !! wikitext
1268 ; Mono-ruby for individual base characters
1269 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1270 ; Group ruby
1271 : <ruby>今日<rt>きょう</rt></ruby>
1272 ; Jukugo ruby
1273 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1274 ; Inline ruby
1275 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1276 ; Double-sided ruby
1277 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1278 <ruby>
1279 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1280 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1281 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1282 </ruby>
1283 !! html
1284 <dl><dt> Mono-ruby for individual base characters</dt>
1285 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1286 <dt> Group ruby</dt>
1287 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1288 <dt> Jukugo ruby</dt>
1289 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1290 <dt> Inline ruby</dt>
1291 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1292 <dt> Double-sided ruby</dt>
1293 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1294 <p><ruby>
1295 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1296 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1297 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1298 </ruby>
1299 </p>
1300 !! end
1301
1302 # The next two test different paths in the sanitizer.
1303 !! test
1304 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1305 !! wikitext
1306 <blockquote|>a</blockquote>
1307
1308 <b→> doesn't terminate </b→>
1309
1310 <bä> doesn't terminate </bä>
1311
1312 <boo> doesn't terminate </boo>
1313
1314 <s.foo> doesn't terminate </s.foo>
1315
1316 <sub-ID#1>
1317 !! html
1318 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1319 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1320 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1321 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1322 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1323 </p><p>&lt;sub-ID#1&gt;
1324 </p>
1325 !! end
1326
1327 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1328 # If the non-word-character tag made it through the sanitizer, tidy
1329 # would munge it up.
1330 !! test
1331 Non-word characters don't terminate tag names + tidy
1332 !! wikitext
1333 <blockquote|>a</blockquote>
1334
1335 <b→> doesn't terminate </b→>
1336
1337 <bä> doesn't terminate </bä>
1338
1339 <boo> doesn't terminate </boo>
1340
1341 <s.foo> doesn't terminate </s.foo>
1342
1343 <sub-ID#1>
1344 !! html+tidy
1345 <p>&lt;blockquote|&gt;a</p>
1346 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1347 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1348 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1349 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1350 <p>&lt;sub-ID#1&gt;</p>
1351 !! end
1352
1353 ###
1354 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1355 ### This checks that HTML5 tags (with non-word characters in the tag
1356 ### name) make it safely through the parser -- the Sanitizer will
1357 ### munge them later, as it should.
1358 ###
1359 !! test
1360 Non-word characters are valid in extension tags (T19663)
1361 !! wikitext
1362 <tåg>tåg</tåg>
1363 !! html/php
1364 <pre>
1365 'tåg'
1366 array (
1367 )
1368 </pre>
1369
1370 !! html/parsoid
1371 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1372 !! end
1373
1374 !! test
1375 Isolated close tags should be treated as literal text (bug 52760)
1376 !! options
1377 parsoid=wt2html
1378 !! wikitext
1379 </b>
1380
1381 <s.foo>s</s>
1382 !! html/php+tidy
1383 <p>&lt;s.foo&gt;s</p>
1384 !! html/parsoid
1385 <p>&lt;s.foo&gt;s</p>
1386 !! end
1387
1388 ###
1389 ### Special characters
1390 ###
1391
1392 !! test
1393 Bare pipe character (bug 52363)
1394 !! wikitext
1395 |
1396 !! html
1397 <p>|
1398 </p>
1399 !! end
1400
1401 !! test
1402 Bare pipe character from a template (bug 52363)
1403 !! wikitext
1404 {{pipe}}
1405 !! html
1406 <p>|
1407 </p>
1408 !! end
1409
1410 ###
1411 ### <nowiki> test cases
1412 ###
1413
1414 !! test
1415 <nowiki> unordered list
1416 !! wikitext
1417 <nowiki>* This is not an unordered list item.</nowiki>
1418 !! html/php
1419 <p>* This is not an unordered list item.
1420 </p>
1421 !! html/parsoid
1422 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1423 !! end
1424
1425 !! test
1426 <nowiki> spacing
1427 !! wikitext
1428 <nowiki>Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434 </nowiki>
1435 !! html/php
1436 <p>Lorem ipsum dolor
1437
1438 sed abit.
1439 sed nullum.
1440
1441 :and a colon
1442
1443 </p>
1444 !! html/parsoid
1445 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1446
1447 sed abit.
1448 sed nullum.
1449
1450 :and a colon
1451 </span></p>
1452 !! end
1453
1454 !! test
1455 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1456 !! wikitext
1457 <nowiki><span class="error"></nowiki>
1458 !! html/php
1459 <p>&lt;span class="error"&gt;
1460 </p>
1461 !! html/parsoid
1462 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1463 !! end
1464
1465 !! test
1466 nowiki 3
1467 !! wikitext
1468 :There is not nowiki.
1469 :There is <nowiki>nowiki</nowiki>.
1470
1471 #There is not nowiki.
1472 #There is <nowiki>nowiki</nowiki>.
1473
1474 *There is not nowiki.
1475 *There is <nowiki>nowiki</nowiki>.
1476 !! html/php
1477 <dl><dd>There is not nowiki.</dd>
1478 <dd>There is nowiki.</dd></dl>
1479 <ol><li>There is not nowiki.</li>
1480 <li>There is nowiki.</li></ol>
1481 <ul><li>There is not nowiki.</li>
1482 <li>There is nowiki.</li></ul>
1483
1484 !! html/parsoid
1485 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1486 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1487
1488 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1489 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1490
1491 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1492 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1493 !! end
1494
1495 !! test
1496 Entities inside <nowiki>
1497 !! wikitext
1498 <nowiki>&lt;</nowiki>
1499 !! html
1500 <p>&lt;
1501 </p>
1502 !! end
1503
1504 !! test
1505 Entities inside template parameters
1506 !! wikitext
1507 {{echo|&ndash;}}
1508 !! html/php+tidy
1509 <p>–</p>
1510 !! html/parsoid
1511 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1512 !! end
1513
1514 !! test
1515 Properly escape nowiki when combined with other wiki markup
1516 !! options
1517 parsoid=html2wt
1518 !! html/parsoid
1519 <p>* &lt;/nowiki&gt; tag</p>
1520 !! wikitext
1521 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1522 !! end
1523
1524 !! test
1525 T93824: Put escaped HTML tags inside nowiki
1526 !! options
1527 parsoid=html2wt
1528 !! html/parsoid
1529 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1530 !! wikitext
1531 <nowiki><h2>foo</h2></nowiki>
1532 !! end
1533
1534 !! test
1535 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1536 !! options
1537 parsoid=html2wt
1538 !! html/parsoid
1539 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1540 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1541 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1542 !! wikitext
1543 This text: L'[[Foo]]
1544 This text: L<nowiki>''</nowiki>[[Foo]]
1545 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1546 !! end
1547
1548 # This test fails because wikitext whitespace is not normalized before comparing.
1549 !! test
1550 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1555 </p>
1556 !! wikitext
1557 This text : L<nowiki>''</nowiki>[[Foo]]
1558 !! end
1559
1560 # This test and the next one are html2wt only as they test that incorrect wikitext
1561 # passed in template arguments gets escaped or wrapped in nowikis where required.
1562 !! test
1563 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1564 !! options
1565 parsoid=html2wt
1566 !! html/parsoid
1567 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1568 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1569 !! wikitext
1570 {{echo|foo{{!}}bar}}
1571 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1572 !! end
1573
1574 !! test
1575 T53961: Output correct nowikis in template arguments
1576 !! options
1577 parsoid=html2wt
1578 !! html/parsoid
1579 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1580 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1581 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1582 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1583 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1584 !! wikitext
1585 {{echo|a [ b}}
1586 {{echo|<nowiki>a }} b</nowiki>}}
1587 {{echo|<nowiki>a [[ b</nowiki>}}
1588 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1589 {{echo|a <nowiki>}</nowiki>}}
1590 !! end
1591
1592 !! test
1593 Cases where "!!" needs nowiki protection
1594 !! options
1595 parsoid=html2wt
1596 !! html/parsoid
1597 <table>
1598 <tr><th>this needs protection !! here</th></tr>
1599 </table>
1600
1601 <table>
1602 <tr><th>this does not need
1603 protection !! here</th></tr>
1604 </table>
1605 !! wikitext
1606 {|
1607 !<nowiki>this needs protection !! here</nowiki>
1608 |}
1609
1610 {|
1611 !this does not need
1612 protection !! here
1613 |}
1614 !! end
1615
1616 ###
1617 ### Comments
1618 ###
1619 !! test
1620 Comments and Indent-Pre
1621 !! wikitext
1622 <!-- comment 1 --> asdf
1623
1624 <!-- comment 1 --> asdf
1625 <!-- comment 2 -->
1626
1627 <!-- comment 1 --> asdf
1628 <!-- comment 2 -->xyz
1629
1630 <!-- comment 1 --> asdf
1631 <!-- comment 2 --> xyz
1632 !! html
1633 <pre>asdf
1634 </pre>
1635 <pre>asdf
1636 </pre>
1637 <pre>asdf
1638 </pre>
1639 <p>xyz
1640 </p>
1641 <pre>asdf
1642 xyz
1643 </pre>
1644 !! end
1645
1646 !! test
1647 Comment test 2a
1648 !! wikitext
1649 asdf
1650 <!-- comment 1 -->
1651 jkl
1652 !! html
1653 <p>asdf
1654 jkl
1655 </p>
1656 !! end
1657
1658 !! test
1659 Comment test 2b
1660 !! wikitext
1661 asdf
1662 <!-- comment 1 -->
1663
1664 jkl
1665 !! html
1666 <p>asdf
1667 </p><p>jkl
1668 </p>
1669 !! end
1670
1671 !! test
1672 Comment test 3
1673 !! wikitext
1674 asdf
1675 <!-- comment 1 -->
1676 <!-- comment 2 -->
1677 jkl
1678 !! html
1679 <p>asdf
1680 jkl
1681 </p>
1682 !! end
1683
1684 !! test
1685 Comment test 4
1686 !! wikitext
1687 asdf<!-- comment 1 -->jkl
1688 !! html
1689 <p>asdfjkl
1690 </p>
1691 !! end
1692
1693 !! test
1694 Comment spacing
1695 !! wikitext
1696 a
1697 <!-- foo --> b <!-- bar -->
1698 c
1699 !! html
1700 <p>a
1701 </p>
1702 <pre> b
1703 </pre>
1704 <p>c
1705 </p>
1706 !! end
1707
1708 !! test
1709 Comment whitespace
1710 !! wikitext
1711 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1712 !! html
1713
1714 !! end
1715
1716 !! test
1717 Comment semantics and delimiters
1718 !! wikitext
1719 <!-- --><!----><!-----><!------>
1720 !! html/php
1721
1722 !! html/parsoid
1723 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1724 !! end
1725
1726 !! test
1727 Comment semantics and delimiters, redux
1728 !! wikitext
1729 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1730 -- foo -- funky huh? ... -->
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1735 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1736 !! end
1737
1738 !! test
1739 Comment semantics and delimiters: directors cut
1740 !! wikitext
1741 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1742 everything starting with < followed by !-- until the first -- and > we see,
1743 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1744 -->-->
1745 !! html/php
1746 <p>--&gt;
1747 </p>
1748 !! html/parsoid
1749 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1750 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1751 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1752 --><p>--></p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: nesting
1757 !! wikitext
1758 <!--<!-- no, we're not going to do anything fancy here -->-->
1759 !! html/php
1760 <p>--&gt;
1761 </p>
1762 !! html/parsoid
1763 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1764 !! end
1765
1766 # Parsoid closes the unclosed comment, even if it means a slight
1767 # round-trip diff.
1768 !! test
1769 Comment semantics: unclosed comment at end
1770 !! options
1771 parsoid=wt2html,html2html
1772 !! wikitext
1773 <!--This comment will run out to the end of the document
1774 !! html/php
1775
1776 !! html/parsoid
1777 <!--This comment will run out to the end of the document-->
1778 !! end
1779
1780 !! test
1781 Comment semantics: normalize comments to play nice with XML and browsers
1782 !! wikitext
1783 <!-- Browsers --!> think this is closed -->
1784 <!--> This would normally be text -->
1785 <!---> As would this -->
1786 <!-- XML doesn't like trailing dashes -------->
1787 <!-- Nor doubled hyphens -- anywhere in the data -->
1788 But this is not a comment.
1789 !! html/php
1790 <p>But this is not a comment.
1791 </p>
1792 !! html/parsoid
1793 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1794 <!--&#x3E; This would normally be text -->
1795 <!--&#x2D;&#x3E; As would this -->
1796 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1797 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1798 <p>But this is not a comment.</p>
1799 !! end
1800
1801 !! test
1802 Comment semantics: round-trip even text which contains encoded -->
1803 !! wikitext
1804 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1805 !! html/parsoid
1806 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1807 !! end
1808
1809 !! test
1810 Comment in template title
1811 !! wikitext
1812 {{f<!---->oo}}
1813 !! html
1814 <p>FOO
1815 </p>
1816 !! end
1817
1818 !! test
1819 Comment on its own line post-expand
1820 !! wikitext
1821 a
1822 {{blank}}<!---->
1823 b
1824 !! html
1825 <p>a
1826 </p><p>b
1827 </p>
1828 !! end
1829
1830 !! test
1831 Comment on its own line post-expand with non-significant whitespace
1832 !! wikitext
1833 a
1834 {{blank}} <!---->
1835 b
1836 !! html
1837 <p>a
1838 </p><p>b
1839 </p>
1840 !! end
1841
1842 !! test
1843 Multiple comments should still parse as SOL-transparent
1844 !! options
1845 parsoid=wt2html,wt2wt
1846 !! wikitext
1847 <!--c1-->*a
1848 <!--c2--><!--c3--><!--c4-->*b
1849 !! html/php
1850 <ul><li>a</li>
1851 <li>b</li></ul>
1852
1853 !! html/parsoid
1854 <!--c1--><ul>
1855 <li>a
1856 </li>
1857 <!--c2--><!--c3--><!--c4-->
1858 <li>b
1859 </li>
1860 </ul>
1861 !! end
1862
1863 ###
1864 ### paragraph wrapping tests
1865 ###
1866 !! test
1867 No block tags
1868 !! wikitext
1869 a
1870
1871 b
1872 !! html
1873 <p>a
1874 </p><p>b
1875 </p>
1876 !! end
1877
1878 !! test
1879 Block tag on one line (<div>)
1880 !! wikitext
1881 a <div>foo</div>
1882
1883 b
1884 !! html
1885 a <div>foo</div>
1886 <p>b
1887 </p>
1888 !! html+tidy
1889 <p>a</p>
1890 <div>foo</div>
1891 <p>b</p>
1892 !! end
1893
1894 !! test
1895 Block tag on one line (<blockquote>)
1896 !! wikitext
1897 a <blockquote>foo</blockquote>
1898
1899 b
1900 !! html
1901 a <blockquote>foo</blockquote>
1902 <p>b
1903 </p>
1904 !! html+tidy
1905 <p>a</p>
1906 <blockquote>
1907 <p>foo</p>
1908 </blockquote>
1909 <p>b</p>
1910 !! end
1911
1912 !! test
1913 Block tag on both lines (<div>)
1914 !! wikitext
1915 a <div>foo</div>
1916
1917 b <div>foo</div>
1918 !! html
1919 a <div>foo</div>
1920 b <div>foo</div>
1921
1922 !! html+tidy
1923 <p>a</p>
1924 <div>foo</div>
1925 <p>b</p>
1926 <div>foo</div>
1927 !! end
1928
1929 !! test
1930 Block tag on both lines (<blockquote>)
1931 !! wikitext
1932 a <blockquote>foo</blockquote>
1933
1934 b <blockquote>foo</blockquote>
1935 !! html
1936 a <blockquote>foo</blockquote>
1937 b <blockquote>foo</blockquote>
1938
1939 !! html+tidy
1940 <p>a</p>
1941 <blockquote>
1942 <p>foo</p>
1943 </blockquote>
1944 <p>b</p>
1945 <blockquote>
1946 <p>foo</p>
1947 </blockquote>
1948 !! end
1949
1950 !! test
1951 Multiple lines without block tags
1952 !! wikitext
1953 <div>foo</div> a
1954 b
1955 c
1956 d<!--foo--> e
1957 x <div>foo</div> z
1958 !! html
1959 <div>foo</div> a
1960 <p>b
1961 c
1962 d e
1963 </p>
1964 x <div>foo</div> z
1965
1966 !! html+tidy
1967 <div>foo</div>
1968 <p>a</p>
1969 <p>b c d e</p>
1970 <p>x</p>
1971 <div>foo</div>
1972 <p>z</p>
1973 !! end
1974
1975 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1976 # So, we have a separate section for Parsoid. We don't want
1977 # to mimic this stripping behavior in Parsoid. It affects
1978 # editing experience and also requires us to maintain additional
1979 # info for RT-ing.
1980 !! test
1981 Empty lines between lines with block tags
1982 !! wikitext
1983 <div></div>
1984
1985
1986 <div></div>a
1987
1988 b
1989 <div>a</div>b
1990
1991 <div>b</div>d
1992
1993
1994 <div>e</div>
1995 !! html
1996 <div></div>
1997 <p><br />
1998 </p>
1999 <div></div>a
2000 <p>b
2001 </p>
2002 <div>a</div>b
2003 <div>b</div>d
2004 <p><br />
2005 </p>
2006 <div>e</div>
2007
2008 !! html+tidy
2009 <p><br /></p>
2010 <p>a</p>
2011 <p>b</p>
2012 <div>a</div>
2013 <p>b</p>
2014 <div>b</div>
2015 <p>d</p>
2016 <p><br /></p>
2017 <div>e</div>
2018 !! html/parsoid
2019 <div data-parsoid='{"stx":"html"}'></div>
2020
2021 <p><br /></p>
2022 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2023
2024 <p>b</p>
2025 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2026
2027 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2028
2029 <p><br /></p>
2030 <div data-parsoid='{"stx":"html"}'>e</div>
2031 !! end
2032
2033 ## PHP parser emits output which is broken
2034 !! test
2035 Unclosed HTML p-tags should be handled properly
2036 !! wikitext
2037 <div><p>foo</div>
2038 a
2039
2040 b
2041 !! html/php+tidy
2042 <div>
2043 <p>foo</p>
2044 </div>
2045 <p>a</p>
2046 <p>b</p>
2047 !! html/parsoid
2048 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2049 <p>a</p>
2050 <p>b</p>
2051 !! end
2052
2053 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2054 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2055 ## them for now.
2056 !! test
2057 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2058 !! options
2059 parsoid=wt2html
2060 !! wikitext
2061 a [[Category:A1]] [[Category:A2]]
2062 [[Category:A3]]
2063 [[Category:A4]]
2064 !! html/parsoid
2065 <p>a</p>
2066 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2067 !! end
2068
2069 !! test
2070 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2071 !! options
2072 parsoid=wt2html
2073 !! wikitext
2074 [[Category:A1]]a
2075 !! html/parsoid
2076 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2077 !! end
2078
2079 ###
2080 ### Preformatted text
2081 ###
2082 !! test
2083 Preformatted text
2084 !! wikitext
2085 This is some
2086 Preformatted text
2087 With ''italic''
2088 And '''bold'''
2089 And a [[Main Page|link]]
2090 !! html
2091 <pre>This is some
2092 Preformatted text
2093 With <i>italic</i>
2094 And <b>bold</b>
2095 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 Tabs don't trigger preformatted text
2101 !! wikitext
2102 This is not
2103 preformatted text.
2104 This is preformatted text.
2105 So is this.
2106 !! html/php
2107 <p> This is not
2108 preformatted text.
2109 </p>
2110 <pre>This is preformatted text.
2111 So is this.
2112 </pre>
2113 !! html/parsoid
2114 <p> This is not
2115 preformatted text.</p>
2116 <pre>This is preformatted text.
2117 So is this.</pre>
2118 !! end
2119
2120 !! test
2121 Space before tab needs nowiki pre protection
2122 !! options
2123 parsoid=html2wt
2124 !! html/parsoid
2125 <p> a</p>
2126 !! wikitext
2127 <nowiki> </nowiki> a
2128 !! end
2129
2130 !! test
2131 Ident preformatting with inline content
2132 !! wikitext
2133 a
2134 ''b''
2135 !! html
2136 <pre>a
2137 <i>b</i>
2138 </pre>
2139 !! end
2140
2141 !! test
2142 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2143 !! wikitext
2144 <pre><nowiki>
2145 <b>
2146 <cite>
2147 <em>
2148 </nowiki></pre>
2149 !! html
2150 <pre>
2151 &lt;b&gt;
2152 &lt;cite&gt;
2153 &lt;em&gt;
2154 </pre>
2155
2156 !! end
2157
2158 !! test
2159 Regression with preformatted in <center>
2160 !! wikitext
2161 <center>
2162 Blah
2163 </center>
2164 !! html
2165 <center>
2166 <pre>Blah
2167 </pre>
2168 </center>
2169
2170 !! end
2171
2172 !! test
2173 Bug 52763: Preformatted in <blockquote>
2174 !! wikitext
2175 <blockquote>
2176 Blah
2177 {|
2178 |
2179 indented cell (no pre-wrapping!)
2180 |}
2181 </blockquote>
2182 !! html
2183 <blockquote>
2184 <p> Blah
2185 </p>
2186 <table>
2187 <tr>
2188 <td>
2189 <p> indented cell (no pre-wrapping!)
2190 </p>
2191 </td></tr></table>
2192 </blockquote>
2193
2194 !! end
2195
2196 !! test
2197 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2198 !! wikitext
2199 <blockquote>
2200 Foo
2201
2202 Bar
2203 </blockquote>
2204 !! html
2205 <blockquote>
2206 <p>Foo
2207 </p><p>Bar
2208 </p>
2209 </blockquote>
2210
2211 !! end
2212
2213 !! test
2214 Bug 15491: <ins>/<del> in blockquote
2215 !! wikitext
2216 <blockquote>
2217 Foo <del>bar</del> <ins>baz</ins> quux
2218 </blockquote>
2219 !! html
2220 <blockquote>
2221 <p>Foo <del>bar</del> <ins>baz</ins> quux
2222 </p>
2223 </blockquote>
2224
2225 !! end
2226
2227 # Note that the p-wrapping is newline sensitive, which could be
2228 # considered a bug: tidy will wrap only the 'Foo' in the example
2229 # below in a <p> tag. (see comment 23-25 of bug #6200)
2230 !! test
2231 Bug 15491: <ins>/<del> in blockquote (2)
2232 !! wikitext
2233 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2234 </blockquote>
2235 !! html
2236 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2237 </blockquote>
2238
2239 !! html+tidy
2240 <blockquote>
2241 <p>Foo</p>
2242 <del>bar</del> <ins>baz</ins> quux</blockquote>
2243 !! end
2244
2245 !! test
2246 <pre> with attributes (bug 3202)
2247 !! wikitext
2248 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2249 !! html
2250 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2251
2252 !! end
2253
2254 !! test
2255 <pre> with width attribute (bug 3202)
2256 !! wikitext
2257 <pre width="8">Narrow screen goodies</pre>
2258 !! html
2259 <pre width="8">Narrow screen goodies</pre>
2260
2261 !! end
2262
2263 !! test
2264 <pre> with forbidden attribute (bug 3202)
2265 !! wikitext
2266 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2267 !! html
2268 <pre width="8">Narrow screen goodies</pre>
2269
2270 !! end
2271
2272 !! test
2273 Entities inside <pre>
2274 !! wikitext
2275 <pre>&lt;</pre>
2276 !! html
2277 <pre>&lt;</pre>
2278
2279 !! end
2280
2281 !! test
2282 <pre> with forbidden attribute values (bug 3202)
2283 !! wikitext
2284 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2285 !! html
2286 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2287
2288 !! end
2289
2290 !! test
2291 <nowiki> inside <pre> (bug 13238)
2292 !! wikitext
2293 <pre>
2294 <nowiki>
2295 </pre>
2296 <pre>
2297 <nowiki></nowiki>
2298 </pre>
2299 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2300 !! html
2301 <pre>
2302 &lt;nowiki&gt;
2303 </pre>
2304 <pre>
2305
2306 </pre>
2307 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2308
2309 !! end
2310
2311 !! test
2312 <nowiki> inside of #tag:pre
2313 !! wikitext
2314 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2315 !! html/php
2316 <pre>Foo &#8594;bar</pre>
2317
2318 !! html/parsoid
2319 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2320 !! end
2321
2322 !! test
2323 <nowiki> and <pre> preference (first one wins)
2324 !! wikitext
2325 <pre>
2326 <nowiki>
2327 </pre>
2328 </nowiki>
2329 </pre>
2330
2331 <nowiki>
2332 <pre>
2333 <nowiki>
2334 </pre>
2335 </nowiki>
2336 </pre>
2337
2338 !! html/php
2339 <pre>
2340 &lt;nowiki&gt;
2341 </pre>
2342 <p>&lt;/nowiki&gt;
2343 &lt;/pre&gt;
2344 </p><p>
2345 &lt;pre&gt;
2346 &lt;nowiki&gt;
2347 &lt;/pre&gt;
2348
2349 &lt;/pre&gt;
2350 </p>
2351 !! html/parsoid
2352 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2353 </pre>
2354 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2355 &lt;/pre></p>
2356
2357 <p><span typeof="mw:Nowiki">
2358 &lt;pre>
2359 &lt;nowiki>
2360 &lt;/pre>
2361 </span>
2362 &lt;/pre></p>
2363 !! end
2364
2365 !! test
2366 </pre> inside nowiki
2367 !! wikitext
2368 <nowiki></pre></nowiki>
2369 !! html
2370 <p>&lt;/pre&gt;
2371 </p>
2372 !! end
2373
2374 # Parsoid doesn't strip empty tags, like Tidy does.
2375 !! test
2376 Empty pre; pre inside other HTML tags (bug 54946)
2377 !! options
2378 parsoid=wt2html,wt2wt
2379 !! wikitext
2380 a
2381
2382 <div><pre>
2383 foo
2384 </pre></div>
2385 <pre></pre>
2386 !! html/php
2387 <p>a
2388 </p>
2389 <div><pre>
2390 foo
2391 </pre></div>
2392 <pre></pre>
2393
2394 !! html/php+tidy
2395 <p>a</p>
2396 <div>
2397 <pre>
2398 foo
2399 </pre></div>
2400 !! html/parsoid
2401 <p>a</p>
2402
2403 <div><pre>foo
2404 </pre></div>
2405 <pre></pre>
2406 !! end
2407
2408 !! test
2409 HTML pre followed by indent-pre
2410 !! wikitext
2411 <pre>foo</pre>
2412 bar
2413 !! html
2414 <pre>foo</pre>
2415 <pre>bar
2416 </pre>
2417 !! end
2418
2419 # Note that tidy removes the empty <p> tags from the start and end.
2420 # Parsoid does not, by design.
2421 !!test
2422 Block tag pre
2423 !! wikitext
2424 <p><pre>foo</pre></p>
2425 !! html/php+tidy
2426 <pre>
2427 foo
2428 </pre>
2429 !! html/parsoid
2430 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2431 !!end
2432
2433 !!test
2434 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2435 !! wikitext
2436 {{echo|}}
2437 !! html
2438
2439 !!end
2440
2441 !!test
2442 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2443 !! wikitext
2444 {{echo|
2445 foo}}
2446 !! html
2447 <p>foo
2448 </p>
2449 !!end
2450
2451 !! test
2452 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2453 !! wikitext
2454 {{echo|a
2455 b}}
2456 !! html
2457 <pre>a
2458 </pre>
2459 <p>b
2460 </p>
2461 !!end
2462
2463 !! test
2464 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2465 !! wikitext
2466 {{echo|a
2467 b
2468 c
2469 d
2470 e
2471 }}
2472 !! html
2473 <pre>a
2474 </pre>
2475 <p>b
2476 c
2477 </p>
2478 <pre>d
2479 </pre>
2480 <p>e
2481 </p>
2482 !!end
2483
2484 !!test
2485 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2486 !! wikitext
2487 {{echo| foo}}
2488
2489 {{echo| foo}}{{echo| bar}}
2490
2491 {{echo| foo}}
2492 {{echo| bar}}
2493
2494 {{echo|<!--cmt--> foo}}
2495
2496 <!--cmt-->{{echo| foo}}
2497
2498 {{echo|{{echo| }}bar}}
2499 !! html
2500 <pre>foo
2501 </pre>
2502 <pre>foo bar
2503 </pre>
2504 <pre>foo
2505 bar
2506 </pre>
2507 <pre>foo
2508 </pre>
2509 <pre>foo
2510 </pre>
2511 <pre>bar
2512 </pre>
2513 !!end
2514
2515 !! test
2516 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2517 !! wikitext
2518 {{echo| }}a
2519
2520 {{echo|
2521 }}a
2522
2523 {{echo|
2524 b}}
2525
2526 {{echo|a
2527 }}b
2528
2529 {{echo|a
2530 }} b
2531 !! html
2532 <pre>a
2533 </pre>
2534 <p><br />
2535 </p>
2536 <pre>a
2537 </pre>
2538 <p><br />
2539 </p>
2540 <pre>b
2541 </pre>
2542 <p>a
2543 </p>
2544 <pre>b
2545 </pre>
2546 <p>a
2547 </p>
2548 <pre>b
2549 </pre>
2550 !!end
2551
2552 !! test
2553 Pres with newline attributes
2554 !! wikitext
2555 <pre class="one
2556 two">hi</pre>
2557 !! html/php
2558 <pre class="one two">hi</pre>
2559
2560 !! html/parsoid
2561 <pre class="one
2562 two" data-parsoid='{"stx":"html"}'>hi</pre>
2563 !! end
2564
2565 !! test
2566 Things that look like <pre> tags aren't treated as such
2567 !! wikitext
2568 Barack Obama <President> of the United States
2569 <President></President>
2570 !! html
2571 <p>Barack Obama &lt;President&gt; of the United States
2572 &lt;President&gt;&lt;/President&gt;
2573 </p>
2574 !! end
2575
2576 !! test
2577 Handle broken pre-like tags (bug 64025)
2578 !! options
2579 parsoid=wt2html
2580 !! wikitext
2581 {{echo|<pre <pre>x</pre>}}
2582
2583 <table><pre </table>
2584 !! html/php
2585 <pre>x</pre>
2586 <table>&lt;pre </table>
2587
2588 !! html/php+tidy
2589 <pre>
2590 x
2591 </pre>
2592 <p>&lt;pre</p>
2593 !! html/parsoid
2594 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2595
2596
2597 <p>&lt;pre </p>
2598
2599 <table></table>
2600 !! end
2601
2602 !! test
2603 Parsoid: handle pre with space after attribute
2604 !! options
2605 parsoid=wt2html
2606 !! wikitext
2607 <pre style="width:50%;" >{{echo|foo}}</pre>
2608 !! html/php
2609 <pre style="width:50%;">{{echo|foo}}</pre>
2610
2611 !! html/parsoid
2612 <pre style="width:50%;">{{echo|foo}}</pre>
2613 !! end
2614
2615 # TODO / maybe: fix wt2wt for this
2616 !! test
2617 Parsoid: Don't paragraph-wrap fosterable content
2618 !! options
2619 parsoid=wt2html
2620 !! wikitext
2621 {|
2622 <td></td>
2623 <td></td>
2624
2625
2626
2627 |}
2628 !! html
2629 <table>
2630
2631 <tbody>
2632 <tr>
2633 <td></td>
2634
2635 <td></td></tr>
2636
2637
2638
2639 </tbody></table>
2640 !! end
2641
2642 !! test
2643 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2644 !! options
2645 parsoid=wt2html
2646 !! wikitext
2647 {|
2648 <td>
2649 <td>
2650 </td>
2651
2652
2653
2654 |}
2655 !! html
2656 <table>
2657
2658 <tbody>
2659 <tr>
2660 <td></td>
2661
2662 <td>
2663 </td></tr>
2664
2665
2666
2667 </tbody></table>
2668 !! end
2669
2670
2671 #--------------------------------------------------------------------
2672 # Transclusion parameter whitespace stripping tests
2673 # Behavior is different for positional and named parameters
2674 #--------------------------------------------------------------------
2675 !! test
2676 Templates: Strip leading and trailing whitespace from named-param values
2677 !! wikitext
2678 {{echo|1= a }}
2679
2680 {{echo|1= {{echo|b}} }}
2681
2682 {{echo| 1 =
2683 c }}
2684
2685 {{echo| 1 =
2686 * d
2687 }}
2688 !! html
2689 <p>a
2690 </p><p>b
2691 </p><p>c
2692 </p>
2693 <ul><li> d</li></ul>
2694
2695 !! end
2696
2697 !! test
2698 Templates: Don't strip whitespace from positional-param values
2699 !! wikitext
2700 {{echo|a }}
2701
2702 {{echo|{{echo|b}} }}
2703
2704 {{echo| c
2705 }}
2706
2707 {{echo| {{echo|d}}
2708 }}
2709
2710 {{echo|
2711 e}}
2712
2713 {{echo|
2714 * f}}
2715
2716 {{echo|
2717 }}g
2718 !! html
2719 <p>a
2720 </p><p>b
2721 </p>
2722 <pre>c
2723 </pre>
2724 <p><br />
2725 </p>
2726 <pre>d
2727 </pre>
2728 <p><br />
2729 </p>
2730 <pre>e
2731 </pre>
2732 <p><br />
2733 </p>
2734 <ul><li> f</li></ul>
2735 <p><br />
2736 </p>
2737 <pre>g
2738 </pre>
2739 !! end
2740
2741 !! test
2742 Templates: Handle empty comment-and-ws-only lines correctly
2743 !! wikitext
2744 {{echo|foo
2745 <!--should be ignored-->
2746 <!--should be ignored as well-->
2747 bar}}
2748 !! html/php
2749 <p>foo
2750 bar
2751 </p>
2752 !! html/parsoid
2753 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2754 !! end
2755
2756 !! test
2757 Templates: Handle comments in the target
2758 !! wikitext
2759 {{echo
2760 <!-- should be ignored -->
2761 |foo}}
2762
2763 {{echo
2764 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2765 |foo}}
2766
2767 {{echo<!-- should be ignored -->
2768 |foo}}
2769
2770 {{echo<!-- should be ignored -->|foo}}
2771
2772 {{<!-- should be ignored -->echo|foo}}
2773 !! html/php
2774 <p>foo
2775 </p><p>foo
2776 </p><p>foo
2777 </p><p>foo
2778 </p><p>foo
2779 </p>
2780 !! html/parsoid
2781 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2782
2783 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2784
2785 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2786
2787 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2788
2789 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2790 !!end
2791
2792 !! test
2793 Templates: Handle comments in parameter names (bug 67657)
2794 !! wikitext
2795 {{echo|1
2796 <!-- should be ignored -->
2797 =foo}}
2798
2799 {{echo|
2800 <!-- should be ignored -->
2801 1 = foo}}
2802
2803 {{echo|1<!-- should be ignored -->=foo}}
2804
2805 {{echo|<!-- should be ignored -->1=foo}}
2806 !! html/php
2807 <p>foo
2808 </p><p>foo
2809 </p><p>foo
2810 </p><p>foo
2811 </p>
2812 !! html/parsoid
2813 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2814
2815 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2816
2817 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2818
2819 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2820 !!end
2821
2822 !! test
2823 Templates: Other wikitext in parameter names (bug 67657)
2824 !! wikitext
2825 {{echo|''1''=foo}}
2826 !! html/php
2827 <p>{{{1}}}
2828 </p>
2829 !! html/parsoid
2830 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2831 !!end
2832
2833 #--------------------------------------------------------------------
2834 # Transclusion parameter escaping tests
2835 #--------------------------------------------------------------------
2836 !! test
2837 Templates: Parsoid parameter escaping test 1
2838 !! wikitext
2839 {{echo|[foo]|{{echo|[bar]}}}}
2840 !! html/php+tidy
2841 <p>[foo]</p>
2842 !! html/parsoid
2843 <p about="#mwt1" typeof="mw:Transclusion"
2844 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2845 !! end
2846
2847 !! test
2848 Parsoid: Pipes in external links in template parameter
2849 !! wikitext
2850 {{echo|[{{echo|http://example.com}} link]}}
2851 !! html/php+tidy
2852 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2853 !! html/parsoid
2854 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2855 !! end
2856
2857 !! test
2858 Parsoid: pipe in transclusion parameter
2859 !! wikitext
2860 {{echo|http://foo.com/a&#124;b}}
2861 !! html/php+tidy
2862 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2863 !! html/parsoid
2864 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2865 typeof="mw:Transclusion"
2866 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2867 !! end
2868
2869 !! test
2870 Parsoid: Pipe in external link target and content in template parameter
2871 !! options
2872 parsoid=html2wt,wt2wt
2873 !! wikitext
2874 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2875 !! html/php+tidy
2876 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2877 !! html/parsoid
2878 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2879 typeof="mw:Transclusion"
2880 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2881 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2882 !! end
2883
2884 !! test
2885 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2886 !! options
2887 parsoid
2888 !! wikitext
2889 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2890 !! html
2891 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2892 !! end
2893
2894 !! test
2895 Templates: Don't escape already nowiki-escaped text in template parameters
2896 !! options
2897 parsoid=html2wt,wt2wt
2898 !! wikitext
2899 {{echo|foo<nowiki>|</nowiki>bar}}
2900 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2901 {{echo|<nowiki></nowiki>}}
2902 !! html/php+tidy
2903 <p>foo|bar &lt;div&gt;</p>
2904 !! html/parsoid
2905 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2906 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2907 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2908 </p>
2909 !! end
2910
2911 ## Bug 52824
2912 !! test
2913 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2914 !! options
2915 parsoid=html2wt,wt2wt
2916 !! wikitext
2917 {{echo|{{echo|1=bar}}}}
2918 !! html/php+tidy
2919 <p>bar</p>
2920 !! html/parsoid
2921 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2922 !! end
2923
2924 ## Bug 56733
2925 !! test
2926 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2927 !! wikitext
2928 {{echo|a : b}}
2929 !! html/php+tidy
2930 <p>a&#160;: b</p>
2931 !! html/parsoid
2932 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2933 !! end
2934
2935 ## Bug T73412
2936 !! test
2937 Templates: Preserve blank parameter names
2938 !! wikitext
2939 {{echo|=foo}}
2940 !! html/php+tidy
2941 <p>{{{1}}}</p>
2942 !! html/parsoid
2943 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2944 !! end
2945
2946 !! test
2947 Templates: Preserve blank parameter names in other positions
2948 !! wikitext
2949 {{blank_param|bar|=foo}}
2950 !! html/php+tidy
2951 <p>bar foo</p>
2952 !! html/parsoid
2953 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2954 foo</p>
2955 !! end
2956
2957 ###
2958 ### Parsoid-centric tests for testing RT edge cases for pre
2959 ###
2960
2961 !!test
2962 1a. Indent-Pre and Comments
2963 !! wikitext
2964 a
2965 <!--a-->
2966 c
2967 !! html
2968 <pre>a
2969 </pre>
2970 <p>c
2971 </p>
2972 !!end
2973
2974 !!test
2975 1b. Indent-Pre and Comments
2976 !! wikitext
2977 a
2978 <!--a-->
2979 c
2980 !! html
2981 <pre>a
2982 </pre>
2983 <p>c
2984 </p>
2985 !!end
2986
2987 !!test
2988 1c. Indent-Pre and Comments
2989 !! wikitext
2990 <!--a--> a
2991
2992 <!--a--> a
2993 !! html
2994 <pre> a
2995 </pre>
2996 <pre> a
2997 </pre>
2998 !!end
2999
3000 !!test
3001 1d. Indent-Pre and Comments
3002 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3003 !! wikitext
3004 <!--a--> a
3005
3006 <!--b-->b
3007 !! html
3008 <pre>a
3009 </pre>
3010 <pre>b
3011 </pre>
3012 !!end
3013
3014 !!test
3015 2a. Indent-Pre and tables
3016 !! wikitext
3017 {|
3018 |-
3019 !h1!!h2
3020 |foo||bar
3021 |}
3022 !! html
3023 <table>
3024
3025 <tr>
3026 <th>h1</th>
3027 <th>h2
3028 </th>
3029 <td>foo</td>
3030 <td>bar
3031 </td></tr></table>
3032
3033 !!end
3034
3035 !!test
3036 2b. Indent-Pre and tables
3037 !! wikitext
3038 {|
3039 |-
3040 |foo
3041 |}
3042 !! html
3043 <table>
3044
3045 <tr>
3046 <td>foo
3047 </td></tr></table>
3048
3049 !!end
3050
3051 !!test
3052 2c. Indent-Pre and tables (bug 42252)
3053 !! wikitext
3054 {|
3055 |+ foo
3056 ! | bar
3057 |}
3058 !! html
3059 <table>
3060 <caption> foo
3061 </caption>
3062 <tr>
3063 <th> bar
3064 </th></tr></table>
3065
3066 !!end
3067
3068 !!test
3069 2d. Indent-Pre and tables
3070 !! wikitext
3071 a
3072 {|
3073 | b
3074 |}
3075 !! html/php
3076 <pre>a
3077 </pre>
3078 <table>
3079 <tr>
3080 <td> b
3081 </td></tr></table>
3082
3083 !! html/parsoid
3084 <pre>a</pre>
3085 <table>
3086 <tbody><tr><td> b</td></tr>
3087 </tbody></table>
3088 !!end
3089
3090 !!test
3091 2e. Indent-Pre and table-line syntax
3092 !! wikitext
3093 a
3094 | b
3095 | c
3096 !! html/php
3097 <pre>a
3098 | b
3099 | c
3100 </pre>
3101 !!end
3102
3103 !!test
3104 2f. Indent-pre started by table-line syntax
3105 !! wikitext
3106 a
3107 | b
3108 | c
3109 !! html/php
3110 <p>a
3111 </p>
3112 <pre>| b
3113 | c
3114 </pre>
3115 !! html/parsoid
3116 <p>a</p>
3117 <pre>
3118 | b
3119 | c</pre>
3120 !!end
3121
3122 !! test
3123 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3124 !! wikitext
3125 <table>
3126 <tr>
3127 <td>
3128 Text that should be rendered preformatted
3129 </td>
3130 </tr>
3131 </table>
3132 !! html
3133 <table>
3134 <tr>
3135 <td>
3136 <pre>Text that should be rendered preformatted
3137 </pre>
3138 </td>
3139 </tr>
3140 </table>
3141
3142 !! end
3143
3144 !!test
3145 3a. Indent-Pre and block tags (single-line html)
3146 !! wikitext
3147 a <p> foo </p>
3148 b <div> foo </div>
3149 c <blockquote> foo </blockquote>
3150 <span> foo </span>
3151 !! html
3152 a <p> foo </p>
3153 b <div> foo </div>
3154 c <blockquote> foo </blockquote>
3155 <pre><span> foo </span>
3156 </pre>
3157 !! html/parsoid
3158 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3159 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3160 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3161 <pre><span> foo </span>
3162 </pre>
3163 !! html+tidy
3164 <p>a</p>
3165 <p>foo</p>
3166 <p>b</p>
3167 <div>foo</div>
3168 <p>c</p>
3169 <blockquote>
3170 <p>foo</p>
3171 </blockquote>
3172 <pre>
3173 <span> foo </span>
3174 </pre>
3175 !! end
3176
3177 !!test
3178 3b. Indent-Pre and block tags (multi-line html)
3179 !! wikitext
3180 a <span>foo</span>
3181 b <div> foo </div>
3182 !! html
3183 <pre>a <span>foo</span>
3184 </pre>
3185 b <div> foo </div>
3186
3187 !! html/parsoid
3188 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3189 b <div data-parsoid='{"stx":"html"}'> foo </div>
3190 !! html+tidy
3191 <pre>
3192 a <span>foo</span>
3193 </pre>
3194 <p>b</p>
3195 <div>foo</div>
3196 !!end
3197
3198 !!test
3199 3c. Indent-Pre and block tags (pre-content on separate line)
3200 !! wikitext
3201 <p>
3202 foo
3203 </p>
3204
3205 <div>
3206 foo
3207 </div>
3208
3209 <center>
3210 foo
3211 </center>
3212
3213 <blockquote>
3214 foo
3215 </blockquote>
3216
3217 <blockquote>
3218 <pre>
3219 foo
3220 </pre>
3221 </blockquote>
3222
3223 <table><tr><td>
3224 foo
3225 </td></tr></table>
3226
3227 <ul><li>
3228 foo
3229 </li></ul>
3230
3231 !! html
3232 <p>
3233 foo
3234 </p>
3235 <div>
3236 <pre>foo
3237 </pre>
3238 </div>
3239 <center>
3240 <pre>foo
3241 </pre>
3242 </center>
3243 <blockquote>
3244 <p> foo
3245 </p>
3246 </blockquote>
3247 <blockquote>
3248 <pre>
3249 foo
3250 </pre>
3251 </blockquote>
3252 <table><tr><td>
3253 <pre>foo
3254 </pre>
3255 </td></tr></table>
3256 <ul><li>
3257 foo
3258 </li></ul>
3259
3260 !!end
3261
3262 !! test
3263 4. Indent-Pre and extension tags
3264 !! wikitext
3265 a <tag />
3266 !! html/php
3267 a <pre>
3268 NULL
3269 array (
3270 )
3271 </pre>
3272
3273 !! html/parsoid
3274 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3275 !! end
3276
3277 !!test
3278 Render paragraphs when indent-pre is suppressed in blocklevels
3279 !! wikitext
3280 <blockquote>
3281 foo
3282
3283 bar
3284 </blockquote>
3285 !! html
3286 <blockquote>
3287 <p> foo
3288 </p><p> bar
3289 </p>
3290 </blockquote>
3291
3292 !!end
3293
3294 !!test
3295 4. Multiple spaces at start-of-line
3296 !! wikitext
3297 <p> foo </p>
3298 foo
3299 {|
3300 |foo
3301 |}
3302 !! html
3303 <p> foo </p>
3304 <pre> foo
3305 </pre>
3306 <table>
3307 <tr>
3308 <td>foo
3309 </td></tr></table>
3310
3311 !!end
3312
3313 ## NOTE: the leading white-space chars on empty line are significant
3314 !! test
3315 5a. White-space in indent-pre
3316 !! wikitext
3317 a<br />
3318
3319 b
3320 !! html
3321 <pre>a<br />
3322
3323 b
3324 </pre>
3325 !! end
3326
3327 ## NOTE: the leading white-space chars on empty line are significant
3328 !! test
3329 5b. White-space in indent-pre
3330 !! wikitext
3331 a
3332
3333 b
3334
3335
3336 c
3337 !! html
3338 <pre>a
3339
3340 b
3341
3342
3343 c
3344 </pre>
3345 !! end
3346
3347 !! test
3348 5c. White-space in indent-pre
3349 !! wikitext
3350 ''a''
3351 ''b''
3352 ''c''
3353 !! html
3354 <pre><i>a</i>
3355 <i>b</i>
3356 <i>c</i>
3357 </pre>
3358 !! end
3359
3360 !! test
3361 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3362 !! wikitext
3363 a
3364
3365 <!-- continue -->
3366 b
3367
3368 c
3369
3370 d
3371 !! html
3372 <pre>a
3373
3374 b
3375 </pre>
3376 <pre>c
3377
3378 </pre>
3379 <p>d
3380 </p>
3381 !! end
3382
3383 !! test
3384 7a. Indent-pre and category links
3385 !! options
3386 parsoid=wt2html,wt2wt
3387 !! wikitext
3388 [[Category:foo]] <!-- No pre-wrapping -->
3389 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3390 !! html/php+tidy
3391 !! html/parsoid
3392 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3393 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3394 !! end
3395
3396 ## We used to, but no longer wt2wt this test since the default serializer
3397 ## will normalize all categories to serialize on their own line.
3398 ## This wikitext usage is going to be fairly uncommon in production and
3399 ## selser will take care of preserving formatting in those scenarios.
3400 !! test
3401 7b. Indent-pre and category links
3402 !! options
3403 parsoid=wt2html
3404 !! wikitext
3405 [[Category:foo]] a
3406 [[Category:foo]] {{echo|b}}
3407 !! html/parsoid
3408 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3409 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3410 !! end
3411
3412 !! test
3413 Indent-Pre: Newlines in comments shouldn't affect sol state
3414 !! wikitext
3415 a <!--
3416 foo
3417 --> b
3418 !! html/php+tidy
3419 <p>a b</p>
3420 !! html/parsoid
3421 <p>a <!--
3422 foo
3423 --> b</p>
3424 !! end
3425
3426 ###
3427 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3428 ###
3429
3430 !!test
3431 HTML-pre: 1. embedded newlines
3432 !! wikitext
3433 <pre>foo</pre>
3434
3435 <pre>
3436 foo
3437 </pre>
3438
3439 <pre>
3440
3441 foo
3442 </pre>
3443
3444 <pre>
3445
3446
3447 foo
3448 </pre>
3449 !! html/php+tidy
3450 <pre>
3451 foo
3452 </pre>
3453 <pre>
3454 foo
3455 </pre>
3456 <pre>
3457
3458 foo
3459 </pre>
3460 <pre>
3461
3462
3463 foo
3464 </pre>
3465 !! html/parsoid
3466 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3467
3468 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3469 foo
3470 </pre>
3471
3472 <pre data-parsoid='{"stx":"html"}'>
3473
3474 foo
3475 </pre>
3476
3477 <pre data-parsoid='{"stx":"html"}'>
3478
3479
3480 foo
3481 </pre>
3482 !!end
3483
3484 !! test
3485 HTML-pre: big spaces
3486 !! wikitext
3487 <pre>
3488
3489
3490
3491
3492 haha
3493
3494
3495
3496
3497 haha
3498
3499
3500
3501
3502 </pre>
3503 !! html/php+tidy
3504 <pre>
3505
3506
3507
3508
3509 haha
3510
3511
3512
3513
3514 haha
3515
3516
3517
3518
3519 </pre>
3520 !! html/parsoid
3521 <pre data-parsoid='{"stx":"html"}'>
3522
3523
3524
3525
3526 haha
3527
3528
3529
3530
3531 haha
3532
3533
3534
3535
3536 </pre>
3537 !! end
3538
3539 !!test
3540 HTML-pre: 2: indented text
3541 !! wikitext
3542 <pre>
3543 foo
3544 </pre>
3545 !! html
3546 <pre>
3547 foo
3548 </pre>
3549
3550 !!end
3551
3552 !!test
3553 HTML-pre: 3: other wikitext
3554 !! wikitext
3555 <pre>
3556 * foo
3557 # bar
3558 = no-h =
3559 '' no-italic ''
3560 [[ NoLink ]]
3561 </pre>
3562 !! html/php
3563 <pre>
3564 * foo
3565 # bar
3566 = no-h =
3567 '' no-italic ''
3568 [[ NoLink ]]
3569 </pre>
3570
3571 !! html/parsoid
3572 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3573 # bar
3574 = no-h =
3575 '' no-italic ''
3576 [[ NoLink ]]
3577 </pre>
3578 !!end
3579
3580 ###
3581 ### Definition lists
3582 ###
3583 !! test
3584 Simple definition
3585 !! wikitext
3586 ; name : Definition
3587 !! html
3588 <dl><dt> name&#160;</dt>
3589 <dd> Definition</dd></dl>
3590
3591 !! end
3592
3593 !! test
3594 Definition list for indentation only
3595 !! wikitext
3596 : Indented text
3597 !! html
3598 <dl><dd> Indented text</dd></dl>
3599
3600 !! end
3601
3602 !! test
3603 Definition list with no space
3604 !! wikitext
3605 ;name:Definition
3606 !! html
3607 <dl><dt>name</dt>
3608 <dd>Definition</dd></dl>
3609
3610 !!end
3611
3612 !! test
3613 Definition list with URL link
3614 !! wikitext
3615 ; http://example.com/ : definition
3616 !! html
3617 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3618 <dd> definition</dd></dl>
3619
3620 !! end
3621
3622 !! test
3623 Definition list with bracketed URL link
3624 !! wikitext
3625 ;[http://www.example.com/ Example]:Something about it
3626 !! html
3627 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3628 <dd>Something about it</dd></dl>
3629
3630 !! end
3631
3632 !! test
3633 Definition list with wikilink containing colon
3634 !! wikitext
3635 ; [[Help:FAQ]]: The least-read page on Wikipedia
3636 !! html
3637 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3638 <dd> The least-read page on Wikipedia</dd></dl>
3639
3640 !! end
3641
3642 # At Brion's and JeLuF's insistence... :)
3643 !! test
3644 Definition list with news link containing colon
3645 !! wikitext
3646 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3647 !! html/php
3648 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3649 <dd> This isn't even a real newsgroup!</dd></dl>
3650
3651 !! html/parsoid
3652 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3653 !! end
3654
3655 !! test
3656 Malformed definition list with colon
3657 !! wikitext
3658 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3659 !! html
3660 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3661
3662 !! end
3663
3664 !! test
3665 Definition lists: colon in external link text
3666 !! wikitext
3667 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3668 !! html
3669 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3670 <dd> OK, I made that up</dd></dl>
3671
3672 !! end
3673
3674 !! test
3675 Definition lists: colon in HTML attribute
3676 !! wikitext
3677 ;<b style="display: inline">bold</b>
3678 !! html
3679 <dl><dt><b style="display: inline">bold</b></dt></dl>
3680
3681 !! end
3682
3683 !! test
3684 Definition lists: self-closed tag
3685 !! wikitext
3686 ;one<br/>two : two-line fun
3687 !! html
3688 <dl><dt>one<br />two&#160;</dt>
3689 <dd> two-line fun</dd></dl>
3690
3691 !! end
3692
3693 !! test
3694 Bug 11748: Literal closing tags
3695 !! wikitext
3696 <dl>
3697 <dt>test 1</dt>
3698 <dd>test test test test test</dd>
3699 <dt>test 2</dt>
3700 <dd>test test test test test</dd>
3701 </dl>
3702 !! html
3703 <dl>
3704 <dt>test 1</dt>
3705 <dd>test test test test test</dd>
3706 <dt>test 2</dt>
3707 <dd>test test test test test</dd>
3708 </dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3714 !! wikitext
3715 <ul><li>
3716 ; term : description
3717 * unordered
3718 </li></ul>
3719 !! html
3720 <ul><li>
3721 <dl><dt> term&#160;</dt>
3722 <dd> description</dd></dl>
3723 <ul><li> unordered</li></ul>
3724 </li></ul>
3725
3726 !! end
3727
3728 !! test
3729 Definition list with empty definition and following paragraph
3730 !! wikitext
3731 ; term:
3732 Paragraph text
3733 !! html
3734 <dl><dt> term</dt>
3735 <dd></dd></dl>
3736 <p>Paragraph text
3737 </p>
3738 !! end
3739
3740 !! test
3741 Nested definition lists using html syntax
3742 !! wikitext
3743 <dl><dt>x</dt>
3744 <dd>a</dd>
3745 <dd>b</dd></dl>
3746 !! html
3747 <dl><dt>x</dt>
3748 <dd>a</dd>
3749 <dd>b</dd></dl>
3750
3751 !! end
3752
3753 !! test
3754 Definition Lists: No nesting: Multiple dd's
3755 !! wikitext
3756 ;x
3757 :a
3758 :b
3759 !! html
3760 <dl><dt>x</dt>
3761 <dd>a</dd>
3762 <dd>b</dd></dl>
3763
3764 !! end
3765
3766 !! test
3767 Definition Lists: Indentation: Regular
3768 !! wikitext
3769 :i1
3770 ::i2
3771 :::i3
3772 !! html
3773 <dl><dd>i1
3774 <dl><dd>i2
3775 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3776
3777 !! end
3778
3779 !! test
3780 Definition Lists: Indentation: Missing 1st level
3781 !! wikitext
3782 ::i2
3783 :::i3
3784 !! html
3785 <dl><dd><dl><dd>i2
3786 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3787
3788 !! end
3789
3790 !! test
3791 Definition Lists: Indentation: Multi-level indent
3792 !! wikitext
3793 :::i3
3794 !! html
3795 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition Lists: Hacky use to indent tables
3801 !! wikitext
3802 ::{|
3803 |foo
3804 |bar
3805 |}
3806 this text
3807 should be left alone
3808 !! html
3809 <dl><dd><dl><dd><table>
3810 <tr>
3811 <td>foo
3812 </td>
3813 <td>bar
3814 </td></tr></table></dd></dl></dd></dl>
3815 <p>this text
3816 should be left alone
3817 </p>
3818 !! end
3819
3820 !! test
3821 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3822 !! wikitext
3823 <!-- foo -->
3824 ::{|
3825 |foo
3826 |bar
3827 |}<!-- bar -->
3828 this text
3829 should be left alone
3830 !! html/parsoid
3831 <!-- foo -->
3832 <dl><dd><dl><dd><table><tr>
3833 <td>foo</td>
3834 <td>bar</td>
3835 </tr></table><!-- bar --></dd></dl></dd></dl>
3836 <p>this text
3837 should be left alone</p>
3838 !! end
3839
3840 !! test
3841 Definition Lists: Hacky use to indent tables, with comment before table
3842 !! wikitext
3843 ::<!-- foo -->{|
3844 |foo
3845 |}
3846 !! html/parsoid
3847 <dl><dd><dl><dd><!-- foo --><table><tr>
3848 <td>foo</td>
3849 </tr></table></dd></dl></dd></dl>
3850 !! end
3851
3852 # The trailing whitespace in this test is to catch a regression in
3853 # Parsoid after T54473.
3854 !! test
3855 Definition Lists: Hacky use to indent tables (WS-insensitive)
3856 !! wikitext
3857 : {|
3858 |a
3859 |}
3860 !! html/php
3861 <dl><dd><table>
3862 <tr>
3863 <td>a
3864 </td></tr></table></dd></dl>
3865
3866 !! html/parsoid
3867 <dl><dd> <table>
3868 <tbody><tr><td>a</td></tr>
3869 </tbody></table> </dd></dl>
3870 !! end
3871
3872 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3873 ## as an empty dt item. It also ignores all but the last ";" when followed
3874 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3875 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3876 ## ";"s.
3877 ##
3878 ## Ex: ";;t2 ::d2" is transformed into:
3879 ##
3880 ## <dl>
3881 ## <dt>t2 </dt>
3882 ## <dd>
3883 ## <dl>
3884 ## <dt></dt>
3885 ## <dd>d2</dd>
3886 ## </dl>
3887 ## </dd>
3888 ## </dl>
3889 ##
3890 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3891 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3892 ##
3893 ## <dl>
3894 ## <dt>
3895 ## <dl>
3896 ## <dt>t2 </dt>
3897 ## <dd>:d2</dd>
3898 ## </dl>
3899 ## </dt>
3900 ## </dl>
3901 ##
3902 ## All Parsoid only definition list tests have this difference.
3903 ##
3904 ## See also: https://phabricator.wikimedia.org/T8569
3905 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3906
3907 !! test
3908 Table / list interaction: indented table with lists in table contents
3909 !! wikitext
3910 :{|
3911 |-
3912 | a
3913 * b
3914 |-
3915 | c
3916 * d
3917 |}
3918 !! html
3919 <dl><dd><table>
3920
3921 <tr>
3922 <td> a
3923 <ul><li> b</li></ul>
3924 </td></tr>
3925 <tr>
3926 <td> c
3927 <ul><li> d</li></ul>
3928 </td></tr></table></dd></dl>
3929
3930 !! end
3931
3932 !!test
3933 Table / list interaction: lists nested in tables nested in indented lists
3934 !! wikitext
3935 :{|
3936 |
3937 :a
3938 :b
3939 |
3940 *c
3941 *d
3942 |}
3943
3944 *e
3945 *f
3946 !! html
3947 <dl><dd><table>
3948 <tr>
3949 <td>
3950 <dl><dd>a</dd>
3951 <dd>b</dd></dl>
3952 </td>
3953 <td>
3954 <ul><li>c</li>
3955 <li>d</li></ul>
3956 </td></tr></table></dd></dl>
3957 <ul><li>e</li>
3958 <li>f</li></ul>
3959
3960 !!end
3961
3962 !! test
3963 Definition Lists: Nesting: Multi-level (Parsoid only)
3964 !! options
3965 parsoid
3966 !! wikitext
3967 ;t1 :d1
3968 ;;t2 ::d2
3969 ;;;t3 :::d3
3970 !! html
3971 <dl>
3972 <dt>t1 </dt>
3973 <dd>d1</dd>
3974 <dt>
3975 <dl>
3976 <dt>t2 </dt>
3977 <dd>:d2</dd>
3978 <dt>
3979 <dl>
3980 <dt>t3 </dt>
3981 <dd>::d3</dd>
3982 </dl>
3983 </dt>
3984 </dl>
3985 </dt>
3986 </dl>
3987
3988
3989 !! end
3990
3991
3992 !! test
3993 Definition Lists: Nesting: Test 2 (Parsoid only)
3994 !! wikitext
3995 ;t1
3996 ::d2
3997 !! html/php+tidy
3998 <dl>
3999 <dt>t1</dt>
4000 <dd>
4001 <dl>
4002 <dd>d2</dd>
4003 </dl>
4004 </dd>
4005 </dl>
4006 !! html/parsoid
4007 <dl>
4008 <dt>t1</dt>
4009 <dd>
4010 <dl>
4011 <dd>d2</dd>
4012 </dl>
4013 </dd>
4014 </dl>
4015
4016 !! end
4017
4018
4019 !! test
4020 Definition Lists: Nesting: Test 3 (Parsoid only)
4021 !! wikitext
4022 :;t1
4023 ::::d2
4024 !! html/php+tidy
4025 <dl>
4026 <dd>
4027 <dl>
4028 <dt>t1</dt>
4029 <dd>
4030 <dl>
4031 <dd>
4032 <dl>
4033 <dd>d2</dd>
4034 </dl>
4035 </dd>
4036 </dl>
4037 </dd>
4038 </dl>
4039 </dd>
4040 </dl>
4041 !! html/parsoid
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dt>t1</dt>
4046 <dd>
4047 <dl>
4048 <dd>
4049 <dl>
4050 <dd>d2</dd>
4051 </dl>
4052 </dd>
4053 </dl>
4054 </dd>
4055 </dl>
4056 </dd>
4057 </dl>
4058
4059 !! end
4060
4061
4062 !! test
4063 Definition Lists: Nesting: Test 4
4064 !! wikitext
4065 ::;t3
4066 :::d3
4067 !! html
4068 <dl><dd><dl><dd><dl><dt>t3</dt>
4069 <dd>d3</dd></dl></dd></dl></dd></dl>
4070
4071 !! end
4072
4073
4074 ## The Parsoid team believes the following three test exposes a
4075 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4076 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4077 ## It also exposes a "misfeature" in tidy, which doesn't like
4078 ## <dl> tags with a single <dt> child; it converts the <dt> into
4079 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4080 !! test
4081 Definition Lists: Mixed Lists: Test 1
4082 !! wikitext
4083 :;* foo
4084 ::* bar
4085 :; baz
4086 !! html/php
4087 <dl><dd><dl><dt><ul><li> foo</li>
4088 <li> bar</li></ul></dt></dl>
4089 <dl><dt> baz</dt></dl></dd></dl>
4090
4091 !! html/php+tidy
4092 <dl>
4093 <dd>
4094 <dl>
4095 <dd>
4096 <ul>
4097 <li>foo</li>
4098 <li>bar</li>
4099 </ul>
4100 </dd>
4101 </dl>
4102 <dl>
4103 <dt>baz</dt>
4104 </dl>
4105 </dd>
4106 </dl>
4107 !! html/parsoid
4108 <dl>
4109 <dd><dl>
4110 <dt><ul>
4111 <li> foo
4112 </li>
4113 </ul></dt>
4114 <dd><ul>
4115 <li> bar
4116 </li>
4117 </ul></dd>
4118 <dt> baz</dt>
4119 </dl></dd>
4120 </dl>
4121 !! end
4122
4123 !! test
4124 Definition Lists: Mixed Lists: Test 2
4125 !! wikitext
4126 *: d1
4127 *: d2
4128 !! html
4129 <ul><li><dl><dd> d1</dd>
4130 <dd> d2</dd></dl></li></ul>
4131
4132 !! end
4133
4134
4135 !! test
4136 Definition Lists: Mixed Lists: Test 3
4137 !! wikitext
4138 *::: d1
4139 *::: d2
4140 !! html
4141 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4142 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4143
4144 !! end
4145
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 4
4149 !! wikitext
4150 *;d1 :d2
4151 *;d3 :d4
4152 !! html
4153 <ul><li><dl><dt>d1&#160;</dt>
4154 <dd>d2</dd>
4155 <dt>d3&#160;</dt>
4156 <dd>d4</dd></dl></li></ul>
4157
4158 !! end
4159
4160
4161 !! test
4162 Definition Lists: Mixed Lists: Test 5
4163 !! wikitext
4164 *:d1
4165 *:: d2
4166 !! html
4167 <ul><li><dl><dd>d1
4168 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4169
4170 !! end
4171
4172
4173 !! test
4174 Definition Lists: Mixed Lists: Test 6
4175 !! wikitext
4176 #*:d1
4177 #*::: d3
4178 !! html
4179 <ol><li><ul><li><dl><dd>d1
4180 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4181
4182 !! end
4183
4184
4185 !! test
4186 Definition Lists: Mixed Lists: Test 7
4187 !! wikitext
4188 :* d1
4189 :* d2
4190 !! html
4191 <dl><dd><ul><li> d1</li>
4192 <li> d2</li></ul></dd></dl>
4193
4194 !! end
4195
4196
4197 !! test
4198 Definition Lists: Mixed Lists: Test 8
4199 !! wikitext
4200 :* d1
4201 ::* d2
4202 !! html
4203 <dl><dd><ul><li> d1</li></ul>
4204 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4205
4206 !! end
4207
4208
4209 !! test
4210 Definition Lists: Mixed Lists: Test 9
4211 !! wikitext
4212 *;foo :bar
4213 !! html
4214 <ul><li><dl><dt>foo&#160;</dt>
4215 <dd>bar</dd></dl></li></ul>
4216
4217 !! end
4218
4219
4220 !! test
4221 Definition Lists: Mixed Lists: Test 10
4222 !! wikitext
4223 *#;foo :bar
4224 !! html
4225 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4226 <dd>bar</dd></dl></li></ol></li></ul>
4227
4228 !! end
4229
4230 # The Parsoid team disagrees with the PHP parser's seemingly-random
4231 # rules regarding dd/dt on the next two tests. Parsoid is more
4232 # consistent, and recognizes the shared nesting and keeps the
4233 # still-open tags around until the nesting is complete.
4234 # (And tidy again converts <dt> to <dd> before 'bar'.)
4235
4236 !! test
4237 Definition Lists: Mixed Lists: Test 11
4238 !! wikitext
4239 *#*#;*;;foo :bar
4240 *#*#;boo :baz
4241 !! html/php
4242 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4243 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4244 <dl><dt>boo&#160;</dt>
4245 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4246
4247 !! html/php+tidy
4248 <ul>
4249 <li>
4250 <ol>
4251 <li>
4252 <ul>
4253 <li>
4254 <ol>
4255 <li>
4256 <dl>
4257 <dt>foo&#160;</dt>
4258 <dd>
4259 <ul>
4260 <li>
4261 <dl>
4262 <dd>
4263 <dl>
4264 <dt>bar</dt>
4265 </dl>
4266 </dd>
4267 </dl>
4268 </li>
4269 </ul>
4270 </dd>
4271 </dl>
4272 <dl>
4273 <dt>boo&#160;</dt>
4274 <dd>baz</dd>
4275 </dl>
4276 </li>
4277 </ol>
4278 </li>
4279 </ul>
4280 </li>
4281 </ol>
4282 </li>
4283 </ul>
4284 !! html/parsoid
4285 <ul>
4286 <li>
4287 <ol>
4288 <li>
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dt>
4299 <dl>
4300 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4301 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4302 </dl></dt>
4303 </dl></li>
4304 </ul></dt>
4305 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4306 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4307 </dl></li>
4308 </ol></li>
4309 </ul></li>
4310 </ol></li>
4311 </ul>
4312 !! end
4313
4314
4315 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4316 # From whitelist:
4317 # * The test is wrong, there are two colons where there should be :;
4318 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4319 !! test
4320 Definition Lists: Weird Ones: Test 1
4321 !! wikitext
4322 *#;*::;; foo : bar (who uses this?)
4323 !! html/php
4324 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4325 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4326
4327 !! html/php+tidy
4328 <ul>
4329 <li>
4330 <ol>
4331 <li>
4332 <dl>
4333 <dt>foo&#160;</dt>
4334 <dd>
4335 <ul>
4336 <li>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dd>
4341 <dl>
4342 <dd>
4343 <dl>
4344 <dt>bar (who uses this?)</dt>
4345 </dl>
4346 </dd>
4347 </dl>
4348 </dd>
4349 </dl>
4350 </dd>
4351 </dl>
4352 </li>
4353 </ul>
4354 </dd>
4355 </dl>
4356 </li>
4357 </ol>
4358 </li>
4359 </ul>
4360 !! html/parsoid
4361 <ul>
4362 <li>
4363 <ol>
4364 <li>
4365 <dl>
4366 <dt>
4367 <ul>
4368 <li>
4369 <dl>
4370 <dd>
4371 <dl>
4372 <dd>
4373 <dl>
4374 <dt>
4375 <dl>
4376 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4377 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4378 </dl></dt>
4379 </dl></dd>
4380 </dl></dd>
4381 </dl></li>
4382 </ul></dt>
4383 </dl></li>
4384 </ol></li>
4385 </ul>
4386 !! end
4387
4388 !! test
4389 Definition Lists: colons occurring in tags
4390 !! wikitext
4391 ;a:b
4392 ;'''a:b'''
4393 ;<i>a:b</i>
4394 ;<span>a:b</span>
4395 ;<div>a:b</div>
4396 ;<div>a
4397 :b</div>
4398 ;{{echo|a:b}}
4399 ;{{echo|''a:b''}}
4400 ;;;''a:b''
4401 !! html+tidy
4402 <dl>
4403 <dt>a</dt>
4404 <dd>b</dd>
4405 <dt><b>a:b</b></dt>
4406 <dt><i>a:b</i></dt>
4407 <dt><span>a:b</span></dt>
4408 <dd>
4409 <div>a:b</div>
4410 </dd>
4411 <dd>
4412 <div>a
4413 <dl>
4414 <dd>b</dd>
4415 </dl>
4416 </div>
4417 </dd>
4418 <dt>a</dt>
4419 <dd>b</dd>
4420 <dt><i>a:b</i></dt>
4421 </dl>
4422 <dl>
4423 <dd>
4424 <dl>
4425 <dd>
4426 <dl>
4427 <dt><i>a:b</i></dt>
4428 </dl>
4429 </dd>
4430 </dl>
4431 </dd>
4432 </dl>
4433 !! html/parsoid
4434 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4435 <dt><b>a:b</b></dt>
4436 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4437 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4438 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4439 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4440 <dd>b</dd>
4441 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4442 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4443 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4444 !! end
4445
4446 !! test
4447 Definition Lists: colons and tables 1
4448 !! wikitext
4449 :{|
4450 | x
4451 |}
4452 :{|
4453 | y
4454 |}
4455 !! html
4456 <dl><dd><table>
4457 <tr>
4458 <td> x
4459 </td></tr></table></dd></dl>
4460 <dl><dd><table>
4461 <tr>
4462 <td> y
4463 </td></tr></table></dd></dl>
4464
4465 !! end
4466
4467 # Parsoid's output (as documented below) differs from php's in this case.
4468 # This is probably a bug. If we fixup parsoid to match php's output, the
4469 # above test should pass and the below test case can be removed. It is
4470 # unclear which output is more desirable.
4471
4472 !! test
4473 Definition Lists: colons and tables 2
4474 !! wikitext
4475 :{|
4476 | x
4477 |}
4478 :{|
4479 | y
4480 |}
4481 !! html/parsoid
4482 <dl><dd><table>
4483 <tr>
4484 <td> x
4485 </td></tr></table></dd>
4486 <dd><table>
4487 <tr>
4488 <td> y
4489 </td></tr></table></dd></dl>
4490 !! end
4491
4492 !! test
4493 Definition Lists: template interaction
4494 !! wikitext
4495 ::{{definition_list}}
4496
4497 :one
4498 ::{{definition_list}}
4499 :::two
4500 :::three
4501 ::four
4502 !! html/parsoid
4503 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4504 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4505
4506 <dl><dd data-parsoid='{}'>one
4507 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4508 </span><dd about="#mwt2">two
4509 <dl><dd>two</dd>
4510 <dd>three</dd></dl></dd>
4511 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4512 !! end
4513
4514
4515 ###
4516 ### External links
4517 ###
4518 !! test
4519 External links: non-bracketed
4520 !! wikitext
4521 Non-bracketed: http://example.com
4522 !! html
4523 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4524 </p>
4525 !! end
4526
4527 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4528 !! test
4529 External links: numbered
4530 !! wikitext
4531 Numbered: [http://example.com]
4532 Numbered: [http://example.net]
4533 Numbered: [http://example.com]
4534 !! html/php
4535 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4536 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4537 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4538 </p>
4539 !! html/parsoid
4540 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4541 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4542 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4543 !!end
4544
4545 !! test
4546 External links: specified text
4547 !! wikitext
4548 Specified text: [http://example.com link]
4549 !! html
4550 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: trail
4556 !! wikitext
4557 Linktrails should not work for external links: [http://example.com link]s
4558 !! html
4559 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4560 </p>
4561 !! end
4562
4563 !! test
4564 External links: dollar sign in URL
4565 !! wikitext
4566 http://example.com/1$2345
4567 !! html
4568 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4569 </p>
4570 !! end
4571
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: dollar sign in URL (autonumber)
4575 !! wikitext
4576 [http://example.com/1$2345]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4582 !!end
4583
4584 !! test
4585 External links: open square bracket forbidden in URL (bug 4377)
4586 !! options
4587 parsoid=wt2html,wt2wt,html2html
4588 !! wikitext
4589 http://example.com/1[2345
4590 !! html/php
4591 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4592 </p>
4593 !! html/parsoid
4594 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4595 !! end
4596
4597 !! test
4598 External links: open square bracket forbidden in URL (named) (bug 4377)
4599 !! options
4600 parsoid=wt2html,html2html
4601 !! wikitext
4602 [http://example.com/1[2345]
4603 !! html/php
4604 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4605 </p>
4606 !! html/parsoid
4607 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4608 !!end
4609
4610 # parsoid adds a space before the link name
4611 !! test
4612 External links: open square bracket forbidden in URL (named) (bug 4377)
4613 Parsoid variant.
4614 !! wikitext
4615 [http://example.com/1 [2345]
4616 !! html
4617 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4618 </p>
4619 !!end
4620
4621 !! test
4622 External links: nowiki in URL link text (bug 6230)
4623 !! wikitext
4624 [http://example.com/ <nowiki>''example site''</nowiki>]
4625 !! html
4626 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4627 </p>
4628 !! end
4629
4630 !! test
4631 External links: newline forbidden in text (bug 6230 regression check)
4632 !! wikitext
4633 [http://example.com/ first
4634 second]
4635 !! html
4636 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4637 second]
4638 </p>
4639 !!end
4640
4641 !! test
4642 External links: Pipe char between url and text
4643 !! wikitext
4644 [http://example.com | link]
4645 !! html
4646 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4647 </p>
4648 !!end
4649
4650 !! test
4651 External links: protocol-relative URL in brackets
4652 !! wikitext
4653 [//example.com/ Test]
4654 !! html
4655 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4656 </p>
4657 !! end
4658
4659 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4660 !! test
4661 External links: protocol-relative URL in brackets without text
4662 !! wikitext
4663 [//example.com]
4664 !! html/php
4665 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4666 </p>
4667 !! html/parsoid
4668 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4669 !! end
4670
4671 !! test
4672 External links: protocol-relative URL in free text is left alone
4673 !! wikitext
4674 //example.com/Foo
4675 !! html
4676 <p>//example.com/Foo
4677 </p>
4678 !!end
4679
4680 !! test
4681 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4682 !! wikitext
4683 foo//example.com/Foo
4684 !! html
4685 <p>foo//example.com/Foo
4686 </p>
4687 !! end
4688
4689 !! test
4690 External links: with no contents
4691 !! wikitext
4692 [http://en.wikipedia.org/wiki/Foo]
4693
4694 [[wikipedia:Foo|Bar]]
4695
4696 [[wikipedia:Foo|<span>Bar</span>]]
4697 !! html/php
4698 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4699 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4700 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4701 </p>
4702 !! html/parsoid
4703 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4704 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4705 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4706 !! end
4707
4708 !! test
4709 External links: Free with trailing punctuation
4710 !! wikitext
4711 http://example.com,
4712 http://example.com;
4713 http://example.com\
4714 http://example.com.
4715 http://example.com:
4716 http://example.com!
4717 http://example.com?
4718 http://example.com)
4719 http://example.com/url_with_(brackets)
4720 (http://example.com/url_without_brackets)
4721 http://example.com/url_with_entity&amp;
4722 http://example.com/url_with_entity&#x26;
4723 http://example.com/url_with_entity&#038;
4724 http://example.com/url_with_entity&nbsp;
4725 http://example.com/url_with_entity&#xA0;
4726 http://example.com/url_with_entity&#160;
4727 http://example.com/url_with_entity&lt;
4728 http://example.com/url_with_entity&#x3C;
4729 http://example.com/url_with_entity&#60;
4730 !! html/php
4731 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4732 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4735 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4738 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4740 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4745 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4746 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4747 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4748 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4749 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4750 </p>
4751 !! html/parsoid
4752 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4753 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4754 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4755 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4756 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4757 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4758 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4759 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4760 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4761 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4762 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4763 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4764 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4765 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4766 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4767 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4768 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4769 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4770 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4771 !! end
4772
4773 !! test
4774 External links: tricky Parsoid html2html case
4775 !! options
4776 parsoid=wt2html,wt2wt,html2html
4777 !! wikitext
4778 http://example.com/url_with_entity&amp;amp;
4779 !! html/php
4780 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4781 </p>
4782 !! html/parsoid
4783 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4784 !! end
4785
4786 !! test
4787 External links: Free with trailing quotes (T113666)
4788 !! wikitext
4789 '''News:''' Stuff here
4790
4791 news:'a'b''c''d e
4792 !! html/php
4793 <p><b>News:</b> Stuff here
4794 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4795 </p>
4796 !! html/parsoid
4797 <p><b>News:</b> Stuff here</p>
4798 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4799 !! end
4800
4801 !! test
4802 External links: Lone protocols are never linked (T105697)
4803 !! wikitext
4804 http://
4805 http://;
4806 (http://)
4807 bitcoin:
4808 bitcoin:;
4809 (bitcoin:)
4810 !! html
4811 <p>http://
4812 http://;
4813 (http://)
4814 bitcoin:
4815 bitcoin:;
4816 (bitcoin:)
4817 </p>
4818 !! end
4819
4820 !! test
4821 External links: No preceding word characters allowed (bug 65278)
4822 !! wikitext
4823 NOPEhttp://example.com
4824 N0http://example.com
4825 ok:http://example.com
4826 ok-http://example.com
4827 !! html
4828 <p>NOPEhttp://example.com
4829 N0http://example.com
4830 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4831 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External links: nofollow domain exception
4837 !! wikitext
4838 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4839 !! html
4840 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4841 </p>
4842 !!end
4843
4844 !! test
4845 External image
4846 !! wikitext
4847 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4848 !! html
4849 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4850 </p>
4851 !! end
4852
4853 !! test
4854 External image from https
4855 !! wikitext
4856 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4857 !! html
4858 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4859 </p>
4860 !! end
4861
4862 !! test
4863 External image (when not allowed)
4864 !! options
4865 wgAllowExternalImages=0
4866 !! wikitext
4867 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4868 !! html
4869 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4870 </p>
4871 !! end
4872
4873 !! test
4874 Link to non-http image, no img tag
4875 !! wikitext
4876 Link to non-http image, no img tag: ftp://example.com/test.jpg
4877 !! html
4878 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4879 </p>
4880 !! end
4881
4882 !! test
4883 External links: terminating separator
4884 !! wikitext
4885 Terminating separator: http://example.com/thing,
4886 !! html
4887 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4888 </p>
4889 !! end
4890
4891 !! test
4892 External links: intervening separator
4893 !! wikitext
4894 Intervening separator: http://example.com/1,2,3
4895 !! html
4896 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4897 </p>
4898 !! end
4899
4900 !! test
4901 External links: old bug with URL in query
4902 !! wikitext
4903 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4904 !! html
4905 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4906 </p>
4907 !! end
4908
4909 !! test
4910 External links: old URL-in-URL bug, mixed protocols
4911 !! wikitext
4912 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4913 !! html
4914 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4915 </p>
4916 !!end
4917
4918 # Since Parsoid is starting to emit canonical wikitext for links,
4919 # [http://example.com http://example.com] will not RT back to that
4920 # form anymore.
4921 !! test
4922 External links: URL in text
4923 !! options
4924 parsoid=wt2html
4925 !! wikitext
4926 URL in text: [http://example.com http://example.com]
4927 !! html/php
4928 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4929 </p>
4930 !! html/parsoid
4931 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4932 !! end
4933
4934 !! test
4935 External links: Clickable images
4936 !! wikitext
4937 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4938 !! html/php
4939 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
4940 </p>
4941 !! html/parsoid
4942 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4943 !! end
4944
4945 !! test
4946 External links: raw ampersand
4947 !! wikitext
4948 Old &amp; use: http://x&y
4949 !! html
4950 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4951 </p>
4952 !! end
4953
4954 !! test
4955 External links: encoded ampersand
4956 !! wikitext
4957 Old &amp; use: http://x&amp;y
4958 !! html/php
4959 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4960 </p>
4961 !! html/parsoid
4962 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4963 !! end
4964
4965 !! test
4966 External links: encoded equals (bug 6102)
4967 !! wikitext
4968 http://example.com/?foo&#61;bar
4969 !! html/php
4970 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4971 </p>
4972 !! html/parsoid
4973 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4974 !! end
4975
4976 ##
4977 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4978 ## does it number them. As discussed in bug 53505, we can identify
4979 ## autonumbered links via CSS.
4980 ##
4981
4982 !! test
4983 External links: [raw ampersand]
4984 !! wikitext
4985 Old &amp; use: [http://x&y]
4986 !! html/php
4987 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4988 </p>
4989 !! html/parsoid
4990 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4991 !! end
4992
4993 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4994 # mode will return the [raw ampersand] wikitext
4995 !! test
4996 External links: [encoded ampersand]
4997 !! options
4998 parsoid=wt2html,wt2wt,html2html
4999 !! wikitext
5000 Old &amp; use: [http://x&amp;y]
5001 !! html/php
5002 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5003 </p>
5004 !! html/parsoid
5005 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5006 !! end
5007
5008 !! test
5009 External links: [raw equals]
5010 !! wikitext
5011 [http://example.com/?foo=bar]
5012 !! html/php
5013 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5014 </p>
5015 !! html/parsoid
5016 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5017 !! end
5018
5019 # note that parsoid html is identical to [raw equals] case; so html2wt
5020 # mode will return the [raw equals] wikitext
5021 !! test
5022 External links: [encoded equals] (bug 6102)
5023 !! options
5024 parsoid=wt2html,wt2wt,html2html
5025 !! wikitext
5026 [http://example.com/?foo&#61;bar]
5027 !! html/php
5028 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5029 </p>
5030 !! html/parsoid
5031 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5032 !! end
5033
5034 # xxx parsoid strips the IDN character, so the round-trip tests will
5035 # obviously fail and are disabled. --cscott
5036 !! test
5037 External links: [IDN ignored character reference in hostname; strip it right off]
5038 !! options
5039 parsoid=wt2html,wt2wt,html2html
5040 !! wikitext
5041 [http://e&zwnj;xample.com/]
5042 !! html/php
5043 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5044 </p>
5045 !! html/parsoid
5046 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5047 !! end
5048
5049 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5050 # Where an external link could easily circumvent the sanitization of the text of
5051 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5052 # test demands a higher standard. That's a bit strange.
5053 #
5054 # Example:
5055 #
5056 # http://e‌xample.com -> [http://example.com|http://example.com]
5057 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5058 #
5059 # The first example is sanitized, but the second is not. Any security benefits
5060 # from this production are trivial to circumvent. Either remove this test and
5061 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5062 # the test accordingly.
5063 #
5064 # All our love,
5065 # The Parsoid team.
5066 # xxx parsoid strips the IDN character, so the round-trip tests will
5067 # obviously fail and are disabled. --cscott
5068 !! test
5069 External links: IDN ignored character reference in hostname; strip it right off
5070 !! options
5071 parsoid=wt2html,html2html
5072 !! wikitext
5073 http://e&zwnj;xample.com/
5074 !! html/php
5075 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5076 </p>
5077 !! html/parsoid
5078 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5079 !! end
5080
5081 !! test
5082 External links: www.jpeg.org (bug 554)
5083 !! wikitext
5084 http://www.jpeg.org
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5087 </p>
5088 !! end
5089
5090 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5091 !! test
5092 External links: URL within URL (original bug 2)
5093 !! wikitext
5094 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5095 !! html/php
5096 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5097 </p>
5098 !! html/parsoid
5099 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5100 !! end
5101
5102 !! test
5103 BUG 361: URL inside bracketed URL
5104 !! wikitext
5105 [http://www.example.com/foo http://www.example.com/bar]
5106 !! html
5107 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5108 </p>
5109 !! end
5110
5111 !! test
5112 BUG 361: URL within URL, not bracketed
5113 !! wikitext
5114 http://www.example.com/foo?=http://www.example.com/bar
5115 !! html
5116 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5117 </p>
5118 !! end
5119
5120 !! test
5121 BUG 289: ">"-token in URL-tail
5122 !! wikitext
5123 http://www.example.com/<hello>
5124 !! html
5125 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5126 </p>
5127 !!end
5128
5129 !! test
5130 BUG 289: literal ">"-token in URL-tail
5131 !! wikitext
5132 http://www.example.com/<b>html</b>
5133 !! html/php
5134 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5135 </p>
5136 !! html/parsoid
5137 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5138 !! end
5139
5140 !! test
5141 BUG 289: ">"-token in bracketed URL
5142 !! wikitext
5143 [http://www.example.com/<hello> stuff]
5144 !! html
5145 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5146 </p>
5147 !!end
5148
5149 !! test
5150 BUG 289: literal ">"-token in bracketed URL
5151 !! wikitext
5152 [http://www.example.com/<b>html</b> stuff]
5153 !! html
5154 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5155 </p>
5156 !!end
5157
5158 !! test
5159 BUG 289: literal double quote at end of URL
5160 !! wikitext
5161 http://www.example.com/"hello"
5162 !! html
5163 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5164 </p>
5165 !!end
5166
5167 !! test
5168 BUG 289: literal double quote in bracketed URL
5169 !! wikitext
5170 [http://www.example.com/"hello" stuff]
5171 !! html
5172 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5173 </p>
5174 !!end
5175
5176 !! test
5177 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5178 !! wikitext
5179 [http://www.example.com test]
5180 !! html
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5182 </p>
5183 !! end
5184
5185 !! test
5186 External links: link text with spaces
5187 !! wikitext
5188 [http://www.example.com a b c]
5189 [http://www.example.com ''a'' ''b'']
5190 !! html
5191 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5192 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 External links: wiki links within external link (Bug 3695)
5198 !! options
5199 parsoid=wt2html,html2html
5200 !! wikitext
5201 [http://example.com [[wikilink]] embedded in ext link]
5202 !! html/php
5203 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5204 </p>
5205 !! html/parsoid
5206 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5207 !! end
5208
5209 !! test
5210 BUG 787: Links with one slash after the url protocol are invalid
5211 !! wikitext
5212 http:/example.com
5213
5214 [http:/example.com title]
5215 !! html
5216 <p>http:/example.com
5217 </p><p>[http:/example.com title]
5218 </p>
5219 !! end
5220
5221 !! test
5222 Bracketed external links with template-generated invalid target
5223 !! wikitext
5224 [{{echo|http:/example.com}} title]
5225 !! html
5226 <p>[http:/example.com title]
5227 </p>
5228 !! end
5229
5230 !! test
5231 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5232 !! wikitext
5233 ''[http://example.com text'']
5234 [http://example.com '''text]'''
5235 ''Something [http://example.com in italic'']
5236 ''Something [http://example.com mixed''''', even bold]'''
5237 '''''Now [http://example.com both''''']
5238 !! html
5239 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5240 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5241 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5242 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5243 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5244 </p>
5245 !! end
5246
5247
5248 !! test
5249 Bug 4781: %26 in URL
5250 !! wikitext
5251 http://www.example.com/?title=AT%26T
5252 !! html/php
5253 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5254 </p>
5255 !! html/parsoid
5256 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5257 !! end
5258
5259 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5260 # % is actually legal in HTML5. Any change in output would need testing though.
5261 !! test
5262 Bug 4781, 5267: %25 in URL
5263 !! wikitext
5264 http://www.example.com/?title=100%25_Bran
5265 !! html/php
5266 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %28, %29 in URL
5274 !! wikitext
5275 http://www.example.com/?title=Ben-Hur_%281959_film%29
5276 !! html/php
5277 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5278 </p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5281 !! end
5282
5283
5284 !! test
5285 Bug 4781: %26 in autonumber URL
5286 !! wikitext
5287 [http://www.example.com/?title=AT%26T]
5288 !! html/php
5289 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5290 </p>
5291 !! html/parsoid
5292 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5293 !! end
5294
5295 !! test
5296 Bug 4781, 5267: %26 in autonumber URL
5297 !! wikitext
5298 [http://www.example.com/?title=100%25_Bran]
5299 !! html/php
5300 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5304 !! end
5305
5306 !! test
5307 Bug 4781, 5267: %28, %29 in autonumber URL
5308 !! wikitext
5309 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5310 !! html/php
5311 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5312 </p>
5313 !! html/parsoid
5314 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5315 !! end
5316
5317
5318 !! test
5319 Bug 4781: %26 in bracketed URL
5320 !! wikitext
5321 [http://www.example.com/?title=AT%26T link]
5322 !! html/php
5323 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5324 </p>
5325 !! html/parsoid
5326 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5327 !! end
5328
5329 !! test
5330 Bug 4781, 5267: %25 in bracketed URL
5331 !! wikitext
5332 [http://www.example.com/?title=100%25_Bran link]
5333 !! html
5334 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5335 </p>
5336 !! end
5337
5338 !! test
5339 Bug 4781, 5267: %28, %29 in bracketed URL
5340 !! wikitext
5341 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5342 !! html/php
5343 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5344 </p>
5345 !! html/parsoid
5346 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5347 !! end
5348
5349 !! test
5350 External link containing a period in the anchor. (bug 63947)
5351 !! wikitext
5352 [//foo.org/bar#baz. bang]
5353
5354 [//foo.org/bar. bang]
5355 !! html/php
5356 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5357 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5358 </p>
5359 !! html/parsoid
5360 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5361 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5362 !! end
5363
5364 !! test
5365 External link containing a single quote. (bug 63947)
5366 !! wikitext
5367 [//foo.org/bar'baz]
5368
5369 [//foo.org/bar'baz bang]
5370 !! html/php
5371 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5372 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5373 </p>
5374 !! html/parsoid
5375 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5376 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5377 !! end
5378
5379 !! test
5380 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5381 !! wikitext
5382 Some [http://example.com/ pretty ''italics'' and stuff]!
5383 !! html
5384 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5385 </p>
5386 !! end
5387
5388 !! test
5389 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5390 !! wikitext
5391 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5392 !! html
5393 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5394 </p>
5395 !! end
5396
5397 !! test
5398 External link containing double-single-quotes with no space separating the url from text in italics
5399 !! wikitext
5400 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5401 !! html/php
5402 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5403 </p>
5404 !! html/php+tidy
5405 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5406 !! html/parsoid
5407 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5408 !! end
5409
5410 !! test
5411 External link with comments in link text
5412 !! wikitext
5413 [http://www.google.com Google <!-- comment -->]
5414 !! html/php
5415 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5416 </p>
5417 !! html/parsoid
5418 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5419 !! end
5420
5421 !! test
5422 External link to bare IPv4 address
5423 !! wikitext
5424 [http://192.168.0.1 Link]
5425 !! html/php
5426 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5427 </p>
5428 !! html/parsoid
5429 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5430 !! end
5431
5432 !! test
5433 URL-encoding in URL functions (single parameter)
5434 !! wikitext
5435 {{localurl:Some page|amp=&}}
5436 !! html
5437 <p>/index.php?title=Some_page&amp;amp=&amp;
5438 </p>
5439 !! end
5440
5441 !! test
5442 URL-encoding in URL functions (multiple parameters)
5443 !! wikitext
5444 {{localurl:Some page|q=?&amp=&}}
5445 !! html
5446 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5447 </p>
5448 !! end
5449
5450 !! test
5451 Brackets in urls
5452 !! wikitext
5453 http://example.com/index.php?foozoid%5B%5D=bar
5454
5455 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5456 !! html/php
5457 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5458 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5459 </p>
5460 !! html/parsoid
5461 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5462
5463 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5464 !! end
5465
5466 !! test
5467 IPv6 urls, autolink format (T23261)
5468 !! wikitext
5469 http://[2404:130:0:1000::187:2]/index.php
5470
5471 Examples from RFC 2373, section 2.2:
5472 * http://[1080::8:800:200C:417A]/unicast
5473 * http://[FF01::101]/multicast
5474 * http://[::1]/loopback
5475 * http://[::]/unspecified
5476 * http://[::13.1.68.3]/ipv4compat
5477 * http://[::FFFF:129.144.52.38]/ipv4compat
5478
5479 Examples from RFC 2732, section 2:
5480 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5481 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5482 * http://[3ffe:2a00:100:7031::1]
5483 * http://[1080::8:800:200C:417A]/foo
5484 * http://[::192.9.5.5]/ipng
5485 * http://[::FFFF:129.144.52.38]:80/index.html
5486 * http://[2010:836B:4179::836B:4179]
5487
5488 !! html/php
5489 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5490 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5491 </p>
5492 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5493 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5494 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5495 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5496 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5497 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5498 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5499 </p>
5500 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5501 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5502 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5503 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5504 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5505 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5506 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5507
5508 !! html/parsoid
5509 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5510
5511 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5512 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5514 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5515 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5518
5519 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5520 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5524 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5525 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5526 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5527 !! end
5528
5529 !! test
5530 IPv6 urls, bracketed format (T23261)
5531 !! wikitext
5532 [http://[2404:130:0:1000::187:2]/index.php test]
5533
5534 Examples from RFC 2373, section 2.2:
5535 * [http://[1080::8:800:200C:417A] unicast]
5536 * [http://[FF01::101] multicast]
5537 * [http://[::1]/ loopback]
5538 * [http://[::] unspecified]
5539 * [http://[::13.1.68.3] ipv4compat]
5540 * [http://[::FFFF:129.144.52.38] ipv4compat]
5541
5542 Examples from RFC 2732, section 2:
5543 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5544 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5545 * [http://[3ffe:2a00:100:7031::1] 3]
5546 * [http://[1080::8:800:200C:417A]/foo 4]
5547 * [http://[::192.9.5.5]/ipng 5]
5548 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5549 * [http://[2010:836B:4179::836B:4179] 7]
5550
5551 !! html/php
5552 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5553 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5554 </p>
5555 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5556 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5557 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5558 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5561 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5562 </p>
5563 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5564 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5565 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5566 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5567 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5568 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5569 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5570
5571 !! html/parsoid
5572 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5573
5574 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5575 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5576 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5577 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5578 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5581
5582 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5583 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5584 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5585 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5586 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5587 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5588 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5589 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5590 !! end
5591
5592 !! test
5593 Non-extlinks in brackets
5594 !! wikitext
5595 [foo]
5596 [foo bar]
5597 [foo ''bar'']
5598 [fool's] errand
5599 [fool's errand]
5600 [{{echo|foo}}]
5601 [{{echo|foo}} bar]
5602 [{{echo|foo}} ''bar'']
5603 [{{echo|foo}}l's] errand
5604 [{{echo|foo}}l's errand]
5605 [url={{echo|foo}}]
5606 [url=http://example.com]
5607 [http:// bare protocols don't count]
5608 !! html/php
5609 <p>[foo]
5610 [foo bar]
5611 [foo <i>bar</i>]
5612 [fool's] errand
5613 [fool's errand]
5614 [foo]
5615 [foo bar]
5616 [foo <i>bar</i>]
5617 [fool's] errand
5618 [fool's errand]
5619 [url=foo]
5620 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5621 [http:// bare protocols don't count]
5622 </p>
5623 !! html/parsoid
5624 <p>[foo]
5625 [foo bar]
5626 [foo <i>bar</i>]
5627 [fool's] errand
5628 [fool's errand]
5629 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5630 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5631 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5632 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5633 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5634 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5635 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5636 [http:// bare protocols don't count]</p>
5637 !! end
5638
5639 !! test
5640 Percent encoding in external links
5641 !! wikitext
5642 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5643 !! html/php
5644 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5645 </p>
5646 !! html/parsoid
5647 <p><a rel="mw:ExtLink"
5648 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5649 !! end
5650
5651 !! test
5652 Use url link syntax for links where the content is equal the link target
5653 !! wikitext
5654 http://example.com
5655 !! html/php
5656 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5657 </p>
5658 !! html/parsoid
5659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5660 !! end
5661
5662 !! test
5663 Parenthesis in external links, especially URL links
5664 !! wikitext
5665 http://example.com)
5666
5667 http://example.com/test)
5668
5669 http://example.com/(test)
5670
5671 http://example.com/((test)
5672
5673 (http://example.com/(test))
5674
5675 (http://example.com/(test)))))
5676
5677 http://example.com/a)b
5678
5679 [http://example.com) foo]
5680 !! html/php
5681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5682 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5683 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5684 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5685 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5686 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5687 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5688 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5689 </p>
5690 !! html/parsoid
5691 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5692 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5693 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5694 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5695 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5696 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5697 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5698 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5699 !! end
5700
5701 !! test
5702 Parenthesis in external links, w/ transclusion or comment
5703 !! wikitext
5704 (http://example.com/{{echo|hi}})
5705
5706 (http://example.com<!-- hi -->)
5707 !! html/php
5708 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5709 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5710 </p>
5711 !! html/parsoid
5712 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5713
5714 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5715 !! end
5716
5717 !! test
5718 Serialize <a> tags with invalid link targets as plain text
5719 !! options
5720 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5721 !! html/parsoid
5722 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5723 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5724 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5725 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5726 !! wikitext
5727 text
5728 <nowiki>*</nowiki>text
5729 <nowiki>[[foo]]</nowiki>
5730 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5731 !! end
5732
5733 !! test
5734 mw:ExtLink -vs- mw:WikiLink (T94723)
5735 !! options
5736 parsoid=html2wt
5737 !! html/parsoid
5738 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5739 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5740 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5741 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5742 <p>
5743 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5744 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5745 </p>
5746 !! wikitext
5747 [[Foo|Bar]]
5748 [[Foo|Bar]]
5749 [[wikipedia:Foo|Bar]]
5750 [[wikipedia:Foo|Bar]]
5751
5752 [[wikipedia:European_Robin|European Robin]]
5753 [[wikipedia:European_Robin|European Robin]]
5754 !! end
5755
5756 !! test
5757 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5758 !! options
5759 parsoid=wt2wt
5760 !! wikitext
5761 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5762 !! html/parsoid
5763 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5764 !! end
5765
5766
5767 ###
5768 ### Quotes
5769 ###
5770
5771 !! test
5772 Quotes
5773 !! wikitext
5774 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5775
5776 Normal text. '''''Bold italic text.''''' Normal text.
5777 !! html
5778 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5779 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5780 </p>
5781 !! end
5782
5783
5784 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5785 # parser strips. The wikitext contains just the first half of the bold
5786 # quote pair.
5787 !! test
5788 Unclosed and unmatched quotes
5789 !! wikitext
5790 '''''Bold italic text '''with bold deactivated''' in between.'''''
5791
5792 '''''Bold italic text ''with italic deactivated'' in between.'''''
5793
5794 '''Bold text..
5795
5796 ..spanning two paragraphs (should not work).'''
5797
5798 '''Bold tag left open
5799
5800 ''Italic tag left open
5801
5802 Normal text.
5803
5804 <!-- Unmatching number of opening, closing tags: -->
5805 '''This year''''s election ''should'' beat '''last year''''s.
5806
5807 ''Tom'''s car is bigger than ''Susan'''s.
5808
5809 Plain ''italic'''s plain
5810 !! html/php
5811 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5812 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5813 </p><p><b>Bold text..</b>
5814 </p><p>..spanning two paragraphs (should not work).
5815 </p><p><b>Bold tag left open</b>
5816 </p><p><i>Italic tag left open</i>
5817 </p><p>Normal text.
5818 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5819 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5820 </p><p>Plain <i>italic'</i>s plain
5821 </p>
5822 !! html/parsoid
5823 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5824 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5825 </p><p><b>Bold text..</b>
5826 </p><p>..spanning two paragraphs (should not work).<b></b>
5827 </p><p><b>Bold tag left open</b>
5828 </p><p><i>Italic tag left open</i>
5829 </p><p>Normal text.
5830 </p>
5831 <!-- Unmatching number of opening, closing tags: -->
5832 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5833 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5834 </p><p>Plain <i>italic'</i>s plain
5835 </p>
5836 !! end
5837
5838 ###
5839 ### Tables
5840 ###
5841 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5842 ###
5843
5844 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5845 # is the bare minimum required by the spec, see:
5846 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5847 # Parsoid team replies: empty table tags are legal in HTML5
5848 !! test
5849 A table with no data.
5850 !! options
5851 parsoid=wt2html
5852 !! wikitext
5853 {||}
5854 !! html/php
5855
5856 !! html/parsoid
5857 <table></table>
5858
5859 !! end
5860
5861 !! test
5862 A table with stray table end tags on start tag line (wt2html)
5863 !! options
5864 parsoid=wt2html
5865 !! wikitext
5866 {|style="color: red;"|}
5867
5868 {|style="color: red;" |}
5869 |foo
5870 |}
5871
5872 {|style="color: red;"|} id="foo"
5873 |foo
5874 |}
5875
5876 {|style="color: red;" |} id="foo"
5877 |foo
5878 |}
5879 !! html
5880 <table style="color: red;"></table>
5881
5882 <table style="color: red;">
5883 <tbody><tr>
5884 <td>foo</td>
5885 </tr></tbody>
5886 </table>
5887
5888 <table style="color: red;" id="foo">
5889 <tbody><tr>
5890 <td>foo</td>
5891 </tr></tbody>
5892 </table>
5893
5894 <table style="color: red;" id="foo">
5895 <tbody><tr>
5896 <td>foo</td>
5897 </tr></tbody>
5898 </table>
5899
5900 !! end
5901
5902 !! test
5903 A table with no data (take 2)
5904 !! wikitext
5905 {|
5906 |}
5907 !! html/parsoid
5908 <table></table>
5909 !! end
5910
5911 # A table with nothing but a caption is invalid XHTML, we might want to render
5912 # this as <p>caption</p>
5913 # Parsoid team replies: table with only a caption is legal in HTML5
5914 !! test
5915 A table with nothing but a caption
5916 !! wikitext
5917 {|
5918 |+ caption
5919 |}
5920 !! html/php
5921 <table>
5922 <caption> caption
5923 </caption><tr><td></td></tr></table>
5924
5925 !! html/parsoid
5926 <table><caption> caption</caption></table>
5927 !! end
5928
5929 !! test
5930 A table with caption with default-spaced attributes and a table row
5931 !! wikitext
5932 {|
5933 |+ style="color: red;" | caption1
5934 |-
5935 | foo
5936 |}
5937 !! html
5938 <table>
5939 <caption style="color: red;"> caption1
5940 </caption>
5941 <tr>
5942 <td> foo
5943 </td></tr></table>
5944
5945 !! end
5946
5947 !! test
5948 A table with captions with non-default spaced attributes and a table row
5949 !! wikitext
5950 {|
5951 |+style="color: red;"|caption2
5952 |+ style="color: red;"| caption3
5953 |-
5954 | foo
5955 |}
5956 !! html
5957 <table>
5958 <caption style="color: red;">caption2
5959 </caption>
5960 <caption style="color: red;"> caption3
5961 </caption>
5962 <tr>
5963 <td> foo
5964 </td></tr></table>
5965
5966 !! end
5967
5968 !! test
5969 Table td-cell syntax variations
5970 !! wikitext
5971 {|
5972 | foo bar foo | baz
5973 | foo bar foo || baz
5974 | style='color:red;' | baz
5975 | style='color:red;' || baz
5976 |}
5977 !! html
5978 <table>
5979 <tr>
5980 <td> baz
5981 </td>
5982 <td> foo bar foo </td>
5983 <td> baz
5984 </td>
5985 <td style="color:red;"> baz
5986 </td>
5987 <td> style='color:red;' </td>
5988 <td> baz
5989 </td></tr></table>
5990
5991 !! end
5992
5993 !! test
5994 Simple table
5995 !! wikitext
5996 {|
5997 | 1 || 2
5998 |-
5999 | 3 || 4
6000 |}
6001 !! html
6002 <table>
6003 <tr>
6004 <td> 1 </td>
6005 <td> 2
6006 </td></tr>
6007 <tr>
6008 <td> 3 </td>
6009 <td> 4
6010 </td></tr></table>
6011
6012 !! end
6013
6014 !! test
6015 Simple table but with multiple dashes for row wikitext
6016 !! wikitext
6017 {|
6018 | foo
6019 |-----
6020 | bar
6021 |}
6022 !! html
6023 <table>
6024 <tr>
6025 <td> foo
6026 </td></tr>
6027 <tr>
6028 <td> bar
6029 </td></tr></table>
6030
6031 !! end
6032
6033 !! test
6034 Multiplication table
6035 !! wikitext
6036 {| border="1" cellpadding="2"
6037 |+Multiplication table
6038 |-
6039 ! &times; !! 1 !! 2 !! 3
6040 |-
6041 ! 1
6042 | 1 || 2 || 3
6043 |-
6044 ! 2
6045 | 2 || 4 || 6
6046 |-
6047 ! 3
6048 | 3 || 6 || 9
6049 |-
6050 ! 4
6051 | 4 || 8 || 12
6052 |-
6053 ! 5
6054 | 5 || 10 || 15
6055 |}
6056 !! html
6057 <table border="1" cellpadding="2">
6058 <caption>Multiplication table
6059 </caption>
6060 <tr>
6061 <th> &#215; </th>
6062 <th> 1 </th>
6063 <th> 2 </th>
6064 <th> 3
6065 </th></tr>
6066 <tr>
6067 <th> 1
6068 </th>
6069 <td> 1 </td>
6070 <td> 2 </td>
6071 <td> 3
6072 </td></tr>
6073 <tr>
6074 <th> 2
6075 </th>
6076 <td> 2 </td>
6077 <td> 4 </td>
6078 <td> 6
6079 </td></tr>
6080 <tr>
6081 <th> 3
6082 </th>
6083 <td> 3 </td>
6084 <td> 6 </td>
6085 <td> 9
6086 </td></tr>
6087 <tr>
6088 <th> 4
6089 </th>
6090 <td> 4 </td>
6091 <td> 8 </td>
6092 <td> 12
6093 </td></tr>
6094 <tr>
6095 <th> 5
6096 </th>
6097 <td> 5 </td>
6098 <td> 10 </td>
6099 <td> 15
6100 </td></tr></table>
6101
6102 !! end
6103
6104 !! test
6105 Accept "||" in table headings
6106 !! wikitext
6107 {|
6108 !h1 || h2
6109 |}
6110 !! html
6111 <table>
6112 <tr>
6113 <th>h1 </th>
6114 <th> h2
6115 </th></tr></table>
6116
6117 !! end
6118
6119 !! test
6120 Accept "!!" in table data
6121 !! wikitext
6122 {|
6123 | Foo!! ||
6124 |}
6125 !! html
6126 <table>
6127 <tr>
6128 <td> Foo!! </td>
6129 <td>
6130 </td></tr></table>
6131
6132 !! html/parsoid
6133 <table>
6134 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6135 </tbody></table>
6136 !! end
6137
6138 !! test
6139 Accept "||" in indented table headings
6140 !! wikitext
6141 :{|
6142 !h1 || h2
6143 |}
6144 !! html
6145 <dl><dd><table>
6146 <tr>
6147 <th>h1 </th>
6148 <th> h2
6149 </th></tr></table></dd></dl>
6150
6151 !! end
6152
6153 !! test
6154 Accept "!!" in templates
6155 !! wikitext
6156 {|
6157 !a {{echo|b!!c}}
6158 |}
6159 !! html/php
6160 <table>
6161 <tr>
6162 <th>a b</th>
6163 <th>c
6164 </th></tr></table>
6165
6166 !! html/parsoid
6167 <table>
6168 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6169 !! end
6170
6171 !! test
6172 Accept "!!" in table headings after newline
6173 !! wikitext
6174 {|
6175 !a
6176 b!!c
6177 |}
6178 !! html/php
6179 <table>
6180 <tr>
6181 <th>a
6182 <p>b!!c
6183 </p>
6184 </th></tr></table>
6185
6186 !! html/parsoid
6187 <table>
6188 <tbody><tr><th>a
6189 <p>b!!c</p></th></tr>
6190 </tbody></table>
6191 !! end
6192
6193 !! test
6194 Accept "!!" in table data of mixed wikitext / html syntax
6195 !! wikitext
6196 {|
6197 !a
6198 <tr><td>b!!c</td></tr>
6199 |}
6200 !! html+tidy
6201 <table>
6202 <tr>
6203 <th>a</th>
6204 </tr>
6205 <tr>
6206 <td>b!!c</td>
6207 </tr>
6208 </table>
6209 !! html/parsoid
6210 <table>
6211 <tbody><tr><th>a</th></tr>
6212 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6213 </tbody></table>
6214 !! end
6215
6216 !! test
6217 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6218 !! wikitext
6219 {|
6220 !| h1
6221 || a
6222 |}
6223 !! html
6224 <table>
6225 <tr>
6226 <th> h1
6227 </th>
6228 <td> a
6229 </td></tr></table>
6230
6231 !! end
6232
6233 !!test
6234 Accept "| !" at start of line in tables (ignore !-attribute)
6235 !! wikitext
6236 {|
6237 |-
6238 | !style="color:red" | bar
6239 |}
6240 !! html
6241 <table>
6242
6243 <tr>
6244 <td> bar
6245 </td></tr></table>
6246
6247 !!end
6248
6249 !!test
6250 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6251 !! wikitext
6252 {|
6253 |-
6254 |style='color:red;'|+1
6255 |style='color:blue;'|-1
6256 |-
6257 | 1 || 2 || 3
6258 | 1 ||+2 ||-3
6259 |-
6260 | +1
6261 | -1
6262 |}
6263 !! html
6264 <table>
6265
6266 <tr>
6267 <td style="color:red;">+1
6268 </td>
6269 <td style="color:blue;">-1
6270 </td></tr>
6271 <tr>
6272 <td> 1 </td>
6273 <td> 2 </td>
6274 <td> 3
6275 </td>
6276 <td> 1 </td>
6277 <td>+2 </td>
6278 <td>-3
6279 </td></tr>
6280 <tr>
6281 <td> +1
6282 </td>
6283 <td> -1
6284 </td></tr></table>
6285
6286 !!end
6287
6288 !! test
6289 Table rowspan
6290 !! wikitext
6291 {| border=1
6292 | Cell 1, row 1
6293 |rowspan=2| Cell 2, row 1 (and 2)
6294 | Cell 3, row 1
6295 |-
6296 | Cell 1, row 2
6297 | Cell 3, row 2
6298 |}
6299 !! html
6300 <table border="1">
6301 <tr>
6302 <td> Cell 1, row 1
6303 </td>
6304 <td rowspan="2"> Cell 2, row 1 (and 2)
6305 </td>
6306 <td> Cell 3, row 1
6307 </td></tr>
6308 <tr>
6309 <td> Cell 1, row 2
6310 </td>
6311 <td> Cell 3, row 2
6312 </td></tr></table>
6313
6314 !! end
6315
6316 !! test
6317 Nested table
6318 !! wikitext
6319 {| border=1
6320 | &alpha;
6321 |
6322 {| bgcolor=#ABCDEF border=2
6323 |nested
6324 |-
6325 |table
6326 |}
6327 |the original table again
6328 |}
6329 !! html
6330 <table border="1">
6331 <tr>
6332 <td> &#945;
6333 </td>
6334 <td>
6335 <table bgcolor="#ABCDEF" border="2">
6336 <tr>
6337 <td>nested
6338 </td></tr>
6339 <tr>
6340 <td>table
6341 </td></tr></table>
6342 </td>
6343 <td>the original table again
6344 </td></tr></table>
6345
6346 !! end
6347
6348 !! test
6349 Invalid attributes in table cell (bug 1830)
6350 !! wikitext
6351 {|
6352 |Cell:|broken
6353 |}
6354 !! html
6355 <table>
6356 <tr>
6357 <td>broken
6358 </td></tr></table>
6359
6360 !! end
6361
6362 !! test
6363 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6364 !! wikitext
6365 {|
6366 | title="foo" |bar
6367 | title="foo<nowiki>|</nowiki>" |bar
6368 | title="foo<nowiki>|</nowiki>" bar
6369 |}
6370 !! html/php
6371 <table>
6372 <tr>
6373 <td title="foo">bar
6374 </td>
6375 <td title="foo&#124;">bar
6376 </td>
6377 <td> title="foo|" bar
6378 </td></tr></table>
6379
6380 !! html/parsoid
6381 <table>
6382 <tbody><tr><td title="foo">bar</td>
6383 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6384 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6385 </tbody></table>
6386 !! end
6387
6388 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6389 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6390 # *2wt modes will fail.
6391 !! test
6392 Table security: embedded pipes
6393 !! options
6394 parsoid=wt2html,html2html
6395 !! wikitext
6396 {|
6397 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6398 !! html/php
6399 <table>
6400 <tr>
6401 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6402 <td>]" onmouseover="alert(document.cookie)"&gt;test
6403 </td>
6404 </tr>
6405 </table>
6406
6407 !! html/parsoid
6408 <table><tbody>
6409 <tr>
6410 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6411 !! end
6412
6413 !! test
6414 Element attributes with double ! should not be broken up by <th>
6415 !! wikitext
6416 {|
6417 ! hi <div class="!!">ha</div> ho
6418 |}
6419 !! html/php
6420 <table>
6421 <tr>
6422 <th> hi <div class="!!">ha</div> ho
6423 </th></tr></table>
6424
6425 !! html/parsoid
6426 <table>
6427 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6428 </tbody></table>
6429 !! end
6430
6431 !! test
6432 ! and || in element attributes should not be parsed as <th>/<td>
6433 !! wikitext
6434 {|
6435 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6436 |}
6437 !! html/php
6438 <table>
6439 <tr>
6440 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6441 </td></tr></table>
6442
6443 !! html/parsoid
6444 <table>
6445 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6446 </tbody></table>
6447 !! end
6448
6449 # FIXME: The output seems broken. Filed as T110268.
6450 !! test
6451 ! and || in td attributes should not be parsed as <th>/<td>
6452 !! options
6453 parsoid=wt2html
6454 !! wikitext
6455 {|
6456 | style="color: red !important;" data-contrived="put this here ||" | foo
6457 |}
6458 !! html/php
6459 <table>
6460 <tr>
6461 <td> style="color: red !important;" data-contrived="put this here </td>
6462 <td> foo
6463 </td></tr></table>
6464
6465 !! html/parsoid
6466 <table>
6467 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6468 </tbody></table>
6469 !! end
6470
6471 !! test
6472 Break on | in element attribute in template
6473 !! options
6474 parsoid=wt2html,html2html
6475 !! wikitext
6476 {{echo|1=<div class="hi|ho">ha</div>}}
6477 !! html/php
6478 <p>ho"&gt;ha&lt;/div&gt;
6479 </p>
6480 !! html/parsoid
6481 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6482 !! end
6483
6484 !! test
6485 Break on | in element attribute name in template
6486 !! wikitext
6487 {{echo|<div cla|ss="hiho">ha</div>}}
6488 !! html/parsoid
6489 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6490 !! end
6491
6492 !! test
6493 Don't break on | in extension attribute in template
6494 !! wikitext
6495 {{echo|<ref name="hi|ho">ha</ref>}}
6496
6497 <references />
6498 !! html/parsoid
6499 <p><span about="#mwt2" class="mw-ref" id="cite_ref-hi.7Cho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi.7Cho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
6500
6501 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6502 !! end
6503
6504 ## We don't support roundtripping of these attributes in Parsoid.
6505 ## Selective serialization takes care of preventing dirty diffs.
6506 ## But, on edits, we dirty-diff the invalid attribute text.
6507 !! test
6508 Invalid text in table attributes should be discarded
6509 !! options
6510 parsoid=wt2html
6511 !! wikitext
6512 {| <span>boo</span> style='border:1px solid black'
6513 | <span>boo</span> style='color:blue' | 1
6514 |<span>boo</span> style='color:blue'| 2
6515 |}
6516 !! html/php
6517 <table style="border:1px solid black">
6518 <tr>
6519 <td style="color:blue"> 1
6520 </td>
6521 <td style="color:blue"> 2
6522 </td></tr></table>
6523
6524 !! html/parsoid
6525 <table style="border:1px solid black">
6526 <tr>
6527 <td style="color:blue"> 1</td>
6528 <td style="color:blue"> 2</td>
6529 </tr>
6530 </table>
6531 !! end
6532
6533 !! test
6534 Invalid text in table attributes should be preserved by selective serializer
6535 !! options
6536 parsoid={
6537 "modes": ["selser"],
6538 "changes": [
6539 ["td:first-child", "text", "abc"],
6540 ["td + td", "text", "xyz"]
6541 ]
6542 }
6543 !! wikitext
6544 {| <span>boo</span> style='border:1px solid black'
6545 | <span>boo</span> style='color:blue' | 1
6546 |<span>boo</span> style='color:blue'| 2
6547 |}
6548 !! wikitext/edited
6549 {| <span>boo</span> style='border:1px solid black'
6550 | <span>boo</span> style='color:blue' |abc
6551 |<span>boo</span> style='color:blue'|xyz
6552 |}
6553 !! end
6554
6555 !! test
6556 1. Template-generated table cell attributes and cell content
6557 !! wikitext
6558 {|
6559 |{{table_attribs}}
6560 | {{table_attribs}}
6561 || {{table_attribs_5}}
6562 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6563 |align=center {{table_attribs}}
6564 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6565 |}
6566 !! html
6567 <table>
6568 <tr>
6569 <td style="color:red;">Foo
6570 </td>
6571 <td style="color:red;">Foo
6572 </td>
6573 <td> style="color:red;"</td>
6574 <td>Bar
6575 </td>
6576 <td style="color:red;">Foo
6577 </td>
6578 <td align="center" style="color:red;">Foo
6579 </td>
6580 <td align="center" style="color:red;">Foo
6581 </td></tr></table>
6582
6583 !! end
6584
6585 !! test
6586 2. Template-generated table cell attributes and cell content
6587 !! wikitext
6588 {|
6589 |{{table_attribs_2}}
6590 |}
6591 !! html/php
6592 <table>
6593 <tr>
6594 <td style="color:red;">Foo
6595 </td>
6596 <td>Bar</td>
6597 <td>Baz
6598 </td></tr></table>
6599
6600 !! html/parsoid
6601 <table>
6602 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6603 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6604 </tbody></table>
6605 !! end
6606
6607 !! test
6608 3. Template-generated table cell attributes and cell content
6609 !! wikitext
6610 {|
6611 !align=center {{table_header_cells}}
6612 |-
6613 |align=center {{table_cells}}
6614 |}
6615 !! html/php
6616 <table>
6617 <tr>
6618 <th align="center" style="color:red;">Foo</th>
6619 <th style="color:red;"><i>Bar</i></th>
6620 <th style="color:brown;"><i>Foo</i> and Baz
6621 </th></tr>
6622 <tr>
6623 <td align="center" style="color:red;">Foo</td>
6624 <td style="color:red;"><i>Bar</i></td>
6625 <td style="color:brown;"><i>Foo</i> and Baz
6626 </td></tr></table>
6627
6628 !! html/parsoid
6629 <table>
6630 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6631 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6632 </tbody></table>
6633 !! end
6634
6635 !! test
6636 4. Template-generated table cell attributes and cell content inside a templated table
6637 !! wikitext
6638 {{tbl-start}}
6639 !align=center {{table_header_cells}}
6640 |-
6641 |align=center {{table_cells}}
6642 {{tbl-end}}
6643 !! html/php
6644 <table>
6645 <tr>
6646 <th align="center" style="color:red;">Foo</th>
6647 <th style="color:red;"><i>Bar</i></th>
6648 <th style="color:brown;"><i>Foo</i> and Baz
6649 </th></tr>
6650 <tr>
6651 <td align="center" style="color:red;">Foo</td>
6652 <td style="color:red;"><i>Bar</i></td>
6653 <td style="color:brown;"><i>Foo</i> and Baz
6654 </td></tr></table>
6655
6656 !! html/parsoid
6657 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6658 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6659 <tr>
6660 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6661 </tbody></table>
6662 !! end
6663
6664 ## Edge case fix to prevent future regressions
6665 !! test
6666 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6667 !! wikitext
6668 {|
6669 |{{table_attribs_7}}
6670 |}
6671 <references />
6672 !! html/parsoid
6673 <table>
6674 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6675 </tbody></table>
6676 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6677 !! end
6678
6679 !! test
6680 Table with row followed by newlines and table heading
6681 !! options
6682 parsoid=wt2html,html2html
6683 !! wikitext
6684 {|
6685 |-
6686
6687 ! foo
6688 |}
6689 !! html/*
6690 <table>
6691
6692
6693 <tr>
6694 <th> foo
6695 </th></tr></table>
6696
6697 !! end
6698
6699 !! test
6700 Table with empty line following the start tag
6701 !! options
6702 parsoid=wt2html,html2html
6703 !! wikitext
6704 {|
6705
6706 |-
6707 | foo
6708 |}
6709 !! html/*
6710 <table>
6711
6712
6713 <tr>
6714 <td> foo
6715 </td></tr></table>
6716
6717 !! end
6718
6719 !! test
6720 Table attributes with empty value
6721 !! options
6722 parsoid=wt2html,html2html
6723 !! wikitext
6724 {|
6725 | style=| hello
6726 |}
6727 !! html/php
6728 <table>
6729 <tr>
6730 <td style=""> hello
6731 </td></tr></table>
6732
6733 !! html/parsoid
6734 <table>
6735 <tbody><tr><td style=""> hello</td></tr>
6736 </tbody></table>
6737 !! end
6738
6739 !! test
6740 Wikitext table with a lot of comments
6741 !! wikitext
6742 {|
6743 <!-- c0 -->
6744 | foo
6745 <!-- c1 -->
6746 |-<!-- c2 -->
6747 <!-- c3 -->
6748 |<!-- c4 -->
6749 <!-- c5 -->
6750 |}
6751 !! html
6752 <table>
6753 <tr>
6754 <td> foo
6755 </td></tr>
6756 <tr>
6757 <td>
6758 </td></tr></table>
6759
6760 !! end
6761
6762 !! test
6763 Wikitext table comments represented in parsoid dom
6764 !! wikitext
6765 {|<!--c1--><!--c2-->
6766 |-<!--c3-->
6767 | x
6768 |}
6769 !! html/php+tidy
6770 <table>
6771 <tr>
6772 <td>x</td>
6773 </tr>
6774 </table>
6775 !! html/parsoid
6776 <table><!--c1--><!--c2-->
6777 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6778 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6779 </tbody></table>
6780 !! end
6781
6782 !! test
6783 Wikitext table with double-line table cell
6784 !! wikitext
6785 {|
6786 |a
6787 b
6788 |}
6789 !! html
6790 <table>
6791 <tr>
6792 <td>a
6793 <p>b
6794 </p>
6795 </td></tr></table>
6796
6797 !! end
6798
6799 !! test
6800 Table cell with a single comment
6801 !! wikitext
6802 {|
6803 | <!-- c1 -->
6804 | a
6805 |}
6806 !! html
6807 <table>
6808 <tr>
6809 <td>
6810 </td>
6811 <td> a
6812 </td></tr></table>
6813
6814 !! end
6815
6816 !! test
6817 Table-cell after a comment-only-empty-line
6818 !! wikitext
6819 {|
6820 |a
6821 <!--c1-->
6822 <!--c2-->| b
6823 |}
6824 !! html
6825 <table>
6826 <tr>
6827 <td>a
6828 </td>
6829 <td> b
6830 </td></tr></table>
6831
6832 !! html/parsoid
6833 <table>
6834 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6835 <!--c1-->
6836 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6837 </tbody></table>
6838
6839 !! end
6840
6841 !! test
6842 Build table with {{!}}
6843 !! wikitext
6844 {{{!}} class="wikitable"
6845 ! header
6846 ! second header
6847 {{!}}- style="color:red;"
6848 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6849 {{!}}}
6850 !! html
6851 <table class="wikitable">
6852 <tr>
6853 <th> header
6854 </th>
6855 <th> second header
6856 </th></tr>
6857 <tr style="color:red;">
6858 <td> data </td>
6859 <td style="color:red;"> second data
6860 </td></tr></table>
6861
6862 !! end
6863
6864 !! test
6865 Build table with pipe as data
6866 !! wikitext
6867 {| class="wikitable"
6868 ! header
6869 ! second header
6870 |- style="color:red;"
6871 | data || style="color:red;" | second data
6872 |-
6873 | style="color:red;" | data with | || style="color:red;" | second data with |
6874 |-
6875 || data with | ||| second data with |
6876 |}
6877 !! html
6878 <table class="wikitable">
6879 <tr>
6880 <th> header
6881 </th>
6882 <th> second header
6883 </th></tr>
6884 <tr style="color:red;">
6885 <td> data </td>
6886 <td style="color:red;"> second data
6887 </td></tr>
6888 <tr>
6889 <td style="color:red;"> data with | </td>
6890 <td style="color:red;"> second data with |
6891 </td></tr>
6892 <tr>
6893 <td> data with | </td>
6894 <td> second data with |
6895 </td></tr></table>
6896
6897 !! end
6898
6899 !! test
6900 Build table with wikilink
6901 !! wikitext
6902 {| class="wikitable"
6903 ! header || second header
6904 |- style="color:red;"
6905 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6906 |-
6907 | data || second data [[Main Page|link|text with pipe]]
6908 |}
6909 !! html
6910 <table class="wikitable">
6911 <tr>
6912 <th> header </th>
6913 <th> second header
6914 </th></tr>
6915 <tr style="color:red;">
6916 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6917 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6918 </td></tr>
6919 <tr>
6920 <td> data </td>
6921 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6922 </td></tr></table>
6923
6924 !! end
6925
6926 # The expected HTML structure in this test is debatable. The PHP parser does
6927 # not parse this kind of table at all. The main focus for Parsoid is on
6928 # round-tripping, so this output is ok for now. TODO: revisit!
6929 !! test
6930 Wikitext table with html-syntax row
6931 !! wikitext
6932 {|
6933 |-
6934 <td>foo</td>
6935 |}
6936 !! html/parsoid
6937 <table>
6938 <tbody>
6939 <tr>
6940 <td>foo</td></tr></tbody></table>
6941 !! end
6942
6943 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6944 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6945 ## PHP parser, which tidy then compounds by fostering the content
6946 ## entirely out of the table. Parsoid recognizes the table context
6947 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6948 ## depends on PHP's treatment of broken table markup!
6949 !! test
6950 Implicit <td> after a |-
6951 !! options
6952 parsoid=wt2html,html2html
6953 !! wikitext
6954 {|
6955 |-
6956 a
6957 |}
6958 !! html/php
6959 <table>
6960
6961 a
6962 </table>
6963
6964 !! html/php+tidy
6965 <p>a</p>
6966 !! html/parsoid
6967 <table>
6968 <tr><td>a</td></tr>
6969 </table>
6970 !! end
6971
6972 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6973 !! test
6974 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6975 !! options
6976 parsoid=wt2html,html2html
6977 !! wikitext
6978 {|
6979 |-
6980 |
6981 a
6982 |-
6983 b
6984 |}
6985 !! html/php
6986 <table>
6987
6988 <tr>
6989 <td>
6990 <pre>a
6991 </pre>
6992 </td></tr>
6993 b
6994 </table>
6995
6996 !! html/php+tidy
6997 <p>b</p>
6998 <table>
6999 <tr>
7000 <td>
7001 <pre>
7002 a
7003 </pre></td>
7004 </tr>
7005 </table>
7006 !! html/parsoid
7007 <table>
7008 <tbody>
7009 <tr><td><pre>a</pre></td></tr>
7010 <tr><td> b</td></tr>
7011 </tbody>
7012 </table>
7013 !! end
7014
7015 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
7016 # Parsoid generates the missing <td>, so wt2wt won't succeed.
7017 !! test
7018 Lists should be recognized in an implicit <td> context
7019 !! options
7020 parsoid=wt2html,html2html
7021 !! wikitext
7022 {|
7023 |-
7024 *a
7025 |}
7026 !! html/php
7027 <table>
7028
7029 <ul><li>a</li></ul>
7030 </table>
7031
7032 !! html/php+tidy
7033 <ul>
7034 <li>a</li>
7035 </ul>
7036 !! html/parsoid
7037 <table>
7038 <tr>
7039 <td><ul>
7040 <li>a</li>
7041 </ul></td>
7042 </tr>
7043 </table>
7044 !! end
7045
7046 !! test
7047 Table cells not properly parsed in an implicit-td context
7048 !! wikitext
7049 {|
7050 |-
7051 {{table_attribs_4}} || a || b
7052 |}
7053 !! html/php+tidy
7054 <table>
7055 <tr>
7056 <td style="background-color:#DC241f;" width="10px"></td>
7057 <td>a</td>
7058 <td>b</td>
7059 </tr>
7060 </table>
7061 !! html/parsoid
7062 <table>
7063 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7064 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
7065 </tbody></table>
7066 !! end
7067
7068 !! test
7069 Parsoid: Round-trip tables directly followed by content (bug 51219)
7070 !! options
7071 parsoid=wt2html,wt2wt
7072 !! wikitext
7073 {|
7074 |foo
7075 |} bar
7076
7077 {|
7078 |baz
7079 |}<b>quux</b>
7080 !! html+tidy
7081 <table>
7082 <tr>
7083 <td>foo</td>
7084 </tr>
7085 </table>
7086 <p>bar</p>
7087 <table>
7088 <tr>
7089 <td>baz</td>
7090 </tr>
7091 </table>
7092 <p><b>quux</b></p>
7093 !! end
7094
7095 !! test
7096 Parsoid: Default to a newline after tables in new content (bug 51219)
7097 !! options
7098 parsoid=html2wt
7099 !! html/parsoid
7100 <table><tbody>
7101 <tr><td>foo</td></tr></tbody></table> bar
7102 <table><tbody>
7103 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7104 !! wikitext
7105 {|
7106 |foo
7107 |}
7108 <nowiki> </nowiki>bar
7109 {|
7110 |baz
7111 |}
7112 '''quux'''
7113 !! end
7114
7115 !! test
7116 Parsoid: newline inducing block nodes don't suppress <nowiki>
7117 !! options
7118 parsoid=html2wt
7119 !! html/parsoid
7120 a<h1>foo</h1>
7121 !! wikitext
7122 <nowiki> </nowiki>a
7123
7124 = foo =
7125 !! end
7126
7127 !! test
7128 Parsoid: Row-syntax table headings followed by comment & table cells
7129 !! options
7130 parsoid=wt2html,wt2wt
7131 !! wikitext
7132 {|
7133 ! foo || bar
7134 <!-- foo --> || baz || quux
7135 |}
7136 !! html/php
7137 <table>
7138 <tr>
7139 <th> foo </th>
7140 <th> bar
7141 </th>
7142 <td> baz </td>
7143 <td> quux
7144 </td></tr></table>
7145
7146 !! html/parsoid
7147 <table>
7148 <tbody><tr><th> foo </th><th> bar
7149 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7150 </tbody></table>
7151 !! end
7152
7153 !!test
7154 Parsoid: Recover better from broken table attributes
7155 !!options
7156 parsoid=wt2html
7157 !!wikitext
7158 {| class="foo
7159 | class="bar" |
7160 foo
7161 |}
7162 !!html/php+tidy
7163 <table class="foo">
7164 <tr>
7165 <td class="bar">
7166 <p>foo</p>
7167 </td>
7168 </tr>
7169 </table>
7170 !!html/parsoid
7171 <table class="foo">
7172 <tr>
7173 <td class="bar">
7174 <p>foo</p></td></tr>
7175 </tbody></table>
7176 !!end
7177
7178 !! test
7179 Tables: Digest broken attributes on table and tr tag
7180 !! options
7181 parsoid=wt2html
7182 !! wikitext
7183 {| || |} ++
7184 |- || || ++ --
7185 |- > [
7186 |}
7187 !! html
7188 <table>
7189 <tbody>
7190 <tr></tr>
7191 <tr></tr>
7192 </tbody></table>
7193 !! end
7194
7195 # T137406: Whitespace in the HTML
7196 !! test
7197 1. Generate correct wikitext for tables with thead/tbody/tfoot
7198 !! options
7199 parsoid=html2wt
7200 !! html/parsoid
7201 <table>
7202 <caption>Test</caption>
7203 <thead>
7204 <tr>
7205 <th>Month</th>
7206 <th>Savings</th>
7207 </tr>
7208 </thead>
7209 <tbody>
7210 <tr>
7211 <td>January</td>
7212 <td>$100</td>
7213 </tr>
7214 <tr>
7215 <td>February</td>
7216 <td>$80</td>
7217 </tr>
7218 </tbody>
7219 <tfoot>
7220 <tr>
7221 <td>Sum</td>
7222 <td>$180</td>
7223 </tr>
7224 </tfoot>
7225 </table>
7226 !! wikitext
7227 {|
7228 |+Test
7229 !Month
7230 !Savings
7231 |-
7232 |January
7233 |$100
7234 |-
7235 |February
7236 |$80
7237 |-
7238 |Sum
7239 |$180
7240 |}
7241 !! html/php+tidy
7242 <table>
7243 <caption>Test</caption>
7244 <tr>
7245 <th>Month</th>
7246 <th>Savings</th>
7247 </tr>
7248 <tr>
7249 <td>January</td>
7250 <td>$100</td>
7251 </tr>
7252 <tr>
7253 <td>February</td>
7254 <td>$80</td>
7255 </tr>
7256 <tr>
7257 <td>Sum</td>
7258 <td>$180</td>
7259 </tr>
7260 </table>
7261 !! end
7262
7263 # T137406: No whitespace in the HTML
7264 !! test
7265 2. Generate correct wikitext for tables with thead/tbody/tfoot
7266 !! options
7267 parsoid=html2wt
7268 !! html/parsoid
7269 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7270 !! wikitext
7271 {|
7272 !heading
7273 |-
7274 |foo
7275 |}
7276 !! end
7277
7278 !! test
7279 Testing serialization after deletion in references
7280 !! options
7281 parsoid={
7282 "modes": ["wt2wt"],
7283 "changes": [
7284 ["#x", "remove"]
7285 ]
7286 }
7287 !! wikitext
7288 hi <ref><div id="x">ho</div></ref>
7289
7290 <references />
7291 !! wikitext/edited
7292 hi <ref></ref>
7293
7294 <references />
7295 !! end
7296
7297 !!test
7298 Testing serialization after deletion of table cells
7299 !!options
7300 parsoid={
7301 "modes": ["wt2wt", "selser"],
7302 "changes": [
7303 ["#x", "remove"]
7304 ]
7305 }
7306 !!wikitext
7307 {|
7308 !h1 !!h2 !!h3
7309 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7310 |}
7311 !! wikitext/edited
7312 {|
7313 !h1 !!h2 !!h3
7314 |c2 |||c3
7315 |}
7316 !!end
7317
7318 !! test
7319 Testing selser after addition of new row before first row (T125419)
7320 !! options
7321 parsoid={
7322 "modes": ["wt2wt", "selser"],
7323 "changes": [
7324 [ "tr", "before", "<tr><td>X</td></tr>" ]
7325 ]
7326 }
7327 !! wikitext
7328 {|
7329 |a
7330 |}
7331 !! wikitext/edited
7332 {|
7333 |X
7334 |-
7335 |a
7336 |}
7337 !! end
7338
7339 !! test
7340 Serialize new table rows in a HTML table using HTML tags
7341 !! options
7342 parsoid={
7343 "modes": ["wt2wt", "selser"],
7344 "changes": [
7345 [ "tr", "before", "<tr><td>X</td></tr>" ]
7346 ]
7347 }
7348 !! wikitext
7349 <table><tr><td>a</td></tr></table>
7350 !! wikitext/edited
7351 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7352 !! end
7353
7354 !! test
7355 Serialize new table cells in a HTML row using HTML tags
7356 !! options
7357 parsoid={
7358 "modes": ["wt2wt", "selser"],
7359 "changes": [
7360 [ "td", "before", "<td>X</td>" ]
7361 ]
7362 }
7363 !! wikitext
7364 <table><tr><td>a</td></tr></table>
7365 !! wikitext/edited
7366 <table><tr><td>X</td><td>a</td></tr></table>
7367 !! end
7368
7369 !! test
7370 Wikitext tables can be nested inside HTML tables
7371 !! options
7372 parsoid=html2wt
7373 !! html
7374 <table data-parsoid='{"stx":"html"}'>
7375 <tr><td>
7376 <table>
7377 <tr><td>foo</td></tr>
7378 </table>
7379 </td></tr>
7380 </table>
7381 !! wikitext
7382 <table>
7383 <tr><td>
7384 {|
7385 |foo
7386 |}
7387 </td></tr>
7388 </table>
7389 !! end
7390
7391 !! test
7392 Serialize wikitext list items as HTML list items when embedded in a HTML list
7393 !! options
7394 parsoid=html2wt
7395 !! html
7396 <ul data-parsoid='{"stx": "html"}'>
7397 <li data-parsoid='{}'>a</li>
7398 <li>b</li>
7399 </ul>
7400 !! wikitext
7401 <ul>
7402 <li>a</li>
7403 <li>b</li>
7404 </ul>
7405 !! end
7406
7407 # SSS FIXME: Is this actually a good thing given the
7408 # odd nested list output that is generated by MW?
7409 # <ul><li>foo<ul>..</ul></li></ul> instead of
7410 # <ul><li>foo</li><ul>..</ul></ul>
7411 !! test
7412 Wikitext lists can be nested inside HTML lists
7413 !! options
7414 parsoid=html2wt
7415 !! html
7416 <ul data-parsoid='{"stx": "html"}'>
7417 <li data-parsoid='{"stx": "html"}'>a
7418 <ul><li>b</li></ul>
7419 </li>
7420 </ul>
7421
7422 <ul data-parsoid='{"stx": "html"}'>
7423 <li>x
7424 <ul><li>y</li></ul>
7425 </li>
7426 </ul>
7427 !! wikitext
7428 <ul>
7429 <li>a
7430 * b
7431 </li>
7432 </ul>
7433
7434 <ul>
7435 <li>x
7436 * y
7437 </li>
7438 </ul>
7439 !! end
7440
7441 ###
7442 ### Internal links
7443 ###
7444 !! test
7445 Plain link, capitalized
7446 !! wikitext
7447 [[Main Page]]
7448 !! html
7449 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7450 </p>
7451 !! end
7452
7453 !! test
7454 Plain link, uncapitalized
7455 !! wikitext
7456 [[main Page]]
7457 !! html
7458 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7459 </p>
7460 !! end
7461
7462 !! test
7463 Piped link
7464 !! wikitext
7465 [[Main Page|The Main Page]]
7466 !! html
7467 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7468 </p>
7469 !! end
7470
7471 !! test
7472 Piped link with comment in link text
7473 !! wikitext
7474 [[Main Page|The Main<!--front--> Page]]
7475 !! html
7476 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7477 </p>
7478 !! end
7479
7480 !! test
7481 Piped link with multiple pipe characters in link text
7482 !! wikitext
7483 [[Main Page||The|Main|Page|]]
7484 !! html/php
7485 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7486 </p>
7487 !! html/parsoid
7488 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7489 !! end
7490
7491 !! test
7492 Piped link with no link text
7493 !! wikitext
7494 [[Thomas Bek (bishop of St David's)|]]
7495 !! html/php
7496 <p>[[Thomas Bek (bishop of St David's)|]]
7497 </p>
7498 !! html/parsoid
7499 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7500 !! end
7501
7502 !! test
7503 Piped link with empty link text
7504 !! wikitext
7505 [[Main Page|<nowiki />]] - empty nowiki
7506 [[Main Page| ]] - empty space
7507 [[Main Page|&nbsp;]] - empty non breaking space
7508 !! html/php
7509 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7510 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7511 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7512 </p>
7513 !! html/parsoid
7514 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7515 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7516 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7517 !! end
7518
7519 !! test
7520 Broken link
7521 !! wikitext
7522 [[Zigzagzogzagzig]]
7523 !! html
7524 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7525 </p>
7526 !! end
7527
7528 !! test
7529 Broken link with fragment
7530 !! wikitext
7531 [[Zigzagzogzagzig#zug]]
7532 !! html
7533 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7534 </p>
7535 !! end
7536
7537 !! test
7538 Special page link with fragment
7539 !! wikitext
7540 [[Special:Version#anchor]]
7541 !! html
7542 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7543 </p>
7544 !! end
7545
7546 !! test
7547 Nonexistent special page link with fragment
7548 !! wikitext
7549 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7550 !! html
7551 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7552 </p>
7553 !! end
7554
7555 !! test
7556 Link with prefix
7557 !! wikitext
7558 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7559 !! html
7560 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7561 </p>
7562 !! end
7563
7564 !! test
7565 Link with suffix
7566 !! wikitext
7567 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7568 !! html
7569 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7570 </p>
7571 !! end
7572
7573 !! article
7574 prefixed article
7575 !! text
7576 Some text
7577 !! endarticle
7578
7579 !! test
7580 Bug 43661: Piped links with identical prefixes
7581 !! wikitext
7582 [[prefixed article|prefixed articles with spaces]]
7583
7584 [[prefixed article|prefixed articlesaoeu]]
7585
7586 [[Main Page|Main Page test]]
7587 !! html
7588 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7589 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7590 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7591 </p>
7592 !! end
7593
7594
7595 !! test
7596 Link with HTML entity in suffix / tail
7597 !! wikitext
7598 [[Main Page]]&quot;, [[Main Page]]&#97;
7599 !! html/php
7600 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7601 </p>
7602 !! html/parsoid
7603 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7604 !! end
7605
7606 !! test
7607 Link with 3 brackets
7608 !! wikitext
7609 [[[Main Page]]]
7610 Foo [[[Main Page]]]
7611 !! html
7612 <p>[[[Main Page]]]
7613 Foo [[[Main Page]]]
7614 </p>
7615 !! end
7616
7617 !! test
7618 Link with 4 brackets
7619 !! wikitext
7620 [[[[Main Page]]]]
7621 !! html
7622 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7623 </p>
7624 !! end
7625
7626 !! test
7627 Piped link with 3 brackets
7628 !! wikitext
7629 [[[main page|the main page]]]
7630 !! html
7631 <p>[[[main page|the main page]]]
7632 </p>
7633 !! end
7634
7635 !! test
7636 Piped link with extlink-like text
7637 !! wikitext
7638 [[Main Page|[bar]]]
7639 [[Main Page|This is a [bar]]]
7640 !! html/php
7641 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7642 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7643 </p>
7644 !! html/parsoid
7645 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7646 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7647 !! end
7648
7649 !! test
7650 Link with multiple pipes
7651 !! wikitext
7652 [[Main Page|The|Main|Page]]
7653 !! html
7654 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7655 </p>
7656 !! end
7657
7658 !! test
7659 Anchor containing a #. (bug 63430)
7660 !! wikitext
7661 [[Main Page#And#Link]]
7662 !! html/php
7663 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7664 </p>
7665 !! html/parsoid
7666 <p><a rel="mw:WikiLink" href="./Main_Page#And.23Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And.23Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7667 !! end
7668
7669 !! test
7670 Link to namespaces
7671 !! wikitext
7672 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7673 !! html
7674 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7675 </p>
7676 !! end
7677
7678 !! test
7679 Link with space in namespace
7680 !! wikitext
7681 [[User talk:Foo bar]]
7682 !! html
7683 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7684 </p>
7685 !! end
7686
7687 !! article
7688 MemoryAlpha:AlphaTest
7689 !! text
7690 This is an article in the MemoryAlpha namespace
7691 (which shadows the memoryalpha interwiki link).
7692 !! endarticle
7693
7694 !! test
7695 Namespace takes precedence over interwiki link (bug 51680)
7696 !! wikitext
7697 [[MemoryAlpha:AlphaTest]]
7698 !! html
7699 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7700 </p>
7701 !! end
7702
7703 # The previous test doesn't work correctly in html2*, due to not recognizing the
7704 # link as an internal one. This one checks for the correct behavior.
7705 !! test
7706 Link to namespace preferred over interwiki with correct rel attribute
7707 !! options
7708 parsoid=html2wt,html2html
7709 !! html/parsoid
7710 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7711 !! wikitext
7712 [[MemoryAlpha:AlphaTest]]
7713 !! end
7714
7715 !! test
7716 Piped link to namespace
7717 !! wikitext
7718 [[Meta:Disclaimers|The disclaimers]]
7719 !! html
7720 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7721 </p>
7722 !! end
7723
7724 !! test
7725 Link containing }
7726 !! wikitext
7727 [[Usually caused by a typo (oops}]]
7728 !! html
7729 <p>[[Usually caused by a typo (oops}]]
7730 </p>
7731 !! end
7732
7733 !! article
7734 7% Solution
7735 !! text
7736 Just a test of an article title containing a percent.
7737 !! endarticle
7738
7739 !! test
7740 Link containing % (not as a hex sequence)
7741 !! wikitext
7742 [[7% Solution]]
7743 [[7% Solution|7%25 Solution]]
7744 !! html/php
7745 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7746 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7747 </p>
7748 !! html/parsoid
7749 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7750 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7751 !! end
7752
7753 # note that the parsoid HTML is identical to the previous test output,
7754 # so the previous test ensures that the html2wt mode will generate the
7755 # "not as a hex sequence" wikitext.
7756 !! test
7757 Link containing % as a single hex sequence interpreted to char
7758 !! options
7759 parsoid=wt2wt,wt2html,html2html
7760 !! wikitext
7761 [[7%25 Solution]]
7762 [[7%25 Solution|7%25 Solution]]
7763 !! html/php
7764 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7765 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7766 </p>
7767 !! html/parsoid
7768 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7769 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7770 !!end
7771
7772 !! test
7773 Link containing % as a double hex sequence interpreted to hex sequence
7774 !! wikitext
7775 [[7%2525 Solution]]
7776 !! html
7777 <p>[[7%2525 Solution]]
7778 </p>
7779 !!end
7780
7781 ## Example for such a section: == < ==
7782 !! test
7783 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7784 !! wikitext
7785 [[%23%3c]][[%23%3e]]
7786 !! html/php
7787 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7788 </p>
7789 !! html/parsoid
7790 <p><a rel="mw:WikiLink" href="./Main_Page#.3C" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3C"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#.3E" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3E"},"sa":{"href":"%23%3e"}}'>#></a></p>
7791 !! end
7792
7793 !! test
7794 Link containing "<#" and ">#" as a hex sequences
7795 !! wikitext
7796 [[%3c%23]][[%3e%23]]
7797 !! html
7798 <p>[[%3c%23]][[%3e%23]]
7799 </p>
7800 !! end
7801
7802 !! test
7803 Link containing an equals sign
7804 !! wikitext
7805 [[Special:BookSources/isbn=4-00-026157-6]]
7806 !! html/php
7807 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7808 </p>
7809 !! html/parsoid
7810 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7811 !! end
7812
7813 !! article
7814 Foo~bar
7815 !! text
7816 Just a test of an article title containing a tilde.
7817 !! endarticle
7818
7819 # note that links containing signatures, like [[Foo~~~~]], are
7820 # massaged by the pre-save transform (PST) and so the tildes are never
7821 # seen by the parser.
7822 !! test
7823 Link containing a tilde
7824 !! wikitext
7825 [[Foo~bar]]
7826 !! html/php
7827 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7828 </p>
7829 !! html/parsoid
7830 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7831 !! end
7832
7833 !! test
7834 Link containing double-single-quotes '' (bug 4598)
7835 !! wikitext
7836 [[Lista d''e paise d''o munno]]
7837 !! html/php
7838 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7839 </p>
7840 !! html/parsoid
7841 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7842 !! end
7843
7844 !! test
7845 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7846 !! wikitext
7847 Some [[Link|pretty ''italics'' and stuff]]!
7848 !! html/php
7849 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
7850 </p>
7851 !! html/parsoid
7852 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7853 !! end
7854
7855 !! test
7856 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7857 !! wikitext
7858 ''Some [[Link|pretty ''italics'' and stuff]]!''
7859 !! html
7860 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
7861 </p>
7862 !! end
7863
7864 !! test
7865 Link with double quotes in title part (literal) and alternate part (interpreted)
7866 !! wikitext
7867 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7868
7869 [[''Pentecoste'']]
7870
7871 [[''Pentecoste''|Pentecoste]]
7872
7873 [[''Pentecoste''|''Pentecoste'']]
7874 !! html/php
7875 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7876 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7877 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
7878 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
7879 </p>
7880 !! html/parsoid
7881 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7882 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7883 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7884 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7885 !! end
7886
7887 !! test
7888 Broken image links with HTML captions (bug 39700)
7889 !! wikitext
7890 [[File:Nonexistent|<script></script>]]
7891 [[File:Nonexistent|100x100px|<script></script>]]
7892 [[File:Nonexistent|&lt;]]
7893 [[File:Nonexistent|a<i>b</i>c]]
7894 !! html/php
7895 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7896 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7897 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7898 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7899 </p>
7900 !! html/parsoid
7901 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7902 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7903 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7904 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7905 !! end
7906
7907 !! test
7908 Plain link to URL
7909 !! wikitext
7910 [[http://www.example.com]]
7911 !! html/php
7912 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7913 </p>
7914 !! html/parsoid
7915 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7916 !! end
7917
7918 !! test
7919 Plain link to URL with link text
7920 !! wikitext
7921 [[http://www.example.com Link text]]
7922 !! html
7923 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7924 </p>
7925 !! end
7926
7927 !! test
7928 Plain link to protocol-relative URL
7929 !! wikitext
7930 [[//www.example.com]]
7931 !! html/php
7932 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7933 </p>
7934 !! html/parsoid
7935 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7936 !! end
7937
7938 !! test
7939 Plain link to protocol-relative URL with link text
7940 !! wikitext
7941 [[//www.example.com Link text]]
7942 !! html
7943 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7944 </p>
7945 !! end
7946
7947 !! test
7948 Plain link to page with question mark in title
7949 !! wikitext
7950 [[A?b]]
7951
7952 [[A?b|Baz]]
7953 !! html
7954 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7955 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7956 </p>
7957 !! end
7958
7959
7960 # I'm fairly sure the expected result here is wrong.
7961 # We want these to be URL links, not pseudo-pages with URLs for titles....
7962 # However the current output is also pretty screwy.
7963 #
7964 # ----
7965 # I'm changing it to match the current output--it arguably makes more
7966 # sense in the light of the test above. Old expected result was:
7967 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7968 #</p>
7969 # But I think this test is bordering on "garbage in, garbage out" anyway.
7970 # -- wtm
7971 !! test
7972 Piped link to URL
7973 !! wikitext
7974 Piped link to URL: [[http://www.example.com|an example URL]]
7975 !! html/php
7976 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7977 </p>
7978 !! html/parsoid
7979 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7980 !! end
7981
7982 !! test
7983 BUG 2: [[page|http://url/]] should link to page, not http://url/
7984 !! wikitext
7985 [[Main Page|http://url/]]
7986 !! html/php
7987 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7988 </p>
7989 !! html/parsoid
7990 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7991 !! end
7992
7993 # Parsoid does not mark self-links, by design.
7994 !! test
7995 BUG 337: Escaped self-links should be bold
7996 !! options
7997 title=[[Bug462]]
7998 !! wikitext
7999 [[Bu&#103;462]] [[Bug462]]
8000 !! html/php
8001 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
8002 </p>
8003 !! html/php+tidy
8004 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
8005 !! html/parsoid
8006 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8007 !! end
8008
8009 !! test
8010 Self-link to section should not be bold
8011 !! options
8012 title=[[Main Page]]
8013 !! wikitext
8014 [[Main Page#section]]
8015 !! html
8016 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8017 </p>
8018 !! end
8019
8020 !! article
8021 00
8022 !! text
8023 This is 00.
8024 !! endarticle
8025
8026 !!test
8027 Self-link to numeric title
8028 !!options
8029 title=[[0]]
8030 !! wikitext
8031 [[0]]
8032 !! html
8033 <p><strong class="selflink">0</strong>
8034 </p>
8035 !!end
8036
8037 !!test
8038 Link to numeric-equivalent title
8039 !!options
8040 title=[[0]]
8041 !! wikitext
8042 [[00]]
8043 !! html
8044 <p><a href="/wiki/00" title="00">00</a>
8045 </p>
8046 !!end
8047
8048 !! test
8049 <nowiki> inside a link
8050 !! wikitext
8051 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8052 !! html
8053 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8054 </p>
8055 !! end
8056
8057 !! test
8058 Non-breaking spaces in title
8059 !! wikitext
8060 [[&nbsp; Main &nbsp; Page &nbsp;]]
8061 !! html
8062 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8063 </p>
8064 !!end
8065
8066 !! test
8067 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8068 !! options
8069 language=ca
8070 !! wikitext
8071 '''[[Main Page]]'''
8072 !! html
8073 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8074 </p>
8075 !! end
8076
8077 !! test
8078 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8079 !! options
8080 language=ca
8081 !! wikitext
8082 ''[[Main Page]]''
8083 !! html
8084 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8085 </p>
8086 !! end
8087
8088 !! test
8089 Internal link with en linktrail: no apostrophes (bug 27473)
8090 !! options
8091 language=en
8092 !! wikitext
8093 [[Something]]'nice
8094 !! html
8095 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8096 </p>
8097 !! end
8098
8099 !! test
8100 Internal link with ca linktrail with apostrophes (bug 27473)
8101 !! options
8102 language=ca
8103 !! wikitext
8104 [[Something]]'nice
8105 !! html
8106 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8107 </p>
8108 !! end
8109
8110 !! test
8111 Internal link with kaa linktrail with apostrophes (bug 27473)
8112 !! options
8113 language=kaa
8114 !! wikitext
8115 [[Something]]'nice
8116 !! html
8117 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
8118 </p>
8119 !! end
8120
8121 !! test
8122 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8123 !! wikitext
8124 [[User:Foo/Test/63636:Bar|Test]]
8125 !! html/php
8126 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8127 </p>
8128 !! html/parsoid
8129 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8130 !! end
8131
8132 ## Mainly a sanity check for Parsoid
8133 !! test
8134 Handle title parsing for subpages
8135 !! options
8136 title=[[/123123]]
8137 !! wikitext
8138 123
8139 !! html/parsoid
8140 <p>123</p>
8141 !! end
8142
8143 ## FIXME: Add a working php section here
8144 !! test
8145 Link to a subpage from a namespace other than main
8146 !! options
8147 title=[[User:test]]
8148 !! wikitext
8149 [[/123]]
8150 !! html/parsoid
8151 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8152 !! end
8153
8154 !! test
8155 Ensure that transclusion titles are not url-decoded
8156 !! options
8157 subpage title=[[Test]]
8158 parsoid=wt2html
8159 !! wikitext
8160 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8161 !! html/php
8162 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8163 </p>
8164 !! html/parsoid
8165 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8166 !! end
8167
8168 !! test
8169 Purely hash wikilink
8170 !! options
8171 title=[[User:test/123]]
8172 !! wikitext
8173 [[#a|b]]
8174 !! html/php
8175 <p><a href="#a">b</a>
8176 </p>
8177 !! html/parsoid
8178 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8179 !! end
8180
8181 !! test
8182 1. Interaction of linktrail and template encapsulation
8183 !! options
8184 parsoid
8185 !! wikitext
8186 {{echo|[[Foo]]}}l
8187 !! html
8188 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8189 !! end
8190
8191 !! test
8192 2. Interaction of linktrail and template encapsulation
8193 !! options
8194 parsoid
8195 !! wikitext
8196 {{echo|Some [[Fool]]}}s
8197 !! html
8198 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8199 !! end
8200
8201 !! test
8202 3. Interaction of linktrail and template encapsulation
8203 !! options
8204 parsoid
8205 !! wikitext
8206 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8207 !! html
8208 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8209 !! end
8210
8211 !! article
8212 Söfnuður
8213 !! text
8214 Test.
8215 !! endarticle
8216
8217 !! test
8218 Internal link with is link prefix
8219 !! options
8220 language=is
8221 !! wikitext
8222 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8223 !! html
8224 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8225 </p>
8226 !! end
8227
8228 !! article
8229 Mótmælendatrú
8230 !! text
8231 Test.
8232 !! endarticle
8233
8234 !! test
8235 Internal link with is link trail and link prefix
8236 !! options
8237 language=is
8238 !! wikitext
8239 [[mótmælendatrú|xxx]]ar
8240 [[mótmælendatrú]]ar
8241 mótmælenda[[söfnuður]]
8242 mótmælenda[[söfnuður|söfnuðir]]
8243 mótmælenda[[söfnuður|söfnuðir]]xxx
8244 !! html
8245 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8246 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8247 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8248 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8249 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8250 </p>
8251 !! end
8252
8253 !! test
8254 Parsoid link trail escaping
8255 !! options
8256 parsoid=html2wt,html2html
8257 !! html/parsoid
8258 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8259 !! wikitext
8260 [[apple]]<nowiki/>s
8261 !! end
8262
8263 !! test
8264 Parsoid link prefix escaping
8265 !! options
8266 language=is
8267 parsoid=html2wt,html2html
8268 !! html/parsoid
8269 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8270 !! wikitext
8271 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8272 !! end
8273
8274 !! test
8275 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8276 !! wikitext
8277 [[Foo| bar]]
8278
8279 [[Foo| ''bar'']]
8280
8281 [http://wp.org foo]
8282
8283 [http://wp.org ''foo'']
8284 !! html
8285 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8286 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8287 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8288 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8289 </p>
8290 !! end
8291
8292 !! test
8293 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8294 !! options
8295 parsoid
8296 !! wikitext
8297 [[Foo|{{echo|a}} b {{echo|c}}]]
8298 !! html
8299 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8300 !! end
8301
8302 !! test
8303 Link with angle bracket after anchor
8304 !! wikitext
8305 [[Foo#<bar>]]
8306 !! html/php
8307 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8308 </p>
8309 !! html/parsoid
8310 <p><a rel="mw:WikiLink" href="./Foo#.3Cbar.3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#.3Cbar.3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8311 !! end
8312
8313 ###
8314 ### Interwiki links (see maintenance/interwiki.sql)
8315 ###
8316
8317 !! test
8318 Inline interwiki link
8319 !! options
8320 parsoid=wt2html,wt2wt,html2html
8321 !! wikitext
8322 [[MeatBall:SoftSecurity]]
8323 !! html/php
8324 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8325 </p>
8326 !! html/parsoid
8327 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8328 !! end
8329
8330 !! test
8331 Inline interwiki link with empty title (bug 2372)
8332 !! options
8333 parsoid=wt2html,wt2wt,html2html
8334 !! wikitext
8335 [[MeatBall:]]
8336 !! html/php
8337 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8338 </p>
8339 !! html/parsoid
8340 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8341 !! end
8342
8343 !! test
8344 Interwiki link encoding conversion (bug 1636)
8345 !! wikitext
8346 *[[Wikipedia:ro:Olteni&#0355;a]]
8347 *[[Wikipedia:ro:Olteni&#355;a]]
8348 !! html
8349 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8350 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8351
8352 !! html+tidy
8353 <ul>
8354 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8355 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8356 </ul>
8357 !! end
8358
8359 !! test
8360 Interwiki link with fragment (bug 2130)
8361 !! wikitext
8362 [[MeatBall:SoftSecurity#foo]]
8363 !! html
8364 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8365 </p>
8366 !! end
8367
8368 !! test
8369 Link scenarios with escaped fragments
8370 !! wikitext
8371 [[#Is this great?]]
8372 [[Foo#Is this great?]]
8373 [[meatball:Foo#Is this great?]]
8374 !! html/php
8375 <p><a href="#Is_this_great.3F">#Is this great?</a>
8376 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8377 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8378 </p>
8379 !! html/parsoid
8380 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great.3F" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great.3F"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8381 <a rel="mw:WikiLink" href="./Foo#Is_this_great.3F" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great.3F"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8382 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8383 !! end
8384
8385 # Ideally the wikipedia: prefix here should be proto-relative too
8386 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8387 # define the 'en' prefix, and originally the test used 'wikipedia',
8388 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8389 # article.
8390 !! test
8391 Different interwiki prefixes mapping to the same URL
8392 !! wikitext
8393 [[:en:Foo]]
8394
8395 [[:en:Foo|Foo]]
8396
8397 [[wikipedia:Foo]]
8398
8399 [[:wikipedia:Foo|Foo]]
8400
8401 [[wikipedia:en:Foo]]
8402
8403 [[:wikipedia:en:Foo]]
8404
8405 [[ wikiPEdia :Foo]]
8406 !! html/parsoid
8407 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8408
8409 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8410
8411 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8412
8413 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8414
8415 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8416
8417 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8418
8419 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8420 !! end
8421
8422 !! test
8423 Interwiki links that cannot be represented in wiki syntax
8424 !! wikitext
8425 [[meatball:ok]]
8426 [[meatball:ok#foo|ok with fragment]]
8427 [[meatball:ok_as_well?|ok ending with ? mark]]
8428 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8429 [http://de.wikipedia.org/wiki/#foo is just fragment]
8430
8431 !! html/php
8432 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8433 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8434 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8435 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8436 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8437 </p>
8438 !! html/parsoid
8439 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8440 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8441 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8442 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8443 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8444 !! end
8445
8446 !! test
8447 Interwiki links: trail
8448 !! wikitext
8449 [[wikipedia:Foo|Ba]]r
8450 !! html/php
8451 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8452 </p>
8453 !! html/parsoid
8454 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8455 !! end
8456
8457 !! test
8458 Local interwiki link
8459 !! options
8460 parsoid=wt2html,wt2wt,html2html
8461 !! wikitext
8462 [[local:Template:Foo]]
8463 !! html/php
8464 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8465 </p>
8466 !! html/parsoid
8467 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8468 !! end
8469
8470 # Parsoid does not mark self-links, by design.
8471 !! test
8472 Local interwiki link: self-link to current page
8473 !! options
8474 title=[[Main Page]]
8475 parsoid=wt2html,wt2wt,html2html
8476 !! wikitext
8477 [[local:Main Page]]
8478 !! html/php
8479 <p><strong class="selflink">local:Main Page</strong>
8480 </p>
8481 !! html/parsoid
8482 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8483 !! end
8484
8485 !! test
8486 Local interwiki link: prefix only (bug 64167)
8487 !! options
8488 parsoid=wt2html,wt2wt,html2html
8489 !! wikitext
8490 [[local:]]
8491 !! html/php
8492 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8493 </p>
8494 !! html/parsoid
8495 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8496 !! end
8497
8498 !! test
8499 Local interwiki link: with additional interwiki prefix (bug 61357)
8500 !! options
8501 parsoid=wt2html,wt2wt,html2html
8502 !! wikitext
8503 [[local:meatball:Hello]]
8504 !! html/php
8505 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8509 !! end
8510
8511 !! test
8512 Multiple local interwiki link prefixes
8513 !! wikitext
8514 [[local:local:local:local:mi:local:Foo]]
8515 !! options
8516 parsoid=wt2html,wt2wt,html2html
8517 !! html/php
8518 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8519 </p>
8520 !! html/parsoid
8521 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8522 !! end
8523
8524 ###
8525 ### Interlanguage links
8526 ### Language links (so that searching for '### language' matches..)
8527 ###
8528
8529 !! test
8530 Interlanguage link
8531 !! wikitext
8532 Blah blah blah
8533 [[zh:Chinese]]
8534 !! html/php
8535 <p>Blah blah blah
8536 </p>
8537 !! html/parsoid
8538 <p>Blah blah blah</p>
8539 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8540 !! end
8541
8542 ## parsoid html2wt will lose the space variations
8543 !! test
8544 Interlanguage link with spacing
8545 !! options
8546 parsoid=wt2html,wt2wt,html2html
8547 !! wikitext
8548 Blah blah blah
8549 [[ zh : Chinese ]]
8550 !! html/php
8551 <p>Blah blah blah
8552 </p>
8553 !! html/parsoid
8554 <p>Blah blah blah</p>
8555 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8556 !! end
8557
8558 !! test
8559 Double interlanguage link
8560 !! wikitext
8561 Blah blah blah
8562 [[es:Spanish]]
8563 [[zh:Chinese]]
8564 !! html/php
8565 <p>Blah blah blah
8566 </p>
8567 !! html/parsoid
8568 <p>Blah blah blah</p>
8569 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8570 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8571 !! end
8572
8573 ## parsoid html2wt will lose the space variations
8574 !! test
8575 Interlanguage link variations
8576 !! options
8577 parsoid=wt2html,wt2wt,html2html
8578 !! wikitext
8579 Blah blah blah
8580 [[ es :Spanish]]
8581 [[ ZH :Chinese]]
8582 [[es:Foo_bar]]
8583 !! html/php
8584 <p>Blah blah blah
8585 </p>
8586 !! html/parsoid
8587 <p>Blah blah blah</p>
8588 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8589 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8590 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8591 !! end
8592
8593 !! test
8594 Escaping of interlanguage links
8595 !! wikitext
8596 Blah blah blah
8597 [[:es:Spanish]]
8598 [[ : zh : Chinese ]]
8599 !! html/php
8600 <p>Blah blah blah
8601 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8602 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8603 </p>
8604 !! html/parsoid
8605 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8606 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8607 !! end
8608
8609 ## parsoid html2wt will normalize the space to _
8610 !! test
8611 Space and question mark encoding in interlanguage links (T95473)
8612 !! options
8613 parsoid=wt2html,wt2wt,html2html
8614 !! wikitext
8615 Blah blah blah
8616 [[es:Foo bar?]]
8617 !! html/php
8618 <p>Blah blah blah
8619 </p>
8620 !! html/parsoid
8621 <p>Blah blah blah</p>
8622 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8623 !! end
8624
8625 !! test
8626 Interlanguage link, with prefix links
8627 !! options
8628 language=ln
8629 !! wikitext
8630 Blah blah blah
8631 [[zh:Chinese]]
8632 !! html/php
8633 <p>Blah blah blah
8634 </p>
8635 !! html/parsoid
8636 <p>Blah blah blah</p>
8637 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8638 !! end
8639
8640 !! test
8641 Double interlanguage link, with prefix links (bug 8897)
8642 !! options
8643 language=ln
8644 !! wikitext
8645 Blah blah blah
8646 [[es:Spanish]]
8647 [[zh:Chinese]]
8648 !! html/php
8649 <p>Blah blah blah
8650 </p>
8651 !! html/parsoid
8652 <p>Blah blah blah</p>
8653 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8654 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8655 !! end
8656
8657 !! test
8658 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8659 !! wikitext
8660 Blah blah blah
8661 [[mul:Article]]
8662 !! html/php
8663 <p>Blah blah blah
8664 </p>
8665 !! html/parsoid
8666 <p>Blah blah blah</p>
8667 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8668 !! end
8669
8670 ## PHP parser tests script needs an update
8671 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8672 !! test
8673 Language links render as inline links if $wgInterwikiMagic=false
8674 !! options
8675 wgInterwikiMagic=false
8676 parsoid=wt2html,wt2wt,html2html
8677 !! wikitext
8678 Blah blah blah
8679 [[zh:Chinese]]
8680 !! html/parsoid
8681 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8682 !! end
8683
8684 ## PHP parser tests script needs an update
8685 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8686 !! test
8687 Language links render as inline links in the Talk namespace
8688 !! options
8689 title=Talk:Foo
8690 parsoid=wt2html,wt2wt,html2html
8691 !! wikitext
8692 Blah blah blah
8693 [[zh:Chinese]]
8694 !! html/parsoid
8695 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8696 !! end
8697
8698 !! test
8699 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8700 !! options
8701 language=ln
8702 !! wikitext
8703 [[WW&nbsp;II]]
8704 !! html
8705 <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>
8706 </p>
8707 !! end
8708
8709 !! test
8710 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8711 !! options
8712 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8713 !! html/parsoid
8714 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8715 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8716 !! wikitext
8717 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8718
8719 He&amp;nbsp;llo He&amp;nbsp;llo
8720 !! html/php
8721 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8722 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8723 </p>
8724 !! end
8725
8726 # html2wt will fail because of title normalization without data-parsoid
8727 !! test
8728 Parsoid: handle constructor well
8729 !! options
8730 parsoid=wt2html,wt2wt
8731 !! wikitext
8732 [[constructor]]
8733
8734 [[constructor:foo]]
8735 !! html/php
8736 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8737 </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>
8738 </p>
8739 !! html/parsoid
8740 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8741
8742 <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>
8743 !! end
8744
8745 !! article
8746 ko:
8747 !! text
8748 Test.
8749 !! endarticle
8750
8751 # Note that `ko` isn't a known interlanguage prefix
8752 !! test
8753 Parsoid: recognize interlanguage links without a target page
8754 !! options
8755 ill
8756 !! wikitext
8757 [[es:]]
8758
8759 [[ko:]]
8760 !! html/php
8761 es:
8762 !! html/parsoid
8763 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8764
8765 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8766 !! end
8767
8768 # Note that `ko` isn't a known interwiki prefix
8769 !! test
8770 Parsoid: recognize interwiki links without a target page
8771 !! options
8772 parsoid=wt2html,wt2wt,html2html
8773 !! wikitext
8774 [[:es:]]
8775
8776 [[:ko:]]
8777 !! html/php
8778 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8779 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8780 </p>
8781 !! html/parsoid
8782 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8783 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8784 !! end
8785
8786 !! test
8787 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8788 !! wikitext
8789 [[mi:Foo]]
8790 !! html/php
8791 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8792 </p>
8793 !! html/parsoid
8794 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8795 !! end
8796
8797 !! test
8798 Interlanguage link with preceding local interwiki link (bug 68085)
8799 !! options
8800 parsoid=wt2html,wt2wt,html2html
8801 !! wikitext
8802 Blah blah blah
8803 [[local:es:Spanish]]
8804 !! html/php
8805 <p>Blah blah blah
8806 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8807 </p>
8808 !! html/parsoid
8809 <p>Blah blah blah
8810 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8811 !! end
8812
8813 !! test
8814 Looks like an interlanguage link, but is actually a local interwiki
8815 !! options
8816 parsoid=wt2html,wt2wt,html2html
8817 !! wikitext
8818 Blah blah blah
8819 [[mi:Template:Foo]]
8820 !! html/php
8821 <p>Blah blah blah
8822 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8823 </p>
8824 !! html/parsoid
8825 <p>Blah blah blah
8826 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8827 !! end
8828
8829 ###
8830 ### Redirects, Parsoid-only
8831 ###
8832
8833 !! test
8834 1. Simple redirect to page
8835 !! wikitext
8836 #REDIRECT [[Main Page]]
8837 !! html/parsoid
8838 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8839 !! end
8840
8841 !! test
8842 2. Other redirect variants
8843 !! wikitext
8844 #REDIRECT [[Main_Page]]
8845 !! html/parsoid
8846 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8847 !! end
8848
8849 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8850 # This tests the Parsoid bail-out code.
8851 !! test
8852 3. Other redirect variants
8853 !! wikitext
8854 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8855 !! html/parsoid
8856 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8857 !! end
8858
8859 !! test
8860 4. Redirect to a templated destination
8861 !! wikitext
8862 #REDIRECT [[{{echo|Foo}}bar]]
8863 !! html/parsoid
8864 <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"}]]}'/>
8865 !! end
8866
8867 !! test
8868 Empty redirect
8869 !! options
8870 parsoid=wt2html,wt2wt
8871 !! wikitext
8872 #REDIRECT [[]]
8873 !! html/parsoid
8874 <ol>
8875 <li>REDIRECT [[]]</li></ol>
8876 !! end
8877
8878 !! test
8879 Optional colon in #REDIRECT
8880 !! options
8881 # the colon is archaic syntax. we support it for wt2html, but we
8882 # don't care that it roundtrips back to the modern syntax.
8883 parsoid=wt2html,html2html
8884 !! wikitext
8885 #REDIRECT:[[Main Page]]
8886 !! html/parsoid
8887 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8888 !! end
8889
8890 !! test
8891 Whitespace in #REDIRECT with optional colon
8892 !! options
8893 # the colon and gratuitous whitespace is archaic syntax. we support
8894 # it for wt2html, but we don't care that it roundtrips back to the
8895 # modern syntax (without extra whitespace)
8896 parsoid=wt2html,html2html
8897 !! wikitext
8898
8899 #REDIRECT
8900 :
8901 [[Main Page]]
8902 !! html/parsoid
8903 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8904 !! end
8905
8906 !! test
8907 Piped link in #REDIRECT
8908 !! options
8909 # content after piped link is ignored. we support this syntax,
8910 # but don't care that the piped link is lost when we roundtrip this.
8911 parsoid=wt2html
8912 !! wikitext
8913 #REDIRECT [[Main Page|bar]]
8914 !! html/parsoid
8915 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8916 !! end
8917
8918 !! test
8919 Redirect to category (T104502)
8920 !! options
8921 parsoid=wt2html,wt2wt
8922 !! wikitext
8923 #REDIRECT [[Category:Foo]]
8924 !! html/parsoid
8925 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8926 !! end
8927
8928 !! test
8929 Redirect to category with URL encoding (T104502)
8930 !! options
8931 parsoid=wt2html
8932 !! wikitext
8933 #REDIRECT [[Category%3AFoo]]
8934 !! html/parsoid
8935 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8936 !! end
8937
8938 !! test
8939 Redirect to category page
8940 !! wikitext
8941 #REDIRECT [[:Category:Foo]]
8942 !! html/parsoid
8943 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8944 !! end
8945
8946 !! test
8947 Redirect to image page (1)
8948 !! wikitext
8949 #REDIRECT [[File:Wiki.png]]
8950 !! html/parsoid
8951 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8952 !! end
8953
8954 !! test
8955 Redirect to image page (2)
8956 !! wikitext
8957 #REDIRECT [[Image:Wiki.png]]
8958 !! html/parsoid
8959 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8960 !! end
8961
8962 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8963 # Next test confirms this.
8964 !! test
8965 Redirect to language (1) (T104918)
8966 !! options
8967 parsoid=wt2html,wt2wt,html2html
8968 !! wikitext
8969 #REDIRECT [[en:File:Wiki.png]]
8970 !! html/parsoid
8971 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8972 !! end
8973
8974 !! test
8975 Redirect to language (2) (T104918)
8976 !! wikitext
8977 #REDIRECT [[:en:File:Wiki.png]]
8978 !! html/parsoid
8979 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8980 !! end
8981
8982 !! test
8983 Redirect to interwiki (T104918)
8984 !! wikitext
8985 #REDIRECT [[meatball:File:Wiki.png]]
8986 !! html/parsoid
8987 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8988 !! end
8989
8990 !! test
8991 Non-English #REDIRECT
8992 !! options
8993 language=is
8994 !! wikitext
8995 #TILVÍSUN [[Main Page]]
8996 !! html/parsoid
8997 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8998 !! end
8999
9000 !! test
9001 Redirect syntax under text isn't considered a redirect
9002 !! wikitext
9003 some text
9004 #redirect [[Main Page]]
9005 !! html/parsoid
9006 <p>some text</p>
9007 <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>
9008 !! end
9009
9010 # FIXME: Should hoist the redirect to the top of the page and ensure there
9011 # is only one.
9012 !! test
9013 New redirect
9014 !! options
9015 parsoid=html2wt
9016 !! html/parsoid
9017 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9018 !! wikitext
9019 Foo
9020 #REDIRECT [[Foo]]
9021 !! end
9022
9023 ##
9024 ## XHTML tidiness
9025 ###
9026
9027 !! test
9028 <br> to <br />
9029 !! wikitext
9030 1<br>2<br />3
9031 !! html
9032 <p>1<br />2<br />3
9033 </p>
9034 !! end
9035
9036 !! test
9037 Broken br tag sanitization
9038 !! wikitext
9039 </br>
9040 !! html/php
9041 <p>&lt;/br&gt;
9042 </p>
9043 !! end
9044
9045 # TODO: Fix html2html mode (bug 51055)!
9046 !! test
9047 Parsoid: Broken br tag recognition
9048 !! options
9049 parsoid=wt2html
9050 !! wikitext
9051 </br>
9052
9053 <br/ >
9054 !! html+tidy
9055 <p><br /></p>
9056 <p><br /></p>
9057 !! end
9058
9059 !! test
9060 Incorrecly removing closing slashes from correctly formed XHTML
9061 !! wikitext
9062 <br style="clear:both;" />
9063 !! html
9064 <p><br style="clear:both;" />
9065 </p>
9066 !! end
9067
9068 !! test
9069 Failing to transform badly formed HTML into correct XHTML
9070 !! wikitext
9071 <br style="clear: left;">
9072 <br style="clear: right;">
9073 <br style="clear: both;">
9074 !! html
9075 <p><br style="clear: left;" />
9076 <br style="clear: right;" />
9077 <br style="clear: both;" />
9078 </p>
9079 !!end
9080
9081 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9082 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9083 !! test
9084 Handling html with a div self-closing tag
9085 !! wikitext
9086 <div title />
9087 <div title/>
9088 <div title/ >
9089 <div title=bar />
9090 <div title=bar/>
9091 <div title=bar/ >
9092 !! html/php
9093 <p>&lt;div title /&gt;
9094 &lt;div title/&gt;
9095 </p>
9096 <div>
9097 <p>&lt;div title=bar /&gt;
9098 &lt;div title=bar/&gt;
9099 </p>
9100 <div title="bar/"></div>
9101 </div>
9102
9103 !! html/parsoid
9104 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9105 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9106 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9107 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9108 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9109 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9110 !! end
9111
9112 !! test
9113 Handling html with a br self-closing tag
9114 !! wikitext
9115 <br title />
9116 <br title/>
9117 <br title/ >
9118 <br title=bar />
9119 <br title=bar/>
9120 <br title=bar/ >
9121 !! html/php
9122 <p><br title="" />
9123 <br title="" />
9124 <br />
9125 <br title="bar" />
9126 <br title="bar" />
9127 <br title="bar/" />
9128 </p>
9129 !! html/parsoid
9130 <p><br title="" />
9131 <br title="" />
9132 <br title="" />
9133 <br title="bar" />
9134 <br title="bar" />
9135 <br title="bar/" />
9136 </p>
9137 !! end
9138
9139 !! test
9140 Horizontal ruler (should it add that extra space?)
9141 !! wikitext
9142 <hr>
9143 <hr >
9144 foo <hr
9145 > bar
9146 !! html+tidy
9147 <hr />
9148 <hr />
9149 <p>foo</p>
9150 <hr />
9151 <p>bar</p>
9152 !! end
9153
9154 !! test
9155 Horizontal ruler -- 4+ dashes render hr
9156 !! wikitext
9157 ----
9158 !! html
9159 <hr />
9160
9161 !! end
9162
9163 !! test
9164 Horizontal ruler -- eats additional dashes on the same line
9165 !! wikitext
9166 ---------
9167 !! html
9168 <hr />
9169
9170 !! end
9171
9172 !! test
9173 Horizontal ruler -- does not collapse dashes on consecutive lines
9174 !! wikitext
9175 ----
9176 ----
9177 !! html
9178 <hr />
9179 <hr />
9180
9181 !! end
9182
9183 !! test
9184 Horizontal ruler -- <4 dashes render as plain text
9185 !! wikitext
9186 ---
9187 !! html
9188 <p>---
9189 </p>
9190 !! end
9191
9192 !! test
9193 Horizontal ruler -- Supports content following dashes on same line
9194 !! wikitext
9195 ---- Foo
9196 !! html
9197 <hr /> Foo
9198
9199 !! html+tidy
9200 <hr />
9201 <p>Foo</p>
9202 !! end
9203
9204 ###
9205 ### Block-level elements
9206 ###
9207 !! test
9208 Common list
9209 !! wikitext
9210 *Common list
9211 * item 2
9212 *item 3
9213 !! html
9214 <ul><li>Common list</li>
9215 <li> item 2</li>
9216 <li>item 3</li></ul>
9217
9218 !! end
9219
9220 !! test
9221 Numbered list
9222 !! wikitext
9223 #Numbered list
9224 #item 2
9225 # item 3
9226 !! html
9227 <ol><li>Numbered list</li>
9228 <li>item 2</li>
9229 <li> item 3</li></ol>
9230
9231 !! end
9232
9233 !! test
9234 Mixed list
9235 !! wikitext
9236 *Mixed list
9237 *# with numbers
9238 ** and bullets
9239 *# and numbers
9240 *bullets again
9241 **bullet level 2
9242 ***bullet level 3
9243 ***#Number on level 4
9244 **bullet level 2
9245 **#Number on level 3
9246 **#Number on level 3
9247 *#number level 2
9248 *Level 1
9249 *** Level 3
9250 #** Level 3, but ordered
9251 !! html
9252 <ul><li>Mixed list
9253 <ol><li> with numbers</li></ol>
9254 <ul><li> and bullets</li></ul>
9255 <ol><li> and numbers</li></ol></li>
9256 <li>bullets again
9257 <ul><li>bullet level 2
9258 <ul><li>bullet level 3
9259 <ol><li>Number on level 4</li></ol></li></ul></li>
9260 <li>bullet level 2
9261 <ol><li>Number on level 3</li>
9262 <li>Number on level 3</li></ol></li></ul>
9263 <ol><li>number level 2</li></ol></li>
9264 <li>Level 1
9265 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9266 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9267
9268 !! end
9269
9270 !! test
9271 1. Nested mixed wikitext and html list
9272 !! wikitext
9273 * hi
9274 * <ul><li>ho</li></ul>
9275 * hi
9276 ** ho
9277 !! html/php
9278 <ul><li> hi</li>
9279 <li> <ul><li>ho</li></ul></li>
9280 <li> hi
9281 <ul><li> ho</li></ul></li></ul>
9282
9283 !! html/parsoid
9284 <ul><li> hi</li>
9285 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9286 <li> hi
9287 <ul><li> ho</li></ul></li></ul>
9288 !! end
9289
9290 !! test
9291 2. Nested mixed wikitext and html list (incompatible)
9292 !! wikitext
9293 ; hi
9294 : {{echo|<li>ho</li>}}
9295 !! html/php
9296 <dl><dt> hi</dt>
9297 <dd> <li>ho</li></dd></dl>
9298
9299 !! html/parsoid
9300 <dl><dt> hi</dt>
9301 <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>
9302 !! end
9303
9304 !! test
9305 Nested lists 1
9306 !! wikitext
9307 *foo
9308 **bar
9309 !! html
9310 <ul><li>foo
9311 <ul><li>bar</li></ul></li></ul>
9312
9313 !! end
9314
9315 !! test
9316 Nested lists 2
9317 !! wikitext
9318 **foo
9319 *bar
9320 !! html
9321 <ul><li><ul><li>foo</li></ul></li>
9322 <li>bar</li></ul>
9323
9324 !! end
9325
9326 !! test
9327 Nested lists 3 (first element empty)
9328 !! wikitext
9329 *
9330 **bar
9331 !! html
9332 <ul><li>
9333 <ul><li>bar</li></ul></li></ul>
9334
9335 !! end
9336
9337 !! test
9338 Nested lists 4 (first element empty)
9339 !! wikitext
9340 **
9341 *bar
9342 !! html
9343 <ul><li><ul><li></li></ul></li>
9344 <li>bar</li></ul>
9345
9346 !! end
9347
9348 !! test
9349 Nested lists 5 (both elements empty)
9350 !! wikitext
9351 **
9352 *
9353 !! html
9354 <ul><li><ul><li></li></ul></li>
9355 <li></li></ul>
9356
9357 !! end
9358
9359 !! test
9360 Nested lists 6 (both elements empty)
9361 !! wikitext
9362 *
9363 **
9364 !! html
9365 <ul><li>
9366 <ul><li></li></ul></li></ul>
9367
9368 !! end
9369
9370 !! test
9371 Nested lists 7 (skip initial nesting levels)
9372 !! wikitext
9373 *** foo
9374 !! html
9375 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9376
9377 !! end
9378
9379 !! test
9380 Nested lists 8 (multiple nesting transitions)
9381 !! wikitext
9382 * foo
9383 *** bar
9384 ** baz
9385 * boo
9386 !! html
9387 <ul><li> foo
9388 <ul><li><ul><li> bar</li></ul></li>
9389 <li> baz</li></ul></li>
9390 <li> boo</li></ul>
9391
9392 !! end
9393
9394 !! test
9395 Nested lists 9 (extension interaction)
9396 !! options
9397 parsoid
9398 !! wikitext
9399 *<references />
9400 !! html/parsoid
9401 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9402 !! end
9403
9404 !! test
9405 1. Lists with start-of-line-transparent tokens before bullets: Comments
9406 !! wikitext
9407 *foo
9408 *<!--cmt-->bar
9409 <!--cmt-->*baz
9410 !! html
9411 <ul><li>foo</li>
9412 <li>bar</li>
9413 <li>baz</li></ul>
9414
9415 !! end
9416
9417 !! test
9418 2. Lists with start-of-line-transparent tokens before bullets: Template close
9419 !! wikitext
9420 *foo {{echo|bar
9421 }}*baz
9422 !! html
9423 <ul><li>foo bar</li>
9424 <li>baz</li></ul>
9425
9426 !! end
9427
9428 !! test
9429 List items are not parsed correctly following a <pre> block (bug 785)
9430 !! wikitext
9431 * <pre>foo</pre>
9432 * <pre>bar</pre>
9433 * zar
9434 !! html/php
9435 <ul><li> <pre>foo</pre></li>
9436 <li> <pre>bar</pre></li>
9437 <li> zar</li></ul>
9438
9439 !! html/parsoid
9440 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9441 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9442 <li> zar</li></ul>
9443 !! end
9444
9445 !! test
9446 List items from template
9447 !! wikitext
9448
9449 {{inner list}}
9450 * item 2
9451
9452 * item 0
9453 {{inner list}}
9454 * item 2
9455
9456 * item 0
9457 * notSOL{{inner list}}
9458 * item 2
9459 !! html
9460 <ul><li> item 1</li>
9461 <li> item 2</li></ul>
9462 <ul><li> item 0</li>
9463 <li> item 1</li>
9464 <li> item 2</li></ul>
9465 <ul><li> item 0</li>
9466 <li> notSOL</li>
9467 <li> item 1</li>
9468 <li> item 2</li></ul>
9469
9470 !! end
9471
9472 !! test
9473 List interrupted by empty line or heading
9474 !! wikitext
9475 * foo
9476
9477 ** bar
9478 == A heading ==
9479 * Another list item
9480 !! html
9481 <ul><li> foo</li></ul>
9482 <ul><li><ul><li> bar</li></ul></li></ul>
9483 <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>
9484 <ul><li> Another list item</li></ul>
9485
9486 !!end
9487
9488 !!test
9489 Multiple list tags generated by templates
9490 !! wikitext
9491 {{echo|<li>}}a
9492 {{echo|<li>}}b
9493 {{echo|<li>}}c
9494 !! html
9495 <li>a
9496 <li>b
9497 <li>c</li>
9498 </li>
9499 </li>
9500
9501 !! html+tidy
9502 <ul>
9503 <li>a</li>
9504 <li>b</li>
9505 <li>c</li>
9506 </ul>
9507 !!end
9508
9509 !!test
9510 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9511 !! wikitext
9512 *a
9513 <!--This line will NOT split the list-->
9514 *b
9515 <!--This line will NOT split the list either-->
9516 *c
9517 <!--foo--> <!----> <!--This line NOT split the list either-->
9518 *d
9519 !! html
9520 <ul><li>a</li>
9521 <li>b</li>
9522 <li>c</li>
9523 <li>d</li></ul>
9524
9525 !!end
9526
9527 !!test
9528 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9529 !! wikitext
9530 *a
9531 <!--This line will NOT split the list-->
9532 *b
9533 <!--This line will NOT split the list either-->
9534 *c
9535 <!--foo--> <!----> <!--This line NOT split the list
9536 either-->
9537 *d
9538 !! html
9539 <ul><li>a</li>
9540 <li>b</li>
9541 <li>c</li>
9542 <li>d</li></ul>
9543
9544 !!end
9545
9546 !!test
9547 Test the li-hack
9548 (The PHP parser relies on Tidy for the hack)
9549 !!options
9550 parsoid=wt2html,wt2wt
9551 !! wikitext
9552 * foo
9553 * <li>li-hack
9554 * {{echo|<li>templated li-hack}}
9555 * <!--foo--> <li> unsupported li-hack with preceding comments
9556
9557 <ul>
9558 <li><li>not a li-hack
9559 </li>
9560 </ul>
9561 !! html+tidy
9562 <ul>
9563 <li>foo</li>
9564 <li>li-hack</li>
9565 <li>templated li-hack</li>
9566 <li>unsupported li-hack with preceding comments</li>
9567 </ul>
9568 <ul>
9569 <li>not a li-hack</li>
9570 </ul>
9571 !!end
9572
9573 !! test
9574 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9575 !! options
9576 parsoid
9577 !! wikitext
9578 # foo
9579 ## bar
9580 * foo
9581 ** bar
9582 : foo
9583 :: bar
9584 !! html
9585 <ol>
9586 <li> foo<ol>
9587 <li> bar</li>
9588 </ol></li>
9589 </ol><ul>
9590 <li> foo<ul>
9591 <li> bar</li>
9592 </ul></li>
9593 </ul><dl>
9594 <dd> foo<dl>
9595 <dd> bar</dd>
9596 </dl></dd>
9597 </dl>
9598 !! end
9599
9600 !! test
9601 Parsoid: Test of whitespace serialization with Templated bullets
9602 !! options
9603 parsoid
9604 !! wikitext
9605 * {{bullet}}
9606 !! html
9607 <ul>
9608 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9609 </ul>
9610 !! end
9611
9612 # ------------------------------------------------------------------------
9613 # The next set of tests are about Parsoid's ability to handle badly nested
9614 # tags (parse, minimize scope of fixup, and roundtrip back)
9615 # ------------------------------------------------------------------------
9616
9617 !! test
9618 Unbalanced closing block tags break a list
9619 (php parser relies on Tidy to fix up)
9620 !! wikitext
9621 <div>
9622 *a</div><div>
9623 *b</div>
9624 !! html+tidy
9625 <div>
9626 <ul>
9627 <li>a</li>
9628 </ul>
9629 </div>
9630 <div>
9631 <ul>
9632 <li>b</li>
9633 </ul>
9634 </div>
9635 !! end
9636
9637 # Parsoid fails this test, but it might be tricky to support properly.
9638 # See bug 68395.
9639 !! test
9640 Unbalanced closing non-block tags don't break a list
9641 (php parser relies on Tidy to fix up)
9642 !! wikitext
9643 <span>
9644 *a</span><span>
9645 *b</span>
9646 !! html/php+tidy
9647 <ul>
9648 <li><span>a</span></li>
9649 <li><span>b</span></li>
9650 </ul>
9651 !! html/parsoid
9652 <span>
9653 <ul>
9654 <li>a<span></span>
9655 </li>
9656 <li>b
9657 </li>
9658 </ul>
9659 </span>
9660 !! end
9661
9662 !! test
9663 Unclosed formatting tags that straddle lists are closed and reopened
9664 (php parser relies on Tidy to fix up)
9665 !! options
9666 parsoid=wt2html,wt2wt,html2html
9667 !! wikitext
9668 # <s> a
9669 # b </s>
9670 !! html/php+tidy
9671 <ol>
9672 <li><s>a</s></li>
9673 <li><s>b</s></li>
9674 </ol>
9675 !! html/parsoid
9676 <ol><li> <s> a</s></li>
9677 <li><s> b </s></li></ol>
9678 !! end
9679
9680 # See bug 68395.
9681 !!test
9682 1. List embedded in a formatting tag
9683 !! wikitext
9684 <small>
9685 * foo
9686 </small>
9687 !! html/php+tidy
9688 <ul>
9689 <li><small>foo</small></li>
9690 </ul>
9691 !! html/parsoid
9692 <small>
9693 <ul>
9694 <li> foo</li>
9695 </ul>
9696 </small>
9697 !!end
9698
9699 ## Ugly Parsoid output here
9700 ## Not sure what the right output is.
9701 !!test
9702 2. List embedded in a formatting tag
9703 !! wikitext
9704 <small>
9705 *a
9706 *b</small>
9707 !! html/php+tidy
9708 <ul>
9709 <li><small>a</small></li>
9710 <li><small>b</small></li>
9711 </ul>
9712 !! html/parsoid
9713 <small></small>
9714 <ul><small>
9715 <li>a</li>
9716 </small>
9717 <li><small>b</small></li>
9718 </ul>
9719 !!end
9720
9721 # Ugly Parsoid and PHP parser output here
9722 # Not sure if we want to make this a test!
9723 #
9724 ## !!test
9725 ## 3. Unclosed formatting tags in list elements
9726 ## !! wikitext
9727 ## *<small>a
9728 ## *<small>b
9729 ## !! html/php+tidy
9730 ## <ul>
9731 ## <li><small>a</small></li>
9732 ## <li><small><small>b</small></small></li>
9733 ## </ul>
9734 ## !! html/parsoid
9735 ## <ul>
9736 ## <li><small>a</small></li>
9737 ## <small>
9738 ## <li><small>b</small></li>
9739 ## </small></ul>
9740 ## !!end
9741
9742 # This is a bug in the PHP parser + tidy combination.
9743 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9744 # and then fostered out of the table by tidy.)
9745 # We believe the Parsoid output to be correct.
9746 !! test
9747 Table with missing opening <tr> tag
9748 !! options
9749 parsoid=wt2html,wt2wt
9750 !! wikitext
9751 <table>
9752 <td>foo</td>
9753 </tr>
9754 </table>
9755 !! html+tidy
9756 <table>
9757 <tr>
9758 <td>foo</td>
9759 </tr>
9760 </table>
9761 !! end
9762
9763 ###
9764 ### Magic Words
9765 ###
9766
9767 # Note that the current date is hard-coded as
9768 # 1970-01-01T00:02:03Z (a Thursday)
9769 # when running parser tests. The timezone is also fixed to GMT, so
9770 # local date will be identical to current date.
9771
9772 !! test
9773 Magic Word: {{CURRENTDAY}}
9774 !! wikitext
9775 {{CURRENTDAY}}
9776 !! html
9777 <p>1
9778 </p>
9779 !! end
9780
9781 !! test
9782 Magic Word: {{CURRENTDAY2}}
9783 !! wikitext
9784 {{CURRENTDAY2}}
9785 !! html
9786 <p>01
9787 </p>
9788 !! end
9789
9790 !! test
9791 Magic Word: {{CURRENTDAYNAME}}
9792 !! wikitext
9793 {{CURRENTDAYNAME}}
9794 !! html
9795 <p>Thursday
9796 </p>
9797 !! end
9798
9799 !! test
9800 Magic Word: {{CURRENTDOW}}
9801 !! wikitext
9802 {{CURRENTDOW}}
9803 !! html
9804 <p>4
9805 </p>
9806 !! end
9807
9808 !! test
9809 Magic Word: {{CURRENTMONTH}}
9810 !! wikitext
9811 {{CURRENTMONTH}}
9812 !! html
9813 <p>01
9814 </p>
9815 !! end
9816
9817 !! test
9818 Magic Word: {{CURRENTMONTH1}}
9819 !! wikitext
9820 {{CURRENTMONTH1}}
9821 !! html
9822 <p>1
9823 </p>
9824 !! end
9825
9826 !! test
9827 Magic Word: {{CURRENTMONTHABBREV}}
9828 !! wikitext
9829 {{CURRENTMONTHABBREV}}
9830 !! html
9831 <p>Jan
9832 </p>
9833 !! end
9834
9835 !! test
9836 Magic Word: {{CURRENTMONTHNAME}}
9837 !! wikitext
9838 {{CURRENTMONTHNAME}}
9839 !! html
9840 <p>January
9841 </p>
9842 !! end
9843
9844 !! test
9845 Magic Word: {{CURRENTMONTHNAMEGEN}}
9846 !! wikitext
9847 {{CURRENTMONTHNAMEGEN}}
9848 !! html
9849 <p>January
9850 </p>
9851 !! end
9852
9853 !! test
9854 Magic Word: {{CURRENTTIME}}
9855 !! wikitext
9856 {{CURRENTTIME}}
9857 !! html
9858 <p>00:02
9859 </p>
9860 !! end
9861
9862 !! test
9863 Magic Word: {{CURRENTHOUR}}
9864 !! wikitext
9865 {{CURRENTHOUR}}
9866 !! html
9867 <p>00
9868 </p>
9869 !! end
9870
9871 !! test
9872 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9873 !! wikitext
9874 {{CURRENTWEEK}}
9875 !! html
9876 <p>1
9877 </p>
9878 !! end
9879
9880 !! test
9881 Magic Word: {{CURRENTYEAR}}
9882 !! wikitext
9883 {{CURRENTYEAR}}
9884 !! html
9885 <p>1970
9886 </p>
9887 !! end
9888
9889 !! test
9890 Magic Word: {{CURRENTTIMESTAMP}}
9891 !! wikitext
9892 {{CURRENTTIMESTAMP}}
9893 !! html
9894 <p>19700101000203
9895 </p>
9896 !! end
9897
9898 !! test
9899 Magic Words LOCAL (UTC)
9900 !! wikitext
9901 * {{LOCALMONTH}}
9902 * {{LOCALMONTH1}}
9903 * {{LOCALMONTHNAME}}
9904 * {{LOCALMONTHNAMEGEN}}
9905 * {{LOCALMONTHABBREV}}
9906 * {{LOCALDAY}}
9907 * {{LOCALDAY2}}
9908 * {{LOCALDAYNAME}}
9909 * {{LOCALYEAR}}
9910 * {{LOCALTIME}}
9911 * {{LOCALHOUR}}
9912 * {{LOCALWEEK}}
9913 * {{LOCALDOW}}
9914 * {{LOCALTIMESTAMP}}
9915 !! html
9916 <ul><li> 01</li>
9917 <li> 1</li>
9918 <li> January</li>
9919 <li> January</li>
9920 <li> Jan</li>
9921 <li> 1</li>
9922 <li> 01</li>
9923 <li> Thursday</li>
9924 <li> 1970</li>
9925 <li> 00:02</li>
9926 <li> 00</li>
9927 <li> 1</li>
9928 <li> 4</li>
9929 <li> 19700101000203</li></ul>
9930
9931 !! end
9932
9933 !! test
9934 Magic Word: {{FULLPAGENAME}}
9935 !! options
9936 title=[[User:Ævar Arnfjörð Bjarmason]]
9937 !! wikitext
9938 {{FULLPAGENAME}}
9939 !! html
9940 <p>User:Ævar Arnfjörð Bjarmason
9941 </p>
9942 !! end
9943
9944 !! test
9945 Magic Word: {{FULLPAGENAMEE}}
9946 !! options
9947 title=[[User:Ævar Arnfjörð Bjarmason]]
9948 !! wikitext
9949 {{FULLPAGENAMEE}}
9950 !! html
9951 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9952 </p>
9953 !! end
9954
9955 !! test
9956 Magic Word: {{TALKSPACE}}
9957 !! options
9958 title=[[User:Ævar Arnfjörð Bjarmason]]
9959 !! wikitext
9960 {{TALKSPACE}}
9961 !! html
9962 <p>User talk
9963 </p>
9964 !! end
9965
9966 !! test
9967 Magic Word: {{TALKSPACE}}, same namespace
9968 !! options
9969 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9970 !! wikitext
9971 {{TALKSPACE}}
9972 !! html
9973 <p>User talk
9974 </p>
9975 !! end
9976
9977 !! test
9978 Magic Word: {{TALKSPACE}}, main namespace
9979 !! options
9980 title=[[Parser Test]]
9981 !! wikitext
9982 {{TALKSPACE}}
9983 !! html
9984 <p>Talk
9985 </p>
9986 !! end
9987
9988 !! test
9989 Magic Word: {{TALKSPACEE}}
9990 !! options
9991 title=[[User:Ævar Arnfjörð Bjarmason]]
9992 !! wikitext
9993 {{TALKSPACEE}}
9994 !! html
9995 <p>User_talk
9996 </p>
9997 !! end
9998
9999 !! test
10000 Magic Word: {{SUBJECTSPACE}}
10001 !! options
10002 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10003 !! wikitext
10004 {{SUBJECTSPACE}}
10005 !! html
10006 <p>User
10007 </p>
10008 !! end
10009
10010 !! test
10011 Magic Word: {{SUBJECTSPACE}}, same namespace
10012 !! options
10013 title=[[User:Ævar Arnfjörð Bjarmason]]
10014 !! wikitext
10015 {{SUBJECTSPACE}}
10016 !! html
10017 <p>User
10018 </p>
10019 !! end
10020
10021 !! test
10022 Magic Word: {{SUBJECTSPACE}}, main namespace
10023 !! options
10024 title=[[Parser Test]]
10025 !! wikitext
10026 {{SUBJECTSPACE}}
10027 !! html
10028
10029 !! end
10030
10031 !! test
10032 Magic Word: {{SUBJECTSPACEE}}
10033 !! options
10034 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10035 !! wikitext
10036 {{SUBJECTSPACEE}}
10037 !! html
10038 <p>User
10039 </p>
10040 !! end
10041
10042 !! test
10043 Magic Word: {{NAMESPACE}}
10044 !! options
10045 title=[[User:Ævar Arnfjörð Bjarmason]]
10046 !! wikitext
10047 {{NAMESPACE}}
10048 !! html
10049 <p>User
10050 </p>
10051 !! end
10052
10053 !! test
10054 Magic Word: {{NAMESPACEE}}
10055 !! options
10056 title=[[User:Ævar Arnfjörð Bjarmason]]
10057 !! wikitext
10058 {{NAMESPACEE}}
10059 !! html
10060 <p>User
10061 </p>
10062 !! end
10063
10064 !! test
10065 Magic Word: {{NAMESPACENUMBER}}
10066 !! options
10067 title=[[User:Ævar Arnfjörð Bjarmason]]
10068 !! wikitext
10069 {{NAMESPACENUMBER}}
10070 !! html
10071 <p>2
10072 </p>
10073 !! end
10074
10075 !! test
10076 Magic Word: {{SUBPAGENAME}}
10077 !! options
10078 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10079 !! wikitext
10080 {{SUBPAGENAME}}
10081 !! html
10082 <p>sub ö
10083 </p>
10084 !! end
10085
10086 !! test
10087 Magic Word: {{SUBPAGENAMEE}}
10088 !! options
10089 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10090 !! wikitext
10091 {{SUBPAGENAMEE}}
10092 !! html
10093 <p>sub_%C3%B6
10094 </p>
10095 !! end
10096
10097 !! test
10098 Magic Word: {{ROOTPAGENAME}}
10099 !! options
10100 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10101 !! wikitext
10102 {{ROOTPAGENAME}}
10103 !! html
10104 <p>Ævar Arnfjörð Bjarmason
10105 </p>
10106 !! end
10107
10108 !! test
10109 Magic Word: {{ROOTPAGENAMEE}}
10110 !! options
10111 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10112 !! wikitext
10113 {{ROOTPAGENAMEE}}
10114 !! html
10115 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10116 </p>
10117 !! end
10118
10119 !! test
10120 Magic Word: {{BASEPAGENAME}}
10121 !! options
10122 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10123 !! wikitext
10124 {{BASEPAGENAME}}
10125 !! html
10126 <p>Ævar Arnfjörð Bjarmason
10127 </p>
10128 !! end
10129
10130 !! test
10131 Magic Word: {{BASEPAGENAMEE}}
10132 !! options
10133 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10134 !! wikitext
10135 {{BASEPAGENAMEE}}
10136 !! html
10137 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10138 </p>
10139 !! end
10140
10141 !! test
10142 Magic Word: {{TALKPAGENAME}}
10143 !! options
10144 title=[[User:Ævar Arnfjörð Bjarmason]]
10145 !! wikitext
10146 {{TALKPAGENAME}}
10147 !! html
10148 <p>User talk:Ævar Arnfjörð Bjarmason
10149 </p>
10150 !! end
10151
10152 !! test
10153 Magic Word: {{TALKPAGENAMEE}}
10154 !! options
10155 title=[[User:Ævar Arnfjörð Bjarmason]]
10156 !! wikitext
10157 {{TALKPAGENAMEE}}
10158 !! html
10159 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10160 </p>
10161 !! end
10162
10163 !! test
10164 Magic Word: {{SUBJECTPAGENAME}}
10165 !! options
10166 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10167 !! wikitext
10168 {{SUBJECTPAGENAME}}
10169 !! html
10170 <p>User:Ævar Arnfjörð Bjarmason
10171 </p>
10172 !! end
10173
10174 !! test
10175 Magic Word: {{SUBJECTPAGENAMEE}}
10176 !! options
10177 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10178 !! wikitext
10179 {{SUBJECTPAGENAMEE}}
10180 !! html
10181 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10182 </p>
10183 !! end
10184
10185 !! test
10186 Magic Word: {{NUMBEROFFILES}}
10187 !! wikitext
10188 {{NUMBEROFFILES}}
10189 !! html
10190 <p>7
10191 </p>
10192 !! end
10193
10194 !! test
10195 Magic Word: {{PAGENAME}}
10196 !! options
10197 title=[[User:Ævar Arnfjörð Bjarmason]]
10198 !! wikitext
10199 {{PAGENAME}}
10200 !! html
10201 <p>Ævar Arnfjörð Bjarmason
10202 </p>
10203 !! end
10204
10205 !! test
10206 Magic Word: {{PAGENAME}} with metacharacters
10207 !! options
10208 title=[['foo & bar = baz']]
10209 !! wikitext
10210 ''{{PAGENAME}}''
10211 !! html/php
10212 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10213 </p>
10214 !! html+tidy
10215 <p><i>'foo &amp; bar = baz'</i></p>
10216 !! end
10217
10218 !! test
10219 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10220 !! options
10221 title=[[*RFC 1234 http://example.com/]]
10222 !! wikitext
10223 {{PAGENAME}}
10224 !! html/php
10225 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10226 </p>
10227 !! html+tidy
10228 <p>*RFC 1234 http://example.com/</p>
10229 !! end
10230
10231 !! test
10232 Magic Word: {{PAGENAMEE}}
10233 !! options
10234 title=[[User:Ævar Arnfjörð Bjarmason]]
10235 !! wikitext
10236 {{PAGENAMEE}}
10237 !! html
10238 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10239 </p>
10240 !! end
10241
10242 !! test
10243 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10244 !! options
10245 title=[[*RFC 1234 http://example.com/]]
10246 !! wikitext
10247 {{PAGENAMEE}}
10248 !! html/php
10249 <p>&#42;RFC_1234_http&#58;//example.com/
10250 </p>
10251 !! html+tidy
10252 <p>*RFC_1234_http://example.com/</p>
10253 !! end
10254
10255 !! test
10256 Magic Word: {{REVISIONID}}
10257 !! wikitext
10258 {{REVISIONID}}
10259 !! html
10260 <p>1337
10261 </p>
10262 !! end
10263
10264 !! test
10265 Magic Word: {{SCRIPTPATH}}
10266 !! wikitext
10267 {{SCRIPTPATH}}
10268 !! html
10269
10270 !! end
10271
10272 !! test
10273 Magic Word: {{STYLEPATH}}
10274 !! wikitext
10275 {{STYLEPATH}}
10276 !! html
10277 <p>/skins
10278 </p>
10279 !! end
10280
10281 !! test
10282 Magic Word: {{SERVER}}
10283 !! wikitext
10284 {{SERVER}}
10285 !! html
10286 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10287 </p>
10288 !! end
10289
10290 !! test
10291 Magic Word: {{SERVERNAME}}
10292 !! wikitext
10293 {{SERVERNAME}}
10294 !! html
10295 <p>example.org
10296 </p>
10297 !! end
10298
10299 !! test
10300 Magic Word: {{SITENAME}}
10301 !! wikitext
10302 {{SITENAME}}
10303 !! html
10304 <p>MediaWiki
10305 </p>
10306 !! end
10307
10308 !! test
10309 Magic Word: {{PAGELANGUAGE}}
10310 !! options
10311 language=fr
10312 !! wikitext
10313 {{PAGELANGUAGE}}
10314 !! html
10315 <p>fr
10316 </p>
10317 !! end
10318
10319 !! test
10320 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10321 !! wikitext
10322 {{PAGELANGUAGE}}
10323 !! html
10324 <p>en
10325 </p>
10326 !! end
10327
10328 !! test
10329 Case-sensitive magic words, when cased differently, should just be template transclusions
10330 !! wikitext
10331 {{CurrentMonth}}
10332 {{currentday}}
10333 {{cURreNTweEK}}
10334 {{currentHour}}
10335 !! html
10336 <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>
10337 <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>
10338 <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>
10339 <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>
10340 </p>
10341 !! end
10342
10343 !! test
10344 Case-insensitive magic words should still work with weird casing.
10345 !! wikitext
10346 {{sErVeRNaMe}}
10347 {{LCFirst:AOEU}}
10348 {{ucFIRST:aoeu}}
10349 {{SERver}}
10350 !! html
10351 <p>example.org
10352 aOEU
10353 Aoeu
10354 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10355 </p>
10356 !! end
10357
10358 # From plwiki:PLOS_ONE
10359 !! test
10360 Parsoid: Page property magic word with magic word contents
10361 !! wikitext
10362 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10363 !! html/parsoid
10364 <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>"}]]}'/>
10365 !! end
10366
10367 !! test
10368 Parsoid: Template-generated DISPLAYTITLE
10369 !! wikitext
10370 {{{{echo|DISPLAYTITLE}}:Foo}}
10371 !! html/parsoid
10372 <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}}]}'/>
10373 !! end
10374
10375 !! test
10376 Namespace 1 {{ns:1}}
10377 !! wikitext
10378 {{ns:1}}
10379 !! html
10380 <p>Talk
10381 </p>
10382 !! end
10383
10384 !! test
10385 Namespace 1 {{ns:01}}
10386 !! wikitext
10387 {{ns:01}}
10388 !! html
10389 <p>Talk
10390 </p>
10391 !! end
10392
10393 !! test
10394 Namespace 0 {{ns:0}} (bug 4783)
10395 !! wikitext
10396 {{ns:0}}
10397 !! html
10398
10399 !! end
10400
10401 !! test
10402 Namespace 0 {{ns:00}} (bug 4783)
10403 !! wikitext
10404 {{ns:00}}
10405 !! html
10406
10407 !! end
10408
10409 !! test
10410 Namespace -1 {{ns:-1}}
10411 !! wikitext
10412 {{ns:-1}}
10413 !! html
10414 <p>Special
10415 </p>
10416 !! end
10417
10418 !! test
10419 Namespace User {{ns:User}}
10420 !! wikitext
10421 {{ns:User}}
10422 !! html
10423 <p>User
10424 </p>
10425 !! end
10426
10427 !! test
10428 Namespace User talk {{ns:User_talk}}
10429 !! wikitext
10430 {{ns:User_talk}}
10431 !! html
10432 <p>User talk
10433 </p>
10434 !! end
10435
10436 !! test
10437 Namespace User talk {{ns:uSeR tAlK}}
10438 !! wikitext
10439 {{ns:uSeR tAlK}}
10440 !! html
10441 <p>User talk
10442 </p>
10443 !! end
10444
10445 !! test
10446 Namespace File {{ns:File}}
10447 !! wikitext
10448 {{ns:File}}
10449 !! html
10450 <p>File
10451 </p>
10452 !! end
10453
10454 !! test
10455 Namespace File {{ns:Image}}
10456 !! wikitext
10457 {{ns:Image}}
10458 !! html
10459 <p>File
10460 </p>
10461 !! end
10462
10463 !! test
10464 Namespace (lang=de) Benutzer {{ns:User}}
10465 !! options
10466 language=de
10467 !! wikitext
10468 {{ns:User}}
10469 !! html
10470 <p>Benutzer
10471 </p>
10472 !! end
10473
10474 !! test
10475 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10476 !! options
10477 language=de
10478 !! wikitext
10479 {{ns:3}}
10480 !! html
10481 <p>Benutzer Diskussion
10482 </p>
10483 !! end
10484
10485 !! test
10486 Urlencode
10487 !! wikitext
10488 {{urlencode:hi world?!}}
10489 {{urlencode:hi world?!|WIKI}}
10490 {{urlencode:hi world?!|PATH}}
10491 {{urlencode:hi world?!|QUERY}}
10492 !! html/php
10493 <p>hi+world%3F%21
10494 hi_world%3F!
10495 hi%20world%3F%21
10496 hi+world%3F%21
10497 </p>
10498 !! end
10499
10500 !! test
10501 Magic Word: prioritize type info over data-parsoid
10502 !! options
10503 parsoid=html2wt
10504 !! html/parsoid
10505 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10506 !! wikitext
10507 __FORCETOC__
10508 !! end
10509
10510 !! test
10511 Magic Word: serialize on separate line (parsoid)
10512 !! options
10513 parsoid=wt2wt,html2wt
10514 !! wikitext
10515 foo
10516 __NOTOC__
10517 bar
10518 !! html/parsoid
10519 foo<meta property="mw:PageProp/notoc"/>bar
10520 !! end
10521
10522 !! test
10523 Magic Word: rt non-english wikis
10524 !! options
10525 parsoid=wt2wt
10526 language=de
10527 !! wikitext
10528 __NOEDITSECTION__
10529 !! html/parsoid
10530 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10531 !! end
10532
10533 !!test
10534 __proto__ is treated as normal wikitext (T105997)
10535 !!wikitext
10536 __proto__
10537 !!html
10538 <p>__proto__
10539 </p>
10540 !!end
10541
10542 ###
10543 ### Magic links
10544 ###
10545 !! test
10546 Magic links: internal link to RFC (bug 479)
10547 !! wikitext
10548 [[RFC 123]]
10549 !! html/php
10550 <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>
10551 </p>
10552 !! html/parsoid
10553 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10554 !! end
10555
10556 !! test
10557 Magic links: RFC (bug 479)
10558 !! wikitext
10559 RFC 822
10560 !! html/php
10561 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10562 </p>
10563 !! html/parsoid
10564 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10565 !! end
10566
10567 !! test
10568 Magic links: RFC (bug 65278)
10569 !! wikitext
10570 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10571 !! html/php
10572 <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.
10573 </p>
10574 !! html/parsoid
10575 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10576 !! end
10577
10578 !! test
10579 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10580 !! wikitext
10581 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10582 RFC
10583 822
10584 !! html/php
10585 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10586 RFC
10587 822
10588 </p>
10589 !! html/parsoid
10590 <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>
10591 RFC
10592 822</p>
10593 !! end
10594
10595 !! test
10596 Magic links: ISBN (bug 1937)
10597 !! wikitext
10598 ISBN 0-306-40615-2
10599 !! html/php
10600 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10601 </p>
10602 !! html/parsoid
10603 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10604 !! end
10605
10606 !! test
10607 Magic links: ISBN (bug 65278)
10608 !! wikitext
10609 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10610 !! html/php
10611 <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.
10612 </p>
10613 !! html/parsoid
10614 <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>
10615 !! end
10616
10617 !! test
10618 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10619 !! wikitext
10620 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10621 ISBN
10622 9780316098113
10623 ISBN 978
10624 0316098113
10625 !! html/php
10626 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10627 ISBN
10628 9780316098113
10629 ISBN 978
10630 0316098113
10631 </p>
10632 !! html/parsoid
10633 <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>
10634 ISBN
10635 9780316098113
10636 ISBN 978
10637 0316098113</p>
10638 !! end
10639
10640 !! test
10641 Magic links: PMID incorrectly converts space to underscore
10642 !! wikitext
10643 PMID 1234
10644 !! html/php
10645 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10646 </p>
10647 !! html/parsoid
10648 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10649 !! end
10650
10651 !! test
10652 Magic links: PMID (bug 65278)
10653 !! wikitext
10654 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10655 !! html/php
10656 <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.
10657 </p>
10658 !! html/parsoid
10659 <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>
10660 !! end
10661
10662 !! test
10663 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10664 !! wikitext
10665 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10666 PMID
10667 1234
10668 !! html/php
10669 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10670 PMID
10671 1234
10672 </p>
10673 !! html/parsoid
10674 <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>
10675 PMID
10676 1234</p>
10677 !! end
10678
10679 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10680 # since these are ExtLinkText, not MagicLinkText
10681 !! test
10682 Magic links: use appropriate serialization for "almost" magic links.
10683 !! wikitext
10684 X[[Special:BookSources/0978739256|foo]]
10685
10686 X[//tools.ietf.org/html/rfc1234 foo]
10687 !! html/php
10688 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10689 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10690 </p>
10691 !! html/parsoid
10692 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10693 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10694 !! end
10695
10696 !! test
10697 Magic links: All disabled (T47942)
10698 !! options
10699 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10700 !! wikitext
10701 ISBN 0-306-40615-2
10702 PMID 1234
10703 RFC 4321
10704 !! html/php
10705 <p>ISBN 0-306-40615-2
10706 PMID 1234
10707 RFC 4321
10708 </p>
10709 !! end
10710
10711 ###
10712 ### Templates
10713 ####
10714
10715 !! test
10716 Nonexistent template
10717 !! wikitext
10718 {{thistemplatedoesnotexist}}
10719 !! html
10720 <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>
10721 </p>
10722 !! end
10723
10724 !! test
10725 Template with invalid target containing tags
10726 !! wikitext
10727 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10728 !! html
10729 <p>{{a<b>b</b>|foo|a=b|a = b}}
10730 </p>
10731 !! end
10732
10733 !! test
10734 Template with invalid target containing unclosed tag
10735 !! wikitext
10736 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10737 !! html
10738 <p>{{a<b>|foo|a=b|a = b}}</b>
10739 </p>
10740 !! end
10741
10742 !! test
10743 Template with invalid target containing wikilink
10744 !! wikitext
10745 {{[[Main Page]]}}
10746 !! html/php
10747 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10748 </p>
10749 !! html/parsoid
10750 <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>
10751 !! end
10752
10753 !! test
10754 Template with just whitespace in it, bug #68421
10755 !! wikitext
10756 {{echo|{{ }}}}
10757 !! html/parsoid
10758 <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>
10759 !! end
10760
10761 !! article
10762 Template:test
10763 !! text
10764 This is a test template
10765 !! endarticle
10766
10767 !! test
10768 Simple template
10769 !! wikitext
10770 {{test}}
10771 !! html
10772 <p>This is a test template
10773 </p>
10774 !! end
10775
10776 !! test
10777 Template with explicit namespace
10778 !! wikitext
10779 {{Template:test}}
10780 !! html
10781 <p>This is a test template
10782 </p>
10783 !! end
10784
10785
10786 !! article
10787 Template:paramtest
10788 !! text
10789 This is a test template with parameter {{{param}}}
10790 !! endarticle
10791
10792 !! test
10793 Template parameter
10794 !! wikitext
10795 {{paramtest|param=foo}}
10796 !! html
10797 <p>This is a test template with parameter foo
10798 </p>
10799 !! end
10800
10801 !! article
10802 Template:paramtestnum
10803 !! text
10804 [[{{{1}}}|{{{2}}}]]
10805 !! endarticle
10806
10807 !! test
10808 Template unnamed parameter
10809 !! wikitext
10810 {{paramtestnum|Main Page|the main page}}
10811 !! html
10812 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10813 </p>
10814 !! end
10815
10816 !! article
10817 Template:templatesimple
10818 !! text
10819 (test)
10820 !! endarticle
10821
10822 !! article
10823 Template:templateredirect
10824 !! text
10825 #redirect [[Template:templatesimple]]
10826 !! endarticle
10827
10828 !! article
10829 Template:templateasargtestnum
10830 !! text
10831 {{{{{1}}}}}
10832 !! endarticle
10833
10834 !! article
10835 Template:templateasargtest
10836 !! text
10837 {{template{{{templ}}}}}
10838 !! endarticle
10839
10840 !! article
10841 Template:templateasargtest2
10842 !! text
10843 {{{{{templ}}}}}
10844 !! endarticle
10845
10846 !! test
10847 Template with template name as unnamed argument
10848 !! wikitext
10849 {{templateasargtestnum|templatesimple}}
10850 !! html
10851 <p>(test)
10852 </p>
10853 !! end
10854
10855 !! test
10856 Template with template name as argument
10857 !! wikitext
10858 {{templateasargtest|templ=simple}}
10859 !! html
10860 <p>(test)
10861 </p>
10862 !! end
10863
10864 !! test
10865 Template with template name as argument (2)
10866 !! wikitext
10867 {{templateasargtest2|templ=templatesimple}}
10868 !! html
10869 <p>(test)
10870 </p>
10871 !! end
10872
10873 !! article
10874 Template:templateasargtestdefault
10875 !! text
10876 {{{{{templ|templatesimple}}}}}
10877 !! endarticle
10878
10879 !! article
10880 Template:templa
10881 !! text
10882 '''templ'''
10883 !! endarticle
10884
10885 !! test
10886 Template with default value
10887 !! wikitext
10888 {{templateasargtestdefault}}
10889 !! html
10890 <p>(test)
10891 </p>
10892 !! end
10893
10894 !! test
10895 Template with default value (value set)
10896 !! wikitext
10897 {{templateasargtestdefault|templ=templa}}
10898 !! html
10899 <p><b>templ</b>
10900 </p>
10901 !! end
10902
10903 !! test
10904 Template redirect
10905 !! wikitext
10906 {{templateredirect}}
10907 !! html/php
10908 <p>(test)
10909 </p>
10910 !! html/parsoid
10911 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10912 !! end
10913
10914 !! test
10915 Template with argument in separate line
10916 !! wikitext
10917 {{ templateasargtest |
10918 templ = simple }}
10919 !! html
10920 <p>(test)
10921 </p>
10922 !! end
10923
10924 !! test
10925 Template with complex template as argument
10926 !! wikitext
10927 {{paramtest|
10928 param ={{ templateasargtest |
10929 templ = simple }}}}
10930 !! html
10931 <p>This is a test template with parameter (test)
10932 </p>
10933 !! end
10934
10935 !! test
10936 Template with thumb image (with link in description)
10937 !! wikitext
10938 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10939 !! html/php
10940 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>
10941
10942 !! html+tidy
10943 <p>This is a test template with parameter</p>
10944 <div class="thumb tright">
10945 <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>
10946 <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>
10947 </div>
10948 </div>
10949 !! html/parsoid
10950 <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>
10951 !! end
10952
10953 !! article
10954 Template:complextemplate
10955 !! text
10956 {{{1}}} {{paramtest|
10957 param ={{{param}}}}}
10958 !! endarticle
10959
10960 !! test
10961 Template with complex arguments
10962 !! wikitext
10963 {{complextemplate|
10964 param ={{ templateasargtest |
10965 templ = simple }}|[[Template:complextemplate|link]]}}
10966 !! html
10967 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10968 </p>
10969 !! end
10970
10971 !! test
10972 BUG 553: link with two variables in a piped link
10973 !! wikitext
10974 {|
10975 |[[{{{1}}}|{{{2}}}]]
10976 |}
10977 !! html/php
10978 <table>
10979 <tr>
10980 <td>[[{{{1}}}|{{{2}}}]]
10981 </td></tr></table>
10982
10983 !! html/parsoid
10984 <table>
10985 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
10986 </tbody></table>
10987 !! end
10988
10989 # See: T2553
10990 !! test
10991 Abort table cell attribute parsing on wikilink
10992 !! wikitext
10993 {|
10994 | testing [[one|two]] | three || four
10995 | testing one two | three || four
10996 | testing="[[one|two]]" | three || four
10997 |}
10998 !! html/php
10999 <table>
11000 <tr>
11001 <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>
11002 <td> four
11003 </td>
11004 <td> three </td>
11005 <td> four
11006 </td>
11007 <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>
11008 <td> four
11009 </td></tr></table>
11010
11011 !! html/parsoid
11012 <table>
11013 <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>
11014 <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>
11015 <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>
11016 </tbody></table>
11017 !! end
11018
11019 !! test
11020 Don't abort table cell attribute parsing if wikilink is found in template arg
11021 !! wikitext
11022 {|
11023 | Test {{#tag:ref|One two "[[three]]" four}}
11024 |}
11025 !! html/parsoid
11026 <table>
11027 <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>
11028 </tbody></table>
11029 !! end
11030
11031 !! test
11032 Magic variable as template parameter
11033 !! wikitext
11034 {{paramtest|param={{SITENAME}}}}
11035 !! html
11036 <p>This is a test template with parameter MediaWiki
11037 </p>
11038 !! end
11039
11040 !! article
11041 Template:linktest
11042 !! text
11043 [[{{{param}}}|link]]
11044 !! endarticle
11045
11046 !! test
11047 Template parameter as link source
11048 !! wikitext
11049 {{linktest|param=Main Page}}
11050 !! html
11051 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11052 </p>
11053 !! end
11054
11055 !!article
11056 Template:paramtest2
11057 !! text
11058 including another template, {{paramtest|param={{{arg}}}}}
11059 !! endarticle
11060
11061 !! test
11062 Template passing argument to another template
11063 !! wikitext
11064 {{paramtest2|arg='hmm'}}
11065 !! html
11066 <p>including another template, This is a test template with parameter 'hmm'
11067 </p>
11068 !! end
11069
11070 !! article
11071 Template:Linktest2
11072 !! text
11073 Main Page
11074 !! endarticle
11075
11076 !! test
11077 Template as link source
11078 !! wikitext
11079 [[{{linktest2}}]]
11080
11081 [[{{linktest2}}|Main Page]]
11082
11083 [[{{linktest2}}]]Page
11084 !! html
11085 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11086 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11087 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11088 </p>
11089 !! end
11090
11091
11092 !! article
11093 Template:loop1
11094 !! text
11095 {{loop2}}
11096 !! endarticle
11097
11098 !! article
11099 Template:loop2
11100 !! text
11101 {{loop1}}
11102 !! endarticle
11103
11104 !! test
11105 Template infinite loop
11106 !! wikitext
11107 {{loop1}}
11108 !! html
11109 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11110 </p>
11111 !! end
11112
11113 !! test
11114 Template from main namespace
11115 !! wikitext
11116 {{:Main Page}}
11117 !! html
11118 <p>blah blah
11119 </p>
11120 !! end
11121
11122 !! article
11123 Template:table
11124 !! text
11125 {|
11126 | 1 || 2
11127 |-
11128 | 3 || 4
11129 |}
11130 !! endarticle
11131
11132 !! test
11133 BUG 529: Template with table, not included at beginning of line
11134 !! wikitext
11135 foo {{table}}
11136 !! html
11137 <p>foo
11138 </p>
11139 <table>
11140 <tr>
11141 <td> 1 </td>
11142 <td> 2
11143 </td></tr>
11144 <tr>
11145 <td> 3 </td>
11146 <td> 4
11147 </td></tr></table>
11148
11149 !! end
11150
11151 !! test
11152 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11153 !! wikitext
11154 foo
11155 {{table}}
11156 !! html
11157 <p>foo
11158 </p>
11159 <table>
11160 <tr>
11161 <td> 1 </td>
11162 <td> 2
11163 </td></tr>
11164 <tr>
11165 <td> 3 </td>
11166 <td> 4
11167 </td></tr></table>
11168
11169 !! end
11170
11171 !! test
11172 BUG 41: Template parameters shown as broken links
11173 !! wikitext
11174 {{{parameter}}}
11175 !! html
11176 <p>{{{parameter}}}
11177 </p>
11178 !! end
11179
11180 !! test
11181 Template with targets containing wikilinks
11182 !! wikitext
11183 {{[[foo]]}}
11184
11185 {{[[{{echo|foo}}]]}}
11186
11187 {{{{echo|[[foo}}]]}}
11188 !! html
11189 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11190 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11191 </p><p>{{[[foo}}]]
11192 </p>
11193 !! end
11194
11195 !! article
11196 Template:''
11197 !! text
11198 bar
11199 !! endarticle
11200
11201 !! test
11202 Templates: Double quotes as template target
11203 !! wikitext
11204 foo {{''}} baz
11205 !! html/php
11206 <p>foo bar baz
11207 </p>
11208 !! html/parsoid
11209 <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
11210 </p>
11211 !! end
11212
11213 ## This test is about making sure Parsoid's data-mw is well formed in the
11214 ## face of multiple templates with intersecting and overlapping ranges. The
11215 ## wikitext itself is wretched.
11216 !! test
11217 Templates with intersecting and overlapping ranges
11218 !! wikitext
11219 {|{{echo|
11220 <p>ha</p>}}
11221 {|{{echo|
11222 <p>ho</p>}}
11223 {{echo|{{!}}hi}}
11224 |}
11225 !! html/php+tidy
11226 <p>ha</p>
11227 <p>ho</p>
11228 <table>
11229 <tr>
11230 <td></td>
11231 </tr>
11232 <tr>
11233 <td>hi</td>
11234 </tr>
11235 </table>
11236 <table>
11237 <tr>
11238 <td></td>
11239 </tr>
11240 </table>
11241 !! html/parsoid
11242 <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":""}]]}'>
11243
11244 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11245
11246 <tbody><tr><td>hi</td></tr>
11247 </tbody></table>
11248 !! end
11249
11250 !! article
11251 Template:MSGNW test
11252 !! text
11253 ''None'' of '''this''' should be
11254 * interpreted
11255 but rather passed unmodified
11256 {{test}}
11257 <gallery>
11258 File:Foobar.jpg
11259 </gallery>
11260 <!-- comment -->
11261 !! endarticle
11262
11263 # hmm, fix this or just deprecate msgnw and document its behavior?
11264 !! test
11265 msgnw keyword
11266 !! wikitext
11267 {{msgnw:MSGNW test}}
11268 !! html/php
11269 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11270 &#42; interpreted
11271 &#32;but rather passed unmodified
11272 &#123;&#123;test&#125;&#125;
11273 &#60;gallery&#62;
11274 File:Foobar.jpg
11275 &#60;/gallery&#62;
11276 &#60;!-- comment --&#62;
11277 </p>
11278 !! end
11279
11280 !! test
11281 int keyword
11282 !! wikitext
11283 {{int:youhavenewmessages|lots of money|not!}}
11284 !! html
11285 <p>You have lots of money (not!).
11286 </p>
11287 !! end
11288
11289 !! test
11290 int keyword - non-existing message
11291 !! wikitext
11292 {{int:var}}
11293 !! html
11294 <p>⧼var⧽
11295 </p>
11296 !! end
11297
11298 !! article
11299 Template:Includes
11300 !! text
11301 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11302 !! endarticle
11303
11304 !! test
11305 <includeonly> and <noinclude> being included
11306 !! wikitext
11307 {{Includes}}
11308 !! html
11309 <p>Foobar
11310 </p>
11311 !! end
11312
11313 !! article
11314 Template:Includes2
11315 !! text
11316 <onlyinclude>Foo</onlyinclude>bar
11317 !! endarticle
11318
11319 !! test
11320 <onlyinclude> being included
11321 !! wikitext
11322 {{Includes2}}
11323 !! html
11324 <p>Foo
11325 </p>
11326 !! end
11327
11328
11329 !! article
11330 Template:Includes3
11331 !! text
11332 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11333 !! endarticle
11334
11335 !! test
11336 <onlyinclude> and <includeonly> being included
11337 !! wikitext
11338 {{Includes3}}
11339 !! html
11340 <p>Foo
11341 </p>
11342 !! end
11343
11344 !! test
11345 <includeonly> and <noinclude> on a page
11346 !! wikitext
11347 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11348 !! html
11349 <p>Foozar
11350 </p>
11351 !! end
11352
11353 !! test
11354 Un-closed <noinclude>
11355 !! wikitext
11356 <noinclude>
11357 !! html
11358 !! end
11359
11360 !! test
11361 <onlyinclude> on a page
11362 !! wikitext
11363 <onlyinclude>Foo</onlyinclude>bar
11364 !! html
11365 <p>Foobar
11366 </p>
11367 !! end
11368
11369 !! test
11370 Un-closed <onlyinclude>
11371 !! wikitext
11372 <onlyinclude>
11373 !! html
11374 !! end
11375
11376 !!test
11377 Self-closed noinclude, includeonly, onlyinclude tags
11378 !! wikitext
11379 <noinclude />
11380 <includeonly />
11381 <onlyinclude />
11382 !! html
11383 <p><br />
11384 </p>
11385 !!end
11386
11387 !!test
11388 Unbalanced includeonly and noinclude tags
11389 !! wikitext
11390 {|
11391 |a</noinclude>
11392 |b</noinclude></noinclude>
11393 |c</noinclude></includeonly>
11394 |d</includeonly></includeonly>
11395 |}
11396 !! html
11397 <table>
11398 <tr>
11399 <td>a
11400 </td>
11401 <td>b
11402 </td>
11403 <td>c&lt;/includeonly&gt;
11404 </td>
11405 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11406 </td></tr></table>
11407
11408 !!end
11409
11410 !! article
11411 Template:Includeonly section
11412 !! text
11413 <includeonly>
11414 ==Includeonly section==
11415 </includeonly>
11416 ==Section T-1==
11417 !!endarticle
11418
11419 !! test
11420 Bug 6563: Edit link generation for section shown by <includeonly>
11421 !! wikitext
11422 {{includeonly section}}
11423 !! html
11424 <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>
11425 <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>
11426
11427 !! end
11428
11429 # Uses same input as the contents of [[Template:Includeonly section]]
11430 !! test
11431 Bug 6563: Section extraction for section shown by <includeonly>
11432 !! options
11433 section=T-2
11434 !! wikitext
11435 <includeonly>
11436 ==Includeonly section==
11437 </includeonly>
11438 ==Section T-2==
11439 !! html
11440 ==Section T-2==
11441 !! end
11442
11443 !! test
11444 Bug 6563: Edit link generation for section suppressed by <includeonly>
11445 !! wikitext
11446 <includeonly>
11447 ==Includeonly section==
11448 </includeonly>
11449 ==Section 1==
11450 !! html
11451 <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>
11452
11453 !! end
11454
11455 !! test
11456 Bug 6563: Section extraction for section suppressed by <includeonly>
11457 !! options
11458 section=1
11459 !! wikitext
11460 <includeonly>
11461 ==Includeonly section==
11462 </includeonly>
11463 ==Section 1==
11464 !! html
11465 ==Section 1==
11466 !! end
11467
11468 !! test
11469 Un-closed <includeonly>
11470 !! wikitext
11471 <includeonly>
11472 !! html/php
11473 !! html/parsoid
11474 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11475 !! end
11476
11477 ## We used to, but no longer wt2wt this test since the default serializer
11478 ## will normalize the include directives to serialize on their own line.
11479 ## Selser will take care of preserving formatting in scenarios where they
11480 ## intermingled with other wikitext.
11481 !! test
11482 Includes and comments at SOL
11483 !! options
11484 parsoid=wt2html,html2html
11485 !! wikitext
11486 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11487
11488 <noinclude>
11489 some
11490 </noinclude>* stuff
11491 * here
11492
11493 <includeonly>can have stuff</includeonly>=== here ===
11494
11495 !! html/php
11496 <h2><span class="mw-headline" id="hu">hu</span></h2>
11497 <p>some
11498 </p>
11499 <ul><li> stuff</li>
11500 <li> here</li></ul>
11501 <h3><span class="mw-headline" id="here">here</span></h3>
11502
11503 !! html/parsoid
11504 <!-- 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>
11505
11506 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11507 <p>some</p>
11508 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11509 <li> here</li></ul>
11510
11511 <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>
11512
11513 !! end
11514
11515 # TODO: test with DOM fragment reuse!
11516 !! test
11517 Parsoid: DOM fragment reuse
11518 !! options
11519 parsoid=wt2wt,wt2html
11520 !! wikitext
11521 a{{echo|b<table></table>c}}d
11522
11523 a{{echo|b
11524 <table></table>
11525 c}}d
11526
11527 {{echo|a
11528
11529 <table></table>
11530
11531 b}}
11532 !! html
11533 <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>
11534
11535 <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">
11536 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11537 </span><p about="#mwt2">cd</p>
11538
11539 <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">
11540
11541 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11542
11543 </span><p about="#mwt3">b</p>
11544 !! end
11545
11546 !! test
11547 Parsoid: Merge double tds (T52603)
11548 !! options
11549 parsoid
11550 !! wikitext
11551 {|
11552 |{{echo|{{!}} foo}}
11553 |}
11554 !! html
11555 <table><tbody>
11556 <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>
11557 </tbody></table>
11558 !! end
11559
11560 !! test
11561 Parsoid: Merge double tds in nested transclusion content (T52603)
11562 !! options
11563 parsoid
11564 !! wikitext
11565 {{echo|<div>}}
11566 {|
11567 |{{echo|{{!}} foo}}
11568 |}
11569 {{echo|</div>}}
11570 !! html
11571 <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}}]}'>
11572 <table><tbody>
11573 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11574 </tbody></table>
11575 </div>
11576 !! end
11577
11578 ###
11579 ### <includeonly> and <noinclude> in attributes
11580 ###
11581 !!test
11582 0. includeonly around the entire attribute
11583 !! wikitext
11584 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11585 !! html
11586 <p><span id="v2">bar</span>
11587 </p>
11588 !!end
11589
11590 !!test
11591 1. includeonly in html attr key
11592 !! wikitext
11593 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11594 !! html
11595 <p><span id="foo">bar</span>
11596 </p>
11597 !!end
11598
11599 !!test
11600 2. includeonly in html attr value
11601 !! wikitext
11602 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11603 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11604 !! html
11605 <p><span id="v1">bar</span>
11606 <span id="v1">bar</span>
11607 </p>
11608 !!end
11609
11610 !!test
11611 3. includeonly in part of an attr value
11612 !! wikitext
11613 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11614 !! html
11615 <p><span style="color:red;">bar</span>
11616 </p>
11617 !!end
11618
11619 !!test
11620 4. includeonly in table attributes
11621 !! wikitext
11622 {|
11623 |- <noinclude>
11624 |-
11625 |a
11626 </noinclude>
11627 |- <includeonly>
11628 |-
11629 |b
11630 </includeonly>
11631 |}
11632 !! html
11633 <table>
11634
11635
11636 <tr>
11637 <td>a
11638 </td></tr>
11639 </table>
11640
11641 !!end
11642
11643 ###
11644 ### Token Stream Patcher tests
11645 ###
11646 ### These tests won't always pass wt2wt and other modes because
11647 ### on serialization, the table will be output on a new line.
11648 ### For now, we are blacklisting them, and using this to test selser.
11649 ###
11650
11651 !!test
11652 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11653 !!options
11654 parsoid=wt2html,wt2wt
11655 !!wikitext
11656 {{echo|}}{| width = '100%'
11657 |foo
11658 |}
11659 !!html/parsoid
11660 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11661 <tbody><tr><td>foo</td></tr>
11662 </tbody></table>
11663 !!end
11664
11665 ## We used to, but no longer wt2wt this test since the default serializer
11666 ## will normalize the include directives to serialize on their own line.
11667 ## Selser will take care of preserving formatting in scenarios where they
11668 ## intermingled with other wikitext.
11669 !!test
11670 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11671 !!options
11672 parsoid=wt2html
11673 !!wikitext
11674 <includeonly>a</includeonly>{| {{{b}}}
11675 |c
11676 |}
11677 !!html/parsoid
11678 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11679 <tbody><tr><td>c</td></tr>
11680 </tbody></table>
11681 !!end
11682
11683 !! test
11684 Table wikitext syntax outside wiki-tables
11685 !! wikitext
11686 a
11687 |+ not a caption
11688 ! not a table heading
11689 |- not a table row
11690 | not a table cell
11691 | class="foo bar" | baz
11692 b
11693 |}
11694 |-
11695 c
11696 !! html
11697 <p>a
11698 |+ not a caption
11699 ! not a table heading
11700 |- not a table row
11701 | not a table cell
11702 | class="foo bar" | baz
11703 b
11704 |}
11705 |-
11706 c
11707 </p>
11708 !! end
11709
11710 ###
11711 ### Testing parsing of templates where a template arg
11712 ### has the same name as the template itself.
11713 ###
11714
11715 !! article
11716 Template:quote
11717 !! text
11718 {{{quote|{{{1}}}}}}
11719 !! endarticle
11720
11721 !!test
11722 Templates: Template Name/Arg clash: 1. Use of positional param
11723 !! wikitext
11724 {{quote|foo}}
11725 !! html
11726 <p>foo
11727 </p>
11728 !!end
11729
11730 !!test
11731 Templates: Template Name/Arg clash: 2. Use of named param
11732 !! wikitext
11733 {{quote|quote=foo}}
11734 !! html
11735 <p>foo
11736 </p>
11737 !!end
11738
11739 !!test
11740 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11741 !! wikitext
11742 {{quote|quote}}
11743 !! html
11744 <p>quote
11745 </p>
11746 !!end
11747
11748 ###
11749 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11750 ###
11751
11752 !!test
11753 Templates: 1. Simple use
11754 !! wikitext
11755 {{echo|Foo}}
11756 !! html
11757 <p>Foo
11758 </p>
11759 !!end
11760
11761 !!test
11762 Templates: 2. Inside a block tag
11763 !! wikitext
11764 <div>{{echo|Foo}}</div>
11765 <blockquote>{{echo|Foo}}</blockquote>
11766 !! html
11767 <div>Foo</div>
11768 <blockquote>Foo</blockquote>
11769
11770 !! html+tidy
11771 <div>Foo</div>
11772 <blockquote>
11773 <p>Foo</p>
11774 </blockquote>
11775 !!end
11776
11777 !!test
11778 Templates: P-wrapping: 1a. Templates on consecutive lines
11779 !! wikitext
11780 {{echo|Foo}}
11781 {{echo|bar}}
11782 !! html
11783 <p>Foo
11784 bar
11785 </p>
11786 !!end
11787
11788 !!test
11789 Templates: P-wrapping: 1b. Templates on consecutive lines
11790 !! wikitext
11791 Foo
11792
11793 {{echo|bar}}
11794 {{echo|baz}}
11795 !! html
11796 <p>Foo
11797 </p><p>bar
11798 baz
11799 </p>
11800 !!end
11801
11802 !!test
11803 Templates: P-wrapping: 1c. Templates on consecutive lines
11804 !! wikitext
11805 {{echo|Foo}}
11806 {{echo|bar}} <div>baz</div>
11807 !! html
11808 <p>Foo
11809 </p>
11810 bar <div>baz</div>
11811
11812 !! html+tidy
11813 <p>Foo</p>
11814 <p>bar</p>
11815 <div>baz</div>
11816 !! end
11817
11818 !!test
11819 Templates: P-wrapping: 1d. Template preceded by comment-only line
11820 !!options
11821 parsoid
11822 !! wikitext
11823 <!-- foo -->
11824 {{echo|Bar}}
11825 !! html
11826 <!-- foo -->
11827
11828 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11829 !!end
11830
11831 !!test
11832 Templates: Inline Text: 1. Multiple template uses
11833 !! wikitext
11834 {{echo|Foo}}bar{{echo|baz}}
11835 !! html
11836 <p>Foobarbaz
11837 </p>
11838 !!end
11839
11840 !!test
11841 Templates: Inline Text: 2. Back-to-back template uses
11842 !! wikitext
11843 {{echo|Foo}}{{echo|bar}}
11844 !! html
11845 <p>Foobar
11846 </p>
11847 !!end
11848
11849 !!test
11850 Templates: Block Tags: 1. Multiple template uses
11851 !! wikitext
11852 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11853 !! html
11854 <div>Foo</div><div>bar</div><div>baz</div>
11855
11856 !!end
11857
11858 !!test
11859 Templates: Block Tags: 2. Back-to-back template uses
11860 !! wikitext
11861 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11862 !! html
11863 <div>Foo</div><div>bar</div>
11864
11865 !!end
11866
11867 # This is an edge case relating to paragraph wrapping.
11868 !!test
11869 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11870 !! wikitext
11871 {{echo|a
11872 b</p>}}
11873 !! html/parsoid
11874 <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
11875 b</p>
11876 !!end
11877
11878 !!test
11879 Templates: Links: 1. Simple example
11880 !! wikitext
11881 {{echo|[[Foo|bar]]}}
11882 !! html
11883 <p><a href="/wiki/Foo" title="Foo">bar</a>
11884 </p>
11885 !!end
11886
11887 !!test
11888 Templates: Links: 2. Generation of link href
11889 !! wikitext
11890 [[{{echo|Foo}}|bar]]
11891 !! html
11892 <p><a href="/wiki/Foo" title="Foo">bar</a>
11893 </p>
11894 !!end
11895
11896 !!test
11897 Templates: Links: 3. Generation of part of a link href
11898 !! wikitext
11899 [[Fo{{echo|o}}|bar]]
11900
11901 [[Foo{{echo|bar}}]]
11902
11903 [[Foo{{echo|bar}}baz]]
11904
11905 [[Foo{{echo|bar}}|bar]]
11906
11907 [[:Foo{{echo|bar}}]]
11908
11909 [[:Foo{{echo|bar}}|bar]]
11910 !! html
11911 <p><a href="/wiki/Foo" title="Foo">bar</a>
11912 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11913 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11914 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11915 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11916 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11917 </p>
11918 !!end
11919
11920 !!test
11921 Templates: Links: 4. Multiple templates generating link href
11922 !! wikitext
11923 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11924 !! html
11925 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11926 </p>
11927 !!end
11928
11929 !!test
11930 Templates: Links: 5. Generation of link text
11931 !! wikitext
11932 [[Foo|{{echo|bar}}]]
11933 !! html
11934 <p><a href="/wiki/Foo" title="Foo">bar</a>
11935 </p>
11936 !!end
11937
11938 !!test
11939 Templates: Links: 5. Nested templates (only outermost template should be marked)
11940 !! wikitext
11941 {{echo|[[{{echo|Foo}}|bar]]}}
11942 !! html
11943 <p><a href="/wiki/Foo" title="Foo">bar</a>
11944 </p>
11945 !!end
11946
11947 !!test
11948 Templates: HTML Tag: 1. Generation of HTML attr. key
11949 !! wikitext
11950 <div {{echo|style}}="color:red;">foo</div>
11951 !! html
11952 <div style="color:red;">foo</div>
11953
11954 !!end
11955
11956 !!test
11957 Templates: HTML Tag: 2. Generation of HTML attr. value
11958 !! wikitext
11959 <div style={{echo|'color:red;'}}>foo</div>
11960 !! html
11961 <div style="color:red;">foo</div>
11962
11963 !!end
11964
11965 !!test
11966 Templates: HTML Tag: 3. Generation of HTML attr key and value
11967 !! wikitext
11968 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11969 !! html
11970 <div style="color:red;">foo</div>
11971
11972 !!end
11973
11974 !!test
11975 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11976 !! wikitext
11977 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11978 !! html
11979 <div title="This is a long title with just one piece templated">foo</div>
11980
11981 !!end
11982
11983 !!test
11984 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11985 !! wikitext
11986 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11987 !! html
11988 <div title="This is a long title with just one piece templated">foo</div>
11989
11990 !!end
11991
11992 !!test
11993 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11994 !! wikitext
11995 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11996 !! html
11997 <div title="This is a long title with just one piece templated">foo</div>
11998
11999 !!end
12000
12001 # SSS FIXME: While it is great we added support for all this,
12002 # do we want to make this part of the spec? Maybe we want to
12003 # deprecate this kind of usage in the future?
12004 !!test
12005 Templates: HTML Tag: 7. Generation of partial attribute key string
12006 !! wikitext
12007 <div st{{echo|yle}}="color:red;">foo</div>
12008 !! html
12009 <div style="color:red;">foo</div>
12010
12011 !!end
12012
12013 !! test
12014 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12015 !! wikitext
12016 <div {{echo|1=id="v1"}}>bar</div>
12017 !! html
12018 <div id="v1">bar</div>
12019
12020 !!end
12021
12022 !! test
12023 Templates: HTML Tag: 9. Multiple template-generated attributes
12024 !! wikitext
12025 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12026 !! html
12027 <div id="v1" title="foo">bar</div>
12028
12029 !!end
12030
12031 !! test
12032 Templates: Support for templates generating attributes and content
12033 !! wikitext
12034 {| {{mixed_attr_content_template}}
12035 |-
12036 |bar
12037 |}
12038 !! html/php
12039 <table style="color:red;" title="T48811">
12040
12041 <tr>
12042 <td>foo
12043 </td></tr>
12044 <tr>
12045 <td>bar
12046 </td></tr></table>
12047
12048 !! html/parsoid
12049 <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|}"]}'>
12050 <tbody><tr>
12051 <td>foo</td></tr>
12052 <tr>
12053 <td>bar</td></tr>
12054 </tbody></table>
12055 !!end
12056
12057 !! test
12058 1. Entities and nowikis inside templated attributes should be handled correctly
12059 !! wikitext
12060 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12061 !! html/php
12062 <div style="background:#f9f9f9;">foo</div>
12063
12064 !! html/parsoid
12065 <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>
12066 !! end
12067
12068 !! test
12069 2. Entities and nowikis inside templated attributes should be handled correctly
12070 !! wikitext
12071 {|
12072 |{{table_attribs_3}}
12073 |}
12074 !! html/php
12075 <table>
12076 <tr>
12077 <td style="background:#f9f9f9;">Foo
12078 </td></tr></table>
12079
12080 !! html/parsoid
12081 <table>
12082 <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>
12083 </tbody></table>
12084 !! end
12085
12086 !! test
12087 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12088 !! wikitext
12089 {{tbl-start}}
12090 |{{table_attribs_3}}
12091 {{tbl-end}}
12092 !! html/php
12093 <table>
12094 <tr>
12095 <td style="background:#f9f9f9;">Foo
12096 </td></tr></table>
12097
12098 !! html/parsoid
12099 <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}}]}'>
12100 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12101 </tbody></table>
12102 !! end
12103
12104 # T107622
12105 !! test
12106 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12107 !! wikitext
12108 {|
12109 | {{table_attribs_6}} hi
12110 |}
12111 !! html/php
12112 <table>
12113 <tr>
12114 <td style="background: red;"> hi
12115 </td></tr></table>
12116
12117 !! html/parsoid
12118 <table>
12119 <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>
12120 </tbody></table>
12121 !! end
12122
12123 !!test
12124 Templates: HTML Tables: 1. Generating start of a HTML table
12125 !! wikitext
12126 {{echo|<table><tr><td>foo</td>}}</tr></table>
12127 !! html
12128 <table><tr><td>foo</td></tr></table>
12129
12130 !!end
12131
12132 !!test
12133 Templates: HTML Tables: 2a. Generating middle of a HTML table
12134 !! wikitext
12135 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12136 !! html
12137 <table><tr><td>foo</td></tr></table>
12138
12139 !!end
12140
12141 !!test
12142 Templates: HTML Tables: 2b. Generating middle of a HTML table
12143 !! wikitext
12144 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12145 !! html
12146 <table><tr><td>foo</td></tr></table>
12147
12148 !!end
12149
12150 !!test
12151 Templates: HTML Tables: 3. Generating end of a HTML table
12152 !! wikitext
12153 <table><tr>{{echo|<td>foo</td></tr></table>}}
12154 !! html
12155 <table><tr><td>foo</td></tr></table>
12156
12157 !!end
12158
12159 !!test
12160 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12161 !! wikitext
12162 {{echo|<table>}}<tr><td>foo</td></tr></table>
12163 !! html
12164 <table><tr><td>foo</td></tr></table>
12165
12166 !!end
12167
12168 !!test
12169 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12170 !! wikitext
12171 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12172 !! html
12173 <table><tr><td>foo</td></tr></table>
12174
12175 !!end
12176
12177 !!test
12178 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12179 !! wikitext
12180 <table><tr>{{echo|<td>}}foo</td></tr></table>
12181 !! html
12182 <table><tr><td>foo</td></tr></table>
12183
12184 !!end
12185
12186 !!test
12187 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12188 !! wikitext
12189 <table><tr><td>foo{{echo|</td>}}</tr></table>
12190 !! html
12191 <table><tr><td>foo</td></tr></table>
12192
12193 !!end
12194
12195 !!test
12196 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12197 !! wikitext
12198 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12199 !! html
12200 <table><tr><td>foo</td></tr></table>
12201
12202 !!end
12203
12204 !!test
12205 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12206 !! wikitext
12207 <table><tr><td>foo</td></tr>{{echo|</table>}}
12208 !! html
12209 <table><tr><td>foo</td></tr></table>
12210
12211 !!end
12212
12213 !!test
12214 Templates: HTML Tables: 5. Proper fostering of categories from inside
12215 !!options
12216 parsoid=wt2html,wt2wt
12217 !! wikitext
12218 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12219 <!--Two categories (Bug 50330)-->
12220 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12221 !! html
12222 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12223 <!--Two categories (Bug 50330)-->
12224 <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>
12225 !!end
12226
12227 !!test
12228 Templates: Wiki Tables: 1a. Fostering of entire template content
12229 !! wikitext
12230 {|
12231 {{echo|a}}
12232 |}
12233 !! html
12234 <table>
12235 a
12236 <tr><td></td></tr></table>
12237
12238 !! html+tidy
12239 <p>a</p>
12240 <table>
12241 <tr>
12242 <td></td>
12243 </tr>
12244 </table>
12245 !! end
12246
12247 !!test
12248 Templates: Wiki Tables: 1b. Fostering of entire template content
12249 !! wikitext
12250 {|
12251 {{echo|<div>}}
12252 foo
12253 {{echo|</div>}}
12254 |}
12255 !! html
12256 <table>
12257 <div>
12258 <p>foo
12259 </p>
12260 </div>
12261 <tr><td></td></tr></table>
12262
12263 !! html+tidy
12264 <div>
12265 <p>foo</p>
12266 </div>
12267 <table>
12268 <tr>
12269 <td></td>
12270 </tr>
12271 </table>
12272 !! end
12273
12274 !!test
12275 Templates: Wiki Tables: 2. Fostering of partial template content
12276 !! wikitext
12277 {|
12278 {{echo|a
12279 <div>b</div>}}
12280 |}
12281 !! html
12282 <table>
12283 a
12284 <div>b</div>
12285 <tr><td></td></tr></table>
12286
12287 !! html+tidy
12288 <p>a</p>
12289 <div>b</div>
12290 <table>
12291 <tr>
12292 <td></td>
12293 </tr>
12294 </table>
12295 !! end
12296
12297 !!test
12298 Templates: Wiki Tables: 3. td-content via multiple templates
12299 !! wikitext
12300 {|
12301 {{echo|{{pipe}}a}}{{echo|b}}
12302 |}
12303 !! html
12304 <table>
12305 <tr>
12306 <td>ab
12307 </td></tr></table>
12308
12309 !!end
12310
12311 !!test
12312 Templates: Wiki Tables: 4. Templated tags, no content
12313 !! wikitext
12314 {{tbl-start}}
12315 {{tbl-end}}
12316 !! html
12317 <table>
12318 <tr><td></td></tr></table>
12319
12320 !!end
12321
12322 !!test
12323 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12324 !! wikitext
12325 {{tbl-start}}
12326 |foo
12327 {{tbl-end}}
12328 !! html
12329 <table>
12330 <tr>
12331 <td>foo
12332 </td></tr></table>
12333
12334 !!end
12335
12336 !!test
12337 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12338 !! wikitext
12339 {{tbl-start}}
12340 {{!}}foo
12341 {{tbl-end}}
12342 !! html
12343 <table>
12344 <tr>
12345 <td>foo
12346 </td></tr></table>
12347
12348 !!end
12349
12350 ## This test case is very specific to Parsoid's internals
12351 ## and is hence only tested for Parsoid's code. Parsoid uses
12352 ## a <meta> marker tag for <ref> tags and they are expanded
12353 ## much later. We are verifying that this <meta> tag usage
12354 ## doesn't prevent foster parenting.
12355 !!test
12356 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12357 !!wikitext
12358 {{PartialTable}}<ref>foo</ref>
12359 |}
12360
12361 <references />
12362 !!html/parsoid
12363 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
12364 <tbody>
12365 </tbody></table>
12366
12367 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
12368 !!end
12369
12370 !! test
12371 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12372 !! wikitext
12373 {{echo|
12374 {{{!}}
12375 {{!}}-}}
12376 <onlyinclude>
12377 |foo
12378 </onlyinclude>
12379 {{!}}}
12380 !! html/parsoid
12381 <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{{!}}}"]}'>
12382 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12383 <tbody><tr>
12384
12385 <td>foo
12386 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12387 </tbody></table>
12388 !! end
12389
12390 !!test
12391 Templates: Lists: Multi-line list-items via templates
12392 !! wikitext
12393 *{{echo|a {{nonexistent|
12394 unused}}}}
12395 *{{echo|b {{nonexistent|
12396 unused}}}}
12397 !! html
12398 <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>
12399 <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>
12400
12401 !!end
12402
12403 !!test
12404 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12405 !! wikitext
12406 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12407 !! html
12408 <p><i>ab</i>c<i>d</i>e
12409 </p>
12410 !!end
12411
12412 !!test
12413 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12414 (PHP parser generates misnested html)
12415 !! wikitext
12416 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12417 !! html/parsoid
12418 <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>
12419 !!end
12420
12421 !!test
12422 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12423 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12424 !! options
12425 parsoid=wt2html,wt2wt
12426 !! wikitext
12427 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12428 !! html
12429 <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>
12430 <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>
12431 <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>
12432 !!end
12433
12434 !!test
12435 Templates: Ugly nesting: 4. Divs opened/closed across templates
12436 !! wikitext
12437 a<div>b{{echo|c</div>d}}e
12438 !! html
12439 a<div>bc</div>de
12440
12441 !! html+tidy
12442 <p>a</p>
12443 <div>bc</div>
12444 <p>de</p>
12445 !! end
12446
12447 !!test
12448 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12449 (Parsoid-centric)
12450 !! options
12451 parsoid
12452 !! wikitext
12453 {|
12454 |{{echo|foo</table>}}
12455 |bar
12456 |}
12457 !! html
12458 <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|}"]}'>
12459
12460 <tbody>
12461 <tr>
12462 <td>foo</td></tr></tbody></table><span about="#mwt1">
12463 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12464 |}</span>
12465 !!end
12466
12467 !!test
12468 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12469 (Parsoid-centric)
12470 !! options
12471 parsoid
12472 !! wikitext
12473 <table>
12474 <tr>
12475 <td>
12476 <table>
12477 <tr>
12478 <td>1. {{echo|foo </table>}}</td>
12479 <td> bar </td>
12480 <td>2. {{echo|baz </table>}}</td>
12481 </tr>
12482 <tr>
12483 <td>abc</td>
12484 </tr>
12485 </table>
12486 </td>
12487 </tr>
12488 <tr>
12489 <td>xyz</td>
12490 </tr>
12491 </table>
12492 !! html
12493 <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>"]}'>
12494 <tbody><tr>
12495 <td>
12496 <table>
12497 <tbody><tr>
12498 <td>1. foo </td></tr></tbody></table></td>
12499 <td> bar </td>
12500 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12501 </span><span about="#mwt2">
12502 </span><span about="#mwt2">
12503 </span><span about="#mwt2">abc</span><span about="#mwt2">
12504 </span><span about="#mwt2">
12505 </span><span about="#mwt2">
12506 </span><span about="#mwt2">
12507 </span><span about="#mwt2">
12508 </span><span about="#mwt2">
12509 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12510 </span><span about="#mwt2">
12511 </span>
12512 !!end
12513
12514 !! test
12515 Templates: Ugly templates: 3. newline-only template parameter
12516 !! wikitext
12517 foo {{echo|
12518 }}
12519 !! html
12520 <p>foo
12521 </p>
12522 !! end
12523
12524 # This looks like a bug: a single newline triggers p/br for some reason.
12525 !! test
12526 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12527 !! wikitext
12528 {{echo|
12529 }}
12530 !! html
12531 <p><br />
12532 </p>
12533 !! end
12534
12535 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12536 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12537 !! test
12538 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12539 !! wikitext
12540 {{echo|<table>}}
12541 {{echo|<div>foo}}
12542 {{echo|</table>}}
12543 !! html/parsoid
12544 <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
12545 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12546 </table>
12547 !! end
12548
12549 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12550 # that are "identical" and generate nesting cycles in the algorithm
12551 !! test
12552 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12553 !! wikitext
12554 {{echo|<table><tr><td><table>}}
12555 {{echo|<div>}}
12556 {{echo|</div>}}
12557 !! html/parsoid
12558 <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"}'>
12559 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12560 </table></td></tr></tbody></table>
12561 !! end
12562
12563 !! test
12564 Templates: Parameters substituted at the top-level
12565 !! wikitext
12566 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12567
12568 {{{foo|bar|baz}}}
12569 !! html/php
12570 <p><i>who</i> me? <b>never!</b>
12571 </p><p>bar
12572 </p>
12573 !! html/parsoid
12574 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
12575
12576 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12577 !! end
12578
12579 !!test
12580 Parser Functions: 1. Simple example
12581 !! wikitext
12582 {{uc:foo}}
12583 !! html
12584 <p>FOO
12585 </p>
12586 !!end
12587
12588 !!test
12589 Parser Functions: 2. Nested use (only outermost should be marked up)
12590 !! wikitext
12591 {{uc:{{lc:FOO}}}}
12592 !! html
12593 <p>FOO
12594 </p>
12595 !!end
12596
12597 ###
12598 ### Pre-save transform tests
12599 ###
12600 !! test
12601 pre-save transform: subst:
12602 !! options
12603 pst
12604 !! wikitext
12605 {{subst:test}}
12606 !! html/php
12607 This is a test template
12608 !! end
12609
12610 !! test
12611 pre-save transform: normal template
12612 !! options
12613 pst
12614 !! wikitext
12615 {{test}}
12616 !! html/php
12617 {{test}}
12618 !! end
12619
12620 !! test
12621 pre-save transform: nonexistent template
12622 !! options
12623 pst
12624 !! wikitext
12625 {{thistemplatedoesnotexist}}
12626 !! html/php
12627 {{thistemplatedoesnotexist}}
12628 !! end
12629
12630 !! test
12631 pre-save transform: subst magic variables
12632 !! options
12633 pst
12634 !! wikitext
12635 {{subst:SITENAME}}
12636 !! html/php
12637 MediaWiki
12638 !! end
12639
12640 # This is bug 89, which I fixed. -- wtm
12641 !! test
12642 pre-save transform: subst: templates with parameters
12643 !! options
12644 pst
12645 !! wikitext
12646 {{subst:paramtest|param="something else"}}
12647 !! html/php
12648 This is a test template with parameter "something else"
12649 !! end
12650
12651 !! article
12652 Template:nowikitest
12653 !! text
12654 <nowiki>'''not wiki'''</nowiki>
12655 !! endarticle
12656
12657 !! test
12658 pre-save transform: nowiki in subst (bug 1188)
12659 !! options
12660 pst
12661 !! wikitext
12662 {{subst:nowikitest}}
12663 !! html/php
12664 <nowiki>'''not wiki'''</nowiki>
12665 !! end
12666
12667 !! article
12668 Template:commenttest
12669 !! text
12670 This template has <!-- a comment --> in it.
12671 !! endarticle
12672
12673 !! test
12674 pre-save transform: comment in subst (bug 1936)
12675 !! options
12676 pst
12677 !! wikitext
12678 {{subst:commenttest}}
12679 !! html/php
12680 This template has <!-- a comment --> in it.
12681 !! end
12682
12683 !! test
12684 pre-save transform: unclosed tag
12685 !! options
12686 pst
12687 !! wikitext
12688 <nowiki>'''not wiki'''
12689 !! html/php
12690 <nowiki>'''not wiki'''
12691 !! end
12692
12693 !! test
12694 pre-save transform: mixed tag case
12695 !! options
12696 pst
12697 !! wikitext
12698 <NOwiki>'''not wiki'''</noWIKI>
12699 !! html/php
12700 <NOwiki>'''not wiki'''</noWIKI>
12701 !! end
12702
12703 !! test
12704 pre-save transform: unclosed comment in <nowiki>
12705 !! options
12706 pst
12707 !! wikitext
12708 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12709 !! html/php
12710 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12711 !!end
12712
12713 # Leading @ in this template definition works around a limitation
12714 # in parsoid's parserTests which otherwise strips the <span> from the
12715 # result (confusing it for a template wrapper)
12716 !! article
12717 Template:dangerous
12718 !!text
12719 @<span onmouseover="alert('crap')">Oh no</span>
12720 !!endarticle
12721
12722 !!test
12723 (confirming safety of fix for subst bug 1936)
12724 !! wikitext
12725 {{Template:dangerous}}
12726 !! html
12727 <p>@<span>Oh no</span>
12728 </p>
12729 !! end
12730
12731 !! test
12732 pre-save transform: comment containing gallery (bug 5024)
12733 !! options
12734 pst
12735 !! wikitext
12736 <!-- <gallery>data</gallery> -->
12737 !! html/php
12738 <!-- <gallery>data</gallery> -->
12739 !!end
12740
12741 !! test
12742 pre-save transform: comment containing extension
12743 !! options
12744 pst
12745 !! wikitext
12746 <!-- <tag>data</tag> -->
12747 !! html/php
12748 <!-- <tag>data</tag> -->
12749 !!end
12750
12751 !! test
12752 pre-save transform: comment containing nowiki
12753 !! options
12754 pst
12755 !! wikitext
12756 <!-- <nowiki>data</nowiki> -->
12757 !! html/php
12758 <!-- <nowiki>data</nowiki> -->
12759 !!end
12760
12761 !! test
12762 pre-save transform: <noinclude> in subst (bug 3298)
12763 !! options
12764 pst
12765 !! wikitext
12766 {{subst:Includes}}
12767 !! html/php
12768 Foobar
12769 !! end
12770
12771 !! test
12772 pre-save transform: <onlyinclude> in subst (bug 3298)
12773 !! options
12774 pst
12775 !! wikitext
12776 {{subst:Includes2}}
12777 !! html/php
12778 Foo
12779 !! end
12780
12781 !! article
12782 Template:SubstTest
12783 !!text
12784 {{<includeonly>subst:</includeonly>Includes}}
12785 !! endarticle
12786
12787 !! article
12788 Template:SafeSubstTest
12789 !! text
12790 {{<includeonly>safesubst:</includeonly>Includes}}
12791 !! endarticle
12792
12793 !! test
12794 bug 22297: safesubst: works during PST
12795 !! options
12796 pst
12797 !! wikitext
12798 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12799 !! html/php
12800 FoobarFoobar
12801 !! end
12802
12803 !! test
12804 bug 22297: safesubst: works during normal parse
12805 !! wikitext
12806 {{SafeSubstTest}}
12807 !! html
12808 <p>Foobar
12809 </p>
12810 !! end
12811
12812 !! test
12813 subst: does not work during normal parse
12814 !! wikitext
12815 {{SubstTest}}
12816 !! html
12817 <p>{{subst:Includes}}
12818 </p>
12819 !! end
12820
12821 !! test
12822 pre-save transform: context links ("pipe trick")
12823 !! options
12824 pst
12825 !! wikitext
12826 [[Article (context)|]]
12827 [[Bar:Article|]]
12828 [[:Bar:Article|]]
12829 [[Bar:Article (context)|]]
12830 [[:Bar:Article (context)|]]
12831 [[|Article]]
12832 [[|Article (context)]]
12833 [[Bar:X (Y) Z|]]
12834 [[:Bar:X (Y) Z|]]
12835 !! html/php
12836 [[Article (context)|Article]]
12837 [[Bar:Article|Article]]
12838 [[:Bar:Article|Article]]
12839 [[Bar:Article (context)|Article]]
12840 [[:Bar:Article (context)|Article]]
12841 [[Article]]
12842 [[Article (context)]]
12843 [[Bar:X (Y) Z|X (Y) Z]]
12844 [[:Bar:X (Y) Z|X (Y) Z]]
12845 !! end
12846
12847 !! test
12848 pre-save transform: context links ("pipe trick") with interwiki prefix
12849 !! options
12850 pst
12851 !! wikitext
12852 [[interwiki:Article|]]
12853 [[:interwiki:Article|]]
12854 [[interwiki:Bar:Article|]]
12855 [[:interwiki:Bar:Article|]]
12856 !! html/php
12857 [[interwiki:Article|Article]]
12858 [[:interwiki:Article|Article]]
12859 [[interwiki:Bar:Article|Bar:Article]]
12860 [[:interwiki:Bar:Article|Bar:Article]]
12861 !! end
12862
12863 !! test
12864 pre-save transform: context links ("pipe trick") with parens in title
12865 !! options
12866 pst title=[[Somearticle (context)]]
12867 !! wikitext
12868 [[|Article]]
12869 !! html/php
12870 [[Article (context)|Article]]
12871 !! end
12872
12873 !! test
12874 pre-save transform: context links ("pipe trick") with comma in title
12875 !! options
12876 pst title=[[Someplace, Somewhere]]
12877 !! wikitext
12878 [[|Otherplace]]
12879 [[Otherplace, Elsewhere|]]
12880 [[Otherplace, Elsewhere, Anywhere|]]
12881 !! html/php
12882 [[Otherplace, Somewhere|Otherplace]]
12883 [[Otherplace, Elsewhere|Otherplace]]
12884 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12885 !! end
12886
12887 !! test
12888 pre-save transform: context links ("pipe trick") with parens and comma
12889 !! options
12890 pst title=[[Someplace (IGNORED), Somewhere]]
12891 !! wikitext
12892 [[|Otherplace]]
12893 [[Otherplace (place), Elsewhere|]]
12894 !! html/php
12895 [[Otherplace, Somewhere|Otherplace]]
12896 [[Otherplace (place), Elsewhere|Otherplace]]
12897 !! end
12898
12899 !! test
12900 pre-save transform: context links ("pipe trick") with comma and parens
12901 !! options
12902 pst title=[[Who, me? (context)]]
12903 !! wikitext
12904 [[|Yes, you.]]
12905 [[Me, Myself, and I (1937 song)|]]
12906 !! html/php
12907 [[Yes, you. (context)|Yes, you.]]
12908 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12909 !! end
12910
12911 !! test
12912 pre-save transform: context links ("pipe trick") with namespace
12913 !! options
12914 pst title=[[Ns:Somearticle]]
12915 !! wikitext
12916 [[|Article]]
12917 !! html/php
12918 [[Ns:Article|Article]]
12919 !! end
12920
12921 !! test
12922 pre-save transform: context links ("pipe trick") with namespace and parens
12923 !! options
12924 pst title=[[Ns:Somearticle (context)]]
12925 !! wikitext
12926 [[|Article]]
12927 !! html/php
12928 [[Ns:Article (context)|Article]]
12929 !! end
12930
12931 !! test
12932 pre-save transform: context links ("pipe trick") with namespace and comma
12933 !! options
12934 pst title=[[Ns:Somearticle, Context, Whatever]]
12935 !! wikitext
12936 [[|Article]]
12937 !! html/php
12938 [[Ns:Article, Context, Whatever|Article]]
12939 !! end
12940
12941 !! test
12942 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12943 !! options
12944 pst title=[[Ns:Somearticle, Context (context)]]
12945 !! wikitext
12946 [[|Article]]
12947 !! html/php
12948 [[Ns:Article (context)|Article]]
12949 !! end
12950
12951 !! test
12952 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12953 !! options
12954 pst title=[[Ns:Somearticle (IGNORED), Context]]
12955 !! wikitext
12956 [[|Article]]
12957 !! html/php
12958 [[Ns:Article, Context|Article]]
12959 !! end
12960
12961 !! test
12962 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12963 !! options
12964 pst
12965 !! wikitext
12966 [[Article(context)|]]
12967 [[Bar:Article(context)|]]
12968 [[:Bar:Article(context)|]]
12969 [[|Article(context)]]
12970 [[Bar:X(Y)Z|]]
12971 [[:Bar:X(Y)Z|]]
12972 !! html/php
12973 [[Article(context)|Article]]
12974 [[Bar:Article(context)|Article]]
12975 [[:Bar:Article(context)|Article]]
12976 [[Article(context)]]
12977 [[Bar:X(Y)Z|X(Y)Z]]
12978 [[:Bar:X(Y)Z|X(Y)Z]]
12979 !! end
12980
12981 !! test
12982 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12983 !! options
12984 pst
12985 !! wikitext
12986 [[Article (context)|]]
12987 [[Bar:Article (context)|]]
12988 [[:Bar:Article (context)|]]
12989 [[|Article (context)]]
12990 [[Bar:X (Y) Z|]]
12991 [[:Bar:X (Y) Z|]]
12992 !! html/php
12993 [[Article (context)|Article]]
12994 [[Bar:Article (context)|Article]]
12995 [[:Bar:Article (context)|Article]]
12996 [[Article (context)]]
12997 [[Bar:X (Y) Z|X (Y) Z]]
12998 [[:Bar:X (Y) Z|X (Y) Z]]
12999 !! end
13000
13001 !! test
13002 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
13003 !! options
13004 pst
13005 !! wikitext
13006 [[Article(context)|]]
13007 [[Bar:Article(context)|]]
13008 [[:Bar:Article(context)|]]
13009 [[|Article(context)]]
13010 [[Bar:X(Y)Z|]]
13011 [[:Bar:X(Y)Z|]]
13012 !! html/php
13013 [[Article(context)|Article]]
13014 [[Bar:Article(context)|Article]]
13015 [[:Bar:Article(context)|Article]]
13016 [[Article(context)]]
13017 [[Bar:X(Y)Z|X(Y)Z]]
13018 [[:Bar:X(Y)Z|X(Y)Z]]
13019 !! end
13020
13021 !! test
13022 pre-save transform: context links ("pipe trick") with commas (bug 21660)
13023 !! options
13024 pst
13025 !! wikitext
13026 [[Article (context), context|]]
13027 [[Article (context),context|]]
13028 [[Bar:Article (context), context|]]
13029 [[Bar:Article (context),context|]]
13030 [[:Bar:Article (context), context|]]
13031 [[:Bar:Article (context),context|]]
13032 !! html/php
13033 [[Article (context), context|Article]]
13034 [[Article (context),context|Article]]
13035 [[Bar:Article (context), context|Article]]
13036 [[Bar:Article (context),context|Article]]
13037 [[:Bar:Article (context), context|Article]]
13038 [[:Bar:Article (context),context|Article]]
13039 !! end
13040
13041 !! test
13042 pre-save transform: trim trailing empty lines
13043 !! options
13044 pst
13045 !! wikitext
13046 Empty lines are trimmed
13047
13048
13049
13050
13051 !! html/php
13052 Empty lines are trimmed
13053 !! end
13054
13055 !! test
13056 pre-save transform: Signature expansion
13057 !! options
13058 pst
13059 !! wikitext
13060 * ~~~
13061 * <noinclude>~~~</noinclude>
13062 * <includeonly>~~~</includeonly>
13063 * <onlyinclude>~~~</onlyinclude>
13064 !! html/php
13065 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13066 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13067 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13068 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13069 !! end
13070
13071
13072 !! test
13073 pre-save transform: Signature expansion in nowiki tags (bug 93)
13074 !! options
13075 pst disabled
13076 !! wikitext
13077 Shall not expand:
13078
13079 <nowiki>~~~~</nowiki>
13080
13081 <includeonly><nowiki>~~~~</nowiki></includeonly>
13082
13083 <noinclude><nowiki>~~~~</nowiki></noinclude>
13084
13085 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13086
13087 {{subst:Foo}} shall be converted to FOO
13088
13089 As well as inside noinclude/onlyinclude
13090 <noinclude>{{subst:Foo}}</noinclude>
13091 <onlyinclude>{{subst:Foo}}</onlyinclude>
13092
13093 But not inside includeonly
13094 <includeonly>{{subst:Foo}}</includeonly>
13095 !! html/php
13096 Shall not expand:
13097
13098 <nowiki>~~~~</nowiki>
13099
13100 <includeonly><nowiki>~~~~</nowiki></includeonly>
13101
13102 <noinclude><nowiki>~~~~</nowiki></noinclude>
13103
13104 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13105
13106 FOO shall be converted to FOO
13107
13108 As well as inside noinclude/onlyinclude
13109 <noinclude>FOO</noinclude>
13110 <onlyinclude>FOO</onlyinclude>
13111
13112 But not inside includeonly
13113 <includeonly>{{subst:Foo}}</includeonly>
13114 !! end
13115
13116 !! test
13117 Parsoid: Recognize nowiki with trailing space in tags
13118 !! options
13119 parsoid=wt2html
13120 !! wikitext
13121 <nowiki ><div>[[foo]]</nowiki >
13122
13123 a<nowiki / >b
13124
13125 c<nowiki />d
13126
13127 e<nowiki/ >f
13128 !! html
13129 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13130 <p>ab</p>
13131 <p>cd</p>
13132 <p>ef</p>
13133 !! end
13134
13135 !! test
13136 Parsoid: Recognize nowiki with odd capitalization
13137 !! options
13138 parsoid=wt2html
13139 !! wikitext
13140 <noWikI ><div>[[foo]]</Nowiki >
13141 !! html
13142 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13143 !! end
13144
13145
13146 !! test
13147 Parsoid: Escape nowiki with trailing space in tags
13148 !! options
13149 parsoid=html2wt
13150 !! html/parsoid
13151 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13152 <p>a&lt;nowiki /&gt;b</p>
13153 <p>c&lt;nowiki/ &gt;d</p>
13154 !! wikitext
13155 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13156
13157 a&lt;nowiki /&gt;b
13158
13159 c&lt;nowiki/ &gt;d
13160 !! end
13161
13162 !! test
13163 Parsoid: Escape weird noWikI capitalizations
13164 !! options
13165 parsoid=html2wt
13166 !! html/parsoid
13167 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13168 !! wikitext
13169 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13170 !! end
13171
13172 ###
13173 ### Message transform tests
13174 ###
13175 !! test
13176 message transform: magic variables
13177 !! options
13178 msg
13179 !! wikitext
13180 {{SITENAME}}
13181 !! html
13182 MediaWiki
13183 !! end
13184
13185 !! test
13186 message transform: should not transform wiki markup
13187 !! options
13188 msg
13189 !! wikitext
13190 ''test''
13191 !! html
13192 ''test''
13193 !! end
13194
13195 !! test
13196 message transform: <noinclude> in transcluded template (bug 4926)
13197 !! options
13198 msg
13199 !! wikitext
13200 {{Includes}}
13201 !! html
13202 Foobar
13203 !! end
13204
13205 !! test
13206 message transform: <onlyinclude> in transcluded template (bug 4926)
13207 !! options
13208 msg
13209 !! wikitext
13210 {{Includes2}}
13211 !! html
13212 Foo
13213 !! end
13214
13215 !! test
13216 {{#special:}} page name, known
13217 !! options
13218 msg
13219 !! wikitext
13220 {{#special:Recentchanges}}
13221 !! html
13222 Special:RecentChanges
13223 !! end
13224
13225 !! test
13226 {{#special:}} page name with subpage, known
13227 !! options
13228 msg
13229 !! wikitext
13230 {{#special:Recentchanges/param}}
13231 !! html
13232 Special:RecentChanges/param
13233 !! end
13234
13235 !! test
13236 {{#special:}} page name, unknown
13237 !! options
13238 msg
13239 !! wikitext
13240 {{#special:foobar nonexistent}}
13241 !! html
13242 Special:Foobar nonexistent
13243 !! end
13244
13245 !! test
13246 {{#speciale:}} page name, known
13247 !! options
13248 msg
13249 !! wikitext
13250 {{#speciale:Recentchanges}}
13251 !! html
13252 Special:RecentChanges
13253 !! end
13254
13255 !! test
13256 {{#speciale:}} page name with subpage, known
13257 !! options
13258 msg
13259 !! wikitext
13260 {{#speciale:Recentchanges/param}}
13261 !! html
13262 Special:RecentChanges/param
13263 !! end
13264
13265 !! test
13266 {{#speciale:}} page name, unknown
13267 !! options
13268 msg
13269 !! wikitext
13270 {{#speciale:foobar nonexistent}}
13271 !! html
13272 Special:Foobar_nonexistent
13273 !! end
13274
13275 ###
13276 ### Images
13277 ###
13278 ### For Parsoid-specific tests, see
13279 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13280
13281 !! test
13282 Simple image
13283 !! options
13284 parsoid=wt2html,wt2wt,html2html
13285 !! wikitext
13286 [[Image:foobar.jpg]]
13287 !! html/php
13288 <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>
13289 </p>
13290 !! html/parsoid
13291 <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>
13292 !! end
13293
13294 !! test
13295 Simple image (using File: namespace, now canonical)
13296 !! wikitext
13297 [[File:Foobar.jpg]]
13298 !! html/php
13299 <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>
13300 </p>
13301 !! html/parsoid
13302 <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>
13303 !! end
13304
13305 !! test
13306 Right-aligned image
13307 !! wikitext
13308 [[File:Foobar.jpg|right]]
13309 !! html/php
13310 <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>
13311
13312 !! html/parsoid
13313 <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>
13314 !! end
13315
13316 !! test
13317 Image with caption
13318 !! wikitext
13319 [[File:Foobar.jpg|right|Caption text]]
13320 !! html/php
13321 <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>
13322
13323 !! html/parsoid
13324 <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>
13325 !! end
13326
13327 !! test
13328 Image with caption, bug 53312 #1
13329 !! wikitext
13330 [[File:Foobar.jpg|right|Caption page stuff]]
13331 !! html/php
13332 <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>
13333
13334 !! html/parsoid
13335 <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>
13336 !! end
13337
13338 !! test
13339 Image with caption, bug 53312 #2
13340 !! wikitext
13341 [[File:Foobar.jpg|right|Caption page=]]
13342 !! html/php
13343 <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>
13344
13345 !! html/parsoid
13346 <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>
13347 !! end
13348
13349 !! test
13350 Image with caption, bug 53312 #3
13351 !! wikitext
13352 [[File:Foobar.jpg|right|Caption page=stuff]]
13353 !! html/php
13354 <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>
13355
13356 !! html/parsoid
13357 <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>
13358 !! end
13359
13360 !! test
13361 Allow empty links in image captions (Bug 60753)
13362 !! options
13363 thumbsize=220
13364 !! wikitext
13365 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13366 [[]]
13367 [[Link2]]
13368 ]]
13369 !! html/php
13370 <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>
13371
13372 !! html/parsoid
13373 <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>
13374 [[]]
13375 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13376 </figcaption></figure>
13377 !! end
13378
13379 !! test
13380 Titles in unlinked images (T23454)
13381 !! wikitext
13382 [[File:Foobar.jpg|link=|stuff]]
13383 !! html/php
13384 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13385 </p>
13386 !! end
13387
13388 !! test
13389 Link with empty target
13390 !! wikitext
13391 [[]]
13392 !! html
13393 <p>[[]]
13394 </p>
13395 !! end
13396
13397 !! test
13398 Image with link trail
13399 !! wikitext
13400 Linktrails should not work for images: [[File:Foobar.jpg]]s
13401 !! html/php
13402 <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
13403 </p>
13404 !! html/parsoid
13405 <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>
13406 !! end
13407
13408 !! test
13409 Image with empty attribute
13410 !! options
13411 parsoid=wt2html,wt2wt,html2html
13412 !! wikitext
13413 [[File:Foobar.jpg|right||Caption text]]
13414 !! html/php
13415 <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>
13416
13417 !! html/parsoid
13418 <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>
13419 !! end
13420
13421 !! test
13422 1. Block image with individual attributes from templates
13423 !! wikitext
13424 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13425 !! html/php
13426 <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>
13427
13428 !! html/parsoid
13429 <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>
13430 !! end
13431
13432 !! test
13433 2. Block Image with individual attributes from templates
13434 !! wikitext
13435 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13436 !! html/php
13437 <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>
13438
13439 !! html/parsoid
13440 <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>
13441 !! end
13442
13443 !! test
13444 3. Inline image with individual attributes from templates
13445 !! wikitext
13446 [[File:Foobar.jpg|{{echo|50px}}]]
13447 !! html/php
13448 <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>
13449 </p>
13450 !! html/parsoid
13451 <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>
13452 !! end
13453
13454 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13455 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13456 !! test
13457 Image with multiple attributes from the same template
13458 !! wikitext
13459 [[File:Foobar.jpg|{{image_attribs}}]]
13460 !! html/php
13461 <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>
13462
13463 !! html/parsoid
13464 <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>
13465 !! end
13466
13467 !! test
13468 Image with link tails
13469 !! options
13470 thumbsize=220
13471 !! wikitext
13472 123[[File:Foobar.jpg]]456
13473 123[[File:Foobar.jpg|right]]456
13474 123[[File:Foobar.jpg|thumb]]456
13475 !! html/php
13476 <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
13477 </p>
13478 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
13479 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
13480
13481 !! html/php+tidy
13482 <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>
13483 <p>123</p>
13484 <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>
13485 <p>456 123</p>
13486 <div class="thumb tright">
13487 <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>
13488 <div class="thumbcaption">
13489 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13490 </div>
13491 </div>
13492 </div>
13493 <p>456</p>
13494 !! html/parsoid
13495 <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>
13496 <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>
13497 <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>
13498 !! end
13499
13500 !! test
13501 Image with multiple captions -- only last one is accepted
13502 !! wikitext
13503 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13504 !! html/php
13505 <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>
13506
13507 !! html/parsoid
13508 <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>
13509 !! end
13510
13511 !! test
13512 Image with multiple widths -- use last
13513 !! wikitext
13514 [[File:Foobar.jpg|200px|300px|caption]]
13515 !! html/php
13516 <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>
13517 </p>
13518 !! html/parsoid
13519 <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>
13520 !! end
13521
13522 !! test
13523 Image with multiple alignments -- use first (bug 48664)
13524 !! options
13525 thumbsize=220
13526 !! wikitext
13527 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13528
13529 [[File:Foobar.jpg|middle|text-top|caption]]
13530 !! html/php
13531 <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>
13532 <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>
13533 </p>
13534 !! html/parsoid
13535 <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>
13536 <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>
13537 !! end
13538
13539 !! test
13540 Image with width attribute at different positions
13541 !! wikitext
13542 [[File:Foobar.jpg|200px|right|Caption]]
13543 [[File:Foobar.jpg|right|200px|Caption]]
13544 [[File:Foobar.jpg|right|Caption|200px]]
13545 !! html/php
13546 <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>
13547 <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>
13548 <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>
13549
13550 !! html/parsoid
13551 <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>
13552 <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>
13553 <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>
13554 !! end
13555
13556 # a sad bit of backward-compatibility
13557 !! test
13558 Image with size specified with pxpx (bug 13500, 51628)
13559 !! options
13560 parsoid=wt2html,wt2wt,html2html
13561 !! wikitext
13562 [[File:Foobar.jpg|20pxpx]]
13563 [[File:Foobar.jpg|200x20pxpx]]
13564 !! html/php
13565 <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>
13566 <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>
13567 </p>
13568 !! html/parsoid
13569 <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>
13570 !! end
13571
13572 !! test
13573 Image with link parameter, wiki target
13574 !! wikitext
13575 [[File:Foobar.jpg|link=Main Page]]
13576 !! html/php
13577 <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>
13578 </p>
13579 !! html/parsoid
13580 <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>
13581 !! end
13582
13583 # parsoid bug 49293 (part 1)
13584 !! test
13585 Image with link parameter, URL target
13586 !! wikitext
13587 [[File:Foobar.jpg|link=http://example.com/]]
13588 !! html/php
13589 <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>
13590 </p>
13591 !! html/parsoid
13592 <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>
13593 !! end
13594
13595 # parsoid bug 49293 (part 2)
13596 !! test
13597 Image with link parameter, protocol-less URL target
13598 !! wikitext
13599 [[File:Foobar.jpg|link=//example.com/]]
13600 !! html/php
13601 <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>
13602 </p>
13603 !! html/parsoid
13604 <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>
13605 !! end
13606
13607 !! test
13608 Escaping non-block captions (T107435)
13609 !! options
13610 parsoid={
13611 "modes": ["wt2wt"],
13612 "changes": [
13613 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13614 ]
13615 }
13616 !! wikitext
13617 [[Image:Foobar.jpg|caption]]
13618 !! wikitext/edited
13619 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13620 !! end
13621
13622 # wgExternalLinkTarget not supported by Parsoid
13623 !! test
13624 Image with link parameter, wgExternalLinkTarget
13625 !! wikitext
13626 [[Image:foobar.jpg|link=http://example.com/]]
13627 !! config
13628 wgExternalLinkTarget='foobar'
13629 !! html/php
13630 <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>
13631 </p>
13632 !! end
13633
13634 !! test
13635 Image with link parameter, wgNoFollowLinks set to false
13636 !! wikitext
13637 [[Image:foobar.jpg|link=http://example.com/]]
13638 !! config
13639 wgNoFollowLinks=false
13640 !! html
13641 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13642 </p>
13643 !! end
13644
13645 !! test
13646 Image with link parameter, wgNoFollowDomainExceptions
13647 !! wikitext
13648 [[Image:foobar.jpg|link=http://example.com/]]
13649 !! config
13650 wgNoFollowDomainExceptions='example.com'
13651 !! html
13652 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13653 </p>
13654 !! end
13655
13656 # wgExternalLinkTarget not supported by Parsoid
13657 !! test
13658 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13659 !! wikitext
13660 [[Image:foobar.jpg|link=http://example.com/|Title]]
13661 !! config
13662 wgExternalLinkTarget='foobar'
13663 !! html/php
13664 <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>
13665 </p>
13666 !! end
13667
13668 !! test
13669 Image with empty link parameter
13670 !! wikitext
13671 [[File:Foobar.jpg|link=]]
13672 !! html/php
13673 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13674 </p>
13675 !! html/parsoid
13676 <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>
13677 !! end
13678
13679 !! test
13680 Image with link parameter (wiki target) and unnamed parameter
13681 !! wikitext
13682 [[File:Foobar.jpg|link=Main_Page|Title]]
13683 !! html/php
13684 <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>
13685 </p>
13686 !! html/parsoid
13687 <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>
13688 !! end
13689
13690 !! test
13691 Image with link parameter (URL target) and unnamed parameter
13692 !! wikitext
13693 [[File:Foobar.jpg|link=http://example.com/|Title]]
13694 !! html/php
13695 <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>
13696 </p>
13697 !! html/parsoid
13698 <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>
13699 !! end
13700
13701 !! test
13702 Thumbnail image with link parameter
13703 !! options
13704 thumbsize=220
13705 parsoid=wt2html,wt2wt,html2html
13706 !! wikitext
13707 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13708 !! html/php
13709 <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>
13710
13711 !! html/parsoid
13712 <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>
13713 !! end
13714
13715 !! test
13716 Manually-specified thumbnail image
13717 !! options
13718 thumbsize=220
13719 !! wikitext
13720 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13721 !! html/php
13722 <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>
13723
13724 !! html/parsoid
13725 <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>
13726 !! end
13727
13728 !! test
13729 Manually-specified thumbnail image with explicit link to wiki page
13730 !! options
13731 thumbsize=220
13732 parsoid=wt2html,wt2wt,html2html
13733 !! wikitext
13734 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13735 !! html/php
13736 <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>
13737
13738 !! html/parsoid
13739 <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>
13740 !! end
13741
13742 !! test
13743 Manually-specified thumbnail image with explicit link to url
13744 !! options
13745 thumbsize=220
13746 parsoid=wt2html,wt2wt,html2html
13747 !! wikitext
13748 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13749 !! html/php
13750 <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>
13751
13752 !! html/parsoid
13753 <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>
13754 !! end
13755
13756 !! test
13757 Manually-specified thumbnail image with explicit no link
13758 !! options
13759 thumbsize=220
13760 parsoid=wt2html,wt2wt,html2html
13761 !! wikitext
13762 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13763 !! html/php
13764 <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>
13765
13766 !! html/parsoid
13767 <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>
13768 !! end
13769
13770 !! test
13771 Manually-specified thumbnail image with explicit link and alt text
13772 !! options
13773 thumbsize=220
13774 parsoid=wt2html,wt2wt,html2html
13775 !! wikitext
13776 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13777 !! html/php
13778 <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>
13779
13780 !! html/parsoid
13781 <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>
13782 !! end
13783
13784 !! test
13785 Image with frame and link
13786 !! options
13787 parsoid=wt2html,wt2wt,html2html
13788 !! wikitext
13789 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13790 !! html/php
13791 <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>
13792
13793 !! html/parsoid
13794 <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>
13795 !! end
13796
13797 !! test
13798 Image with frame and link and explicit alt
13799 !! options
13800 parsoid=wt2html,wt2wt,html2html
13801 !! wikitext
13802 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13803 !! html/php
13804 <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>
13805
13806 !! html/parsoid
13807 <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>
13808 !! end
13809
13810 !! test
13811 Image with wiki markup in implicit alt
13812 !! wikitext
13813 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13814
13815 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13816 !! html/php
13817 <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>
13818 </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>
13819 </p>
13820 !! html/parsoid
13821 <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>
13822
13823 <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>
13824 !! end
13825
13826 !! test
13827 Alt image option should handle most kinds of wikitext without barfing
13828 !! wikitext
13829 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13830 !! html/php
13831 <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>
13832
13833 !! html/parsoid
13834 <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>
13835 !! end
13836
13837 ###################
13838 # Conflicting image format options.
13839 # First option specified should 'win'.
13840 # All three cases in each test should be identical.
13841
13842 !! test
13843 Image with 'frameless' first.
13844 !! options
13845 parsoid=wt2html,wt2wt,html2html
13846 !! wikitext
13847 [[File:Foobar.jpg|frameless|caption]]
13848
13849 [[File:Foobar.jpg|frameless|frame|caption]]
13850
13851 [[File:Foobar.jpg|frameless|thumb|caption]]
13852 !! html/php
13853 <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>
13854 </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>
13855 </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>
13856 </p>
13857 !! html/parsoid
13858 <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>
13859 <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>
13860 <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>
13861 !! end
13862
13863 !! test
13864 Image with 'frame' first.
13865 !! options
13866 parsoid=wt2html,wt2wt,html2html
13867 !! wikitext
13868 [[File:Foobar.jpg|frame|caption]]
13869 [[File:Foobar.jpg|frame|frameless|caption]]
13870 [[File:Foobar.jpg|frame|thumb|caption]]
13871 !! html/php
13872 <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>
13873 <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>
13874 <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>
13875
13876 !! html/parsoid
13877 <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>
13878 <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>
13879 <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>
13880 !! end
13881
13882 !! test
13883 Image with 'thumb' first.
13884 !! options
13885 parsoid=wt2html,wt2wt,html2html
13886 !! wikitext
13887 [[File:Foobar.jpg|thumb|caption]]
13888 [[File:Foobar.jpg|thumb|frameless|caption]]
13889 [[File:Foobar.jpg|thumb|frame|caption]]
13890 !! html/php
13891 <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>
13892 <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>
13893 <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>
13894
13895 !! html/parsoid
13896 <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>
13897 <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>
13898 <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>
13899 !! end
13900
13901 ###################
13902 # Image sizing.
13903 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13904 # and https://phabricator.wikimedia.org/T64258
13905 # Foobar has actual size of 1941x220
13906 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13907 # a scalable format.
13908 # 2. Framed images always ignore size options; always render at default size.
13909 # 3. "Unspecified format" and border are the only types which can be
13910 # enlarged.
13911
13912 !! test
13913 Image: "unspecified format" and border enlarge
13914 !! options
13915 parsoid=wt2html,wt2wt,html2html
13916 !! wikitext
13917 [[File:Foobar.jpg|2000px]]
13918
13919 [[File:Foobar.jpg|border|2000px]]
13920 !! html/php
13921 <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>
13922 </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>
13923 </p>
13924 !! html/parsoid
13925 <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>
13926 <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>
13927 !! end
13928
13929 !! test
13930 Image: "unspecified format" and border reduce
13931 !! options
13932 parsoid=wt2html,wt2wt,html2html
13933 !! wikitext
13934 [[File:Foobar.jpg|1000px]]
13935
13936 [[File:Foobar.jpg|border|1000px]]
13937 !! html/php
13938 <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>
13939 </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>
13940 </p>
13941 !! html/parsoid
13942 <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>
13943 <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>
13944 !! end
13945
13946 !! test
13947 Image: thumbs reduce
13948 !! options
13949 parsoid=wt2html,wt2wt,html2html
13950 !! wikitext
13951 [[File:Foobar.jpg|thumb|50px]]
13952 !! html/php
13953 <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>
13954
13955 !! html/parsoid
13956 <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>
13957 !! end
13958
13959 !! test
13960 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13961 !! options
13962 parsoid=wt2html,wt2wt,html2html
13963 !! wikitext
13964 [[File:Foobar.jpg|thumb|2000px]]
13965
13966 [[File:Foobar.svg|thumb|2000px]]
13967 !! html/php
13968 <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>
13969 <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>
13970
13971 !! html/parsoid
13972 <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>
13973 <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>
13974 !! end
13975
13976 !! test
13977 Image: frameless can reduce in size
13978 !! options
13979 parsoid=wt2html,wt2wt,html2html
13980 !! wikitext
13981 [[File:Foobar.jpg|frameless|50px]]
13982 !! html/php
13983 <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>
13984 </p>
13985 !! html/parsoid
13986 <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>
13987 !! end
13988
13989 !! test
13990 Image: bitmap frameless can't be enlarged past original size, but vector can
13991 !! options
13992 parsoid=wt2html,wt2wt,html2html
13993 !! wikitext
13994 [[File:Foobar.jpg|frameless|2000px]]
13995
13996 [[File:Foobar.svg|frameless|2000px]]
13997 !! html/php
13998 <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>
13999 </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>
14000 </p>
14001 !! html/parsoid
14002 <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>
14003 <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>
14004 !! end
14005
14006 !! test
14007 Image: framed images are always unscaled.
14008 !! options
14009 parsoid=wt2html,wt2wt,html2html
14010 !! wikitext
14011 [[File:Foobar.jpg|frame]]
14012
14013 [[File:Foobar.jpg|frame|50px]]
14014
14015 [[File:Foobar.jpg|frame|50x50px]]
14016
14017 [[File:Foobar.jpg|frame|2000px]]
14018 !! html/php
14019 <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>
14020 <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>
14021 <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>
14022 <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>
14023
14024 !! html/parsoid
14025 <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>
14026 <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>
14027 <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>
14028 <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>
14029 !! end
14030
14031 ###################
14032
14033 !! test
14034 Link to image page- image page normally doesn't exists, hence edit link
14035 Add test with existing image page
14036 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14037 !! wikitext
14038 [[:Image:test]]
14039 !! html
14040 <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>
14041 </p>
14042 !! end
14043
14044 !! test
14045 bug 18784 Link to non-existent image page with caption should use caption as link text
14046 !! wikitext
14047 [[:Image:test|caption]]
14048 !! html
14049 <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>
14050 </p>
14051 !! end
14052
14053 !! test
14054 Frameless image caption with a free URL
14055 !! wikitext
14056 [[File:Foobar.jpg|http://example.com]]
14057 !! html/php
14058 <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>
14059 </p>
14060 !! html/parsoid
14061 <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>
14062 !! end
14063
14064 !! test
14065 Thumbnail image caption with a free URL
14066 !! options
14067 thumbsize=220
14068 !! wikitext
14069 [[File:Foobar.jpg|thumb|http://example.com]]
14070 !! html/php
14071 <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>
14072
14073 !! html/parsoid
14074 <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>
14075 !! end
14076
14077 !! test
14078 Thumbnail image caption with a free URL and explicit alt
14079 !! options
14080 thumbsize=220
14081 parsoid=wt2html,wt2wt,html2html
14082 !! wikitext
14083 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14084 !! html/php
14085 <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>
14086
14087 !! html/parsoid
14088 <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>
14089 !! end
14090
14091 !! test
14092 SVG thumbnails with no language set
14093 !! options
14094 !! wikitext
14095 [[File:Foobar.svg|thumb|caption]]
14096 !! html/php
14097 <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>
14098
14099 !! html/parsoid
14100 <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>
14101 !! end
14102
14103 !! test
14104 SVG thumbnails with language de
14105 !! options
14106 parsoid=wt2html,wt2wt,html2html
14107 !! wikitext
14108 [[File:Foobar.svg|thumb|caption|lang=de]]
14109 !! html/php
14110 <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>
14111
14112 !! html/parsoid
14113 <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>
14114 !! end
14115
14116 !! test
14117 SVG thumbnails with invalid language code
14118 !! options
14119 parsoid=wt2html,wt2wt,html2html
14120 !! wikitext
14121 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14122 !! html/php
14123 <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>
14124
14125 !! html/parsoid
14126 <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>
14127 !! end
14128
14129 !! test
14130 BUG 1887: A ISBN with a thumbnail
14131 !! wikitext
14132 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14133 !! html/php
14134 <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>
14135
14136 !! html/parsoid
14137 <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>
14138 !! end
14139
14140 !! test
14141 BUG 1887: A RFC with a thumbnail
14142 !! wikitext
14143 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14144 !! html/php
14145 <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>
14146
14147 !! html/parsoid
14148 <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>
14149 !! end
14150
14151 !! test
14152 BUG 1887: A mailto link with a thumbnail
14153 !! wikitext
14154 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14155 !! html/php
14156 <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>
14157
14158 !! html/parsoid
14159 <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>
14160 !! end
14161
14162 # Pending resolution to bug 368
14163 !! test
14164 BUG 648: Frameless image caption with a link
14165 !! wikitext
14166 [[File:Foobar.jpg|text with a [[link]] in it]]
14167 !! html/php
14168 <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>
14169 </p>
14170 !! html/parsoid
14171 <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>
14172 !! end
14173
14174 !! test
14175 BUG 648: Frameless image caption with a link (suffix)
14176 !! wikitext
14177 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14178 !! html/php
14179 <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>
14180 </p>
14181 !! html/parsoid
14182 <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>
14183 !! end
14184
14185 !! test
14186 BUG 648: Frameless image caption with an interwiki link
14187 !! wikitext
14188 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14189 !! html/php
14190 <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>
14191 </p>
14192 !! html/parsoid
14193 <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>
14194 !! end
14195
14196 !! test
14197 BUG 648: Frameless image caption with a piped interwiki link
14198 !! wikitext
14199 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14200 !! html/php
14201 <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>
14202 </p>
14203 !! html/parsoid
14204 <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>
14205 !! end
14206
14207 !! test
14208 T107474: Frameless image caption with <nowiki>
14209 !! wikitext
14210 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14211 !! html/parsoid
14212 <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>
14213 !! end
14214
14215 !! test
14216 Escape HTML special chars in image alt text
14217 !! wikitext
14218 [[File:Foobar.jpg|& < > "]]
14219 !! html/php
14220 <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>
14221 </p>
14222 !! html/parsoid
14223 <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>
14224 !! end
14225
14226 !! test
14227 Escape HTML special chars in image alt text with LanguageConverter
14228 !! options
14229 language=zh
14230 !! wikitext
14231 [[File:Foobar.jpg|& < > "]]
14232 !! html/php
14233 <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>
14234 </p>
14235 !! html/parsoid
14236 <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>
14237 !! end
14238
14239 !! test
14240 Entities in file name and attributes
14241 !! wikitext
14242 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14243 !! html/php
14244 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14245 </p>
14246 !! html/parsoid
14247 <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>
14248 !! end
14249
14250 !! test
14251 BUG 499: Alt text should have &#1234;, not &amp;1234;
14252 !! wikitext
14253 [[File:Foobar.jpg|&#9792;]]
14254 !! html/php
14255 <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>
14256 </p>
14257 !! html/parsoid
14258 <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>
14259 !! end
14260
14261 !! test
14262 Broken image caption with link
14263 !! options
14264 parsoid=wt2html,wt2wt,html2html
14265 !! wikitext
14266 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14267 !! html/php
14268 <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.
14269 </p>
14270 !! html/parsoid
14271 <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>
14272 !! end
14273
14274 !! test
14275 Image caption containing another image
14276 !! wikitext
14277 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14278 !! html/php
14279 <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>
14280
14281 !! html/parsoid
14282 <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>
14283 !! end
14284
14285 !! test
14286 Image: caption containing a newline
14287 !! wikitext
14288 [[File:Foobar.jpg|This
14289 *is some text]]
14290 !! html/php
14291 <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>
14292 </p>
14293 !! html/parsoid
14294 <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>
14295 !!end
14296
14297 !!test
14298 Image: caption containing leading space
14299 (The leading space should not trigger nowiki escaping in wt2wt mode)
14300 !! wikitext
14301 [[File:Foobar.jpg|thumb| bar]]
14302 !! html/php
14303 <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>
14304
14305 !! html/parsoid
14306 <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>
14307 !!end
14308
14309 !! test
14310 Image: caption containing a table
14311 !! options
14312 parsoid=wt2html,wt2wt,html2html
14313 !! wikitext
14314 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14315 {|
14316 ! Foo !! Bar
14317 |-
14318 | Foo1 || Bar1
14319 |}
14320 and some more text.]]
14321 !! html/php
14322 <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>
14323
14324 !! html/parsoid
14325 <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
14326 <table>
14327 <tbody>
14328 <tr><th>Foo </th><th>Bar</th></tr>
14329 <tr>
14330 <td>Foo1 </td>
14331 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14332 !! end
14333
14334 !! test
14335 Bug 3090: External links other than http: in image captions
14336 !! wikitext
14337 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14338 !! html/php
14339 <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>
14340
14341 !! html/parsoid
14342 <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>
14343 !! end
14344
14345 !! test
14346 Custom class
14347 !! options
14348 parsoid=wt2html,wt2wt,html2html
14349 !! wikitext
14350 [[Image:foobar.jpg|a|class=b]]
14351 !! html/php
14352 <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>
14353 </p>
14354 !! html/parsoid
14355 <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>
14356 !! end
14357
14358 !! test
14359 Localized image handling (1).
14360 !! options
14361 parsoid=wt2html,wt2wt,html2html
14362 language=es
14363 !! wikitext
14364 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14365 !! html/php
14366 <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>
14367
14368 !! html/parsoid
14369 <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>
14370 !! end
14371
14372 !! test
14373 Localized image handling (2).
14374 !! options
14375 thumbsize=220
14376 parsoid=wt2html,wt2wt,html2html
14377 language=es
14378 !! wikitext
14379 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14380 !! html/php
14381 <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>
14382
14383 !! html/parsoid
14384 <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>
14385 !! end
14386
14387 !! test
14388 Localized image handling (3).
14389 !! options
14390 language=fa
14391 parsoid=html2wt
14392 !! html/parsoid
14393 <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>
14394 !! wikitext
14395 [[File:Foobar.jpg|بندانگشتی]]
14396 !! end
14397
14398 !! test
14399 "border", "frameless" and "class" attributes on an image.
14400 !! options
14401 thumbsize=220
14402 parsoid=wt2html,wt2wt,html2html
14403 !! wikitext
14404 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14405 !! html/php
14406 <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>
14407 </p>
14408 !! html/parsoid
14409 <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>
14410 !! end
14411
14412 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14413 !! test
14414 Invalid image attributes (bug 62500)
14415 !! options
14416 thumbsize=220
14417 parsoid=wt2html,wt2wt,html2html
14418 !! wikitext
14419 [[File:Foobar.jpg|thumb|float|left|caption]]
14420
14421 [[File:Foobar.jpg|thumb|righ|caption]]
14422
14423 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14424 !! html/php
14425 <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>
14426 <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>
14427 <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>
14428
14429 !! html/parsoid
14430 <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>
14431 <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>
14432 <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>
14433 !! end
14434
14435 !! article
14436 File:Barfoo.jpg
14437 !! text
14438 #REDIRECT [[File:Barfoo.jpg]]
14439 !! endarticle
14440
14441 # FIXME: Parsoid should run this test -- but we'd need to teach the
14442 # mockAPI about the redirected Barfoo.jpg image.
14443 !! test
14444 Redirected image
14445 !! wikitext
14446 [[Image:Barfoo.jpg]]
14447 !! html/php
14448 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14449 </p>
14450 !! end
14451
14452 !! test
14453 Missing image with uploads disabled
14454 !! options
14455 wgEnableUploads=0
14456 !! wikitext
14457 [[File:Foobaz.jpg]]
14458 !! html/php
14459 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14460 </p>
14461 !! html/parsoid
14462 <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>
14463 !! end
14464
14465 # Parsoid-specific testing for images
14466 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14467 # Currently imperfect due to a flaw in the Parsoid testrunner
14468 # Work in progress
14469 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14470 # image tests.
14471
14472 !! test
14473 Parsoid-specific image handling - simple image with size and middle alignment
14474 !! wikitext
14475 [[File:Foobar.jpg|middle|50px]]
14476 !! html/parsoid
14477 <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>
14478 !! end
14479
14480 !! test
14481 Parsoid-specific image handling - simple image with size, middle alignment,
14482 non-standard namespace alias
14483 !! options
14484 parsoid=wt2wt,wt2html,html2html
14485 !! wikitext
14486 [[Image:Foobar.jpg|middle|50px]]
14487 !! html/parsoid
14488 <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>
14489 !! end
14490
14491 !! test
14492 Parsoid-specific image handling - simple image with size and middle alignment
14493 (existing content)
14494 !! wikitext
14495 [[File:Foobar.jpg|50px|middle]]
14496 !! html/parsoid
14497 <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>
14498 !! end
14499
14500 !! test
14501 Parsoid-specific image handling - simple image with size and middle alignment
14502 and non-standard namespace name
14503 !! options
14504 parsoid=wt2html,wt2wt,html2html
14505 !! wikitext
14506 [[Image:Foobar.jpg|50px|middle]]
14507 !! html/parsoid
14508 <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>
14509 !! end
14510
14511 !! test
14512 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14513 !! wikitext
14514 [[File:Foobar.jpg|500x10px|baseline|caption]]
14515 !! html/parsoid
14516 <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>
14517 !! end
14518
14519 !! test
14520 Parsoid-specific image handling - simple image with border and size spec
14521 !! wikitext
14522 [[File:Foobar.jpg|50px|border|caption]]
14523 !! html/parsoid
14524 <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>
14525 !! end
14526
14527 !! test
14528 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14529 !! wikitext
14530 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14531 !! html/parsoid
14532 <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>
14533 !! end
14534
14535 !! test
14536 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14537 (existing content)
14538 !! wikitext
14539 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14540 !! html/parsoid
14541 <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>
14542 !! end
14543
14544 !! test
14545 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14546 !! wikitext
14547 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14548 !! html/parsoid
14549 <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>
14550 !! end
14551
14552 !! test
14553 Parsoid-specific image handling - thumbnail with specific size, halign,
14554 valign, and caption (existing content)
14555 !! wikitext
14556 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14557 !! html/parsoid
14558 <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>
14559 !! end
14560
14561 !! test
14562 Parsoid-specific image handling - framed image with specific size and caption
14563 (size is ignored)
14564 !! options
14565 parsoid=wt2html,wt2wt,html2html
14566 !! wikitext
14567 [[File:Foobar.jpg|frame|500x50px|caption]]
14568 !! html/parsoid
14569 <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>
14570 !! end
14571
14572 !! test
14573 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14574 (size is ignored)
14575 !! options
14576 parsoid=wt2html,wt2wt,html2html
14577 !! wikitext
14578 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14579 !! html/parsoid
14580 <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>
14581 !! end
14582
14583 !! test
14584 Parsoid-specific image handling - frameless image with specific size, border, and caption
14585 !! wikitext
14586 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14587 !! html/parsoid
14588 <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>
14589 !! end
14590
14591 !! test
14592 Parsoid-specific image handling - simple image with a formatted caption
14593 !! wikitext
14594 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14595 !! html/parsoid
14596 <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>
14597 !! end
14598
14599 !! test
14600 Parsoid-specific image handling - caption with a template in it
14601 !! wikitext
14602 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14603 !! html/parsoid
14604 <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>
14605 !! end
14606
14607 !! test
14608 Parsoid-specific image handling - caption with unbalanced tags in it
14609 !! options
14610 parsoid=wt2html,wt2wt,html2html
14611 !! wikitext
14612 foo
14613 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14614 bar
14615 !! html/parsoid
14616 <p>foo</p>
14617 <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>
14618 <p>bar</p>
14619 !! end
14620
14621 !! test
14622 Parsoid-specific image handling - empty caption (1)
14623 !! options
14624 parsoid=wt2html,wt2wt
14625 !! wikitext
14626 [[File:Foobar.jpg|thumb|]]
14627 !! html/parsoid
14628 <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>
14629 !! end
14630
14631 # empty captions don't get serialized unless we're in the "round trip" case
14632 !! test
14633 Parsoid-specific image handling - empty caption (2)
14634 !! options
14635 parsoid=html2wt
14636 !! html/parsoid
14637 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14638 <a href="./File:Foobar.jpg">
14639 <img resource="./File:Foobar.jpg"
14640 src="//example.com/images/3/3a/Foobar.jpg"
14641 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14642 height="25" width="220"/>
14643 </a>
14644 <figcaption></figcaption>
14645 </figure>
14646 !! wikitext
14647 [[File:Foobar.jpg|thumb]]
14648 !! end
14649
14650 !! test
14651 Parsoid-specific image handling - whitespace caption
14652 !! wikitext
14653 [[File:Foobar.jpg|thumb| ]]
14654 !! html/parsoid
14655 <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>
14656 !! end
14657
14658 !! test
14659 Parsoid-specific image handling - lang option
14660 !! wikitext
14661 foo
14662 [[File:Foobar.svg|lang=de|caption]]
14663 bar
14664 !! html/parsoid
14665 <p>foo
14666 <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>
14667 bar</p>
14668 !! end
14669
14670 ## Edge case bugs in Parsoid from T93580
14671 !! test
14672 T93580: 1. Templated <ref> inside block images
14673 !! wikitext
14674 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14675
14676 <references />
14677 !! html/parsoid
14678 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14679
14680 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14681 !! end
14682
14683 !! test
14684 T93580: 2. <ref> inside inline images
14685 !! wikitext
14686 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14687
14688 <references />
14689 !! html/parsoid
14690 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14691
14692 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14693 !! end
14694
14695 !! test
14696 T93580: 3. Templated <ref> inside inline images
14697 !! wikitext
14698 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14699
14700 <references />
14701 !! html/parsoid
14702 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14703
14704 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14705 !! end
14706
14707 ###
14708 ### Subpages
14709 ###
14710 !! article
14711 Subpage test/subpage
14712 !! text
14713 foo
14714 !! endarticle
14715
14716 !! test
14717 Subpage link
14718 !! options
14719 subpage title=[[Subpage test]]
14720 !! wikitext
14721 [[/subpage]]
14722 !! html
14723 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14724 </p>
14725 !! end
14726
14727 !! test
14728 Subpage noslash link
14729 !! options
14730 subpage title=[[Subpage test]]
14731 !! wikitext
14732 [[/subpage/]]
14733 !! html
14734 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14735 </p>
14736 !! end
14737
14738 !! article
14739 Subpage test/1/2/subpage
14740 !! text
14741 blah
14742 !! endarticle
14743
14744 !! test
14745 Relative subpage noslash link
14746 !! options
14747 parsoid=wt2wt,wt2html,html2html
14748 subpage title=[[Subpage test/1/2/3/4]]
14749 !! wikitext
14750 [[../../subpage/]]
14751
14752 [[../../subpage]]
14753 !! html/php
14754 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14755 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14756 </p>
14757 !! html/parsoid
14758 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14759 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14760 !! end
14761
14762 !! test
14763 Parsoid: dot-slash prefixed wikilinks
14764 !! wikitext
14765 [[./foo]]
14766
14767 [[././bar]]
14768
14769 [[././baz/]]
14770 !! html/php
14771 <p>[[./foo]]
14772 </p><p>[[././bar]]
14773 </p><p>[[././baz/]]
14774 </p>
14775 !! html/parsoid
14776 <p>[[./foo]]
14777 </p><p>[[././bar]]
14778 </p><p>[[././baz/]]
14779 </p>
14780 !! end
14781
14782 !! test
14783 Render invalid page names as plain text (bug 51090)
14784 !! wikitext
14785 [[./../foo|bar]]
14786 [[foo�|bar]]
14787 [[foo/.|bar]]
14788 [[foo/..|bar]]
14789 [[foo~~~bar]]
14790 [[foo>bar]]
14791 [[foo[bar]]
14792 [[.]]
14793 [[..]]
14794 [[foo././bar]]
14795
14796 [[{{echo|./../foo}}|bar]]
14797 [[{{echo|foo/.}}|bar]]
14798 [[{{echo|foo/..}}|bar]]
14799 [[{{echo|foo~~~~bar}}]]
14800 [[{{echo|foo>bar}}]]
14801 [[{{echo|foo././bar}}]]
14802 [[{{echo|foo{bar}}]]
14803 [[{{echo|foo}bar}}]]
14804 [[{{echo|foo[bar}}]]
14805 [[{{echo|foo]bar}}]]
14806 [[{{echo|foo<bar}}]]
14807 !!html/php
14808 <p>[[./../foo|bar]]
14809 [[foo�|bar]]
14810 [[foo/.|bar]]
14811 [[foo/..|bar]]
14812 [[foo~~~bar]]
14813 [[foo&gt;bar]]
14814 [[foo[bar]]
14815 [[.]]
14816 [[..]]
14817 [[foo././bar]]
14818 </p><p>[[./../foo|bar]]
14819 [[foo/.|bar]]
14820 [[foo/..|bar]]
14821 [[foo~~~~bar]]
14822 [[foo&gt;bar]]
14823 [[foo././bar]]
14824 [[foo{bar]]
14825 [[foo}bar]]
14826 [[foo[bar]]
14827 [[foo]bar]]
14828 [[foo&lt;bar]]
14829 </p>
14830 !!html/parsoid
14831 <p>[[./../foo|bar]]
14832 [[foo�|bar]]
14833 [[foo/.|bar]]
14834 [[foo/..|bar]]
14835 [[foo~~~bar]]
14836 [[foo>bar]]
14837 [[foo[bar]]
14838 [[.]]
14839 [[..]]
14840 [[foo././bar]]</p>
14841
14842 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14843 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14844 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14845 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14846 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14847 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14848 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14849 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14850 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14851 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14852 [[<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>
14853 !!end
14854
14855 !! test
14856 Disabled subpages
14857 !! wikitext
14858 [[/subpage]]
14859 !! html
14860 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14861 </p>
14862 !! end
14863
14864 !! test
14865 BUG 561: {{/Subpage}}
14866 !! options
14867 subpage title=[[Page]]
14868 !! wikitext
14869 {{/Subpage}}
14870 !! html
14871 <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>
14872 </p>
14873 !! end
14874
14875 ###
14876 ### Categories
14877 ###
14878 !! article
14879 Category:MediaWiki User's Guide
14880 !! text
14881 blah
14882 !! endarticle
14883
14884 !! test
14885 Link to category
14886 !! wikitext
14887 [[:Category:MediaWiki User's Guide]]
14888 !! html
14889 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14890 </p>
14891 !! end
14892
14893 !! test
14894 Simple category
14895 !! options
14896 cat
14897 !! wikitext
14898 [[Category:MediaWiki User's Guide]]
14899 !! html/php
14900 cat=MediaWiki_User's_Guide sort=
14901 !! html/parsoid
14902 <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"}}'/>
14903 !! end
14904
14905 !! test
14906 PAGESINCATEGORY invalid title fatal (r33546 fix)
14907 !! wikitext
14908 {{PAGESINCATEGORY:<bogus>}}
14909 !! html
14910 <p>0
14911 </p>
14912 !! end
14913
14914 !! test
14915 Category with different sort key
14916 !! options
14917 cat
14918 !! wikitext
14919 [[Category:MediaWiki User's Guide|Foo]]
14920 !! html/php
14921 cat=MediaWiki_User's_Guide sort=Foo
14922 !! html/parsoid
14923 <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"}}'/>
14924 !! end
14925
14926 !! test
14927 Category with identical sort key
14928 !! options
14929 cat
14930 !! wikitext
14931 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14932 !! html/php
14933 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14934 !! html/parsoid
14935 <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"}}'/>
14936 !! end
14937
14938 !! test
14939 Category with empty sort key
14940 !! options
14941 cat
14942 pst
14943 !! wikitext
14944 [[Category:MediaWiki User's Guide|]]
14945 !! html/php
14946 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14947 !! end
14948
14949 !! test
14950 Category with empty sort key and parentheses
14951 !! options
14952 cat
14953 pst
14954 !! wikitext
14955 [[Category:Foo (bar)|]]
14956 !! html/php
14957 [[Category:Foo (bar)|Foo]]
14958 !! end
14959
14960 !! test
14961 Category with link tail
14962 !! options
14963 cat
14964 pst
14965 !! wikitext
14966 123[[Category:Foo]]456
14967 !! html/php
14968 123[[Category:Foo]]456
14969 !! end
14970
14971 !! test
14972 Category with template
14973 !! options
14974 cat
14975 pst
14976 !! wikitext
14977 [[Category:{{echo|Foo}}]]
14978 !! html/php
14979 [[Category:{{echo|Foo}}]]
14980 !! end
14981
14982 !! test
14983 Category with template in sort key
14984 !! options
14985 cat
14986 pst
14987 !! wikitext
14988 [[Category:Foo|{{echo|Bar}}]]
14989 !! html/php
14990 [[Category:Foo|{{echo|Bar}}]]
14991 !! end
14992
14993 !! test
14994 Category with template in sort key and title
14995 !! options
14996 cat
14997 pst
14998 !! wikitext
14999 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15000 !! html/php
15001 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15002 !! end
15003
15004 ## We used to, but no longer wt2wt this test since the default serializer
15005 ## will normalize all categories to serialize on their own line.
15006 ## This wikitext usage is going to be fairly uncommon in production and
15007 ## selser will take care of preserving formatting in those scenarios.
15008 !! test
15009 Category / paragraph interactions
15010 !! options
15011 parsoid=wt2html
15012 !! wikitext
15013 Foo [[Category:Baz]] Bar
15014
15015 Foo [[Category:Baz]]
15016 Bar
15017
15018 Foo
15019 [[Category:Baz]]
15020 Bar
15021
15022 Foo
15023 [[Category:Baz]] Bar
15024
15025 Foo
15026 [[Category:Baz]]
15027 [[Category:Baz]]
15028 [[Category:Baz]]
15029 Bar
15030
15031 [[Category:Baz]]
15032 [[Category:Baz]]
15033 [[Category:Baz]]
15034
15035 [[Category:Baz]]
15036 {{echo|[[Category:Baz]]}}
15037 [[Category:Baz]]
15038 !! html/php
15039 <p>Foo Bar
15040 </p><p>Foo
15041 Bar
15042 </p><p>Foo
15043 Bar
15044 </p><p>Foo Bar
15045 </p><p>Foo
15046 Bar
15047 </p>
15048 !! html/parsoid
15049 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15050 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15051 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15052 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15053 <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>
15054 <link rel="mw:PageProp/Category" href="Category:Baz"/>
15055 !! end
15056
15057 ## We used to, but no longer wt2wt this test since the default serializer
15058 ## will normalize all categories to serialize on their own line.
15059 ## This wikitext usage is going to be fairly uncommon in production and
15060 ## selser will take care of preserving formatting in those scenarios.
15061 ##
15062 ## The whitespace on the empty line is part of the test. Please do not delete
15063 !! test
15064 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15065 !! options
15066 parsoid=wt2html
15067 !! wikitext
15068 This
15069
15070 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15071
15072 {{echo|[[Category:Foo]] and so should this!}}
15073 !! html/php
15074 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15075 </p>
15076 !! html/parsoid
15077 <p>This
15078
15079 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15080
15081 <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>
15082 !! end
15083
15084 ## Parsoid will not try to wt2wt this while preserving newlines because
15085 ## it suppresses excess newlines within list items -- and we don't want to
15086 ## introduce a special case just for categories, which is, in reality somewhat
15087 ## odd behavior -- categories are unlikely to be used in list items like this
15088 ## in top-level pages and are only likely to show up in template-generated
15089 ## list items where this RT-ing is a non-issue.
15090 ##
15091 ## The whitespace on the empty line is part of the test. Please do not delete
15092 !! test
15093 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15094 !! options
15095 parsoid=wt2html
15096 !! wikitext
15097 * This
15098
15099 [[Category:Foo]] and this should be part of the same list item
15100 * So should this
15101
15102 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15103 !! html
15104 <ul><li>This and this should be part of the same list item</li>
15105 <li>So should this and this should be part of the same list item</li></ul>
15106 !! html/parsoid
15107 <ul>
15108 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15109 <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>
15110 </ul>
15111 !! end
15112
15113 ## Newlines and categories that follow the last item of a list
15114 ## are treated differently because this (list followed by categories)
15115 ## is an extremely common pattern on wikis.
15116 !! test
15117 3. Categories and newlines: newline suppression for last list item should RT properly
15118 !! wikitext
15119 * a
15120 * b
15121
15122 [[Category:Foo]]
15123
15124 [[Category:Bar]]
15125 [[Category:Baz]]
15126 !! html/parsoid
15127 <ul><li> a</li>
15128 <li> b</li></ul>
15129
15130 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15131
15132 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15133 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15134 !! end
15135
15136 !! test
15137 4. Categories and newlines: newline suppression for last list item should RT properly
15138 !! wikitext
15139 * a
15140 **** b
15141
15142 [[Category:Foo]]
15143 !! html/parsoid
15144 <ul><li> a
15145 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15146
15147 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15148 !! end
15149
15150 ## only wt2html for this to make sure the algo only applies to the rightmost path
15151 !! test
15152 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15153 !! options
15154 parsoid=wt2html
15155 !! wikitext
15156 * a
15157 ** b
15158 [[Category:Foo]]
15159 * c
15160 ** d
15161 [[Category:Foo]]
15162 !! html/parsoid
15163 <ul><li> a
15164 <ul><li> b
15165 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15166 <li> c
15167 <ul><li> d</li></ul></li></ul>
15168 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15169 !! end
15170
15171 ## We used to, but no longer wt2wt this test since the default serializer
15172 ## will normalize all categories to serialize on their own line.
15173 ## This wikitext usage is going to be fairly uncommon in production and
15174 ## selser will take care of preserving formatting in those scenarios.
15175 !! test
15176 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15177 !! options
15178 parsoid=wt2html
15179 !! wikitext
15180 * a [[Category:Foo]]
15181 !! html/parsoid
15182 <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>
15183 !! end
15184
15185 # This test also demonstrates because of newline+category tunneling
15186 # through the list hander, template wrapping doesn't expand to the
15187 # containing list when the list item swallows the category.
15188 !! test
15189 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15190 !! wikitext
15191 * {{echo|a
15192 [[Category:Foo]]}}
15193 !! html/parsoid
15194 <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
15195 </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>
15196 !! end
15197
15198 !! test
15199 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15200 !! wikitext
15201 * a
15202
15203 {{echo|[[Category:Foo]]
15204 [[Category:Bar]]}}
15205 [[Category:Baz]]
15206 !! html/parsoid
15207 <ul><li> a</li></ul>
15208
15209 <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">
15210 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15211 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15212 !! end
15213
15214 !! test
15215 Category links with multiple namespaces
15216 !! wikitext
15217 [[Category:Project:Foo]]
15218 !! html/parsoid
15219 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15220 !! end
15221
15222 !! test
15223 Parsoid: Serialize link to category page with colon escape
15224 !! options
15225 parsoid
15226 !! wikitext
15227
15228 [[:Category:Foo]]
15229 [[:Category:Foo|Bar]]
15230 !! html
15231 <p>
15232 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15233 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15234 </p>
15235 !! end
15236
15237 # We used to, but no longer wt2wt this test since the default serializer
15238 # will normalize all categories to serialize on their own line.
15239 # This wikitext usage is going to be fairly uncommon in production and
15240 # selser will take care of preventing whitespace insertion if this
15241 # occurs in an article.
15242 #
15243 # html2html disabled for the same reason (whitespace insertion between
15244 # x and y).
15245 #
15246 # html2wt disabled because it localizes the "Category" namespace.
15247 !! test
15248 Link prefix/suffixes aren't applied to category links
15249 !! options
15250 parsoid=wt2html
15251 language=is
15252 !! wikitext
15253 x[[Category:Foo]]y
15254 !! html/php
15255 <p>xy
15256 </p>
15257 !! html/parsoid
15258 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15259 !! end
15260
15261 !! test
15262 Parsoid: Serialize link to file page with colon escape
15263 !! options
15264 parsoid
15265 !! wikitext
15266
15267 [[:File:Foo.png]]
15268 [[:File:Foo.png|Bar]]
15269 !! html
15270 <p>
15271 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15272 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15273 </p>
15274 !! end
15275
15276 !! test
15277 Parsoid: Serialize a genuine category link without colon escape
15278 !! options
15279 parsoid
15280 !! wikitext
15281 [[Category:Foo]]
15282 [[Category:Foo|Bar]]
15283 !! html
15284 <link rel="mw:PageProp/Category" href="./Category:Foo">
15285 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15286 !! end
15287
15288 !! test
15289 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15290 !! options
15291 parsoid=html2wt
15292 !! html/parsoid
15293 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15294 !! wikitext
15295 [[Category:Toxine bactérienne]]
15296 !! end
15297
15298 !! test
15299 Parsoid: Defaultsort
15300 !! wikitext
15301 {{DEFAULTSORT:Foo}}
15302 !! html/parsoid
15303 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15304 !! end
15305
15306 !! test
15307 Parsoid: Defaultsort (template-generated)
15308 !! wikitext
15309 {{{{echo|DEFAULTSORT}}:Foo}}
15310 !! html/parsoid
15311 <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}}]}'/>
15312 !! end
15313
15314 ###
15315 ### Inter-language links
15316 ###
15317 !! test
15318 Interlanguage links
15319 !! options
15320 ill
15321 !! wikitext
15322 [[es:Alimento]]
15323 [[fr:Nourriture]]
15324 [[zh:食品]]
15325 !! html/php
15326 es:Alimento fr:Nourriture zh:食品
15327 !! html/parsoid
15328 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15329 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15330 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15331 !! end
15332
15333 !! test
15334 Duplicate interlanguage links (bug 24502)
15335 !! options
15336 ill
15337 !! wikitext
15338 [[es:1]]
15339 [[es:2]]
15340 [[fr:1]]
15341 [[fr:2]]
15342 !! html/php
15343 es:1 fr:1
15344 !! html/parsoid
15345 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15346 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15347 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15348 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15349 !! end
15350
15351 ###
15352 ### Sections
15353 ###
15354 !! test
15355 Basic section headings
15356 !! wikitext
15357 == Headline 1 ==
15358 Some text
15359
15360 ==Headline 2==
15361 More
15362 ===Smaller headline===
15363 Blah blah
15364 !! html
15365 <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>
15366 <p>Some text
15367 </p>
15368 <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>
15369 <p>More
15370 </p>
15371 <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>
15372 <p>Blah blah
15373 </p>
15374 !! end
15375
15376 !! test
15377 Section headings with TOC
15378 !! wikitext
15379 == Headline 1 ==
15380 === Subheadline 1 ===
15381 ===== Skipping a level =====
15382 ====== Skipping a level ======
15383
15384 == Headline 2 ==
15385 Some text
15386 ===Another headline===
15387 !! html
15388 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15389 <ul>
15390 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15391 <ul>
15392 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15393 <ul>
15394 <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>
15395 <ul>
15396 <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>
15397 </ul>
15398 </li>
15399 </ul>
15400 </li>
15401 </ul>
15402 </li>
15403 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15404 <ul>
15405 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15406 </ul>
15407 </li>
15408 </ul>
15409 </div>
15410
15411 <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>
15412 <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>
15413 <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>
15414 <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>
15415 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15416 <p>Some text
15417 </p>
15418 <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>
15419
15420 !! end
15421
15422 !! test
15423 TOC anchors don't collide
15424 !! wikitext
15425 __FORCETOC__
15426 == Headline 2 ==
15427 == Headline ==
15428 == Headline 2 ==
15429 == Headline ==
15430 !! html/php
15431 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15432 <ul>
15433 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15434 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15435 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15436 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15437 </ul>
15438 </div>
15439
15440 <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>
15441 <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>
15442 <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>
15443 <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>
15444
15445 !! end
15446
15447 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15448 !! test
15449 Handling of sections up to level 6 and beyond
15450 !! wikitext
15451 = Level 1 Heading=
15452 == Level 2 Heading==
15453 === Level 3 Heading===
15454 ==== Level 4 Heading====
15455 ===== Level 5 Heading=====
15456 ====== Level 6 Heading======
15457 ======= Level 7 Heading=======
15458 ======== Level 8 Heading========
15459 ========= Level 9 Heading=========
15460 ========== Level 10 Heading==========
15461 !! html
15462 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15463 <ul>
15464 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15465 <ul>
15466 <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>
15467 <ul>
15468 <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>
15469 <ul>
15470 <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>
15471 <ul>
15472 <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>
15473 <ul>
15474 <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>
15475 <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>
15476 <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>
15477 <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>
15478 <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>
15479 </ul>
15480 </li>
15481 </ul>
15482 </li>
15483 </ul>
15484 </li>
15485 </ul>
15486 </li>
15487 </ul>
15488 </li>
15489 </ul>
15490 </div>
15491
15492 <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>
15493 <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>
15494 <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>
15495 <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>
15496 <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>
15497 <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>
15498 <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>
15499 <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>
15500 <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>
15501 <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>
15502
15503 !! end
15504
15505 !! test
15506 TOC regression (T11764)
15507 !! wikitext
15508 == title 1 ==
15509 === title 1.1 ===
15510 ==== title 1.1.1 ====
15511 === title 1.2 ===
15512 == title 2 ==
15513 === title 2.1 ===
15514 !! html
15515 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15516 <ul>
15517 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15518 <ul>
15519 <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>
15520 <ul>
15521 <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>
15522 </ul>
15523 </li>
15524 <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>
15525 </ul>
15526 </li>
15527 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15528 <ul>
15529 <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>
15530 </ul>
15531 </li>
15532 </ul>
15533 </div>
15534
15535 <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>
15536 <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>
15537 <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>
15538 <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>
15539 <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>
15540 <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>
15541
15542 !! end
15543
15544 !! test
15545 TOC for heading containing <span id="..."></span> (T96153)
15546 !! wikitext
15547 __FORCETOC__
15548 ==<span id="old-anchor"></span>New title==
15549 !! html/php
15550 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15551 <ul>
15552 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15553 </ul>
15554 </div>
15555
15556 <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>
15557
15558 !! end
15559
15560 !! test
15561 TOC with wgMaxTocLevel=3 (bug 6204)
15562 !! options
15563 wgMaxTocLevel=3
15564 !! wikitext
15565 == title 1 ==
15566 === title 1.1 ===
15567 ==== title 1.1.1 ====
15568 === title 1.2 ===
15569 == title 2 ==
15570 === title 2.1 ===
15571 !! html
15572 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15573 <ul>
15574 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15575 <ul>
15576 <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>
15577 <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>
15578 </ul>
15579 </li>
15580 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15581 <ul>
15582 <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>
15583 </ul>
15584 </li>
15585 </ul>
15586 </div>
15587
15588 <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>
15589 <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>
15590 <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>
15591 <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>
15592 <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>
15593 <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>
15594
15595 !! end
15596
15597 !! test
15598 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15599 !! options
15600 wgMaxTocLevel=3
15601 !! wikitext
15602 ==Section 1==
15603 ===Section 1.1===
15604 ====Section 1.1.1====
15605 ====Section 1.1.1.1====
15606 ==Section 2==
15607 !! html
15608 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15609 <ul>
15610 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15611 <ul>
15612 <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>
15613 </ul>
15614 </li>
15615 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15616 </ul>
15617 </div>
15618
15619 <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>
15620 <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>
15621 <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>
15622 <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>
15623 <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>
15624
15625 !! end
15626
15627
15628 !! test
15629 Resolving duplicate section names
15630 !! wikitext
15631 == Foo bar ==
15632 == Foo bar ==
15633 !! html
15634 <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>
15635 <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>
15636
15637 !! end
15638
15639 !! test
15640 Resolving duplicate section names with differing case (bug 10721)
15641 !! wikitext
15642 == Foo bar ==
15643 == Foo Bar ==
15644 !! html
15645 <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>
15646 <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>
15647
15648 !! end
15649
15650 !! article
15651 Template:sections
15652 !! text
15653 ===Section 1===
15654 ==Section 2==
15655 !! endarticle
15656
15657 !! test
15658 Template with sections, __NOTOC__
15659 !! wikitext
15660 __NOTOC__
15661 ==Section 0==
15662 {{sections}}
15663 ==Section 4==
15664 !! html
15665 <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>
15666 <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>
15667 <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>
15668 <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>
15669
15670 !! end
15671
15672 !! test
15673 __NOEDITSECTION__ keyword
15674 !! wikitext
15675 __NOEDITSECTION__
15676 ==Section 1==
15677 ==Section 2==
15678 !! html
15679 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15680 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15681
15682 !! end
15683
15684 !! test
15685 Link inside a section heading
15686 !! wikitext
15687 ==Section with a [[Main Page|link]] in it==
15688 !! html
15689 <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>
15690
15691 !! end
15692
15693 !! test
15694 TOC regression (T14077)
15695 !! wikitext
15696 __TOC__
15697 == title 1 ==
15698 === title 1.1 ===
15699 == title 2 ==
15700 !! html
15701 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15702 <ul>
15703 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15704 <ul>
15705 <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>
15706 </ul>
15707 </li>
15708 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15709 </ul>
15710 </div>
15711
15712 <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>
15713 <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>
15714 <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>
15715
15716 !! end
15717
15718 !! test
15719 BUG 1219 URL next to image (good)
15720 !! wikitext
15721 http://example.com [[File:Foobar.jpg]]
15722 !! html/php
15723 <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>
15724 </p>
15725 !! html/parsoid
15726 <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>
15727 !!end
15728
15729 !! test
15730 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15731 !! wikitext
15732 ===
15733 The line above must have a trailing space!
15734 === <!--
15735 --> <!-- -->
15736 But just in case it doesn't...
15737 !! html
15738 <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>
15739 <p>The line above must have a trailing space!
15740 </p>
15741 <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>
15742 <p>But just in case it doesn't...
15743 </p>
15744 !! end
15745
15746 !! test
15747 Header with special characters (bug 25462)
15748 !! wikitext
15749 The tooltips shall not show entities to the user (ie. be double escaped)
15750
15751 == text > text ==
15752 section 1
15753
15754 == text < text ==
15755 section 2
15756
15757 == text & text ==
15758 section 3
15759
15760 == text ' text ==
15761 section 4
15762
15763 == text " text ==
15764 section 5
15765 !! html
15766 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15767 </p>
15768 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15769 <ul>
15770 <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>
15771 <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>
15772 <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>
15773 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15774 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15775 </ul>
15776 </div>
15777
15778 <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>
15779 <p>section 1
15780 </p>
15781 <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>
15782 <p>section 2
15783 </p>
15784 <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>
15785 <p>section 3
15786 </p>
15787 <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>
15788 <p>section 4
15789 </p>
15790 <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>
15791 <p>section 5
15792 </p>
15793 !! end
15794
15795 !! test
15796 Header with space, plus and underscore as entity
15797 !! wikitext
15798 Id should not contain + for spaces
15799
15800 == Space between Text ==
15801 section 1
15802
15803 == Space-Entity&#32;between&#32;Text ==
15804 section 2
15805
15806 == Plus+between+Text ==
15807 section 3
15808
15809 == Plus-Entity&#43;between&#43;Text ==
15810 section 4
15811
15812 == Underscore_between_Text ==
15813 section 5
15814
15815 == Underscore-Entity&#95;between&#95;Text ==
15816 section 6
15817
15818 [[#Space between Text]]
15819 [[#Space-Entity&#32;between&#32;Text]]
15820 [[#Plus+between+Text]]
15821 [[#Plus-Entity&#43;between&#43;Text]]
15822 [[#Underscore_between_Text]]
15823 [[#Underscore-Entity&#95;between&#95;Text]]
15824 !! html
15825 <p>Id should not contain + for spaces
15826 </p>
15827 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15828 <ul>
15829 <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>
15830 <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>
15831 <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>
15832 <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>
15833 <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>
15834 <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>
15835 </ul>
15836 </div>
15837
15838 <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>
15839 <p>section 1
15840 </p>
15841 <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>
15842 <p>section 2
15843 </p>
15844 <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>
15845 <p>section 3
15846 </p>
15847 <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>
15848 <p>section 4
15849 </p>
15850 <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>
15851 <p>section 5
15852 </p>
15853 <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>
15854 <p>section 6
15855 </p><p><a href="#Space_between_Text">#Space between Text</a>
15856 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15857 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15858 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15859 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15860 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15861 </p>
15862 !! end
15863
15864 !! test
15865 Headers with excess '=' characters
15866 (Are similar tests necessary beyond the 1st level?)
15867 !! wikitext
15868 =foo==
15869 ==foo=
15870 =''italic'' heading==
15871 ==''italic'' heading=
15872 !! html
15873 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15874 <ul>
15875 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15876 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15877 <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>
15878 <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>
15879 </ul>
15880 </div>
15881
15882 <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>
15883 <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>
15884 <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>
15885 <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>
15886
15887 !! end
15888
15889 !! test
15890 HTML headers vs TOC (bug 23393)
15891 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15892 !! wikitext
15893 <h1>Header 1</h1>
15894 == Header 1.1 ==
15895 == Header 1.2 ==
15896
15897 <h1>Header 2
15898 </h1>
15899 == Header 2.1 ==
15900 == Header 2.2 ==
15901 __NOEDITSECTION__
15902 !! html
15903 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15904 <ul>
15905 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15906 <ul>
15907 <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>
15908 <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>
15909 </ul>
15910 </li>
15911 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15912 <ul>
15913 <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>
15914 <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>
15915 </ul>
15916 </li>
15917 </ul>
15918 </div>
15919
15920 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15921 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15922 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15923 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15924 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15925 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15926
15927 !! end
15928
15929 !! test
15930 Single-line or multiline-comments can follow headings
15931 !! options
15932 parsoid=wt2html,wt2wt
15933 !! wikitext
15934 ==foo==<!---->
15935 ==bar==<!--c1-->
15936 ==baz==<!--
15937 c2
15938 c3-->
15939 !! html
15940 <h2><span class="mw-headline" id="foo">foo</span></h2>
15941 <h2><span class="mw-headline" id="bar">bar</span></h2>
15942 <h2><span class="mw-headline" id="baz">baz</span></h2>
15943
15944 !! end
15945
15946 !! test
15947 BUG 1219 URL next to image (broken)
15948 !! wikitext
15949 http://example.com[[File:Foobar.jpg]]
15950 !! html/php
15951 <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>
15952 </p>
15953 !! html/parsoid
15954 <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>
15955 !!end
15956
15957 !! test
15958 Bug 1186 news: in the middle of text
15959 !! wikitext
15960 http://en.wikinews.org/wiki/Wikinews:Workplace
15961 !! html
15962 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15963 </p>
15964 !!end
15965
15966
15967 !! test
15968 Namespaced link must have a title
15969 !! wikitext
15970 [[Project:]]
15971 !! html
15972 <p>[[Project:]]
15973 </p>
15974 !!end
15975
15976 !! test
15977 Namespaced link must have a title (bad fragment version)
15978 !! wikitext
15979 [[Project:#fragment]]
15980 !! html
15981 <p>[[Project:#fragment]]
15982 </p>
15983 !!end
15984
15985
15986 ###
15987 ### HTML tags and HTML attributes
15988 ###
15989
15990 !! test
15991 div with no attributes
15992 !! wikitext
15993 <div>HTML rocks</div>
15994 !! html
15995 <div>HTML rocks</div>
15996
15997 !! end
15998
15999 !! test
16000 div with double-quoted attribute
16001 !! wikitext
16002 <div id="rock">HTML rocks</div>
16003 !! html
16004 <div id="rock">HTML rocks</div>
16005
16006 !! end
16007
16008 !! test
16009 div with single-quoted attribute
16010 !! wikitext
16011 <div id='rock'>HTML rocks</div>
16012 !! html
16013 <div id="rock">HTML rocks</div>
16014
16015 !! end
16016
16017 !! test
16018 div with unquoted attribute
16019 !! wikitext
16020 <div id=rock>HTML rocks</div>
16021 !! html
16022 <div id="rock">HTML rocks</div>
16023
16024 !! end
16025
16026 !! test
16027 div with illegal double attributes
16028 !! wikitext
16029 <div id="a" id="b">HTML rocks</div>
16030 !! html
16031 <div id="b">HTML rocks</div>
16032
16033 !!end
16034
16035 !! test
16036 div with empty attribute value, space before equals
16037 !! options
16038 parsoid=wt2html,html2html
16039 !! wikitext
16040 <div class =>HTML rocks</div>
16041 !! html/php
16042 <div class="">HTML rocks</div>
16043
16044 !! html/parsoid
16045 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16046 !! end
16047
16048 !! test
16049 div with multiple empty attribute values
16050 !! options
16051 parsoid=wt2html,html2html
16052 !! wikitext
16053 <div id= title=>HTML rocks</div>
16054 !! html/php
16055 <div id="title.3D">HTML rocks</div>
16056
16057 !! html/parsoid
16058 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16059 !! end
16060
16061 !! test
16062 table with multiple empty attribute values
16063 !! options
16064 parsoid=wt2html,html2html
16065 !! wikitext
16066 {| title= id=
16067 | hi
16068 |}
16069 !! html/php
16070 <table title="id=">
16071 <tr>
16072 <td> hi
16073 </td></tr></table>
16074
16075 !! html/parsoid
16076 <table title="id=">
16077 <tbody><tr><td> hi</td></tr>
16078 </tbody></table>
16079 !! end
16080
16081 !! test
16082 div with braces in attribute value
16083 !! wikitext
16084 <div title="{}">Foo</div>
16085 !! html/php
16086 <div title="&#123;&#125;">Foo</div>
16087
16088 !! html/parsoid
16089 <div title="{}">Foo</div>
16090 !! end
16091
16092 !! test
16093 div with empty attribute value, no space before equals
16094 !! options
16095 parsoid=wt2html,html2html
16096 !! wikitext
16097 <div class=>HTML rocks</div>
16098 !! html/php
16099 <div class="">HTML rocks</div>
16100
16101 !! html/parsoid
16102 <div class="">HTML rocks</div>
16103 !! end
16104
16105 !! test
16106 HTML multiple attributes correction
16107 !! wikitext
16108 <p class="error" class="awesome">Awesome!</p>
16109 !! html
16110 <p class="awesome">Awesome!</p>
16111
16112 !!end
16113
16114 !! test
16115 Table multiple attributes correction
16116 !! wikitext
16117 {|
16118 !+ class="error" class="awesome"| status
16119 |}
16120 !! html
16121 <table>
16122 <tr>
16123 <th class="awesome"> status
16124 </th></tr></table>
16125
16126 !!end
16127
16128 !! test
16129 DIV IN UPPERCASE
16130 !! wikitext
16131 <DIV ID="x">HTML ROCKS</DIV>
16132 !! html
16133 <div id="x">HTML ROCKS</div>
16134
16135 !!end
16136
16137 !! test
16138 Non-ASCII pseudo-tags are rendered as text
16139 !! wikitext
16140 <khyô>
16141 !! html
16142 <p>&lt;khyô&gt;
16143 </p>
16144 !! end
16145
16146 !! test
16147 Pseudo-tag with URL 'name' renders as url link
16148 !! wikitext
16149 <http://example.com/>
16150 !! html
16151 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16152 </p>
16153 !! end
16154
16155 !! test
16156 text with amp in the middle of nowhere
16157 !! wikitext
16158 Remember AT&T?
16159 !! html
16160 <p>Remember AT&amp;T?
16161 </p>
16162 !! end
16163
16164 !! test
16165 text with character entity: eacute
16166 !! wikitext
16167 I always thought &eacute; was a cute letter.
16168 !! html
16169 <p>I always thought &#233; was a cute letter.
16170 </p>
16171 !! html+tidy
16172 <p>I always thought é was a cute letter.</p>
16173 !! end
16174
16175 !! test
16176 text with entity-escaped character entity-like string: eacute
16177 !! wikitext
16178 I always thought &amp;eacute; was a cute letter.
16179 !! html
16180 <p>I always thought &amp;eacute; was a cute letter.
16181 </p>
16182 !! end
16183
16184 !! test
16185 text with undefined character entity: xacute
16186 !! wikitext
16187 I always thought &xacute; was a cute letter.
16188 !! html
16189 <p>I always thought &amp;xacute; was a cute letter.
16190 </p>
16191 !! end
16192
16193 !! test
16194 HTML5 tags
16195 !! wikitext
16196 <data value="5">five</data>
16197 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16198 <mark>This highlighted text</mark>
16199 !! html
16200 <p><data value="5">five</data>
16201 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16202 <mark>This highlighted text</mark>
16203 </p>
16204 !! end
16205
16206 !! test
16207 HTML tag with leading space is parsed as text
16208 !! wikitext
16209 < div>foo< /div>
16210 !! html
16211 <p>&lt; div&gt;foo&lt; /div&gt;
16212 </p>
16213 !! end
16214
16215 ###
16216 ### Nesting tests (see bug 41545, 50604, 51081)
16217 ###
16218
16219 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16220 # Note that html2wt is considerably more difficult if we use <b> in
16221 # the test case, instead of <big>
16222 !! test
16223 Ensure that HTML adoption agency algorithm is properly implemented.
16224 !! wikitext
16225 <big>X<big>Y</big>Z</big>
16226 !! html
16227 <p><big>X<big>Y</big>Z</big>
16228 </p>
16229 !! end
16230
16231 # This was bug 41545 in the PHP parser.
16232 # Note that tidy doesn't handle this correctly.
16233 !! test
16234 Nesting of <kbd>
16235 !! wikitext
16236 <kbd>X<kbd>Y</kbd>Z</kbd>
16237 !! html
16238 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16239 </p>
16240 !! end
16241
16242 # The following cases were bug 51081 in the PHP parser.
16243 # Note that there are some other nestable tags (b, i, etc) which are
16244 # not covered; see bug 51081 for discussion.
16245
16246 # Note that tidy doesn't handle this correctly.
16247 !! test
16248 Nesting of <em>
16249 !! wikitext
16250 <em>X<em>Y</em>Z</em>
16251 !! html
16252 <p><em>X<em>Y</em>Z</em>
16253 </p>
16254 !! end
16255
16256 # Note that tidy doesn't handle this correctly.
16257 !! test
16258 Nesting of <strong>
16259 !! wikitext
16260 <strong>X<strong>Y</strong>Z</strong>
16261 !! html
16262 <p><strong>X<strong>Y</strong>Z</strong>
16263 </p>
16264 !! end
16265
16266 !! test
16267 Nesting of <q>
16268 !! wikitext
16269 <q>X<q>Y</q>Z</q>
16270 !! html+tidy
16271 <p><q>X<q>Y</q>Z</q></p>
16272 !! end
16273
16274 # Note that tidy doesn't handle this correctly.
16275 !! test
16276 Nesting of <ruby>
16277 !! wikitext
16278 <ruby>X<ruby>Y</ruby>Z</ruby>
16279 !! html
16280 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16281 </p>
16282 !! end
16283
16284 # Note that tidy doesn't handle this correctly.
16285 !! test
16286 Nesting of <bdo>
16287 !! wikitext
16288 <bdo>X<bdo>Y</bdo>Z</bdo>
16289 !! html
16290 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16291 </p>
16292 !! end
16293
16294
16295 ###
16296 ### Media links
16297 ###
16298
16299 !! test
16300 Media link
16301 !! wikitext
16302 [[Media:Foobar.jpg]]
16303 !! html
16304 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16305 </p>
16306 !! end
16307
16308 !! test
16309 Media link with text
16310 !! wikitext
16311 [[Media:Foobar.jpg|A neat file to look at]]
16312 !! html
16313 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16314 </p>
16315 !! end
16316
16317 # FIXME: this is still bad HTML tag nesting
16318 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16319 !! test
16320 Media link with nasty text
16321 !! wikitext
16322 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16323 !! html
16324 <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>
16325
16326 !! html+tidy
16327 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16328 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16329 !! end
16330
16331 !! test
16332 Media link to nonexistent file (bug 1702)
16333 !! wikitext
16334 [[Media:No such.jpg]]
16335 !! html
16336 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16337 </p>
16338 !! end
16339
16340 !! test
16341 Image link to nonexistent file (bug 1850 - good)
16342 !! wikitext
16343 [[File:No_such.jpg]]
16344 !! html/php
16345 <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>
16346 </p>
16347 !! html/parsoid
16348 <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>
16349 !! end
16350
16351 !! test
16352 :Image link to nonexistent file (bug 1850 - bad)
16353 !! wikitext
16354 [[:Image:No such.jpg]]
16355 !! html/php
16356 <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>
16357 </p>
16358 !! html/parsoid
16359 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16360 !! end
16361
16362
16363
16364 !! test
16365 Character reference normalization in link text (bug 1938)
16366 !! wikitext
16367 [[Main Page|this&that]]
16368 !! html
16369 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16370 </p>
16371 !!end
16372
16373 !! article
16374 אַ
16375 !! text
16376 Test for unicode normalization
16377
16378 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16379 !! endarticle
16380
16381 !! test
16382 (bug 19451) Links should refer to the normalized form.
16383 !! wikitext
16384 [[&#xFB2E;]]
16385 [[&#x5d0;&#x5b7;]]
16386 [[&#x5d0;ַ]]
16387 [[א&#x5b7;]]
16388 [[אַ]]
16389 !! html
16390 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16391 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16392 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16393 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16394 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16395 </p>
16396 !! end
16397
16398 !! test
16399 Empty attribute crash test (bug 2067)
16400 !! wikitext
16401 <font color="">foo</font>
16402 !! html
16403 <p><font color="">foo</font>
16404 </p>
16405 !! end
16406
16407 !! test
16408 Empty attribute crash test single-quotes (bug 2067)
16409 !! wikitext
16410 <font color=''>foo</font>
16411 !! html
16412 <p><font color="">foo</font>
16413 </p>
16414 !! end
16415
16416 !! test
16417 Attribute test: equals, then nothing
16418 !! options
16419 parsoid=wt2html,html2html
16420 !! wikitext
16421 <font color=>foo</font>
16422 !! html/php
16423 <p><font color="">foo</font>
16424 </p>
16425 !! html/parsoid
16426 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16427 !! end
16428
16429 !! test
16430 Attribute test: unquoted value
16431 !! options
16432 parsoid=wt2html,html2html
16433 !! wikitext
16434 <font color=x>foo</font>
16435 !! html/php
16436 <p><font color="x">foo</font>
16437 </p>
16438 !! html/parsoid
16439 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16440 !! end
16441
16442 !! test
16443 Attribute test: unquoted but illegal value (hash)
16444 !! wikitext
16445 <font color=#x>foo</font>
16446 !! html
16447 <p><font color="#x">foo</font>
16448 </p>
16449 !! end
16450
16451 # Parsoid does not serialize to empty attribute syntax,
16452 # so wt2wt and html2wt cases are skipped
16453 !! test
16454 Attribute test: no value (T54330)
16455 !! options
16456 parsoid=wt2html,html2html
16457 !! wikitext
16458 <font color>foo</font>
16459 !! html/php
16460 <p><font color="">foo</font>
16461 </p>
16462 !! html/parsoid
16463 <p><font color="">foo</font></p>
16464 !! end
16465
16466 !! test
16467 Bug 2095: link with three closing brackets
16468 !! wikitext
16469 [[Main Page]]]
16470 !! html/php
16471 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16472 </p>
16473 !! html/parsoid
16474 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16475 !! end
16476
16477 !! test
16478 Bug 2095: link with pipe and three closing brackets
16479 !! wikitext
16480 [[Main Page|link]]]
16481 !! html/php
16482 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16483 </p>
16484 !! html/parsoid
16485 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16486 !! end
16487
16488 !! test
16489 Bug 2095: link with pipe and three closing brackets, version 2
16490 !! wikitext
16491 [[Main Page|[http://example.com/]]]
16492 !! html/php
16493 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16494 </p>
16495 !! html/parsoid
16496 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16497 !! end
16498
16499
16500 ###
16501 ### Safety
16502 ###
16503
16504 !! article
16505 Template:Dangerous attribute
16506 !! text
16507 " onmouseover="alert(document.cookie)
16508 !! endarticle
16509
16510 !! article
16511 Template:Dangerous style attribute
16512 !! text
16513 border-size: expression(alert(document.cookie))
16514 !! endarticle
16515
16516 !! article
16517 Template:Div style
16518 !! text
16519 <div style="float: right; {{{1}}}">Magic div</div>
16520 !! endarticle
16521
16522 !! test
16523 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16524 !! wikitext
16525 <div title="{{test}}"></div>
16526 !! html
16527 <div title="This is a test template"></div>
16528
16529 !! end
16530
16531 # Parsoid has enough context to handle this case
16532 !! test
16533 Bug 2304: HTML attribute safety (dangerous template; 2309)
16534 !! wikitext
16535 <div title="{{dangerous attribute}}"></div>
16536 !! html/php
16537 <div title=""></div>
16538
16539 !! html/parsoid
16540 <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>
16541 !! end
16542
16543 !! test
16544 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16545 !! wikitext
16546 <div style="{{dangerous style attribute}}"></div>
16547 !! html
16548 <div style="/* insecure input */"></div>
16549
16550 !! end
16551
16552 !! test
16553 Bug 2304: HTML attribute safety (safe parameter; 2309)
16554 !! wikitext
16555 {{div style|width: 200px}}
16556 !! html
16557 <div style="float: right; width: 200px">Magic div</div>
16558
16559 !! end
16560
16561 !! test
16562 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16563 !! wikitext
16564 {{div style|width: expression(alert(document.cookie))}}
16565 !! html
16566 <div style="/* insecure input */">Magic div</div>
16567
16568 !! end
16569
16570 !! test
16571 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16572 !! wikitext
16573 {{div style|"><script>alert(document.cookie)</script>}}
16574 !! html
16575 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16576
16577 !! end
16578
16579 !! test
16580 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16581 !! wikitext
16582 {{div style|" ><script>alert(document.cookie)</script>}}
16583 !! html
16584 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16585
16586 !! end
16587
16588 !! test
16589 Bug 2304: HTML attribute safety (link)
16590 !! wikitext
16591 <div title="[[Main Page]]"></div>
16592 !! html
16593 <div title="&#91;&#91;Main Page]]"></div>
16594
16595 !! end
16596
16597 !! test
16598 Bug 2304: HTML attribute safety (italics)
16599 !! wikitext
16600 <div title="''foobar''"></div>
16601 !! html
16602 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16603
16604 !! end
16605
16606 !! test
16607 Bug 2304: HTML attribute safety (bold)
16608 !! wikitext
16609 <div title="'''foobar'''"></div>
16610 !! html
16611 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16612
16613 !! end
16614
16615
16616 !! test
16617 Bug 2304: HTML attribute safety (ISBN)
16618 !! wikitext
16619 <div title="ISBN 1234567890"></div>
16620 !! html
16621 <div title="&#73;SBN 1234567890"></div>
16622
16623 !! end
16624
16625 !! test
16626 Bug 2304: HTML attribute safety (RFC)
16627 !! wikitext
16628 <div title="RFC 1234"></div>
16629 !! html
16630 <div title="&#82;FC 1234"></div>
16631
16632 !! end
16633
16634 !! test
16635 Bug 2304: HTML attribute safety (PMID)
16636 !! wikitext
16637 <div title="PMID 1234567890"></div>
16638 !! html
16639 <div title="&#80;MID 1234567890"></div>
16640
16641 !! end
16642
16643 !! test
16644 Bug 2304: HTML attribute safety (web link)
16645 !! wikitext
16646 <div title="http://example.com/"></div>
16647 !! html
16648 <div title="http&#58;//example.com/"></div>
16649
16650 !! end
16651
16652 !! test
16653 Bug 2304: HTML attribute safety (named web link)
16654 !! wikitext
16655 <div title="[http://example.com/ link]"></div>
16656 !! html
16657 <div title="&#91;http&#58;//example.com/ link]"></div>
16658
16659 !! end
16660
16661 !! test
16662 Bug 3244: HTML attribute safety (extension; safe)
16663 !! wikitext
16664 <div style="<nowiki>background:blue</nowiki>"></div>
16665 !! html
16666 <div style="background:blue"></div>
16667
16668 !! end
16669
16670 !! test
16671 Bug 3244: HTML attribute safety (extension; unsafe)
16672 !! wikitext
16673 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16674 !! html
16675 <div style="/* insecure input */"></div>
16676
16677 !! end
16678
16679 # More MSIE fun discovered by Tom Gilder
16680
16681 !! test
16682 MSIE CSS safety test: spurious slash
16683 !! wikitext
16684 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16685 !! html
16686 <div style="/* insecure input */">evil</div>
16687
16688 !! end
16689
16690 !! test
16691 MSIE CSS safety test: hex code
16692 !! wikitext
16693 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16694 !! html
16695 <div style="/* insecure input */">evil</div>
16696
16697 !! end
16698
16699 !! test
16700 MSIE CSS safety test: comment in url
16701 !! wikitext
16702 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16703 !! html
16704 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16705
16706 !! end
16707
16708 !! test
16709 MSIE CSS safety test: comment in expression
16710 !! wikitext
16711 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16712 !! html
16713 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16714
16715 !! end
16716
16717 !! test
16718 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16719 !! wikitext
16720 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16721 !! html
16722 <p style="/* invalid control char */">A</p>
16723
16724 !! end
16725
16726 !! test
16727 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16728 !! wikitext
16729 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16730 <div style="top:EXPRESSION(alert())">B</div>
16731 !! html
16732 <p style="/* insecure input */">A</p>
16733 <div style="/* insecure input */">B</div>
16734
16735 !! end
16736
16737 !! test
16738 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16739 !! wikitext
16740 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16741 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16742 !! html
16743 <div style="/* insecure input */">A</div>
16744 <p style="/* insecure input */">B</p>
16745
16746 !! end
16747
16748 !! test
16749 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16750 !! wikitext
16751 <div style="background-image:url⁽javascript:alert())">A</div>
16752 <div style="background-image:url₍javascript:alert())">B</div>
16753 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16754 !! html
16755 <div style="/* insecure input */">A</div>
16756 <div style="/* insecure input */">B</div>
16757 <p style="/* insecure input */">C</p>
16758
16759 !! end
16760
16761 # FIXME: Parsoid fails to sanitize this! See T58846.
16762 !! test
16763 Opera -o-link CSS
16764 !! wikitext
16765 <div
16766 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;"
16767 style="-o-link:attr(title);-o-link-source:current">X</div>
16768 !! html
16769 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16770
16771 !! end
16772
16773 !! test
16774 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16775 !! wikitext
16776 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16777 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16778 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16779 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16780 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16781 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16782 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16783 !! html
16784 <p style="/* insecure input */">A</p>
16785 <p style="/* insecure input */">B</p>
16786 <p style="/* insecure input */">C</p>
16787 <p style="/* insecure input */">D</p>
16788 <p style="/* insecure input */">E</p>
16789 <p style="/* insecure input */">F</p>
16790 <p style="/* insecure input */">G</p>
16791
16792 !! end
16793
16794 !! test
16795 Table attribute legitimate extension
16796 !! wikitext
16797 {|
16798 !+ style="<nowiki>color:blue</nowiki>"| status
16799 |}
16800 !! html
16801 <table>
16802 <tr>
16803 <th style="color:blue"> status
16804 </th></tr></table>
16805
16806 !!end
16807
16808 !! test
16809 Table attribute safety
16810 !! wikitext
16811 {|
16812 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16813 |}
16814 !! html
16815 <table>
16816 <tr>
16817 <th style="/* insecure input */"> status
16818 </th></tr></table>
16819
16820 !! end
16821
16822 !! test
16823 CSS line continuation 1
16824 !! wikitext
16825 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16826 !! html
16827 <div style="/* insecure input */"></div>
16828
16829 !! end
16830
16831 !! test
16832 CSS line continuation 2
16833 !! wikitext
16834 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16835 !! html
16836 <div style="/* invalid control char */"></div>
16837
16838 !! end
16839
16840 !! article
16841 Template:Identity
16842 !! text
16843 {{{1}}}
16844 !! endarticle
16845
16846 !! test
16847 Expansion of multi-line templates in attribute values (bug 6255)
16848 !! wikitext
16849 <div style="background: {{identity|#00FF00}}">-</div>
16850 !! html
16851 <div style="background: #00FF00">-</div>
16852
16853 !! end
16854
16855
16856 !! test
16857 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16858 !! wikitext
16859 <div style="background:
16860 #00FF00">-</div>
16861 !! html/php
16862 <div style="background: #00FF00">-</div>
16863
16864 !! html/parsoid
16865 <div style="background:
16866 #00FF00">-</div>
16867 !! end
16868
16869 !! test
16870 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16871 !! wikitext
16872 <div style="background: &#10;#00FF00">-</div>
16873 !! html
16874 <div style="background: &#10;#00FF00">-</div>
16875
16876 !! end
16877
16878 !! test
16879 Tags which are hidden from Tidy cannot pass through the Sanitizer
16880 !! wikitext
16881 <mw:toc><script>alert();</script></mw:toc>
16882 !! html+tidy
16883 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16884 !! end
16885
16886 ###
16887 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16888 ###
16889 !! test
16890 Parser hook: empty input
16891 !! wikitext
16892 <tag></tag>
16893 !! html/php
16894 <pre>
16895 ''
16896 array (
16897 )
16898 </pre>
16899
16900 !! html/parsoid
16901 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16902 !! end
16903
16904 ## Don't expect parsoid to rt this form.
16905 !! test
16906 Parser hook: empty input using terminated empty elements
16907 !! options
16908 parsoid=wt2html,html2html
16909 !! wikitext
16910 <tag/>
16911 !! html/php
16912 <pre>
16913 NULL
16914 array (
16915 )
16916 </pre>
16917
16918 !! html/parsoid
16919 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16920 !! end
16921
16922 !! test
16923 Parser hook: empty input using terminated empty elements (space before)
16924 !! wikitext
16925 <tag />
16926 !! html/php
16927 <pre>
16928 NULL
16929 array (
16930 )
16931 </pre>
16932
16933 !! html/parsoid
16934 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16935 !! end
16936
16937 !! test
16938 Parser hook: basic input
16939 !! wikitext
16940 <tag>input</tag>
16941 !! html/php
16942 <pre>
16943 'input'
16944 array (
16945 )
16946 </pre>
16947
16948 !! html/parsoid
16949 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16950 !! end
16951
16952 ## Don't expect parsoid to rt this form.
16953 !! test
16954 Parser hook: case insensitive
16955 !! options
16956 parsoid=wt2html,html2html
16957 !! wikitext
16958 <TAG>input</TAG>
16959 !! html/php
16960 <pre>
16961 'input'
16962 array (
16963 )
16964 </pre>
16965
16966 !! html/parsoid
16967 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16968 !! end
16969
16970 ## Don't expect parsoid to rt this form.
16971 !! test
16972 Parser hook: case insensitive, redux
16973 !! options
16974 parsoid=wt2html,html2html
16975 !! wikitext
16976 <TaG>input</TAg>
16977 !! html/php
16978 <pre>
16979 'input'
16980 array (
16981 )
16982 </pre>
16983
16984 !! html/parsoid
16985 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16986 !! end
16987
16988 !! test
16989 Parser hook: nested tags
16990 !! wikitext
16991 <tag><tag></tag></tag>
16992 !! html/php
16993 <pre>
16994 '<tag>'
16995 array (
16996 )
16997 </pre>&lt;/tag&gt;
16998
16999 !! html/parsoid
17000 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17001 !! end
17002
17003 !! test
17004 Parser hook: basic arguments
17005 !! wikitext
17006 <tag width="200" height="100" depth="50" square=""></tag>
17007 !! html/php
17008 <pre>
17009 ''
17010 array (
17011 'width' => '200',
17012 'height' => '100',
17013 'depth' => '50',
17014 'square' => '',
17015 )
17016 </pre>
17017
17018 !! html/parsoid
17019 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17020 !! end
17021
17022 ## Don't expect parsoid to rt this form.
17023 !! test
17024 Parser hook: basic arguments, variations
17025 !! options
17026 parsoid=wt2html,html2html
17027 !! wikitext
17028 <tag width=200 height = "100" depth = '50' square></tag>
17029 !! html/php
17030 <pre>
17031 ''
17032 array (
17033 'width' => '200',
17034 'height' => '100',
17035 'depth' => '50',
17036 'square' => '',
17037 )
17038 </pre>
17039
17040 !! html/parsoid
17041 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17042 !! end
17043
17044 !! test
17045 Parser hook: argument containing a forward slash (bug 5344)
17046 !! wikitext
17047 <tag filename="/tmp/bla"></tag>
17048 !! html/php
17049 <pre>
17050 ''
17051 array (
17052 'filename' => '/tmp/bla',
17053 )
17054 </pre>
17055
17056 !! html/parsoid
17057 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17058 !! end
17059
17060 ## Don't expect parsoid to rt this form.
17061 !! test
17062 Parser hook: empty input using terminated empty elements (bug 2374)
17063 !! options
17064 parsoid=wt2html,html2html
17065 !! wikitext
17066 <tag foo=bar/>text
17067 !! html/php
17068 <pre>
17069 NULL
17070 array (
17071 'foo' => 'bar',
17072 )
17073 </pre>text
17074
17075 !! html/parsoid
17076 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17077 !! end
17078
17079 ## </tag> should be output literally since there is no matching tag that begins it
17080 ## Don't expect parsoid to rt this form.
17081 !! test
17082 Parser hook: basic arguments using terminated empty elements (bug 2374)
17083 !! options
17084 parsoid=wt2html
17085 !! wikitext
17086 <tag width=200 height = "100" depth = '50' square/>
17087 other stuff
17088 </tag>
17089 !! html/php
17090 <pre>
17091 NULL
17092 array (
17093 'width' => '200',
17094 'height' => '100',
17095 'depth' => '50',
17096 'square' => '',
17097 )
17098 </pre>
17099 <p>other stuff
17100 &lt;/tag&gt;
17101 </p>
17102 !! html/parsoid
17103 <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
17104 &lt;/tag></p>
17105 !! end
17106
17107 ## Don't expect parsoid to rt this form.
17108 !! test
17109 Parser hook: Don't allow unclosed extension tags
17110 !! options
17111 parsoid=wt2html
17112 !! wikitext
17113 test <tag>123
17114
17115 this is a '''test'''
17116 !! html/php
17117 <p>test &lt;tag&gt;123
17118 </p><p>this is a <b>test</b>
17119 </p>
17120 !! html/parsoid
17121 <p>test &lt;tag>123</p>
17122
17123 <p>this is a <b>test</b></p>
17124 !! end
17125
17126 ###
17127 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17128 ###
17129
17130 !! test
17131 Parser hook: static parser hook not inside a comment
17132 !! wikitext
17133 <statictag>hello, world</statictag>
17134
17135 <statictag action="flush" />
17136 !! html/php
17137 <p><br />
17138 hello, world
17139 </p>
17140 !! html/parsoid
17141 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17142 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17143 !! end
17144
17145 !! test
17146 Parser hook: static parser hook inside a comment
17147 !! wikitext
17148 <!-- <statictag>hello, world</statictag> -->
17149 <statictag action="flush" />
17150 !! html/php
17151 <p><br />
17152 </p>
17153 !! html/parsoid
17154 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17155 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17156 !! end
17157
17158 # Nested template calls; this case was broken by Parser.php rev 1.506,
17159 # since reverted.
17160
17161 !! article
17162 Template:One-parameter
17163 !! text
17164 (My parameter is: {{{1}}})
17165 !! endarticle
17166
17167 !! article
17168 Template:Map-one-parameter
17169 !! text
17170 {{{{{1}}}|{{{2}}}}}
17171 !! endarticle
17172
17173 !! test
17174 Nested template calls
17175 !! wikitext
17176 {{Map-one-parameter|One-parameter|param}}
17177 !! html
17178 <p>(My parameter is: param)
17179 </p>
17180 !! end
17181
17182
17183 ###
17184 ### Sanitizer
17185 ###
17186
17187 # HTML+Tidy effectively strips out the empty tags completely
17188 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17189 # which Tidy would have done for the PHP parser had there been content inside it.
17190 !! test
17191 Sanitizer: Closing of open tags
17192 !! wikitext
17193 <s></s><table></table>
17194 !! html
17195 <s></s><table></table>
17196
17197 !! html/parsoid
17198 <p><s></s></p><table></table>
17199 !! end
17200
17201 !! test
17202 Sanitizer: Closing of open but not closed tags
17203 !! wikitext
17204 <s>foo
17205 !! html
17206 <p><s>foo</s>
17207 </p>
17208 !! end
17209
17210 !! test
17211 Sanitizer: Closing of closed but not open tags
17212 !! options
17213 parsoid=wt2html
17214 !! wikitext
17215 </s>
17216 !! html/php+tidy
17217 !! html/parsoid
17218 !! end
17219
17220 !! test
17221 Sanitizer: Closing of closed but not open table tags
17222 !! options
17223 parsoid=wt2html
17224 !! wikitext
17225 Table not started</td></tr></table>
17226 !! html/php+tidy
17227 <p>Table not started</p>
17228 !! html/parsoid
17229 <p>Table not started</p>
17230 !! end
17231
17232 !! test
17233 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17234 !! wikitext
17235 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17236 !! html/php
17237 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17238 </p>
17239 !! html/parsoid
17240 <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>
17241 !! end
17242
17243 # In HTML5, the restrictions are that id must contain at least one character,
17244 # and must not contain any space characters.
17245 !! test
17246 Sanitizer: Validating the contents of the id attribute (bug 4515)
17247 !! options
17248 disabled
17249 !! wikitext
17250 <br id="" /><br id="a space" />
17251 !! html
17252 Something ...
17253 !! end
17254
17255 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17256 !! test
17257 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17258 !! options
17259 disabled
17260 !! wikitext
17261 <br id="foo" /><br id="foo" />
17262 !! html
17263 Something need to be done. foo-2 ?
17264 !! end
17265
17266 !! test
17267 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17268 !! wikitext
17269 <div itemscope>
17270 <meta itemprop="hello" content="world">
17271 <meta http-equiv="refresh" content="5">
17272 <meta itemprop="hello" http-equiv="refresh" content="5">
17273 <link itemprop="hello" href="{{SERVER}}">
17274 <link rel="stylesheet" href="{{SERVER}}">
17275 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17276 </div>
17277 !! html
17278 <div itemscope="">
17279 <p> <meta itemprop="hello" content="world" />
17280 &lt;meta http-equiv="refresh" content="5"&gt;
17281 <meta itemprop="hello" content="5" />
17282 </p>
17283 <link itemprop="hello" href="http&#58;//example.org" />
17284 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17285 <link itemprop="hello" href="http&#58;//example.org" />
17286 </div>
17287
17288 !! end
17289
17290 !! test
17291 Language converter: output gets cut off unexpectedly (bug 5757)
17292 !! options
17293 language=zh
17294 !! wikitext
17295 this bit is safe: }-
17296
17297 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17298
17299 then we get cut off here: }-
17300
17301 all additional text is vanished
17302 !! html
17303 <p>this bit is safe: }-
17304 </p><p>but if we add a conversion instance: xxx
17305 </p><p>then we get cut off here: }-
17306 </p><p>all additional text is vanished
17307 </p>
17308 !! end
17309
17310 !! test
17311 Self closed html pairs (bug 5487)
17312 !! options
17313 !! wikitext
17314 <center><font id="bug" />Centered text</center>
17315 <div><font id="bug2" />In div text</div>
17316 !! html
17317 <center>&lt;font id="bug" /&gt;Centered text</center>
17318 <div>&lt;font id="bug2" /&gt;In div text</div>
17319
17320 !! end
17321
17322 #
17323 #
17324 #
17325
17326 !! test
17327 Punctuation: nbsp before exclamation
17328 !! wikitext
17329 C'est grave !
17330 !! html
17331 <p>C'est grave&#160;!
17332 </p>
17333 !! end
17334
17335 !! test
17336 Punctuation: CSS !important (bug 11874)
17337 !! wikitext
17338 <div style="width:50% !important">important</div>
17339 !! html
17340 <div style="width:50% !important">important</div>
17341
17342 !!end
17343
17344 !! test
17345 Punctuation: CSS ! important (bug 11874; with space after)
17346 !! wikitext
17347 <div style="width:50% ! important">important</div>
17348 !! html
17349 <div style="width:50% ! important">important</div>
17350
17351 !!end
17352
17353 !! test
17354 HTML bullet list, closed tags (bug 5497)
17355 !! wikitext
17356 <ul>
17357 <li>One</li>
17358 <li>Two</li>
17359 </ul>
17360 !! html/php
17361 <ul>
17362 <li>One</li>
17363 <li>Two</li>
17364 </ul>
17365
17366 !! html/parsoid
17367 <ul data-parsoid='{"stx":"html"}'>
17368 <li data-parsoid='{"stx":"html"}'>One</li>
17369 <li data-parsoid='{"stx":"html"}'>Two</li>
17370 </ul>
17371
17372 !! end
17373
17374 !! test
17375 HTML bullet list, unclosed tags (bug 5497)
17376 !! wikitext
17377 <ul>
17378 <li>One
17379 <li>Two
17380 </ul>
17381 !! html/php+tidy
17382 <ul>
17383 <li>One</li>
17384 <li>Two</li>
17385 </ul>
17386 !! html/parsoid
17387 <ul data-parsoid='{"stx":"html"}'>
17388 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17389 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17390 </ul>
17391
17392 !! end
17393
17394 !! test
17395 HTML ordered list, closed tags (bug 5497)
17396 !! wikitext
17397 <ol>
17398 <li>One</li>
17399 <li>Two</li>
17400 </ol>
17401 !! html/php
17402 <ol>
17403 <li>One</li>
17404 <li>Two</li>
17405 </ol>
17406
17407 !! html/parsoid
17408 <ol data-parsoid='{"stx":"html"}'>
17409 <li data-parsoid='{"stx":"html"}'>One</li>
17410 <li data-parsoid='{"stx":"html"}'>Two</li>
17411 </ol>
17412
17413 !! end
17414
17415 !! test
17416 HTML ordered list, unclosed tags (bug 5497)
17417 !! options
17418 !! wikitext
17419 <ol>
17420 <li>One
17421 <li>Two
17422 </ol>
17423 !! html/php+tidy
17424 <ol>
17425 <li>One</li>
17426 <li>Two</li>
17427 </ol>
17428 !! html/parsoid
17429 <ol data-parsoid='{"stx":"html"}'>
17430 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17431 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17432 </ol>
17433
17434 !! end
17435
17436 !! test
17437 HTML nested bullet list, closed tags (bug 5497)
17438 !! wikitext
17439 <ul>
17440 <li>One</li>
17441 <li>Two:
17442 <ul>
17443 <li>Sub-one</li>
17444 <li>Sub-two</li>
17445 </ul>
17446 </li>
17447 </ul>
17448 !! html/php
17449 <ul>
17450 <li>One</li>
17451 <li>Two:
17452 <ul>
17453 <li>Sub-one</li>
17454 <li>Sub-two</li>
17455 </ul>
17456 </li>
17457 </ul>
17458
17459 !! html/parsoid
17460 <ul data-parsoid='{"stx":"html"}'>
17461 <li data-parsoid='{"stx":"html"}'>One</li>
17462 <li data-parsoid='{"stx":"html"}'>Two:
17463 <ul data-parsoid='{"stx":"html"}'>
17464 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17465 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17466 </ul>
17467 </li>
17468 </ul>
17469 !! end
17470
17471 !! test
17472 HTML nested bullet list, open tags (bug 5497)
17473 !! wikitext
17474 <ul>
17475 <li>One
17476 <li>Two:
17477 <ul>
17478 <li>Sub-one
17479 <li>Sub-two
17480 </ul>
17481 </ul>
17482 !! html/php+tidy
17483 <ul>
17484 <li>One</li>
17485 <li>Two:
17486 <ul>
17487 <li>Sub-one</li>
17488 <li>Sub-two</li>
17489 </ul>
17490 </li>
17491 </ul>
17492 !! html/parsoid
17493 <ul>
17494 <li>One
17495 </li>
17496 <li>Two:
17497 <ul>
17498 <li>Sub-one
17499 </li>
17500 <li>Sub-two
17501 </li>
17502 </ul>
17503 </li>
17504 </ul>
17505
17506 !! end
17507
17508 !! test
17509 HTML nested ordered list, closed tags (bug 5497)
17510 !! wikitext
17511 <ol>
17512 <li>One</li>
17513 <li>Two:
17514 <ol>
17515 <li>Sub-one</li>
17516 <li>Sub-two</li>
17517 </ol>
17518 </li>
17519 </ol>
17520 !! html
17521 <ol>
17522 <li>One</li>
17523 <li>Two:
17524 <ol>
17525 <li>Sub-one</li>
17526 <li>Sub-two</li>
17527 </ol>
17528 </li>
17529 </ol>
17530
17531 !! end
17532
17533 !! test
17534 HTML nested ordered list, open tags (bug 5497)
17535 !! wikitext
17536 <ol>
17537 <li>One
17538 <li>Two:
17539 <ol>
17540 <li>Sub-one
17541 <li>Sub-two
17542 </ol>
17543 </ol>
17544 !! html/php
17545 <ol>
17546 <li>One
17547 <li>Two:
17548 <ol>
17549 <li>Sub-one
17550 <li>Sub-two
17551 </ol>
17552 </ol>
17553
17554 !! html/parsoid
17555 <ol>
17556 <li>One
17557 </li>
17558 <li>Two:
17559 <ol>
17560 <li>Sub-one
17561 </li>
17562 <li>Sub-two
17563 </li>
17564 </ol>
17565 </li>
17566 </ol>
17567
17568 !! end
17569
17570 !! test
17571 HTML ordered list item with parameters oddity
17572 !! wikitext
17573 <ol><li id="fragment">One</li>
17574 </ol>
17575 !! html
17576 <ol><li id="fragment">One</li>
17577 </ol>
17578
17579 !! end
17580
17581 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17582 !!test
17583 bug 5918: autonumbering
17584 !! wikitext
17585 [http://first/] [http://second] [ftp://ftp]
17586
17587 ftp://inlineftp
17588
17589 [mailto:enclosed@mail.tld With target]
17590
17591 [mailto:enclosed@mail.tld]
17592
17593 mailto:inline@mail.tld
17594 !! html/php
17595 <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>
17596 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17597 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17598 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17599 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17600 </p>
17601 !! html/parsoid
17602 <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>
17603 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17604 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17605 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17606 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17607 !! end
17608
17609
17610 #
17611 # Security and HTML correctness
17612 # From Nick Jenkins' fuzz testing
17613 #
17614
17615 !! test
17616 Fuzz testing: Parser13
17617 !! wikitext
17618 {|
17619 | http://a|
17620 !! html
17621 <table>
17622 <tr>
17623 <td>
17624 </td>
17625 </tr>
17626 </table>
17627
17628 !! end
17629
17630 !! test
17631 Fuzz testing: Parser14
17632 !! wikitext
17633 == onmouseover= ==
17634 http://__TOC__
17635 !! html
17636 <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>
17637 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17638 <ul>
17639 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17640 </ul>
17641 </div>
17642
17643
17644 !! html+tidy
17645 <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>
17646 <p>http://</p>
17647 <div id="toc" class="toc">
17648 <div id="toctitle">
17649 <h2>Contents</h2>
17650 </div>
17651 <ul>
17652 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17653 </ul>
17654 </div>
17655 <p></p>
17656 !! end
17657
17658 !! test
17659 Fuzz testing: Parser14-table
17660 !! options
17661 parsoid=wt2html,html2html
17662 !! wikitext
17663 ==a==
17664 {| STYLE=__TOC__
17665 !! html
17666 <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>
17667 <table style="&#95;_TOC&#95;_">
17668 <tr><td></td></tr>
17669 </table>
17670
17671 !! html+tidy
17672 <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>
17673 <table style="__TOC__">
17674 <tr>
17675 <td></td>
17676 </tr>
17677 </table>
17678 !! html/parsoid
17679 <h2>a</h2>
17680 <table style="__TOC__"></table>
17681 !! end
17682
17683 # Known to produce bogus xml (extra </td>)
17684 !! test
17685 Fuzz testing: Parser16
17686 !! wikitext
17687 {|
17688 !https://||||||
17689 !! html
17690 <table>
17691 <tr>
17692 <th>https://</th>
17693 <th></th>
17694 <th></th>
17695 <th>
17696 </td>
17697 </tr>
17698 </table>
17699
17700 !! html+tidy
17701 <table>
17702 <tr>
17703 <th>https://</th>
17704 <th></th>
17705 <th></th>
17706 <th></th>
17707 </tr>
17708 </table>
17709 !! end
17710
17711 !! test
17712 Fuzz testing: Parser21
17713 !! wikitext
17714 {|
17715 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17716 |
17717 !! html
17718 <table>
17719 <tr>
17720 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17721 </th>
17722 <td>
17723 </td>
17724 </tr>
17725 </table>
17726
17727 !! end
17728
17729 !! test
17730 Fuzz testing: Parser22
17731 !! wikitext
17732 http://===r:::https://b
17733
17734 {|
17735 !! html
17736 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17737 </p>
17738 <table>
17739 <tr><td></td></tr>
17740 </table>
17741
17742 !! end
17743
17744 # Known to produce bad XML for now
17745 !! test
17746 Fuzz testing: Parser24
17747 !! options
17748 parsoid=wt2html
17749 !! wikitext
17750 {|
17751 {{{|
17752 <u CLASS=
17753 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17754 <br style="onmouseover='alert(document.cookie);' " />
17755
17756 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17757 |
17758 !! html/php
17759 <table>
17760 {{{|
17761 <u class="&#124;">}}}} &gt;
17762 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17763
17764 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17765 <tr>
17766 <td></u>
17767 </td>
17768 </tr>
17769 </table>
17770
17771 !! html/parsoid
17772 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17773 <u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>
17774 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true,"autoInsertedStart":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
17775
17776
17777
17778 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17779 !! end
17780
17781 # Note: the current result listed for this is not what the original one was,
17782 # but the original bug was JavaScript injection, which is fixed in any case.
17783 # It's not clear that the original result listed was any more correct than the
17784 # current one. Original result:
17785 # <p>{{{|
17786 # </p>
17787 # <li class="&#124;&#124;">
17788 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17789 !!test
17790 Fuzz testing: Parser25 (bug 6055)
17791 !! wikitext
17792 {{{
17793 |
17794 <LI CLASS=||
17795 >
17796 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17797 !! html/php
17798 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17799 </p>
17800 !! html/parsoid
17801 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
17802 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17803 !! end
17804
17805 !!test
17806 Fuzz testing: URL adjacent extension (with space, clean)
17807 !! wikitext
17808 http://example.com <nowiki>junk</nowiki>
17809 !! html/php
17810 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17811 </p>
17812 !! html/parsoid
17813 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17814 !! end
17815
17816 !!test
17817 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17818 !! wikitext
17819 http://example.com<nowiki>junk</nowiki>
17820 !! html/php
17821 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17822 </p>
17823 !! html/parsoid
17824 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17825 !! end
17826
17827 !!test
17828 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17829 !! wikitext
17830 http://example.com<pre>junk</pre>
17831 !! html/php
17832 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17833
17834 !! html/php+tidy
17835 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17836 <pre>
17837 junk
17838 </pre>
17839 !! html/parsoid
17840 <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>
17841 !!end
17842
17843 !!test
17844 Fuzz testing: image with bogus manual thumbnail
17845 !! wikitext
17846 [[Image:foobar.jpg|thumbnail= ]]
17847 !! html/php
17848 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17849
17850 !! html/parsoid
17851 <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>
17852 !!end
17853
17854 !! test
17855 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17856 !! wikitext
17857 <pre dir="&#10;"></pre>
17858 !! html
17859 <pre dir="&#10;"></pre>
17860
17861 !! end
17862
17863 !! test
17864 Parsing optional HTML elements (Bug 6171)
17865 !! options
17866 !! wikitext
17867 <table>
17868 <tr>
17869 <td> Some tabular data</td>
17870 <td> More tabular data ...
17871 <td> And yet som tabular data</td>
17872 </tr>
17873 </table>
17874 !! html
17875 <table>
17876 <tr>
17877 <td> Some tabular data</td>
17878 <td> More tabular data ...
17879 </td><td> And yet som tabular data</td>
17880 </tr>
17881 </table>
17882
17883 !! end
17884
17885 !! test
17886 Correct handling of <td>, <tr> (Bug 6171)
17887 !! options
17888 !! wikitext
17889 <table>
17890 <tr>
17891 <td> Some tabular data</td>
17892 <td> More tabular data ...</td>
17893 <td> And yet som tabular data</td>
17894 </tr>
17895 </table>
17896 !! html
17897 <table>
17898 <tr>
17899 <td> Some tabular data</td>
17900 <td> More tabular data ...</td>
17901 <td> And yet som tabular data</td>
17902 </tr>
17903 </table>
17904
17905 !! end
17906
17907
17908 !! test
17909 Parsing crashing regression (fr:JavaScript)
17910 !! wikitext
17911 </body></x>
17912 !! html
17913 <p>&lt;/body&gt;&lt;/x&gt;
17914 </p>
17915 !! end
17916
17917 !! test
17918 Inline wiki vs wiki block nesting
17919 !! wikitext
17920 '''Bold paragraph
17921
17922 New wiki paragraph
17923 !! html
17924 <p><b>Bold paragraph</b>
17925 </p><p>New wiki paragraph
17926 </p>
17927 !! end
17928
17929 # FIXME: The current php output is documented
17930 # and desired output is the parsoid target.
17931 !! test
17932 Inline HTML vs wiki block nesting
17933 !! wikitext
17934 <b>Bold paragraph
17935
17936 New wiki paragraph
17937 !! html/php
17938 <p><b>Bold paragraph
17939 </p><p>New wiki paragraph</b>
17940 </p>
17941 !! html/parsoid
17942 <p><b>Bold paragraph</b>
17943 </p><p>New wiki paragraph
17944 </p>
17945 !! end
17946
17947 # Original result was this:
17948 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17949 # </p>
17950 # While that might be marginally more intuitive, maybe, the six-apostrophe
17951 # construct is clearly pathological and the result stated here (which is what
17952 # the parser actually does) is about as reasonable as anything.
17953 !!test
17954 Mixing markup for italics and bold
17955 !! options
17956 !! wikitext
17957 '''bold''''''bold''bolditalics'''''
17958 !! html
17959 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17960 </p>
17961 !! end
17962
17963
17964 !! article
17965 Xyzzyx
17966 !! text
17967 Article for special page transclusion test
17968 !! endarticle
17969
17970 !! test
17971 Special page transclusion
17972 !! options
17973 !! wikitext
17974 {{Special:Prefixindex/Xyzzyx}}
17975 !! html
17976 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17977 </ul>
17978
17979 !! end
17980
17981 !! test
17982 Special page transclusion twice (bug 5021)
17983 !! options
17984 !! wikitext
17985 {{Special:Prefixindex/Xyzzyx}}
17986 {{Special:Prefixindex/Xyzzyx}}
17987 !! html
17988 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17989 </ul>
17990 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17991 </ul>
17992
17993 !! end
17994
17995 !! test
17996 Transclusion of default MediaWiki message
17997 !! wikitext
17998 {{MediaWiki:Mainpage}}
17999 !! html
18000 <p>Main Page
18001 </p>
18002 !! end
18003
18004 !! test
18005 Transclusion of nonexistent MediaWiki message
18006 !! wikitext
18007 {{MediaWiki:Mainpagexxx}}
18008 !! html
18009 <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>
18010 </p>
18011 !! end
18012
18013 !! test
18014 Transclusion of MediaWiki message with underscore
18015 !! wikitext
18016 {{MediaWiki:history_short}}
18017 !! html
18018 <p>History
18019 </p>
18020 !! end
18021
18022 !! test
18023 Transclusion of MediaWiki message with space
18024 !! wikitext
18025 {{MediaWiki:history short}}
18026 !! html
18027 <p>History
18028 </p>
18029 !! end
18030
18031 !! test
18032 Invalid header with following text
18033 !! wikitext
18034 = x = y
18035 !! html
18036 <p>= x = y
18037 </p>
18038 !! end
18039
18040
18041 !! test
18042 Section extraction test (section 0)
18043 !! options
18044 section=0
18045 !! wikitext
18046 start
18047 ==a==
18048 ===aa===
18049 ====aaa====
18050 ==b==
18051 ===ba===
18052 ===bb===
18053 ====bba====
18054 ===bc===
18055 ==c==
18056 ===ca===
18057 !! html/php
18058 start
18059 !! end
18060
18061 !! test
18062 Section extraction test (section 1)
18063 !! options
18064 section=1
18065 !! wikitext
18066 start
18067 ==a==
18068 ===aa===
18069 ====aaa====
18070 ==b==
18071 ===ba===
18072 ===bb===
18073 ====bba====
18074 ===bc===
18075 ==c==
18076 ===ca===
18077 !! html/php
18078 ==a==
18079 ===aa===
18080 ====aaa====
18081 !! end
18082
18083 !! test
18084 Section extraction test (section 2)
18085 !! options
18086 section=2
18087 !! wikitext
18088 start
18089 ==a==
18090 ===aa===
18091 ====aaa====
18092 ==b==
18093 ===ba===
18094 ===bb===
18095 ====bba====
18096 ===bc===
18097 ==c==
18098 ===ca===
18099 !! html/php
18100 ===aa===
18101 ====aaa====
18102 !! end
18103
18104 !! test
18105 Section extraction test (section 3)
18106 !! options
18107 section=3
18108 !! wikitext
18109 start
18110 ==a==
18111 ===aa===
18112 ====aaa====
18113 ==b==
18114 ===ba===
18115 ===bb===
18116 ====bba====
18117 ===bc===
18118 ==c==
18119 ===ca===
18120 !! html/php
18121 ====aaa====
18122 !! end
18123
18124 !! test
18125 Section extraction test (section 4)
18126 !! options
18127 section=4
18128 !! wikitext
18129 start
18130 ==a==
18131 ===aa===
18132 ====aaa====
18133 ==b==
18134 ===ba===
18135 ===bb===
18136 ====bba====
18137 ===bc===
18138 ==c==
18139 ===ca===
18140 !! html/php
18141 ==b==
18142 ===ba===
18143 ===bb===
18144 ====bba====
18145 ===bc===
18146 !! end
18147
18148 !! test
18149 Section extraction test (section 5)
18150 !! options
18151 section=5
18152 !! wikitext
18153 start
18154 ==a==
18155 ===aa===
18156 ====aaa====
18157 ==b==
18158 ===ba===
18159 ===bb===
18160 ====bba====
18161 ===bc===
18162 ==c==
18163 ===ca===
18164 !! html/php
18165 ===ba===
18166 !! end
18167
18168 !! test
18169 Section extraction test (section 6)
18170 !! options
18171 section=6
18172 !! wikitext
18173 start
18174 ==a==
18175 ===aa===
18176 ====aaa====
18177 ==b==
18178 ===ba===
18179 ===bb===
18180 ====bba====
18181 ===bc===
18182 ==c==
18183 ===ca===
18184 !! html/php
18185 ===bb===
18186 ====bba====
18187 !! end
18188
18189 !! test
18190 Section extraction test (section 7)
18191 !! options
18192 section=7
18193 !! wikitext
18194 start
18195 ==a==
18196 ===aa===
18197 ====aaa====
18198 ==b==
18199 ===ba===
18200 ===bb===
18201 ====bba====
18202 ===bc===
18203 ==c==
18204 ===ca===
18205 !! html/php
18206 ====bba====
18207 !! end
18208
18209 !! test
18210 Section extraction test (section 8)
18211 !! options
18212 section=8
18213 !! wikitext
18214 start
18215 ==a==
18216 ===aa===
18217 ====aaa====
18218 ==b==
18219 ===ba===
18220 ===bb===
18221 ====bba====
18222 ===bc===
18223 ==c==
18224 ===ca===
18225 !! html/php
18226 ===bc===
18227 !! end
18228
18229 !! test
18230 Section extraction test (section 9)
18231 !! options
18232 section=9
18233 !! wikitext
18234 start
18235 ==a==
18236 ===aa===
18237 ====aaa====
18238 ==b==
18239 ===ba===
18240 ===bb===
18241 ====bba====
18242 ===bc===
18243 ==c==
18244 ===ca===
18245 !! html/php
18246 ==c==
18247 ===ca===
18248 !! end
18249
18250 !! test
18251 Section extraction test (section 10)
18252 !! options
18253 section=10
18254 !! wikitext
18255 start
18256 ==a==
18257 ===aa===
18258 ====aaa====
18259 ==b==
18260 ===ba===
18261 ===bb===
18262 ====bba====
18263 ===bc===
18264 ==c==
18265 ===ca===
18266 !! html/php
18267 ===ca===
18268 !! end
18269
18270 !! test
18271 Section extraction test (nonexistent section 11)
18272 !! options
18273 section=11
18274 !! wikitext
18275 start
18276 ==a==
18277 ===aa===
18278 ====aaa====
18279 ==b==
18280 ===ba===
18281 ===bb===
18282 ====bba====
18283 ===bc===
18284 ==c==
18285 ===ca===
18286 !! html/php
18287 !! end
18288
18289 !! test
18290 Section extraction test with bogus heading (section 1)
18291 !! options
18292 section=1
18293 !! wikitext
18294 ==a==
18295 ==bogus== not a legal section
18296 ==b==
18297 !! html/php
18298 ==a==
18299 ==bogus== not a legal section
18300 !! end
18301
18302 !! test
18303 Section extraction test with bogus heading (section 2)
18304 !! options
18305 section=2
18306 !! wikitext
18307 ==a==
18308 ==bogus== not a legal section
18309 ==b==
18310 !! html/php
18311 ==b==
18312 !! end
18313
18314 !! test
18315 Section extraction test with comment after heading (section 1)
18316 !! options
18317 section=1
18318 !! wikitext
18319 ==a==
18320 ==b== <!-- -->
18321 ==c==
18322 !! html/php
18323 ==a==
18324 !! end
18325
18326 !! test
18327 Section extraction test with comment after heading (section 2)
18328 !! options
18329 section=2
18330 !! wikitext
18331 ==a==
18332 ==b== <!-- -->
18333 ==c==
18334 !! html/php
18335 ==b== <!-- -->
18336 !! end
18337
18338 !! test
18339 Section extraction test with bogus <nowiki> heading (section 1)
18340 !! options
18341 section=1
18342 !! wikitext
18343 ==a==
18344 ==bogus== <nowiki>not a legal section</nowiki>
18345 ==b==
18346 !! html/php
18347 ==a==
18348 ==bogus== <nowiki>not a legal section</nowiki>
18349 !! end
18350
18351 !! test
18352 Section extraction test with bogus <nowiki> heading (section 2)
18353 !! options
18354 section=2
18355 !! wikitext
18356 ==a==
18357 ==bogus== <nowiki>not a legal section</nowiki>
18358 ==b==
18359 !! html/php
18360 ==b==
18361 !! end
18362
18363 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18364 # instead of respecting commented sections
18365 !! test
18366 Section extraction prefixed by comment (section 1)
18367 !! options
18368 section=1
18369 !! wikitext
18370 <!-- -->==sec1==
18371 ==sec2==
18372 !! html/php
18373 ==sec2==
18374 !!end
18375
18376 !! test
18377 Section extraction prefixed by comment (section 2)
18378 !! options
18379 section=2
18380 !! wikitext
18381 <!-- -->==sec1==
18382 ==sec2==
18383 !! html/php
18384
18385 !!end
18386
18387 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18388 # instead of respecting HTML-style headings
18389 !! test
18390 Section extraction, mixed wiki and html (section 1)
18391 !! options
18392 section=1
18393 !! wikitext
18394 <h2>unmarked</h2>
18395 unmarked
18396 ==1==
18397 one
18398 ==2==
18399 two
18400 !! html/php
18401 ==1==
18402 one
18403 !! end
18404
18405 !! test
18406 Section extraction, mixed wiki and html (section 2)
18407 !! options
18408 section=2
18409 !! wikitext
18410 <h2>unmarked</h2>
18411 unmarked
18412 ==1==
18413 one
18414 ==2==
18415 two
18416 !! html/php
18417 ==2==
18418 two
18419 !! end
18420
18421
18422 # Formerly testing for bug 3342
18423 !! test
18424 Section extraction, heading surrounded by <noinclude>
18425 !! options
18426 section=1
18427 !! wikitext
18428 <noinclude>==unmarked==</noinclude>
18429 ==marked==
18430 !! html/php
18431 ==marked==
18432 !!end
18433
18434 # Test behavior of bug 19910
18435 !! test
18436 Sectiion with all-equals
18437 !! options
18438 section=2
18439 !! wikitext
18440 ===
18441 The line above must have a trailing space
18442 === <!--
18443 --> <!-- -->
18444 But just in case it doesn't...
18445 !! html/php
18446 === <!--
18447 --> <!-- -->
18448 But just in case it doesn't...
18449 !! end
18450
18451 !! test
18452 Section replacement test (section 0)
18453 !! options
18454 replace=0,"xxx"
18455 !! wikitext
18456 start
18457 ==a==
18458 ===aa===
18459 ====aaa====
18460 ==b==
18461 ===ba===
18462 ===bb===
18463 ====bba====
18464 ===bc===
18465 ==c==
18466 ===ca===
18467 !! html/php
18468 xxx
18469
18470 ==a==
18471 ===aa===
18472 ====aaa====
18473 ==b==
18474 ===ba===
18475 ===bb===
18476 ====bba====
18477 ===bc===
18478 ==c==
18479 ===ca===
18480 !! end
18481
18482 !! test
18483 Section replacement test (section 1)
18484 !! options
18485 replace=1,"xxx"
18486 !! wikitext
18487 start
18488 ==a==
18489 ===aa===
18490 ====aaa====
18491 ==b==
18492 ===ba===
18493 ===bb===
18494 ====bba====
18495 ===bc===
18496 ==c==
18497 ===ca===
18498 !! html/php
18499 start
18500 xxx
18501
18502 ==b==
18503 ===ba===
18504 ===bb===
18505 ====bba====
18506 ===bc===
18507 ==c==
18508 ===ca===
18509 !! end
18510
18511 !! test
18512 Section replacement test (section 2)
18513 !! options
18514 replace=2,"xxx"
18515 !! wikitext
18516 start
18517 ==a==
18518 ===aa===
18519 ====aaa====
18520 ==b==
18521 ===ba===
18522 ===bb===
18523 ====bba====
18524 ===bc===
18525 ==c==
18526 ===ca===
18527 !! html/php
18528 start
18529 ==a==
18530 xxx
18531
18532 ==b==
18533 ===ba===
18534 ===bb===
18535 ====bba====
18536 ===bc===
18537 ==c==
18538 ===ca===
18539 !! end
18540
18541 !! test
18542 Section replacement test (section 3)
18543 !! options
18544 replace=3,"xxx"
18545 !! wikitext
18546 start
18547 ==a==
18548 ===aa===
18549 ====aaa====
18550 ==b==
18551 ===ba===
18552 ===bb===
18553 ====bba====
18554 ===bc===
18555 ==c==
18556 ===ca===
18557 !! html/php
18558 start
18559 ==a==
18560 ===aa===
18561 xxx
18562
18563 ==b==
18564 ===ba===
18565 ===bb===
18566 ====bba====
18567 ===bc===
18568 ==c==
18569 ===ca===
18570 !! end
18571
18572 !! test
18573 Section replacement test (section 4)
18574 !! options
18575 replace=4,"xxx"
18576 !! wikitext
18577 start
18578 ==a==
18579 ===aa===
18580 ====aaa====
18581 ==b==
18582 ===ba===
18583 ===bb===
18584 ====bba====
18585 ===bc===
18586 ==c==
18587 ===ca===
18588 !! html/php
18589 start
18590 ==a==
18591 ===aa===
18592 ====aaa====
18593 xxx
18594
18595 ==c==
18596 ===ca===
18597 !! end
18598
18599 !! test
18600 Section replacement test (section 5)
18601 !! options
18602 replace=5,"xxx"
18603 !! wikitext
18604 start
18605 ==a==
18606 ===aa===
18607 ====aaa====
18608 ==b==
18609 ===ba===
18610 ===bb===
18611 ====bba====
18612 ===bc===
18613 ==c==
18614 ===ca===
18615 !! html/php
18616 start
18617 ==a==
18618 ===aa===
18619 ====aaa====
18620 ==b==
18621 xxx
18622
18623 ===bb===
18624 ====bba====
18625 ===bc===
18626 ==c==
18627 ===ca===
18628 !! end
18629
18630 !! test
18631 Section replacement test (section 6)
18632 !! options
18633 replace=6,"xxx"
18634 !! wikitext
18635 start
18636 ==a==
18637 ===aa===
18638 ====aaa====
18639 ==b==
18640 ===ba===
18641 ===bb===
18642 ====bba====
18643 ===bc===
18644 ==c==
18645 ===ca===
18646 !! html/php
18647 start
18648 ==a==
18649 ===aa===
18650 ====aaa====
18651 ==b==
18652 ===ba===
18653 xxx
18654
18655 ===bc===
18656 ==c==
18657 ===ca===
18658 !! end
18659
18660 !! test
18661 Section replacement test (section 7)
18662 !! options
18663 replace=7,"xxx"
18664 !! wikitext
18665 start
18666 ==a==
18667 ===aa===
18668 ====aaa====
18669 ==b==
18670 ===ba===
18671 ===bb===
18672 ====bba====
18673 ===bc===
18674 ==c==
18675 ===ca===
18676 !! html/php
18677 start
18678 ==a==
18679 ===aa===
18680 ====aaa====
18681 ==b==
18682 ===ba===
18683 ===bb===
18684 xxx
18685
18686 ===bc===
18687 ==c==
18688 ===ca===
18689 !! end
18690
18691 !! test
18692 Section replacement test (section 8)
18693 !! options
18694 replace=8,"xxx"
18695 !! wikitext
18696 start
18697 ==a==
18698 ===aa===
18699 ====aaa====
18700 ==b==
18701 ===ba===
18702 ===bb===
18703 ====bba====
18704 ===bc===
18705 ==c==
18706 ===ca===
18707 !! html/php
18708 start
18709 ==a==
18710 ===aa===
18711 ====aaa====
18712 ==b==
18713 ===ba===
18714 ===bb===
18715 ====bba====
18716 xxx
18717
18718 ==c==
18719 ===ca===
18720 !!end
18721
18722 !! test
18723 Section replacement test (section 9)
18724 !! options
18725 replace=9,"xxx"
18726 !! wikitext
18727 start
18728 ==a==
18729 ===aa===
18730 ====aaa====
18731 ==b==
18732 ===ba===
18733 ===bb===
18734 ====bba====
18735 ===bc===
18736 ==c==
18737 ===ca===
18738 !! html/php
18739 start
18740 ==a==
18741 ===aa===
18742 ====aaa====
18743 ==b==
18744 ===ba===
18745 ===bb===
18746 ====bba====
18747 ===bc===
18748 xxx
18749 !! end
18750
18751 !! test
18752 Section replacement test (section 10)
18753 !! options
18754 replace=10,"xxx"
18755 !! wikitext
18756 start
18757 ==a==
18758 ===aa===
18759 ====aaa====
18760 ==b==
18761 ===ba===
18762 ===bb===
18763 ====bba====
18764 ===bc===
18765 ==c==
18766 ===ca===
18767 !! html/php
18768 start
18769 ==a==
18770 ===aa===
18771 ====aaa====
18772 ==b==
18773 ===ba===
18774 ===bb===
18775 ====bba====
18776 ===bc===
18777 ==c==
18778 xxx
18779 !! end
18780
18781 !! test
18782 Section replacement test with initial whitespace (bug 13728)
18783 !! options
18784 replace=2,"xxx"
18785 !! wikitext
18786 Preformatted initial line
18787 ==a==
18788 ===a===
18789 !! html/php
18790 Preformatted initial line
18791 ==a==
18792 xxx
18793 !! end
18794
18795
18796 !! test
18797 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18798 !! options
18799 section=1
18800 !! wikitext
18801 ==a==
18802 a
18803 !! html/php
18804 ==a==
18805 a
18806 !! end
18807
18808 !! test
18809 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18810 !! options
18811 section=1
18812 !! wikitext
18813 ==a==
18814 a
18815 !! html/php
18816 ==a==
18817 a
18818 !! end
18819
18820
18821 !! test
18822 Section extraction, <pre> around bogus header (bug 10309)
18823 !! options
18824 section=2
18825 !! wikitext
18826 == Section One ==
18827 <pre>
18828 =======
18829 </pre>
18830
18831 == Section Two ==
18832 stuff
18833 !! html/php
18834 == Section Two ==
18835 stuff
18836 !! end
18837
18838 !! test
18839 Section replacement, <pre> around bogus header (bug 10309)
18840 !! options
18841 replace=2,"xxx"
18842 !! wikitext
18843 == Section One ==
18844 <pre>
18845 =======
18846 </pre>
18847
18848 == Section Two ==
18849 stuff
18850 !! html/php
18851 == Section One ==
18852 <pre>
18853 =======
18854 </pre>
18855
18856 xxx
18857 !! end
18858
18859
18860 !! test
18861 Handling of &#x0A; in URLs
18862 !! wikitext
18863 ** irc://&#x0A;a
18864 !! html/php
18865 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18866
18867 !! html/parsoid
18868 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18869 a">irc://
18870 a</a></li></ul></li></ul>
18871 !! end
18872
18873 !! test
18874 Handling of %0A in URLs
18875 !! wikitext
18876 ** irc://%0Aa
18877 !! html/php
18878 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18879
18880 !! html/parsoid
18881 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18882 !! end
18883
18884
18885 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18886 !! test
18887 5 quotes, code coverage +1 line
18888 !! options
18889 parsoid=wt2html
18890 !! wikitext
18891 '''''
18892 !! html/php
18893 !! html/parsoid
18894 <p><b><i></i></b></p>
18895 !! end
18896
18897 # same html as previous, but wikitext adjusted to match parsoid html2wt
18898 # note that wt2html and html2html will put the <i> before the <b>
18899 !! test
18900 5 quotes, code coverage +1 line w/ nowiki (1)
18901 !! options
18902 parsoid=wt2wt,html2wt
18903 !! wikitext
18904 '''''<nowiki/>'''''
18905 !! html/php
18906 <p><i></i>
18907 </p>
18908 !! html/parsoid
18909 <p><b><i></i></b></p>
18910 !! end
18911
18912 # same as previous, just swapping the <i> and <b>
18913 !! test
18914 5 quotes, code coverage +1 line w/ nowiki (2)
18915 !! wikitext
18916 '''''<nowiki/>'''''
18917 !! html/php
18918 <p><i></i>
18919 </p>
18920 !! html/parsoid
18921 <p><i><b></b></i></p>
18922 !! end
18923
18924 !! test
18925 Special:Search page linking.
18926 !! wikitext
18927 {{Special:search}}
18928 !! html
18929 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18930 </p>
18931 !! end
18932
18933 !! test
18934 {{!}} is a magic word
18935 !! wikitext
18936 {{!}} is a magic word there and {{!}} is still a magic word here
18937 | is not a magic word here but {{!}} is still a magic word here
18938 !! html/php
18939 <p>| is a magic word there and | is still a magic word here
18940 | is not a magic word here but | is still a magic word here
18941 </p>
18942 !! html/parsoid
18943 <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
18944 | 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>
18945
18946 !! end
18947
18948 !! test
18949 Say the magic word
18950 !! options
18951 title=[[Parser test]]
18952 !! wikitext
18953 * {{PAGENAME}}
18954 * {{PAGENAMEE}}
18955 * {{FULLPAGENAME}}
18956 * {{FULLPAGENAMEE}}
18957 * {{BASEPAGENAME}}
18958 * {{BASEPAGENAMEE}}
18959 * {{SUBPAGENAME}}
18960 * {{SUBPAGENAMEE}}
18961 * {{ROOTPAGENAME}}
18962 * {{ROOTPAGENAMEE}}
18963 * {{TALKPAGENAME}}
18964 * {{TALKPAGENAMEE}}
18965 * {{SUBJECTPAGENAME}}
18966 * {{SUBJECTPAGENAMEE}}
18967 * {{NAMESPACEE}}
18968 * {{NAMESPACE}}
18969 * {{NAMESPACENUMBER}}
18970 * {{TALKSPACE}}
18971 * {{TALKSPACEE}}
18972 * {{SUBJECTSPACE}}
18973 * {{SUBJECTSPACEE}}
18974 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18975 !! html
18976 <ul><li> Parser test</li>
18977 <li> Parser_test</li>
18978 <li> Parser test</li>
18979 <li> Parser_test</li>
18980 <li> Parser test</li>
18981 <li> Parser_test</li>
18982 <li> Parser test</li>
18983 <li> Parser_test</li>
18984 <li> Parser test</li>
18985 <li> Parser_test</li>
18986 <li> Talk:Parser test</li>
18987 <li> Talk:Parser_test</li>
18988 <li> Parser test</li>
18989 <li> Parser_test</li>
18990 <li> </li>
18991 <li> </li>
18992 <li> 0</li>
18993 <li> Talk</li>
18994 <li> Talk</li>
18995 <li> </li>
18996 <li> </li>
18997 <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>
18998
18999 !! end
19000 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
19001
19002 ## Parsoid thinks the "centre" here is a property, not a caption.
19003 !! test
19004 Gallery
19005 !! options
19006 parsoid={
19007 "modes": ["wt2html"],
19008 "nativeGallery": true
19009 }
19010 !! wikitext
19011 <gallery>
19012 image1.png |
19013 image2.gif|||||
19014
19015 image3|
19016 image4 |300px| centre
19017 image5.svg| http://///////
19018 [[x|xx]]]]
19019 * image6
19020 </gallery>
19021 !! html/php
19022 <ul class="gallery mw-gallery-traditional">
19023 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19024 <div class="thumb" style="height: 150px;">Image1.png</div>
19025 <div class="gallerytext">
19026 </div>
19027 </div></li>
19028 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19029 <div class="thumb" style="height: 150px;">Image2.gif</div>
19030 <div class="gallerytext">
19031 </div>
19032 </div></li>
19033 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19034 <div class="thumb" style="height: 150px;">Image3</div>
19035 <div class="gallerytext">
19036 </div>
19037 </div></li>
19038 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19039 <div class="thumb" style="height: 150px;">Image4</div>
19040 <div class="gallerytext">
19041 <pre>centre
19042 </pre>
19043 </div>
19044 </div></li>
19045 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19046 <div class="thumb" style="height: 150px;">Image5.svg</div>
19047 <div class="gallerytext">
19048 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19049 </p>
19050 </div>
19051 </div></li>
19052 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19053 <div class="thumb" style="height: 150px;">* image6</div>
19054 <div class="gallerytext">
19055 </div>
19056 </div></li>
19057 </ul>
19058
19059 !! html/parsoid
19060 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19061 <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>
19062 <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>
19063 <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>
19064 <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>
19065 <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>
19066 <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>
19067 </ul>
19068 !! end
19069
19070 !! test
19071 Gallery (with options, html)
19072 !! options
19073 parsoid={
19074 "modes": ["wt2html", "html2html"],
19075 "nativeGallery": true
19076 }
19077 !! wikitext
19078 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19079 File:Nonexistent.jpg|caption
19080 File:Nonexistent.jpg
19081 image:foobar.jpg|some '''caption''' [[Main Page]]
19082 image:foobar.jpg
19083 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19084 </gallery>
19085 !! html/php
19086 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19087 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19088 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19089 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19090 <div class="gallerytext">
19091 <p>caption
19092 </p>
19093 </div>
19094 </div></li>
19095 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19096 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19097 <div class="gallerytext">
19098 </div>
19099 </div></li>
19100 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19101 <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>
19102 <div class="gallerytext">
19103 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19104 </p>
19105 </div>
19106 </div></li>
19107 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19108 <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>
19109 <div class="gallerytext">
19110 </div>
19111 </div></li>
19112 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19113 <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>
19114 <div class="gallerytext">
19115 <p>blabla.
19116 </p>
19117 </div>
19118 </div></li>
19119 </ul>
19120
19121 !! html/parsoid
19122 <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":{}}'>
19123 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19124 <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>
19125 <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>
19126 <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>
19127 <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>
19128 <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>
19129 </ul>
19130 !! end
19131
19132 !! test
19133 Gallery (with options, extsrc)
19134 !! options
19135 parsoid={
19136 "nativeGallery": false
19137 }
19138 !! wikitext
19139 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19140 File:Nonexistent.jpg|caption
19141 File:Nonexistent.jpg
19142 image:foobar.jpg|some '''caption''' [[Main Page]]
19143 image:foobar.jpg
19144 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19145 </gallery>
19146 !! html/php
19147 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19148 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19149 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19150 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19151 <div class="gallerytext">
19152 <p>caption
19153 </p>
19154 </div>
19155 </div></li>
19156 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19157 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19158 <div class="gallerytext">
19159 </div>
19160 </div></li>
19161 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19162 <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>
19163 <div class="gallerytext">
19164 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19165 </p>
19166 </div>
19167 </div></li>
19168 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19169 <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>
19170 <div class="gallerytext">
19171 </div>
19172 </div></li>
19173 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19174 <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>
19175 <div class="gallerytext">
19176 <p>blabla.
19177 </p>
19178 </div>
19179 </div></li>
19180 </ul>
19181
19182 !! html/parsoid
19183 <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"}}'>
19184 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19185 <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>
19186 <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>
19187 <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>
19188 <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>
19189 <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>
19190 </ul>
19191 !! end
19192
19193 !! test
19194 Gallery with link that has fragment
19195 !! options
19196 parsoid={
19197 "modes": ["wt2html", "html2html"],
19198 "nativeGallery": true
19199 }
19200 !! wikitext
19201 <gallery>
19202 image:foobar.jpg|link=Main_Page
19203 image:foobar.jpg|link=Main_Page#section
19204 image:foobar.jpg|link=Main Page#section|caption
19205 </gallery>
19206 !! html/php
19207 <ul class="gallery mw-gallery-traditional">
19208 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19209 <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>
19210 <div class="gallerytext">
19211 </div>
19212 </div></li>
19213 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19214 <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>
19215 <div class="gallerytext">
19216 </div>
19217 </div></li>
19218 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19219 <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>
19220 <div class="gallerytext">
19221 <p>caption
19222 </p>
19223 </div>
19224 </div></li>
19225 </ul>
19226
19227 !! html/parsoid
19228 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19229 <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>
19230 <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>
19231 <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>
19232 </ul>
19233 !! end
19234
19235 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19236 !! test
19237 Gallery with template inside caption
19238 !! options
19239 parsoid={
19240 "nativeGallery": true
19241 }
19242 !! wikitext
19243 <gallery caption="{{echo|hi}}">
19244 File:Foobar.jpg|{{echo|ho}}
19245 </gallery>
19246 !! html/php
19247 <ul class="gallery mw-gallery-traditional">
19248 <li class='gallerycaption'>{{echo|hi}}</li>
19249 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19250 <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>
19251 <div class="gallerytext">
19252 <p>ho
19253 </p>
19254 </div>
19255 </div></li>
19256 </ul>
19257
19258 !! html/parsoid
19259 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19260 <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>
19261 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><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>
19262 </ul>
19263 !! end
19264
19265 !! test
19266 Gallery with wikitext inside caption
19267 !! options
19268 parsoid={
19269 "nativeGallery": true
19270 }
19271 !! wikitext
19272 <gallery>
19273 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19274 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19275 </gallery>
19276 !! html/php
19277 <ul class="gallery mw-gallery-traditional">
19278 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19279 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
19280 <div class="gallerytext">
19281 <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>
19282 </p>
19283 </div>
19284 </div></li>
19285 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19286 <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>
19287 <div class="gallerytext">
19288 <p>This is a test template
19289 </p>
19290 </div>
19291 </div></li>
19292 </ul>
19293
19294 !! html/parsoid
19295 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19296 <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>
19297 <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>
19298 </ul>
19299 !! end
19300
19301 !! test
19302 Gallery (with showfilename option)
19303 !! options
19304 parsoid={
19305 "nativeGallery": true
19306 }
19307 !! wikitext
19308 <gallery showfilename="">
19309 File:Nonexistent.jpg|caption
19310 File:Nonexistent.jpg
19311 File:Foobar.jpg|some '''caption''' [[Main Page]]
19312 File:Foobar.jpg
19313 </gallery>
19314 !! html/php
19315 <ul class="gallery mw-gallery-traditional">
19316 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19317 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19318 <div class="gallerytext">
19319 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19320 caption
19321 </p>
19322 </div>
19323 </div></li>
19324 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19325 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19326 <div class="gallerytext">
19327 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19328 </p>
19329 </div>
19330 </div></li>
19331 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19332 <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>
19333 <div class="gallerytext">
19334 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19335 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19336 </p>
19337 </div>
19338 </div></li>
19339 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19340 <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>
19341 <div class="gallerytext">
19342 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19343 </p>
19344 </div>
19345 </div></li>
19346 </ul>
19347
19348 !! html/parsoid
19349 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19350 <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>
19351 <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>
19352 <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>
19353 <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>
19354 </ul>
19355 !! end
19356
19357 ## Should Parsoid be preserving these variations?
19358 !! test
19359 Gallery (with namespace-less filenames)
19360 !! options
19361 parsoid={
19362 "modes": ["wt2html", "html2html"],
19363 "nativeGallery": true
19364 }
19365 !! wikitext
19366 <gallery>
19367 File:Nonexistent.jpg
19368 Nonexistent.jpg
19369 image:foobar.jpg
19370 foobar.jpg
19371 </gallery>
19372 !! html/php
19373 <ul class="gallery mw-gallery-traditional">
19374 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19375 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19376 <div class="gallerytext">
19377 </div>
19378 </div></li>
19379 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19380 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19381 <div class="gallerytext">
19382 </div>
19383 </div></li>
19384 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19385 <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>
19386 <div class="gallerytext">
19387 </div>
19388 </div></li>
19389 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19390 <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>
19391 <div class="gallerytext">
19392 </div>
19393 </div></li>
19394 </ul>
19395
19396 !! html/parsoid
19397 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19398 <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>
19399 <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>
19400 <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>
19401 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19402 </ul>
19403 !! end
19404
19405 !! test
19406 Gallery override link with WikiLink (T36852)
19407 !! options
19408 parsoid={
19409 "nativeGallery": true
19410 }
19411 !! wikitext
19412 <gallery>
19413 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19414 </gallery>
19415 !! html/php
19416 <ul class="gallery mw-gallery-traditional">
19417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19418 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/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>
19419 <div class="gallerytext">
19420 </div>
19421 </div></li>
19422 </ul>
19423
19424 !! html/parsoid
19425 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-parsoid='{"dsr":[0,70,2,2]}' data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19426 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./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>
19427 </ul>
19428 !! end
19429
19430 !! test
19431 Gallery override link with absolute external link (T36852)
19432 !! options
19433 parsoid={
19434 "nativeGallery": true
19435 }
19436 !! wikitext
19437 <gallery>
19438 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19439 </gallery>
19440 !! html/php
19441 <ul class="gallery mw-gallery-traditional">
19442 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19443 <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>
19444 <div class="gallerytext">
19445 </div>
19446 </div></li>
19447 </ul>
19448
19449 !! html/parsoid
19450 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19451 <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>
19452 </ul>
19453 !! end
19454
19455 !! test
19456 Gallery override link with malicious javascript (T36852)
19457 !! options
19458 parsoid={
19459 "modes": ["wt2html", "html2html"],
19460 "nativeGallery": true
19461 }
19462 !! wikitext
19463 <gallery>
19464 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19465 </gallery>
19466 !! html/php
19467 <ul class="gallery mw-gallery-traditional">
19468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19469 <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>
19470 <div class="gallerytext">
19471 </div>
19472 </div></li>
19473 </ul>
19474
19475 !! html/parsoid
19476 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19477 <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>
19478 </ul>
19479 !! end
19480
19481 !! test
19482 Gallery with invalid title as link (T45964)
19483 !! options
19484 parsoid={
19485 "modes": ["wt2html", "html2html"],
19486 "nativeGallery": true
19487 }
19488 !! wikitext
19489 <gallery>
19490 File:Foobar.jpg|link=<
19491 </gallery>
19492 !! html/php
19493 <ul class="gallery mw-gallery-traditional">
19494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19495 <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>
19496 <div class="gallerytext">
19497 </div>
19498 </div></li>
19499 </ul>
19500
19501 !! html/parsoid
19502 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19503 <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>
19504 </ul>
19505 !! end
19506
19507 !! test
19508 HTML Hex character encoding (spells the word "JavaScript")
19509 !! options
19510 parsoid=wt2html,wt2wt,html2html
19511 !! wikitext
19512 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19513 !! html/php
19514 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19515 </p>
19516 !! html/php+tidy
19517 <p>JavaScript</p>
19518 !! html/parsoid
19519 <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>
19520 !! end
19521
19522 !! test
19523 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19524 !! wikitext
19525 &#xsee;&#XSEE;
19526 !! html/php
19527 <p>&amp;#xsee;&amp;#XSEE;
19528 </p>
19529 !! html/parsoid
19530 <p>&amp;#xsee;&amp;#XSEE;</p>
19531 !! end
19532
19533 !! test
19534 HTML Hex character encoding mixed case
19535 !! options
19536 parsoid=wt2html,wt2wt,html2html
19537 !! wikitext
19538 &#xEE;&#Xee;
19539 !! html/php
19540 <p>&#xee;&#xee;
19541 </p>
19542 !! html/php+tidy
19543 <p>îî</p>
19544 !! html/parsoid
19545 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19546 !! end
19547
19548 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19549 # Note that U+000C (form feed) is not a valid XML character, so
19550 # it is banned even though allowed in HTML5.
19551 !! test
19552 Illegal character references (T106578)
19553 !! wikitext
19554 ; Null: &#00;
19555 ; FF: &#xC;
19556 ; CR: &#xD;
19557 ; Control (low): &#8;
19558 ; Control (high): &#x7F; &#x9F;
19559 ; Surrogate: &#xD83D;&#xDCA9;
19560 ; This is an okay astral character: &#x1F4A9;
19561 !! html+tidy
19562 <dl>
19563 <dt>Null</dt>
19564 <dd>&amp;#00;</dd>
19565 <dt>FF</dt>
19566 <dd>&amp;#xC;</dd>
19567 <dt>CR</dt>
19568 <dd>&amp;#xD;</dd>
19569 <dt>Control (low)</dt>
19570 <dd>&amp;#8;</dd>
19571 <dt>Control (high)</dt>
19572 <dd>&amp;#x7F; &amp;#x9F;</dd>
19573 <dt>Surrogate</dt>
19574 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19575 <dt>This is an okay astral character</dt>
19576 <dd>💩</dd>
19577 </dl>
19578 !! end
19579
19580 !! test
19581 __FORCETOC__ override
19582 !! wikitext
19583 __NEWSECTIONLINK__
19584 __FORCETOC__
19585 !! html/php
19586 <p><br />
19587 </p>
19588 !! end
19589
19590 !! test
19591 ISBN code coverage
19592 !! wikitext
19593 ISBN 978-0-1234-56&#x20;789
19594 !! html
19595 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19596 </p>
19597 !! html+tidy
19598 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19599 !! html/parsoid
19600 <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>
19601 !! end
19602
19603 !! test
19604 ISBN followed by 5 spaces
19605 !! wikitext
19606 ISBN
19607 !! html
19608 <p>ISBN
19609 </p>
19610 !! end
19611
19612 !! test
19613 Double ISBN
19614 !! wikitext
19615 ISBN ISBN 1234567890
19616 !! html/php
19617 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19618 </p>
19619 !! html/parsoid
19620 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19621 !! end
19622
19623 # Uppercase X and lowercase x as well
19624 !! test
19625 ISBN with an X
19626 !! wikitext
19627 ISBN 3-462-04561-X
19628 ISBN 3-462-04561-x
19629 ISBN 080442957X
19630 ISBN 080442957x
19631 ISBN 978080442957X
19632 ISBN 978080442957x
19633 !! html/php
19634 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19635 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19636 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19637 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19638 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19639 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19640 </p>
19641 !! html/parsoid
19642 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19643 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19644 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19645 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19646 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19647 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19648 !! end
19649
19650 !! test
19651 ISBN with empty prefix (parsoid test)
19652 !! wikitext
19653 ISBN 1234567890
19654 !! html/php
19655 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19656 </p>
19657 !! html/parsoid
19658 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19659 !! end
19660
19661 !! test
19662 Bug 22905: <abbr> followed by ISBN followed by </a>
19663 !! wikitext
19664 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19665 !! html/php
19666 <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>
19667 </p>
19668 !! html/parsoid
19669 <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>
19670 !! end
19671
19672 !! test
19673 Double RFC
19674 !! wikitext
19675 RFC RFC 1234
19676 !! html
19677 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19678 </p>
19679 !! end
19680
19681 !! test
19682 Double RFC with a wiki link
19683 !! wikitext
19684 RFC [[RFC 1234]]
19685 !! html
19686 <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>
19687 </p>
19688 !! end
19689
19690 !! test
19691 RFC code coverage
19692 !! wikitext
19693 RFC 983&#x20;987
19694 !! html
19695 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19696 </p>
19697 !! html+tidy
19698 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19699 !! end
19700
19701 !! test
19702 Centre-aligned image
19703 !! wikitext
19704 [[Image:foobar.jpg|centre]]
19705 !! html
19706 <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>
19707
19708 !!end
19709
19710 !! test
19711 None-aligned image
19712 !! wikitext
19713 [[Image:foobar.jpg|none]]
19714 !! html
19715 <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>
19716
19717 !!end
19718
19719 !! test
19720 Width + Height sized image (using px) (height is ignored)
19721 !! wikitext
19722 [[Image:foobar.jpg|640x480px]]
19723 !! html
19724 <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>
19725 </p>
19726 !!end
19727
19728 !! test
19729 Width-sized image (using px, no following whitespace)
19730 !! wikitext
19731 [[Image:foobar.jpg|640px]]
19732 !! html
19733 <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>
19734 </p>
19735 !!end
19736
19737 !! test
19738 Width-sized image (using px, with following whitespace - test regression from r39467)
19739 !! wikitext
19740 [[Image:foobar.jpg|640px ]]
19741 !! html
19742 <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>
19743 </p>
19744 !!end
19745
19746 !! test
19747 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19748 !! wikitext
19749 [[Image:foobar.jpg| 640px]]
19750 !! html
19751 <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>
19752 </p>
19753 !!end
19754
19755 !! test
19756 Image with page parameter
19757 !! options
19758 djvu
19759 !! wikitext
19760 [[File:LoremIpsum.djvu|page=2]]
19761 !! html/php
19762 <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>
19763 </p>
19764 !! html/parsoid
19765 <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>
19766 !! end
19767
19768 !! test
19769 Another italics / bold test
19770 !! wikitext
19771 ''' ''x'
19772 !! html
19773 <pre>'<i> </i>x'
19774 </pre>
19775 !!end
19776
19777 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19778 !! test
19779 dt/dd/dl test
19780 !! wikitext
19781 :;;;::
19782 !! html/php
19783 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19784
19785 !! html/parsoid
19786 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19787
19788 !!end
19789
19790
19791 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19792 !! test
19793 Images with the "|" character in the comment
19794 !! wikitext
19795 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19796 !! html/php
19797 <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>
19798
19799 !! html/parsoid
19800 <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>
19801 !! end
19802
19803 !! test
19804 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19805 !! wikitext
19806 <html><script>alert(1);</script></html>
19807 !! html
19808 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19809 </p>
19810 !! end
19811
19812 !! test
19813 HTML with raw HTML ($wgRawHtml==true)
19814 !! options
19815 wgRawHtml=1
19816 !! wikitext
19817 <html><script>alert(1);</script></html>
19818 !! html
19819 <p><script>alert(1);</script>
19820 </p>
19821 !! end
19822
19823 !! test
19824 Parents of subpages, one level up
19825 !! options
19826 subpage title=[[Subpage test/L1/L2/L3]]
19827 !! wikitext
19828 [[../|L2]]
19829 !! html
19830 <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>
19831 </p>
19832 !! end
19833
19834
19835 !! test
19836 Parents of subpages, one level up, not named
19837 !! options
19838 subpage title=[[Subpage test/L1/L2/L3]]
19839 !! wikitext
19840 [[../]]
19841 !! html
19842 <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>
19843 </p>
19844 !! end
19845
19846
19847
19848 !! test
19849 Parents of subpages, two levels up
19850 !! options
19851 subpage title=[[Subpage test/L1/L2/L3]]
19852 !! wikitext
19853 [[../../|L1]]2
19854
19855 [[../../|L1]]l
19856 !! html
19857 <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
19858 </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>
19859 </p>
19860 !! end
19861
19862 !! test
19863 Parents of subpages, two levels up, without trailing slash or name.
19864 !! options
19865 subpage title=[[Subpage test/L1/L2/L3]]
19866 !! wikitext
19867 [[../..]]
19868 !! html
19869 <p>[[../..]]
19870 </p>
19871 !! end
19872
19873 !! test
19874 Parents of subpages, two levels up, with lots of extra trailing slashes.
19875 !! options
19876 subpage title=[[Subpage test/L1/L2/L3]]
19877 !! wikitext
19878 [[../../////]]
19879 !! html
19880 <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>
19881 </p>
19882 !! end
19883
19884 !! article
19885 Subpage test/L1/L2/L3Sibling
19886 !! text
19887 Sibling article
19888 !! endarticle
19889
19890 !! test
19891 Transclusion of a sibling page (one level up)
19892 !! options
19893 subpage title=[[Subpage test/L1/L2/L3]]
19894 !! wikitext
19895 {{../L3Sibling}}
19896 !! html
19897 <p>Sibling article
19898 </p>
19899 !! end
19900
19901 !! test
19902 Transclusion of a child page
19903 !! options
19904 subpage title=[[Subpage test/L1/L2]]
19905 !! wikitext
19906 {{/L3Sibling}}
19907 !! html
19908 <p>Sibling article
19909 </p>
19910 !! end
19911
19912 # This is wt2html only in Parsoid because we add <nowiki>
19913 # because of {{..}} and we don't expect to fix that to
19914 # eliminate the nowikis selective for {{..}} markup.
19915 !! test
19916 Non-transclusion because of too many up levels
19917 !! options
19918 subpage title=[[Subpage test/L1/L2/L3]]
19919 parsoid=wt2html
19920 !! wikitext
19921 {{../../../../More than parent}}
19922 !! html/php
19923 <p>{{../../../../More than parent}}
19924 </p>
19925 !! html/parsoid
19926 <p>{{../../../../More than parent}}</p>
19927 !! end
19928
19929 !! test
19930 Definition list code coverage
19931 !! wikitext
19932 ; title : def
19933 ; title : def
19934 ;title: def
19935 !! html/php
19936 <dl><dt> title &#160;</dt>
19937 <dd> def</dd>
19938 <dt> title&#160;</dt>
19939 <dd> def</dd>
19940 <dt>title</dt>
19941 <dd> def</dd></dl>
19942
19943 !! html/parsoid
19944 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19945 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19946 <dt>title</dt><dd> def</dd></dl>
19947 !! end
19948
19949 !! test
19950 Don't fall for the self-closing div
19951 !! wikitext
19952 <div>hello world</div/>
19953 !! html
19954 <div>hello world</div>
19955
19956 !! end
19957
19958 !! test
19959 MSGNW magic word
19960 !! wikitext
19961 {{MSGNW:msg}}
19962 !! html/php
19963 <p>&#91;&#91;:Template:Msg&#93;&#93;
19964 </p>
19965 !! end
19966
19967 !! test
19968 RAW magic word
19969 !! wikitext
19970 {{RAW:QUERTY}}
19971 !! html
19972 <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>
19973 </p>
19974 !! end
19975
19976 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19977 !! test
19978 Always escape literal '>' in output, not just after '<'
19979 !! wikitext
19980 ><>
19981 !! html
19982 <p>&gt;&lt;&gt;
19983 </p>
19984 !! end
19985
19986 !! test
19987 Template caching
19988 !! wikitext
19989 {{Test}}
19990 {{Test}}
19991 !! html
19992 <p>This is a test template
19993 This is a test template
19994 </p>
19995 !! end
19996
19997
19998 !! article
19999 MediaWiki:Fake
20000 !! text
20001 ==header==
20002 !! endarticle
20003
20004 !! test
20005 Inclusion of !userCanEdit() content
20006 !! wikitext
20007 {{MediaWiki:Fake}}
20008 !! html
20009 <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>
20010
20011 !! end
20012
20013
20014 !! test
20015 Out-of-order TOC heading levels
20016 !! wikitext
20017 ==2==
20018 ======6======
20019 ===3===
20020 =1=
20021 =====5=====
20022 ==2==
20023 !! html
20024 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20025 <ul>
20026 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20027 <ul>
20028 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20029 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20030 </ul>
20031 </li>
20032 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20033 <ul>
20034 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20035 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20036 </ul>
20037 </li>
20038 </ul>
20039 </div>
20040
20041 <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>
20042 <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>
20043 <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>
20044 <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>
20045 <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>
20046 <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>
20047
20048 !! end
20049
20050
20051 !! test
20052 ISBN with a dummy number
20053 !! wikitext
20054 ISBN ---
20055 !! html
20056 <p>ISBN ---
20057 </p>
20058 !! end
20059
20060
20061 !! test
20062 ISBN with space-delimited number
20063 !! wikitext
20064 ISBN 92 9017 032 8
20065 !! html
20066 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20067 </p>
20068 !! end
20069
20070
20071 !! test
20072 ISBN with multiple spaces, no number
20073 !! wikitext
20074 ISBN foo
20075 !! html
20076 <p>ISBN foo
20077 </p>
20078 !! end
20079
20080
20081 !! test
20082 ISBN length
20083 !! wikitext
20084 ISBN 123456789
20085
20086 ISBN 1234567890
20087
20088 ISBN 12345678901
20089 !! html
20090 <p>ISBN 123456789
20091 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20092 </p><p>ISBN 12345678901
20093 </p>
20094 !! end
20095
20096
20097 !! test
20098 ISBN with trailing year (bug 8110)
20099 !! wikitext
20100 ISBN 1-234-56789-0 - 2006
20101
20102 ISBN 1 234 56789 0 - 2006
20103 !! html
20104 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20105 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20106 </p>
20107 !! end
20108
20109
20110 !! test
20111 anchorencode
20112 !! wikitext
20113 {{anchorencode:foo bar©#%n}}
20114 !! html
20115 <p>foo_bar.C2.A9.23.25n
20116 </p>
20117 !! end
20118
20119 !! test
20120 anchorencode trims spaces
20121 !! wikitext
20122 {{anchorencode: __pretty__please__}}
20123 !! html
20124 <p>pretty_please
20125 </p>
20126 !! end
20127
20128 !! test
20129 anchorencode deals with links
20130 !! wikitext
20131 {{anchorencode: [[hello|world]] [[hi]]}}
20132 !! html
20133 <p>world_hi
20134 </p>
20135 !! end
20136
20137 !! test
20138 anchorencode deals with templates
20139 !! wikitext
20140 {{anchorencode: {{Foo}} }}
20141 !! html
20142 <p>FOO
20143 </p>
20144 !! end
20145
20146 !! test
20147 anchorencode encodes like the TOC generator: (bug 18431)
20148 !! wikitext
20149 === _ +:.3A%3A&&amp;]] ===
20150 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20151 __NOEDITSECTION__
20152 !! html
20153 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20154 <p>.2B:.3A.253A.26.26.5D.5D
20155 </p>
20156 !! end
20157
20158 !! test
20159 Bug 6200: blockquotes and paragraph formatting
20160 !! wikitext
20161 <blockquote>
20162 foo
20163 </blockquote>
20164
20165 bar
20166
20167 baz
20168 !! html
20169 <blockquote>
20170 <p>foo
20171 </p>
20172 </blockquote>
20173 <p>bar
20174 </p>
20175 <pre>baz
20176 </pre>
20177 !! end
20178
20179 !! test
20180 Bug 8293: Use of center tag ruins paragraph formatting
20181 !! wikitext
20182 <center>
20183 foo
20184 </center>
20185
20186 bar
20187
20188 baz
20189 !! html
20190 <center>
20191 <p>foo
20192 </p>
20193 </center>
20194 <p>bar
20195 </p>
20196 <pre>baz
20197 </pre>
20198 !! end
20199
20200 !!test
20201 Parsing of overlapping (improperly nested) inline html tags
20202 !! wikitext
20203 <span><s>x</span></s>
20204 !! html/php
20205 <p><span><s>x&lt;/span&gt;</s></span>
20206 </p>
20207 !! html/parsoid
20208 <p><span><s>x</s></span>
20209 </p>
20210 !!end
20211
20212 ###
20213 ### Language variants related tests
20214 ###
20215 !! test
20216 Self-link in language variants
20217 !! options
20218 title=[[Dunav]] language=sr
20219 !! wikitext
20220 Both [[Dunav]] and [[Дунав]] are names for this river.
20221 !! html
20222 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20223 </p>
20224 !!end
20225
20226 !! article
20227 Дуна
20228 !! text
20229 content
20230 !! endarticle
20231
20232 !! test
20233 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20234 !! options
20235 title=[[Duna]] language=sr
20236 !! wikitext
20237 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20238 !! html
20239 <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.
20240 </p>
20241 !! end
20242
20243 !! test
20244 Link to a section of a variant of this title shouldn't be parsed as self-link
20245 !! options
20246 title=[[Duna]] language=sr
20247 !! wikitext
20248 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20249 !! html
20250 <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.
20251 </p>
20252 !! end
20253
20254 !! test
20255 Link to pages in language variants
20256 !! options
20257 language=sr
20258 !! wikitext
20259 Main Page can be written as [[Маин Паге]]
20260 !! html
20261 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20262 </p>
20263 !!end
20264
20265
20266 !! test
20267 Multiple links to pages in language variants
20268 !! options
20269 language=sr
20270 !! wikitext
20271 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20272 !! html
20273 <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>.
20274 </p>
20275 !!end
20276
20277
20278 !! test
20279 Simple template in language variants
20280 !! options
20281 language=sr
20282 !! wikitext
20283 {{тест}}
20284 !! html
20285 <p>This is a test template
20286 </p>
20287 !! end
20288
20289
20290 !! test
20291 Template with explicit namespace in language variants
20292 !! options
20293 language=sr
20294 !! wikitext
20295 {{Template:тест}}
20296 !! html
20297 <p>This is a test template
20298 </p>
20299 !! end
20300
20301
20302 !! test
20303 Basic test for template parameter in language variants
20304 !! options
20305 language=sr
20306 !! wikitext
20307 {{парамтест|param=foo}}
20308 !! html
20309 <p>This is a test template with parameter foo
20310 </p>
20311 !! end
20312
20313 !! test
20314 Simple category in language variants
20315 !! options
20316 language=sr cat
20317 !! wikitext
20318 [[Category:МедиаWики Усер'с Гуиде]]
20319 !! html/php
20320 cat=МедиаWики_Усер'с_Гуиде sort=
20321 !! html/parsoid
20322 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20323 !! end
20324
20325 !! article
20326 Category:分类
20327 !! text
20328 blah
20329 !! endarticle
20330
20331 !! article
20332 Category:分類
20333 !! text
20334 blah
20335 !! endarticle
20336
20337 ## We used to, but no longer wt2wt this test since the default serializer
20338 ## will normalize all categories to serialize on their own line.
20339 ## This wikitext usage is going to be fairly uncommon in production and
20340 ## selser will take care of preserving formatting in those scenarios.
20341 !! test
20342 Don't convert blue categorylinks to another variant (bug 33210)
20343 !! options
20344 cat
20345 language=zh
20346 parsoid=wt2html
20347 !! wikitext
20348 [[A]][[Category:分类]]
20349 !! html/php
20350 cat=分类 sort=
20351 !! html/parsoid
20352 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20353 <link rel="mw:PageProp/Category" href="Category:分类"/>
20354 !! end
20355
20356 !! test
20357 Stripping -{}- tags (language variants)
20358 !! options
20359 language=sr
20360 !! wikitext
20361 Latin proverb: -{Ne nuntium necare}-
20362 !! html
20363 <p>Latin proverb: Ne nuntium necare
20364 </p>
20365 !! end
20366
20367
20368 !! test
20369 Prevent conversion with -{}- tags (language variants)
20370 !! options
20371 language=sr variant=sr-ec
20372 !! wikitext
20373 Latinski: -{Ne nuntium necare}-
20374 !! html
20375 <p>Латински: Ne nuntium necare
20376 </p>
20377 !! end
20378
20379
20380 !! test
20381 Prevent conversion of text with -{}- tags (language variants)
20382 !! options
20383 language=sr variant=sr-ec
20384 !! wikitext
20385 Latinski: -{Ne nuntium necare}-
20386 !! html
20387 <p>Латински: Ne nuntium necare
20388 </p>
20389 !! end
20390
20391
20392 !! test
20393 Prevent conversion of links with -{}- tags (language variants)
20394 !! options
20395 language=sr variant=sr-ec
20396 !! wikitext
20397 -{[[Main Page]]}-
20398 !! html
20399 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20400 </p>
20401 !! end
20402
20403
20404 !! test
20405 -{}- tags within headlines (within html for parserConvert())
20406 !! options
20407 language=sr variant=sr-ec
20408 !! wikitext
20409 == -{Naslov}- ==
20410 !! html
20411 <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>
20412
20413 !! end
20414
20415
20416 !! test
20417 Explicit definition of language variant alternatives
20418 !! options
20419 language=zh variant=zh-tw
20420 !! wikitext
20421 -{zh:China;zh-tw:Taiwan}-, not China
20422 !! html
20423 <p>Taiwan, not China
20424 </p>
20425 !! end
20426
20427
20428 !! test
20429 Conversion around HTML tags
20430 !! options
20431 language=sr variant=sr-ec
20432 !! wikitext
20433 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20434 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20435 !! html
20436 <p>
20437 <span title="ЛаCтин">ски</span>
20438 </p>
20439 !! end
20440
20441
20442 !! test
20443 Explicit session-wise language variant mapping (A flag and - flag)
20444 !! options
20445 language=zh variant=zh-tw
20446 !! wikitext
20447 Taiwan is not China.
20448 But -{A|zh:China;zh-tw:Taiwan}- is China,
20449 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20450 and -{China}- is China.
20451 !! html
20452 <p>Taiwan is not China.
20453 But Taiwan is Taiwan,
20454 (This should be stripped!)
20455 and China is China.
20456 </p>
20457 !! end
20458
20459 !! test
20460 Explicit session-wise language variant mapping (H flag for hide)
20461 !! options
20462 language=zh variant=zh-tw
20463 !! wikitext
20464 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20465 Taiwan is China.
20466 !! html
20467 <p>(This should be stripped!)
20468 Taiwan is Taiwan.
20469 </p>
20470 !! end
20471
20472 !! test
20473 Adding explicit conversion rule for title (T flag)
20474 !! options
20475 language=zh variant=zh-tw showtitle
20476 !! wikitext
20477 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20478 !! html
20479 Taiwan
20480 <p>Should be stripped!
20481 </p>
20482 !! end
20483
20484 !! test
20485 Testing that changing the language variant here in the tests actually works
20486 !! options
20487 language=zh variant=zh showtitle
20488 !! wikitext
20489 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20490 !! html
20491 China
20492 <p>Should be stripped!
20493 </p>
20494 !! end
20495
20496 !! test
20497 Recursive conversion of alt and title attrs shouldn't clear converter state
20498 !! options
20499 language=zh variant=zh-cn showtitle
20500 !! wikitext
20501 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20502 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20503 !! html
20504 China
20505 <p>
20506 Should be stripped<span title="Exclamation">!</span>
20507 </p>
20508 !! end
20509
20510 !! test
20511 Bug 24072: more test on conversion rule for title
20512 !! options
20513 language=zh variant=zh-tw showtitle
20514 !! wikitext
20515 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20516 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20517 !! html
20518 Taiwan
20519 <p>This should be stripped!
20520 This won't take interferes with the title rule.
20521 </p>
20522 !! end
20523
20524 !! test
20525 Partly disable title conversion if variant == main language code
20526 !! options
20527 language=zh variant=zh title=[[ZH]] showtitle
20528 !! wikitext
20529 -{T|zh-cn:CN;zh-tw:TW}-
20530 !! html
20531 ZH
20532 <p>
20533 </p>
20534 !! end
20535
20536 !! test
20537 Partly disable title conversion if variant == main language code, more
20538 !! options
20539 language=zh variant=zh title=[[ZH]] showtitle
20540 !! wikitext
20541 -{T|TW}-
20542 !! html
20543 ZH
20544 <p>
20545 </p>
20546 !! end
20547
20548 !! test
20549 Raw output of variant escape tags (R flag)
20550 !! options
20551 language=zh variant=zh-tw
20552 !! wikitext
20553 Raw: -{R|zh:China;zh-tw:Taiwan}-
20554 !! html
20555 <p>Raw: zh:China;zh-tw:Taiwan
20556 </p>
20557 !! end
20558
20559 !! test
20560 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20561 !! options
20562 language=zh variant=zh-cn
20563 !! input
20564 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20565 !! result
20566 <p>0
20567 </p>
20568 !! end
20569
20570 !! test
20571 Conversion rules from [numeric-only string] to [something else] (T48634)
20572 !! options
20573 language=zh variant=zh-cn
20574 !! input
20575 -{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
20576 !! result
20577 <p>D12345EE12345
20578 </p>
20579 !! end
20580
20581 !! test
20582 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20583 !! options
20584 language=zh variant=zh-cn
20585 !! input
20586 -{H|zh-cn:foo;zh-tw:;}-foobar
20587 !! result
20588 <p>foobar
20589 </p>
20590 !! end
20591
20592 !! test
20593 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20594 !! options
20595 language=zh variant=zh-cn
20596 !! input
20597 -{H|=>zh-cn:foo;}-foobar
20598 !! result
20599 <p>foobar
20600 </p>
20601 !! end
20602
20603 !! test
20604 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20605 !! options
20606 language=zh variant=zh-cn
20607 !! input
20608 -{H|}-foobar
20609 !! result
20610 <p>foobar
20611 </p>
20612 !! end
20613
20614 !! test
20615 Nested using of manual convert syntax
20616 !! options
20617 language=zh variant=zh-hk
20618 !! wikitext
20619 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20620 !! html
20621 <p>Nested: Hello Hong Kong!
20622 </p>
20623 !! end
20624
20625 # Since Parsoid is starting to emit canonical wikitext for links,
20626 # [http://example.com http://example.com] will not RT back to that
20627 # form anymore.
20628 !! test
20629 HTML markups with conversion syntax in attribs, nested in other conversion blocks
20630 !! options
20631 language=zh variant=zh-cn
20632 !! wikitext
20633 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
20634 !! html
20635 <p><span title="X">A</span>
20636 </p>
20637 !! end
20638
20639 !! test
20640 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet)
20641 !! options
20642 language=zh variant=zh-cn disabled
20643 !! wikitext
20644 -{<span title="-{X}-">A</span>}-
20645 !! html
20646 <p><span title="X">A</span>
20647 </p>
20648 !! end
20649
20650 !! test
20651 Proper conversion of text in external links
20652 !! options
20653 language=sr variant=sr-ec
20654 parsoid=wt2html
20655 !! wikitext
20656 http://www.google.com
20657 gopher://www.google.com
20658 [http://www.google.com http://www.google.com]
20659 [gopher://www.google.com gopher://www.google.com]
20660 [https://www.google.com irc://www.google.com]
20661 [ftp://www.google.com www.google.com/ftp://dir]
20662 [//www.google.com www.google.com]
20663 !! html/php
20664 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20665 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20666 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20667 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20668 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20669 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20670 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20671 </p>
20672 !! html/parsoid
20673 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20674 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20675 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20676 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20677 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20678 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20679 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20680 !! end
20681
20682 !! test
20683 Do not convert roman numbers to language variants
20684 !! options
20685 language=sr variant=sr-ec
20686 !! wikitext
20687 Fridrih IV je car.
20688 !! html
20689 <p>Фридрих IV је цар.
20690 </p>
20691 !! end
20692
20693 !! test
20694 Unclosed language converter markup "-{"
20695 !! options
20696 language=sr
20697 !! wikitext
20698 -{T|hello
20699 !! html
20700 <p>-{T|hello
20701 </p>
20702 !! end
20703
20704 !! test
20705 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20706 !! options
20707 language=sr
20708 !! wikitext
20709 -{R|=&gt;}-
20710 !! html
20711 <p>=&gt;
20712 </p>
20713 !!end
20714
20715 !! test
20716 Don't break link parsing if language converter markup is in the caption.
20717 !! options
20718 language=sr variant=sr-ec
20719 !! wikitext
20720 [[Main Page|-{R|main page}-]]
20721 !! html
20722 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20723 </p>
20724 !! end
20725
20726 # FIXME: This test is currently broken in the PHP parser T153761
20727 !! test
20728 T146304: Don't break template parsing if language converter markup is in the parameter.
20729 !! options
20730 language=sr variant=sr-ec
20731 disabled
20732 !! wikitext
20733 {{echo|-{R|foo}-}}
20734 !! html/php
20735 <p>foo
20736 </p>
20737 !! end
20738
20739 !! test
20740 T146305: Don't break image parsing if language converter markup is in the caption.
20741 !! options
20742 language=sr
20743 !! wikitext
20744 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20745 !! html/php
20746 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="internal" title="Повећај"></a></div>caption:</div></div></div>
20747
20748 !! html/parsoid
20749 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./Датотека:Foobar.jpg"><img resource="./Датотека:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"caption:"}'></span></figcaption></figure>
20750 !! end
20751
20752 !! test
20753 T146305: Don't break image parsing if nested language converter markup is in the caption.
20754 !! options
20755 language=zh variant=zh-cn
20756 !! wikitext
20757 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20758 !! html/php
20759 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="放大"></a></div>blog (hk: WEBJOURNAL, tw: WEBLOG)</div></div></div>
20760
20761 !! html/parsoid
20762 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"blog (hk: &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[42,64,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBJOURNAL\"}&#39;>&lt;/span>, tw: &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[70,88,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBLOG\"}&#39;>&lt;/span>)"}],"show":true}'></span></figcaption></figure>
20763 !! end
20764
20765 !! test
20766 Don't break gallery if language converter markup is inside.
20767 !! options
20768 language=zh
20769 !! wikitext
20770 <gallery>
20771 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20772 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20773 </gallery>
20774 !! html
20775 <ul class="gallery mw-gallery-traditional">
20776 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20777 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="bat" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20778 <div class="gallerytext">
20779 <p><a href="/wiki/File:Foobar.jpg" class="image" title="bar"><img alt="foo" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
20780 </p>
20781 </div>
20782 </div></li>
20783 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20784 <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>
20785 <div class="gallerytext">
20786 <p>This is a test template
20787 </p>
20788 </div>
20789 </div></li>
20790 </ul>
20791
20792 !! end
20793
20794 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20795 !! test
20796 Don't break list handling if language converter markup is in the item.
20797 !! options
20798 language=zh variant=zh-cn
20799 !! wikitext
20800 ;-{zh-cn:AAA;zh-tw:BBB}-
20801 !! html/php
20802 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20803
20804 !! html/parsoid
20805 <dl><dt>AAA
20806 </dt></dl>
20807 !! end
20808
20809 !! test
20810 T153140: Don't break table handling if language converter markup is in the cell.
20811 !! options
20812 language=sr variant=sr-ec
20813 !! wikitext
20814 {|
20815 |-
20816 | -{R|B}-
20817 |}
20818 !! html/php
20819 <table>
20820
20821 <tr>
20822 <td> B
20823 </td></tr></table>
20824
20825 !! html/parsoid
20826 <table>
20827
20828 <tr>
20829 <td> B
20830 </td></tr></table>
20831
20832 !! end
20833
20834 !! test
20835 Bug 529: Uncovered bullet
20836 !! wikitext
20837 * Foo {{bullet}}
20838 !! html
20839 <ul><li> Foo </li>
20840 <li> Bar</li></ul>
20841
20842 !! end
20843
20844 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20845 # Templates in Wikipedia rely on this behavior, as tidy has always been
20846 # enabled there. These tests are normally run *without* tidy, so specify the
20847 # full output here.
20848 # To test realistic parsing behavior, apply a tidy-like transformation to both
20849 # the expected output and your parser's output.
20850 !! test
20851 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20852 !! wikitext
20853 ******* Foo {{bullet}}
20854 !! html
20855 <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>
20856 <li> Bar</li></ul>
20857
20858 !! end
20859
20860 !! test
20861 Bug 529: Uncovered table already at line-start
20862 !! wikitext
20863 x
20864
20865 {{table}}
20866 y
20867 !! html
20868 <p>x
20869 </p>
20870 <table>
20871 <tr>
20872 <td> 1 </td>
20873 <td> 2
20874 </td></tr>
20875 <tr>
20876 <td> 3 </td>
20877 <td> 4
20878 </td></tr></table>
20879 <p>y
20880 </p>
20881 !! end
20882
20883 !! test
20884 Bug 529: Uncovered bullet in parser function result
20885 !! wikitext
20886 * Foo {{lc:{{bullet}} }}
20887 !! html
20888 <ul><li> Foo </li>
20889 <li> bar</li></ul>
20890
20891 !! end
20892
20893 !! test
20894 Bug 5678: Double-parsed template argument
20895 !! wikitext
20896 {{lc:{{{1}}}|hello}}
20897 !! html
20898 <p>{{{1}}}
20899 </p>
20900 !! end
20901
20902 !! test
20903 Bug 5678: Double-parsed template invocation
20904 !! wikitext
20905 {{lc:{{paramtest {{!}} param = hello }} }}
20906 !! html
20907 <p>{{paramtest | param = hello }}
20908 </p>
20909 !! end
20910
20911 !! test
20912 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20913 !! options
20914 language=cs
20915 title=[[Main Page]]
20916 !! wikitext
20917 {{PRVNÍVELKÉ:ěščř}}
20918 {{prvnívelké:ěščř}}
20919 {{PRVNÍMALÉ:ěščř}}
20920 {{prvnímalé:ěščř}}
20921 {{MALÁ:ěščř}}
20922 {{malá:ěščř}}
20923 {{VELKÁ:ěščř}}
20924 {{velká:ěščř}}
20925 !! html
20926 <p>Ěščř
20927 Ěščř
20928 ěščř
20929 ěščř
20930 ěščř
20931 ěščř
20932 ĚŠČŘ
20933 ĚŠČŘ
20934 </p>
20935 !! end
20936
20937 !! test
20938 Morwen/13: Unclosed link followed by heading
20939 !! wikitext
20940 [[link
20941 ==heading==
20942 !! html
20943 <p>[[link
20944 </p>
20945 <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>
20946
20947 !! end
20948
20949 !! test
20950 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20951 !! wikitext
20952 {{foo|
20953 =heading=
20954 !! html
20955 <p>{{foo|
20956 </p>
20957 <h1><span class="mw-headline" id="heading">heading</span></h1>
20958
20959 !! end
20960
20961 !! test
20962 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20963 !! wikitext
20964 {{foo|
20965 ==heading==
20966 !! html
20967 <p>{{foo|
20968 </p>
20969 <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>
20970
20971 !! end
20972
20973 !! test
20974 Tildes in comments
20975 !! options
20976 pst
20977 !! wikitext
20978 <!-- ~~~~ -->
20979 !! html/php
20980 <!-- ~~~~ -->
20981 !! end
20982
20983 !! test
20984 Paragraphs inside divs (no extra line breaks)
20985 !! wikitext
20986 <div>Line one
20987
20988 Line two</div>
20989 !! html
20990 <div>Line one
20991 Line two</div>
20992
20993 !! end
20994
20995 !! test
20996 Paragraphs inside divs (extra line break on open)
20997 !! wikitext
20998 <div>
20999 Line one
21000
21001 Line two</div>
21002 !! html
21003 <div>
21004 <p>Line one
21005 </p>
21006 Line two</div>
21007
21008 !! end
21009
21010 !! test
21011 Paragraphs inside divs (extra line break on close)
21012 !! wikitext
21013 <div>Line one
21014
21015 Line two
21016 </div>
21017 !! html
21018 <div>Line one
21019 <p>Line two
21020 </p>
21021 </div>
21022
21023 !! end
21024
21025 !! test
21026 Paragraphs inside divs (extra line break on open and close)
21027 !! wikitext
21028 <div>
21029 Line one
21030
21031 Line two
21032 </div>
21033 !! html
21034 <div>
21035 <p>Line one
21036 </p><p>Line two
21037 </p>
21038 </div>
21039
21040 !! end
21041
21042 !! test
21043 Nesting tags, paragraphs on lines which begin with <div>
21044 !! wikitext
21045 <div></div><strong>A
21046 B</strong>
21047 !! html/php+tidy
21048 <p><strong>A</strong></p>
21049 <p><strong>B</strong></p>
21050 !! html/parsoid
21051 <div></div>
21052 <p><strong>A
21053 B</strong>
21054 </p>
21055 !! end
21056
21057 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
21058 !! test
21059 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
21060 !! wikitext
21061 <blockquote>Line one
21062
21063 Line two</blockquote>
21064 !! html
21065 <blockquote>Line one
21066 Line two</blockquote>
21067
21068 !! html+tidy
21069 <blockquote>
21070 <p>Line one Line two</p>
21071 </blockquote>
21072 !! end
21073
21074 !! test
21075 Bug 6200: paragraphs inside blockquotes (extra line break on open)
21076 !! wikitext
21077 <blockquote>
21078 Line one
21079
21080 Line two</blockquote>
21081 !! html
21082 <blockquote>
21083 <p>Line one
21084 </p>
21085 Line two</blockquote>
21086
21087 !! html+tidy
21088 <blockquote>
21089 <p>Line one</p>
21090 Line two</blockquote>
21091 !! end
21092
21093 !! test
21094 Bug 6200: paragraphs inside blockquotes (extra line break on close)
21095 !! wikitext
21096 <blockquote>Line one
21097
21098 Line two
21099 </blockquote>
21100 !! html
21101 <blockquote>Line one
21102 <p>Line two
21103 </p>
21104 </blockquote>
21105
21106 !! html+tidy
21107 <blockquote>
21108 <p>Line one</p>
21109 <p>Line two</p>
21110 </blockquote>
21111 !! end
21112
21113 !! test
21114 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21115 !! wikitext
21116 <blockquote>
21117 Line one
21118
21119 Line two
21120 </blockquote>
21121 !! html
21122 <blockquote>
21123 <p>Line one
21124 </p><p>Line two
21125 </p>
21126 </blockquote>
21127
21128 !! html+tidy
21129 <blockquote>
21130 <p>Line one</p>
21131 <p>Line two</p>
21132 </blockquote>
21133 !! end
21134
21135 !! test
21136 Paragraphs inside blockquotes/divs (no extra line breaks)
21137 !! wikitext
21138 <blockquote><div>Line one
21139
21140 Line two</div></blockquote>
21141 !! html
21142 <blockquote><div>Line one
21143 Line two</div></blockquote>
21144
21145 !! end
21146
21147 !! test
21148 Paragraphs inside blockquotes/divs (extra line break on open)
21149 !! wikitext
21150 <blockquote><div>
21151 Line one
21152
21153 Line two</div></blockquote>
21154 !! html
21155 <blockquote><div>
21156 <p>Line one
21157 </p>
21158 Line two</div></blockquote>
21159
21160 !! end
21161
21162 !! test
21163 Paragraphs inside blockquotes/divs (extra line break on close)
21164 !! wikitext
21165 <blockquote><div>Line one
21166
21167 Line two
21168 </div></blockquote>
21169 !! html
21170 <blockquote><div>Line one
21171 <p>Line two
21172 </p>
21173 </div></blockquote>
21174
21175 !! end
21176
21177 !! test
21178 Paragraphs inside blockquotes/divs (extra line break on open and close)
21179 !! wikitext
21180 <blockquote><div>
21181 Line one
21182
21183 Line two
21184 </div></blockquote>
21185 !! html
21186 <blockquote><div>
21187 <p>Line one
21188 </p><p>Line two
21189 </p>
21190 </div></blockquote>
21191
21192 !! end
21193
21194 !! test
21195 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21196 !! options
21197 wgLinkHolderBatchSize=0
21198 !! wikitext
21199 [[meatball:1]]
21200 [[meatball:2]]
21201 [[meatball:3]]
21202 !! html
21203 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21204 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21205 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21206 </p>
21207 !! end
21208
21209 !! test
21210 Free external link invading image caption
21211 !! wikitext
21212 [[Image:Foobar.jpg|thumb|http://x|hello]]
21213 !! html
21214 <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>
21215
21216 !! end
21217
21218 !! test
21219 Bug 15196: localised external link numbers
21220 !! options
21221 language=fa
21222 !! wikitext
21223 [http://en.wikipedia.org/]
21224 !! html/php
21225 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21226 </p>
21227 !! html/parsoid
21228 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21229 !! end
21230
21231 !! test
21232 Multibyte character in padleft
21233 !! wikitext
21234 {{padleft:-Hello|7|Æ}}
21235 !! html
21236 <p>Æ-Hello
21237 </p>
21238 !! end
21239
21240 !! test
21241 Multibyte character in padright
21242 !! wikitext
21243 {{padright:Hello-|7|Æ}}
21244 !! html
21245 <p>Hello-Æ
21246 </p>
21247 !! end
21248
21249 !!test
21250 formatdate parser function
21251 !! wikitext
21252 {{#formatdate:2009-03-24}}
21253 !! html
21254 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21255 </p>
21256 !! end
21257
21258 !!test
21259 formatdate parser function, with default format
21260 !! wikitext
21261 {{#formatdate:2009-03-24|mdy}}
21262 !! html
21263 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21264 </p>
21265 !! end
21266
21267 !! test
21268 Spacing of numbers in formatted dates
21269 !! wikitext
21270 {{#formatdate:January 15}}
21271 !! html
21272 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21273 </p>
21274 !! end
21275
21276 !! test
21277 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
21278 !! options
21279 language=nl title=[[MediaWiki:Common.css]]
21280 !! wikitext
21281 {{#formatdate:2009-03-24|dmy}}
21282 !! html
21283 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21284 </p>
21285 !! end
21286
21287 #
21288 #
21289 #
21290
21291 #
21292 # Edit comments
21293 #
21294
21295 !! test
21296 Edit comment with link
21297 !! options
21298 comment
21299 !! wikitext
21300 I like the [[Main Page]] a lot
21301 !! html/php
21302 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21303 !!end
21304
21305 !! test
21306 Edit comment with link and link text
21307 !! options
21308 comment
21309 !! wikitext
21310 I like the [[Main Page|best pages]] a lot
21311 !! html/php
21312 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21313 !!end
21314
21315 !! test
21316 Edit comment with link and link text with suffix
21317 !! options
21318 comment
21319 !! wikitext
21320 I like the [[Main Page|best page]]s a lot
21321 !! html/php
21322 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21323 !!end
21324
21325 !! test
21326 Edit comment with section link (non-local, eg in history list)
21327 !! options
21328 comment title=[[Main Page]]
21329 !! wikitext
21330 /* External links */ removed bogus entries
21331 !! html/php
21332 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21333 !!end
21334
21335 !! test
21336 Edit comment with section link and text before it (non-local, eg in history list)
21337 !! options
21338 comment title=[[Main Page]]
21339 !! wikitext
21340 pre-comment text /* External links */ removed bogus entries
21341 !! html/php
21342 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>
21343 !!end
21344
21345 !! test
21346 Edit comment with section link (local, eg in diff view)
21347 !! options
21348 comment local title=[[Main Page]]
21349 !! wikitext
21350 /* External links */ removed bogus entries
21351 !! html/php
21352 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21353 !!end
21354
21355 !! test
21356 Edit comment with subpage link (bug 14080)
21357 !! options
21358 comment
21359 subpage
21360 title=[[Subpage test]]
21361 !! wikitext
21362 Poked at a [[/subpage]] here...
21363 !! html/php
21364 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21365 !!end
21366
21367 !! test
21368 Edit comment with subpage link and link text (bug 14080)
21369 !! options
21370 comment
21371 subpage
21372 title=[[Subpage test]]
21373 !! wikitext
21374 Poked at a [[/subpage|neat little page]] here...
21375 !! html/php
21376 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21377 !!end
21378
21379 !! test
21380 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21381 !! options
21382 comment
21383 title=[[Subpage test]]
21384 !! wikitext
21385 Poked at a [[/subpage]] here...
21386 !! html/php
21387 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...
21388 !!end
21389
21390 !! test
21391 Edit comment with bare anchor link (local, as on diff)
21392 !! options
21393 comment
21394 local
21395 title=[[Main Page]]
21396 !! wikitext
21397 [[#section]]
21398 !! html/php
21399 <a href="#section">#section</a>
21400 !! end
21401
21402 !! test
21403 Edit comment with bare anchor link (non-local, as on history)
21404 !! options
21405 comment
21406 title=[[Main Page]]
21407 !! wikitext
21408 [[#section]]
21409 !! html/php
21410 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21411 !! end
21412
21413 !! test
21414 Anchor starting with underscore
21415 !! options
21416 title=[[Foo]]
21417 !! wikitext
21418 [[#_ref|One]]
21419 !! html/php
21420 <p><a href="#_ref">One</a>
21421 </p>
21422 !! html/parsoid
21423 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21424 !! end
21425
21426 !! test
21427 Id starting with underscore
21428 !! wikitext
21429 <div id="_ref"></div>
21430 !! html/*
21431 <div id="_ref"></div>
21432
21433 !! end
21434
21435 !! test
21436 Edit comment with link with more than one pipe (T99346)
21437 !! options
21438 comment
21439 !! wikitext
21440 [[Main Page|Many|pipes]]
21441 !! html/php
21442 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21443 !! end
21444
21445 !! test
21446 Complex edit comment with link with more than one pipe (T99346)
21447 !! options
21448 comment
21449 !! wikitext
21450 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21451 !! html/php
21452 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;
21453 !! end
21454
21455 !! test
21456 Space normalisation on autocomment (bug 22784)
21457 !! options
21458 comment
21459 title=[[Main Page]]
21460 !! wikitext
21461 /* __hello__world__ */
21462 !! html/php
21463 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21464 !! end
21465
21466 !! test
21467 percent-encoding and + signs in comments (Bug 26410)
21468 !! options
21469 comment
21470 !! wikitext
21471 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21472 !! html/php
21473 <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>
21474 !! end
21475
21476 # Parsoid doesn't support this yet: see bug 73581
21477 # but it *should* omit the 'src' attribute if the image is bad.
21478 # PHP side of tests was disabled in
21479 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21480 # because of issues in the PHP parserTests infrastructure
21481 # (but the output below is indeed what the PHP side emits)
21482 !! test
21483 Bad images - basic functionality
21484 !! wikitext
21485 [[File:Bad.jpg]]
21486 !! DISABLED/html/php
21487 !! html/parsoid
21488 <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>
21489 !! end
21490
21491 !! test
21492 Bad images - bug 16039: text after bad image disappears
21493 !! wikitext
21494 Foo bar
21495 [[File:Bad.jpg]]
21496 Bar foo
21497 !! DISABLED/html/php
21498 <p>Foo bar
21499 </p><p>Bar foo
21500 </p>
21501 !! html/parsoid
21502 <p>Foo bar
21503 <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>
21504 Bar foo</p>
21505 !! end
21506
21507 !! test
21508 Verify that displaytitle works (bug #22501) no displaytitle
21509 !! options
21510 showtitle
21511 !! config
21512 wgAllowDisplayTitle=true
21513 wgRestrictDisplayTitle=false
21514 !! wikitext
21515 this is not the the title
21516 !! html/php
21517 Parser test
21518 <p>this is not the the title
21519 </p>
21520 !! end
21521
21522 !! test
21523 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21524 !! options
21525 showtitle
21526 title=[[Screen]]
21527 !! config
21528 wgAllowDisplayTitle=true
21529 wgRestrictDisplayTitle=false
21530 !! wikitext
21531 this is not the the title
21532 {{DISPLAYTITLE:whatever}}
21533 !! html/php
21534 whatever
21535 <p>this is not the the title
21536 </p>
21537 !! end
21538
21539 !! test
21540 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21541 !! options
21542 showtitle
21543 title=[[Screen]]
21544 !! config
21545 wgAllowDisplayTitle=true
21546 wgRestrictDisplayTitle=true
21547 !! wikitext
21548 this is not the the title
21549 {{DISPLAYTITLE:whatever}}
21550 !! html/php
21551 Screen
21552 <p>this is not the the title
21553 </p>
21554 !! end
21555
21556 !! test
21557 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21558 !! options
21559 showtitle
21560 title=[[Screen]]
21561 !! config
21562 wgAllowDisplayTitle=true
21563 wgRestrictDisplayTitle=true
21564 !! wikitext
21565 this is not the the title
21566 {{DISPLAYTITLE:screen}}
21567 !! html/php
21568 screen
21569 <p>this is not the the title
21570 </p>
21571 !! end
21572
21573 !! test
21574 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21575 !! options
21576 showtitle
21577 title=[[Screen]]
21578 !! config
21579 wgAllowDisplayTitle=false
21580 !! wikitext
21581 this is not the the title
21582 {{DISPLAYTITLE:screen}}
21583 !! html/php
21584 Screen
21585 <p>this is not the the title
21586 <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>
21587 </p>
21588 !! end
21589
21590 !! test
21591 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21592 !! options
21593 showtitle
21594 title=[[Screen]]
21595 !! config
21596 wgAllowDisplayTitle=false
21597 !! wikitext
21598 this is not the the title
21599 !! html/php
21600 Screen
21601 <p>this is not the the title
21602 </p>
21603 !! end
21604
21605 !! test
21606 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21607 !! options
21608 showtitle
21609 title=[[Screen]]
21610 !! config
21611 wgAllowDisplayTitle=true
21612 wgRestrictDisplayTitle=true
21613 !! wikitext
21614 this is not the the title
21615 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21616 !! html/php
21617 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21618 <p>this is not the the title
21619 </p>
21620 !! end
21621
21622 !! test
21623 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21624 !! options
21625 showtitle
21626 title=[[Screen]]
21627 !! config
21628 wgAllowDisplayTitle=true
21629 wgRestrictDisplayTitle=true
21630 !! wikitext
21631 this is not the the title
21632 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21633 !! html/php
21634 <span style="color: red;">s</span>creen
21635 <p>this is not the the title
21636 </p>
21637 !! end
21638
21639 !! test
21640 Page status indicators: Empty name is invalid
21641 !! options
21642 showindicators
21643 !! wikitext
21644 <indicator name=" "></indicator>
21645 <indicator></indicator>
21646 !! html
21647 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21648 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21649 </p>
21650 !! end
21651
21652 !! test
21653 Page status indicators: Weird syntaxes that are okay
21654 !! options
21655 showindicators
21656 !! wikitext
21657 <indicator name="empty" />
21658 <indicator name="name"></indicator>
21659 !! html
21660 empty=
21661 name=
21662 <p><br />
21663 </p>
21664 !! end
21665
21666 !! test
21667 Page status indicators: Torture test
21668 !! options
21669 showindicators
21670 !! wikitext
21671 <indicator name="01">hello world</indicator>
21672 <indicator name="02">[[Main Page]]</indicator>
21673 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21674 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21675 <indicator name="05">* foo
21676 * bar</indicator>
21677 <indicator name="06"><nowiki>foo</nowiki></indicator>
21678 <indicator name="07"> Preformatted</indicator>
21679 <indicator name="08"><div>Broken tag</indicator>
21680 <indicator name="09">{| class=wikitable
21681 | cell
21682 |}</indicator>
21683 <indicator name="10">Two
21684
21685 paragraphs</indicator>
21686 !! html
21687 01=hello world
21688 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21689 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" />
21690 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>
21691 05=<ul><li> foo</li>
21692 <li> bar</li></ul>
21693
21694 06=foo
21695 07=<pre>Preformatted
21696 </pre>
21697 08=<div>Broken tag</div>
21698
21699 09=<table class="wikitable">
21700 <tr>
21701 <td> cell
21702 </td></tr></table>
21703
21704 10=<p>Two
21705 </p><p>paragraphs
21706 </p>
21707 <p><br />
21708 </p><p><br />
21709 </p><p><br />
21710 </p><p><br />
21711 </p><p><br />
21712 </p>
21713 !! end
21714
21715 !! test
21716 preload: check <noinclude> and <includeonly>
21717 !! options
21718 preload
21719 !! wikitext
21720 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21721 !! html/php
21722 Hello kind world.
21723 !! end
21724
21725 !! test
21726 preload: check <onlyinclude>
21727 !! options
21728 preload
21729 !! wikitext
21730 Goodbye <onlyinclude>Hello world</onlyinclude>
21731 !! html/php
21732 Hello world
21733 !! end
21734
21735 !! test
21736 preload: can pass tags through if we want to
21737 !! options
21738 preload
21739 !! wikitext
21740 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21741 !! html/php
21742 <includeonly>Hello world</includeonly>
21743 !! end
21744
21745 !! test
21746 preload: check that it doesn't try to do tricks
21747 !! options
21748 preload
21749 !! wikitext
21750 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21751 !! html/php
21752 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21753 !! end
21754
21755 !! test
21756 Play a bit with r67090 and bug 3158
21757 !! wikitext
21758 <div style="width:50% !important">&nbsp;</div>
21759 <div style="width:50%&nbsp;!important">&nbsp;</div>
21760 <div style="width:50%&#160;!important">&nbsp;</div>
21761 <div style="border : solid;">&nbsp;</div>
21762 !! html/php
21763 <div style="width:50% !important">&#160;</div>
21764 <div style="width:50% !important">&#160;</div>
21765 <div style="width:50% !important">&#160;</div>
21766 <div style="border&#160;: solid;">&#160;</div>
21767
21768 !! html/parsoid
21769 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21770 <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>
21771 <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>
21772 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21773
21774 !! end
21775
21776 !! test
21777 HTML5 data attributes
21778 !! wikitext
21779 <span data-foo="bar">Baz</span>
21780 <p data-abc-def_hij="">Quuz</p>
21781 !! html/php
21782 <p><span data-foo="bar">Baz</span>
21783 </p>
21784 <p data-abc-def_hij="">Quuz</p>
21785
21786 !! html/parsoid
21787 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21788 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21789 !! end
21790
21791 !! test
21792 Strip reserved data attributes
21793 !! wikitext
21794 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21795 !! html/php
21796 <div data-ok="fred">d</div>
21797
21798 !! html/parsoid
21799 <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>
21800 !! end
21801
21802 !! test
21803 percent-encoding and + signs in internal links (Bug 26410)
21804 !! wikitext
21805 [[User:+%]] [[Page+title%]]
21806 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21807 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21808 [[%33%45]] [[%33%45+]]
21809 !! html/php
21810 <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>
21811 <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>
21812 <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>
21813 <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>
21814 </p>
21815 !! html/parsoid
21816 <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>
21817 <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>
21818 <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>
21819 <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>
21820 !! end
21821
21822 !! test
21823 Special characters in embedded file links (bug 27679)
21824 !! wikitext
21825 [[File:Contains & ampersand.jpg]]
21826 [[File:Does not exist.jpg|Title with & ampersand]]
21827 !! html/php
21828 <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>
21829 <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>
21830 </p>
21831 !! html/parsoid
21832 <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>
21833 <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>
21834 !! end
21835
21836 !! test
21837 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21838 !! wikitext
21839 Text&apos;s been normalized?
21840 !! html
21841 <p>Text&#39;s been normalized?
21842 </p>
21843 !! end
21844
21845 !! test
21846 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21847 !! wikitext
21848 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21849 !! html
21850 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21851 </p>
21852 !! end
21853
21854 !! test
21855 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21856 !! wikitext
21857 [http://www.example.org/ ideograms]
21858 !! html
21859 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21860 </p>
21861 !! end
21862
21863 !! test
21864 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21865 !! wikitext
21866 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21867 !! html
21868 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21869 </p>
21870 !! end
21871
21872 !! article
21873 Mediawiki:loop1
21874 !! text
21875 {{Identical|A}}
21876 !! endarticle
21877
21878 !! article
21879 Mediawiki:loop2
21880 !! text
21881 {{Identical|B}}
21882 !! endarticle
21883
21884 !! article
21885 Template:Identical
21886 !! text
21887 {{int:loop1}}
21888 {{int:loop2}}
21889 !! endarticle
21890
21891 !! test
21892 Bug 31098 Template which includes system messages which includes the template
21893 !! wikitext
21894 {{Identical}}
21895 !! html
21896 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21897 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21898 </p>
21899 !! end
21900
21901 !! test
21902 Bug31490 Turkish: ucfirst 'blah'
21903 !! options
21904 language=tr
21905 !! wikitext
21906 {{ucfirst:blah}}
21907 !! html
21908 <p>Blah
21909 </p>
21910 !! end
21911
21912 !! test
21913 Bug31490 Turkish: ucfirst 'ix'
21914 !! options
21915 language=tr
21916 !! wikitext
21917 {{ucfirst:ix}}
21918 !! html
21919 <p>İx
21920 </p>
21921 !! end
21922
21923 !! test
21924 Bug31490 Turkish: lcfirst 'BLAH'
21925 !! options
21926 language=tr
21927 !! wikitext
21928 {{lcfirst:BLAH}}
21929 !! html
21930 <p>bLAH
21931 </p>
21932 !! end
21933
21934 !! test
21935 Bug31490 Turkish: ucfırst (with a dotless i)
21936 !! options
21937 language=tr
21938 !! wikitext
21939 {{ucfırst:blah}}
21940 !! html
21941 <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>
21942 </p>
21943 !! end
21944
21945 !! test
21946 Bug31490 ucfırst (with a dotless i) with English language
21947 !! options
21948 language=en
21949 !! wikitext
21950 {{ucfırst:blah}}
21951 !! html
21952 <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>
21953 </p>
21954 !! end
21955
21956 !! test
21957 Bug 26375: TOC with italics
21958 !! options
21959 title=[[Main Page]]
21960 !! wikitext
21961 __TOC__
21962 == ''Lost'' episodes ==
21963 !! html
21964 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21965 <ul>
21966 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
21967 </ul>
21968 </div>
21969
21970 <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>
21971
21972 !! end
21973
21974 !! test
21975 Bug 26375: TOC with bold
21976 !! options
21977 title=[[Main Page]]
21978 !! wikitext
21979 __TOC__
21980 == '''should be bold''' then normal text ==
21981 !! html
21982 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21983 <ul>
21984 <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>
21985 </ul>
21986 </div>
21987
21988 <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>
21989
21990 !! end
21991
21992 !! test
21993 Bug 33845: Headings become cursive in TOC when they contain an image
21994 !! options
21995 title=[[Main Page]]
21996 !! wikitext
21997 __TOC__
21998 == Image [[Image:foobar.jpg]] ==
21999 !! html
22000 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22001 <ul>
22002 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
22003 </ul>
22004 </div>
22005
22006 <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>
22007
22008 !! end
22009
22010 !! test
22011 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
22012 !! options
22013 title=[[Main Page]]
22014 !! wikitext
22015 __TOC__
22016 == <blockquote>Quote</blockquote> ==
22017 !! html
22018 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22019 <ul>
22020 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22021 </ul>
22022 </div>
22023
22024 <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>
22025
22026 !! html+tidy
22027 <p></p>
22028 <div id="toc" class="toc">
22029 <div id="toctitle">
22030 <h2>Contents</h2>
22031 </div>
22032 <ul>
22033 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
22034 </ul>
22035 </div>
22036 <p></p>
22037 <h2><span class="mw-headline" id="Quote"></span></h2>
22038 <blockquote>
22039 <p><span class="mw-headline" id="Quote">Quote</span></p>
22040 </blockquote>
22041 <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>
22042 !! end
22043
22044 !! test
22045 Unclosed tags in TOC
22046 !! options
22047 title=[[Main Page]]
22048 !! wikitext
22049 __TOC__
22050 == Proof: 2 < 3 ==
22051 <small>Hanc marginis exiguitas non caperet.</small>
22052 QED
22053 !! html
22054 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22055 <ul>
22056 <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>
22057 </ul>
22058 </div>
22059
22060 <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>
22061 <p><small>Hanc marginis exiguitas non caperet.</small>
22062 QED
22063 </p>
22064 !! end
22065
22066 !! test
22067 Multiple tags in TOC
22068 !! wikitext
22069 __TOC__
22070 == <i>Foo</i> <b>Bar</b> ==
22071
22072 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22073 !! html
22074 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22075 <ul>
22076 <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>
22077 <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>
22078 </ul>
22079 </div>
22080
22081 <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>
22082 <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>
22083
22084 !! html+tidy
22085 <p></p>
22086 <div id="toc" class="toc">
22087 <div id="toctitle">
22088 <h2>Contents</h2>
22089 </div>
22090 <ul>
22091 <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>
22092 <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>
22093 </ul>
22094 </div>
22095 <p></p>
22096 <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>
22097 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22098 <blockquote>
22099 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22100 </blockquote>
22101 <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>
22102 !! end
22103
22104 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22105 # html5 tag parsing.
22106 !! test
22107 Tags with parameters in TOC
22108 !! options
22109 parsoid=wt2html
22110 !! wikitext
22111 __TOC__
22112 == <sup class="in-h2">Hello</sup> ==
22113
22114 == <sup class="a > b">Evilbye</sup> ==
22115 !! html/php
22116 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22117 <ul>
22118 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22119 <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>
22120 </ul>
22121 </div>
22122
22123 <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>
22124 <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>
22125
22126 !! html/parsoid
22127 <meta property="mw:PageProp/toc" />
22128 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22129
22130 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22131 !! end
22132
22133 !! test
22134 span tags with directionality in TOC
22135 !! wikitext
22136 __TOC__
22137 == <span dir="ltr">C++</span> ==
22138
22139 == <span dir="rtl">זבנג!</span> ==
22140
22141 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22142
22143 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22144
22145 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22146 !! html
22147 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22148 <ul>
22149 <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>
22150 <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>
22151 <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>
22152 <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>
22153 <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>
22154 </ul>
22155 </div>
22156
22157 <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>
22158 <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>
22159 <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>
22160 <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>
22161 <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>
22162
22163 !! end
22164
22165 !! test
22166 Bug 72884: bdi element in ToC
22167 !! wikitext
22168 __TOC__
22169 == <bdi>test</bdi> ==
22170 !! html
22171 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22172 <ul>
22173 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22174 </ul>
22175 </div>
22176
22177 <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>
22178
22179 !! end
22180
22181 !! test
22182 T35715: s/strike element in ToC
22183 !! wikitext
22184 __TOC__
22185 == <s>test</s> test <strike>test</strike> ==
22186 !! html
22187 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22188 <ul>
22189 <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>
22190 </ul>
22191 </div>
22192
22193 <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>
22194
22195 !! end
22196
22197 # Note that the html output does not have the <p></p>, but the
22198 # html+tidy output *does*. This is because the empty <p></p> is
22199 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22200 !! test
22201 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22202 !! wikitext
22203 __TOC__
22204 == x ==
22205 !! html
22206 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22207 <ul>
22208 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22209 </ul>
22210 </div>
22211
22212 <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>
22213
22214 !! html+tidy
22215 <p></p>
22216 <div id="toc" class="toc">
22217 <div id="toctitle">
22218 <h2>Contents</h2>
22219 </div>
22220 <ul>
22221 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22222 </ul>
22223 </div>
22224 <p></p>
22225 <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>
22226 !! end
22227
22228 !! article
22229 MediaWiki:Bug32057
22230 !! text
22231 == {{int:headline_sample}} ==
22232 !! endarticle
22233
22234 !! test
22235 Bug 32057: Title needed when expanding <h> nodes.
22236 !! options
22237 title=[[Main Page]]
22238 !! wikitext
22239 {{int:Bug32057}}
22240 !! html
22241 <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>
22242
22243 !! end
22244
22245 !! test
22246 Strip marker in urlencode
22247 !! wikitext
22248 {{urlencode:x<nowiki/>y}}
22249 {{urlencode:x<nowiki/>y|wiki}}
22250 {{urlencode:x<nowiki/>y|path}}
22251 {{urlencode:x<pre id="one">two</pre>y}}
22252 !! html/php
22253 <p>xy
22254 xy
22255 xy
22256 xy
22257 </p>
22258 !! end
22259
22260 !! test
22261 Strip marker in lc
22262 !! wikitext
22263 {{lc:x<nowiki/>y}}
22264 !! html
22265 <p>xy
22266 </p>
22267 !! end
22268
22269 !! test
22270 Strip marker in uc
22271 !! wikitext
22272 {{uc:x<nowiki/>y}}
22273 !! html
22274 <p>XY
22275 </p>
22276 !! end
22277
22278 !! test
22279 Strip marker in formatNum
22280 !! wikitext
22281 {{formatnum:1<nowiki/>2}}
22282 {{formatnum:1<nowiki/>2|R}}
22283 !! html
22284 <p>12
22285 12
22286 </p>
22287 !! end
22288
22289 !! test
22290 Check noCommafy in formatNum
22291 !! options
22292 language=be-tarask
22293 !! wikitext
22294 {{formatnum:123456.78}}
22295 {{formatnum:123456.78|NOSEP}}
22296 !! html
22297 <p>123 456,78
22298 123456.78
22299 </p>
22300 !! end
22301
22302 !! test
22303 Wrong option for formatNum (bug 56199)
22304 !! wikitext
22305 {{formatnum:1,234.56|Random}}
22306 {{formatnum:1,234.56|EVERYTHING}}
22307 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22308 !! html
22309 <p>1,234.56
22310 1,234.56
22311 1,234.56
22312 </p>
22313 !! end
22314
22315 !! test
22316 Strip marker in grammar
22317 !! options
22318 language=fi
22319 !! wikitext
22320 {{grammar:elative|foo<nowiki/>bar}}
22321 !! html
22322 <p>foobarista
22323 </p>
22324 !! end
22325
22326 !! test
22327 Strip marker in padleft
22328 !! wikitext
22329 {{padleft:|2|x<nowiki/>y}}
22330 !! html
22331 <p>xy
22332 </p>
22333 !! end
22334
22335 !! test
22336 Strip marker in padright
22337 !! wikitext
22338 {{padright:|2|x<nowiki/>y}}
22339 !! html
22340 <p>xy
22341 </p>
22342 !! end
22343
22344 !! test
22345 Strip marker in anchorencode
22346 !! wikitext
22347 {{anchorencode:x<nowiki/>y}}
22348 !! html
22349 <p>xy
22350 </p>
22351 !! end
22352
22353 !! test
22354 nowiki inside link inside heading (bug 18295)
22355 !! wikitext
22356 ==[[foo|x<nowiki>y</nowiki>z]]==
22357 !! html
22358 <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>
22359
22360 !! end
22361
22362 !! test
22363 new support for bdi element (bug 31817)
22364 !! wikitext
22365 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22366 !! html
22367 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22368
22369 !!end
22370
22371 !! test
22372 Ignore pipe between table row attributes
22373 !! wikitext
22374 {|
22375 | quux
22376 |- id=foo | style='color: red'
22377 | bar
22378 |}
22379 !! html
22380 <table>
22381 <tr>
22382 <td> quux
22383 </td></tr>
22384 <tr id="foo" style="color: red">
22385 <td> bar
22386 </td></tr></table>
22387
22388 !! end
22389
22390 !!test
22391 Gallery override link with WikiLink (bug 34852)
22392 !! wikitext
22393 <gallery>
22394 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22395 </gallery>
22396 !! html
22397 <ul class="gallery mw-gallery-traditional">
22398 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22399 <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>
22400 <div class="gallerytext">
22401 <p>caption
22402 </p>
22403 </div>
22404 </div></li>
22405 </ul>
22406
22407 !! end
22408
22409 !!test
22410 Gallery override link with absolute external link (bug 34852)
22411 !! wikitext
22412 <gallery>
22413 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22414 </gallery>
22415 !! html
22416 <ul class="gallery mw-gallery-traditional">
22417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22418 <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>
22419 <div class="gallerytext">
22420 <p>caption
22421 </p>
22422 </div>
22423 </div></li>
22424 </ul>
22425
22426 !! end
22427
22428 !! test
22429 Gallery override link with absolute external link with LanguageConverter
22430 !! options
22431 language=zh
22432 !! input
22433 <gallery>
22434 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22435 </gallery>
22436 !! result
22437 <ul class="gallery mw-gallery-traditional">
22438 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22439 <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>
22440 <div class="gallerytext">
22441 <p>caption
22442 </p>
22443 </div>
22444 </div></li>
22445 </ul>
22446
22447 !! end
22448
22449 !!test
22450 Gallery override link with malicious javascript (bug 34852)
22451 !! wikitext
22452 <gallery>
22453 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
22454 </gallery>
22455 !! html
22456 <ul class="gallery mw-gallery-traditional">
22457 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22458 <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>
22459 <div class="gallerytext">
22460 <p>caption
22461 </p>
22462 </div>
22463 </div></li>
22464 </ul>
22465
22466 !! end
22467
22468 !!test
22469 Gallery with invalid title as link (bug 43964)
22470 !! wikitext
22471 <gallery>
22472 File:foobar.jpg|link=<
22473 </gallery>
22474 !! html
22475 <ul class="gallery mw-gallery-traditional">
22476 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22477 <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>
22478 <div class="gallerytext">
22479 </div>
22480 </div></li>
22481 </ul>
22482
22483 !! end
22484
22485 !!test
22486 Language parser function
22487 !! wikitext
22488 {{#language:ar}}
22489 !! html
22490 <p>العربية
22491 </p>
22492 !! end
22493
22494 !!test
22495 Padleft and padright as substr
22496 !! wikitext
22497 {{padleft:|3|abcde}}
22498 {{padright:|3|abcde}}
22499 !! html
22500 <p>abc
22501 abc
22502 </p>
22503 !! end
22504
22505 !!test
22506 Special parser function
22507 !! wikitext
22508 {{#special:RandomPage}}
22509 {{#special:BaDtItLe}}
22510 {{#special:Foobar}}
22511 !! html
22512 <p>Special:Random
22513 Special:Badtitle
22514 Special:Foobar
22515 </p>
22516 !! end
22517
22518 !!test
22519 Bug 34939 - Case insensitive link parsing ([HttP://])
22520 !! wikitext
22521 [HttP://MediaWiki.Org/]
22522 !! html/php
22523 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22524 </p>
22525 !! html/parsoid
22526 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22527 !! end
22528
22529 !!test
22530 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22531 !! wikitext
22532 [HttP://MediaWiki.Org/ MediaWiki]
22533 !! html
22534 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22535 </p>
22536 !! end
22537
22538 !!test
22539 Bug 34939 - Case insensitive link parsing (HttP://)
22540 !! wikitext
22541 HttP://MediaWiki.Org/
22542 !! html/php
22543 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22544 </p>
22545 !! html/parsoid
22546 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22547 !! end
22548
22549 !!test
22550 Disable TOC
22551 !! options
22552 notoc
22553 !! wikitext
22554 Lead
22555 == Section 1 ==
22556 == Section 2 ==
22557 == Section 3 ==
22558 == Section 4 ==
22559 == Section 5 ==
22560 !! html
22561 <p>Lead
22562 </p>
22563
22564 <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>
22565 <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>
22566 <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>
22567 <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>
22568 <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>
22569
22570 !! end
22571
22572
22573 ###
22574 ### Parsoid-specific tests
22575 ### Parsoid-PHP parser incompatibilities
22576 ###
22577 !!test
22578 1. SOL-sensitive wikitext tokens as template-args
22579 !!options
22580 parsoid=wt2html,wt2wt
22581 !! wikitext
22582 {{echo|*a}}
22583 {{echo|#a}}
22584 {{echo|:a}}
22585 !! html
22586 <span about="#mwt1" typeof="mw:Transclusion">
22587 </span><ul about="#mwt1"><li>a</li>
22588 </ul>
22589 <span about="#mwt2" typeof="mw:Transclusion">
22590 </span><ol about="#mwt2"><li>a</li>
22591 </ol>
22592 <span about="#mwt3" typeof="mw:Transclusion">
22593 </span><dl about="#mwt3"><dd>a</dd>
22594 </dl>
22595 !!end
22596
22597 #### -----------------------------------------------------------------
22598 #### Parsoid-specific functionality tests
22599 #### -----------------------------------------------------------------
22600
22601 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22602 # We know wt2wt will fail, but we expect selser to pass.
22603 # Due to the nature of our testing, wt2wt and selser tests will enter the
22604 # blacklist and we'll catch selser regressions based on changes to the
22605 # blacklist entries for selser tests.
22606 !! test
22607 1. Bad treebuilder fixup of formatting elt is cleaned up
22608 !! options
22609 parsoid=wt2html,wt2wt
22610 !! wikitext
22611 {|
22612 |
22613 <small>
22614 [[Image:Foobar.jpg|right|Test]]
22615 </small>
22616 |}
22617 !! html/parsoid
22618 <table>
22619 <tbody><tr><td>
22620 <small>
22621 <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>
22622 </small>
22623 </td></tr>
22624 </tbody></table>
22625 !! end
22626
22627 !! test
22628 2. Bad treebuilder fixup of formatting elt is cleaned up
22629 !! options
22630 parsoid=wt2html,wt2wt
22631 !! wikitext
22632 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22633
22634 <small>[[Image:Foobar.jpg|right|300px]]</small>
22635 !! html/parsoid
22636
22637 <p><b>foo</b></p>
22638 <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>
22639 <p><b>bar</b></p>
22640 <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>
22641 !! end
22642
22643 !! test
22644 3. Bad treebuilder fixup of formatting elt is cleaned up
22645 !! options
22646 parsoid=wt2html,wt2wt
22647 !! wikitext
22648 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22649 !! html/parsoid
22650 <p><small><b>foo</b></small></p>
22651 <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>
22652 <p><small><b>bar</b></small></p>
22653 !! end
22654
22655 !! test
22656 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22657 !! options
22658 parsoid=wt2html,wt2wt
22659 !! wikitext
22660 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22661 !! html/parsoid
22662 <p><b><small></small></b></p>
22663 <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>
22664 <p></p>
22665 !! end
22666
22667 #### ----------------------------------------------------------------
22668 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22669 #### tags. Parsoid's output for these tags differs from that of the
22670 #### PHP parser.
22671 #### ----------------------------------------------------------------
22672
22673 !!test
22674 Ref: 1. ref-location should be replaced with an index span
22675 !! wikitext
22676 A <ref>foo</ref>
22677 B <ref name="x">foo</ref>
22678 C <ref name="y" />
22679 <references />
22680 !! html/parsoid
22681 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22682 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
22683 C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="./Main_Page#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
22684 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22685 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22686 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="./Main_Page#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
22687 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="./Main_Page#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
22688 </ol>
22689 !!end
22690
22691 !!test
22692 Ref: 2. ref-tags with identical names should all get the same index
22693 !! wikitext
22694 A <ref name="x">foo</ref>
22695 B <ref name="x" />
22696 <references />
22697 !! html/parsoid
22698 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22699 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22700 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22701 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
22702 </ol>
22703 !!end
22704
22705 !!test
22706 Ref: 3. spaces in ref-names should be ignored
22707 !! wikitext
22708 A <ref name="x">foo</ref>
22709 B <ref name=" x " />
22710 C <ref name= x />
22711 <references />
22712 !! html/parsoid
22713 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22714 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22715 C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22716 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22717 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
22718 </ol>
22719 !!end
22720
22721 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22722 !!test
22723 Ref: 4. 'constructor' should be accepted as a valid ref-name
22724 !! wikitext
22725 A <ref name="constructor">foo</ref>
22726 <references />
22727 !! html/parsoid
22728 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="./Main_Page#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22729 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22730 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="./Main_Page#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
22731 </ol>
22732 !!end
22733
22734 !!test
22735 Ref: 5. body should accept generic wikitext
22736 !! wikitext
22737 A <ref>
22738 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22739 </ref>
22740
22741 <references />
22742 !! html/parsoid
22743 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22744
22745 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22746 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">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>
22747 </span></li>
22748 </ol>
22749 !!end
22750
22751 !!test
22752 Ref: 6. indent-pres should not be output in ref-body
22753 !! wikitext
22754 A <ref>
22755 foo
22756 bar
22757 baz
22758 </ref>
22759
22760 <references />
22761 !! html/parsoid
22762 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22763
22764 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22765 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
22766 bar
22767 baz
22768 </span></li>
22769 </ol>
22770 !!end
22771
22772 !!test
22773 Ref: 7. No p-wrapping in ref-body
22774 !! wikitext
22775 A <ref>
22776 foo
22777
22778 bar
22779
22780
22781 baz
22782
22783
22784
22785 booz
22786 </ref>
22787
22788 <references />
22789 !! html/parsoid
22790 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22791
22792 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22793 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
22794
22795 bar
22796
22797
22798 baz
22799
22800
22801
22802 booz
22803 </span></li>
22804 </ol>
22805 !!end
22806
22807 !!test
22808 Ref: 8. transclusion wikitext has lower precedence
22809 !! wikitext
22810 A <ref> foo {{echo|</ref> B C}}
22811
22812 <references />
22813 !! html/parsoid
22814 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C}}</p>
22815 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22816 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo {{echo|</span></li>
22817 </ol>
22818 !!end
22819
22820 !!test
22821 Ref: 9. unclosed comments should not leak out of ref-body
22822 !! wikitext
22823 A <ref> foo <!--</ref> B C
22824 <references />
22825 !! html/parsoid
22826 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22827 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22828 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
22829 </ol>
22830 !!end
22831
22832 !!test
22833 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22834 !! wikitext
22835 A <ref> <b> foo </ref> B C
22836
22837 <references />
22838 !! html/parsoid
22839 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22840
22841
22842 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22843 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
22844 </ol>
22845 !!end
22846
22847 !!test
22848 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22849 !! wikitext
22850 A <ref>foo</ref> B
22851 C <ref>bar</ref> D
22852 <references />
22853 !! html/parsoid
22854 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
22855 C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
22856 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22857 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22858 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22859 </ol>
22860 !!end
22861
22862 !!test
22863 Ref: 12. ref-tags act as trailing newline migration barrier
22864 !! wikitext
22865 <!--the newline at the end of this line moves out of the p tag-->a
22866
22867 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22868 <ref />
22869
22870 c
22871 <references />
22872 !! html/parsoid
22873 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22874
22875
22876 <p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22877 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22878
22879 <p>c</p>
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="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
22882 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
22883 !!end
22884
22885 !!test
22886 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22887 !! wikitext
22888 <ref>foo</ref> A
22889 <ref>bar
22890 </ref> B
22891 <references />
22892 !! html/parsoid
22893 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
22894 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
22895 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22896 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22897 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
22898 </span></li>
22899 </ol>
22900 !!end
22901
22902 ## Roundtripping fails because of nowiki'ing
22903 !! test
22904 Ref: 14. A nested ref-tag should be emitted as plain text
22905 !! options
22906 parsoid=wt2html
22907 !! wikitext
22908 <ref>foo <ref>bar</ref> baz</ref>
22909
22910 <references />
22911 !! html/parsoid
22912 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span> baz&lt;/ref></p>
22913
22914 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo &lt;ref>bar</span></li></ol>
22915 !! end
22916
22917 !!test
22918 Ref: 15. ref-tags with identical names should get identical indexes
22919 !! wikitext
22920 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22921 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22922
22923 <references />
22924 !! html/parsoid
22925 <p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22926 B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22927
22928 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
22929 </ol>
22930 !!end
22931
22932 ## We don't bother wt2wt-ing non-standard whitespace
22933 !!test
22934 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22935 !!options
22936 parsoid=wt2html
22937 !! wikitext
22938 A <ref >foo</ref >
22939
22940 <references />
22941 !! html/parsoid
22942 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22943 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22944 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
22945 !!end
22946
22947 !!test
22948 Ref: 17. Generate valid HTML5 id/about attributes
22949 !!wikitext
22950 <ref name="a b">foo</ref>
22951 <ref name=":0">ve-created name</ref>
22952
22953 <references />
22954 !!html/parsoid
22955 <p><span about="#mwt2" class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="./Main_Page#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span>
22956 <span about="#mwt4" class="mw-ref" id="cite_ref-:0_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-:0-2"},"attrs":{"name":":0"}}'><a href="./Main_Page#cite_note-:0-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></span>
22957
22958 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="./Main_Page#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li><li about="#cite_note-:0-2" id="cite_note-:0-2"><a href="./Main_Page#cite_ref-:0_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-:0-2" class="mw-reference-text">ve-created name</span></li></ol>
22959
22960 !!end
22961
22962 !!test
22963 Ref: 18. T58916: Extension attributes should be parsed as plain text
22964 !!wikitext
22965 <ref name="{{echo|a}}">foo</ref>
22966
22967 <references />
22968 !!html/parsoid
22969 <p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="./Main_Page#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
22970 </p>
22971
22972 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22973 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="./Main_Page#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
22974 </ol>
22975 !!end
22976
22977 !!test
22978 Ref: 19. ref-tags with identical name encodings should get identical indexes
22979 !! wikitext
22980 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22981
22982 <references />
22983 !! html/parsoid
22984 <p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22985 </p>
22986 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22987 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
22988 </ol>
22989 !!end
22990
22991 !!test
22992 Ref: 20. ref-tags with identical names but different content should keep it
22993 !! wikitext
22994 A <ref name="foo">Foo one</ref>
22995 B <ref name="foo">Foo two</ref>
22996 C <ref name="foo" />
22997
22998 <references />
22999 !! html/parsoid
23000 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
23001 B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
23002 C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23003
23004 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
23005 </ol>
23006 !!end
23007
23008 !!test
23009 References: 1. references tag without any refs should be handled properly
23010 !! wikitext
23011 <references />
23012 !! html/parsoid
23013 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23014 !!end
23015
23016 !!test
23017 References: 2. references tag with group only outputs references from that group
23018 !! wikitext
23019 A <ref group="a">foo</ref>
23020 B <ref group="b">bar</ref>
23021 C <ref>baz</ref>
23022
23023 <references group="a" />
23024 <references />
23025 <references group="b" />
23026 !! html/parsoid
23027 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
23028 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="./Main_Page#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
23029 C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
23030
23031 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
23032 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
23033 </ol>
23034 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
23035 <li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
23036 </ol>
23037 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
23038 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
23039 </ol>
23040 !!end
23041
23042 !!test
23043 References: 3. ref list should be cleared after processing references
23044 !! wikitext
23045 A <ref>foo</ref>
23046
23047 <references />
23048
23049 B <ref>bar</ref>
23050
23051 <references />
23052 !! html/parsoid
23053 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23054
23055 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
23056 </ol>
23057
23058 <p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
23059
23060 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
23061 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
23062 </ol>
23063 !!end
23064
23065 !!test
23066 References: 4. only referenced group should be cleared after processing references
23067 !! wikitext
23068 A <ref group="a">afoo</ref>
23069 B <ref>bfoo</ref>
23070
23071 <references group="a" />
23072
23073 C <ref>cfoo</ref>
23074
23075 <references />
23076 !! html/parsoid
23077 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
23078 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
23079
23080 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
23081 </ol>
23082
23083 <p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="./Main_Page#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
23084
23085 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
23086 </ol>
23087 !!end
23088
23089 ## Don't expect this to rt since we're dropping content
23090 !! test
23091 References: 5. ref tags in references should be processed while ignoring all other content
23092 !! options
23093 parsoid=wt2html,html2html
23094 !! wikitext
23095 A <ref name="a" />
23096 B <ref name="b">bar</ref>
23097
23098 <references>
23099 <ref name="a">foo</ref>
23100 This should just get lost.
23101 </references>
23102 !! html/parsoid
23103 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
23104 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
23105
23106
23107 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Main_Page#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
23108 </ol>
23109 !! end
23110
23111 !! test
23112 References: 6. <references /> from a transclusion
23113 !! wikitext
23114 <ref>Foo</ref> {{echo|<references />}}
23115 !! html/parsoid
23116 <p><span about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p> <ol class="mw-references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
23117 </ol>
23118 !! end
23119
23120 !! test
23121 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23122 !! wikitext
23123 A <ref>foo bar for a</ref>
23124 B <ref group="X" name="b" />
23125
23126 <references />
23127
23128 <references group="X">
23129 <ref name="b">foo</ref>
23130 </references>
23131 !! html/parsoid
23132 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
23133 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="./Main_Page#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
23134 </p>
23135
23136 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23137 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
23138 </ol>
23139
23140 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
23141 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
23142 </ol>
23143 !! end
23144
23145 !! test
23146 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23147 !! wikitext
23148 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23149 <references />
23150 !! html/parsoid
23151 <p>X<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23152 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
23153 </ol>
23154 !!end
23155
23156 # This test only works in wt2html now as the <references /> are always generated
23157 # unless selser is active. Once T72722 is fixed, we should add a changes test
23158 # here to ensure that unrelated changes don't add the new <references />
23159 # when selser is active.
23160 !! test
23161 References: 9. Generate missing references list at the end
23162 !! wikitext
23163 A <ref>foo</ref>
23164 B <ref group="inexistent">bar</ref>
23165 !! html/parsoid
23166 <p>A <span class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="./Main_Page#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
23167 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23168 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
23169 </ol>
23170 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23171 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
23172 </ol>
23173 !! end
23174
23175 !! test
23176 References: 10. New <references/> shouldn't be added for unrelated edits.
23177 !! options
23178 parsoid={
23179 "modes": ["selser"],
23180 "changes": [["#x", "remove"]],
23181 "selser": "noauto"
23182 }
23183 !! wikitext
23184 Unrelated text<span id="x"> that's going to disappear</span>.
23185 A <ref>foo</ref>
23186 !! wikitext/edited
23187 Unrelated text.
23188 A <ref>foo</ref>
23189 !!end
23190
23191 !! test
23192 Entities in ref name
23193 !! wikitext
23194 <ref name="test &amp; me">hi</ref>
23195 <references />
23196 !! html/parsoid
23197 <p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="./Main_Page#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23198 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23199 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="./Main_Page#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
23200 </ol>
23201 !! end
23202
23203 ## The output here may look funny, but it's what the php parser will do. The
23204 ## unclosed references tag becomes escaped text, and then a new references
23205 ## tag is auto-generated. The test is wt2html only because it roundtrips with
23206 ## nowiki tags, and the auto-generated references tag is only dropped in
23207 ## rtTestMode.
23208 !! test
23209 Generate references for unclosed references tag
23210 !! options
23211 parsoid=wt2html
23212 !! wikitext
23213 a<ref>foo</ref>
23214
23215 <references>
23216 !! html/parsoid
23217 <p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
23218
23219 <p>&lt;references></p>
23220 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
23221 !! end
23222
23223 !! test
23224 New reference serializes on its own line
23225 !! options
23226 parsoid=wt2wt,html2wt
23227 !! wikitext
23228 foo
23229 <references />
23230 !! html/parsoid
23231 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23232 !! end
23233
23234 #### ----------------------------------------------------------------
23235 #### Parsoid-only testing of Parsoid's impl of LST
23236 #### Not implemented yet, see
23237 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23238 #### ----------------------------------------------------------------
23239
23240 ## We still need to support serializing the older format while content is stored.
23241 !! test
23242 LST Sections: Backwards compatibility
23243 !! options
23244 parsoid={
23245 "suppressErrors": true,
23246 "modes": ["html2wt"]
23247 }
23248 !! wikitext
23249 <section begin="2011-05-16" />
23250 <section end="2014-04-10 (MW 1.23wmf22)" />
23251 !! html/parsoid
23252 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23253 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23254 !! end
23255
23256 ## The unconventional output is the result of `usePHPPreProcessor` being
23257 ## disabled in parserTests.js. This test is mainly just to show <section> is
23258 ## recognized as an extension tag w/o a native handler.
23259 !! test
23260 LST Sections: Newfangled approach
23261 !! options
23262 parsoid={ "suppressErrors": true }
23263 !! wikitext
23264 <section begin="2011-05-16" />
23265 <section end="2014-04-10 (MW 1.23wmf22)" />
23266 !! html/parsoid
23267 <p><span typeof="mw:Extension/section" about="#mwt1" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section begin=\"2011-05-16\" />","tagWidths":[30,0]}'>&lt;section begin="2011-05-16" /></span>
23268 <span typeof="mw:Extension/section" about="#mwt2" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section end=\"2014-04-10 (MW 1.23wmf22)\" />","tagWidths":[43,0]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
23269 !! end
23270
23271 #--------- Test stripping of empty nodes in template content ----------
23272 !!test
23273 Empty LI and TR nodes should be stripped from template content
23274 !!wikitext
23275 {{EmptyLITest}}
23276 {{EmptyTRTest}}
23277 !!html/parsoid
23278 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23279 <li>a</li>
23280 <li>b</li>
23281 </ul>
23282 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23283 <tbody>
23284 <tr>
23285 <td>foo</td>
23286 </tr>
23287 <tr>
23288 <td>bar</td>
23289 </tr>
23290 </tbody>
23291 </table>
23292 !!end
23293
23294 !!test
23295 Empty LI and TR nodes should not be stripped from top-level content
23296 !!wikitext
23297 * a
23298 *
23299 * b
23300 {|
23301 |-
23302 |-
23303 |foo
23304 |}
23305 !!html/parsoid
23306 <ul>
23307 <li> a</li>
23308 <li></li>
23309 <li> b</li>
23310 </ul>
23311 <table>
23312 <tbody>
23313 <tr></tr>
23314 <tr>
23315 <td>foo</td>
23316 </tr>
23317 </tbody>
23318 </table>
23319 !!end
23320
23321 !!test
23322 Empty TR nodes should not be stripped if they have any attributes set
23323 !!wikitext
23324 {{EmptyTRWithHTMLAttrTest}}
23325 !!html/parsoid
23326 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23327 <tr align="center"></tr>
23328 <tr><td>foo</td></tr>
23329 <tr align="center"></tr>
23330 <tr><td>bar</td></tr>
23331 </table>
23332 !!end
23333
23334 #### ----------------------------------------------------------------
23335 #### The following section of tests are primarily to test
23336 #### wikitext escaping capabilities of Parsoid. Given that
23337 #### escaping can be done any number of ways, the wikitext (input)
23338 #### is always adjusted to reflect how Parsoid adds nowiki
23339 #### escape tags.
23340 ####
23341 #### We are marking several tests as parsoid-only since the
23342 #### HTML in the result section is different from what the
23343 #### PHP parser generates for it.
23344 #### ----------------------------------------------------------------
23345
23346
23347 #### --------------- Headings ---------------
23348 #### 0. Unnested
23349 #### 1. Nested inside html <h1>=foo=</h1>
23350 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23351 #### 3. Nested inside html with wikitext split by html tags
23352 #### 4. No escape needed
23353 #### 5. Empty headings <h1></h1>
23354 #### 6. Heading chars in SOL context
23355 #### ----------------------------------------
23356 !! test
23357 Headings: 0. Unnested
23358 !! options
23359 parsoid=html2wt
23360 !! html/parsoid
23361 <p>=foo=</p>
23362
23363 <p> =foo=
23364 <!--cmt-->
23365 =foo=</p>
23366
23367 <p>=foo<i>a</i>=</p>
23368 !! wikitext
23369 <nowiki>=foo=</nowiki>
23370
23371 <nowiki> </nowiki>=foo=
23372 <!--cmt-->
23373 <nowiki>=foo=</nowiki>
23374
23375 =foo''a''<nowiki>=</nowiki>
23376 !!end
23377
23378 # New headings and existing headings are handled differently
23379 !! test
23380 Headings: 1. Nested inside html
23381 !! options
23382 parsoid=html2wt
23383 !! html/parsoid
23384 <h1>=foo=</h1>
23385 <h2>=foo=</h2>
23386 <h3>=foo=</h3>
23387
23388 <h1 data-parsoid=''>=foo=</h1>
23389 <h2 data-parsoid=''>=foo=</h2>
23390 <h3 data-parsoid=''>=foo=</h3>
23391 <h4 data-parsoid=''>=foo=</h4>
23392 <h5 data-parsoid=''>=foo=</h5>
23393 <h6 data-parsoid=''>=foo=</h6>
23394 !! wikitext
23395 = =foo= =
23396
23397 == =foo= ==
23398
23399 === =foo= ===
23400
23401 =<nowiki>=foo=</nowiki>=
23402 ==<nowiki>=foo=</nowiki>==
23403 ===<nowiki>=foo=</nowiki>===
23404 ====<nowiki>=foo=</nowiki>====
23405 =====<nowiki>=foo=</nowiki>=====
23406 ======<nowiki>=foo=</nowiki>======
23407
23408 !!end
23409
23410 !! test
23411 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23412 !! options
23413 parsoid=html2wt
23414 !! html/parsoid
23415 <h1>foo</h1>*bar
23416 <h1>foo</h1>=bar
23417 <h1>foo</h1>=bar=
23418 !! wikitext
23419 = foo =
23420 <nowiki>*</nowiki>bar
23421
23422 = foo =
23423 =bar
23424
23425 = foo =
23426 <nowiki>=bar=</nowiki>
23427 !!end
23428
23429 !! test
23430 Headings: 3. Nested inside html with wikitext split by html tags
23431 !! options
23432 parsoid=html2wt
23433 !! html/parsoid
23434 <h1>=<b>bold</b>foo=</h1>
23435 !! wikitext
23436 = ='''bold'''foo= =
23437 !!end
23438
23439 !! test
23440 Headings: 4a. No escaping needed (testing just h1 and h2)
23441 !! options
23442 parsoid=html2wt
23443 !! html/parsoid
23444 <h1>=foo</h1>
23445 <h1>foo=</h1>
23446 <h1> =foo= </h1>
23447 <h1>=foo= bar</h1>
23448 <h2>=foo</h2>
23449 <h2>foo=</h2>
23450 <h1>=</h1>
23451 <h1><i>=</i>foo=</h1>
23452 !! wikitext
23453 = =foo =
23454
23455 = foo= =
23456
23457 = =foo= =
23458
23459 = =foo= bar =
23460
23461 == =foo ==
23462
23463 == foo= ==
23464
23465 = = =
23466
23467 = ''=''foo= =
23468 !!end
23469
23470 !! test
23471 Headings: 4b. No escaping needed (inside p-tags)
23472 !! options
23473 parsoid=html2wt
23474 !! html/parsoid
23475 <p>===
23476 =foo= x
23477 =foo= <s></s>
23478 </p>
23479 !! wikitext
23480 ===
23481 =foo= x
23482 =foo= <s></s>
23483 !!end
23484
23485 !! test
23486 Headings: 5. Empty headings
23487 !! options
23488 parsoid=html2wt
23489 !! html/parsoid
23490 <h1 data-parsoid='{}'></h1>
23491
23492 <h2 data-parsoid='{}'></h2>
23493
23494 <h3 data-parsoid='{}'></h3>
23495
23496 <h4 data-parsoid='{}'></h4>
23497
23498 <h5 data-parsoid='{}'></h5>
23499
23500 <h6 data-parsoid='{}'></h6>
23501 !! wikitext
23502 =<nowiki/>=
23503
23504 ==<nowiki/>==
23505
23506 ===<nowiki/>===
23507
23508 ====<nowiki/>====
23509
23510 =====<nowiki/>=====
23511
23512 ======<nowiki/>======
23513 !!end
23514
23515 !! test
23516 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23517 !! options
23518 parsoid=html2wt
23519 !! html/parsoid
23520 <p>=a=</p>
23521
23522 <p>=a=</p>
23523
23524 <p>=a=</p>
23525 !! wikitext
23526 <nowiki>=a=</nowiki>
23527
23528 <nowiki>=a=</nowiki>
23529
23530 <nowiki>=a=</nowiki>
23531 !!end
23532
23533 !! test
23534 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23535 !! options
23536 parsoid=html2wt
23537 !! html/parsoid
23538 <p>=a=
23539 b</p>
23540
23541 <p>=a=
23542 b</p>
23543
23544 <p>=a=
23545 b</p>
23546 !! wikitext
23547 <nowiki>=a=</nowiki>
23548 b
23549
23550 <nowiki>=a=</nowiki>
23551 b
23552
23553 <nowiki>=a=</nowiki>
23554 b
23555 !!end
23556
23557 !! test
23558 Headings: 6c. Heading chars in SOL context (leading newline break)
23559 !! options
23560 parsoid=html2wt
23561 !! html/parsoid
23562 <p>a
23563 =b=</p>
23564 !! wikitext
23565 a
23566 <nowiki>=b=</nowiki>
23567 !!end
23568
23569 !! test
23570 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23571 !! options
23572 parsoid=html2wt
23573 !! html/parsoid
23574 <!--c0--><p>=a=</p>
23575
23576 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23577 !! wikitext
23578 <!--c0--><nowiki>=a=</nowiki>
23579
23580 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23581 !!end
23582
23583 !! test
23584 Headings: 6d. Heading chars in SOL context (No escaping needed)
23585 !! options
23586 parsoid=html2wt
23587 !! html/parsoid
23588 =a=<div>b</div>
23589 !! wikitext
23590 =a=<div>b</div>
23591 !!end
23592
23593 !! test
23594 Headings: 7. Insert a newline between new content and headings
23595 !! options
23596 parsoid=html2wt
23597 !! html/parsoid
23598 <h2>NEW</h2>
23599 <p>new</p>
23600 <h2 data-parsoid='{}'>A</h2>
23601 <p data-parsoid='{}'>a</p>
23602 !! wikitext
23603 == NEW ==
23604 new
23605
23606 ==A==
23607 a
23608
23609 !! end
23610
23611 #### --------------- Lists ---------------
23612 #### 0. Outside nests (*foo, etc.)
23613 #### 1. Nested inside html <ul><li>*foo</li></ul>
23614 #### 2. Inside definition lists
23615 #### 3. Only bullets at start should be escaped
23616 #### 4. No escapes needed
23617 #### 5. No unnecessary escapes
23618 #### 6. Escape bullets in SOL position
23619 #### 7. Escape bullets in a multi-line context
23620 #### ----------------------------------------
23621
23622 !! test
23623 Lists: 0. Outside nests
23624 !! options
23625 parsoid=html2wt
23626 !! html/parsoid
23627 <p>*foo</p>
23628
23629 <p>#foo</p>
23630
23631 <p>;Foo:bar</p>
23632 !! wikitext
23633 <nowiki>*</nowiki>foo
23634
23635 <nowiki>#</nowiki>foo
23636
23637 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23638 !!end
23639
23640 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23641 ## to test wikitext escaping, and insignificant whitespace diffs
23642 ## cause PHP parser tests to barf
23643 !! test
23644 Lists: 1. Nested inside html (No unnecessary escapes)
23645 !! options
23646 parsoid=html2wt
23647 !! html/parsoid
23648 <ul>
23649 <li>*foo</li>
23650 <li>#foo</li>
23651 <li>:foo</li>
23652 <li>;foo</li>
23653 <li data-parsoid='{}'>*foo</li>
23654 <li data-parsoid='{}'>#foo</li>
23655 <li data-parsoid='{}'>:foo</li>
23656 <li data-parsoid='{}'>;foo</li>
23657 </ul>
23658
23659 <ol>
23660 <li>*foo</li>
23661 <li>#foo</li>
23662 <li>:foo</li>
23663 <li>;foo</li>
23664 <li data-parsoid='{}'>*foo</li>
23665 <li data-parsoid='{}'>#foo</li>
23666 <li data-parsoid='{}'>:foo</li>
23667 <li data-parsoid='{}'>;foo</li>
23668 </ol>
23669 !! wikitext
23670 * *foo
23671 * #foo
23672 * :foo
23673 * ;foo
23674 *<nowiki>*foo</nowiki>
23675 *<nowiki>#foo</nowiki>
23676 *<nowiki>:foo</nowiki>
23677 *<nowiki>;foo</nowiki>
23678
23679 # *foo
23680 # #foo
23681 # :foo
23682 # ;foo
23683 #<nowiki>*foo</nowiki>
23684 #<nowiki>#foo</nowiki>
23685 #<nowiki>:foo</nowiki>
23686 #<nowiki>;foo</nowiki>
23687 !!end
23688
23689 !! test
23690 Lists: 2. Inside definition lists
23691 !! options
23692 parsoid=html2wt
23693 !! html/parsoid
23694 <dl><dt>;foo</dt></dl>
23695 <dl><dt>:foo</dt></dl>
23696 <dl><dt>:foo</dt>
23697 <dd>bar</dd></dl>
23698 <dl><dd>:foo</dd></dl>
23699 !! wikitext
23700 ; ;foo
23701
23702 ; <nowiki>:foo</nowiki>
23703
23704 ; <nowiki>:foo</nowiki>
23705 : bar
23706
23707 : :foo
23708 !!end
23709
23710 !! test
23711 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23712 !! options
23713 parsoid=html2wt
23714 !! html/parsoid
23715 <ul>
23716 <li>*foo*bar</li>
23717 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23718 </ul>
23719 !! wikitext
23720 * *foo*bar
23721 *<nowiki>*foo</nowiki>''it''*bar
23722 !!end
23723
23724 !! test
23725 Lists: 4. No escapes needed
23726 !! options
23727 parsoid=html2wt
23728 !! html/parsoid
23729 <ul>
23730 <li>foo*bar
23731 </li>
23732 </ul>
23733 <ul>
23734 <li><i>foo</i>*bar
23735 </li>
23736 </ul>
23737 <ul>
23738 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23739 </li>
23740 </ul>
23741 <ul>
23742 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23743 </li>
23744 </ul>
23745 !! wikitext
23746 *foo*bar
23747
23748 *''foo''*bar
23749
23750 *[[Foo]]: bar
23751
23752 *[[Foo]]*bar
23753 !!end
23754
23755 !! test
23756 Lists: 5. No unnecessary escapes
23757 !! options
23758 parsoid=html2wt
23759 !! html/parsoid
23760 <ul><li> bar <span>[[foo]]</span></li></ul>
23761 <ul><li> =bar <span>[[foo]]</span></li></ul>
23762 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23763 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23764 <ul><li> =bar <span>foo]]</span>=</li></ul>
23765 <ul><li> <s></s>: a</li></ul>
23766 <ul><li> <i>* foo</i></li></ul>
23767
23768 !! wikitext
23769 * bar <span><nowiki>[[foo]]</nowiki></span>
23770
23771 * =bar <span><nowiki>[[foo]]</nowiki></span>
23772
23773 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23774
23775 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23776
23777 * =bar <span>foo]]</span>=
23778
23779 * <s></s>: a
23780
23781 * ''* foo''
23782 !!end
23783
23784 !! test
23785 Lists: 6. Escape bullets in SOL position
23786 !! options
23787 parsoid=html2wt
23788 !! html/parsoid
23789 <p><!--cmt-->*foo</p>
23790 !! wikitext
23791 <!--cmt--><nowiki>*</nowiki>foo
23792 !!end
23793
23794 !! test
23795 Lists: 7. Escape bullets in a multi-line context
23796 !! options
23797 parsoid=html2wt
23798 !! html/parsoid
23799 <p>a
23800 *b
23801 </p>
23802 !! wikitext
23803 a
23804 <nowiki>*</nowiki>b
23805 !!end
23806
23807 !! test
23808 Lists: 8. Escape colons only if not present in tags
23809 !! options
23810 parsoid=html2wt
23811 !! html/parsoid
23812 <dl><dt>a:b<i>c:d</i></dt></dl>
23813 !! wikitext
23814 ; <nowiki>a:b</nowiki>''c:d''
23815 !! end
23816
23817 #### --------------- HRs ---------------
23818 #### 1. Single line
23819 #### -----------------------------------
23820
23821 !! test
23822 HRs: 1. Single line
23823 !! options
23824 parsoid=html2wt
23825 !! html/parsoid
23826 <hr />----
23827 <hr />=foo=
23828 <hr />*foo
23829 !! wikitext
23830 ----<nowiki>----</nowiki>
23831 ----=foo=
23832 ----*foo
23833 !! end
23834
23835 #### --------------- Tables ---------------
23836 #### 1a. Simple example
23837 #### 1b. No escaping needed (!foo)
23838 #### 1c. No escaping needed (|foo)
23839 #### 1d. No escaping needed (|}foo)
23840 ####
23841 #### 2a. Nested in td (<td>foo|bar</td>)
23842 #### 2b. Nested in td (<td>foo||bar</td>)
23843 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23844 ####
23845 #### 3a. Nested in th (<th>foo!bar</th>)
23846 #### 3b. Nested in th (<th>foo!!bar</th>)
23847 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23848 ####
23849 #### 4a. Escape -
23850 #### 4b. Escape +
23851 #### 4c. No escaping needed
23852 #### --------------------------------------
23853
23854 !! test
23855 Tables: 1a. Simple example
23856 !! options
23857 parsoid=html2wt
23858 !! html/parsoid
23859 <p>{|
23860 |}
23861 </p>
23862 !! wikitext
23863 <nowiki>{|</nowiki>
23864 |}
23865 !! end
23866
23867 !! test
23868 Tables: 1b. No escaping needed
23869 !! options
23870 parsoid=html2wt
23871 !! html/parsoid
23872 <p>!foo
23873 </p>
23874 !! wikitext
23875 !foo
23876 !! end
23877
23878 !! test
23879 Tables: 1c. No escaping needed
23880 !! options
23881 parsoid=html2wt
23882 !! html/parsoid
23883 <p>|foo
23884 </p>
23885 !! wikitext
23886 |foo
23887 !! end
23888
23889 !! test
23890 Tables: 1d. No escaping needed
23891 !! options
23892 parsoid=html2wt
23893 !! html/parsoid
23894 <p>|}foo
23895 </p>
23896 !! wikitext
23897 |}foo
23898 !! end
23899
23900 !! test
23901 Tables: 2a. Nested in td
23902 !! options
23903 parsoid=html2wt
23904 !! html/parsoid
23905 <table><tbody><tr>
23906 <td>foo|bar</td></tr>
23907 <tr><td>x<div>a|b</div></td>
23908 </tbody></table>
23909 !! wikitext
23910 {|
23911 |<nowiki>foo|bar</nowiki>
23912 |-
23913 |x<div><nowiki>a|b</nowiki></div>
23914 |}
23915 !! html/php+tidy
23916 <table>
23917 <tr>
23918 <td>foo|bar</td>
23919 </tr>
23920 <tr>
23921 <td>x
23922 <div>a|b</div>
23923 </td>
23924 </tr>
23925 </table>
23926 !! end
23927
23928 !! test
23929 Tables: 2b. Nested in td
23930 !! options
23931 parsoid=html2wt
23932 !! html/parsoid
23933 <table><tbody><tr>
23934 <td>foo||bar</td>
23935 <td>a<i>b||c</i></td>
23936 <td>a<i><div>b||c</div></i></td>
23937 </tr></tbody></table>
23938 !! wikitext
23939 {|
23940 |<nowiki>foo||bar</nowiki>
23941 |a''<nowiki>b||c</nowiki>''
23942 |a''<div><nowiki>b||c</nowiki></div>''
23943 |}
23944 !! html/php
23945 <table>
23946 <tr>
23947 <td>foo||bar
23948 </td>
23949 <td>a<i>b||c</i>
23950 </td>
23951 <td>a<i><div>b||c</div></i>
23952 </td></tr></table>
23953
23954 !! end
23955
23956 !! test
23957 Tables: 2c. Nested in td -- no escaping needed
23958 !! options
23959 parsoid=html2wt
23960 !! html/*
23961 <table>
23962 <tr>
23963 <td>foo!!bar
23964 </td></tr></table>
23965
23966 !! wikitext
23967 {|
23968 |foo!!bar
23969 |}
23970 !! end
23971
23972 !! test
23973 Tables: 3a. Nested in th
23974 !! options
23975 parsoid=html2wt
23976 !! html/*
23977 <table>
23978 <tr>
23979 <th>foo!bar
23980 </th></tr></table>
23981
23982 !! wikitext
23983 {|
23984 !foo!bar
23985 |}
23986 !! end
23987
23988 !! test
23989 Tables: 3b. Nested in th
23990 !! options
23991 parsoid=html2wt
23992 !! html/parsoid
23993 <table><tbody>
23994 <tr><th>foo!!bar</th>
23995 <th><i>foo|bar</i></th>
23996 <th><i>foo!!bar</i></th>
23997 <th><i><span>foo!!bar</span></i></th>
23998 </tr></tbody></table>
23999 !! wikitext
24000 {|
24001 !<nowiki>foo!!bar</nowiki>
24002 !''<nowiki>foo|bar</nowiki>''
24003 !''<nowiki>foo!!bar</nowiki>''
24004 !''<span><nowiki>foo!!bar</nowiki></span>''
24005 |}
24006 !! html/php
24007 <table>
24008 <tr>
24009 <th>foo!!bar
24010 </th>
24011 <th><i>foo|bar</i>
24012 </th>
24013 <th><i>foo!!bar</i>
24014 </th>
24015 <th><i><span>foo!!bar</span></i>
24016 </th></tr></table>
24017
24018 !! end
24019
24020 !! test
24021 Tables: 3c. Nested in th
24022 !! options
24023 parsoid=html2wt
24024 !! html/parsoid
24025 <table><tbody>
24026 <tr><th>foo||bar</th>
24027 <th><span typeof="mw:Nowiki">foo||bar</span></th>
24028 </tr></tbody></table>
24029 !! wikitext
24030 {|
24031 !<nowiki>foo||bar</nowiki>
24032 !<nowiki>foo||bar</nowiki>
24033 |}
24034 !! html/php
24035 <table>
24036 <tr>
24037 <th>foo||bar
24038 </th>
24039 <th>foo||bar
24040 </th></tr></table>
24041
24042 !! end
24043
24044 !! test
24045 Tables: 4a. Escape -
24046 !! options
24047 parsoid=html2wt
24048 !! html/*
24049 <table>
24050 <tr>
24051 <th>-bar
24052 </th></tr>
24053 <tr>
24054 <td>-bar
24055 </td></tr></table>
24056
24057 !! wikitext
24058 {|
24059 !-bar
24060 |-
24061 |<nowiki>-bar</nowiki>
24062 |}
24063 !! end
24064
24065 !! test
24066 Tables: 4b. Escape +
24067 !! options
24068 parsoid=html2wt
24069 !! html/*
24070 <table>
24071 <tr>
24072 <th>+bar
24073 </th></tr>
24074 <tr>
24075 <td>+bar
24076 </td></tr></table>
24077
24078 !! wikitext
24079 {|
24080 !+bar
24081 |-
24082 |<nowiki>+bar</nowiki>
24083 |}
24084 !! end
24085
24086 !! test
24087 Tables: 4c. No escaping needed
24088 !! options
24089 parsoid=html2wt
24090 !! html/parsoid
24091 <table><tbody>
24092 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24093 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24094 <tr><td>foo
24095 <p>bar|baz
24096 +bar
24097 -bar</p></td></tr>
24098 <tr><td>x
24099 <div>a|b</div></td>
24100 </tbody></table>
24101 !! wikitext
24102 {|
24103 |foo-bar
24104 |foo+bar
24105 |-
24106 |''foo''-bar
24107 |''foo''+bar
24108 |-
24109 |foo
24110 bar|baz
24111 +bar
24112 -bar
24113 |-
24114 |x
24115 <div>a|b</div>
24116 |}
24117 !! html/php
24118 <table>
24119 <tr>
24120 <td>foo-bar
24121 </td>
24122 <td>foo+bar
24123 </td></tr>
24124 <tr>
24125 <td><i>foo</i>-bar
24126 </td>
24127 <td><i>foo</i>+bar
24128 </td></tr>
24129 <tr>
24130 <td>foo
24131 <p>bar|baz
24132 +bar
24133 -bar
24134 </p>
24135 </td></tr>
24136 <tr>
24137 <td>x
24138 <div>a|b</div>
24139 </td></tr></table>
24140
24141 !! end
24142
24143 !! test
24144 Tables: 4d. No escaping needed
24145 !! options
24146 parsoid=html2wt
24147 !! html/parsoid
24148 <table>
24149 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24150 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24151 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24152 </tbody></table>
24153 !! wikitext
24154 {|
24155 |[[Foo]]-bar
24156 ||+1
24157 ||-2
24158 |}
24159 !! html/php
24160 <table>
24161 <tr>
24162 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24163 </td>
24164 <td>+1
24165 </td>
24166 <td>-2
24167 </td></tr></table>
24168
24169 !! end
24170
24171 !! test
24172 T97430: Don't emit empty nowiki pairs around marker meta tags
24173 !! options
24174 parsoid=html2wt
24175 !! html/parsoid
24176 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24177 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24178 !! wikitext
24179 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24180 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24181 !! end
24182
24183 !! test
24184 Unclosed xmlish element in table line shouldn't eat end delimiters
24185 !! options
24186 parsoid=html2wt
24187 !! html/parsoid
24188 <table>
24189 <tbody><tr><td> &lt;foo</td>
24190 <td> bar></td></tr>
24191 </tbody></table>
24192 !! wikitext
24193 {|
24194 | <foo
24195 | bar>
24196 |}
24197 !! html/php
24198 <table>
24199 <tr>
24200 <td> &lt;foo
24201 </td>
24202 <td> bar&gt;
24203 </td></tr></table>
24204
24205 !! end
24206
24207 #### --------------- Links ----------------
24208 #### 1. Quote marks in link text
24209 #### 2. Wikilinks: Escapes needed
24210 #### 3. Wikilinks: No escapes needed
24211 #### 4. Extlinks: Escapes needed
24212 #### 5. Extlinks: No escapes needed
24213 #### --------------------------------------
24214 !! test
24215 Links 1. WikiLinks: No escapes needed
24216 !! options
24217 parsoid=html2wt
24218 !! html/parsoid
24219 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24220 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24221 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24222 !! wikitext
24223 [[Foo|Foo''boo'']]
24224 [[Foo|[Foobar]]]
24225 [[Foo|x [Foobar] x]]
24226 !! html/php
24227 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24228 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24229 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24230 </p>
24231 !! end
24232
24233 !! test
24234 Links 2. WikiLinks: Escapes needed
24235 !! options
24236 parsoid=html2wt
24237 !! html/parsoid
24238 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24239 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24240 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24241 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24242 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24243 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24244 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24245 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24246 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24247 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24248 !! wikitext
24249 [[Foo|<nowiki>Foobar]</nowiki>]]
24250 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24251 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24252 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24253 [[Foo|<nowiki>|Bar</nowiki>]]
24254 [[Foo|<nowiki>]]bar</nowiki>]]
24255 [[Foo|<nowiki>[[bar</nowiki>]]
24256 [[Foo|<nowiki>x [[ y</nowiki>]]
24257 [[Foo|<nowiki>x ]] y</nowiki>]]
24258 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24259 !! html/php
24260 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24261 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24262 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24263 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24264 <a href="/wiki/Foo" title="Foo">|Bar</a>
24265 <a href="/wiki/Foo" title="Foo">]]bar</a>
24266 <a href="/wiki/Foo" title="Foo">[[bar</a>
24267 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24268 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24269 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24270 </p>
24271 !! end
24272
24273 !! test
24274 Links 3. WikiLinks: No escapes needed
24275 !! options
24276 parsoid=html2wt
24277 !! html/parsoid
24278 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24279 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24280 !! wikitext
24281 [[Foo|[Foobar]]
24282 [[Foo|foo|bar]]
24283 !! html/php
24284 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24285 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24286 </p>
24287 !! end
24288
24289 !! test
24290 Links 4. ExtLinks: Escapes needed
24291 !! options
24292 parsoid=html2wt
24293 !! html/parsoid
24294 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24295 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24296 <p>[http://google.com]</p>
24297 <p>[http://google.com google]</p>
24298 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24299 <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>
24300 !! wikitext
24301 [http://google.com <nowiki>[google]</nowiki>]
24302 [http://google.com <nowiki>google]</nowiki>]
24303
24304 <nowiki>[http://google.com]</nowiki>
24305
24306 <nowiki>[http://google.com google]</nowiki>
24307
24308 [http://google.com<nowiki>]</nowiki>
24309
24310 [{{echo|http://google.com}}<nowiki>]</nowiki>
24311 !! html/php
24312 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24313 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24314 </p><p>[http://google.com]
24315 </p><p>[http://google.com google]
24316 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24317 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24318 </p>
24319 !! end
24320
24321 !! test
24322 Links 5. ExtLinks: No escapes needed
24323 !! options
24324 parsoid=html2wt
24325 !! html/parsoid
24326 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24327 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24328 !! wikitext
24329 [http://google.com [google]
24330
24331 [[http://google.com]]
24332 !! html/php
24333 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24334 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24335 </p>
24336 !! end
24337
24338 !! test
24339 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24340 !! options
24341 parsoid=html2wt
24342 !! html/parsoid
24343 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24344 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24345 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24346 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24347 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24348 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24349 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24350 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24351 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24352 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24353 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24354 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24355 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24356 </p>
24357 !! wikitext
24358 x<nowiki/>http://example.com<nowiki/>y
24359 http://example.com<nowiki/>?x
24360 http://example.com<nowiki/>&x
24361 http://example.com<nowiki/>'x
24362 http://example.com<nowiki/>,x
24363 http://example.com<nowiki/>.x
24364 http://example.com<nowiki/>;x
24365 http://example.com<nowiki/>:x
24366 http://example.com<nowiki/>;x
24367 http://example.com<nowiki/>!x
24368 http://example.com<nowiki/>=x
24369 http://example.com<nowiki/>(x)
24370 http://example.com(x<nowiki/>)
24371 !! end
24372
24373 !! test
24374 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24375 !! options
24376 parsoid=html2wt
24377 !! html/parsoid
24378 <p>x
24379 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24380 y
24381 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24382 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24383 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24384 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24385 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24386 </p>
24387 !! wikitext
24388 x
24389 http://example.com
24390 y
24391 "http://example.com"
24392 (http://example.com)
24393 (http://example.com) foo
24394 http://example.com,
24395 http://example.com, foo
24396 !! html/php
24397 <p>x
24398 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24399 y
24400 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24401 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24402 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24403 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24404 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24405 </p>
24406 !! end
24407
24408 !! test
24409 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24410 !! options
24411 parsoid=html2wt
24412 !! html/parsoid
24413 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24414 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24415 !! wikitext
24416 http://example.com.,;:!?\
24417 -http://example.com:
24418 !! html/php
24419 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24420 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24421 </p>
24422 !! end
24423
24424 !! test
24425 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24426 !! options
24427 parsoid=html2wt
24428 !! html/parsoid
24429 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24430 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24431 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24432 !! wikitext
24433 RFC 123<nowiki/>4
24434 RFC 123<nowiki/>y
24435 X<nowiki/>RFC 123<nowiki/>y
24436 !! end
24437
24438 !! test
24439 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24440 !! options
24441 parsoid=html2wt
24442 !! html/parsoid
24443 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24444 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24445 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24446 </p>
24447 !! wikitext
24448 RFC 123?foo
24449 RFC 123&foo
24450 -RFC 123-
24451 !! html/php
24452 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24453 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24454 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24455 </p>
24456 !! end
24457
24458 !! test
24459 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24460 !! options
24461 parsoid=html2wt
24462 !! html/parsoid
24463 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24464 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24465 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24466 !! wikitext
24467 PMID 123<nowiki/>4
24468 PMID 123<nowiki/>y
24469 X<nowiki/>PMID 123<nowiki/>y
24470 !! end
24471
24472 !! test
24473 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24474 !! options
24475 parsoid=html2wt
24476 !! html/parsoid
24477 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24478 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24479 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24480 </p>
24481 !! wikitext
24482 PMID 123?foo
24483 PMID 123&foo
24484 -PMID 123-
24485 !! html/php
24486 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24487 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24488 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24489 </p>
24490 !! end
24491
24492 !! test
24493 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24494 !! options
24495 parsoid=html2wt
24496 !! html/parsoid
24497 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24498 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24499 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24500 </p>
24501 !! wikitext
24502 ISBN 1234567890<nowiki/>1
24503 ISBN 1234567890<nowiki/>x
24504 a<nowiki/>ISBN 1234567890<nowiki/>b
24505 !! end
24506
24507 !! test
24508 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24509 !! options
24510 parsoid=html2wt
24511 !! html/parsoid
24512 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24513 !! wikitext
24514 -ISBN 1234567890's
24515 !! html/php
24516 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24517 </p>
24518 !! end
24519
24520 !! test
24521 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24522 !! options
24523 parsoid=html2wt
24524 !! html/*
24525 <p>this is not a link: http://example.com
24526 </p>
24527 !! wikitext
24528 this is not a link: <nowiki>http://example.com</nowiki>
24529 !! end
24530
24531 !! test
24532 Links 15. Link trails can't become link prefixes.
24533 !! options
24534 language=is
24535 parsoid=html2wt
24536 !! html/parsoid
24537 <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>
24538 !! wikitext
24539 [[Söfnuður]]-[[00]]
24540 !! html/php
24541 <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>
24542 </p>
24543 !! end
24544
24545 #### --------------- Quotes ---------------
24546 #### 1. Quotes inside <b> and <i>
24547 #### 2. Link fragments separated by <i> and <b> tags
24548 #### 3. Link fragments inside <i> and <b>
24549 #### 4. No escaping needed
24550 #### --------------------------------------
24551 !! test
24552 1a. Quotes inside <b> and <i>
24553 !! options
24554 parsoid=html2wt
24555 !! html/*
24556 <p><i>'foo'</i>
24557 <i>''foo''</i>
24558 <i>'''foo'''</i>
24559 <i>foo</i>'s
24560 <b>'foo'</b>
24561 <b>''foo''</b>
24562 <b>'''foo'''</b>
24563 <b>foo'<i>bar'</i>baz</b>
24564 <b>foo</b>'s
24565 '<i>foo</i>
24566 <i>foo</i>'
24567 <i>foo'</i>'
24568 '<i>foo</i>'
24569 '<b>foo</b>
24570 <b>foo</b>'
24571 '<b>foo</b>'
24572 <i>fools'<span> errand</span></i>
24573 <i><span>fool</span>'s errand</i>
24574 '<i>foo</i> bar '<i>baz</i>
24575 a|!*#-:;+-~[]{}b'<i>x</i>
24576 </p>
24577 !! wikitext
24578 ''<nowiki/>'foo'''
24579 ''<nowiki>''foo''</nowiki>''
24580 ''<nowiki>'''foo'''</nowiki>''
24581 ''foo''<nowiki/>'s
24582 '''<nowiki/>'foo''''
24583 '''<nowiki>''foo''</nowiki>'''
24584 '''<nowiki>'''foo'''</nowiki>'''
24585 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24586 '''foo'''<nowiki/>'s
24587 '''foo''
24588 ''foo''<nowiki/>'
24589 ''foo'''<nowiki/>'
24590 '''foo''<nowiki/>'
24591 ''''foo'''
24592 '''foo'''<nowiki/>'
24593 ''''foo'''<nowiki/>'
24594 ''fools'<span> errand</span>''
24595 ''<span>fool</span>'s errand''
24596 '<nowiki/>''foo'' bar '''baz''
24597 a|!*#-:;+-~[]{}b'''x''
24598 !! end
24599
24600 !! test
24601 1b. Quotes inside <b> and <i> with other tags on same line
24602 !! options
24603 parsoid=html2wt
24604 !! html/parsoid
24605 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24606 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24607 <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>
24608 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24609 '<i>foo</i> <span class="mw-ref" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
24610 '<i>foo</i> <div title="name">test</div>
24611 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24612 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24613 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
24614 </ol>
24615 !! wikitext
24616 '''a'' foo ''[[bar]]''
24617 ''a''' foo ''[[bar]]''
24618 ''a''' foo '''{{echo|[[bar]]}}'''
24619 [[foo]] x'''[[bar]]''
24620 '''foo'' <ref>test</ref>
24621 '''foo'' <div title="name">test</div>
24622 '''foo'' and <br> bar
24623 <references />
24624 !! end
24625
24626 !! test
24627 2. Link fragments separated by <i> and <b> tags
24628 !! options
24629 parsoid=html2wt
24630 !! html/parsoid
24631 <p>[[<i>foo</i>hello]]</p>
24632 <p>[[<b>foo</b>hello]]</p>
24633 !! wikitext
24634 [[''foo''<nowiki>hello]]</nowiki>
24635
24636 [['''foo'''<nowiki>hello]]</nowiki>
24637 !! end
24638
24639 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24640 # this is one of the shortcomings of this format
24641 !! test
24642 3. Link fragments inside <i> and <b>
24643 !! options
24644 parsoid=html2wt
24645 !! html/parsoid
24646 <p><i>[[foo</i>]]</p>
24647 <p><b>[[foo</b>]]</p>
24648 !! wikitext
24649 ''[[foo''<nowiki>]]</nowiki>
24650
24651 '''[[foo'''<nowiki>]]</nowiki>
24652 !! end
24653
24654 !! test
24655 4. No escaping needed
24656 !! options
24657 options=html2wt
24658 !! html/parsoid
24659 <p>'<span><i>bar</i></span>'
24660 '<span><b>bar</b></span>'
24661 'a:b'foo
24662 </p>
24663 !! wikitext
24664 '<span>''bar''</span>'
24665 '<span>'''bar'''</span>'
24666 'a:b'foo
24667 !! end
24668
24669 #### ----------- Paragraphs ---------------
24670 #### 1. No unnecessary escapes
24671 #### --------------------------------------
24672
24673 !! test
24674 1. No unnecessary escapes
24675 !! options
24676 parsoid=html2wt
24677 !! html/parsoid
24678 <p>bar <span>[[foo]]</span>
24679 </p><p>=bar <span>[[foo]]</span>
24680 </p><p>[[bar <span>[[foo]]</span>
24681 </p><p>]]bar <span>[[foo]]</span>
24682 </p><p>=bar <span>foo]]</span>=
24683 </p>
24684 !! wikitext
24685 bar <span><nowiki>[[foo]]</nowiki></span>
24686
24687 =bar <span><nowiki>[[foo]]</nowiki></span>
24688
24689 [[bar <span><nowiki>[[foo]]</nowiki></span>
24690
24691 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24692
24693 =bar <span>foo]]</span><nowiki>=</nowiki>
24694 !!end
24695
24696 #### ----------------------- PRE --------------------------
24697 #### 1. Leading whitespace in SOL context should be escaped
24698 #### ------------------------------------------------------
24699 !! test
24700 1. Leading whitespace in SOL context should be escaped
24701 !! options
24702 parsoid=html2wt
24703 !! html/parsoid
24704 <p> a</p>
24705
24706 <p> a</p>
24707
24708 <p> a(tab)</p>
24709
24710 <p> a
24711 <!--cmt-->
24712 a</p>
24713
24714 <p>a
24715 b</p>
24716
24717 <p>a
24718 b</p>
24719
24720 <p>a
24721 b</p>
24722 !! wikitext
24723 <nowiki> </nowiki>a
24724
24725 <nowiki> </nowiki> a
24726
24727 a(tab)
24728
24729 <nowiki> </nowiki> a
24730 <!--cmt-->
24731 <nowiki> </nowiki>a
24732
24733 a
24734 <nowiki> </nowiki>b
24735
24736 a
24737 b
24738
24739 a
24740 b
24741 !! html/php
24742 <p> a
24743 </p><p> a
24744 </p><p> a(tab)
24745 </p><p> a
24746 a
24747 </p><p>a
24748 b
24749 </p><p>a
24750 b
24751 </p><p>a
24752 b
24753 </p>
24754 !! end
24755
24756 !! test
24757 2. Leading whitespace in non-indent-pre contexts should not be escaped
24758 !! options
24759 parsoid=html2wt
24760 !! html/parsoid
24761 <p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
24762 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24763 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
24764 b</span></li>
24765 </ol>
24766 !! wikitext
24767 foo <ref>''a''
24768 b</ref>
24769 <references />
24770 !! end
24771
24772 !! test
24773 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24774 !! options
24775 parsoid=html2wt
24776 !! html/parsoid
24777 <blockquote>
24778 <p>
24779 a
24780 <span>b</span>
24781 c</p>
24782 </blockquote>
24783 !! wikitext
24784 <blockquote>
24785 a
24786 <span>b</span>
24787 c
24788 </blockquote>
24789 !! end
24790
24791 !! test
24792 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24793 !! options
24794 options=html2wt
24795 !! html/parsoid
24796 <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>
24797 !! wikitext
24798 [[File:Foobar.jpg|thumb|caption]]
24799 !! end
24800
24801 !! test
24802 5. Nowiki escaping should account for indent-pres
24803 !! options
24804 parsoid=html2wt
24805 !! html/parsoid
24806 <pre>==foo==</pre>
24807 !! wikitext
24808 ==foo==
24809 !! end
24810
24811 !!test
24812 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24813 !! options
24814 parsoid=html2wt
24815 !! html/parsoid
24816 <pre>
24817 * foo
24818 * bar
24819 </pre>
24820 !! wikitext
24821 * foo
24822 * bar
24823 !! end
24824
24825 #### --------------- Behavior Switches --------------------
24826
24827 !! test
24828 1. Valid behavior switches should be escaped
24829 !! options
24830 parsoid=html2wt
24831 !! html/parsoid
24832 __TOC__
24833 <i>__TOC__</i>
24834 !! wikitext
24835 <nowiki>__TOC__</nowiki>
24836 ''<nowiki>__TOC__</nowiki>''
24837 !! end
24838
24839 !! test
24840 2. Invalid behavior switches should not be escaped
24841 !! options
24842 parsoid=html2wt
24843 !! html/parsoid
24844 __TOO__
24845 __|__
24846 !! wikitext
24847 __TOO__
24848 __|__
24849 !! end
24850
24851 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24852 !! test
24853 Behavior switches should be SOL-transparent
24854 !! options
24855 parsoid=html2wt
24856 !! html/parsoid
24857 <meta property="mw:PageProp/toc" />
24858
24859 <!-- this one's bogus -->
24860 <pre>__TOO__</pre>
24861
24862 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24863
24864 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24865 !! wikitext
24866 __TOC__
24867
24868 <!-- this one's bogus -->
24869 __TOO__
24870
24871 __TOC__ foo
24872
24873 __TOC__
24874 bar
24875 !! end
24876
24877 #### --------------- HTML tags ---------------
24878 #### 1. a tags
24879 #### 2. other tags
24880 #### 3. multi-line html tag
24881 #### 4. extension tags
24882 #### -----------------------------------------
24883 !! test
24884 1. a tags
24885 !! options
24886 parsoid=html2wt
24887 !! html/parsoid
24888 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24889 !! wikitext
24890 <a href="http://google.com">google</a>
24891 !! end
24892
24893 !! test
24894 2. other tags
24895 !! options
24896 parsoid=html2wt
24897 !! html/parsoid
24898 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24899 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24900 <li> &lt;td&gt;</li></ul>
24901
24902 !! wikitext
24903 * <nowiki><div>foo</div></nowiki>
24904 * <nowiki><div style="color:red">foo</div></nowiki>
24905 * <nowiki><td></nowiki>
24906 !! end
24907
24908 !! test
24909 3. multi-line html tag
24910 !! options
24911 parsoid=html2wt
24912 !! html/parsoid
24913 <p>&lt;div
24914 &gt;foo&lt;/div
24915 &gt;
24916 </p>
24917 !! wikitext
24918 <nowiki><div
24919 >foo</div
24920 ></nowiki>
24921 !! end
24922
24923 !! test
24924 4. extension tags
24925 !! options
24926 parsoid=html2wt
24927 !! html/parsoid
24928 <p>&lt;ref&gt;foo&lt;/ref&gt;
24929 </p><p>&lt;ref&gt;bar
24930 </p><p>baz&lt;/ref&gt;
24931 </p>
24932 !! wikitext
24933 <nowiki><ref>foo</ref></nowiki>
24934
24935 <nowiki><ref>bar</nowiki>
24936
24937 baz<nowiki></ref></nowiki>
24938 !! end
24939
24940 #### --------------- Others ---------------
24941 !! test
24942 Escaping nowikis
24943 !! options
24944 parsoid=html2wt
24945 !! html/parsoid
24946 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24947 </p>
24948 !! wikitext
24949 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24950 !! end
24951
24952 ## The quote-char in the input is necessary for triggering the bug
24953 !! test
24954 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24955 !! options
24956 parsoid=html2wt
24957 !! html/parsoid
24958 <p>foo's bar :</p>
24959 !! wikitext
24960 foo's bar :
24961 !! end
24962
24963 #----------- End of wikitext escaping tests --------------
24964
24965 !! test
24966
24967 Tag-like HTML structures are passed through as text
24968 !! wikitext
24969 <x y>
24970
24971 <x.y>
24972
24973 <x-y>
24974
24975 1>2
24976
24977 x<y
24978
24979 a>b
24980
24981 1<d e>f
24982 !! html
24983 <p>&lt;x y&gt;
24984 </p><p>&lt;x.y&gt;
24985 </p><p>&lt;x-y&gt;
24986 </p><p>1&gt;2
24987 </p><p>x&lt;y
24988 </p><p>a&gt;b
24989 </p><p>1&lt;d e&gt;f
24990 </p>
24991 !! end
24992
24993 !! test
24994 HTML tag with necessary entities in attributes
24995 !! wikitext
24996 <span title="&amp;amp;">foo</span>
24997 !! html
24998 <p><span title="&amp;amp;">foo</span>
24999 </p>
25000 !! end
25001
25002 !! test
25003 HTML tag with 'unnecessary' entity encoding in attributes
25004 !! wikitext
25005 <span title="&amp;">foo</span>
25006 !! html
25007 <p><span title="&amp;">foo</span>
25008 </p>
25009 !! end
25010
25011 !! test
25012 HTML tag with broken attribute value quoting
25013 !! options
25014 parsoid=wt2html,html2html
25015 !! wikitext
25016 <span title="Hello world>Foo</span>
25017 !! html/php
25018 <p><span title="Hello world">Foo</span>
25019 </p>
25020 !! html/parsoid
25021 <p><span title="Hello world">Foo</span></p>
25022 !! end
25023
25024 !! test
25025 Self-closed tag with broken attribute value quoting
25026 !! options
25027 parsoid=wt2html,html2html
25028 !! wikitext
25029 <div title="Hello world />Foo
25030 !! html/php+tidy
25031 <div title="Hello world"></div>
25032 <p>Foo</p>
25033 !! html/parsoid
25034 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
25035 !! end
25036
25037 !! test
25038 Table with broken attribute value quoting
25039 !! options
25040 parsoid=wt2html,html2html
25041 !! wikitext
25042 {|
25043 | title="Hello world|Foo
25044 |}
25045 !! html/php
25046 <table>
25047 <tr>
25048 <td title="Hello world">Foo
25049 </td></tr></table>
25050
25051 !! html/parsoid
25052 <table>
25053 <tr>
25054 <td title="Hello world">Foo
25055 </td></tr></table>
25056
25057 !! end
25058
25059 !! test
25060 Table with broken attribute value quoting on consecutive lines
25061 !! options
25062 parsoid=wt2html,html2html
25063 !! wikitext
25064 {|
25065 | title="Hello world|Foo
25066 | style="color:red|Bar
25067 |}
25068 !! html/php
25069 <table>
25070 <tr>
25071 <td title="Hello world">Foo
25072 </td>
25073 <td style="color:red">Bar
25074 </td></tr></table>
25075
25076 !! html/parsoid
25077 <table><tbody>
25078 <tr>
25079 <td title="Hello world">Foo
25080 </td><td style="color: red">Bar
25081 </td></tr></tbody></table>
25082
25083 !! end
25084
25085 !!test
25086 Accept empty td cell attribute
25087 !! wikitext
25088 {|
25089 | align="center" | foo || |
25090 |}
25091 !! html
25092 <table>
25093 <tr>
25094 <td align="center"> foo </td>
25095 <td>
25096 </td></tr></table>
25097
25098 !!end
25099
25100 !!test
25101 Non-empty attributes in th-cells
25102 !! wikitext
25103 {|
25104 ! Foo !! style="color: red" | Bar
25105 |}
25106 !! html
25107 <table>
25108 <tr>
25109 <th> Foo </th>
25110 <th style="color: red"> Bar
25111 </th></tr></table>
25112
25113 !!end
25114
25115 !!test
25116 Accept empty attributes in th-cells
25117 !! wikitext
25118 {|
25119 !| foo !!| bar
25120 |}
25121 !! html
25122 <table>
25123 <tr>
25124 <th> foo </th>
25125 <th> bar
25126 </th></tr></table>
25127
25128 !!end
25129
25130 !!test
25131 Empty table rows go away
25132 !! wikitext
25133 {|
25134 | Hello
25135 | there
25136 |- class="foo"
25137 |-
25138 |}
25139 !! html
25140 <table>
25141 <tr>
25142 <td> Hello
25143 </td>
25144 <td> there
25145 </td></tr>
25146
25147 </table>
25148
25149 !! end
25150
25151 ###
25152 ### Parsoid-centric tests for testing RTing of inter-element separators
25153 ### Edge cases not tested by existing parser tests and specific to
25154 ### Parsoid-specific serialization strategies.
25155 ###
25156
25157 !!test
25158 RT-ed inter-element separators should be valid separators
25159 !! wikitext
25160 {|
25161 |- [[foo]]
25162 |}
25163 !! html/php
25164 <table>
25165
25166 </table>
25167
25168 !! html/parsoid
25169 <table>
25170 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25171 </tbody></table>
25172 !!end
25173
25174 # Parsoid-only since PHP parser relies on Tidy for correct output
25175 !!test
25176 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25177 !!options
25178 parsoid
25179 !! wikitext
25180 {|
25181 |<small>foo
25182 bar
25183 |}
25184
25185 {|
25186 |<small>foo<small>
25187 |}
25188 !! html
25189 <table>
25190 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25191 <p>bar</p></small></td></tr>
25192 </tbody></table>
25193
25194 <table>
25195 <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>
25196 </tbody></table>
25197 !!end
25198
25199 # Note that the "style" attribute is really a template parameter here.
25200 # The = would have to be {{=}} if you wanted the literal.
25201 !!test
25202 Empty TD followed by TD with tpl-generated attribute
25203 !! wikitext
25204 {|
25205 |-
25206 |
25207 |{{echo|style='color:red'}}|foo
25208 |}
25209 !! html
25210 <table>
25211
25212 <tr>
25213 <td>
25214 </td>
25215 <td>foo
25216 </td></tr></table>
25217
25218 !!end
25219
25220 !!test
25221 Indented table with an empty td
25222 !! wikitext
25223 {|
25224 |-
25225 |
25226 |foo
25227 |}
25228 !! html
25229 <table>
25230
25231 <tr>
25232 <td>
25233 </td>
25234 <td>foo
25235 </td></tr></table>
25236
25237 !!end
25238
25239 ## We have some newline diffs RT-ing this edge case
25240 ## and it is not important enough -- we seem to be emitting
25241 ## at most 2 newlines after a </tr> and this is unrelated to
25242 ## the issue from T85627 that this is testing.
25243 !!test
25244 Indented table with blank lines in between (T85627)
25245 !! options
25246 parsoid=wt2html
25247 !! wikitext
25248 {|
25249 |foo
25250
25251
25252 |}
25253 !! html
25254 <table>
25255
25256 <tr>
25257 <td>foo
25258 </td></tr></table>
25259
25260 !!end
25261
25262 !!test
25263 Indented block & table
25264 !! wikitext
25265 <div>foo</div>
25266 {|
25267 |foo
25268 |}
25269 !! html/php
25270 <div>foo</div>
25271 <table>
25272 <tr>
25273 <td>foo
25274 </td></tr></table>
25275
25276 !! html/parsoid
25277 <div data-parsoid='{"stx":"html"}'>foo</div>
25278 <table><tbody>
25279 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25280 </tbody></table>
25281 !!end
25282
25283 !! test
25284 Indent and comment before table row
25285 !! wikitext
25286 {|
25287 <!--hi-->|-
25288 | there
25289 |}
25290 !! html/php
25291 <table>
25292
25293 <tr>
25294 <td> there
25295 </td></tr></table>
25296
25297 !! html/parsoid
25298 <table>
25299 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25300 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25301 </tbody></table>
25302 !! end
25303
25304 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25305 !!test
25306 Empty TR followed by a template-generated TR
25307 !!options
25308 parsoid
25309 !! wikitext
25310 {|
25311 |-
25312 {{echo|<tr><td>foo</td></tr>}}
25313 |}
25314 !! html
25315 <table>
25316 <tbody>
25317 <tr></tr>
25318 <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}}]}'>
25319 <td>foo</td></tr>
25320 </tbody></table>
25321 !!end
25322
25323 ## PHP and parsoid output differ for this, and since this is primarily
25324 ## for testing Parsoid's serializer, marking this Parsoid only
25325 !!test
25326 Empty TR followed by mixed-ws-comment line should RT correctly
25327 !!options
25328 parsoid
25329 !! wikitext
25330 {|
25331 |-
25332 <!--c-->
25333 |-
25334 <!--c--> <!--d-->
25335 |}
25336 !! html
25337 <table>
25338 <tbody>
25339 <tr></tr>
25340 <!--c-->
25341 <tr>
25342 <!--c--> </tr><!--d-->
25343 </tbody></table>
25344
25345 !!end
25346
25347 !!test
25348 Multi-line image caption generated by templates with/without trailing newlines
25349 !! wikitext
25350 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25351 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25352 !! html/parsoid
25353 <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>
25354 <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>
25355 !!end
25356
25357 !! test
25358 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25359 !! options
25360 parsoid=html2wt
25361 !! html/parsoid
25362 <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>
25363
25364 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25365 !! wikitext
25366 <includeonly>foo</includeonly>
25367 new para
25368
25369 [[Category:Foo]]
25370
25371 = new heading =
25372 !! end
25373
25374 ## PHP emits broken html for this, and since this is primarily
25375 ## a Parsoid serializer test, marking this Parsoid only
25376 !!test
25377 Improperly nested inline or quotes tags with whitespace in between
25378 !! wikitext
25379 <span> <s>x</span> </s>
25380 ''' ''x''' ''
25381 !! html/parsoid
25382 <p><span> <s>x</s></span><s> </s>
25383 <b> <i>x</i></b><i> </i>
25384 </p>
25385 !!end
25386
25387 !!test
25388 Encapsulate protected attributes from wt
25389 !! wikitext
25390 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25391
25392 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25393 | ok
25394 |}
25395 !! html/parsoid
25396 <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>
25397
25398 <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">
25399 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25400 </tbody></table>
25401 !!end
25402
25403 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25404 ## Having nested or stray pre tags results in the attempt to add duplicates,
25405 ## causing an assertion fail. This test tries to prevent that situation.
25406 !!test
25407 Ensure ParagraphWrapper can deal with stray closing pre tags
25408 !!options
25409 parsoid=wt2html
25410 !! wikitext
25411 plain text</pre>
25412 !! html/parsoid
25413 plain text
25414 !!end
25415
25416 !!test
25417 1. Ensure fostered text content is wrapped in element nodes
25418 !!options
25419 parsoid=wt2html
25420 !! wikitext
25421 <table>hi</table><table>ho</table>
25422 !! html/parsoid
25423 <p>hi</p>
25424 <table></table>
25425 <p>ho</p>
25426 <table></table>
25427 !!end
25428
25429 !!test
25430 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25431 !!options
25432 parsoid=wt2html,wt2wt
25433 !! wikitext
25434 <table>
25435 <tr> || ||
25436 <td> a
25437 </table>
25438 !! html/parsoid
25439 <p> || ||
25440 </p><table>
25441 <tbody><tr><td> a</td></tr>
25442 </tbody></table>
25443 !!end
25444
25445 !!test
25446 Encapsulation properly handles null DSR information from foster box
25447 !!options
25448 parsoid=wt2html,wt2wt
25449 !! wikitext
25450 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25451 !! html/parsoid
25452 <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>
25453 !!end
25454
25455 !!test
25456 1. Encapsulate foster-parented transclusion content
25457 !!options
25458 parsoid=wt2wt,wt2html
25459 !! wikitext
25460 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25461 !! html/parsoid
25462 <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>
25463 <tbody>
25464 <tr>
25465 <td>bar</td>
25466 </tr>
25467 </tbody>
25468 </table>
25469 !!end
25470
25471 !!test
25472 2. Encapsulate foster-parented transclusion content
25473 !!options
25474 parsoid=wt2wt,wt2html
25475 !! wikitext
25476 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25477 !! html/parsoid
25478 <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>
25479 <table>
25480 <tbody>
25481 <tr>
25482 <td>bar</td>
25483 </tr>
25484 </tbody>
25485 </table>
25486 !!end
25487
25488 !!test
25489 3. Encapsulate foster-parented transclusion content
25490 !!options
25491 parsoid=wt2wt,wt2html
25492 !! wikitext
25493 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25494 !! html/parsoid
25495 <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;]}">
25496 <p>foo</p>
25497 </div>
25498 <table>
25499 <tbody>
25500 <tr>
25501 <td>bar</td>
25502 </tr>
25503 </tbody>
25504 </table>
25505 !!end
25506
25507 !!test
25508 4. Encapsulate foster-parented transclusion content
25509 !!options
25510 parsoid=wt2wt,wt2html
25511 !! wikitext
25512 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25513 !! html/parsoid
25514 <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;]}">
25515 <p>foo</p>
25516 </div>
25517 <table>
25518 <tbody>
25519 <tr>
25520 <td>bar</td>
25521 </tr>
25522 </tbody>
25523 </table>
25524 !!end
25525
25526 !!test
25527 5. Encapsulate foster-parented transclusion content
25528 !!options
25529 parsoid=wt2wt,wt2html
25530 !! wikitext
25531 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25532 !! html/parsoid
25533 <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>
25534 <table>
25535 <tbody>
25536 <tr>
25537 <td>
25538 <div>
25539 <p>foo</p>
25540 </div>
25541 </td>
25542 </tr>
25543 </tbody>
25544 </table>
25545 !!end
25546
25547 !!test
25548 6. Encapsulate foster-parented transclusion content
25549 !!options
25550 parsoid=wt2wt,wt2html
25551 !! wikitext
25552 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25553 !! html/parsoid
25554 <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>
25555 <table>
25556 <tbody>
25557 <tr>
25558 <td>
25559 <div>
25560 <p>foo</p>
25561 </div>
25562 </td>
25563 </tr>
25564 </tbody>
25565 </table>
25566 <p>ok</p>
25567 !!end
25568
25569 !!test
25570 7. Encapsulate foster-parented transclusion content
25571 !!options
25572 parsoid=wt2wt,wt2html
25573 !! wikitext
25574 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25575 !! html/parsoid
25576 <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>
25577 <table>
25578 <tbody>
25579 <tr>
25580 <td>bar</td>
25581 </tr>
25582 </tbody>
25583 </table>
25584 !!end
25585
25586 # Note that the wt is broken on purpose: the = should be {{=}} if you
25587 # don't want it to be a template parameter key.
25588 !!test
25589 8. Encapsulate foster-parented transclusion content
25590 !!options
25591 parsoid=wt2wt,wt2html
25592 !! wikitext
25593 {{echo|a
25594 }}{|{{echo|style='color:red'}}
25595 |-
25596 |b
25597 |}
25598 !! html/parsoid
25599 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25600 <span> </span>
25601 <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>
25602 <table>
25603 <tbody>
25604 <tr>
25605 <td>b</td>
25606 </tr>
25607 </tbody>
25608 </table>
25609 !!end
25610
25611 !!test
25612 9. Encapsulate foster-parented transclusion content
25613 !!options
25614 parsoid=wt2wt,wt2html
25615 !! wikitext
25616 <table>{{echo|hi</table>hello}}
25617 !! html/parsoid
25618 <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>
25619 !!end
25620
25621 !!test
25622 Table in fosterable position
25623 !!options
25624 parsoid=wt2html
25625 !! wikitext
25626 {{OpenTable}}
25627 <div>
25628 {|
25629 |}
25630 </div>
25631 |}
25632 !! html/parsoid
25633 <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">
25634 </span>
25635 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25636
25637 <table>
25638 </table>
25639 !!end
25640
25641 # Parsoid only for bug 64747
25642 !! test
25643 Properly encapsulate empty-content transclusions in fosterable positions
25644 !! wikitext
25645 <table>
25646 {{#if:|
25647 <td>foo</td>
25648 }}
25649 </table>
25650 !! html/parsoid
25651 <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"}]]}'>
25652
25653 </table>
25654 !! end
25655
25656 !! test
25657 Always encapsulate foster box when template range is expanded to table
25658 !! options
25659 parsoid=wt2wt
25660 !! wikitext
25661 {|
25662 hello
25663 {{OpenTable}}
25664 |}
25665 !! html/parsoid
25666
25667 !! end
25668
25669 !! test
25670 T115289: Unclosed table
25671 !! wikitext
25672 {{echo|<table>}}<!--c-->[[Category:Two]]
25673 !! html/parsoid
25674 <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>
25675 !! end
25676
25677 !! test
25678 T115289: Don't migrate newlines out of tables with fostered content
25679 !! wikitext
25680 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25681 !! html/parsoid
25682 <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>
25683 !! end
25684
25685 !! test
25686 T73074: More fostering fun
25687 !! wikitext
25688 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25689 !! html/parsoid
25690 <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>
25691 !! end
25692
25693 !!test
25694 Support <object> element with .data attribute
25695 !!options
25696 parsoid=html2wt
25697 !! html/parsoid
25698 <object data="test.swf"></object>
25699 !! wikitext
25700 <object data="test.swf"></object>
25701 !!end
25702
25703 !! test
25704 Don't block XML namespace declaration
25705 !! wikitext
25706 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25707 !! html/php
25708 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25709 </p>
25710 !! html/parsoid
25711 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25712 !! end
25713
25714 # -----------------------------------------------------------------
25715 # The following section of tests are primarily to spec requirements
25716 # around Parsoid's serialization (old, new, edited content)
25717 #
25718 # All these tests are marked Parsoid html2wt and html2html only
25719 # ----------------------------------------------------------------
25720
25721 !! test
25722 Ignore rel attribute in a-tags during serialization to url-links
25723 !! options
25724 parsoid=html2wt
25725 !! html/parsoid
25726 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25727 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25728 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25729 !! wikitext
25730 http://en.wikipedia.org/wiki/Foobar
25731 http://en.wikipedia.org/wiki/Foobar
25732 http://en.wikipedia.org/wiki/Foobar
25733 !! end
25734
25735 # 'mi' is a localinterwiki prefix as well as a language
25736 !! test
25737 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25738 !! options
25739 parsoid=html2wt
25740 !! html/parsoid
25741 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25742 !! wikitext
25743 [[Foo]]
25744 !! end
25745
25746 # See T93839
25747 !! test
25748 New wikilinks should be serialized properly
25749 !! options
25750 parsoid=html2wt
25751 !! html/parsoid
25752 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25753 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25754 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25755 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25756 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25757 !! wikitext
25758 [[Foo]]
25759 [[Foo]]
25760 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25761 http://en.wikipedia.org/wiki/Foo
25762 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25763 !! end
25764
25765 !! test
25766 New wiki links (href variations)
25767 !! options
25768 parsoid=html2wt
25769 !! html/parsoid
25770 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25771 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25772 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25773 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25774 !! wikitext
25775 [[Foo_bar]]
25776 [[Foo_bar]]
25777 [[Foo_bar]]
25778 [[Toxine bactérienne]]
25779 !! end
25780
25781 !! test
25782 New wiki links (content string variations)
25783 !! options
25784 parsoid=html2wt
25785 !! html/parsoid
25786 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25787 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25788 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25789 !! wikitext
25790 [[Foo_bar]]
25791 [[Foo bar]]
25792 [[Foo_bar|./Foo_bar]]
25793 !! end
25794
25795 !! test
25796 New category links (href variations)
25797 !! options
25798 parsoid=html2wt
25799 !! html/parsoid
25800 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25801 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25802 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25803 !! wikitext
25804 [[Category:Toxine bactérienne]]
25805 [[Category:Toxine bactérienne]]
25806 [[Category:Toxine bactérienne]]
25807 !! end
25808
25809 !! test
25810 New sol transparent links don't need indent-pre nowiki protection
25811 !! options
25812 parsoid=html2wt
25813 language=de
25814 !! html/parsoid
25815 <link rel="mw:PageProp/redirect" href="./Main_Page">
25816 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25817 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25818 !! wikitext
25819 #WEITERLEITUNG [[Main Page]]
25820 <!-- this is good --> [[Category:Good]]
25821 <!-- this is great --> [[Kategorie:Great]]
25822 !! end
25823
25824 !! test
25825 New interlanguage links (href variations)
25826 !! options
25827 parsoid=html2wt
25828 !! html/parsoid
25829 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25830 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25831 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25832 !! wikitext
25833 [[es:Toxine bactérienne]]
25834 [[es:Toxine_bactérienne]]
25835 [[es:Toxine_bactérienne]]
25836 !! end
25837
25838 !! test
25839 Image: Modifying size of an image (1)
25840 !! options
25841 parsoid={
25842 "modes": ["wt2wt"],
25843 "changes": [
25844 ["img[height]", "attr", "height", "22"],
25845 ["img[width]", "attr", "width", "200"]
25846 ]
25847 }
25848 !! wikitext
25849 [[Image:Foobar.jpg|230x230px]]
25850 !! wikitext/edited
25851 [[Image:Foobar.jpg|200x200px]]
25852 !!end
25853
25854 !! test
25855 Image: Modifying size of an image (2)
25856 !! options
25857 parsoid={
25858 "modes": ["wt2wt"],
25859 "changes": [
25860 ["img[height]", "attr", "height", "100"],
25861 ["img[width]", "attr", "width", "500"]
25862 ]
25863 }
25864 !! wikitext
25865 [[Image:Foobar.jpg|230x230px]]
25866 !! wikitext/edited
25867 [[Image:Foobar.jpg|500x500px]]
25868 !!end
25869
25870 # Change in size is ignored so long as class='mw-default-size'
25871 !! test
25872 Image: Modifying size of an image (3)
25873 !! options
25874 parsoid={
25875 "modes": ["wt2wt"],
25876 "changes": [
25877 ["figure[class]", "removeClass", "mw-default-size"],
25878 ["figure img", "attr", "height", "19"],
25879 ["figure img", "attr", "width", "170"]
25880 ]
25881 }
25882 !! wikitext
25883 [[Image:Foobar.jpg|thumb]]
25884 !! wikitext/edited
25885 [[Image:Foobar.jpg|thumb|170x170px]]
25886 !!end
25887
25888 !! test
25889 Image: Modifying alignment of an image (bug 48665)
25890 !! options
25891 parsoid={
25892 "modes": ["wt2wt"],
25893 "changes": [
25894 ["figure[class]", "removeClass", "mw-halign-right"],
25895 ["figure[class]", "addClass", "mw-halign-left"]
25896 ]
25897 }
25898 !! wikitext
25899 [[Image:Foobar.jpg|thumb|caption|right]]
25900 !! wikitext/edited
25901 [[Image:Foobar.jpg|thumb|caption|left]]
25902 !! end
25903
25904 !! test
25905 Image: Modifying mw-default-size of an frameless image (bug 62805)
25906 !! options
25907 parsoid={
25908 "modes": ["wt2wt"],
25909 "changes": [
25910 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25911 ]
25912 }
25913 !! wikitext
25914 [[Image:Foobar.jpg|frameless|right]]
25915 !! wikitext/edited
25916 [[Image:Foobar.jpg|frameless|right|220x220px]]
25917 !! end
25918
25919 !! test
25920 Image: Modifying valign of an image (bug 49221)
25921 !! options
25922 parsoid={
25923 "modes": ["wt2wt"],
25924 "changes": [
25925 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25926 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25927 ]
25928 }
25929 !! wikitext
25930 [[File:Foobar.jpg|20px|middle]]
25931 !! wikitext/edited
25932 [[File:Foobar.jpg|20px|text-top]]
25933 !! end
25934
25935 !! test
25936 Image: Modifying alt attribute of an image (bug 56400)
25937 !! options
25938 parsoid={
25939 "modes": ["wt2wt"],
25940 "changes": [
25941 ["img[alt]", "attr", "alt", "some alternate edited text"]
25942 ]
25943 }
25944 !! wikitext
25945 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25946 !! wikitext/edited
25947 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25948 !!end
25949
25950 !! test
25951 Image: Modifying caption of an image
25952 !! options
25953 parsoid={
25954 "modes": ["wt2wt"],
25955 "changes": [
25956 ["figcaption", "text", "new caption"]
25957 ]
25958 }
25959 !! wikitext
25960 [[Image:Foobar.jpg|thumb|original caption]]
25961 !! wikitext/edited
25962 [[Image:Foobar.jpg|thumb|new caption]]
25963 !!end
25964
25965 !! test
25966 Image: empty alt attribute (bug 48924)
25967 !! options
25968 parsoid
25969 !! wikitext
25970 [[File:Foobar.jpg|thumb|alt=|bar]]
25971 !! html
25972 <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>
25973 !! end
25974
25975 !! test
25976 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25977 !! options
25978 parsoid=html2wt
25979 language=ar
25980 disabled
25981 !! html/parsoid
25982 <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>
25983 !! wikitext
25984 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25985 !! end
25986
25987 !! test
25988 Image: Block level image should have \n before and after
25989 !! wikitext
25990 123
25991 [[File:Foobar.jpg|right|thumb|150x150px]]
25992 456
25993 !! html/parsoid
25994 <p>123</p>
25995 <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>
25996 <p>456</p>
25997 !!end
25998
25999 !! test
26000 Image: New block level image should have \n before and after (existing content)
26001 !! wikitext
26002 123
26003 [[File:Foobar.jpg|right|thumb|150x150px]]
26004 456
26005 !! html/parsoid
26006 <p>123</p>
26007 <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>
26008 <p>456</p>
26009 !!end
26010
26011 !! test
26012 Image: upright option (parsoid)
26013 !! wikitext
26014 [[File:Foobar.jpg|thumb|upright|caption]]
26015 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
26016 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
26017 !! html/parsoid
26018 <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>
26019 <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>
26020 <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>
26021 !!end
26022
26023 !! test
26024 Image: upright option is ignored on inline and frame images (parsoid)
26025 !! wikitext
26026 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
26027 !! html/parsoid
26028 <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>
26029 !!end
26030
26031 !! test
26032 Image: from basic HTML (1)
26033 !! options
26034 parsoid=html2wt
26035 !! html/parsoid
26036 <span typeof="mw:Image">
26037 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26038 </span>
26039 !! wikitext
26040 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26041 !! end
26042
26043 !! test
26044 Image: from basic HTML (2)
26045 !! options
26046 parsoid=html2wt
26047 !! html/parsoid
26048 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26049 !! wikitext
26050 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26051 !! end
26052
26053 !! test
26054 Image: from basic HTML (3)
26055 !! options
26056 parsoid=html2wt
26057 !! html/parsoid
26058 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26059 !! wikitext
26060 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26061 !! end
26062
26063 !! test
26064 Image: from basic HTML (4)
26065 !! options
26066 parsoid=html2wt
26067 !! html/parsoid
26068 <img src="./File:Foobar.jpg">
26069 !! wikitext
26070 [[File:Foobar.jpg|link=]]
26071 !! end
26072
26073 !! test
26074 Image: Invalid title as link
26075 !! wikitext
26076 [[File:Foobar.jpg|link=<]]
26077 !! html/php
26078 <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>
26079 </p>
26080 !! html/parsoid
26081 <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>
26082 !! end
26083
26084 !! test
26085 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26086 !! options
26087 parsoid=html2wt
26088 !! html/parsoid
26089 <ul>
26090 <li><p>foo</p></li>
26091 </ul>
26092 !! wikitext
26093 * foo
26094 !! end
26095
26096 !! test
26097 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26098 !! options
26099 parsoid=html2wt
26100 !! html/parsoid
26101 <ul> <li>foo</li></ul>
26102 !! wikitext
26103 * foo
26104 !! end
26105
26106 !! test
26107 Don't strip leading whitespace when handling indent-pre suppressing tags
26108 !! options
26109 parsoid=html2wt
26110 !! html/parsoid
26111 <table>
26112 <tr><td> indented row</td></tr>
26113 </table>
26114 <blockquote><p>
26115 <b>This is very bold of you!</b>
26116 </p>
26117 <table><tr><td>
26118 indented cell (no pre-wrapping!)
26119 </td></tr></table>
26120 </blockquote>
26121 <p>foo</p>
26122 <div>bar</div>
26123 !! wikitext
26124 {|
26125 | indented row
26126 |}
26127 <blockquote>
26128 '''This is very bold of you!'''
26129
26130 {|
26131 |
26132 indented cell (no pre-wrapping!)
26133 |}
26134 </blockquote>
26135 foo
26136 <div>bar</div>
26137 !! end
26138
26139 !! test
26140 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26141 !! options
26142 parsoid=html2wt
26143 !! html/parsoid
26144 <p>foo</p>
26145 <span>bar</span>
26146
26147 <span>foo2
26148 </span>bar2
26149
26150 <div>foo</div>
26151 <span>bar</span>
26152
26153 <div>
26154 <span>foo</span>
26155 </div>
26156 !! wikitext
26157 foo
26158
26159 <span>bar</span>
26160
26161 <span>foo2
26162 <nowiki> </nowiki></span>bar2
26163
26164 <div>foo</div>
26165 <nowiki> </nowiki><span>bar</span>
26166
26167 <div>
26168 <nowiki> </nowiki><span>foo</span>
26169 </div>
26170 !! end
26171
26172 !! test
26173 Lists: Dont insert newlines in a serialized list item.
26174 !! options
26175 parsoid=html2wt
26176 !! html/parsoid
26177 <ul><li>a<br>b</li><li>c</li></ul>
26178 !! wikitext
26179 * a<br>b
26180 * c
26181 !! end
26182
26183 !! test
26184 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26185 !! options
26186 parsoid={
26187 "modes": ["html2wt"],
26188 "scrubWikitext": false
26189 }
26190 !! html/parsoid
26191 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26192 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26193
26194 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26195 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26196
26197 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26198
26199 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26200 !! wikitext
26201 == hello there [[Category:A1]] ==
26202
26203 == [[Category:A2]] hi pal ==
26204
26205 == <!--foo--> [[Category:A3]] how goes it ==
26206
26207 == it goes well [[Category:A4]] <!--bar--> ==
26208
26209 ==howdy [[Category:A5]]==
26210
26211 == __TOC__ ok ==
26212 !! end
26213
26214 !! test
26215 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26216 !! options
26217 parsoid={
26218 "modes": ["html2wt"],
26219 "scrubWikitext": true
26220 }
26221 !! html/parsoid
26222 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26223 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26224
26225 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
26226 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
26227
26228 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26229 !! wikitext
26230 == hello there ==
26231 [[Category:A1]]
26232 [[Category:A2]]
26233
26234 == hi pal ==
26235
26236 <!--foo--> [[Category:A3]]
26237
26238 == how goes it ==
26239
26240 == it goes well ==
26241 [[Category:A4]] <!--bar-->
26242
26243 __TOC__
26244
26245 == ok ==
26246 !! end
26247
26248 !! test
26249 Headings: Don't hoist metas that come from templates
26250 !! options
26251 parsoid={
26252 "modes": ["html2wt"],
26253 "scrubWikitext": true
26254 }
26255 !! html/parsoid
26256 <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>
26257 !! wikitext
26258 == {{echo|foo [[Category:Foo]]}} ==
26259 !! end
26260
26261 !! test
26262 Headings: Category in ref isn't hoisted
26263 !! options
26264 parsoid={
26265 "modes": ["html2wt"],
26266 "scrubWikitext": true
26267 }
26268 !! html/parsoid
26269 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26270
26271 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
26272 !! wikitext
26273 == foo <ref>bar
26274 [[Category:Baz]] </ref> ==
26275
26276 <references />
26277 !! end
26278
26279 !! test
26280 Parsoid: Serialize positional parameters with = in them as named parameter
26281 !! options
26282 parsoid=html2wt
26283 !! html/parsoid
26284 <p about="#mwt1" typeof="mw:Transclusion"
26285 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26286
26287 <p about="#mwt1" typeof="mw:Transclusion"
26288 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26289
26290 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26291 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26292 <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>
26293 !! wikitext
26294 {{echo|1=f=oo}}
26295
26296 {{echo|1=f=oo|2=bar}}
26297
26298 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26299 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26300 {{echo|<nowiki>f=oo</nowiki>|bar}}
26301 !! end
26302
26303 !! test
26304 Parsoid: Serialize positional parameters with = in extlink as named parameter
26305 !! options
26306 parsoid=html2wt
26307 !! html/parsoid
26308 <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>
26309 !! wikitext
26310 {{echo|1=http://stuff?is=ok}}
26311 !! end
26312
26313 !! test
26314 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26315 !! options
26316 parsoid=html2wt
26317 !! html/parsoid
26318 <div>a<p>b</p></div>
26319 <div>a
26320 <p>b</p></div>
26321 <div>
26322 a
26323 <p>b</p></div>
26324 !! wikitext
26325 <div>a
26326 b
26327 </div>
26328 <div>a
26329 b
26330 </div>
26331 <div>
26332 a
26333
26334 b
26335 </div>
26336 !! end
26337
26338 !! test
26339 Substrings resembling wikitext in hrefs should not get nowiki escapes
26340 !! options
26341 parsoid=html2wt
26342 !! html/parsoid
26343 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26344 !! wikitext
26345 [[Foo''bar''baz]]
26346 !! end
26347
26348 !! test
26349 Enforce single-line context in the serializer
26350 !! options
26351 parsoid=html2wt
26352 !! html/parsoid
26353 <h2>testing
26354 123</h2>
26355
26356 <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">
26357 </span><span about="#mwt1">you</span> </h2>
26358
26359 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26360
26361 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
26362 there</span></li></ol>
26363
26364 <ul><li>asd
26365 sdf</li></ul>
26366
26367 <ul><li>foo
26368 bar
26369 baz</li>
26370 <li>foo <b>bar</b>
26371 baz</li></ul>
26372
26373 <dl><dt>hi
26374 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26375 ho</dd></dl>
26376
26377 <dl><dd> <table>
26378 <tbody><tr><td> ha
26379 ha
26380 ha</td></tr>
26381 </tbody></table></dd></dl>
26382 !! wikitext
26383 == testing 123 ==
26384
26385 == hi {{bogus|there
26386 you}} ==
26387
26388 == foo <ref>hello
26389 there</ref> ==
26390
26391 <references />
26392
26393 * asd sdf
26394
26395 * foo bar baz
26396 * foo '''bar''' baz
26397
26398 ; hi ho : hi ho
26399
26400 : {|
26401 | ha
26402 ha
26403 ha
26404 |}
26405 !! end
26406
26407 !! test
26408 Serialize new placeholder space without spans
26409 !! options
26410 parsoid=html2wt
26411 !! html/parsoid
26412 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26413
26414 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26415
26416 <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>
26417 !! wikitext
26418 foo : bar
26419
26420 foo : bar
26421
26422 <ref>foo : bar</ref>ok
26423 !! end
26424
26425
26426 #-----------------------
26427 # Tag minimization tests
26428 #-----------------------
26429
26430 !! test
26431 1. I/B quote minimization: wikitext-only tags should be combined
26432 !! options
26433 parsoid=html2wt
26434 !! html/parsoid
26435 <p><i>A</i><i>B</i></p>
26436 <p><b>A</b><b>B</b></p>
26437 <p><i>A</i><b><i>B</i></b></p>
26438 <p><b>A</b><i><b>B</b></i></p>
26439 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26440 <p><i><b>A</b></i><i><b>B</b></i></p>
26441 <p><i><b>A</b></i><b><i>B</i></b></p>
26442 <p><b><i>A</i></b><i><b>B</b></i></p>
26443 !! wikitext
26444 ''AB''
26445
26446 '''AB'''
26447
26448 ''A'''B'''''
26449
26450 '''A''B'''''
26451
26452 '''A''BC''D'''
26453
26454 '''''AB'''''
26455
26456 '''''AB'''''
26457
26458 '''''AB'''''
26459 !! end
26460
26461 !! test
26462 2. I/B quote minimization: wikitext and html tags should not be combined
26463 !! options
26464 parsoid=html2wt
26465 !! html/parsoid
26466 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26467 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26468 !! wikitext
26469 ''A''<i>B</i>
26470
26471 ''A''<nowiki/>'''<i>B</i>'''
26472 !! end
26473
26474 !! test
26475 3. I/B quote minimization: templated content stops minimization
26476 !! options
26477 parsoid=html2wt
26478 !! html/parsoid
26479 <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>
26480 <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>
26481 !! wikitext
26482 ''A''{{echo|''B''}}
26483
26484 ''A''{{echo|'''''B'''''}}
26485 !! end
26486
26487 !! test
26488 4. I/B quote minimization: new content should be mimimized with adjacent old content
26489 !! options
26490 parsoid=html2wt
26491 !! html/parsoid
26492 <p><i>A</i><i>B</i></p>
26493 <p><b>A</b><b>B</b></p>
26494 <p><i>A</i><b><i>B</i></b></p>
26495 !! wikitext
26496 ''AB''
26497
26498 '''AB'''
26499
26500 ''A'''B'''''
26501 !! end
26502
26503 !! test
26504 5a. Merge adjacent quote nodes if they've been edited
26505 !! options
26506 parsoid={
26507 "modes": ["wt2wt", "selser"],
26508 "changes": [
26509 ["p", "contents", "remove", ":contains('b')"]
26510 ]
26511 }
26512 !! wikitext
26513 ''a''b''c''
26514 !! wikitext/edited
26515 ''ac''
26516 !! end
26517
26518 !! test
26519 5b. Merge adjacent quote nodes if they've been edited
26520 !! options
26521 parsoid={
26522 "modes": ["wt2wt", "selser"],
26523 "changes": [
26524 ["#x", "remove"]
26525 ]
26526 }
26527 !! wikitext
26528 ''a''<span id="x">b</span>''c''
26529 !! wikitext/edited
26530 ''ac''
26531 !! end
26532
26533 !! test
26534 1. Merge adjacent link nodes as long as at least one element is new
26535 !! options
26536 parsoid={
26537 "modes": ["html2wt"],
26538 "scrubWikitext": true
26539 }
26540 !! html/parsoid
26541 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26542 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26543 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26544 !! wikitext
26545 [[Football]]
26546 [[Football]]
26547 [[Football|Foot]][[Football|ball]]
26548 !! end
26549
26550 !! test
26551 2. Merge adjacent link nodes and enable additional normalizations
26552 !! options
26553 parsoid={
26554 "modes": ["html2wt"],
26555 "scrubWikitext": true
26556 }
26557 !! html/parsoid
26558 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26559 !! wikitext
26560 [[Football|''Football'']]
26561 !! end
26562
26563 !! test
26564 3. Don't merge adjacent link nodes if scrubWikitext is false
26565 !! options
26566 parsoid={
26567 "modes": ["html2wt"],
26568 "scrubWikitext": false
26569 }
26570 !! html/parsoid
26571 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26572 !! wikitext
26573 [[Football|Foot]][[Football|ball]]
26574 !! end
26575
26576 #------------------------------
26577 # End of tag minimization tests
26578 #------------------------------
26579
26580 !!test
26581 Bug 54262: New entities
26582 !! options
26583 parsoid=html2wt
26584 !! html/parsoid
26585 <span typeof="mw:Entity">&nbsp;</span>
26586 !! wikitext
26587 &nbsp;
26588 !! end
26589
26590 ## Note that there is no wikitext output for 'unknownproperty' ##
26591 ## Unknown magic words are silently dropped ##
26592
26593 !! test
26594 Magic words
26595 !! options
26596 parsoid=html2wt
26597 !! html/parsoid
26598 <meta property='mw:PageProp/toc' />
26599 <meta property='mw:PageProp/notoc' />
26600 <meta property='mw:PageProp/forcetoc' />
26601 <meta property='mw:PageProp/index' />
26602 <meta property='mw:PageProp/noindex' />
26603 <meta property='mw:PageProp/nogallery' />
26604 <meta property='mw:PageProp/noeditsection' />
26605 <meta property='mw:PageProp/notitleconvert' />
26606 <meta property='mw:PageProp/nocontentconvert' />
26607 <meta property='mw:PageProp/unknownproperty' />
26608 !! wikitext
26609 __TOC__
26610 __NOTOC__
26611 __FORCETOC__
26612 __INDEX__
26613 __NOINDEX__
26614 __NOGALLERY__
26615 __NOEDITSECTION__
26616 __NOTITLECONVERT__
26617 __NOCONTENTCONVERT__
26618 !! end
26619
26620 !! test
26621 Consecutive <pre>s should not get merged
26622 !! options
26623 parsoid=html2wt,html2html
26624 !! html/parsoid
26625 <pre>a</pre><pre>b</pre>
26626
26627 <pre>c
26628 </pre><pre>
26629 d</pre>
26630
26631 <pre>e
26632
26633 </pre><pre>
26634
26635 f</pre>
26636 !! wikitext
26637 a
26638
26639 b
26640
26641 c
26642
26643 d
26644
26645 e
26646
26647
26648
26649 f
26650 !! end
26651
26652 !! test
26653 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26654 !! options
26655 parsoid=html2wt
26656 !! html/parsoid
26657 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26658 !! wikitext
26659 [[Special:BookSources/1234567890|ISBN 1234567895]]
26660 !! end
26661
26662 !! test
26663 Edited RFC links not serializable as RFC links should serialize as extlinks
26664 !! options
26665 parsoid=html2wt
26666 !! html/parsoid
26667 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26668 !! wikitext
26669 [//tools.ietf.org/html/rfc123 New RFC]
26670 !! end
26671
26672 !! test
26673 Edited PMID links not serializable as PMID links should serialize as extlinks
26674 !! options
26675 parsoid=html2wt
26676 !! html/parsoid
26677 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26678 !! wikitext
26679 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26680 !! end
26681
26682 !! test
26683 WTS of autolinks with trailing/surrounding context
26684 !! options
26685 parsoid=html2wt
26686 !! html/parsoid
26687 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26688 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26689 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26690 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26691 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26692 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26693 !! wikitext
26694 http://cscott.net'''foo'''
26695
26696 http://cscott.net<b>foo</b>
26697
26698 '''http://cscott.net'''
26699
26700 '''http://cscott.net '''
26701
26702 '''http://cscott.net<nowiki/>x'''
26703
26704 http://cscott.net<nowiki/>x
26705 !! end
26706
26707 !! test
26708 WTS of autolinks with nowikis (round-trip)
26709 !! wikitext
26710 x<nowiki/>http://cscott.net<nowiki/>x
26711 !! html/parsoid
26712 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26713 !! end
26714
26715 # this is the "easy" test because it leaves in place all the
26716 # data-parsoid information indicating this is an autolink
26717 !! test
26718 WTS of autolinks with escapes (editing)
26719 !! options
26720 parsoid={
26721 "modes": ["wt2wt"],
26722 "changes": [
26723 [ "meta", "remove" ]
26724 ]
26725 }
26726 !! wikitext
26727 x<nowiki/>http://cscott.net<nowiki/>x
26728 !! wikitext/edited
26729 x<nowiki/>http://cscott.net<nowiki/>x
26730 !! end
26731
26732 !! test
26733 WTS of edited autolink-like text (T103364)
26734 !! options
26735 parsoid={
26736 "modes": ["wt2wt"],
26737 "changes": [
26738 [ "span[typeof]", "removeAttr", "typeof" ]
26739 ]
26740 }
26741 !! wikitext
26742 Not a link: <nowiki>http://example.com</nowiki>.
26743 !! wikitext/edited
26744 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26745 !! end
26746
26747 !! test
26748 WTS of newly-authored autolink-like text (T103364)
26749 !! options
26750 parsoid=html2wt
26751 !! html/parsoid
26752 <p>http://example.com is not a link.</p>
26753 !! wikitext
26754 <nowiki>http://example.com</nowiki> is not a link.
26755 !! end
26756
26757 !! test
26758 WTS of autolink-like text after an autolink (T108563)
26759 !! options
26760 parsoid=html2wt
26761 !! html/parsoid
26762 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26763 !! wikitext
26764 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26765 !! end
26766
26767 !! test
26768 Magic links inside links (not autolinked)
26769 !! wikitext
26770 [[Foo|http://example.com]]
26771 [[Foo|RFC 1234]]
26772 [[Foo|PMID 1234]]
26773 [[Foo|ISBN 123456789x]]
26774
26775 [http://foo.com http://example.com]
26776 [http://foo.com RFC 1234]
26777 [http://foo.com PMID 1234]
26778 [http://foo.com ISBN 123456789x]
26779 !! html+tidy
26780 <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>
26781 <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>
26782 !! html/parsoid
26783 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26784 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26785 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26786 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26787
26788 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26789 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26790 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26791 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26792 !! end
26793
26794 !! test
26795 Magic links inside image captions (autolinked)
26796 !! wikitext
26797 [[File:Foobar.jpg|thumb|http://example.com]]
26798 [[File:Foobar.jpg|thumb|RFC 1234]]
26799 [[File:Foobar.jpg|thumb|PMID 1234]]
26800 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26801 !! html+tidy
26802 <div class="thumb tright">
26803 <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>
26804 <div class="thumbcaption">
26805 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26806 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26807 </div>
26808 </div>
26809 <div class="thumb tright">
26810 <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>
26811 <div class="thumbcaption">
26812 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26813 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26814 </div>
26815 </div>
26816 <div class="thumb tright">
26817 <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>
26818 <div class="thumbcaption">
26819 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26820 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26821 </div>
26822 </div>
26823 <div class="thumb tright">
26824 <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>
26825 <div class="thumbcaption">
26826 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26827 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26828 </div>
26829 </div>
26830 !! html/parsoid
26831 <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>
26832 <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>
26833 <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>
26834 <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>
26835 !! end
26836
26837 !! test
26838 WTS of magic word text (T109371)
26839 !! options
26840 parsoid=html2wt
26841 !! html/parsoid
26842 <p>RFC 1234</p>
26843 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26844 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26845 !! wikitext
26846 <nowiki>RFC 1234</nowiki>
26847
26848 [http://foo.com RFC 1234]
26849
26850 [[Foo|RFC 1234]]
26851 !! end
26852
26853 !! test
26854 Edited Redirect link should emit a non-piped wikitext link
26855 !! options
26856 parsoid=html2wt
26857 !! html/parsoid
26858 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26859 !! wikitext
26860 #REDIRECT [[Bar]]
26861 !! end
26862
26863 !! test
26864 T75121: Infer extension name from typeOf if data-mw is not present
26865 !! options
26866 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26867 !! html/parsoid
26868 <div typeOf="mw:Extension/foo"></div>
26869 !! wikitext
26870 <foo />
26871 !! end
26872
26873 # Note that the <p> wrapping isn't present in PHP parser output
26874 # The important thing for this test is that P-wrapping doesn't
26875 # interfere with the <nowiki> protection for leading - in <td>
26876 # (which isn't necessary for <th>).
26877 !! test
26878 T88318: p-wrapped dash in table.
26879 !! options
26880 parsoid=html2wt,wt2wt
26881 !! html/parsoid
26882 <table><tbody>
26883 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26884 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26885 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26886 </tbody></table>
26887 !! wikitext
26888 {|
26889 !-
26890 !-
26891 |-
26892 |<nowiki>-</nowiki>
26893 |<nowiki>- </nowiki>
26894 |-
26895 |<small>-</small>
26896 |<br>
26897 -
26898 |<br>
26899 -
26900 |}
26901 !! html/php+tidy
26902 <table>
26903 <tr>
26904 <th>-</th>
26905 <th>-</th>
26906 </tr>
26907 <tr>
26908 <td>-</td>
26909 <td>-</td>
26910 </tr>
26911 <tr>
26912 <td><small>-</small></td>
26913 <td><br />
26914 <p>-</p>
26915 </td>
26916 <td><br />
26917 <p>-</p>
26918 </td>
26919 </tr>
26920 </table>
26921 !! end
26922
26923 !! test
26924 T149209: WTS: Handle newlines in table cells properly
26925 !! options
26926 parsoid=html2wt
26927 !! html/parsoid
26928 <table>
26929 <tbody>
26930 <tr><td>a
26931 b
26932 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26933 <tr><td><p>x</p>
26934 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26935 </tbody></table>
26936 <table>
26937 <tbody>
26938 <tr><th>a
26939 b
26940 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26941 <tr><th><p>x</h>
26942 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26943 </tbody></table>
26944 !! wikitext
26945 {|
26946 |a
26947 b
26948 |c
26949 |-
26950 |x
26951 {{!}}y
26952 |}
26953 {|
26954 !a
26955 b
26956 !c
26957 |-
26958 !x
26959 !y
26960 |}
26961 !! end
26962
26963 !! test
26964 T149209: Selser: Handle newlines in table cells properly
26965 !! options
26966 parsoid={
26967 "modes": ["selser"],
26968 "changes": [
26969 [ "#h1", "html", "a\nb\n" ],
26970 [ "#h2", "html", "a\nb\n" ],
26971 [ "#c1", "html", "a\nb\n" ],
26972 [ "#c2", "html", "<p>a</p>" ],
26973 [ "#c3", "html", "<p>a</p>" ],
26974 [ "#c4", "html", "edit-me<p>a</p>" ]
26975 ]
26976 }
26977 !! wikitext
26978 {|
26979 ! id="h1" |edit-me!!1
26980 |-
26981 ! id="h2" |edit-me||2
26982 |-
26983 | id="c1" |edit-me||3
26984 |-
26985 | id="c2" |edit-me||4
26986 |-
26987 | id="c3" |edit-me||p||q||r
26988 |-
26989 | id="c4" |edit-me||p||q||r
26990 |}
26991 !! wikitext/edited
26992 {|
26993 ! id="h1" |a
26994 b
26995 !1
26996 |-
26997 ! id="h2" |a
26998 b
26999 !2
27000 |-
27001 | id="c1" |a
27002 b
27003 |3
27004 |-
27005 | id="c2" |a
27006 |4
27007 |-
27008 | id="c3" |a
27009 |p||q||r
27010 |-
27011 | id="c4" |edit-me
27012 a
27013 |p||q||r
27014 |}
27015 !! end
27016
27017 !! test
27018 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
27019 !! options
27020 parsoid=html2wt
27021 !! html/parsoid
27022 <table id='mwAb'>
27023 <td id='mwAc'>foo</td>
27024 <td id='serialize-this'>bar</td>
27025 </table>
27026 !! wikitext
27027 {|
27028 |foo
27029 | id="serialize-this" |bar
27030 |}
27031 !! end
27032
27033 !! test
27034 Parsoid-like element ids should not be serialized to wikitext unless shadowed
27035 !! options
27036 parsoid=html2wt
27037 !! html/parsoid
27038 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27039 !! wikitext
27040 <div id="hello">ok</div>
27041 !! end
27042
27043 !! test
27044 WTS change modes
27045 !! options
27046 parsoid={
27047 "modes": ["wt2wt"],
27048 "changes": [
27049 [ "#xyz", "before", "<b>before</b> stuff " ],
27050 [ "#xyz", "after", " stuff <i>after</i>" ],
27051 [ "#xyz", "html", "x <b>y</b> z" ]
27052 ]
27053 }
27054 !! wikitext
27055 <span id="xyz">hello</span>
27056 !! wikitext/edited
27057 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27058 !! end
27059
27060 !! test
27061 Never serialize a-tag as html, regardless of what data-parsoid has to say
27062 !! options
27063 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27064 !! html/parsoid
27065 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27066 !! wikitext
27067 [[Foo]]
27068 !! end
27069
27070 ## SSS FIXME: This is broken output nevertheless.
27071 ## What might be a reasonable non-broken output for this?
27072 ## This is an edge case unlikely to be seen in production
27073 ## that I am not wasting more time on this right now.
27074 !! test
27075 Never serialize a-tag as html, no matter what attributes it has
27076 !! options
27077 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27078 !! html/parsoid
27079 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27080 !! wikitext
27081 [http://boo.org http://boohoo.org]
27082 !! end
27083
27084 # Misnested is an indication that selser can reuse the source but these have
27085 # shown to sneak through on occasion. See T101768.
27086 # The original wikitext here is: [http://test.com [[one]] two three]
27087 !! test
27088 Strip span tags added to mark misnested links
27089 !! options
27090 parsoid=html2wt
27091 !! html/parsoid
27092 <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>
27093 !! wikitext
27094 [http://test.com][[one]] two three
27095 !! end
27096
27097 !! test
27098 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27099 !! options
27100 parsoid=html2wt
27101 !! html/parsoid
27102 <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|}"]}'>
27103 <tbody><tr><td>d
27104 </td></tr>
27105 </tbody></table>
27106 !! wikitext
27107 {{echo|a}}
27108 {|{{echo|c
27109 {{!}}d
27110 }}
27111 |}
27112 !! end
27113
27114 ## This test verifies the presence and computation of this attribute indirectly
27115 ## by making an edit and ensuring that the serialization is correct (which it would be
27116 ## only if firstWikitextNode is properly set).
27117 !! test
27118 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27119 !! options
27120 parsoid= {
27121 "modes": ["wt2wt"],
27122 "changes": [
27123 [ "div#x", "remove" ],
27124 [ "div", "before", "<div>new</div>" ]
27125 ]
27126 }
27127 !! wikitext
27128 <div id="x">foo</div>
27129 {|
27130 {{echo|<div>boo</div>
27131 {{!}}b}}
27132 |c
27133 |}
27134 !! wikitext/edited
27135
27136 <div>new</div>
27137 {|
27138 {{echo|<div>boo</div>
27139 {{!}}b}}
27140 |c
27141 |}
27142 !! end
27143
27144 # --------------------------------------------
27145 # Tests spec'ing wikitext serialization norms |
27146 # --------------------------------------------
27147
27148 !! test
27149 1. Categories should always be serialized on their own line
27150 !! options
27151 parsoid=html2wt
27152 !! html/parsoid
27153 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27154 !! wikitext
27155 foo
27156 [[Category:Foo]]
27157 bar
27158 !! end
27159
27160 !! test
27161 2. Categories that are part of templates should not introduce a line break
27162 !! wikitext
27163 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27164 !! html/parsoid
27165 <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>
27166 !! end
27167
27168 # Careful while editing these next 2 tests. There are \u200f characters
27169 # before and after the <link> tags in the HTML and following some
27170 # of the categories in wikitext
27171 # Do not remove these characters in edits.
27172 #
27173 # As part of the serialization, these bidi characters will get stripped.
27174 !! test
27175 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27176 !! options
27177 parsoid={
27178 "modes": ["html2wt"],
27179 "scrubWikitext": true
27180 }
27181 !! html/parsoid
27182 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27183 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27184 !! wikitext
27185 [[קטגוריה:טקסים]]
27186 [[קטגוריה: שיטות משפט]]
27187 !! end
27188
27189 !! test
27190 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27191 !! options
27192 parsoid={
27193 "modes": ["html2wt"],
27194 "scrubWikitext": true
27195 }
27196 !! html/parsoid
27197 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27198 !! wikitext
27199 [[קטגוריה:טקסים]]
27200 ‏y
27201 !! end
27202
27203 !! test
27204 Lists: Add space after bullets
27205 !! options
27206 parsoid=html2wt
27207 !! html/parsoid
27208 <ul>
27209 <li>foo</li>
27210 <li> bar</li>
27211 <li><span> baz</span></li>
27212 </ul>
27213 !! wikitext
27214 * foo
27215 * bar
27216 * <span> baz</span>
27217 !! end
27218
27219 !! test
27220 1. Headings: Add space before/after == (T53744)
27221 !! options
27222 parsoid=html2wt
27223 !! html/parsoid
27224 <h2>foo</h2>
27225 <h2> bar</h2>
27226 <h2>baz </h2>
27227 <h2><span> baz</span></h2>
27228 !! wikitext
27229 == foo ==
27230
27231 == bar ==
27232
27233 == baz ==
27234
27235 == <span> baz</span> ==
27236 !! end
27237
27238 !! test
27239 2. Headings: Add space before/after == even after hoisted content
27240 !! options
27241 parsoid={
27242 "modes": ["html2wt"],
27243 "scrubWikitext": true
27244 }
27245 !! html/parsoid
27246 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27247 !! wikitext
27248 [[Category:A2]]
27249
27250 == ok ==
27251 !! end
27252
27253 !! test
27254 1. Headings: suppress newly created empty headings
27255 !! options
27256 parsoid={
27257 "modes": ["html2wt"],
27258 "scrubWikitext": true
27259 }
27260 !! html/parsoid
27261 <h2></h2>
27262 !! wikitext
27263 !! end
27264
27265 !! test
27266 2. Headings: don't suppress empty headings if scrubWikitext is false
27267 !! options
27268 parsoid=html2wt
27269 !! html/parsoid
27270 <h2></h2>
27271 !! wikitext
27272 ==<nowiki/>==
27273 !! end
27274
27275 !! test
27276 3. Headings: suppress empty headings on edits
27277 !! options
27278 parsoid={
27279 "modes": ["selser"],
27280 "scrubWikitext": true,
27281 "changes": [
27282 [ "#x", "remove"]
27283 ]
27284 }
27285 !! wikitext
27286 ==<span id="x">foo</span>==
27287 !! wikitext/edited
27288 !! end
27289
27290 !! test
27291 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27292 !! options
27293 parsoid={
27294 "modes": ["html2wt"],
27295 "scrubWikitext": true
27296 }
27297 !! html/parsoid
27298 <h2>foo<br/>bar</h2>
27299 <h2>foo <span><br/>bar</span> baz</h2>
27300 !! wikitext
27301 == foo bar ==
27302
27303 == foo <span> bar</span> baz ==
27304 !! end
27305
27306 !! test
27307 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27308 !! options
27309 parsoid={
27310 "modes": ["html2wt"],
27311 "scrubWikitext": false
27312 }
27313 !! html/parsoid
27314 <h2>foo<br/>bar</h2>
27315 !! wikitext
27316 == foo<br> bar ==
27317 !! end
27318
27319 !! test
27320 1. WT Quote Tags: suppress newly created empty style tags
27321 !! options
27322 parsoid={
27323 "modes": ["html2wt"],
27324 "scrubWikitext": true
27325 }
27326 !! html/parsoid
27327 <i></i><b></b>
27328 !! wikitext
27329 !! end
27330
27331 !! test
27332 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27333 !! options
27334 parsoid=html2wt
27335 !! html/parsoid
27336 <i></i><b></b>
27337 !! wikitext
27338 ''<nowiki/>'''''<nowiki/>'''
27339 !! end
27340
27341 !! test
27342 3. WT Quote Tags: suppress empty style tags on edits
27343 !! options
27344 parsoid={
27345 "modes": ["selser"],
27346 "scrubWikitext": true,
27347 "changes": [
27348 [ "#x", "remove"]
27349 ]
27350 }
27351 !! wikitext
27352 '''<span id="x">foo</span>'''
27353 !! wikitext/edited
27354 !! end
27355
27356 !! test
27357 1. Anchors: suppress newly created empty anchors
27358 !! options
27359 parsoid={
27360 "modes": ["html2wt"],
27361 "scrubWikitext": true
27362 }
27363 !! html/parsoid
27364 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27365 !! wikitext
27366 !! end
27367
27368 !! test
27369 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27370 !! options
27371 parsoid={
27372 "modes": ["html2wt"],
27373 "scrubWikitext": false
27374 }
27375 !! html/parsoid
27376 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27377 !! wikitext
27378 [[Test|<nowiki/>]]
27379 !! end
27380
27381 !! test
27382 3. Anchors: suppress empty anchors on edits
27383 !! options
27384 parsoid={
27385 "modes": ["selser"],
27386 "scrubWikitext": true,
27387 "changes": [
27388 [ "#x", "remove"]
27389 ]
27390 }
27391 !! wikitext
27392 [[Test|<span id="x">foo</span>]]
27393 !! wikitext/edited
27394 !! end
27395
27396 !! test
27397 3a. Anchors: do not suppress numbered extlinks
27398 !! options
27399 parsoid={
27400 "modes": ["wt2wt"],
27401 "scrubWikitext": true
27402 }
27403 !! wikitext
27404 [http://foo.com]
27405 !! html/parsoid
27406 <a rel="mw:ExtLink" href="http://foo.com"></a>
27407 !! end
27408
27409 !! test
27410 3b. Anchors: do not suppress numbered extlinks
27411 !! options
27412 parsoid={
27413 "modes": ["wt2wt"],
27414 "scrubWikitext": true,
27415 "changes": [
27416 [ "#x", "remove"]
27417 ]
27418 }
27419 !! wikitext
27420 [http://foo.com <span id="x">foo</span>]
27421 !! wikitext/edited
27422 [http://foo.com]
27423 !! end
27424
27425 !!test
27426 Normalizations should be restricted to edited content
27427 !!options
27428 parsoid={
27429 "modes": ["selser"],
27430 "scrubWikitext": true,
27431 "changes": [
27432 [ "h1", "before", "<i></i>"]
27433 ]
27434 }
27435 !!wikitext
27436 a
27437 = =
27438 b
27439 !!wikitext/edited
27440 a
27441 = =
27442 b
27443 !!end
27444
27445 !! test
27446 1. Multiple normalizations (html2wt)
27447 !! options
27448 parsoid={
27449 "modes": ["html2wt"],
27450 "scrubWikitext": true
27451 }
27452 !! html
27453 <h2><i></i></h2>
27454 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27455 </a><b><i></i></b>x</p>
27456 !! wikitext
27457
27458 [[foo]]
27459 x
27460
27461 !! end
27462
27463 !! test
27464 2. Multiple normalizations (selser)
27465 !! options
27466 parsoid={
27467 "modes": ["selser"],
27468 "scrubWikitext": true,
27469 "changes": [
27470 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27471 ]
27472 }
27473 !! wikitext
27474 <span id="x">foo</span>
27475 !! wikitext/edited
27476 <span id="x">foo</span>
27477
27478 x
27479 !! end
27480
27481 !! test
27482 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27483 !! options
27484 parsoid={
27485 "modes": ["html2wt"],
27486 "scrubWikitext": true
27487 }
27488 !! html/parsoid
27489 <p> hi</p>
27490 <p> hello</p>
27491 !! wikitext
27492 hi
27493
27494 hello
27495 !! end
27496
27497 !! test
27498 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27499 !! options
27500 parsoid=html2wt
27501 !! html/parsoid
27502 <p> hi</p>
27503 <p> hello</p>
27504 !! wikitext
27505 <nowiki> </nowiki>hi
27506
27507 <nowiki> </nowiki> hello
27508 !! end
27509
27510 !! test
27511 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27512 !! options
27513 parsoid={
27514 "modes": ["html2wt"],
27515 "scrubWikitext": true
27516 }
27517 !! html/parsoid
27518 <p>Foo
27519 bar
27520 baz</p>
27521
27522 <table><tr><td>Foo
27523 bar
27524 baz bang</td></tr></table>
27525
27526 <p><!--boo--> foo
27527 bar</p>
27528
27529 <p> foo
27530 bar<span>boo</span></p>
27531 !! wikitext
27532 Foo
27533 bar
27534 baz
27535
27536 {|
27537 |Foo
27538 bar
27539 baz bang
27540 |}
27541
27542 <!--boo-->foo
27543 bar
27544
27545 foo
27546 bar<span>boo</span>
27547 !! end
27548
27549 !! test
27550 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27551 !! options
27552 parsoid={
27553 "modes": ["selser"],
27554 "scrubWikitext": true,
27555 "changes": [
27556 [ "p", "html", " a\n b" ]
27557 ]
27558 }
27559 !! wikitext
27560 xyz
27561 !! wikitext/edited
27562 a
27563 b
27564 !! end
27565
27566 !! test
27567 1. New links that end in spaces
27568 !! options
27569 parsoid={
27570 "modes": ["html2wt"],
27571 "scrubWikitext": false
27572 }
27573 !! html/parsoid
27574 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27575 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27576 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27577 !! wikitext
27578 [[Berlin ]]<nowiki/>is the capital of Germany.
27579
27580 [[Foo ]]'''bar'''
27581
27582 [[Boston ]] is a city.
27583 !! end
27584
27585 !! test
27586 2. New links that end in spaces
27587 !! options
27588 parsoid={
27589 "modes": ["html2wt"],
27590 "scrubWikitext": true
27591 }
27592 !! html/parsoid
27593 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27594 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27595 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27596 !! wikitext
27597 [[Berlin]] is the capital of Germany.
27598
27599 [[Foo]] '''bar'''
27600
27601 [[Boston]] is a city.
27602 !! end
27603
27604 !! test
27605 1. Table cells with escapable prefixes
27606 !! options
27607 parsoid={
27608 "modes": ["html2wt"],
27609 "scrubWikitext": false
27610 }
27611 !! html
27612 <table>
27613 <tr><td>a</td></tr>
27614 <tr><td>-</td></tr>
27615 <tr><td>+</td></tr>
27616 </table>
27617 !! wikitext
27618 {|
27619 |a
27620 |-
27621 |<nowiki>-</nowiki>
27622 |-
27623 |<nowiki>+</nowiki>
27624 |}
27625 !! end
27626
27627 !! test
27628 2. Table cells with escapable prefixes
27629 !! options
27630 parsoid={
27631 "modes": ["html2wt"],
27632 "scrubWikitext": true
27633 }
27634 !! html
27635 <table>
27636 <tr><td>a</td></tr>
27637 <tr><td>-</td></tr>
27638 <tr><td>+</td></tr>
27639 </table>
27640 !! wikitext
27641 {|
27642 |a
27643 |-
27644 | -
27645 |-
27646 | +
27647 |}
27648 !! end
27649
27650 !! test
27651 3a. Table cells with escapable prefixes after edits
27652 !! options
27653 parsoid={
27654 "modes": ["selser"],
27655 "scrubWikitext": true,
27656 "changes": [
27657 [ "table tbody tr:first-child td:first-child", "remove"]
27658 ]
27659 }
27660 !! wikitext
27661 {|
27662 |a||-
27663 |}
27664 !! wikitext/edited
27665 {|
27666 | -
27667 |}
27668 !! end
27669
27670 !! test
27671 3b. Table cells with escapable prefixes after edits
27672 !! options
27673 parsoid={
27674 "modes": ["selser"],
27675 "scrubWikitext": true,
27676 "changes": [
27677 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27678 [ "#x", "remove" ]
27679 ]
27680 }
27681 !! wikitext
27682 {|
27683 |pqr
27684 |<span id="x">foo</span>+
27685 |}
27686 !! wikitext/edited
27687 {|
27688 | -
27689 | +
27690 |}
27691 !! end
27692
27693 # FIXME: This test will fail because
27694 # normalization doesn't realize that the id attribute
27695 # will eliminate the escapable scenario
27696 !! test
27697 4a. Table cells without escapable prefixes after edits
27698 !! options
27699 parsoid={
27700 "modes": ["selser"],
27701 "scrubWikitext": true,
27702 "changes": [
27703 [ "#x", "html", "-" ]
27704 ]
27705 }
27706 !! wikitext
27707 {|
27708 | id="x" |abcd
27709 |}
27710 !! wikitext/edited
27711 {|
27712 | id="x" |-
27713 |}
27714 !! end
27715
27716 ## This tests normalizer's ability to discriminate between
27717 ## cells having identical content.
27718 !! test
27719 4b. Table cells without escapable prefixes after edits
27720 !! options
27721 parsoid={
27722 "modes": ["selser"],
27723 "scrubWikitext": true,
27724 "changes": [
27725 [ "td", "html", "-" ]
27726 ]
27727 }
27728 !! wikitext
27729 {|
27730 |a||b
27731 |}
27732 !! wikitext/edited
27733 {|
27734 | -||-
27735 |}
27736 !! end
27737
27738 ## This tests normalizer's ability to not be tripped by
27739 ## comments (and whitespace)
27740 !! test
27741 4c. Table cells without escapable prefixes after edits
27742 !! options
27743 parsoid={
27744 "modes": ["selser"],
27745 "scrubWikitext": true,
27746 "changes": [
27747 [ "table tbody tr td:first-child", "remove" ]
27748 ]
27749 }
27750 !! wikitext
27751 {|
27752 |-
27753 <!--foo--> |a||-
27754 |}
27755 !! wikitext/edited
27756 {|
27757 |-
27758 <!--foo--> | -
27759 |}
27760 !! end
27761
27762 ## This tests normalizer's ability to handle HTML cells
27763 !! test
27764 4d. Table cells without escapable prefixes after edits
27765 !! options
27766 parsoid={
27767 "modes": ["selser"],
27768 "scrubWikitext": true,
27769 "changes": [
27770 [ "td", "html", "-" ]
27771 ]
27772 }
27773 !! wikitext
27774 <table>
27775 <tr><td>a</td></tr>
27776 </table>
27777 !! wikitext/edited
27778 <table>
27779 <tr><td>-</td></tr>
27780 </table>
27781 !! end
27782
27783 ## T111151 Remove font elements without attributes
27784 !! test
27785 5a. font tags without attributes should be dropped in scrubWikitext mode
27786 !! options
27787 parsoid={
27788 "modes": ["html2wt"],
27789 "scrubWikitext": true
27790 }
27791 !! html
27792 <font>foo</font>
27793 <font><font>bar</font></font>
27794 <font class="x">boo</font>
27795 !! wikitext
27796 foo
27797 bar
27798 <font class="x">boo</font>
27799 !! end
27800
27801 !! test
27802 5b. font tags should not be dropped without scrubWikitext being enabled
27803 !! options
27804 parsoid={
27805 "modes": ["html2wt"],
27806 "scrubWikitext": false
27807 }
27808 !! html
27809 <font>foo</font>
27810 !! wikitext
27811 <font>foo</font>
27812 !! end
27813
27814 !! test
27815 Escape nowiki DOM elements
27816 !! options
27817 parsoid=html2wt
27818 !! html/parsoid
27819 <nowiki><i>foo</i></nowiki>
27820 !! wikitext
27821 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27822 !! end
27823
27824 # This is meant to be an interim fix while we go about figuring out
27825 # how to not introduce these trailing <nowiki/>s in the first place.
27826 !! test
27827 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27828 !! options
27829 parsoid=html2wt
27830 !! html/parsoid
27831 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27832 y</p>
27833 <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>
27834 <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>
27835 !! wikitext
27836 x
27837 y
27838
27839 {{echo|
27840 1 = <nowiki/>}}
27841
27842 {{echo|
27843 1 = <nowiki/>
27844 }}
27845 !! end
27846
27847 # ---------------------------------------------------
27848 # End of tests spec'ing wikitext serialization norms |
27849 # ---------------------------------------------------
27850
27851 # T104032
27852 !! test
27853 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27854 !! options
27855 parsoid=html2wt
27856 !! html/parsoid
27857 a<p>b</p>
27858 <b>c</b><p>d</p>
27859 <table><tr>
27860 <td>a<p>b</p></td>
27861 <td><b>c</b><p>d</p></td>
27862 </tr></table>
27863 !! wikitext
27864 a
27865
27866 b
27867
27868 '''c'''
27869
27870 d
27871 {|
27872 |a
27873 b
27874 |'''c'''
27875 d
27876 |}
27877 !! end
27878
27879 # -----------------------------------------------------------------
27880 # End of section for Parsoid-only html2wt tests for serialization
27881 # of new content
27882 # -----------------------------------------------------------------
27883
27884 # -----------------------------------------------------------------
27885 # The following section of tests are primarily to spec behavior of
27886 # the selective serializer. All these tests have manual selser
27887 # changes. The automated selser changes for all tests handle the
27888 # wide variation of changes, but these tests here capture specs
27889 # deterministically.
27890 # ----------------------------------------------------------------
27891
27892 ## T90517
27893 !! test
27894 Selser: New comments should not be lost
27895 !! options
27896 parsoid={
27897 "modes": ["selser"],
27898 "changes": [
27899 [ "#a", "after", "<!--c1-->" ],
27900 [ "#b", "before", "<!--c2-->" ]
27901 ]
27902 }
27903 !! wikitext
27904 <span id="a">a</span>
27905
27906 <span id="b">b</span>
27907 !! wikitext/edited
27908 <span id="a">a</span><!--c1-->
27909
27910 <!--c2--><span id="b">b</span>
27911 !! end
27912
27913 ## T89383
27914 !! test
27915 Selser: Check for validity of DSR before using it
27916 !! options
27917 parsoid={
27918 "modes": ["selser"],
27919 "changes": [
27920 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27921 ]
27922 }
27923 !! wikitext
27924 <span id="a">a</span>
27925 !! wikitext/edited
27926 {{DISPLAYTITLE:foo}}
27927 <span id="a">a</span>
27928 !! end
27929
27930 !! test
27931 1. DOMDiff: Changes to <ref> content should be looked up using id
27932 !! options
27933 parsoid={
27934 "modes": ["selser"],
27935 "changes": [
27936 ["#X", "after", "bar"],
27937 ["#Y", "after", "baz"]
27938 ]
27939 }
27940 !! wikitext
27941 X <ref><span id="X">foo</span></ref>
27942 Y <ref name="a" />
27943 <references>
27944 <ref name="a"><span id="Y">foo</span></ref>
27945 </references>
27946 !! wikitext/edited
27947 X <ref><span id="X">foo</span>bar</ref>
27948 Y <ref name="a" />
27949 <references>
27950 <ref name="a"><span id="Y">foo</span>baz</ref>
27951 </references>
27952 !! end
27953
27954 !! test
27955 2. DOMDiff: Changes to <ref> content should be looked up using id
27956 !! options
27957 parsoid={
27958 "modes": ["selser"],
27959 "changes": [
27960 ["#Z", "after", "bar"]
27961 ]
27962 }
27963 !! wikitext
27964 A <ref>foo bar for a</ref>
27965 B <ref group="X" name="b" />
27966
27967 <references />
27968
27969 <references group="X">
27970 <ref name="b"><span id="Z">foo</span></ref>
27971 </references>
27972 !! wikitext/edited
27973 A <ref>foo bar for a</ref>
27974 B <ref group="X" name="b" />
27975
27976 <references />
27977
27978 <references group="X">
27979 <ref name="b"><span id="Z">foo</span>bar</ref>
27980 </references>
27981 !! end
27982
27983 !! test
27984 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27985 !! options
27986 parsoid={
27987 "modes": ["selser"],
27988 "changes": [
27989 [ "div:first-child", "text", "bar" ]
27990 ]
27991 }
27992 !! wikitext
27993 <div style="{{1x|color:red;}}%">foo</div>
27994 !! wikitext/edited
27995 <div style="{{1x|color:red;}}%">bar</div>
27996 !! end
27997
27998 !! test
27999 Empty LI (T49673)
28000 !! wikitext
28001 * a
28002 *
28003 *
28004 * b
28005 !! html/php+tidy
28006 <ul>
28007 <li>a</li>
28008 <li class="mw-empty-elt"></li>
28009 <li class="mw-empty-elt"></li>
28010 <li>b</li>
28011 </ul>
28012 !! end
28013
28014 !! test
28015 Thumbnail output
28016 !! wikitext
28017 [[File:Thumb.png|thumb]]
28018 !! html/php+tidy
28019 <div class="thumb tright">
28020 <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>
28021 <div class="thumbcaption">
28022 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
28023 </div>
28024 </div>
28025 </div>
28026 !! end
28027
28028 !! test
28029 unclosed internal link XSS (T137264)
28030 !! wikitext
28031 [[#%3Cscript%3Ealert(1)%3C/script%3E|
28032 !! html/php
28033 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
28034 </p>
28035 !! html/parsoid
28036 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
28037 !! end