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