Merge "resources: Provide jquery.i18n (v1.0.3)"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://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 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_header_cells
165 !! text
166 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
167 !! endarticle
168
169 !! article
170 Template:table_cells
171 !! text
172 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
173 !! endarticle
174
175 !! article
176 Template:PartialTable
177 !! text
178 {|
179 |-
180 !! endarticle
181
182 !! article
183 Template:image_attribs
184 !! text
185 <noinclude>
186 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
187 !! endarticle
188
189 ## See T48811 for details
190 !! article
191 Template:mixed_attr_content_template
192 !! text
193 style="color:red;" title="T48811"
194 |-
195 |foo
196 !! endarticle
197
198 !! article
199 Template:definition_list
200 !! text
201 one
202 ::two
203 !! endarticle
204
205 !! article
206 A?b
207 !! text
208 Weirdo titles!
209 !! endarticle
210
211 !!article
212 Template:Bullet
213 !!text
214 * Bar
215 !!endarticle
216
217 !!article
218 Template:OpenTable
219 !!text
220 {|
221 !!endarticle
222
223 !!article
224 Template:EmptyLITest
225 !!text
226 *a
227 *
228 *
229 *b
230 !!endarticle
231
232 !!article
233 Template:EmptyTRTest
234 !!text
235 {|
236 |-
237 |-
238 |foo
239 |-
240 |-
241 |bar
242 |}
243 !!endarticle
244
245 !!article
246 Template:EmptyTRWithHTMLAttrTest
247 !!text
248 <table>
249 <tr align="center"></tr>
250 <tr><td>foo</td></tr>
251 <tr align="center"></tr>
252 <tr><td>bar</td></tr>
253 </table>
254 !!endarticle
255
256 ###
257 ### Basic tests
258 ###
259 !! test
260 Blank input
261 !! wikitext
262 !! html
263 !! end
264
265
266 !! test
267 Simple paragraph
268 !! wikitext
269 This is a simple paragraph.
270 !! html
271 <p>This is a simple paragraph.
272 </p>
273 !! end
274
275 !! test
276 Paragraphs with extra newline spacing
277 !! wikitext
278 foo
279
280 bar
281
282
283 baz
284
285
286
287 booz
288 !! html
289 <p>foo
290 </p><p>bar
291 </p><p><br />
292 baz
293 </p><p><br />
294 </p><p>booz
295 </p>
296 !! end
297
298 !! test
299 Paragraphs with newline spacing with comment lines in between
300 !! wikitext
301 ----
302 a
303 <!--foo-->
304 b
305 ----
306 a
307 <!--foo--><!--More than 1 comment, still stripped-->
308 b
309 ----
310 a
311 <!--foo--> <!----> <!-- bar -->
312 b
313 ----
314 a
315 <!--foo-->
316
317 b
318 ----
319 a
320
321 <!--foo-->
322 b
323 ----
324 a
325 <!--foo-->
326
327
328 b
329 ----
330 a
331
332
333 <!--foo-->
334 b
335 ----
336 !! html
337 <hr />
338 <p>a
339 b
340 </p>
341 <hr />
342 <p>a
343 b
344 </p>
345 <hr />
346 <p>a
347 b
348 </p>
349 <hr />
350 <p>a
351 </p><p>b
352 </p>
353 <hr />
354 <p>a
355 </p><p>b
356 </p>
357 <hr />
358 <p>a
359 </p><p><br />
360 b
361 </p>
362 <hr />
363 <p>a
364 </p><p><br />
365 b
366 </p>
367 <hr />
368
369 !! end
370
371 !! test
372 Paragraphs with newline spacing with non-empty white-space lines in between
373 !! wikitext
374 ----
375 a
376
377 b
378 ----
379 a
380
381
382 b
383 ----
384 !! html
385 <hr />
386 <p>a
387 </p><p>b
388 </p>
389 <hr />
390 <p>a
391 </p><p><br />
392 b
393 </p>
394 <hr />
395
396 !! end
397
398 !! test
399 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
400 !! wikitext
401 ----
402 a
403 <!--foo-->
404 b
405 ----
406 a
407 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
408 b
409 ----
410 a
411
412 <!--foo-->
413 <!--bar-->
414 b
415 ----
416 a
417
418 <!--foo-->
419 <!--bar-->
420
421 b
422 ----
423 !! html
424 <hr />
425 <p>a
426 b
427 </p>
428 <hr />
429 <p>a
430 b
431 </p>
432 <hr />
433 <p>a
434 </p><p>b
435 </p>
436 <hr />
437 <p>a
438 </p><p><br />
439 b
440 </p>
441 <hr />
442
443 !! end
444
445 !! test
446 Extra newlines: More paragraphs with indented comment
447 !! wikitext
448 a
449
450 <!--boo-->
451
452 b
453 !! html
454 <p>a
455 </p><p><br />
456 b
457 </p>
458 !!end
459
460 !! test
461 Extra newlines followed by heading
462 !! wikitext
463 a
464
465
466
467 =b=
468 [[a]]
469
470
471 =b=
472 !! html
473 <p>a
474 </p><p><br />
475 </p>
476 <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>
477 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
478 </p><p><br />
479 </p>
480 <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>
481
482 !! end
483
484 !! test
485 Extra newlines between heading and content are swallowed
486 !! wikitext
487 =b=
488
489
490
491 [[a]]
492 !! html
493 <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>
494 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
495 </p>
496 !! end
497
498 !! test
499 Parsing an URL
500 !! wikitext
501 http://fr.wikipedia.org/wiki/🍺
502 <!-- EasterEgg we love beer, better be able be able to link to it -->
503 !! html
504 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
505 </p>
506 !! end
507
508 # Note that the html+tidy output removes the spaces after the <li>,
509 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
510 # This is an issue for all tests with lists. We intentionally do
511 # *not* add html+tidy clauses for these, as we don't want to
512 # document/test the broken behavior. (Parsoid matches the non-tidy
513 # output in these cases.)
514
515 !! test
516 Simple list
517 !! wikitext
518 * Item 1
519 * Item 2
520 !! html
521 <ul><li> Item 1</li>
522 <li> Item 2</li></ul>
523
524 !! end
525
526 !! test
527 Italics and bold
528 !! wikitext
529 * plain
530 * plain''italic''plain
531 * plain''italic''plain''italic''plain
532 * plain'''bold'''plain
533 * plain'''bold'''plain'''bold'''plain
534 * plain''italic''plain'''bold'''plain
535 * plain'''bold'''plain''italic''plain
536 * plain''italic'''bold-italic'''italic''plain
537 * plain'''bold''bold-italic''bold'''plain
538 * plain'''''bold-italic'''italic''plain
539 * plain'''''bold-italic''bold'''plain
540 * plain''italic'''bold-italic'''''plain
541 * plain'''bold''bold-italic'''''plain
542 * plain l'''italic''plain
543 * plain l''''bold''' plain
544 !! html
545 <ul><li> plain</li>
546 <li> plain<i>italic</i>plain</li>
547 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
548 <li> plain<b>bold</b>plain</li>
549 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
550 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
551 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
552 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
553 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
554 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
555 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
556 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
557 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
558 <li> plain l'<i>italic</i>plain</li>
559 <li> plain l'<b>bold</b> plain</li></ul>
560
561 !! end
562
563 # this example taken from the [[simple:Moon]] article (bug 47326)
564 !! test
565 Italics and possessives (1)
566 !! wikitext
567 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
568 !! html
569 <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
570 </p>
571 !! end
572
573 # this example taken from [[en:Flaming Pie]] (bug 49926)
574 !! test
575 Italics and possessives (2)
576 !! wikitext
577 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
578 !! html
579 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
580 </p>
581 !! end
582
583 # this example taken from [[en:Dictionary]] (bug 49926)
584 !! test
585 Italics and possessives (3)
586 !! wikitext
587 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''.
588 !! html
589 <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>.
590 </p>
591 !! end
592
593
594 ###
595 ### 2-quote opening sequence tests
596 ###
597 !! test
598 Italics and bold: 2-quote opening sequence: (2,2)
599 !! wikitext
600 ''foo''
601 !! html
602 <p><i>foo</i>
603 </p>
604 !!end
605
606 !! test
607 Italics and bold: 2-quote opening sequence: (2,3)
608 !! wikitext
609 ''foo'''
610 !! html/*
611 <p><i>foo'</i>
612 </p>
613 !!end
614
615 !! test
616 Italics and bold: 2-quote opening sequence: (2,4)
617 !! options
618 parsoid=wt2html
619 !! wikitext
620 ''foo''''
621 !! html/*
622 <p><i>foo''</i>
623 </p>
624 !!end
625
626 # same html as previous, but wikitext adjusted to match parsoid html2wt
627 !! test
628 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
629 !! wikitext
630 ''foo<nowiki>''</nowiki>''
631 !! html
632 <p><i>foo''</i>
633 </p>
634 !! end
635
636 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
637 !! test
638 Italics and bold: 2-quote opening sequence: (2,5)
639 !! options
640 parsoid=wt2html
641 !! wikitext
642 ''foo'''''
643 !! html/php
644 <p><i>foo</i>
645 </p>
646 !! html/parsoid
647 <p><i>foo</i><b></b>
648 </p>
649 !!end
650
651 # same html as previous, but wikitext adjusted to match parsoid html2wt
652 !! test
653 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
654 !! wikitext
655 ''foo'''''<nowiki/>'''
656 !! html/php
657 <p><i>foo</i>
658 </p>
659 !! html/parsoid
660 <p><i>foo</i><b></b>
661 </p>
662 !! end
663
664
665 ###
666 ### 3-quote opening sequence tests
667 ###
668
669 !! test
670 Italics and bold: 3-quote opening sequence: (3,2)
671 !! wikitext
672 '''foo''
673 !! html/*
674 <p>'<i>foo</i>
675 </p>
676 !!end
677
678 !! test
679 Italics and bold: 3-quote opening sequence: (3,3)
680 !! wikitext
681 '''foo'''
682 !! html
683 <p><b>foo</b>
684 </p>
685 !!end
686
687 !! test
688 Italics and bold: 3-quote opening sequence: (3,4)
689 !! wikitext
690 '''foo''''
691 !! html/*
692 <p><b>foo'</b>
693 </p>
694 !!end
695
696 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
697 !! test
698 Italics and bold: 3-quote opening sequence: (3,5)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 '''foo'''''
703 !! html/php
704 <p><b>foo</b>
705 </p>
706 !! html/parsoid
707 <p><b>foo</b><i></i>
708 </p>
709 !!end
710
711 # same html as previous, but wikitext adjusted to match parsoid html2wt
712 !! test
713 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
714 !! wikitext
715 '''foo'''''<nowiki/>''
716 !! html/php
717 <p><b>foo</b>
718 </p>
719 !! html/parsoid
720 <p><b>foo</b><i></i>
721 </p>
722 !! end
723
724
725 ###
726 ### 4-quote opening sequence tests
727 ###
728
729 !! test
730 Italics and bold: 4-quote opening sequence: (4,2)
731 !! options
732 parsoid=wt2html
733 !! wikitext
734 ''''foo''
735 !! html/*
736 <p>''<i>foo</i>
737 </p>
738 !!end
739
740 # same html as previous, but wikitext adjusted to match parsoid html2wt
741 !! test
742 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
743 !! wikitext
744 <nowiki>''</nowiki>''foo''
745 !! html
746 <p>''<i>foo</i>
747 </p>
748 !! end
749
750 !! test
751 Italics and bold: 4-quote opening sequence: (4,3)
752 !! wikitext
753 ''''foo'''
754 !! html/*
755 <p>'<b>foo</b>
756 </p>
757 !!end
758
759 !! test
760 Italics and bold: 4-quote opening sequence: (4,4)
761 !! options
762 parsoid=wt2html
763 !! wikitext
764 ''''foo''''
765 !! html/*
766 <p>'<b>foo'</b>
767 </p>
768 !!end
769
770 # same html as previous, but wikitext adjusted to match parsoid html2wt
771 !! test
772 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
773 !! wikitext
774 '<nowiki/>'''foo''''
775 !! html
776 <p>'<b>foo'</b>
777 </p>
778 !! end
779
780 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
781 !! test
782 Italics and bold: 4-quote opening sequence: (4,5)
783 !! options
784 parsoid=wt2html
785 !! wikitext
786 ''''foo'''''
787 !! html/php
788 <p>'<b>foo</b>
789 </p>
790 !! html/parsoid
791 <p>'<b>foo</b><i></i>
792 </p>
793 !!end
794
795 # same html as previous, but wikitext adjusted to match parsoid html2wt
796 !! test
797 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
798 !! wikitext
799 '<nowiki/>'''foo'''''<nowiki/>''
800 !! html/php
801 <p>'<b>foo</b>
802 </p>
803 !! html/parsoid
804 <p>'<b>foo</b><i></i>
805 </p>
806 !! end
807
808
809 ###
810 ### 5-quote opening sequence tests
811 ###
812
813 !! test
814 Italics and bold: 5-quote opening sequence: (5,2)
815 !! options
816 parsoid=wt2html
817 !! wikitext
818 '''''foo''
819 !! html/*
820 <p><b><i>foo</i></b>
821 </p>
822 !!end
823
824 # same html as previous, but wikitext adjusted to match parsoid html2wt
825 # skipping wt2html and html2html because it wants to put <i> before <b>
826 !! test
827 Italics and bold: 5-quote opening sequence: (5,2+3)
828 !! options
829 parsoid=wt2wt,html2wt
830 !! wikitext
831 '''''foo'''''
832 !! html
833 <p><b><i>foo</i></b>
834 </p>
835 !! end
836
837 !! test
838 Italics and bold: 5-quote opening sequence: (5,3)
839 !! options
840 parsoid=wt2html
841 !! wikitext
842 '''''foo'''
843 !! html/*
844 <p><i><b>foo</b></i>
845 </p>
846 !!end
847
848 # same html as previous, but wikitext adjusted to match parsoid html2wt
849 !! test
850 Italics and bold: 5-quote opening sequence: (5,3+2)
851 !! wikitext
852 '''''foo'''''
853 !! html
854 <p><i><b>foo</b></i>
855 </p>
856 !! end
857
858 !! test
859 Italics and bold: 5-quote opening sequence: (5,4)
860 !! options
861 parsoid=wt2html
862 !! wikitext
863 '''''foo''''
864 !! html/*
865 <p><i><b>foo'</b></i>
866 </p>
867 !!end
868
869 !! test
870 Italics and bold: 5-quote opening sequence: (5,5)
871 !! wikitext
872 '''''foo'''''
873 !! html
874 <p><i><b>foo</b></i>
875 </p>
876 !!end
877
878 !! test
879 Italics and bold: 5-quote opening sequence: (5,6)
880 !! wikitext
881 '''''foo''''''
882 !! html/*
883 <p><i><b>foo'</b></i>
884 </p>
885 !! end
886
887 ###
888 ### multiple quote sequences in a line
889 ###
890 !! test
891 Italics and bold: multiple quote sequences: (2,4,2)
892 !! options
893 parsoid=wt2html
894 !! wikitext
895 ''foo''''bar''
896 !! html/*
897 <p><i>foo'<b>bar</b></i>
898 </p>
899 !!end
900
901
902 # same html as previous, but wikitext adjusted to match parsoid html2wt
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
905 !! wikitext
906 ''foo'<nowiki/>'''bar'''''
907 !! html
908 <p><i>foo'<b>bar</b></i>
909 </p>
910 !! end
911
912
913 !! test
914 Italics and bold: multiple quote sequences: (2,4,3)
915 !! options
916 parsoid=wt2html
917 !! wikitext
918 ''foo''''bar'''
919 !! html/*
920 <p><i>foo'<b>bar</b></i>
921 </p>
922 !!end
923
924
925 # same html as previous, but wikitext adjusted to match parsoid html2wt
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
928 !! wikitext
929 ''foo'<nowiki/>'''bar'''''
930 !! html
931 <p><i>foo'<b>bar</b></i>
932 </p>
933 !! end
934
935
936 !! test
937 Italics and bold: multiple quote sequences: (2,4,4)
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,4+2) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'<nowiki/>'''''
953 !! html
954 <p><i>foo'<b>bar'</b></i>
955 </p>
956 !! end
957
958
959 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
960 !! test
961 Italics and bold: multiple quote sequences: (3,4,2)
962 !! options
963 parsoid=wt2html
964 !! wikitext
965 '''foo''''bar''
966 !! html/php
967 <p><b>foo'</b>bar
968 </p>
969 !! html/parsoid
970 <p><b>foo'</b>bar<i></i>
971 </p>
972 !!end
973
974 # same html as previous, but wikitext adjusted to match parsoid html2wt
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
977 !! options
978 parsoid
979 !! wikitext
980 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
986 </p>
987 !! end
988
989
990 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
991 !! test
992 Italics and bold: multiple quote sequences: (3,4,3)
993 !! options
994 parsoid=wt2html
995 !! wikitext
996 '''foo''''bar'''
997 !! html/php
998 <p><b>foo'</b>bar
999 </p>
1000 !! html/parsoid
1001 <p><b>foo'</b>bar<b></b>
1002 </p>
1003 !!end
1004
1005 # same html as previous, but wikitext adjusted to match parsoid html2wt
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1008 !! wikitext
1009 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1015 </p>
1016 !! end
1017
1018 ###
1019 ### other quote tests
1020 ###
1021 !! test
1022 Italics and bold: other quote tests: (2,3,5)
1023 !! wikitext
1024 ''this is about '''foo's family'''''
1025 !! html
1026 <p><i>this is about <b>foo's family</b></i>
1027 </p>
1028 !!end
1029
1030
1031 !! test
1032 Italics and bold: other quote tests: (2,(3,3),2)
1033 !! wikitext
1034 ''this is about '''foo's''' family''
1035 !! html
1036 <p><i>this is about <b>foo's</b> family</i>
1037 </p>
1038 !!end
1039
1040
1041 !! test
1042 Italics and bold: other quote tests: (3,2,3,2)
1043 !! options
1044 parsoid=wt2html
1045 !! wikitext
1046 '''this is about ''foo'''s family''
1047 !! html/*
1048 <p><b>this is about <i>foo</i></b><i>s family</i>
1049 </p>
1050 !!end
1051
1052
1053 # same html as previous, but wikitext adjusted to match parsoid html2wt
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3+2+2,2)
1056 !! wikitext
1057 '''this is about ''foo'''''<nowiki/>''s family''
1058 !! html
1059 <p><b>this is about <i>foo</i></b><i>s family</i>
1060 </p>
1061 !! end
1062
1063
1064 !! test
1065 Italics and bold: other quote tests: (3,2,3,3)
1066 !! wikitext
1067 '''this is about ''foo'''s family'''
1068 !! html/*
1069 <p>'<i>this is about </i>foo<b>s family</b>
1070 </p>
1071 !!end
1072
1073
1074 !! test
1075 Italics and bold: other quote tests: (3,(2,2),3)
1076 !! wikitext
1077 '''this is about ''foo's'' family'''
1078 !! html
1079 <p><b>this is about <i>foo's</i> family</b>
1080 </p>
1081 !!end
1082
1083
1084 !! test
1085 Italicized possessive
1086 !! wikitext
1087 The ''[[Main Page]]'''s talk page.
1088 !! html/php
1089 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1090 </p>
1091 !! html/parsoid
1092 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1093 !! end
1094
1095 !! test
1096 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1097 (Requires tidy for PHP parser output to be fixed up)
1098 !! options
1099 parsoid=wt2html,wt2wt
1100 !! wikitext
1101 {|
1102 !''a!!''b
1103 |''a||''b
1104 |}
1105 !! html/php+tidy
1106 <table>
1107 <tr>
1108 <th><i>a</i></th>
1109 <th><i>b</i></th>
1110 <td><i>a</i></td>
1111 <td><i>b</i></td>
1112 </tr>
1113 </table>
1114 !! html/parsoid
1115 <table>
1116 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1117 <td><i>a</i></td><td><i>b</i></td></tr>
1118 </tbody></table>
1119 !! end
1120
1121 ###
1122 ### Non-html5 tags
1123 ###
1124
1125 !! test
1126 Non-html5 tags should be accepted
1127 !! wikitext
1128 <center>''foo''</center>
1129 <big>''foo''</big>
1130 <font>''foo''</font>
1131 <strike>''foo''</strike>
1132 <tt>''foo''</tt>
1133 !! html
1134 <center><i>foo</i></center>
1135 <p><big><i>foo</i></big>
1136 <font><i>foo</i></font>
1137 <strike><i>foo</i></strike>
1138 <tt><i>foo</i></tt>
1139 </p>
1140 !! end
1141
1142 !! test
1143 <wbr> is valid wikitext (bug 52468)
1144 !! wikitext
1145 <wbr>
1146 !! html
1147 <p><wbr />
1148 </p>
1149 !! end
1150
1151 # <strike> is HTML4, <s> is HTML4/5.
1152 !! test
1153 <s> or <strike> for strikethrough
1154 !! wikitext
1155 <strike>strike</strike>
1156
1157 <s>s</s>
1158 !! html
1159 <p><strike>strike</strike>
1160 </p><p><s>s</s>
1161 </p>
1162 !! end
1163
1164 ## a not permitted
1165 ## i,b,br omitted
1166 !! test
1167 Text-level semantic html elements in wikitext
1168 !! wikitext
1169 <em>text</em>
1170 <strong>text</strong>
1171 <small>text</small>
1172 <s>text</s>
1173 <cite>text</cite>
1174 <q>text</q>
1175 <dfn>text</dfn>
1176 <abbr>text</abbr>
1177 <data>text</data>
1178 <time>text</time>
1179 <code>text</code>
1180 <var>text</var>
1181 <samp>text</samp>
1182 <kbd>text</kbd>
1183 <sub>text</sub>
1184 <u>text</u>
1185 <mark>text</mark>
1186 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1187 <bdi>text</bdi>
1188 <bdo>text</bdo>
1189 <span>text</span>
1190 <wbr />
1191 !! html
1192 <p><em>text</em>
1193 <strong>text</strong>
1194 <small>text</small>
1195 <s>text</s>
1196 <cite>text</cite>
1197 <q>text</q>
1198 <dfn>text</dfn>
1199 <abbr>text</abbr>
1200 <data>text</data>
1201 <time>text</time>
1202 <code>text</code>
1203 <var>text</var>
1204 <samp>text</samp>
1205 <kbd>text</kbd>
1206 <sub>text</sub>
1207 <u>text</u>
1208 <mark>text</mark>
1209 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1210 <bdi>text</bdi>
1211 <bdo>text</bdo>
1212 <span>text</span>
1213 <wbr />
1214 </p>
1215 !! end
1216
1217 # test cases taken from
1218 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1219 !! test
1220 Ruby markup (W3C-style)
1221 !! wikitext
1222 ; Mono-ruby for individual base characters
1223 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1224 ; Group ruby
1225 : <ruby>今日<rt>きょう</rt></ruby>
1226 ; Jukugo ruby
1227 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1228 ; Inline ruby
1229 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1230 ; Double-sided ruby
1231 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1232 <ruby>
1233 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1234 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1235 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1236 </ruby>
1237 !! html
1238 <dl><dt> Mono-ruby for individual base characters</dt>
1239 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1240 <dt> Group ruby</dt>
1241 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1242 <dt> Jukugo ruby</dt>
1243 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1244 <dt> Inline ruby</dt>
1245 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1246 <dt> Double-sided ruby</dt>
1247 <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>
1248 <p><ruby>
1249 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1250 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1251 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1252 </ruby>
1253 </p>
1254 !! end
1255
1256 # The next two test different paths in the sanitizer.
1257 !! test
1258 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1259 !! wikitext
1260 <blockquote|>a</blockquote>
1261
1262 <b→> doesn't terminate </b→>
1263
1264 <bä> doesn't terminate </bä>
1265
1266 <boo> doesn't terminate </boo>
1267
1268 <s.foo> doesn't terminate </s.foo>
1269
1270 <sub-ID#1>
1271 !! html
1272 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1273 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1274 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1275 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1276 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1277 </p><p>&lt;sub-ID#1&gt;
1278 </p>
1279 !! end
1280
1281 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1282 # If the non-word-character tag made it through the sanitizer, tidy
1283 # would munge it up.
1284 !! test
1285 Non-word characters don't terminate tag names + tidy
1286 !! wikitext
1287 <blockquote|>a</blockquote>
1288
1289 <b→> doesn't terminate </b→>
1290
1291 <bä> doesn't terminate </bä>
1292
1293 <boo> doesn't terminate </boo>
1294
1295 <s.foo> doesn't terminate </s.foo>
1296
1297 <sub-ID#1>
1298 !! html+tidy
1299 <p>&lt;blockquote|&gt;a</p>
1300 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1301 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1302 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1303 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1304 <p>&lt;sub-ID#1&gt;</p>
1305 !! end
1306
1307 ###
1308 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1309 ### This checks that HTML5 tags (with non-word characters in the tag
1310 ### name) make it safely through the parser -- the Sanitizer will
1311 ### munge them later, as it should.
1312 ###
1313 !! test
1314 Non-word characters are valid in extension tags (T19663)
1315 !! wikitext
1316 <tåg>tåg</tåg>
1317 !! html
1318 <pre>
1319 'tåg'
1320 array (
1321 )
1322 </pre>
1323
1324 !! end
1325
1326 !! test
1327 Isolated close tags should be treated as literal text (bug 52760)
1328 !! wikitext
1329 </b>
1330
1331 <s.foo>s</s>
1332 !! html+tidy
1333 <p>&lt;s.foo&gt;s</p>
1334 !! end
1335
1336 ###
1337 ### Special characters
1338 ###
1339
1340 !! test
1341 Bare pipe character (bug 52363)
1342 !! wikitext
1343 |
1344 !! html
1345 <p>|
1346 </p>
1347 !! end
1348
1349 !! test
1350 Bare pipe character from a template (bug 52363)
1351 !! wikitext
1352 {{pipe}}
1353 !! html
1354 <p>|
1355 </p>
1356 !! end
1357
1358 ###
1359 ### <nowiki> test cases
1360 ###
1361
1362 !! test
1363 <nowiki> unordered list
1364 !! wikitext
1365 <nowiki>* This is not an unordered list item.</nowiki>
1366 !! html
1367 <p>* This is not an unordered list item.
1368 </p>
1369 !! end
1370
1371 !! test
1372 <nowiki> spacing
1373 !! wikitext
1374 <nowiki>Lorem ipsum dolor
1375
1376 sed abit.
1377 sed nullum.
1378
1379 :and a colon
1380 </nowiki>
1381 !! html
1382 <p>Lorem ipsum dolor
1383
1384 sed abit.
1385 sed nullum.
1386
1387 :and a colon
1388
1389 </p>
1390 !! end
1391
1392 !! test
1393 nowiki 3
1394 !! wikitext
1395 :There is not nowiki.
1396 :There is <nowiki>nowiki</nowiki>.
1397
1398 #There is not nowiki.
1399 #There is <nowiki>nowiki</nowiki>.
1400
1401 *There is not nowiki.
1402 *There is <nowiki>nowiki</nowiki>.
1403 !! html
1404 <dl><dd>There is not nowiki.</dd>
1405 <dd>There is nowiki.</dd></dl>
1406 <ol><li>There is not nowiki.</li>
1407 <li>There is nowiki.</li></ol>
1408 <ul><li>There is not nowiki.</li>
1409 <li>There is nowiki.</li></ul>
1410
1411 !! end
1412
1413 !! test
1414 Entities inside <nowiki>
1415 !! wikitext
1416 <nowiki>&lt;</nowiki>
1417 !! html
1418 <p>&lt;
1419 </p>
1420 !! end
1421
1422 !! test
1423 Entities inside template parameters
1424 !! options
1425 parsoid
1426 !! wikitext
1427 {{echo|&ndash;}}
1428 !! html
1429 <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>
1430 !! end
1431
1432 !! test
1433 Properly escape nowiki when combined with other wiki markup
1434 !! options
1435 parsoid=html2wt
1436 !! html
1437 <p>* &lt;/nowiki&gt; tag</p>
1438 !! wikitext
1439 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1440 !! end
1441
1442 !! test
1443 T93824: Put escaped HTML tags inside nowiki
1444 !! options
1445 parsoid=html2wt
1446 !! html
1447 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1448 !! wikitext
1449 <nowiki><h2>foo</h2></nowiki>
1450 !! end
1451
1452 !! test
1453 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1454 !! options
1455 parsoid=html2wt
1456 !! html
1457 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1458 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1459 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1460 !! wikitext
1461 This text: L'[[Foo]]
1462 This text: L<nowiki>''</nowiki>[[Foo]]
1463 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1464 !! end
1465
1466 # This test fails because wikitext whitespace is not normalized before comparing.
1467 !! test
1468 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1469 !! options
1470 parsoid=html2wt
1471 !! html
1472 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1473 </p>
1474 !! wikitext
1475 This text : L<nowiki>''</nowiki>[[Foo]]
1476 !! end
1477
1478 # This test and the next one are html2wt only as they test that incorrect wikitext
1479 # passed in template arguments gets escaped or wrapped in nowikis where required.
1480 !! test
1481 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1482 !! options
1483 parsoid=html2wt
1484 !! html/parsoid
1485 <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>
1486 <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>
1487 !! wikitext
1488 {{echo|foo{{!}}bar}}
1489 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1490 !! end
1491
1492 !! test
1493 T53961: Output correct nowikis in template arguments
1494 !! options
1495 parsoid=html2wt
1496 !! html/parsoid
1497 <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>
1498 <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>
1499 <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>
1500 <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>
1501 <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>
1502 !! wikitext
1503 {{echo|a [ b}}
1504 {{echo|a <nowiki>}}</nowiki> b}}
1505 {{echo|<nowiki>a [[ b</nowiki>}}
1506 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1507 {{echo|a <nowiki>}</nowiki>}}
1508 !! end
1509
1510 !! test
1511 Cases where "!!" needs nowiki protection
1512 !! options
1513 parsoid=html2wt
1514 !! html
1515 <table>
1516 <tr><th>this needs protection !! here</th></tr>
1517 </table>
1518
1519 <table>
1520 <tr><th>this does not need
1521 protection !! here</th></tr>
1522 </table>
1523 !! wikitext
1524 {|
1525 !<nowiki>this needs protection !! here</nowiki>
1526 |}
1527
1528 {|
1529 !this does not need
1530 protection !! here
1531 |}
1532 !! end
1533
1534 ###
1535 ### Comments
1536 ###
1537 !! test
1538 Comments and Indent-Pre
1539 !! wikitext
1540 <!-- comment 1 --> asdf
1541
1542 <!-- comment 1 --> asdf
1543 <!-- comment 2 -->
1544
1545 <!-- comment 1 --> asdf
1546 <!-- comment 2 -->xyz
1547
1548 <!-- comment 1 --> asdf
1549 <!-- comment 2 --> xyz
1550 !! html
1551 <pre>asdf
1552 </pre>
1553 <pre>asdf
1554 </pre>
1555 <pre>asdf
1556 </pre>
1557 <p>xyz
1558 </p>
1559 <pre>asdf
1560 xyz
1561 </pre>
1562 !! end
1563
1564 !! test
1565 Comment test 2a
1566 !! wikitext
1567 asdf
1568 <!-- comment 1 -->
1569 jkl
1570 !! html
1571 <p>asdf
1572 jkl
1573 </p>
1574 !! end
1575
1576 !! test
1577 Comment test 2b
1578 !! wikitext
1579 asdf
1580 <!-- comment 1 -->
1581
1582 jkl
1583 !! html
1584 <p>asdf
1585 </p><p>jkl
1586 </p>
1587 !! end
1588
1589 !! test
1590 Comment test 3
1591 !! wikitext
1592 asdf
1593 <!-- comment 1 -->
1594 <!-- comment 2 -->
1595 jkl
1596 !! html
1597 <p>asdf
1598 jkl
1599 </p>
1600 !! end
1601
1602 !! test
1603 Comment test 4
1604 !! wikitext
1605 asdf<!-- comment 1 -->jkl
1606 !! html
1607 <p>asdfjkl
1608 </p>
1609 !! end
1610
1611 !! test
1612 Comment spacing
1613 !! wikitext
1614 a
1615 <!-- foo --> b <!-- bar -->
1616 c
1617 !! html
1618 <p>a
1619 </p>
1620 <pre> b
1621 </pre>
1622 <p>c
1623 </p>
1624 !! end
1625
1626 !! test
1627 Comment whitespace
1628 !! wikitext
1629 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1630 !! html
1631
1632 !! end
1633
1634 !! test
1635 Comment semantics and delimiters
1636 !! wikitext
1637 <!-- --><!----><!-----><!------>
1638 !! html/php
1639
1640 !! html/parsoid
1641 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1642 !! end
1643
1644 !! test
1645 Comment semantics and delimiters, redux
1646 !! wikitext
1647 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1648 -- foo -- funky huh? ... -->
1649 !! html/php
1650
1651 !! html/parsoid
1652 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1653 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1654 !! end
1655
1656 !! test
1657 Comment semantics and delimiters: directors cut
1658 !! wikitext
1659 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1660 everything starting with < followed by !-- until the first -- and > we see,
1661 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1662 -->-->
1663 !! html/php
1664 <p>--&gt;
1665 </p>
1666 !! html/parsoid
1667 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1668 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1669 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1670 --><p>--></p>
1671 !! end
1672
1673 !! test
1674 Comment semantics: nesting
1675 !! wikitext
1676 <!--<!-- no, we're not going to do anything fancy here -->-->
1677 !! html/php
1678 <p>--&gt;
1679 </p>
1680 !! html/parsoid
1681 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1682 !! end
1683
1684 # Parsoid closes the unclosed comment, even if it means a slight
1685 # round-trip diff.
1686 !! test
1687 Comment semantics: unclosed comment at end
1688 !! options
1689 parsoid=wt2html,html2html
1690 !! wikitext
1691 <!--This comment will run out to the end of the document
1692 !! html/php
1693
1694 !! html/parsoid
1695 <!--This comment will run out to the end of the document-->
1696 !! end
1697
1698 !! test
1699 Comment semantics: normalize comments to play nice with XML and browsers
1700 !! wikitext
1701 <!-- Browsers --!> think this is closed -->
1702 <!--> This would normally be text -->
1703 <!---> As would this -->
1704 <!-- XML doesn't like trailing dashes -------->
1705 <!-- Nor doubled hyphens -- anywhere in the data -->
1706 But this is not a comment.
1707 !! html/php
1708 <p>But this is not a comment.
1709 </p>
1710 !! html/parsoid
1711 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1712 <!--&#x3E; This would normally be text -->
1713 <!--&#x2D;&#x3E; As would this -->
1714 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1715 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1716 <p>But this is not a comment.</p>
1717 !! end
1718
1719 !! test
1720 Comment semantics: round-trip even text which contains encoded -->
1721 !! wikitext
1722 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1723 !! html/parsoid
1724 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1725 !! end
1726
1727 !! test
1728 Comment in template title
1729 !! wikitext
1730 {{f<!---->oo}}
1731 !! html
1732 <p>FOO
1733 </p>
1734 !! end
1735
1736 !! test
1737 Comment on its own line post-expand
1738 !! wikitext
1739 a
1740 {{blank}}<!---->
1741 b
1742 !! html
1743 <p>a
1744 </p><p>b
1745 </p>
1746 !! end
1747
1748 !! test
1749 Comment on its own line post-expand with non-significant whitespace
1750 !! wikitext
1751 a
1752 {{blank}} <!---->
1753 b
1754 !! html
1755 <p>a
1756 </p><p>b
1757 </p>
1758 !! end
1759
1760 !! test
1761 Multiple comments should still parse as SOL-transparent
1762 !! options
1763 parsoid=wt2html,wt2wt
1764 !! wikitext
1765 <!--c1-->*a
1766 <!--c2--><!--c3--><!--c4-->*b
1767 !! html
1768 <!--c1--><ul>
1769 <li>a
1770 </li>
1771 <!--c2--><!--c3--><!--c4-->
1772 <li>b
1773 </li>
1774 </ul>
1775 !! end
1776
1777 ###
1778 ### paragraph wrapping tests
1779 ###
1780 !! test
1781 No block tags
1782 !! wikitext
1783 a
1784
1785 b
1786 !! html
1787 <p>a
1788 </p><p>b
1789 </p>
1790 !! end
1791
1792 !! test
1793 Block tag on one line (<div>)
1794 !! wikitext
1795 a <div>foo</div>
1796
1797 b
1798 !! html
1799 a <div>foo</div>
1800 <p>b
1801 </p>
1802 !! html+tidy
1803 <p>a</p>
1804 <div>foo</div>
1805 <p>b</p>
1806 !! end
1807
1808 !! test
1809 Block tag on one line (<blockquote>)
1810 !! wikitext
1811 a <blockquote>foo</blockquote>
1812
1813 b
1814 !! html
1815 a <blockquote>foo</blockquote>
1816 <p>b
1817 </p>
1818 !! html+tidy
1819 <p>a</p>
1820 <blockquote>
1821 <p>foo</p>
1822 </blockquote>
1823 <p>b</p>
1824 !! end
1825
1826 !! test
1827 Block tag on both lines (<div>)
1828 !! wikitext
1829 a <div>foo</div>
1830
1831 b <div>foo</div>
1832 !! html
1833 a <div>foo</div>
1834 b <div>foo</div>
1835
1836 !! html+tidy
1837 <p>a</p>
1838 <div>foo</div>
1839 <p>b</p>
1840 <div>foo</div>
1841 !! end
1842
1843 !! test
1844 Block tag on both lines (<blockquote>)
1845 !! wikitext
1846 a <blockquote>foo</blockquote>
1847
1848 b <blockquote>foo</blockquote>
1849 !! html
1850 a <blockquote>foo</blockquote>
1851 b <blockquote>foo</blockquote>
1852
1853 !! html+tidy
1854 <p>a</p>
1855 <blockquote>
1856 <p>foo</p>
1857 </blockquote>
1858 <p>b</p>
1859 <blockquote>
1860 <p>foo</p>
1861 </blockquote>
1862 !! end
1863
1864 !! test
1865 Multiple lines without block tags
1866 !! wikitext
1867 <div>foo</div> a
1868 b
1869 c
1870 d<!--foo--> e
1871 x <div>foo</div> z
1872 !! html
1873 <div>foo</div> a
1874 <p>b
1875 c
1876 d e
1877 </p>
1878 x <div>foo</div> z
1879
1880 !! html+tidy
1881 <div>foo</div>
1882 <p>a</p>
1883 <p>b c d e</p>
1884 <p>x</p>
1885 <div>foo</div>
1886 <p>z</p>
1887 !! end
1888
1889 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1890 # So, we have a separate section for Parsoid. We don't want
1891 # to mimic this stripping behavior in Parsoid. It affects
1892 # editing experience and also requires us to maintain additional
1893 # info for RT-ing.
1894 !! test
1895 Empty lines between lines with block tags
1896 !! wikitext
1897 <div></div>
1898
1899
1900 <div></div>a
1901
1902 b
1903 <div>a</div>b
1904
1905 <div>b</div>d
1906
1907
1908 <div>e</div>
1909 !! html
1910 <div></div>
1911 <p><br />
1912 </p>
1913 <div></div>a
1914 <p>b
1915 </p>
1916 <div>a</div>b
1917 <div>b</div>d
1918 <p><br />
1919 </p>
1920 <div>e</div>
1921
1922 !! html+tidy
1923 <p><br /></p>
1924 <p>a</p>
1925 <p>b</p>
1926 <div>a</div>
1927 <p>b</p>
1928 <div>b</div>
1929 <p>d</p>
1930 <p><br /></p>
1931 <div>e</div>
1932 !! html/parsoid
1933 <div data-parsoid='{"stx":"html"}'></div>
1934
1935 <p><br /></p>
1936 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1937
1938 <p>b</p>
1939 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1940
1941 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1942
1943 <p><br /></p>
1944 <div data-parsoid='{"stx":"html"}'>e</div>
1945 !! end
1946
1947 ## PHP parser emits output which is broken
1948 !! test
1949 Unclosed HTML p-tags should be handled properly
1950 !! wikitext
1951 <div><p>foo</div>
1952 a
1953
1954 b
1955 !! html/php+tidy
1956 <div>
1957 <p>foo</p>
1958 </div>
1959 <p>a</p>
1960 <p>b</p>
1961 !! html/parsoid
1962 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1963 <p>a</p>
1964 <p>b</p>
1965 !! end
1966
1967 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1968 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1969 ## them for now.
1970 !! test
1971 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1972 !! options
1973 parsoid=wt2html
1974 !! wikitext
1975 a [[Category:A1]] [[Category:A2]]
1976 [[Category:A3]]
1977 [[Category:A4]]
1978 !! html/parsoid
1979 <p>a</p>
1980 <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"/>
1981 !! end
1982
1983 !! test
1984 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1985 !! options
1986 parsoid=wt2html
1987 !! wikitext
1988 [[Category:A1]]a
1989 !! html/parsoid
1990 <link rel="mw:PageProp/Category" href="Category:A1"/><p>a</p>
1991 !! end
1992
1993 ###
1994 ### Preformatted text
1995 ###
1996 !! test
1997 Preformatted text
1998 !! wikitext
1999 This is some
2000 Preformatted text
2001 With ''italic''
2002 And '''bold'''
2003 And a [[Main Page|link]]
2004 !! html
2005 <pre>This is some
2006 Preformatted text
2007 With <i>italic</i>
2008 And <b>bold</b>
2009 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2010 </pre>
2011 !! end
2012
2013 !! test
2014 Tabs don't trigger preformatted text
2015 !! wikitext
2016 This is not
2017 preformatted text.
2018 This is preformatted text.
2019 So is this.
2020 !! html
2021 <p> This is not
2022 preformatted text.
2023 </p>
2024 <pre>This is preformatted text.
2025 So is this.
2026 </pre>
2027 !! end
2028
2029 !! test
2030 Ident preformatting with inline content
2031 !! wikitext
2032 a
2033 ''b''
2034 !! html
2035 <pre>a
2036 <i>b</i>
2037 </pre>
2038 !! end
2039
2040 !! test
2041 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2042 !! wikitext
2043 <pre><nowiki>
2044 <b>
2045 <cite>
2046 <em>
2047 </nowiki></pre>
2048 !! html
2049 <pre>
2050 &lt;b&gt;
2051 &lt;cite&gt;
2052 &lt;em&gt;
2053 </pre>
2054
2055 !! end
2056
2057 !! test
2058 Regression with preformatted in <center>
2059 !! wikitext
2060 <center>
2061 Blah
2062 </center>
2063 !! html
2064 <center>
2065 <pre>Blah
2066 </pre>
2067 </center>
2068
2069 !! end
2070
2071 !! test
2072 Bug 52763: Preformatted in <blockquote>
2073 !! wikitext
2074 <blockquote>
2075 Blah
2076 {|
2077 |
2078 indented cell (no pre-wrapping!)
2079 |}
2080 </blockquote>
2081 !! html
2082 <blockquote>
2083 <p> Blah
2084 </p>
2085 <table>
2086 <tr>
2087 <td>
2088 <p> indented cell (no pre-wrapping!)
2089 </p>
2090 </td></tr></table>
2091 </blockquote>
2092
2093 !! end
2094
2095 !! test
2096 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2097 !! wikitext
2098 <blockquote>
2099 Foo
2100
2101 Bar
2102 </blockquote>
2103 !! html
2104 <blockquote>
2105 <p>Foo
2106 </p><p>Bar
2107 </p>
2108 </blockquote>
2109
2110 !! end
2111
2112 !! test
2113 Bug 15491: <ins>/<del> in blockquote
2114 !! wikitext
2115 <blockquote>
2116 Foo <del>bar</del> <ins>baz</ins> quux
2117 </blockquote>
2118 !! html
2119 <blockquote>
2120 <p>Foo <del>bar</del> <ins>baz</ins> quux
2121 </p>
2122 </blockquote>
2123
2124 !! end
2125
2126 # Note that the p-wrapping is newline sensitive, which could be
2127 # considered a bug: tidy will wrap only the 'Foo' in the example
2128 # below in a <p> tag. (see comment 23-25 of bug #6200)
2129 !! test
2130 Bug 15491: <ins>/<del> in blockquote (2)
2131 !! wikitext
2132 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2133 </blockquote>
2134 !! html
2135 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2136 </blockquote>
2137
2138 !! html+tidy
2139 <blockquote>
2140 <p>Foo</p>
2141 <del>bar</del> <ins>baz</ins> quux</blockquote>
2142 !! end
2143
2144 !! test
2145 <pre> with attributes (bug 3202)
2146 !! wikitext
2147 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2148 !! html
2149 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2150
2151 !! end
2152
2153 !! test
2154 <pre> with width attribute (bug 3202)
2155 !! wikitext
2156 <pre width="8">Narrow screen goodies</pre>
2157 !! html
2158 <pre width="8">Narrow screen goodies</pre>
2159
2160 !! end
2161
2162 !! test
2163 <pre> with forbidden attribute (bug 3202)
2164 !! wikitext
2165 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2166 !! html
2167 <pre width="8">Narrow screen goodies</pre>
2168
2169 !! end
2170
2171 !! test
2172 Entities inside <pre>
2173 !! wikitext
2174 <pre>&lt;</pre>
2175 !! html
2176 <pre>&lt;</pre>
2177
2178 !! end
2179
2180 !! test
2181 <pre> with forbidden attribute values (bug 3202)
2182 !! wikitext
2183 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2184 !! html
2185 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2186
2187 !! end
2188
2189 !! test
2190 <nowiki> inside <pre> (bug 13238)
2191 !! wikitext
2192 <pre>
2193 <nowiki>
2194 </pre>
2195 <pre>
2196 <nowiki></nowiki>
2197 </pre>
2198 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2199 !! html
2200 <pre>
2201 &lt;nowiki&gt;
2202 </pre>
2203 <pre>
2204
2205 </pre>
2206 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2207
2208 !! end
2209
2210 !! test
2211 <nowiki> and <pre> preference (first one wins)
2212 !! wikitext
2213 <pre>
2214 <nowiki>
2215 </pre>
2216 </nowiki>
2217 </pre>
2218
2219 <nowiki>
2220 <pre>
2221 <nowiki>
2222 </pre>
2223 </nowiki>
2224 </pre>
2225
2226 !! html
2227 <pre>
2228 &lt;nowiki&gt;
2229 </pre>
2230 <p>&lt;/nowiki&gt;
2231 &lt;/pre&gt;
2232 </p><p>
2233 &lt;pre&gt;
2234 &lt;nowiki&gt;
2235 &lt;/pre&gt;
2236
2237 &lt;/pre&gt;
2238 </p>
2239 !! end
2240
2241 !! test
2242 </pre> inside nowiki
2243 !! wikitext
2244 <nowiki></pre></nowiki>
2245 !! html
2246 <p>&lt;/pre&gt;
2247 </p>
2248 !! end
2249
2250 # Parsoid doesn't strip empty tags, like Tidy does.
2251 !! test
2252 Empty pre; pre inside other HTML tags (bug 54946)
2253 !! options
2254 parsoid=wt2html,wt2wt
2255 !! wikitext
2256 a
2257
2258 <div><pre>
2259 foo
2260 </pre></div>
2261 <pre></pre>
2262 !! html/php
2263 <p>a
2264 </p>
2265 <div><pre>
2266 foo
2267 </pre></div>
2268 <pre></pre>
2269
2270 !! html/php+tidy
2271 <p>a</p>
2272 <div>
2273 <pre>
2274 foo
2275 </pre></div>
2276 !! html/parsoid
2277 <p>a</p>
2278
2279 <div><pre>foo
2280 </pre></div>
2281 <pre></pre>
2282 !! end
2283
2284 !! test
2285 HTML pre followed by indent-pre
2286 !! wikitext
2287 <pre>foo</pre>
2288 bar
2289 !! html
2290 <pre>foo</pre>
2291 <pre>bar
2292 </pre>
2293 !! end
2294
2295 !!test
2296 Block tag pre
2297 !!options
2298 parsoid
2299 !! wikitext
2300 <p><pre>foo</pre></p>
2301 !! html
2302 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2303 !!end
2304
2305 !!test
2306 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2307 !! wikitext
2308 {{echo|}}
2309 !! html
2310
2311 !!end
2312
2313 !!test
2314 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2315 !! wikitext
2316 {{echo|
2317 foo}}
2318 !! html
2319 <p>foo
2320 </p>
2321 !!end
2322
2323 !! test
2324 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2325 !! wikitext
2326 {{echo|a
2327 b}}
2328 !! html
2329 <pre>a
2330 </pre>
2331 <p>b
2332 </p>
2333 !!end
2334
2335 !! test
2336 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2337 !! wikitext
2338 {{echo|a
2339 b
2340 c
2341 d
2342 e
2343 }}
2344 !! html
2345 <pre>a
2346 </pre>
2347 <p>b
2348 c
2349 </p>
2350 <pre>d
2351 </pre>
2352 <p>e
2353 </p>
2354 !!end
2355
2356 !!test
2357 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2358 !! wikitext
2359 {{echo| foo}}
2360
2361 {{echo| foo}}{{echo| bar}}
2362
2363 {{echo| foo}}
2364 {{echo| bar}}
2365
2366 {{echo|<!--cmt--> foo}}
2367
2368 <!--cmt-->{{echo| foo}}
2369
2370 {{echo|{{echo| }}bar}}
2371 !! html
2372 <pre>foo
2373 </pre>
2374 <pre>foo bar
2375 </pre>
2376 <pre>foo
2377 bar
2378 </pre>
2379 <pre>foo
2380 </pre>
2381 <pre>foo
2382 </pre>
2383 <pre>bar
2384 </pre>
2385 !!end
2386
2387 !! test
2388 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2389 !! wikitext
2390 {{echo| }}a
2391
2392 {{echo|
2393 }}a
2394
2395 {{echo|
2396 b}}
2397
2398 {{echo|a
2399 }}b
2400
2401 {{echo|a
2402 }} b
2403 !! html
2404 <pre>a
2405 </pre>
2406 <p><br />
2407 </p>
2408 <pre>a
2409 </pre>
2410 <p><br />
2411 </p>
2412 <pre>b
2413 </pre>
2414 <p>a
2415 </p>
2416 <pre>b
2417 </pre>
2418 <p>a
2419 </p>
2420 <pre>b
2421 </pre>
2422 !!end
2423
2424 !! test
2425 Things that look like <pre> tags aren't treated as such
2426 !! wikitext
2427 Barack Obama <President> of the United States
2428 <President></President>
2429 !! html
2430 <p>Barack Obama &lt;President&gt; of the United States
2431 &lt;President&gt;&lt;/President&gt;
2432 </p>
2433 !! end
2434
2435 ## PHP parser discards the "<pre " string
2436 !! test
2437 Handle broken pre-like tags (bug 64025)
2438 !! options
2439 parsoid=wt2html
2440 !! wikitext
2441 {{echo|<pre <pre>x</pre>}}
2442
2443 <table><pre </table>
2444 !! html/php
2445 <pre>x</pre>
2446 <table><pre></pre></table>
2447
2448 !! html/parsoid
2449 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2450
2451
2452 <p>&lt;pre </p>
2453
2454 <table></table>
2455 !! end
2456
2457 !! test
2458 Parsoid: handle pre with space after attribute
2459 !! options
2460 parsoid=wt2html
2461 !! wikitext
2462 <pre style="width:50%;" >{{echo|foo}}</pre>
2463 !! html
2464 <pre style="width:50%;">{{echo|foo}}</pre>
2465 !! end
2466
2467 # TODO / maybe: fix wt2wt for this
2468 !! test
2469 Parsoid: Don't paragraph-wrap fosterable content
2470 !! options
2471 parsoid=wt2html
2472 !! wikitext
2473 {|
2474 <td></td>
2475 <td></td>
2476
2477
2478
2479 |}
2480 !! html
2481 <table>
2482
2483 <tbody>
2484 <tr>
2485 <td></td>
2486
2487 <td></td></tr>
2488
2489
2490
2491 </tbody></table>
2492 !! end
2493
2494 !! test
2495 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2496 !! options
2497 parsoid=wt2html
2498 !! wikitext
2499 {|
2500 <td>
2501 <td>
2502 </td>
2503
2504
2505
2506 |}
2507 !! html
2508 <table>
2509
2510 <tbody>
2511 <tr>
2512 <td></td>
2513
2514 <td>
2515 </td></tr>
2516
2517
2518
2519 </tbody></table>
2520 !! end
2521
2522
2523 #--------------------------------------------------------------------
2524 # Transclusion parameter whitespace stripping tests
2525 # Behavior is different for positional and named parameters
2526 #--------------------------------------------------------------------
2527 !! test
2528 Templates: Strip leading and trailing whitespace from named-param values
2529 !! wikitext
2530 {{echo|1= a }}
2531
2532 {{echo|1= {{echo|b}} }}
2533
2534 {{echo| 1 =
2535 c }}
2536
2537 {{echo| 1 =
2538 * d
2539 }}
2540 !! html
2541 <p>a
2542 </p><p>b
2543 </p><p>c
2544 </p>
2545 <ul><li> d</li></ul>
2546
2547 !! end
2548
2549 !! test
2550 Templates: Don't strip whitespace from positional-param values
2551 !! wikitext
2552 {{echo|a }}
2553
2554 {{echo|{{echo|b}} }}
2555
2556 {{echo| c
2557 }}
2558
2559 {{echo| {{echo|d}}
2560 }}
2561
2562 {{echo|
2563 e}}
2564
2565 {{echo|
2566 * f}}
2567
2568 {{echo|
2569 }}g
2570 !! html
2571 <p>a
2572 </p><p>b
2573 </p>
2574 <pre>c
2575 </pre>
2576 <p><br />
2577 </p>
2578 <pre>d
2579 </pre>
2580 <p><br />
2581 </p>
2582 <pre>e
2583 </pre>
2584 <p><br />
2585 </p>
2586 <ul><li> f</li></ul>
2587 <p><br />
2588 </p>
2589 <pre>g
2590 </pre>
2591 !! end
2592
2593 !! test
2594 Templates: Handle empty comment-and-ws-only lines correctly
2595 !! wikitext
2596 {{echo|foo
2597 <!--should be ignored-->
2598 <!--should be ignored as well-->
2599 bar}}
2600 !! html
2601 <p>foo
2602 bar
2603 </p>
2604 !! end
2605
2606 !! test
2607 Templates: Handle comments in the target
2608 !! wikitext
2609 {{echo
2610 <!-- should be ignored -->
2611 |foo}}
2612
2613 {{echo<!-- should be ignored -->
2614 |foo}}
2615
2616 {{echo<!-- should be ignored -->|foo}}
2617
2618 {{<!-- should be ignored -->echo|foo}}
2619 !!html/parsoid
2620 <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>
2621
2622 <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>
2623
2624 <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>
2625
2626 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2627 !!end
2628
2629 !! test
2630 Templates: Handle comments in parameter names (bug 67657)
2631 !! wikitext
2632 {{echo|1
2633 <!-- should be ignored -->
2634 =foo}}
2635
2636 {{echo|
2637 <!-- should be ignored -->
2638 1 = foo}}
2639
2640 {{echo|1<!-- should be ignored --> = foo}}
2641
2642 {{echo|<!-- should be ignored -->1 = foo}}
2643 !!html/parsoid
2644 <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>
2645
2646 <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>
2647
2648 <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>
2649
2650 <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>
2651 !!end
2652
2653 !! test
2654 Templates: Other wikitext in parameter names (bug 67657)
2655 !! wikitext
2656 {{echo|''1''=foo}}
2657 !!html/parsoid
2658 <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>
2659 !!html/php
2660 <p>{{{1}}}
2661 </p>
2662 !!end
2663
2664 #--------------------------------------------------------------------
2665 # Transclusion parameter escaping tests
2666 #--------------------------------------------------------------------
2667 !! test
2668 Templates: Parsoid parameter escaping test 1
2669 !! options
2670 parsoid
2671 !! wikitext
2672 {{echo|[foo]|{{echo|[bar]}}}}
2673 !! html
2674 <p about="#mwt1" typeof="mw:Transclusion"
2675 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2676 !! end
2677
2678 !! test
2679 Parsoid: Pipes in external links in template parameter
2680 !! options
2681 parsoid
2682 !! wikitext
2683 {{echo|[{{echo|http://example.com}} link]}}
2684 !! html
2685 <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>
2686 !! end
2687
2688 !! test
2689 Parsoid: pipe in transclusion parameter
2690 !! options
2691 parsoid
2692 !! wikitext
2693 {{echo|http://foo.com/a&#124;b}}
2694 !! html
2695 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2696 typeof="mw:Transclusion"
2697 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>
2698 !! end
2699
2700 !! test
2701 Parsoid: Pipe in external link target and content in template parameter
2702 !! options
2703 parsoid=html2wt,wt2wt
2704 !! wikitext
2705 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2706 !! html
2707 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2708 typeof="mw:Transclusion"
2709 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2710 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2711 !! end
2712
2713 !! test
2714 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2715 !! options
2716 parsoid
2717 !! wikitext
2718 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2719 !! html
2720 <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>
2721 !! end
2722
2723 !! test
2724 Templates: Don't escape already nowiki-escaped text in template parameters
2725 !! options
2726 parsoid=html2wt,wt2wt
2727 !! wikitext
2728 {{echo|foo<nowiki>|</nowiki>bar}}
2729 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2730 {{echo|<nowiki></nowiki>}}
2731 !! html
2732 <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>
2733 <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>
2734 <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>
2735 </p>
2736 !! end
2737
2738 ## Bug 52824
2739 !! test
2740 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2741 !! options
2742 parsoid=html2wt,wt2wt
2743 !! wikitext
2744 {{echo|{{echo|1=bar}}}}
2745 !! html
2746 <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>
2747 !! end
2748
2749 ## Bug 56733
2750 !! test
2751 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2752 !! options
2753 parsoid
2754 !! wikitext
2755 {{echo|a : b}}
2756 !! html
2757 <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>
2758 !! end
2759
2760 ## Bug T73412
2761 !! test
2762 Templates: Preserve blank parameter names
2763 !! wikitext
2764 {{echo|=foo}}
2765 !! html/php
2766 <p>{{{1}}}
2767 </p>
2768 !! html/parsoid
2769 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2770 !! end
2771
2772 !! test
2773 Templates: Preserve blank parameter names in other positions
2774 !! wikitext
2775 {{blank_param|bar|=foo}}
2776 !! html/php
2777 <p>bar
2778 foo
2779 </p>
2780 !! html/parsoid
2781 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2782 foo</p>
2783 !! end
2784
2785 ###
2786 ### Parsoid-centric tests for testing RT edge cases for pre
2787 ###
2788
2789 !!test
2790 1a. Indent-Pre and Comments
2791 !! wikitext
2792 a
2793 <!--a-->
2794 c
2795 !! html
2796 <pre>a
2797 </pre>
2798 <p>c
2799 </p>
2800 !!end
2801
2802 !!test
2803 1b. Indent-Pre and Comments
2804 !! wikitext
2805 a
2806 <!--a-->
2807 c
2808 !! html
2809 <pre>a
2810 </pre>
2811 <p>c
2812 </p>
2813 !!end
2814
2815 !!test
2816 1c. Indent-Pre and Comments
2817 !! wikitext
2818 <!--a--> a
2819
2820 <!--a--> a
2821 !! html
2822 <pre> a
2823 </pre>
2824 <pre> a
2825 </pre>
2826 !!end
2827
2828 !!test
2829 1d. Indent-Pre and Comments
2830 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2831 !! wikitext
2832 <!--a--> a
2833
2834 <!--b-->b
2835 !! html
2836 <pre>a
2837 </pre>
2838 <pre>b
2839 </pre>
2840 !!end
2841
2842 !!test
2843 2a. Indent-Pre and tables
2844 !! wikitext
2845 {|
2846 |-
2847 !h1!!h2
2848 |foo||bar
2849 |}
2850 !! html
2851 <table>
2852
2853 <tr>
2854 <th>h1</th>
2855 <th>h2
2856 </th>
2857 <td>foo</td>
2858 <td>bar
2859 </td></tr></table>
2860
2861 !!end
2862
2863 !!test
2864 2b. Indent-Pre and tables
2865 !! wikitext
2866 {|
2867 |-
2868 |foo
2869 |}
2870 !! html
2871 <table>
2872
2873 <tr>
2874 <td>foo
2875 </td></tr></table>
2876
2877 !!end
2878
2879 !!test
2880 2c. Indent-Pre and tables (bug 42252)
2881 !! wikitext
2882 {|
2883 |+ foo
2884 ! | bar
2885 |}
2886 !! html
2887 <table>
2888 <caption> foo
2889 </caption>
2890 <tr>
2891 <th> bar
2892 </th></tr></table>
2893
2894 !!end
2895
2896 !!test
2897 2d. Indent-Pre and tables
2898 !! wikitext
2899 a
2900 {|
2901 | b
2902 |}
2903 !! html/php
2904 <pre>a
2905 </pre>
2906 <table>
2907 <tr>
2908 <td> b
2909 </td></tr></table>
2910
2911 !! html/parsoid
2912 <pre>a</pre>
2913 <table>
2914 <tbody><tr><td> b</td></tr>
2915 </tbody></table>
2916 !!end
2917
2918 !!test
2919 2e. Indent-Pre and table-line syntax
2920 !! wikitext
2921 a
2922 | b
2923 | c
2924 !! html/php
2925 <pre>a
2926 | b
2927 | c
2928 </pre>
2929 !!end
2930
2931 !!test
2932 2f. Indent-pre started by table-line syntax
2933 !! wikitext
2934 a
2935 | b
2936 | c
2937 !! html/php
2938 <p>a
2939 </p>
2940 <pre>| b
2941 | c
2942 </pre>
2943 !! html/parsoid
2944 <p>a</p>
2945 <pre>
2946 | b
2947 | c</pre>
2948 !!end
2949
2950 !!test
2951 3a. Indent-Pre and block tags (single-line html)
2952 !! wikitext
2953 a <p> foo </p>
2954 b <div> foo </div>
2955 c <blockquote> foo </blockquote>
2956 <span> foo </span>
2957 !! html
2958 a <p> foo </p>
2959 b <div> foo </div>
2960 c <blockquote> foo </blockquote>
2961 <pre><span> foo </span>
2962 </pre>
2963 !! html/parsoid
2964 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2965 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2966 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2967 <pre><span> foo </span>
2968 </pre>
2969 !! html+tidy
2970 <p>a</p>
2971 <p>foo</p>
2972 <p>b</p>
2973 <div>foo</div>
2974 <p>c</p>
2975 <blockquote>
2976 <p>foo</p>
2977 </blockquote>
2978 <pre>
2979 <span> foo </span>
2980 </pre>
2981 !! end
2982
2983 !!test
2984 3b. Indent-Pre and block tags (multi-line html)
2985 !! wikitext
2986 a <span>foo</span>
2987 b <div> foo </div>
2988 !! html
2989 <pre>a <span>foo</span>
2990 </pre>
2991 b <div> foo </div>
2992
2993 !! html/parsoid
2994 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2995 b <div data-parsoid='{"stx":"html"}'> foo </div>
2996 !! html+tidy
2997 <pre>
2998 a <span>foo</span>
2999 </pre>
3000 <p>b</p>
3001 <div>foo</div>
3002 !!end
3003
3004 !!test
3005 3c. Indent-Pre and block tags (pre-content on separate line)
3006 !! wikitext
3007 <p>
3008 foo
3009 </p>
3010
3011 <div>
3012 foo
3013 </div>
3014
3015 <center>
3016 foo
3017 </center>
3018
3019 <blockquote>
3020 foo
3021 </blockquote>
3022
3023 <blockquote>
3024 <pre>
3025 foo
3026 </pre>
3027 </blockquote>
3028
3029 <table><tr><td>
3030 foo
3031 </td></tr></table>
3032
3033 <ul><li>
3034 foo
3035 </li></ul>
3036
3037 !! html
3038 <p>
3039 foo
3040 </p>
3041 <div>
3042 <pre>foo
3043 </pre>
3044 </div>
3045 <center>
3046 <pre>foo
3047 </pre>
3048 </center>
3049 <blockquote>
3050 <p> foo
3051 </p>
3052 </blockquote>
3053 <blockquote>
3054 <pre>
3055 foo
3056 </pre>
3057 </blockquote>
3058 <table><tr><td>
3059 <pre>foo
3060 </pre>
3061 </td></tr></table>
3062 <ul><li>
3063 foo
3064 </li></ul>
3065
3066 !!end
3067
3068 !!test
3069 4. Indent-Pre and extension tags
3070 !! wikitext
3071 a <gallery>
3072 File:foobar.jpg
3073 </gallery>
3074 !! html
3075 a <ul class="gallery mw-gallery-traditional">
3076 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3077 <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>
3078 <div class="gallerytext">
3079 </div>
3080 </div></li>
3081 </ul>
3082
3083 !! html+tidy
3084 <p>a</p>
3085 <ul class="gallery mw-gallery-traditional">
3086 <li class="gallerybox" style="width: 155px">
3087 <div style="width: 155px">
3088 <div class="thumb" style="width: 150px;">
3089 <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>
3090 </div>
3091 <div class="gallerytext"></div>
3092 </div>
3093 </li>
3094 </ul>
3095 !!end
3096
3097 !! test
3098 Table wikitext syntax outside wiki-tables
3099 !! wikitext
3100 a
3101 ! not a table heading
3102 |- not a table row
3103 | not a table cell
3104 | class="foo bar" | baz
3105 b
3106 |}
3107 |-
3108 c
3109 !! html
3110 <p>a
3111 ! not a table heading
3112 |- not a table row
3113 | not a table cell
3114 | class="foo bar" | baz
3115 b
3116 |}
3117 |-
3118 c
3119 </p>
3120 !! end
3121
3122 !!test
3123 Render paragraphs when indent-pre is suppressed in blocklevels
3124 !! wikitext
3125 <blockquote>
3126 foo
3127
3128 bar
3129 </blockquote>
3130 !! html
3131 <blockquote>
3132 <p> foo
3133 </p><p> bar
3134 </p>
3135 </blockquote>
3136
3137 !!end
3138
3139 !!test
3140 4. Multiple spaces at start-of-line
3141 !! wikitext
3142 <p> foo </p>
3143 foo
3144 {|
3145 |foo
3146 |}
3147 !! html
3148 <p> foo </p>
3149 <pre> foo
3150 </pre>
3151 <table>
3152 <tr>
3153 <td>foo
3154 </td></tr></table>
3155
3156 !!end
3157
3158 ## NOTE: the leading white-space chars on empty line are significant
3159 !! test
3160 5a. White-space in indent-pre
3161 !! wikitext
3162 a<br />
3163
3164 b
3165 !! html
3166 <pre>a<br />
3167
3168 b
3169 </pre>
3170 !! end
3171
3172 ## NOTE: the leading white-space chars on empty line are significant
3173 !! test
3174 5b. White-space in indent-pre
3175 !! wikitext
3176 a
3177
3178 b
3179
3180
3181 c
3182 !! html
3183 <pre>a
3184
3185 b
3186
3187
3188 c
3189 </pre>
3190 !! end
3191
3192 !! test
3193 5c. White-space in indent-pre
3194 !! wikitext
3195 ''a''
3196 ''b''
3197 ''c''
3198 !! html
3199 <pre><i>a</i>
3200 <i>b</i>
3201 <i>c</i>
3202 </pre>
3203 !! end
3204
3205 !! test
3206 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3207 !! wikitext
3208 a
3209
3210 <!-- continue -->
3211 b
3212
3213 c
3214
3215 d
3216 !! html
3217 <pre>a
3218
3219 b
3220 </pre>
3221 <pre>c
3222
3223 </pre>
3224 <p>d
3225 </p>
3226 !! end
3227
3228 !! test
3229 7a. Indent-pre and category links
3230 !! options
3231 parsoid=wt2html,wt2wt
3232 !! wikitext
3233 [[Category:foo]] <!-- No pre-wrapping -->
3234 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3235 !! html/parsoid
3236 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3237 <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 -->
3238 !! end
3239
3240 !! test
3241 7b. Indent-pre and category links
3242 !! options
3243 parsoid=wt2html,wt2wt
3244 !! wikitext
3245 [[Category:foo]] a
3246 [[Category:foo]] {{echo|b}}
3247 !! html
3248 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3249 <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>
3250 !! end
3251
3252 !! test
3253 Indent-Pre: Newlines in comments shouldn't affect sol state
3254 !! wikitext
3255 a <!--
3256 foo
3257 --> b
3258 !! html/parsoid
3259 <p>a <!--
3260 foo
3261 --> b</p>
3262 !! end
3263
3264 ###
3265 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3266 ###
3267
3268 !!test
3269 HTML-pre: 1. embedded newlines
3270 !! wikitext
3271 <pre>foo</pre>
3272
3273 <pre>
3274 foo
3275 </pre>
3276
3277 <pre>
3278
3279 foo
3280 </pre>
3281
3282 <pre>
3283
3284
3285 foo
3286 </pre>
3287 !! html
3288 <pre>foo</pre>
3289 <pre>
3290 foo
3291 </pre>
3292 <pre>
3293
3294 foo
3295 </pre>
3296 <pre>
3297
3298
3299 foo
3300 </pre>
3301
3302 !! html/parsoid
3303 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3304
3305 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3306 foo
3307 </pre>
3308
3309 <pre data-parsoid='{"stx":"html"}'>
3310
3311 foo
3312 </pre>
3313
3314 <pre data-parsoid='{"stx":"html"}'>
3315
3316
3317 foo
3318 </pre>
3319 !!end
3320
3321 !! test
3322 HTML-pre: big spaces
3323 !! wikitext
3324 <pre>
3325
3326
3327
3328
3329 haha
3330
3331
3332
3333
3334 haha
3335
3336
3337
3338
3339 </pre>
3340 !! html
3341 <pre>
3342
3343
3344
3345
3346 haha
3347
3348
3349
3350
3351 haha
3352
3353
3354
3355
3356 </pre>
3357
3358 !! html/parsoid
3359 <pre data-parsoid='{"stx":"html"}'>
3360
3361
3362
3363
3364 haha
3365
3366
3367
3368
3369 haha
3370
3371
3372
3373
3374 </pre>
3375 !! end
3376
3377 !!test
3378 HTML-pre: 2: indented text
3379 !! wikitext
3380 <pre>
3381 foo
3382 </pre>
3383 !! html
3384 <pre>
3385 foo
3386 </pre>
3387
3388 !!end
3389
3390 !!test
3391 HTML-pre: 3: other wikitext
3392 !! wikitext
3393 <pre>
3394 * foo
3395 # bar
3396 = no-h =
3397 '' no-italic ''
3398 [[ NoLink ]]
3399 </pre>
3400 !! html
3401 <pre>
3402 * foo
3403 # bar
3404 = no-h =
3405 '' no-italic ''
3406 [[ NoLink ]]
3407 </pre>
3408
3409 !!end
3410
3411 ###
3412 ### Definition lists
3413 ###
3414 !! test
3415 Simple definition
3416 !! wikitext
3417 ; name : Definition
3418 !! html
3419 <dl><dt> name&#160;</dt>
3420 <dd> Definition</dd></dl>
3421
3422 !! end
3423
3424 !! test
3425 Definition list for indentation only
3426 !! wikitext
3427 : Indented text
3428 !! html
3429 <dl><dd> Indented text</dd></dl>
3430
3431 !! end
3432
3433 !! test
3434 Definition list with no space
3435 !! wikitext
3436 ;name:Definition
3437 !! html
3438 <dl><dt>name</dt>
3439 <dd>Definition</dd></dl>
3440
3441 !!end
3442
3443 !! test
3444 Definition list with URL link
3445 !! wikitext
3446 ; http://example.com/ : definition
3447 !! html
3448 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3449 <dd> definition</dd></dl>
3450
3451 !! end
3452
3453 !! test
3454 Definition list with bracketed URL link
3455 !! wikitext
3456 ;[http://www.example.com/ Example]:Something about it
3457 !! html
3458 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3459 <dd>Something about it</dd></dl>
3460
3461 !! end
3462
3463 !! test
3464 Definition list with wikilink containing colon
3465 !! wikitext
3466 ; [[Help:FAQ]]: The least-read page on Wikipedia
3467 !! html
3468 <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>
3469 <dd> The least-read page on Wikipedia</dd></dl>
3470
3471 !! end
3472
3473 # At Brion's and JeLuF's insistence... :)
3474 !! test
3475 Definition list with news link containing colon
3476 !! wikitext
3477 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3478 !! html/php
3479 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3480 <dd> This isn't even a real newsgroup!</dd></dl>
3481
3482 !! html/parsoid
3483 <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>
3484 !! end
3485
3486 !! test
3487 Malformed definition list with colon
3488 !! wikitext
3489 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3490 !! html
3491 <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>
3492
3493 !! end
3494
3495 !! test
3496 Definition lists: colon in external link text
3497 !! wikitext
3498 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3499 !! html
3500 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3501 <dd> OK, I made that up</dd></dl>
3502
3503 !! end
3504
3505 !! test
3506 Definition lists: colon in HTML attribute
3507 !! wikitext
3508 ;<b style="display: inline">bold</b>
3509 !! html
3510 <dl><dt><b style="display: inline">bold</b></dt></dl>
3511
3512 !! end
3513
3514 !! test
3515 Definition lists: self-closed tag
3516 !! wikitext
3517 ;one<br/>two : two-line fun
3518 !! html
3519 <dl><dt>one<br />two&#160;</dt>
3520 <dd> two-line fun</dd></dl>
3521
3522 !! end
3523
3524 !! test
3525 Bug 11748: Literal closing tags
3526 !! wikitext
3527 <dl>
3528 <dt>test 1</dt>
3529 <dd>test test test test test</dd>
3530 <dt>test 2</dt>
3531 <dd>test test test test test</dd>
3532 </dl>
3533 !! html
3534 <dl>
3535 <dt>test 1</dt>
3536 <dd>test test test test test</dd>
3537 <dt>test 2</dt>
3538 <dd>test test test test test</dd>
3539 </dl>
3540
3541 !! end
3542
3543 !! test
3544 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3545 !! wikitext
3546 <ul><li>
3547 ; term : description
3548 * unordered
3549 </li></ul>
3550 !! html
3551 <ul><li>
3552 <dl><dt> term&#160;</dt>
3553 <dd> description</dd></dl>
3554 <ul><li> unordered</li></ul>
3555 </li></ul>
3556
3557 !! end
3558
3559 !! test
3560
3561 Definition list with empty definition and following paragraph
3562 !! wikitext
3563 ; term:
3564 Paragraph text
3565 !! html
3566 <dl><dt> term</dt>
3567 <dd></dd></dl>
3568 <p>Paragraph text
3569 </p>
3570 !! end
3571
3572 !! test
3573 Nested definition lists using html syntax
3574 !! wikitext
3575 <dl><dt>x</dt>
3576 <dd>a</dd>
3577 <dd>b</dd></dl>
3578
3579 !! end
3580
3581 !! test
3582 Definition Lists: No nesting: Multiple dd's
3583 !! wikitext
3584 ;x
3585 :a
3586 :b
3587 !! html
3588 <dl><dt>x</dt>
3589 <dd>a</dd>
3590 <dd>b</dd></dl>
3591
3592 !! end
3593
3594 !! test
3595 Definition Lists: Indentation: Regular
3596 !! wikitext
3597 :i1
3598 ::i2
3599 :::i3
3600 !! html
3601 <dl><dd>i1
3602 <dl><dd>i2
3603 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3604
3605 !! end
3606
3607 !! test
3608 Definition Lists: Indentation: Missing 1st level
3609 !! wikitext
3610 ::i2
3611 :::i3
3612 !! html
3613 <dl><dd><dl><dd>i2
3614 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3615
3616 !! end
3617
3618 !! test
3619 Definition Lists: Indentation: Multi-level indent
3620 !! wikitext
3621 :::i3
3622 !! html
3623 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3624
3625 !! end
3626
3627 !! test
3628 Definition Lists: Hacky use to indent tables
3629 !! wikitext
3630 ::{|
3631 |foo
3632 |bar
3633 |}
3634 this text
3635 should be left alone
3636 !! html
3637 <dl><dd><dl><dd><table>
3638 <tr>
3639 <td>foo
3640 </td>
3641 <td>bar
3642 </td></tr></table></dd></dl></dd></dl>
3643 <p>this text
3644 should be left alone
3645 </p>
3646 !! end
3647
3648 !! test
3649 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3650 !! wikitext
3651 <!-- foo -->
3652 ::{|
3653 |foo
3654 |bar
3655 |}<!-- bar -->
3656 this text
3657 should be left alone
3658 !! html/parsoid
3659 <!-- foo -->
3660 <dl><dd><dl><dd><table><tr>
3661 <td>foo</td>
3662 <td>bar</td>
3663 </tr></table><!-- bar --></dd></dl></dd></dl>
3664 <p>this text
3665 should be left alone</p>
3666 !! end
3667
3668 !! test
3669 Definition Lists: Hacky use to indent tables, with comment before table
3670 !! wikitext
3671 ::<!-- foo -->{|
3672 |foo
3673 |}
3674 !! html/parsoid
3675 <dl><dd><dl><dd><!-- foo --><table><tr>
3676 <td>foo</td>
3677 </tr></table></dd></dl></dd></dl>
3678 !! end
3679
3680 # The trailing whitespace in this test is to catch a regression in
3681 # Parsoid after T54473.
3682 !! test
3683 Definition Lists: Hacky use to indent tables (WS-insensitive)
3684 !! wikitext
3685 : {|
3686 |a
3687 |}
3688 !! html/php
3689 <dl><dd><table>
3690 <tr>
3691 <td>a
3692 </td></tr></table></dd></dl>
3693
3694 !! html/parsoid
3695 <dl><dd> <table>
3696 <tbody><tr><td>a</td></tr>
3697 </tbody></table> </dd></dl>
3698 !! end
3699
3700 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3701 ## as an empty dt item. It also ignores all but the last ";" when followed
3702 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3703 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3704 ## ";"s.
3705 ##
3706 ## Ex: ";;t2 ::d2" is transformed into:
3707 ##
3708 ## <dl>
3709 ## <dt>t2 </dt>
3710 ## <dd>
3711 ## <dl>
3712 ## <dt></dt>
3713 ## <dd>d2</dd>
3714 ## </dl>
3715 ## </dd>
3716 ## </dl>
3717 ##
3718 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3719 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3720 ##
3721 ## <dl>
3722 ## <dt>
3723 ## <dl>
3724 ## <dt>t2 </dt>
3725 ## <dd>:d2</dd>
3726 ## </dl>
3727 ## </dt>
3728 ## </dl>
3729 ##
3730 ## All Parsoid only definition list tests have this difference.
3731 ##
3732 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3733 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3734
3735 !! test
3736 Table / list interaction: indented table with lists in table contents
3737 !! wikitext
3738 :{|
3739 |-
3740 | a
3741 * b
3742 |-
3743 | c
3744 * d
3745 |}
3746 !! html
3747 <dl><dd><table>
3748
3749 <tr>
3750 <td> a
3751 <ul><li> b</li></ul>
3752 </td></tr>
3753 <tr>
3754 <td> c
3755 <ul><li> d</li></ul>
3756 </td></tr></table></dd></dl>
3757
3758 !! end
3759
3760 !!test
3761 Table / list interaction: lists nested in tables nested in indented lists
3762 !! wikitext
3763 :{|
3764 |
3765 :a
3766 :b
3767 |
3768 *c
3769 *d
3770 |}
3771
3772 *e
3773 *f
3774 !! html
3775 <dl><dd><table>
3776 <tr>
3777 <td>
3778 <dl><dd>a</dd>
3779 <dd>b</dd></dl>
3780 </td>
3781 <td>
3782 <ul><li>c</li>
3783 <li>d</li></ul>
3784 </td></tr></table></dd></dl>
3785 <ul><li>e</li>
3786 <li>f</li></ul>
3787
3788 !!end
3789
3790 !! test
3791 Definition Lists: Nesting: Multi-level (Parsoid only)
3792 !! options
3793 parsoid
3794 !! wikitext
3795 ;t1 :d1
3796 ;;t2 ::d2
3797 ;;;t3 :::d3
3798 !! html
3799 <dl>
3800 <dt>t1 </dt>
3801 <dd>d1</dd>
3802 <dt>
3803 <dl>
3804 <dt>t2 </dt>
3805 <dd>:d2</dd>
3806 <dt>
3807 <dl>
3808 <dt>t3 </dt>
3809 <dd>::d3</dd>
3810 </dl>
3811 </dt>
3812 </dl>
3813 </dt>
3814 </dl>
3815
3816
3817 !! end
3818
3819
3820 !! test
3821 Definition Lists: Nesting: Test 2 (Parsoid only)
3822 !! options
3823 parsoid
3824 !! wikitext
3825 ;t1
3826 ::d2
3827 !! html
3828 <dl>
3829 <dt>t1</dt>
3830 <dd>
3831 <dl>
3832 <dd>d2</dd>
3833 </dl>
3834 </dd>
3835 </dl>
3836
3837 !! end
3838
3839
3840 !! test
3841 Definition Lists: Nesting: Test 3 (Parsoid only)
3842 !! options
3843 parsoid
3844 !! wikitext
3845 :;t1
3846 ::::d2
3847 !! html
3848 <dl>
3849 <dd>
3850 <dl>
3851 <dt>t1</dt>
3852 <dd>
3853 <dl>
3854 <dd>
3855 <dl>
3856 <dd>d2</dd>
3857 </dl>
3858 </dd>
3859 </dl>
3860 </dd>
3861 </dl>
3862 </dd>
3863 </dl>
3864
3865 !! end
3866
3867
3868 !! test
3869 Definition Lists: Nesting: Test 4
3870 !! wikitext
3871 ::;t3
3872 :::d3
3873 !! html
3874 <dl><dd><dl><dd><dl><dt>t3</dt>
3875 <dd>d3</dd></dl></dd></dl></dd></dl>
3876
3877 !! end
3878
3879
3880 ## The Parsoid team believes the following three test exposes a
3881 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3882 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3883 ## It also exposes a "misfeature" in tidy, which doesn't like
3884 ## <dl> tags with a single <dt> child; it converts the <dt> into
3885 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3886 !! test
3887 Definition Lists: Mixed Lists: Test 1
3888 !! wikitext
3889 :;* foo
3890 ::* bar
3891 :; baz
3892 !! html/php
3893 <dl><dd><dl><dt><ul><li> foo</li>
3894 <li> bar</li></ul></dt></dl>
3895 <dl><dt> baz</dt></dl></dd></dl>
3896
3897 !! html/php+tidy
3898 <dl>
3899 <dd>
3900 <dl>
3901 <dd>
3902 <ul>
3903 <li>foo</li>
3904 <li>bar</li>
3905 </ul>
3906 </dd>
3907 </dl>
3908 <dl>
3909 <dt>baz</dt>
3910 </dl>
3911 </dd>
3912 </dl>
3913 !! html/parsoid
3914 <dl>
3915 <dd><dl>
3916 <dt><ul>
3917 <li> foo
3918 </li>
3919 </ul></dt>
3920 <dd><ul>
3921 <li> bar
3922 </li>
3923 </ul></dd>
3924 <dt> baz</dt>
3925 </dl></dd>
3926 </dl>
3927 !! end
3928
3929 !! test
3930 Definition Lists: Mixed Lists: Test 2
3931 !! wikitext
3932 *: d1
3933 *: d2
3934 !! html
3935 <ul><li><dl><dd> d1</dd>
3936 <dd> d2</dd></dl></li></ul>
3937
3938 !! end
3939
3940
3941 !! test
3942 Definition Lists: Mixed Lists: Test 3
3943 !! wikitext
3944 *::: d1
3945 *::: d2
3946 !! html
3947 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3948 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3949
3950 !! end
3951
3952
3953 !! test
3954 Definition Lists: Mixed Lists: Test 4
3955 !! wikitext
3956 *;d1 :d2
3957 *;d3 :d4
3958 !! html
3959 <ul><li><dl><dt>d1&#160;</dt>
3960 <dd>d2</dd>
3961 <dt>d3&#160;</dt>
3962 <dd>d4</dd></dl></li></ul>
3963
3964 !! end
3965
3966
3967 !! test
3968 Definition Lists: Mixed Lists: Test 5
3969 !! wikitext
3970 *:d1
3971 *:: d2
3972 !! html
3973 <ul><li><dl><dd>d1
3974 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3975
3976 !! end
3977
3978
3979 !! test
3980 Definition Lists: Mixed Lists: Test 6
3981 !! wikitext
3982 #*:d1
3983 #*::: d3
3984 !! html
3985 <ol><li><ul><li><dl><dd>d1
3986 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3987
3988 !! end
3989
3990
3991 !! test
3992 Definition Lists: Mixed Lists: Test 7
3993 !! wikitext
3994 :* d1
3995 :* d2
3996 !! html
3997 <dl><dd><ul><li> d1</li>
3998 <li> d2</li></ul></dd></dl>
3999
4000 !! end
4001
4002
4003 !! test
4004 Definition Lists: Mixed Lists: Test 8
4005 !! wikitext
4006 :* d1
4007 ::* d2
4008 !! html
4009 <dl><dd><ul><li> d1</li></ul>
4010 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4011
4012 !! end
4013
4014
4015 !! test
4016 Definition Lists: Mixed Lists: Test 9
4017 !! wikitext
4018 *;foo :bar
4019 !! html
4020 <ul><li><dl><dt>foo&#160;</dt>
4021 <dd>bar</dd></dl></li></ul>
4022
4023 !! end
4024
4025
4026 !! test
4027 Definition Lists: Mixed Lists: Test 10
4028 !! wikitext
4029 *#;foo :bar
4030 !! html
4031 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4032 <dd>bar</dd></dl></li></ol></li></ul>
4033
4034 !! end
4035
4036 # The Parsoid team disagrees with the PHP parser's seemingly-random
4037 # rules regarding dd/dt on the next two tests. Parsoid is more
4038 # consistent, and recognizes the shared nesting and keeps the
4039 # still-open tags around until the nesting is complete.
4040 # (And tidy again converts <dt> to <dd> before 'bar'.)
4041
4042 !! test
4043 Definition Lists: Mixed Lists: Test 11
4044 !! wikitext
4045 *#*#;*;;foo :bar
4046 *#*#;boo :baz
4047 !! html/php
4048 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4049 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4050 <dl><dt>boo&#160;</dt>
4051 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4052
4053 !! html/php+tidy
4054 <ul>
4055 <li>
4056 <ol>
4057 <li>
4058 <ul>
4059 <li>
4060 <ol>
4061 <li>
4062 <dl>
4063 <dt>foo&#160;</dt>
4064 <dd>
4065 <ul>
4066 <li>
4067 <dl>
4068 <dd>
4069 <dl>
4070 <dt>bar</dt>
4071 </dl>
4072 </dd>
4073 </dl>
4074 </li>
4075 </ul>
4076 </dd>
4077 </dl>
4078 <dl>
4079 <dt>boo&#160;</dt>
4080 <dd>baz</dd>
4081 </dl>
4082 </li>
4083 </ol>
4084 </li>
4085 </ul>
4086 </li>
4087 </ol>
4088 </li>
4089 </ul>
4090 !! html/parsoid
4091 <ul>
4092 <li>
4093 <ol>
4094 <li>
4095 <ul>
4096 <li>
4097 <ol>
4098 <li>
4099 <dl>
4100 <dt>
4101 <ul>
4102 <li>
4103 <dl>
4104 <dt>
4105 <dl>
4106 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4107 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4108 </dl></dt>
4109 </dl></li>
4110 </ul></dt>
4111 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4112 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4113 </dl></li>
4114 </ol></li>
4115 </ul></li>
4116 </ol></li>
4117 </ul>
4118 !! end
4119
4120
4121 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4122 # From whitelist:
4123 # * The test is wrong, there are two colons where there should be :;
4124 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4125 !! test
4126 Definition Lists: Weird Ones: Test 1
4127 !! wikitext
4128 *#;*::;; foo : bar (who uses this?)
4129 !! html/php
4130 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4131 <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>
4132
4133 !! html/php+tidy
4134 <ul>
4135 <li>
4136 <ol>
4137 <li>
4138 <dl>
4139 <dt>foo&#160;</dt>
4140 <dd>
4141 <ul>
4142 <li>
4143 <dl>
4144 <dd>
4145 <dl>
4146 <dd>
4147 <dl>
4148 <dd>
4149 <dl>
4150 <dt>bar (who uses this?)</dt>
4151 </dl>
4152 </dd>
4153 </dl>
4154 </dd>
4155 </dl>
4156 </dd>
4157 </dl>
4158 </li>
4159 </ul>
4160 </dd>
4161 </dl>
4162 </li>
4163 </ol>
4164 </li>
4165 </ul>
4166 !! html/parsoid
4167 <ul>
4168 <li>
4169 <ol>
4170 <li>
4171 <dl>
4172 <dt>
4173 <ul>
4174 <li>
4175 <dl>
4176 <dd>
4177 <dl>
4178 <dd>
4179 <dl>
4180 <dt>
4181 <dl>
4182 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4183 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4184 </dl></dt>
4185 </dl></dd>
4186 </dl></dd>
4187 </dl></li>
4188 </ul></dt>
4189 </dl></li>
4190 </ol></li>
4191 </ul>
4192 !! end
4193
4194 !! test
4195 Definition Lists: colons occurring in tags
4196 !! wikitext
4197 ;a:b
4198 ;'''a:b'''
4199 ;<i>a:b</i>
4200 ;<span>a:b</span>
4201 ;<div>a:b</div>
4202 ;<div>a
4203 :b</div>
4204 ;{{echo|a:b}}
4205 ;{{echo|''a:b''}}
4206 ;;;''a:b''
4207 !! html+tidy
4208 <dl>
4209 <dt>a</dt>
4210 <dd>b</dd>
4211 <dt><b>a:b</b></dt>
4212 <dt><i>a:b</i></dt>
4213 <dt><span>a:b</span></dt>
4214 <dd>
4215 <div>a:b</div>
4216 </dd>
4217 <dd>
4218 <div>a
4219 <dl>
4220 <dd>b</dd>
4221 </dl>
4222 </div>
4223 </dd>
4224 <dt>a</dt>
4225 <dd>b</dd>
4226 <dt><i>a:b</i></dt>
4227 </dl>
4228 <dl>
4229 <dd>
4230 <dl>
4231 <dd>
4232 <dl>
4233 <dt><i>a:b</i></dt>
4234 </dl>
4235 </dd>
4236 </dl>
4237 </dd>
4238 </dl>
4239 !! end
4240
4241 !! test
4242 Definition Lists: colons and tables 1
4243 !! wikitext
4244 :{|
4245 | x
4246 |}
4247 :{|
4248 | y
4249 |}
4250 !! html
4251 <dl><dd><table>
4252 <tr>
4253 <td> x
4254 </td></tr></table></dd></dl>
4255 <dl><dd><table>
4256 <tr>
4257 <td> y
4258 </td></tr></table></dd></dl>
4259
4260 !! end
4261
4262 # Parsoid's output (as documented below) differs from php's in this case.
4263 # This is probably a bug. If we fixup parsoid to match php's output, the
4264 # above test should pass and the below test case can be removed. It is
4265 # unclear which output is more desirable.
4266
4267 !! test
4268 Definition Lists: colons and tables 2
4269 !! wikitext
4270 :{|
4271 | x
4272 |}
4273 :{|
4274 | y
4275 |}
4276 !! html/parsoid
4277 <dl><dd><table>
4278 <tr>
4279 <td> x
4280 </td></tr></table></dd>
4281 <dd><table>
4282 <tr>
4283 <td> y
4284 </td></tr></table></dd></dl>
4285 !! end
4286
4287 !! test
4288 Definition Lists: template interaction
4289 !! wikitext
4290 ::{{definition_list}}
4291
4292 :one
4293 ::{{definition_list}}
4294 :::two
4295 :::three
4296 ::four
4297 !! html/parsoid
4298 <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">
4299 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4300
4301 <dl><dd data-parsoid='{}'>one
4302 <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">
4303 </span><dd about="#mwt2">two
4304 <dl><dd>two</dd>
4305 <dd>three</dd></dl></dd>
4306 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4307 !! end
4308
4309
4310 ###
4311 ### External links
4312 ###
4313 !! test
4314 External links: non-bracketed
4315 !! wikitext
4316 Non-bracketed: http://example.com
4317 !! html
4318 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4319 </p>
4320 !! end
4321
4322 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4323 !! test
4324 External links: numbered
4325 !! wikitext
4326 Numbered: [http://example.com]
4327 Numbered: [http://example.net]
4328 Numbered: [http://example.com]
4329 !! html/php
4330 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4331 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4332 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4333 </p>
4334 !! html/parsoid
4335 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4336 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4337 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4338 !!end
4339
4340 !! test
4341 External links: specified text
4342 !! wikitext
4343 Specified text: [http://example.com link]
4344 !! html
4345 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4346 </p>
4347 !!end
4348
4349 !! test
4350 External links: trail
4351 !! wikitext
4352 Linktrails should not work for external links: [http://example.com link]s
4353 !! html
4354 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4355 </p>
4356 !! end
4357
4358 !! test
4359 External links: dollar sign in URL
4360 !! wikitext
4361 http://example.com/1$2345
4362 !! html
4363 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4364 </p>
4365 !! end
4366
4367 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4368 !! test
4369 External links: dollar sign in URL (autonumber)
4370 !! wikitext
4371 [http://example.com/1$2345]
4372 !! html/php
4373 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4374 </p>
4375 !! html/parsoid
4376 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4377 !!end
4378
4379 !! test
4380 External links: open square bracket forbidden in URL (bug 4377)
4381 !! options
4382 parsoid=wt2html,wt2wt,html2html
4383 !! wikitext
4384 http://example.com/1[2345
4385 !! html/php
4386 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4387 </p>
4388 !! html/parsoid
4389 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4390 !! end
4391
4392 !! test
4393 External links: open square bracket forbidden in URL (named) (bug 4377)
4394 !! options
4395 parsoid=wt2html,html2html
4396 !! wikitext
4397 [http://example.com/1[2345]
4398 !! html/php
4399 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4400 </p>
4401 !! html/parsoid
4402 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4403 !!end
4404
4405 # parsoid adds a space before the link name
4406 !! test
4407 External links: open square bracket forbidden in URL (named) (bug 4377)
4408 Parsoid variant.
4409 !! wikitext
4410 [http://example.com/1 [2345]
4411 !! html
4412 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4413 </p>
4414 !!end
4415
4416 !! test
4417 External links: nowiki in URL link text (bug 6230)
4418 !! wikitext
4419 [http://example.com/ <nowiki>''example site''</nowiki>]
4420 !! html
4421 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4422 </p>
4423 !! end
4424
4425 !! test
4426 External links: newline forbidden in text (bug 6230 regression check)
4427 !! wikitext
4428 [http://example.com/ first
4429 second]
4430 !! html
4431 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4432 second]
4433 </p>
4434 !!end
4435
4436 !! test
4437 External links: Pipe char between url and text
4438 !! wikitext
4439 [http://example.com | link]
4440 !! html
4441 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4442 </p>
4443 !!end
4444
4445 !! test
4446 External links: protocol-relative URL in brackets
4447 !! wikitext
4448 [//example.com/ Test]
4449 !! html
4450 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4451 </p>
4452 !! end
4453
4454 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4455 !! test
4456 External links: protocol-relative URL in brackets without text
4457 !! wikitext
4458 [//example.com]
4459 !! html/php
4460 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4461 </p>
4462 !! html/parsoid
4463 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4464 !! end
4465
4466 !! test
4467 External links: protocol-relative URL in free text is left alone
4468 !! wikitext
4469 //example.com/Foo
4470 !! html
4471 <p>//example.com/Foo
4472 </p>
4473 !!end
4474
4475 !! test
4476 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4477 !! wikitext
4478 foo//example.com/Foo
4479 !! html
4480 <p>foo//example.com/Foo
4481 </p>
4482 !! end
4483
4484 !! test
4485 External links: with no contents
4486 !! wikitext
4487 [http://en.wikipedia.org/wiki/Foo]
4488
4489 [[wikipedia:Foo|Bar]]
4490
4491 [[wikipedia:Foo|<span>Bar</span>]]
4492 !! html/php
4493 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4494 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4495 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4496 </p>
4497 !! html/parsoid
4498 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4499 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4500 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4501 !! end
4502
4503 !! test
4504 External links: Free with trailing punctuation
4505 !! wikitext
4506 http://example.com,
4507 http://example.com;
4508 http://example.com\
4509 http://example.com.
4510 http://example.com:
4511 http://example.com!
4512 http://example.com?
4513 http://example.com)
4514 http://example.com/url_with_(brackets)
4515 (http://example.com/url_without_brackets)
4516 http://example.com/url_with_entity&nbsp;
4517 http://example.com/url_with_entity&#xA0;
4518 http://example.com/url_with_entity&#160;
4519 http://example.com/url_with_entity&lt;
4520 http://example.com/url_with_entity&#x3C;
4521 http://example.com/url_with_entity&#60;
4522 !! html/php
4523 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4524 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4525 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4526 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4527 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4528 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4529 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4530 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4531 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4532 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4533 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4534 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4535 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4536 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4537 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4538 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4539 </p>
4540 !! html/parsoid
4541 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4542 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4543 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4544 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4545 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4546 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4547 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4548 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4549 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4550 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4551 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4552 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4553 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4554 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4555 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4556 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4557 !! end
4558
4559 !! test
4560 External links: No preceding word characters allowed (bug 65278)
4561 !! wikitext
4562 NOPEhttp://example.com
4563 N0http://example.com
4564 ok:http://example.com
4565 ok-http://example.com
4566 !! html
4567 <p>NOPEhttp://example.com
4568 N0http://example.com
4569 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4570 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4571 </p>
4572 !! end
4573
4574 !! test
4575 External image
4576 !! wikitext
4577 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4578 !! html
4579 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4580 </p>
4581 !! end
4582
4583 !! test
4584 External image from https
4585 !! wikitext
4586 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4587 !! html
4588 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4589 </p>
4590 !! end
4591
4592 !! test
4593 External image (when not allowed)
4594 !! options
4595 wgAllowExternalImages=0
4596 !! wikitext
4597 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4598 !! html
4599 <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>
4600 </p>
4601 !! end
4602
4603 !! test
4604 Link to non-http image, no img tag
4605 !! wikitext
4606 Link to non-http image, no img tag: ftp://example.com/test.jpg
4607 !! html
4608 <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>
4609 </p>
4610 !! end
4611
4612 !! test
4613 External links: terminating separator
4614 !! wikitext
4615 Terminating separator: http://example.com/thing,
4616 !! html
4617 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4618 </p>
4619 !! end
4620
4621 !! test
4622 External links: intervening separator
4623 !! wikitext
4624 Intervening separator: http://example.com/1,2,3
4625 !! html
4626 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4627 </p>
4628 !! end
4629
4630 !! test
4631 External links: old bug with URL in query
4632 !! wikitext
4633 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4634 !! html
4635 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4636 </p>
4637 !! end
4638
4639 !! test
4640 External links: old URL-in-URL bug, mixed protocols
4641 !! wikitext
4642 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4643 !! html
4644 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4645 </p>
4646 !!end
4647
4648 !! test
4649 External links: URL in text
4650 !! wikitext
4651 URL in text: [http://example.com http://example.com]
4652 !! html
4653 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4654 </p>
4655 !! end
4656
4657 !! test
4658 External links: Clickable images
4659 !! wikitext
4660 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4661 !! html/php
4662 <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>
4663 </p>
4664 !! html/parsoid
4665 <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>
4666 !! end
4667
4668 !! test
4669 External links: raw ampersand
4670 !! wikitext
4671 Old &amp; use: http://x&y
4672 !! html
4673 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4674 </p>
4675 !! end
4676
4677 !! test
4678 External links: encoded ampersand
4679 !! wikitext
4680 Old &amp; use: http://x&amp;y
4681 !! html/php
4682 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4683 </p>
4684 !! html/parsoid
4685 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4686 !! end
4687
4688 !! test
4689 External links: encoded equals (bug 6102)
4690 !! wikitext
4691 http://example.com/?foo&#61;bar
4692 !! html/php
4693 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4694 </p>
4695 !! html/parsoid
4696 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4697 !! end
4698
4699 ##
4700 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4701 ## does it number them. As discussed in bug 53505, we can identify
4702 ## autonumbered links via CSS.
4703 ##
4704
4705 !! test
4706 External links: [raw ampersand]
4707 !! wikitext
4708 Old &amp; use: [http://x&y]
4709 !! html/php
4710 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4711 </p>
4712 !! html/parsoid
4713 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4714 !! end
4715
4716 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4717 # mode will return the [raw ampersand] wikitext
4718 !! test
4719 External links: [encoded ampersand]
4720 !! options
4721 parsoid=wt2html,wt2wt,html2html
4722 !! wikitext
4723 Old &amp; use: [http://x&amp;y]
4724 !! html/php
4725 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4726 </p>
4727 !! html/parsoid
4728 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4729 !! end
4730
4731 !! test
4732 External links: [raw equals]
4733 !! wikitext
4734 [http://example.com/?foo=bar]
4735 !! html/php
4736 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4737 </p>
4738 !! html/parsoid
4739 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4740 !! end
4741
4742 # note that parsoid html is identical to [raw equals] case; so html2wt
4743 # mode will return the [raw equals] wikitext
4744 !! test
4745 External links: [encoded equals] (bug 6102)
4746 !! options
4747 parsoid=wt2html,wt2wt,html2html
4748 !! wikitext
4749 [http://example.com/?foo&#61;bar]
4750 !! html/php
4751 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4752 </p>
4753 !! html/parsoid
4754 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4755 !! end
4756
4757 # xxx parsoid strips the IDN character, so the round-trip tests will
4758 # obviously fail and are disabled. --cscott
4759 !! test
4760 External links: [IDN ignored character reference in hostname; strip it right off]
4761 !! options
4762 parsoid=wt2html,wt2wt,html2html
4763 !! wikitext
4764 [http://e&zwnj;xample.com/]
4765 !! html/php
4766 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4767 </p>
4768 !! html/parsoid
4769 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4770 !! end
4771
4772 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4773 # Where an external link could easily circumvent the sanitization of the text of
4774 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4775 # test demands a higher standard. That's a bit strange.
4776 #
4777 # Example:
4778 #
4779 # http://e‌xample.com -> [http://example.com|http://example.com]
4780 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4781 #
4782 # The first example is sanitized, but the second is not. Any security benefits
4783 # from this production are trivial to circumvent. Either remove this test and
4784 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4785 # the test accordingly.
4786 #
4787 # All our love,
4788 # The Parsoid team.
4789 # xxx parsoid strips the IDN character, so the round-trip tests will
4790 # obviously fail and are disabled. --cscott
4791 !! test
4792 External links: IDN ignored character reference in hostname; strip it right off
4793 !! options
4794 parsoid=wt2html,html2html
4795 !! wikitext
4796 http://e&zwnj;xample.com/
4797 !! html/php
4798 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4799 </p>
4800 !! html/parsoid
4801 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4802 !! end
4803
4804 !! test
4805 External links: www.jpeg.org (bug 554)
4806 !! wikitext
4807 http://www.jpeg.org
4808 !! html
4809 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4810 </p>
4811 !! end
4812
4813 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4814 !! test
4815 External links: URL within URL (original bug 2)
4816 !! wikitext
4817 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4818 !! html/php
4819 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4820 </p>
4821 !! html/parsoid
4822 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4823 !! end
4824
4825 !! test
4826 BUG 361: URL inside bracketed URL
4827 !! wikitext
4828 [http://www.example.com/foo http://www.example.com/bar]
4829 !! html
4830 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4831 </p>
4832 !! end
4833
4834 !! test
4835 BUG 361: URL within URL, not bracketed
4836 !! wikitext
4837 http://www.example.com/foo?=http://www.example.com/bar
4838 !! html
4839 <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>
4840 </p>
4841 !! end
4842
4843 !! test
4844 BUG 289: ">"-token in URL-tail
4845 !! wikitext
4846 http://www.example.com/<hello>
4847 !! html
4848 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4849 </p>
4850 !!end
4851
4852 !! test
4853 BUG 289: literal ">"-token in URL-tail
4854 !! wikitext
4855 http://www.example.com/<b>html</b>
4856 !! html/php
4857 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4858 </p>
4859 !! html/parsoid
4860 <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>
4861 !! end
4862
4863 !! test
4864 BUG 289: ">"-token in bracketed URL
4865 !! wikitext
4866 [http://www.example.com/<hello> stuff]
4867 !! html
4868 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4869 </p>
4870 !!end
4871
4872 !! test
4873 BUG 289: literal ">"-token in bracketed URL
4874 !! wikitext
4875 [http://www.example.com/<b>html</b> stuff]
4876 !! html
4877 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4878 </p>
4879 !!end
4880
4881 !! test
4882 BUG 289: literal double quote at end of URL
4883 !! wikitext
4884 http://www.example.com/"hello"
4885 !! html
4886 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4887 </p>
4888 !!end
4889
4890 !! test
4891 BUG 289: literal double quote in bracketed URL
4892 !! wikitext
4893 [http://www.example.com/"hello" stuff]
4894 !! html
4895 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4896 </p>
4897 !!end
4898
4899 !! test
4900 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4901 !! wikitext
4902 [http://www.example.com test]
4903 !! html
4904 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4905 </p>
4906 !! end
4907
4908 !! test
4909 External links: link text with spaces
4910 !! wikitext
4911 [http://www.example.com a b c]
4912 [http://www.example.com ''a'' ''b'']
4913 !! html
4914 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4915 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4916 </p>
4917 !! end
4918
4919 !! test
4920 External links: wiki links within external link (Bug 3695)
4921 !! wikitext
4922 [http://example.com [[wikilink]] embedded in ext link]
4923 !! html/php
4924 <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>
4925 </p>
4926 !! html/parsoid
4927 <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>
4928 !! end
4929
4930 !! test
4931 BUG 787: Links with one slash after the url protocol are invalid
4932 !! wikitext
4933 http:/example.com
4934
4935 [http:/example.com title]
4936 !! html
4937 <p>http:/example.com
4938 </p><p>[http:/example.com title]
4939 </p>
4940 !! end
4941
4942 !! test
4943 Bracketed external links with template-generated invalid target
4944 !! wikitext
4945 [{{echo|http:/example.com}} title]
4946 !! html
4947 <p>[http:/example.com title]
4948 </p>
4949 !! end
4950
4951 !! test
4952 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4953 !! wikitext
4954 ''[http://example.com text'']
4955 [http://example.com '''text]'''
4956 ''Something [http://example.com in italic'']
4957 ''Something [http://example.com mixed''''', even bold]'''
4958 '''''Now [http://example.com both''''']
4959 !! html
4960 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4961 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4962 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4963 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4964 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4965 </p>
4966 !! end
4967
4968
4969 !! test
4970 Bug 4781: %26 in URL
4971 !! wikitext
4972 http://www.example.com/?title=AT%26T
4973 !! html/php
4974 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4975 </p>
4976 !! html/parsoid
4977 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4978 !! end
4979
4980 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4981 # % is actually legal in HTML5. Any change in output would need testing though.
4982 !! test
4983 Bug 4781, 5267: %25 in URL
4984 !! wikitext
4985 http://www.example.com/?title=100%25_Bran
4986 !! html/php
4987 <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>
4988 </p>
4989 !! html/parsoid
4990 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4991 !! end
4992
4993 !! test
4994 Bug 4781, 5267: %28, %29 in URL
4995 !! wikitext
4996 http://www.example.com/?title=Ben-Hur_%281959_film%29
4997 !! html/php
4998 <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>
4999 </p>
5000 !! html/parsoid
5001 <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>
5002 !! end
5003
5004
5005 !! test
5006 Bug 4781: %26 in autonumber URL
5007 !! wikitext
5008 [http://www.example.com/?title=AT%26T]
5009 !! html/php
5010 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5011 </p>
5012 !! html/parsoid
5013 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5014 !! end
5015
5016 !! test
5017 Bug 4781, 5267: %26 in autonumber URL
5018 !! wikitext
5019 [http://www.example.com/?title=100%25_Bran]
5020 !! html/php
5021 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5022 </p>
5023 !! html/parsoid
5024 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5025 !! end
5026
5027 !! test
5028 Bug 4781, 5267: %28, %29 in autonumber URL
5029 !! wikitext
5030 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5031 !! html/php
5032 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5033 </p>
5034 !! html/parsoid
5035 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5036 !! end
5037
5038
5039 !! test
5040 Bug 4781: %26 in bracketed URL
5041 !! wikitext
5042 [http://www.example.com/?title=AT%26T link]
5043 !! html/php
5044 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5045 </p>
5046 !! html/parsoid
5047 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5048 !! end
5049
5050 !! test
5051 Bug 4781, 5267: %25 in bracketed URL
5052 !! wikitext
5053 [http://www.example.com/?title=100%25_Bran link]
5054 !! html
5055 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5056 </p>
5057 !! end
5058
5059 !! test
5060 Bug 4781, 5267: %28, %29 in bracketed URL
5061 !! wikitext
5062 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5063 !! html/php
5064 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5065 </p>
5066 !! html/parsoid
5067 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5068 !! end
5069
5070 !! test
5071 External link containing a period in the anchor. (bug 63947)
5072 !! wikitext
5073 [//foo.org/bar#baz. bang]
5074
5075 [//foo.org/bar. bang]
5076 !! html/php
5077 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5078 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5079 </p>
5080 !! html/parsoid
5081 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5082 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5083 !! end
5084
5085 !! test
5086 External link containing a single quote. (bug 63947)
5087 !! wikitext
5088 [//foo.org/bar'baz]
5089
5090 [//foo.org/bar'baz bang]
5091 !! html/php
5092 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5093 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5094 </p>
5095 !! html/parsoid
5096 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5097 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5098 !! end
5099
5100
5101 !! test
5102 External link containing a period in the anchor. (bug 63947)
5103 !! wikitext
5104 [//foo.org/bar#baz. bang]
5105
5106 [//foo.org/bar. bang]
5107 !! html/php
5108 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5109 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5110 </p>
5111 !! html/parsoid
5112 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5113 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5114 !! end
5115
5116 !! test
5117 External link containing a single quote. (bug 63947)
5118 !! wikitext
5119 [//foo.org/bar'baz]
5120
5121 [//foo.org/bar'baz bang]
5122 !! html/php
5123 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5124 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5125 </p>
5126 !! html/parsoid
5127 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5128 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5129 !! end
5130
5131
5132 !! test
5133 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5134 !! wikitext
5135 Some [http://example.com/ pretty ''italics'' and stuff]!
5136 !! html
5137 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5138 </p>
5139 !! end
5140
5141 !! test
5142 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5143 !! wikitext
5144 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5145 !! html
5146 <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>
5147 </p>
5148 !! end
5149
5150 !! test
5151 External link containing double-single-quotes with no space separating the url from text in italics
5152 !! wikitext
5153 [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]].]
5154 !! html/php
5155 <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>
5156 </p>
5157 !! html/php+tidy
5158 <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>
5159 !! html/parsoid
5160 <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>
5161 !! end
5162
5163 !! test
5164 External link with comments in link text
5165 !! wikitext
5166 [http://www.google.com Google <!-- comment -->]
5167 !! html
5168 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5169 </p>
5170 !! end
5171
5172 !! test
5173 URL-encoding in URL functions (single parameter)
5174 !! wikitext
5175 {{localurl:Some page|amp=&}}
5176 !! html
5177 <p>/index.php?title=Some_page&amp;amp=&amp;
5178 </p>
5179 !! end
5180
5181 !! test
5182 URL-encoding in URL functions (multiple parameters)
5183 !! wikitext
5184 {{localurl:Some page|q=?&amp=&}}
5185 !! html
5186 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5187 </p>
5188 !! end
5189
5190 !! test
5191 Brackets in urls
5192 !! wikitext
5193 http://example.com/index.php?foozoid%5B%5D=bar
5194
5195 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5196 !! html/php
5197 <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>
5198 </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>
5199 </p>
5200 !! html/parsoid
5201 <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>
5202
5203 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5204 !! end
5205
5206 !! test
5207 IPv6 urls (bug 21261)
5208 !! options
5209 disabled
5210 !! wikitext
5211 http://[2404:130:0:1000::187:2]/index.php
5212 !! html
5213 <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>
5214 </p>
5215 !! end
5216
5217 !! test
5218 Non-extlinks in brackets
5219 !! wikitext
5220 [foo]
5221 [foo bar]
5222 [foo ''bar'']
5223 [fool's] errand
5224 [fool's errand]
5225 [{{echo|foo}}]
5226 [{{echo|foo}} bar]
5227 [{{echo|foo}} ''bar'']
5228 [{{echo|foo}}l's] errand
5229 [{{echo|foo}}l's errand]
5230 [url={{echo|foo}}]
5231 [url=http://example.com]
5232 !! html
5233 <p>[foo]
5234 [foo bar]
5235 [foo <i>bar</i>]
5236 [fool's] errand
5237 [fool's errand]
5238 [foo]
5239 [foo bar]
5240 [foo <i>bar</i>]
5241 [fool's] errand
5242 [fool's errand]
5243 [url=foo]
5244 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5245 </p>
5246 !! end
5247
5248 !! test
5249 Percent encoding in external links
5250 !! wikitext
5251 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5252 !! html/php
5253 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5254 </p>
5255 !! html/parsoid
5256 <p><a rel="mw:ExtLink"
5257 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5258 !! end
5259
5260 !! test
5261 Use url link syntax for links where the content is equal the link target
5262 !! wikitext
5263 http://example.com
5264 !! html/php
5265 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5266 </p>
5267 !! html/parsoid
5268 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5269 !! end
5270
5271 !! test
5272 Parenthesis in external links, especially URL links
5273 !! wikitext
5274 http://example.com)
5275
5276 http://example.com/test)
5277
5278 http://example.com/(test)
5279
5280 http://example.com/((test)
5281
5282 (http://example.com/(test))
5283
5284 (http://example.com/(test)))))
5285
5286 http://example.com/a)b
5287
5288 [http://example.com) foo]
5289 !! html/php
5290 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5291 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5292 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5293 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5294 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5295 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5296 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5297 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5298 </p>
5299 !! html/parsoid
5300 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5301 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5302 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5303 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5304 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5305 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5306 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5307 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5308 !! end
5309
5310 !! test
5311 Parenthesis in external links, w/ transclusion or comment
5312 !! wikitext
5313 (http://example.com/{{echo|hi}})
5314
5315 (http://example.com<!-- hi -->)
5316 !! html/php
5317 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5318 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5319 </p>
5320 !! html/parsoid
5321 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5322
5323 <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>
5324 !! end
5325
5326 !! test
5327 Serialize <a> tags with invalid link targets as plain text
5328 !! options
5329 parsoid=html2wt
5330 !! html
5331 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5332 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5333 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5334 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5335 !! wikitext
5336 text
5337 <nowiki>*</nowiki>text
5338 <nowiki>[[foo]]</nowiki>
5339 <nowiki>*a [[foo]]</nowiki>
5340 !! end
5341
5342 !! test
5343 mw:ExtLink -vs- mw:WikiLink (T94723)
5344 !! options
5345 parsoid=html2wt
5346 !! html/parsoid
5347 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5348 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5349 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5350 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5351 <p>
5352 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5353 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5354 </p>
5355 !! wikitext
5356 [[Foo|Bar]]
5357 [[Foo|Bar]]
5358 [[wikipedia:Foo|Bar]]
5359 [[wikipedia:Foo|Bar]]
5360
5361 [[wikipedia:European_Robin|European Robin]]
5362 [[wikipedia:European_Robin|European Robin]]
5363 !! end
5364
5365 !! test
5366 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5367 !! options
5368 parsoid=wt2wt
5369 !! wikitext
5370 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5371 !! html/parsoid
5372 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5373 !! end
5374
5375
5376 ###
5377 ### Quotes
5378 ###
5379
5380 !! test
5381 Quotes
5382 !! wikitext
5383 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5384
5385 Normal text. '''''Bold italic text.''''' Normal text.
5386 !! html
5387 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5388 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5389 </p>
5390 !! end
5391
5392
5393 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5394 # parser strips. The wikitext contains just the first half of the bold
5395 # quote pair.
5396 !! test
5397 Unclosed and unmatched quotes
5398 !! wikitext
5399 '''''Bold italic text '''with bold deactivated''' in between.'''''
5400
5401 '''''Bold italic text ''with italic deactivated'' in between.'''''
5402
5403 '''Bold text..
5404
5405 ..spanning two paragraphs (should not work).'''
5406
5407 '''Bold tag left open
5408
5409 ''Italic tag left open
5410
5411 Normal text.
5412
5413 <!-- Unmatching number of opening, closing tags: -->
5414 '''This year''''s election ''should'' beat '''last year''''s.
5415
5416 ''Tom'''s car is bigger than ''Susan'''s.
5417
5418 Plain ''italic'''s plain
5419 !! html/php
5420 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5421 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5422 </p><p><b>Bold text..</b>
5423 </p><p>..spanning two paragraphs (should not work).
5424 </p><p><b>Bold tag left open</b>
5425 </p><p><i>Italic tag left open</i>
5426 </p><p>Normal text.
5427 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5428 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5429 </p><p>Plain <i>italic'</i>s plain
5430 </p>
5431 !! html/parsoid
5432 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5433 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5434 </p><p><b>Bold text..</b>
5435 </p><p>..spanning two paragraphs (should not work).<b></b>
5436 </p><p><b>Bold tag left open</b>
5437 </p><p><i>Italic tag left open</i>
5438 </p><p>Normal text.
5439 </p>
5440 <!-- Unmatching number of opening, closing tags: -->
5441 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5442 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5443 </p><p>Plain <i>italic'</i>s plain
5444 </p>
5445 !! end
5446
5447 ###
5448 ### Tables
5449 ###
5450 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5451 ###
5452
5453 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5454 # is the bare minimum required by the spec, see:
5455 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5456 # Parsoid team replies: empty table tags are legal in HTML5
5457 !! test
5458 A table with no data.
5459 !! options
5460 parsoid=wt2html
5461 !! wikitext
5462 {||}
5463 !! html/php
5464
5465 !! html/parsoid
5466 <table></table>
5467
5468 !! end
5469
5470 !! test
5471 A table with stray table end tags on start tag line (wt2html)
5472 !! options
5473 parsoid=wt2html
5474 !! wikitext
5475 {|style="color: red;"|}
5476
5477 {|style="color: red;" |}
5478 |foo
5479 |}
5480
5481 {|style="color: red;"|} id="foo"
5482 |foo
5483 |}
5484
5485 {|style="color: red;" |} id="foo"
5486 |foo
5487 |}
5488 !! html
5489 <table style="color: red;"></table>
5490
5491 <table style="color: red;">
5492 <tbody><tr>
5493 <td>foo</td>
5494 </tr></tbody>
5495 </table>
5496
5497 <table style="color: red;" id="foo">
5498 <tbody><tr>
5499 <td>foo</td>
5500 </tr></tbody>
5501 </table>
5502
5503 <table style="color: red;" id="foo">
5504 <tbody><tr>
5505 <td>foo</td>
5506 </tr></tbody>
5507 </table>
5508
5509 !! end
5510
5511 !! test
5512 A table with no data (take 2)
5513 !! wikitext
5514 {|
5515 |}
5516 !! html/parsoid
5517 <table></table>
5518 !! end
5519
5520 # A table with nothing but a caption is invalid XHTML, we might want to render
5521 # this as <p>caption</p>
5522 # Parsoid team replies: table with only a caption is legal in HTML5
5523 !! test
5524 A table with nothing but a caption
5525 !! wikitext
5526 {|
5527 |+ caption
5528 |}
5529 !! html/php
5530 <table>
5531 <caption> caption
5532 </caption><tr><td></td></tr></table>
5533
5534 !! html/parsoid
5535 <table><caption> caption</caption></table>
5536 !! end
5537
5538 !! test
5539 A table with caption with default-spaced attributes and a table row
5540 !! wikitext
5541 {|
5542 |+ style="color: red;" | caption1
5543 |-
5544 | foo
5545 |}
5546 !! html
5547 <table>
5548 <caption style="color: red;"> caption1
5549 </caption>
5550 <tr>
5551 <td> foo
5552 </td></tr></table>
5553
5554 !! end
5555
5556 !! test
5557 A table with captions with non-default spaced attributes and a table row
5558 !! wikitext
5559 {|
5560 |+style="color: red;"|caption2
5561 |+ style="color: red;"| caption3
5562 |-
5563 | foo
5564 |}
5565 !! html
5566 <table>
5567 <caption style="color: red;">caption2
5568 </caption>
5569 <caption style="color: red;"> caption3
5570 </caption>
5571 <tr>
5572 <td> foo
5573 </td></tr></table>
5574
5575 !! end
5576
5577 !! test
5578 Table td-cell syntax variations
5579 !! wikitext
5580 {|
5581 | foo bar foo | baz
5582 | foo bar foo || baz
5583 | style='color:red;' | baz
5584 | style='color:red;' || baz
5585 |}
5586 !! html
5587 <table>
5588 <tr>
5589 <td> baz
5590 </td>
5591 <td> foo bar foo </td>
5592 <td> baz
5593 </td>
5594 <td style="color:red;"> baz
5595 </td>
5596 <td> style='color:red;' </td>
5597 <td> baz
5598 </td></tr></table>
5599
5600 !! end
5601
5602 !! test
5603 Simple table
5604 !! wikitext
5605 {|
5606 | 1 || 2
5607 |-
5608 | 3 || 4
5609 |}
5610 !! html
5611 <table>
5612 <tr>
5613 <td> 1 </td>
5614 <td> 2
5615 </td></tr>
5616 <tr>
5617 <td> 3 </td>
5618 <td> 4
5619 </td></tr></table>
5620
5621 !! end
5622
5623 !! test
5624 Simple table but with multiple dashes for row wikitext
5625 !! wikitext
5626 {|
5627 | foo
5628 |-----
5629 | bar
5630 |}
5631 !! html
5632 <table>
5633 <tr>
5634 <td> foo
5635 </td></tr>
5636 <tr>
5637 <td> bar
5638 </td></tr></table>
5639
5640 !! end
5641
5642 !! test
5643 Multiplication table
5644 !! wikitext
5645 {| border="1" cellpadding="2"
5646 |+Multiplication table
5647 |-
5648 ! &times; !! 1 !! 2 !! 3
5649 |-
5650 ! 1
5651 | 1 || 2 || 3
5652 |-
5653 ! 2
5654 | 2 || 4 || 6
5655 |-
5656 ! 3
5657 | 3 || 6 || 9
5658 |-
5659 ! 4
5660 | 4 || 8 || 12
5661 |-
5662 ! 5
5663 | 5 || 10 || 15
5664 |}
5665 !! html
5666 <table border="1" cellpadding="2">
5667 <caption>Multiplication table
5668 </caption>
5669 <tr>
5670 <th> &#215; </th>
5671 <th> 1 </th>
5672 <th> 2 </th>
5673 <th> 3
5674 </th></tr>
5675 <tr>
5676 <th> 1
5677 </th>
5678 <td> 1 </td>
5679 <td> 2 </td>
5680 <td> 3
5681 </td></tr>
5682 <tr>
5683 <th> 2
5684 </th>
5685 <td> 2 </td>
5686 <td> 4 </td>
5687 <td> 6
5688 </td></tr>
5689 <tr>
5690 <th> 3
5691 </th>
5692 <td> 3 </td>
5693 <td> 6 </td>
5694 <td> 9
5695 </td></tr>
5696 <tr>
5697 <th> 4
5698 </th>
5699 <td> 4 </td>
5700 <td> 8 </td>
5701 <td> 12
5702 </td></tr>
5703 <tr>
5704 <th> 5
5705 </th>
5706 <td> 5 </td>
5707 <td> 10 </td>
5708 <td> 15
5709 </td></tr></table>
5710
5711 !! end
5712
5713 !! test
5714 Accept "||" in table headings
5715 !! wikitext
5716 {|
5717 !h1 || h2
5718 |}
5719 !! html
5720 <table>
5721 <tr>
5722 <th>h1 </th>
5723 <th> h2
5724 </th></tr></table>
5725
5726 !! end
5727
5728 !! test
5729 Accept "!!" in table data
5730 !! wikitext
5731 {|
5732 | Foo!! ||
5733 |}
5734 !! html
5735 <table>
5736 <tr>
5737 <td> Foo!! </td>
5738 <td>
5739 </td></tr></table>
5740
5741 !! html/parsoid
5742 <table>
5743 <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>
5744 </tbody></table>
5745 !! end
5746
5747 !! test
5748 Accept "||" in indented table headings
5749 !! wikitext
5750 :{|
5751 !h1 || h2
5752 |}
5753 !! html
5754 <dl><dd><table>
5755 <tr>
5756 <th>h1 </th>
5757 <th> h2
5758 </th></tr></table></dd></dl>
5759
5760 !! end
5761
5762 !! test
5763 Accept "!!" in templates
5764 !! wikitext
5765 {|
5766 !a {{echo|b!!c}}
5767 |}
5768 !! html/php
5769 <table>
5770 <tr>
5771 <th>a b</th>
5772 <th>c
5773 </th></tr></table>
5774
5775 !! html/parsoid
5776 <table>
5777 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' 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>
5778 !! end
5779
5780 !! test
5781 Accept "!!" in table headings after newline
5782 !! wikitext
5783 {|
5784 !a
5785 b!!c
5786 |}
5787 !! html/php
5788 <table>
5789 <tr>
5790 <th>a
5791 <p>b!!c
5792 </p>
5793 </th></tr></table>
5794
5795 !! html/parsoid
5796 <table>
5797 <tbody><tr><th>a
5798 <p>b!!c</p></th></tr>
5799 </tbody></table>
5800 !! end
5801
5802 !! test
5803 Accept "!!" in table data of mixed wikitext / html syntax
5804 !! wikitext
5805 {|
5806 !a
5807 <tr><td>b!!c</td></tr>
5808 |}
5809 !! html+tidy
5810 <table>
5811 <tr>
5812 <th>a</th>
5813 </tr>
5814 <tr>
5815 <td>b!!c</td>
5816 </tr>
5817 </table>
5818 !! html/parsoid
5819 <table>
5820 <tbody><tr><th>a</th></tr>
5821 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
5822 </tbody></table>
5823 !! end
5824
5825 !! test
5826 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5827 !! wikitext
5828 {|
5829 !| h1
5830 || a
5831 |}
5832 !! html
5833 <table>
5834 <tr>
5835 <th> h1
5836 </th>
5837 <td> a
5838 </td></tr></table>
5839
5840 !! end
5841
5842 !!test
5843 Accept "| !" at start of line in tables (ignore !-attribute)
5844 !! wikitext
5845 {|
5846 |-
5847 | !style="color:red" | bar
5848 |}
5849 !! html
5850 <table>
5851
5852 <tr>
5853 <td> bar
5854 </td></tr></table>
5855
5856 !!end
5857
5858 !!test
5859 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 +/-
5860 !! wikitext
5861 {|
5862 |-
5863 |style='color:red;'|+1
5864 |style='color:blue;'|-1
5865 |-
5866 | 1 || 2 || 3
5867 | 1 ||+2 ||-3
5868 |-
5869 | +1
5870 | -1
5871 |}
5872 !! html
5873 <table>
5874
5875 <tr>
5876 <td style="color:red;">+1
5877 </td>
5878 <td style="color:blue;">-1
5879 </td></tr>
5880 <tr>
5881 <td> 1 </td>
5882 <td> 2 </td>
5883 <td> 3
5884 </td>
5885 <td> 1 </td>
5886 <td>+2 </td>
5887 <td>-3
5888 </td></tr>
5889 <tr>
5890 <td> +1
5891 </td>
5892 <td> -1
5893 </td></tr></table>
5894
5895 !!end
5896
5897 !! test
5898 Table rowspan
5899 !! wikitext
5900 {| border=1
5901 | Cell 1, row 1
5902 |rowspan=2| Cell 2, row 1 (and 2)
5903 | Cell 3, row 1
5904 |-
5905 | Cell 1, row 2
5906 | Cell 3, row 2
5907 |}
5908 !! html
5909 <table border="1">
5910 <tr>
5911 <td> Cell 1, row 1
5912 </td>
5913 <td rowspan="2"> Cell 2, row 1 (and 2)
5914 </td>
5915 <td> Cell 3, row 1
5916 </td></tr>
5917 <tr>
5918 <td> Cell 1, row 2
5919 </td>
5920 <td> Cell 3, row 2
5921 </td></tr></table>
5922
5923 !! end
5924
5925 !! test
5926 Nested table
5927 !! wikitext
5928 {| border=1
5929 | &alpha;
5930 |
5931 {| bgcolor=#ABCDEF border=2
5932 |nested
5933 |-
5934 |table
5935 |}
5936 |the original table again
5937 |}
5938 !! html
5939 <table border="1">
5940 <tr>
5941 <td> &#945;
5942 </td>
5943 <td>
5944 <table bgcolor="#ABCDEF" border="2">
5945 <tr>
5946 <td>nested
5947 </td></tr>
5948 <tr>
5949 <td>table
5950 </td></tr></table>
5951 </td>
5952 <td>the original table again
5953 </td></tr></table>
5954
5955 !! end
5956
5957 !! test
5958 Invalid attributes in table cell (bug 1830)
5959 !! wikitext
5960 {|
5961 |Cell:|broken
5962 |}
5963 !! html
5964 <table>
5965 <tr>
5966 <td>broken
5967 </td></tr></table>
5968
5969 !! end
5970
5971 !! test
5972 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
5973 !! wikitext
5974 {|
5975 | title="foo" |bar
5976 | title="foo<nowiki>|</nowiki>" |bar
5977 | title="foo<nowiki>|</nowiki>" bar
5978 |}
5979 !! html
5980 <table>
5981 <tr>
5982 <td title="foo">bar
5983 </td>
5984 <td title="foo&#124;">bar
5985 </td>
5986 <td> title="foo|" bar
5987 </td></tr></table>
5988
5989 !! end
5990
5991 # The "|}" to close the table is missing from the input, so parsoid's
5992 # *2wt modes will fail.
5993 !! test
5994 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5995 !! options
5996 parsoid=wt2html,html2html
5997 !! wikitext
5998 {|
5999 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6000 !! html/php
6001 <table>
6002 <tr>
6003 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6004 <td>]" onmouseover="alert(document.cookie)"&gt;test
6005 </td>
6006 </tr>
6007 </table>
6008
6009 !! html/parsoid
6010 <table><tbody>
6011 <tr>
6012 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6013 !! end
6014
6015 # FIXME: The php output is broken.
6016 !! test
6017 ! and || in td attributes should not be parsed as <th>/<td>
6018 !! wikitext
6019 {|
6020 | style="color: red !important;" data-contrived="put this here ||" | foo
6021 |}
6022 !! html/php
6023 <table>
6024 <tr>
6025 <td> style="color: red !important;" data-contrived="put this here </td>
6026 <td> foo
6027 </td></tr></table>
6028
6029 !! html/parsoid
6030 <table>
6031 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6032 </tbody></table>
6033 !! end
6034
6035 !! test
6036 Indented table markup mixed with indented pre content (proposed in bug 6200)
6037 !! wikitext
6038 <table>
6039 <tr>
6040 <td>
6041 Text that should be rendered preformatted
6042 </td>
6043 </tr>
6044 </table>
6045 !! html
6046 <table>
6047 <tr>
6048 <td>
6049 <pre>Text that should be rendered preformatted
6050 </pre>
6051 </td>
6052 </tr>
6053 </table>
6054
6055 !! end
6056
6057 !! test
6058 1. Template-generated table cell attributes and cell content
6059 !! wikitext
6060 {|
6061 |{{table_attribs}}
6062 | {{table_attribs}}
6063 || {{table_attribs_5}}
6064 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6065 |align=center {{table_attribs}}
6066 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6067 |}
6068 !! html
6069 <table>
6070 <tr>
6071 <td style="color:red;">Foo
6072 </td>
6073 <td style="color:red;">Foo
6074 </td>
6075 <td> style="color:red;"</td>
6076 <td>Bar
6077 </td>
6078 <td style="color:red;">Foo
6079 </td>
6080 <td align="center" style="color:red;">Foo
6081 </td>
6082 <td align="center" style="color:red;">Foo
6083 </td></tr></table>
6084
6085 !! end
6086
6087 !! test
6088 2. Template-generated table cell attributes and cell content
6089 !! wikitext
6090 {|
6091 |{{table_attribs_2}}
6092 |}
6093 !! html/php
6094 <table>
6095 <tr>
6096 <td style="color:red;">Foo
6097 </td>
6098 <td>Bar</td>
6099 <td>Baz
6100 </td></tr></table>
6101
6102 !! html/parsoid
6103 <table>
6104 <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>
6105 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6106 </tbody></table>
6107 !! end
6108
6109 !! test
6110 3. Template-generated table cell attributes and cell content
6111 !! wikitext
6112 {|
6113 !align=center {{table_header_cells}}
6114 |-
6115 |align=center {{table_cells}}
6116 |}
6117 !! html/php
6118 <table>
6119 <tr>
6120 <th align="center" style="color:red;">Foo</th>
6121 <th style="color:red;"><i>Bar</i></th>
6122 <th style="color:brown;"><i>Foo</i> and Baz
6123 </th></tr>
6124 <tr>
6125 <td align="center" style="color:red;">Foo</td>
6126 <td style="color:red;"><i>Bar</i></td>
6127 <td style="color:brown;"><i>Foo</i> and Baz
6128 </td></tr></table>
6129
6130 !! html/parsoid
6131 <table>
6132 <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>
6133 <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>
6134 </tbody></table>
6135 !! end
6136
6137 !! test
6138 4. Template-generated table cell attributes and cell content inside a templated table
6139 !! wikitext
6140 {{tbl-start}}
6141 !align=center {{table_header_cells}}
6142 |-
6143 |align=center {{table_cells}}
6144 {{tbl-end}}
6145 !! html/php
6146 <table>
6147 <tr>
6148 <th align="center" style="color:red;">Foo</th>
6149 <th style="color:red;"><i>Bar</i></th>
6150 <th style="color:brown;"><i>Foo</i> and Baz
6151 </th></tr>
6152 <tr>
6153 <td align="center" style="color:red;">Foo</td>
6154 <td style="color:red;"><i>Bar</i></td>
6155 <td style="color:brown;"><i>Foo</i> and Baz
6156 </td></tr></table>
6157
6158 !! html/parsoid
6159 <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}}]}'>
6160 <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>
6161 <tr>
6162 <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>
6163 </tbody></table>
6164 !! end
6165
6166 !! test
6167 Table with row followed by newlines and table heading
6168 !! wikitext
6169 {|
6170 |-
6171
6172 ! foo
6173 |}
6174 !! html
6175 <table>
6176
6177
6178 <tr>
6179 <th> foo
6180 </th></tr></table>
6181
6182 !! end
6183
6184 !! test
6185 Table with empty line following the start tag
6186 !! wikitext
6187 {|
6188
6189 |-
6190 | foo
6191 |}
6192 !! html
6193 <table>
6194
6195
6196 <tr>
6197 <td> foo
6198 </td></tr></table>
6199
6200 !! end
6201
6202 # FIXME: Preserve the attribute properly (with an empty string as value) in
6203 # the PHP parser. Parsoid implements the behavior below.
6204 !! test
6205 Table attributes with empty value
6206 !! wikitext
6207 {|
6208 | style=| hello
6209 |}
6210 !! html/parsoid
6211 <table>
6212 <tbody>
6213 <tr>
6214 <td style=""> hello
6215 </td></tr></tbody></table>
6216
6217 !! end
6218
6219 !! test
6220 Wikitext table with a lot of comments
6221 !! wikitext
6222 {|
6223 <!-- c0 -->
6224 | foo
6225 <!-- c1 -->
6226 |-<!-- c2 -->
6227 <!-- c3 -->
6228 |<!-- c4 -->
6229 <!-- c5 -->
6230 |}
6231 !! html
6232 <table>
6233 <tr>
6234 <td> foo
6235 </td></tr>
6236 <tr>
6237 <td>
6238 </td></tr></table>
6239
6240 !! end
6241
6242 !! test
6243 Wikitext table comments represented in parsoid dom
6244 !! wikitext
6245 {|<!--c1--><!--c2-->
6246 |-<!--c3-->
6247 | x
6248 |}
6249 !! html/php+tidy
6250 <table>
6251 <tr>
6252 <td>x</td>
6253 </tr>
6254 </table>
6255 !! html/parsoid
6256 <table><!--c1--><!--c2-->
6257 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6258 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6259 </tbody></table>
6260 !! end
6261
6262 !! test
6263 Wikitext table with double-line table cell
6264 !! wikitext
6265 {|
6266 |a
6267 b
6268 |}
6269 !! html
6270 <table>
6271 <tr>
6272 <td>a
6273 <p>b
6274 </p>
6275 </td></tr></table>
6276
6277 !! end
6278
6279 !! test
6280 Table cell with a single comment
6281 !! wikitext
6282 {|
6283 | <!-- c1 -->
6284 | a
6285 |}
6286 !! html
6287 <table>
6288 <tr>
6289 <td>
6290 </td>
6291 <td> a
6292 </td></tr></table>
6293
6294 !! end
6295
6296 !! test
6297 Table-cell after a comment-only-empty-line
6298 !! wikitext
6299 {|
6300 |a
6301 <!--c1-->
6302 <!--c2-->| b
6303 |}
6304 !! html
6305 <table>
6306 <tr>
6307 <td>a
6308 </td>
6309 <td> b
6310 </td></tr></table>
6311
6312 !! html/parsoid
6313 <table>
6314 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6315 <!--c1-->
6316 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6317 </tbody></table>
6318
6319 !! end
6320
6321 !! test
6322 Build table with {{!}}
6323 !! wikitext
6324 {{{!}} class="wikitable"
6325 ! header
6326 ! second header
6327 {{!}}- style="color:red;"
6328 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6329 {{!}}}
6330 !! html
6331 <table class="wikitable">
6332 <tr>
6333 <th> header
6334 </th>
6335 <th> second header
6336 </th></tr>
6337 <tr style="color:red;">
6338 <td> data </td>
6339 <td style="color:red;"> second data
6340 </td></tr></table>
6341
6342 !! end
6343
6344 !! test
6345 Build table with pipe as data
6346 !! wikitext
6347 {| class="wikitable"
6348 ! header
6349 ! second header
6350 |- style="color:red;"
6351 | data || style="color:red;" | second data
6352 |-
6353 | style="color:red;" | data with | || style="color:red;" | second data with |
6354 |-
6355 || data with | ||| second data with |
6356 |}
6357 !! html
6358 <table class="wikitable">
6359 <tr>
6360 <th> header
6361 </th>
6362 <th> second header
6363 </th></tr>
6364 <tr style="color:red;">
6365 <td> data </td>
6366 <td style="color:red;"> second data
6367 </td></tr>
6368 <tr>
6369 <td style="color:red;"> data with | </td>
6370 <td style="color:red;"> second data with |
6371 </td></tr>
6372 <tr>
6373 <td> data with | </td>
6374 <td> second data with |
6375 </td></tr></table>
6376
6377 !! end
6378
6379 !! test
6380 Build table with wikilink
6381 !! wikitext
6382 {| class="wikitable"
6383 ! header || second header
6384 |- style="color:red;"
6385 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6386 |-
6387 | data || second data [[Main Page|link|text with pipe]]
6388 |}
6389 !! html
6390 <table class="wikitable">
6391 <tr>
6392 <th> header </th>
6393 <th> second header
6394 </th></tr>
6395 <tr style="color:red;">
6396 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6397 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6398 </td></tr>
6399 <tr>
6400 <td> data </td>
6401 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6402 </td></tr></table>
6403
6404 !! end
6405
6406 # The expected HTML structure in this test is debatable. The PHP parser does
6407 # not parse this kind of table at all. The main focus for Parsoid is on
6408 # round-tripping, so this output is ok for now. TODO: revisit!
6409 !! test
6410 Wikitext table with html-syntax row
6411 !! wikitext
6412 {|
6413 |-
6414 <td>foo</td>
6415 |}
6416 !! html/parsoid
6417 <table>
6418 <tbody>
6419 <tr>
6420 <td>foo</td></tr></tbody></table>
6421 !! end
6422
6423 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6424 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6425 ## PHP parser, which tidy then compounds by fostering the content
6426 ## entirely out of the table. Parsoid recognizes the table context
6427 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6428 ## depends on PHP's treatment of broken table markup!
6429 !! test
6430 Implicit <td> after a |-
6431 !! options
6432 parsoid=wt2html,html2html
6433 !! wikitext
6434 {|
6435 |-
6436 a
6437 |}
6438 !! html/php
6439 <table>
6440
6441 a
6442 </table>
6443
6444 !! html/php+tidy
6445 <p>a</p>
6446 !! html/parsoid
6447 <table>
6448 <tr><td>a</td></tr>
6449 </table>
6450 !! end
6451
6452 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6453 !! test
6454 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6455 !! options
6456 parsoid=wt2html,html2html
6457 !! wikitext
6458 {|
6459 |-
6460 |
6461 a
6462 |-
6463 b
6464 |}
6465 !! html/php
6466 <table>
6467
6468 <tr>
6469 <td>
6470 <pre>a
6471 </pre>
6472 </td></tr>
6473 b
6474 </table>
6475
6476 !! html/php+tidy
6477 <p>b</p>
6478 <table>
6479 <tr>
6480 <td>
6481 <pre>
6482 a
6483 </pre></td>
6484 </tr>
6485 </table>
6486 !! html/parsoid
6487 <table>
6488 <tbody>
6489 <tr><td><pre>a</pre></td></tr>
6490 <tr><td> b</td></tr>
6491 </tbody>
6492 </table>
6493 !! end
6494
6495 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6496 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6497 !! test
6498 Lists should be recognized in an implicit <td> context
6499 !! options
6500 parsoid=wt2html,html2html
6501 !! wikitext
6502 {|
6503 |-
6504 *a
6505 |}
6506 !! html/php
6507 <table>
6508
6509 <ul><li>a</li></ul>
6510 </table>
6511
6512 !! html/php+tidy
6513 <ul>
6514 <li>a</li>
6515 </ul>
6516 !! html/parsoid
6517 <table>
6518 <tr>
6519 <td><ul>
6520 <li>a</li>
6521 </ul></td>
6522 </tr>
6523 </table>
6524 !! end
6525
6526 !! test
6527 Table cells not properly parsed in an implicit-td context
6528 !! wikitext
6529 {|
6530 |-
6531 {{table_attribs_4}} || a || b
6532 |}
6533 !! html/php+tidy
6534 <table>
6535 <tr>
6536 <td style="background-color:#DC241f;" width="10px"></td>
6537 <td>a</td>
6538 <td>b</td>
6539 </tr>
6540 </table>
6541 !! html/parsoid
6542 <table>
6543 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6544 <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>
6545 </tbody></table>
6546 !! end
6547
6548 !! test
6549 Parsoid: Round-trip tables directly followed by content (bug 51219)
6550 !! options
6551 parsoid=wt2html,wt2wt
6552 !! wikitext
6553 {|
6554 |foo
6555 |} bar
6556
6557 {|
6558 |baz
6559 |}<b>quux</b>
6560 !! html+tidy
6561 <table>
6562 <tr>
6563 <td>foo</td>
6564 </tr>
6565 </table>
6566 <p>bar</p>
6567 <table>
6568 <tr>
6569 <td>baz</td>
6570 </tr>
6571 </table>
6572 <p><b>quux</b></p>
6573 !! end
6574
6575 !! test
6576 Parsoid: Default to a newline after tables in new content (bug 51219)
6577 !! options
6578 parsoid=html2wt
6579 !! html
6580 <table><tbody>
6581 <tr><td>foo</td></tr></tbody></table> bar
6582 <table><tbody>
6583 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6584 !! wikitext
6585 {|
6586 |foo
6587 |}
6588 <nowiki> </nowiki>bar
6589 {|
6590 |baz
6591 |}
6592 '''quux'''
6593 !! end
6594
6595 !! test
6596 Parsoid: newline inducing block nodes don't suppress <nowiki>
6597 !! options
6598 parsoid=html2wt
6599 !! html
6600 a<h1>foo</h1>
6601 !! wikitext
6602 <nowiki> </nowiki>a
6603
6604 = foo =
6605 !! end
6606
6607 !! test
6608 Parsoid: Row-syntax table headings followed by comment & table cells
6609 !! options
6610 parsoid=wt2html,wt2wt
6611 !! wikitext
6612 {|
6613 ! foo || bar
6614 <!-- foo --> || baz || quux
6615 |}
6616 !! html/php
6617 <table>
6618 <tr>
6619 <th> foo </th>
6620 <th> bar
6621 </th>
6622 <td> baz </td>
6623 <td> quux
6624 </td></tr></table>
6625
6626 !! html/parsoid
6627 <table>
6628 <tbody><tr><th> foo </th><th> bar
6629 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6630 </tbody></table>
6631 !! end
6632
6633
6634 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6635 # preserves it.
6636 !!test
6637 Parsoid: Recover better from broken table attributes
6638 !!options
6639 parsoid=wt2html
6640 !!wikitext
6641 {| class="foo
6642 | class="bar" |
6643 foo
6644 |}
6645 !!html/php+tidy
6646 <table>
6647 <tr>
6648 <td class="bar">
6649 <p>foo</p>
6650 </td>
6651 </tr>
6652 </table>
6653 !!html/parsoid
6654 <table class="foo">
6655 <tr>
6656 <td class="bar">
6657 <p>foo</p></td></tr>
6658 </tbody></table>
6659 !!end
6660
6661 !! test
6662 Strip unsupported table tags
6663 !! options
6664 parsoid=html2wt
6665 !! html
6666 <table>
6667 <thead>
6668 <tr>
6669 <th>Month</th>
6670 <th>Savings</th>
6671 </tr>
6672 </thead>
6673 <tbody>
6674 <tr>
6675 <td>January</td>
6676 <td>$100</td>
6677 </tr>
6678 <tr>
6679 <td>February</td>
6680 <td>$80</td>
6681 </tr>
6682 </tbody>
6683 <tfoot>
6684 <tr>
6685 <td>Sum</td>
6686 <td>$180</td>
6687 </tr>
6688 </tfoot>
6689 </table>
6690 !! wikitext
6691 {|
6692
6693 !Month
6694 !Savings
6695
6696 |January
6697 |$100
6698
6699 |-
6700 |February
6701 |$80
6702
6703 |Sum
6704 |$180
6705
6706 |}
6707 !! end
6708
6709 !!test
6710 Testing serialization after deletion of table cells
6711 !!options
6712 parsoid={
6713 "modes": ["wt2wt", "selser"],
6714 "changes": [
6715 ["#x", "remove"]
6716 ]
6717 }
6718 !!wikitext
6719 {|
6720 !h1 !!h2 !!h3
6721 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6722 |}
6723 !! wikitext/edited
6724 {|
6725 !h1 !!h2 !!h3
6726 |c2 |||c3
6727 |}
6728 !!end
6729
6730 ###
6731 ### Internal links
6732 ###
6733 !! test
6734 Plain link, capitalized
6735 !! wikitext
6736 [[Main Page]]
6737 !! html
6738 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6739 </p>
6740 !! end
6741
6742 !! test
6743 Plain link, uncapitalized
6744 !! wikitext
6745 [[main Page]]
6746 !! html
6747 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6748 </p>
6749 !! end
6750
6751 !! test
6752 Piped link
6753 !! wikitext
6754 [[Main Page|The Main Page]]
6755 !! html
6756 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6757 </p>
6758 !! end
6759
6760 !! test
6761 Piped link with comment in link text
6762 !! wikitext
6763 [[Main Page|The Main<!--front--> Page]]
6764 !! html
6765 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6766 </p>
6767 !! end
6768
6769 !! test
6770 Piped link with multiple pipe characters in link text
6771 !! wikitext
6772 [[Main Page||The|Main|Page|]]
6773 !! html/php
6774 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6775 </p>
6776 !! html/parsoid
6777 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6778 !! end
6779
6780 !! test
6781 Broken link
6782 !! wikitext
6783 [[Zigzagzogzagzig]]
6784 !! html
6785 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6786 </p>
6787 !! end
6788
6789 !! test
6790 Broken link with fragment
6791 !! wikitext
6792 [[Zigzagzogzagzig#zug]]
6793 !! html
6794 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6795 </p>
6796 !! end
6797
6798 !! test
6799 Special page link with fragment
6800 !! wikitext
6801 [[Special:Version#anchor]]
6802 !! html
6803 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6804 </p>
6805 !! end
6806
6807 !! test
6808 Nonexistent special page link with fragment
6809 !! wikitext
6810 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6811 !! html
6812 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6813 </p>
6814 !! end
6815
6816 !! test
6817 Link with prefix
6818 !! wikitext
6819 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6820 !! html
6821 <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>
6822 </p>
6823 !! end
6824
6825 !! test
6826 Link with suffix
6827 !! wikitext
6828 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6829 !! html
6830 <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>!!!
6831 </p>
6832 !! end
6833
6834 !! article
6835 prefixed article
6836 !! text
6837 Some text
6838 !! endarticle
6839
6840 !! test
6841 Bug 43661: Piped links with identical prefixes
6842 !! wikitext
6843 [[prefixed article|prefixed articles with spaces]]
6844
6845 [[prefixed article|prefixed articlesaoeu]]
6846
6847 [[Main Page|Main Page test]]
6848 !! html
6849 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6850 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6851 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6852 </p>
6853 !! end
6854
6855
6856 !! test
6857 Link with HTML entity in suffix / tail
6858 !! wikitext
6859 [[Main Page]]&quot;, [[Main Page]]&#97;
6860 !! html/php
6861 <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;
6862 </p>
6863 !! html/parsoid
6864 <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>
6865 !! end
6866
6867 !! test
6868 Link with 3 brackets
6869 !! wikitext
6870 [[[Main Page]]]
6871 !! html
6872 <p>[[[Main Page]]]
6873 </p>
6874 !! end
6875
6876 !! test
6877 Link with 4 brackets
6878 !! wikitext
6879 [[[[Main Page]]]]
6880 !! html
6881 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6882 </p>
6883 !! end
6884
6885 !! test
6886 Piped link with 3 brackets
6887 !! wikitext
6888 [[[main page|the main page]]]
6889 !! html
6890 <p>[[[main page|the main page]]]
6891 </p>
6892 !! end
6893
6894 !! test
6895 Piped link with extlink-like text
6896 !! wikitext
6897 [[Main Page|[bar]]]
6898 [[Main Page|This is a [bar]]]
6899 !! html/php
6900 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6901 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6902 </p>
6903 !! html/parsoid
6904 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6905 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6906 !! end
6907
6908 !! test
6909 Link with multiple pipes
6910 !! wikitext
6911 [[Main Page|The|Main|Page]]
6912 !! html
6913 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6914 </p>
6915 !! end
6916
6917 # Note that parsoid does not munge anchor text; all non-space
6918 # characters are valid in HTML5 ids.
6919 !! test
6920 Anchor containing a #. (bug 63430)
6921 !! wikitext
6922 [[Main Page#And#Link]]
6923 !! html/php
6924 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6925 </p>
6926 !! html/parsoid
6927 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6928 !! end
6929
6930 !! test
6931 Link to namespaces
6932 !! wikitext
6933 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6934 !! html
6935 <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>
6936 </p>
6937 !! end
6938
6939 !! test
6940 Link with space in namespace
6941 !! wikitext
6942 [[User talk:Foo bar]]
6943 !! html
6944 <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>
6945 </p>
6946 !! end
6947
6948 !! article
6949 MemoryAlpha:AlphaTest
6950 !! text
6951 This is an article in the MemoryAlpha namespace
6952 (which shadows the memoryalpha interwiki link).
6953 !! endarticle
6954
6955 !! test
6956 Namespace takes precedence over interwiki link (bug 51680)
6957 !! wikitext
6958 [[MemoryAlpha:AlphaTest]]
6959 !! html
6960 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6961 </p>
6962 !! end
6963
6964 # The previous test doesn't work correctly in html2*, due to not recognizing the
6965 # link as an internal one. This one checks for the correct behavior.
6966 !! test
6967 Link to namespace preferred over interwiki with correct rel attribute
6968 !! options
6969 parsoid=html2wt,html2html
6970 !! html
6971 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6972 !! wikitext
6973 [[MemoryAlpha:AlphaTest]]
6974 !! end
6975
6976 !! test
6977 Piped link to namespace
6978 !! wikitext
6979 [[Meta:Disclaimers|The disclaimers]]
6980 !! html
6981 <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>
6982 </p>
6983 !! end
6984
6985 !! test
6986 Link containing }
6987 !! wikitext
6988 [[Usually caused by a typo (oops}]]
6989 !! html
6990 <p>[[Usually caused by a typo (oops}]]
6991 </p>
6992 !! end
6993
6994 !! article
6995 7% Solution
6996 !! text
6997 Just a test of an article title containing a percent.
6998 !! endarticle
6999
7000 !! test
7001 Link containing % (not as a hex sequence)
7002 !! wikitext
7003 [[7% Solution]]
7004 !! html/php
7005 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7006 </p>
7007 !! html/parsoid
7008 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7009 !! end
7010
7011 # note that the parsoid HTML is identical to the previous test output,
7012 # so the previous test ensures that the html2wt mode will generate the
7013 # "not as a hex sequence" wikitext.
7014 !! test
7015 Link containing % as a single hex sequence interpreted to char
7016 !! options
7017 parsoid=wt2wt,wt2html,html2html
7018 !! wikitext
7019 [[7%25 Solution]]
7020 !! html/php
7021 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7022 </p>
7023 !! html/parsoid
7024 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7025 !!end
7026
7027 !! test
7028 Link containing % as a double hex sequence interpreted to hex sequence
7029 !! wikitext
7030 [[7%2525 Solution]]
7031 !! html
7032 <p>[[7%2525 Solution]]
7033 </p>
7034 !!end
7035
7036 # note that parsoid does not munge anchor text; all non-space
7037 # characters are valid in HTML5 anchors.
7038 !! test
7039 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7040 Example for such a section: == < ==
7041 !! wikitext
7042 [[%23%3c]][[%23%3e]]
7043 !! html/php
7044 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7045 </p>
7046 !! html/parsoid
7047 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7048 !! end
7049
7050 !! test
7051 Link containing "<#" and ">#" as a hex sequences
7052 !! wikitext
7053 [[%3c%23]][[%3e%23]]
7054 !! html
7055 <p>[[%3c%23]][[%3e%23]]
7056 </p>
7057 !! end
7058
7059 !! test
7060 Link containing an equals sign
7061 !! wikitext
7062 [[Special:BookSources/isbn=4-00-026157-6]]
7063 !! html/php
7064 <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>
7065 </p>
7066 !! html/parsoid
7067 <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>
7068 !! end
7069
7070 !! article
7071 Foo~bar
7072 !! text
7073 Just a test of an article title containing a tilde.
7074 !! endarticle
7075
7076 # note that links containing signatures, like [[Foo~~~~]], are
7077 # massaged by the pre-save transform (PST) and so the tildes are never
7078 # seen by the parser.
7079 !! test
7080 Link containing a tilde
7081 !! wikitext
7082 [[Foo~bar]]
7083 !! html/php
7084 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7085 </p>
7086 !! html/parsoid
7087 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7088 !! end
7089
7090 !! test
7091 Link containing double-single-quotes '' (bug 4598)
7092 !! wikitext
7093 [[Lista d''e paise d''o munno]]
7094 !! html/php
7095 <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>
7096 </p>
7097 !! html/parsoid
7098 <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>
7099 !! end
7100
7101 !! test
7102 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7103 !! wikitext
7104 Some [[Link|pretty ''italics'' and stuff]]!
7105 !! html/php
7106 <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>!
7107 </p>
7108 !! html/parsoid
7109 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7110 !! end
7111
7112 !! test
7113 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7114 !! wikitext
7115 ''Some [[Link|pretty ''italics'' and stuff]]!''
7116 !! html
7117 <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>
7118 </p>
7119 !! end
7120
7121 !! test
7122 Link with double quotes in title part (literal) and alternate part (interpreted)
7123 !! wikitext
7124 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7125
7126 [[''Pentecoste'']]
7127
7128 [[''Pentecoste''|Pentecoste]]
7129
7130 [[''Pentecoste''|''Pentecoste'']]
7131 !! html/php
7132 <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>
7133 </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>
7134 </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>
7135 </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>
7136 </p>
7137 !! html/parsoid
7138 <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>
7139 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7140 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7141 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7142 !! end
7143
7144 !! test
7145 Broken image links with HTML captions (bug 39700)
7146 !! wikitext
7147 [[File:Nonexistent|<script></script>]]
7148 [[File:Nonexistent|100x100px|<script></script>]]
7149 [[File:Nonexistent|&lt;]]
7150 [[File:Nonexistent|a<i>b</i>c]]
7151 !! html/php
7152 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7153 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7154 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7155 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7156 </p>
7157 !! html/parsoid
7158 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7159 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&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"/></a></span>
7160 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7161 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7162 !! end
7163
7164 !! test
7165 Plain link to URL
7166 !! wikitext
7167 [[http://www.example.com]]
7168 !! html/php
7169 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7170 </p>
7171 !! html/parsoid
7172 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7173 !! end
7174
7175 !! test
7176 Plain link to URL with link text
7177 !! wikitext
7178 [[http://www.example.com Link text]]
7179 !! html
7180 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7181 </p>
7182 !! end
7183
7184 !! test
7185 Plain link to protocol-relative URL
7186 !! wikitext
7187 [[//www.example.com]]
7188 !! html/php
7189 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7190 </p>
7191 !! html/parsoid
7192 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7193 !! end
7194
7195 !! test
7196 Plain link to protocol-relative URL with link text
7197 !! wikitext
7198 [[//www.example.com Link text]]
7199 !! html
7200 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7201 </p>
7202 !! end
7203
7204 !! test
7205 Plain link to page with question mark in title
7206 !! wikitext
7207 [[A?b]]
7208
7209 [[A?b|Baz]]
7210 !! html
7211 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7212 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7213 </p>
7214 !! end
7215
7216
7217 # I'm fairly sure the expected result here is wrong.
7218 # We want these to be URL links, not pseudo-pages with URLs for titles....
7219 # However the current output is also pretty screwy.
7220 #
7221 # ----
7222 # I'm changing it to match the current output--it arguably makes more
7223 # sense in the light of the test above. Old expected result was:
7224 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7225 #</p>
7226 # But I think this test is bordering on "garbage in, garbage out" anyway.
7227 # -- wtm
7228 !! test
7229 Piped link to URL
7230 !! wikitext
7231 Piped link to URL: [[http://www.example.com|an example URL]]
7232 !! html/php
7233 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7234 </p>
7235 !! html/parsoid
7236 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7237 !! end
7238
7239 !! test
7240 BUG 2: [[page|http://url/]] should link to page, not http://url/
7241 !! wikitext
7242 [[Main Page|http://url/]]
7243 !! html/php
7244 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7245 </p>
7246 !! html/parsoid
7247 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7248 !! end
7249
7250 # Parsoid does not mark self-links, by design.
7251 !! test
7252 BUG 337: Escaped self-links should be bold
7253 !! options
7254 title=[[Bug462]]
7255 !! wikitext
7256 [[Bu&#103;462]] [[Bug462]]
7257 !! html/php
7258 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7259 </p>
7260 !! html/php+tidy
7261 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7262 !! html/parsoid
7263 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7264 !! end
7265
7266 !! test
7267 Self-link to section should not be bold
7268 !! options
7269 title=[[Main Page]]
7270 !! wikitext
7271 [[Main Page#section]]
7272 !! html
7273 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7274 </p>
7275 !! end
7276
7277 !! article
7278 00
7279 !! text
7280 This is 00.
7281 !! endarticle
7282
7283 !!test
7284 Self-link to numeric title
7285 !!options
7286 title=[[0]]
7287 !! wikitext
7288 [[0]]
7289 !! html
7290 <p><strong class="selflink">0</strong>
7291 </p>
7292 !!end
7293
7294 !!test
7295 Link to numeric-equivalent title
7296 !!options
7297 title=[[0]]
7298 !! wikitext
7299 [[00]]
7300 !! html
7301 <p><a href="/wiki/00" title="00">00</a>
7302 </p>
7303 !!end
7304
7305 !! test
7306 <nowiki> inside a link
7307 !! wikitext
7308 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7309 !! html
7310 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7311 </p>
7312 !! end
7313
7314 !! test
7315 Non-breaking spaces in title
7316 !! wikitext
7317 [[&nbsp; Main &nbsp; Page &nbsp;]]
7318 !! html
7319 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7320 </p>
7321 !!end
7322
7323 !! test
7324 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7325 !! options
7326 language=ca
7327 !! wikitext
7328 '''[[Main Page]]'''
7329 !! html
7330 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7331 </p>
7332 !! end
7333
7334 !! test
7335 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7336 !! options
7337 language=ca
7338 !! wikitext
7339 ''[[Main Page]]''
7340 !! html
7341 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7342 </p>
7343 !! end
7344
7345 !! test
7346 Internal link with en linktrail: no apostrophes (bug 27473)
7347 !! options
7348 language=en
7349 !! wikitext
7350 [[Something]]'nice
7351 !! html
7352 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7353 </p>
7354 !! end
7355
7356 !! test
7357 Internal link with ca linktrail with apostrophes (bug 27473)
7358 !! options
7359 language=ca
7360 !! wikitext
7361 [[Something]]'nice
7362 !! html
7363 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7364 </p>
7365 !! end
7366
7367 !! test
7368 Internal link with kaa linktrail with apostrophes (bug 27473)
7369 !! options
7370 language=kaa
7371 !! wikitext
7372 [[Something]]'nice
7373 !! html
7374 <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>
7375 </p>
7376 !! end
7377
7378 !! test
7379 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7380 !! wikitext
7381 [[User:Foo/Test/63636:Bar|Test]]
7382 !! html/php
7383 <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>
7384 </p>
7385 !! html/parsoid
7386 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7387 !! end
7388
7389 !! test
7390 Purely hash wikilink
7391 !! options
7392 title=[[User:test/123]]
7393 !! wikitext
7394 [[#a|b]]
7395 !! html/php
7396 <p><a href="#a">b</a>
7397 </p>
7398 !! html/parsoid
7399 <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>
7400 !! end
7401
7402 !! test
7403 1. Interaction of linktrail and template encapsulation
7404 !! options
7405 parsoid
7406 !! wikitext
7407 {{echo|[[Foo]]}}l
7408 !! html
7409 <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>
7410 !! end
7411
7412 !! test
7413 2. Interaction of linktrail and template encapsulation
7414 !! options
7415 parsoid
7416 !! wikitext
7417 {{echo|Some [[Fool]]}}s
7418 !! html
7419 <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","spc":["","","",""]}]]}'>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>
7420 !! end
7421
7422 !! test
7423 3. Interaction of linktrail and template encapsulation
7424 !! options
7425 parsoid
7426 !! wikitext
7427 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7428 !! html
7429 <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","spc":["","","",""]}]]}'>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>
7430 !! end
7431
7432 !! article
7433 Söfnuður
7434 !! text
7435 Test.
7436 !! endarticle
7437
7438 !! test
7439 Internal link with is link prefix
7440 !! options
7441 language=is
7442 !! wikitext
7443 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7444 !! html
7445 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7446 </p>
7447 !! end
7448
7449 !! article
7450 Mótmælendatrú
7451 !! text
7452 Test.
7453 !! endarticle
7454
7455 !! test
7456 Internal link with is link trail and link prefix
7457 !! options
7458 language=is
7459 !! wikitext
7460 [[mótmælendatrú|xxx]]ar
7461 [[mótmælendatrú]]ar
7462 mótmælenda[[söfnuður]]
7463 mótmælenda[[söfnuður|söfnuðir]]
7464 mótmælenda[[söfnuður|söfnuðir]]xxx
7465 !! html
7466 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7467 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7468 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7469 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7470 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7471 </p>
7472 !! end
7473
7474 !! test
7475 Parsoid link trail escaping
7476 !! options
7477 parsoid=html2wt,html2html
7478 !! html
7479 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7480 !! wikitext
7481 [[apple]]<nowiki/>s
7482 !! end
7483
7484 !! test
7485 Parsoid link prefix escaping
7486 !! options
7487 language=is
7488 parsoid=html2wt,html2html
7489 !! html
7490 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7491 !! wikitext
7492 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7493 !! end
7494
7495 !! test
7496 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7497 !! wikitext
7498 [[Foo| bar]]
7499
7500 [[Foo| ''bar'']]
7501
7502 [http://wp.org foo]
7503
7504 [http://wp.org ''foo'']
7505 !! html
7506 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7507 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7508 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7509 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7510 </p>
7511 !! end
7512
7513 !! test
7514 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7515 !! options
7516 parsoid
7517 !! wikitext
7518 [[Foo|{{echo|a}} b {{echo|c}}]]
7519 !! html
7520 <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>
7521 !! end
7522
7523 !! test
7524 Link with angle bracket after anchor
7525 !! wikitext
7526 [[Foo#<bar>]]
7527 !! html/php
7528 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7529 </p>
7530 !! html/parsoid
7531 <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>
7532 !! end
7533
7534 ###
7535 ### Interwiki links (see maintenance/interwiki.sql)
7536 ###
7537
7538 !! test
7539 Inline interwiki link
7540 !! options
7541 parsoid=wt2html,wt2wt,html2html
7542 !! wikitext
7543 [[MeatBall:SoftSecurity]]
7544 !! html/php
7545 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7546 </p>
7547 !! html/parsoid
7548 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7549 !! end
7550
7551 !! test
7552 Inline interwiki link with empty title (bug 2372)
7553 !! options
7554 parsoid=wt2html,wt2wt,html2html
7555 !! wikitext
7556 [[MeatBall:]]
7557 !! html/php
7558 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7559 </p>
7560 !! html/parsoid
7561 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7562 !! end
7563
7564 !! test
7565 Interwiki link encoding conversion (bug 1636)
7566 !! wikitext
7567 *[[Wikipedia:ro:Olteni&#0355;a]]
7568 *[[Wikipedia:ro:Olteni&#355;a]]
7569 !! html
7570 <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>
7571 <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>
7572
7573 !! html+tidy
7574 <ul>
7575 <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>
7576 <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>
7577 </ul>
7578 !! end
7579
7580 !! test
7581 Interwiki link with fragment (bug 2130)
7582 !! wikitext
7583 [[MeatBall:SoftSecurity#foo]]
7584 !! html
7585 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7586 </p>
7587 !! end
7588
7589 # Ideally the wikipedia: prefix here should be proto-relative too
7590 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7591 # define the 'en' prefix, and originally the test used 'wikipedia',
7592 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7593 # article.
7594 !! test
7595 Different interwiki prefixes mapping to the same URL
7596 !! wikitext
7597 [[:en:Foo]]
7598
7599 [[:en:Foo|Foo]]
7600
7601 [[wikipedia:Foo]]
7602
7603 [[:wikipedia:Foo|Foo]]
7604
7605 [[wikipedia:en:Foo]]
7606
7607 [[:wikipedia:en:Foo]]
7608
7609 [[ wikiPEdia :Foo]]
7610 !! html/parsoid
7611 <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>
7612
7613 <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>
7614
7615 <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>
7616
7617 <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>
7618
7619 <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>
7620
7621 <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>
7622
7623 <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>
7624 !! end
7625
7626 !! test
7627 Interwiki links that cannot be represented in wiki syntax
7628 !! wikitext
7629 [[meatball:ok]]
7630 [[meatball:ok#foo|ok with fragment]]
7631 [[meatball:ok_as_well?|ok ending with ? mark]]
7632 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7633 [http://de.wikipedia.org/wiki/#foo is just fragment]
7634
7635 !! html/php
7636 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7637 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7638 <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>
7639 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7640 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7641 </p>
7642 !! html/parsoid
7643 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7644 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7645 <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>
7646 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7647 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7648 !! end
7649
7650 !! test
7651 Interwiki links: trail
7652 !! wikitext
7653 [[wikipedia:Foo|Ba]]r
7654 !! html/php
7655 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7656 </p>
7657 !! html/parsoid
7658 <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>
7659 !! end
7660
7661 !! test
7662 Local interwiki link
7663 !! options
7664 parsoid=wt2html,wt2wt,html2html
7665 !! wikitext
7666 [[local:Template:Foo]]
7667 !! html/php
7668 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7669 </p>
7670 !! html/parsoid
7671 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7672 !! end
7673
7674 # Parsoid does not mark self-links, by design.
7675 !! test
7676 Local interwiki link: self-link to current page
7677 !! options
7678 title=[[Main Page]]
7679 parsoid=wt2html,wt2wt,html2html
7680 !! wikitext
7681 [[local:Main Page]]
7682 !! html/php
7683 <p><strong class="selflink">local:Main Page</strong>
7684 </p>
7685 !! html/parsoid
7686 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7687 !! end
7688
7689 !! test
7690 Local interwiki link: prefix only (bug 64167)
7691 !! options
7692 parsoid=wt2html,wt2wt,html2html
7693 !! wikitext
7694 [[local:]]
7695 !! html/php
7696 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7697 </p>
7698 !! html/parsoid
7699 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7700 !! end
7701
7702 !! test
7703 Local interwiki link: with additional interwiki prefix (bug 61357)
7704 !! options
7705 parsoid=wt2html,wt2wt,html2html
7706 !! wikitext
7707 [[local:meatball:Hello]]
7708 !! html/php
7709 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7710 </p>
7711 !! html/parsoid
7712 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7713 !! end
7714
7715 !! test
7716 Multiple local interwiki link prefixes
7717 !! wikitext
7718 [[local:local:local:local:mi:local:Foo]]
7719 !! options
7720 parsoid=wt2html,wt2wt,html2html
7721 !! html/php
7722 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7723 </p>
7724 !! html/parsoid
7725 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7726 !! end
7727
7728 ###
7729 ### Interlanguage links
7730 ### Language links (so that searching for '### language' matches..)
7731 ###
7732
7733 !! test
7734 Interlanguage link
7735 !! options
7736 parsoid=wt2html,wt2wt,html2html
7737 !! wikitext
7738 Blah blah blah
7739 [[zh:Chinese]]
7740 !! html/php
7741 <p>Blah blah blah
7742 </p>
7743 !! html/parsoid
7744 <p>Blah blah blah</p>
7745 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7746 !! end
7747
7748 !! test
7749 Interlanguage link with spacing
7750 !! options
7751 parsoid=wt2html,wt2wt,html2html
7752 !! wikitext
7753 Blah blah blah
7754 [[ zh : Chinese ]]
7755 !! html/php
7756 <p>Blah blah blah
7757 </p>
7758 !! html/parsoid
7759 <p>Blah blah blah</p>
7760 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7761 !! end
7762
7763 !! test
7764 Double interlanguage link
7765 !! options
7766 parsoid=wt2html,wt2wt,html2html
7767 !! wikitext
7768 Blah blah blah
7769 [[es:Spanish]]
7770 [[zh:Chinese]]
7771 !! html/php
7772 <p>Blah blah blah
7773 </p>
7774 !! html/parsoid
7775 <p>Blah blah blah</p>
7776 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7777 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7778 !! end
7779
7780 !! test
7781 Interlanguage link variations
7782 !! options
7783 parsoid=wt2html,wt2wt,html2html
7784 !! wikitext
7785 Blah blah blah
7786 [[ es :Spanish]]
7787 [[ ZH :Chinese]]
7788 [[es:Foo_bar]]
7789 !! html/php
7790 <p>Blah blah blah
7791 </p>
7792 !! html/parsoid
7793 <p>Blah blah blah</p>
7794 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7795 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7796 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7797 !! end
7798
7799 !! test
7800 Space and question mark encoding in interlanguage links (T95473)
7801 !! options
7802 parsoid=wt2html,wt2wt,html2html
7803 !! wikitext
7804 Blah blah blah
7805 [[es:Foo bar?]]
7806 !! html/php
7807 <p>Blah blah blah
7808 </p>
7809 !! html/parsoid
7810 <p>Blah blah blah</p>
7811 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
7812 !! end
7813
7814 !! test
7815 Interlanguage link, with prefix links
7816 !! options
7817 language=ln
7818 !! wikitext
7819 Blah blah blah
7820 [[zh:Chinese]]
7821 !! html/php
7822 <p>Blah blah blah
7823 </p>
7824 !! html/parsoid
7825 <p>Blah blah blah</p>
7826 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7827 !! end
7828
7829 !! test
7830 Double interlanguage link, with prefix links (bug 8897)
7831 !! options
7832 language=ln
7833 !! wikitext
7834 Blah blah blah
7835 [[es:Spanish]]
7836 [[zh:Chinese]]
7837 !! html/php
7838 <p>Blah blah blah
7839 </p>
7840 !! html/parsoid
7841 <p>Blah blah blah</p>
7842 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7843 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7844 !! end
7845
7846 !! test
7847 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7848 !! wikitext
7849 Blah blah blah
7850 [[mul:Article]]
7851 !! html/php
7852 <p>Blah blah blah
7853 </p>
7854 !! html/parsoid
7855 <p>Blah blah blah</p>
7856 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7857 !! end
7858
7859 !! test
7860 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7861 !! options
7862 language=ln
7863 !! wikitext
7864 [[WW&nbsp;II]]
7865 !! html
7866 <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>
7867 </p>
7868 !! end
7869
7870 !! test
7871 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7872 !! options
7873 parsoid=html2wt
7874 !! html
7875 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7876 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7877 !! wikitext
7878 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7879
7880 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7881 !! end
7882
7883 !! test
7884 Parsoid: handle constructor well
7885 !! wikitext
7886 [[constructor]]
7887
7888 [[constructor:foo]]
7889 !! html/php
7890 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7891 </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>
7892 </p>
7893 !! html/parsoid
7894 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
7895
7896 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
7897 !! end
7898
7899 !! article
7900 ko:
7901 !! text
7902 Test.
7903 !! endarticle
7904
7905 # Note that `ko` isn't a known interlanguage prefix
7906 !! test
7907 Parsoid: recognize interlanguage links without a target page
7908 !! options
7909 ill
7910 !! wikitext
7911 [[es:]]
7912
7913 [[ko:]]
7914 !! html/php
7915 es:
7916 !! html/parsoid
7917 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7918
7919 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7920 !! end
7921
7922 # Note that `ko` isn't a known interwiki prefix
7923 !! test
7924 Parsoid: recognize interwiki links without a target page
7925 !! options
7926 parsoid=wt2html,wt2wt,html2html
7927 !! wikitext
7928 [[:es:]]
7929
7930 [[:ko:]]
7931 !! html/php
7932 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7933 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7934 </p>
7935 !! html/parsoid
7936 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7937 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7938 !! end
7939
7940 !! test
7941 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7942 !! wikitext
7943 [[mi:Foo]]
7944 !! html/php
7945 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7946 </p>
7947 !! html/parsoid
7948 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7949 !! end
7950
7951 !! test
7952 Interlanguage link with preceding local interwiki link (bug 68085)
7953 !! options
7954 parsoid=wt2html,wt2wt,html2html
7955 !! wikitext
7956 Blah blah blah
7957 [[local:es:Spanish]]
7958 !! html/php
7959 <p>Blah blah blah
7960 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7961 </p>
7962 !! html/parsoid
7963 <p>Blah blah blah
7964 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7965 !! end
7966
7967 !! test
7968 Looks like an interlanguage link, but is actually a local interwiki
7969 !! options
7970 parsoid=wt2html,wt2wt,html2html
7971 !! wikitext
7972 Blah blah blah
7973 [[mi:Template:Foo]]
7974 !! html/php
7975 <p>Blah blah blah
7976 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7977 </p>
7978 !! html/parsoid
7979 <p>Blah blah blah
7980 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7981 !! end
7982
7983 ###
7984 ### Redirects, Parsoid-only
7985 ###
7986
7987 !! test
7988 1. Simple redirect to page
7989 !! wikitext
7990 #REDIRECT [[Main Page]]
7991 !! html/parsoid
7992 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
7993 !! end
7994
7995 !! test
7996 2. Other redirect variants
7997 !! wikitext
7998 #REDIRECT [[Main_Page]]
7999 !! html/parsoid
8000 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8001 !! end
8002
8003 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8004 # This tests the Parsoid bail-out code.
8005 !! test
8006 3. Other redirect variants
8007 !! wikitext
8008 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8009 !! html/parsoid
8010 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8011 !! end
8012
8013 !! test
8014 4. Redirect to a templated destination
8015 !! wikitext
8016 #REDIRECT [[{{echo|Foo}}bar]]
8017 !! html/parsoid
8018 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8019 !! end
8020
8021 !! test
8022 Empty redirect
8023 !! options
8024 parsoid=wt2html,wt2wt
8025 !! wikitext
8026 #REDIRECT [[]]
8027 !! html/parsoid
8028 <ol>
8029 <li>REDIRECT [[]]</li></ol>
8030 !! end
8031
8032 !! test
8033 Optional colon in #REDIRECT
8034 !! options
8035 # the colon is archaic syntax. we support it for wt2html, but we
8036 # don't care that it roundtrips back to the modern syntax.
8037 parsoid=wt2html,html2html
8038 !! wikitext
8039 #REDIRECT:[[Main Page]]
8040 !! html/parsoid
8041 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8042 !! end
8043
8044 !! test
8045 Whitespace in #REDIRECT with optional colon
8046 !! options
8047 # the colon and gratuitous whitespace is archaic syntax. we support
8048 # it for wt2html, but we don't care that it roundtrips back to the
8049 # modern syntax (without extra whitespace)
8050 parsoid=wt2html,html2html
8051 !! wikitext
8052
8053 #REDIRECT
8054 :
8055 [[Main Page]]
8056 !! html/parsoid
8057 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8058 !! end
8059
8060 !! test
8061 Piped link in #REDIRECT
8062 !! options
8063 # content after piped link is ignored. we support this syntax,
8064 # but don't care that the piped link is lost when we roundtrip this.
8065 parsoid=wt2html
8066 !! wikitext
8067 #REDIRECT [[Main Page|bar]]
8068 !! html/parsoid
8069 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8070 !! end
8071
8072 !! test
8073 Redirect to category (T104502)
8074 !! options
8075 parsoid=wt2html,wt2wt
8076 !! wikitext
8077 #REDIRECT [[Category:Foo]]
8078 !! html/parsoid
8079 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8080 !! end
8081
8082 !! test
8083 Redirect to category with URL encoding (T104502)
8084 !! options
8085 parsoid=wt2html
8086 !! wikitext
8087 #REDIRECT [[Category%3AFoo]]
8088 !! html/parsoid
8089 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8090 !! end
8091
8092 !! test
8093 Redirect to category page
8094 !! wikitext
8095 #REDIRECT [[:Category:Foo]]
8096 !! html/parsoid
8097 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8098 !! end
8099
8100 !! test
8101 Redirect to image page (1)
8102 !! wikitext
8103 #REDIRECT [[File:Wiki.png]]
8104 !! html/parsoid
8105 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8106 !! end
8107
8108 !! test
8109 Redirect to image page (2)
8110 !! wikitext
8111 #REDIRECT [[Image:Wiki.png]]
8112 !! html/parsoid
8113 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8114 !! end
8115
8116 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8117 # Next test confirms this.
8118 !! test
8119 Redirect to language (1) (T104918)
8120 !! options
8121 parsoid=wt2html,wt2wt,html2html
8122 !! wikitext
8123 #REDIRECT [[en:File:Wiki.png]]
8124 !! html/parsoid
8125 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8126 !! end
8127
8128 !! test
8129 Redirect to language (2) (T104918)
8130 !! wikitext
8131 #REDIRECT [[:en:File:Wiki.png]]
8132 !! html/parsoid
8133 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8134 !! end
8135
8136 !! test
8137 Redirect to interwiki (T104918)
8138 !! wikitext
8139 #REDIRECT [[meatball:File:Wiki.png]]
8140 !! html/parsoid
8141 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8142 !! end
8143
8144 !! test
8145 Non-English #REDIRECT
8146 !! options
8147 language=is
8148 !! wikitext
8149 #TILVÍSUN [[Main Page]]
8150 !! html/parsoid
8151 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8152 !! end
8153
8154 !! test
8155 Redirect syntax under text isn't considered a redirect
8156 !! wikitext
8157 some text
8158 #redirect [[Main Page]]
8159 !! html/parsoid
8160 <p>some text</p>
8161 <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>
8162 !! end
8163
8164 # FIXME: Should hoist the redirect to the top of the page and ensure there
8165 # is only one.
8166 !! test
8167 New redirect
8168 !! options
8169 parsoid=html2wt
8170 !! html/parsoid
8171 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8172 !! wikitext
8173 Foo
8174 #REDIRECT [[Foo]]
8175 !! end
8176
8177 ##
8178 ## XHTML tidiness
8179 ###
8180
8181 !! test
8182 <br> to <br />
8183 !! wikitext
8184 1<br>2<br />3
8185 !! html
8186 <p>1<br />2<br />3
8187 </p>
8188 !! end
8189
8190 !! test
8191 Broken br tag sanitization
8192 !! wikitext
8193 </br>
8194 !! html/php
8195 <p>&lt;/br&gt;
8196 </p>
8197 !! end
8198
8199 # TODO: Fix html2html mode (bug 51055)!
8200 !! test
8201 Parsoid: Broken br tag recognition
8202 !! options
8203 parsoid=wt2html
8204 !! wikitext
8205 </br>
8206
8207 <br/ >
8208 !! html+tidy
8209 <p><br /></p>
8210 <p><br /></p>
8211 !! end
8212
8213 !! test
8214 Incorrecly removing closing slashes from correctly formed XHTML
8215 !! wikitext
8216 <br style="clear:both;" />
8217 !! html
8218 <p><br style="clear:both;" />
8219 </p>
8220 !! end
8221
8222 !! test
8223 Failing to transform badly formed HTML into correct XHTML
8224 !! wikitext
8225 <br style="clear: left;">
8226 <br style="clear: right;">
8227 <br style="clear: both;">
8228 !! html
8229 <p><br style="clear: left;" />
8230 <br style="clear: right;" />
8231 <br style="clear: both;" />
8232 </p>
8233 !!end
8234
8235 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8236 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8237 !! test
8238 Handling html with a div self-closing tag
8239 !! wikitext
8240 <div title />
8241 <div title/>
8242 <div title/ >
8243 <div title=bar />
8244 <div title=bar/>
8245 <div title=bar/ >
8246 !! html/php
8247 <p>&lt;div title /&gt;
8248 &lt;div title/&gt;
8249 </p>
8250 <div>
8251 <p>&lt;div title=bar /&gt;
8252 &lt;div title=bar/&gt;
8253 </p>
8254 <div title="bar/"></div>
8255 </div>
8256
8257 !! html/parsoid
8258 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8259 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8260 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8261 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8262 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8263 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8264 !! end
8265
8266 !! test
8267 Handling html with a br self-closing tag
8268 !! wikitext
8269 <br title />
8270 <br title/>
8271 <br title/ >
8272 <br title=bar />
8273 <br title=bar/>
8274 <br title=bar/ >
8275 !! html/php
8276 <p><br title="title" />
8277 <br title="title" />
8278 <br />
8279 <br title="bar" />
8280 <br title="bar" />
8281 <br title="bar/" />
8282 </p>
8283 !! html/parsoid
8284 <p><br title="" />
8285 <br title="" />
8286 <br title="" />
8287 <br title="bar" />
8288 <br title="bar" />
8289 <br title="bar/" />
8290 </p>
8291 !! end
8292
8293 !! test
8294 Horizontal ruler (should it add that extra space?)
8295 !! wikitext
8296 <hr>
8297 <hr >
8298 foo <hr
8299 > bar
8300 !! html+tidy
8301 <hr />
8302 <hr />
8303 <p>foo</p>
8304 <hr />
8305 <p>bar</p>
8306 !! end
8307
8308 !! test
8309 Horizontal ruler -- 4+ dashes render hr
8310 !! wikitext
8311 ----
8312 !! html
8313 <hr />
8314
8315 !! end
8316
8317 !! test
8318 Horizontal ruler -- eats additional dashes on the same line
8319 !! wikitext
8320 ---------
8321 !! html
8322 <hr />
8323
8324 !! end
8325
8326 !! test
8327 Horizontal ruler -- does not collapse dashes on consecutive lines
8328 !! wikitext
8329 ----
8330 ----
8331 !! html
8332 <hr />
8333 <hr />
8334
8335 !! end
8336
8337 !! test
8338 Horizontal ruler -- <4 dashes render as plain text
8339 !! wikitext
8340 ---
8341 !! html
8342 <p>---
8343 </p>
8344 !! end
8345
8346 !! test
8347 Horizontal ruler -- Supports content following dashes on same line
8348 !! wikitext
8349 ---- Foo
8350 !! html
8351 <hr /> Foo
8352
8353 !! html+tidy
8354 <hr />
8355 <p>Foo</p>
8356 !! end
8357
8358 ###
8359 ### Block-level elements
8360 ###
8361 !! test
8362 Common list
8363 !! wikitext
8364 *Common list
8365 * item 2
8366 *item 3
8367 !! html
8368 <ul><li>Common list</li>
8369 <li> item 2</li>
8370 <li>item 3</li></ul>
8371
8372 !! end
8373
8374 !! test
8375 Numbered list
8376 !! wikitext
8377 #Numbered list
8378 #item 2
8379 # item 3
8380 !! html
8381 <ol><li>Numbered list</li>
8382 <li>item 2</li>
8383 <li> item 3</li></ol>
8384
8385 !! end
8386
8387 !! test
8388 Mixed list
8389 !! wikitext
8390 *Mixed list
8391 *# with numbers
8392 ** and bullets
8393 *# and numbers
8394 *bullets again
8395 **bullet level 2
8396 ***bullet level 3
8397 ***#Number on level 4
8398 **bullet level 2
8399 **#Number on level 3
8400 **#Number on level 3
8401 *#number level 2
8402 *Level 1
8403 *** Level 3
8404 #** Level 3, but ordered
8405 !! html
8406 <ul><li>Mixed list
8407 <ol><li> with numbers</li></ol>
8408 <ul><li> and bullets</li></ul>
8409 <ol><li> and numbers</li></ol></li>
8410 <li>bullets again
8411 <ul><li>bullet level 2
8412 <ul><li>bullet level 3
8413 <ol><li>Number on level 4</li></ol></li></ul></li>
8414 <li>bullet level 2
8415 <ol><li>Number on level 3</li>
8416 <li>Number on level 3</li></ol></li></ul>
8417 <ol><li>number level 2</li></ol></li>
8418 <li>Level 1
8419 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8420 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8421
8422 !! end
8423
8424 !! test
8425 Nested lists 1
8426 !! wikitext
8427 *foo
8428 **bar
8429 !! html
8430 <ul><li>foo
8431 <ul><li>bar</li></ul></li></ul>
8432
8433 !! end
8434
8435 !! test
8436 Nested lists 2
8437 !! wikitext
8438 **foo
8439 *bar
8440 !! html
8441 <ul><li><ul><li>foo</li></ul></li>
8442 <li>bar</li></ul>
8443
8444 !! end
8445
8446 !! test
8447 Nested lists 3 (first element empty)
8448 !! wikitext
8449 *
8450 **bar
8451 !! html
8452 <ul><li>
8453 <ul><li>bar</li></ul></li></ul>
8454
8455 !! end
8456
8457 !! test
8458 Nested lists 4 (first element empty)
8459 !! wikitext
8460 **
8461 *bar
8462 !! html
8463 <ul><li><ul><li></li></ul></li>
8464 <li>bar</li></ul>
8465
8466 !! end
8467
8468 !! test
8469 Nested lists 5 (both elements empty)
8470 !! wikitext
8471 **
8472 *
8473 !! html
8474 <ul><li><ul><li></li></ul></li>
8475 <li></li></ul>
8476
8477 !! end
8478
8479 !! test
8480 Nested lists 6 (both elements empty)
8481 !! wikitext
8482 *
8483 **
8484 !! html
8485 <ul><li>
8486 <ul><li></li></ul></li></ul>
8487
8488 !! end
8489
8490 !! test
8491 Nested lists 7 (skip initial nesting levels)
8492 !! wikitext
8493 *** foo
8494 !! html
8495 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8496
8497 !! end
8498
8499 !! test
8500 Nested lists 8 (multiple nesting transitions)
8501 !! wikitext
8502 * foo
8503 *** bar
8504 ** baz
8505 * boo
8506 !! html
8507 <ul><li> foo
8508 <ul><li><ul><li> bar</li></ul></li>
8509 <li> baz</li></ul></li>
8510 <li> boo</li></ul>
8511
8512 !! end
8513
8514 !! test
8515 Nested lists 9 (extension interaction)
8516 !! options
8517 parsoid
8518 !! wikitext
8519 *<references />
8520 !! html/parsoid
8521 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8522 !! end
8523
8524 !! test
8525 1. Lists with start-of-line-transparent tokens before bullets: Comments
8526 !! wikitext
8527 *foo
8528 *<!--cmt-->bar
8529 <!--cmt-->*baz
8530 !! html
8531 <ul><li>foo</li>
8532 <li>bar</li>
8533 <li>baz</li></ul>
8534
8535 !! end
8536
8537 !! test
8538 2. Lists with start-of-line-transparent tokens before bullets: Template close
8539 !! wikitext
8540 *foo {{echo|bar
8541 }}*baz
8542 !! html
8543 <ul><li>foo bar</li>
8544 <li>baz</li></ul>
8545
8546 !! end
8547
8548 !! test
8549 List items are not parsed correctly following a <pre> block (bug 785)
8550 !! wikitext
8551 * <pre>foo</pre>
8552 * <pre>bar</pre>
8553 * zar
8554 !! html/php
8555 <ul><li> <pre>foo</pre></li>
8556 <li> <pre>bar</pre></li>
8557 <li> zar</li></ul>
8558
8559 !! html/parsoid
8560 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8561 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8562 <li> zar</li></ul>
8563 !! end
8564
8565 !! test
8566 List items from template
8567 !! wikitext
8568
8569 {{inner list}}
8570 * item 2
8571
8572 * item 0
8573 {{inner list}}
8574 * item 2
8575
8576 * item 0
8577 * notSOL{{inner list}}
8578 * item 2
8579 !! html
8580 <ul><li> item 1</li>
8581 <li> item 2</li></ul>
8582 <ul><li> item 0</li>
8583 <li> item 1</li>
8584 <li> item 2</li></ul>
8585 <ul><li> item 0</li>
8586 <li> notSOL</li>
8587 <li> item 1</li>
8588 <li> item 2</li></ul>
8589
8590 !! end
8591
8592 !! test
8593 List interrupted by empty line or heading
8594 !! wikitext
8595 * foo
8596
8597 ** bar
8598 == A heading ==
8599 * Another list item
8600 !! html
8601 <ul><li> foo</li></ul>
8602 <ul><li><ul><li> bar</li></ul></li></ul>
8603 <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>
8604 <ul><li> Another list item</li></ul>
8605
8606 !!end
8607
8608 !!test
8609 Multiple list tags generated by templates
8610 !! wikitext
8611 {{echo|<li>}}a
8612 {{echo|<li>}}b
8613 {{echo|<li>}}c
8614 !! html
8615 <li>a
8616 <li>b
8617 <li>c</li>
8618 </li>
8619 </li>
8620
8621 !! html+tidy
8622 <ul>
8623 <li>a</li>
8624 <li>b</li>
8625 <li>c</li>
8626 </ul>
8627 !!end
8628
8629 !!test
8630 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8631 !! wikitext
8632 *a
8633 <!--This line will NOT split the list-->
8634 *b
8635 <!--This line will NOT split the list either-->
8636 *c
8637 <!--foo--> <!----> <!--This line NOT split the list either-->
8638 *d
8639 !! html
8640 <ul><li>a</li>
8641 <li>b</li>
8642 <li>c</li>
8643 <li>d</li></ul>
8644
8645 !!end
8646
8647 !!test
8648 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8649 !! wikitext
8650 *a
8651 <!--This line will NOT split the list-->
8652 *b
8653 <!--This line will NOT split the list either-->
8654 *c
8655 <!--foo--> <!----> <!--This line NOT split the list
8656 either-->
8657 *d
8658 !! html
8659 <ul><li>a</li>
8660 <li>b</li>
8661 <li>c</li>
8662 <li>d</li></ul>
8663
8664 !!end
8665
8666 !!test
8667 Test the li-hack
8668 (The PHP parser relies on Tidy for the hack)
8669 !!options
8670 parsoid=wt2html,wt2wt
8671 !! wikitext
8672 * foo
8673 * <li>li-hack
8674 * {{echo|<li>templated li-hack}}
8675 * <!--foo--> <li> unsupported li-hack with preceding comments
8676
8677 <ul>
8678 <li><li>not a li-hack
8679 </li>
8680 </ul>
8681 !! html+tidy
8682 <ul>
8683 <li>foo</li>
8684 <li>li-hack</li>
8685 <li>templated li-hack</li>
8686 <li>unsupported li-hack with preceding comments</li>
8687 </ul>
8688 <ul>
8689 <li>not a li-hack</li>
8690 </ul>
8691 !!end
8692
8693 !! test
8694 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8695 !! options
8696 parsoid
8697 !! wikitext
8698 # foo
8699 ## bar
8700 * foo
8701 ** bar
8702 : foo
8703 :: bar
8704 !! html
8705 <ol>
8706 <li> foo<ol>
8707 <li> bar</li>
8708 </ol></li>
8709 </ol><ul>
8710 <li> foo<ul>
8711 <li> bar</li>
8712 </ul></li>
8713 </ul><dl>
8714 <dd> foo<dl>
8715 <dd> bar</dd>
8716 </dl></dd>
8717 </dl>
8718 !! end
8719
8720 !! test
8721 Parsoid: Test of whitespace serialization with Templated bullets
8722 !! options
8723 parsoid
8724 !! wikitext
8725 * {{bullet}}
8726 !! html
8727 <ul>
8728 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8729 </ul>
8730 !! end
8731
8732 # ------------------------------------------------------------------------
8733 # The next set of tests are about Parsoid's ability to handle badly nested
8734 # tags (parse, minimize scope of fixup, and roundtrip back)
8735 # ------------------------------------------------------------------------
8736
8737 !! test
8738 Unbalanced closing block tags break a list
8739 (php parser relies on Tidy to fix up)
8740 !! wikitext
8741 <div>
8742 *a</div><div>
8743 *b</div>
8744 !! html+tidy
8745 <div>
8746 <ul>
8747 <li>a</li>
8748 </ul>
8749 </div>
8750 <div>
8751 <ul>
8752 <li>b</li>
8753 </ul>
8754 </div>
8755 !! end
8756
8757 # Parsoid fails this test, but it might be tricky to support properly.
8758 # See bug 68395.
8759 !! test
8760 Unbalanced closing non-block tags don't break a list
8761 (php parser relies on Tidy to fix up)
8762 !! wikitext
8763 <span>
8764 *a</span><span>
8765 *b</span>
8766 !! html/php+tidy
8767 <ul>
8768 <li><span>a</span></li>
8769 <li><span>b</span></li>
8770 </ul>
8771 !! html/parsoid
8772 <span>
8773 <ul>
8774 <li>a<span></span>
8775 </li>
8776 <li>b
8777 </li>
8778 </ul>
8779 </span>
8780 !! end
8781
8782 !! test
8783 Unclosed formatting tags that straddle lists are closed and reopened
8784 (php parser relies on Tidy to fix up)
8785 !! options
8786 parsoid=wt2html,wt2wt,html2html
8787 !! wikitext
8788 # <s> a
8789 # b </s>
8790 !! html/php+tidy
8791 <ol>
8792 <li><s>a</s></li>
8793 <li><s>b</s></li>
8794 </ol>
8795 !! html/parsoid
8796 <ol><li> <s> a</s></li>
8797 <li><s> b </s></li></ol>
8798 !! end
8799
8800 # See bug 68395.
8801 !!test
8802 1. List embedded in a formatting tag
8803 !! wikitext
8804 <small>
8805 * foo
8806 </small>
8807 !! html/php+tidy
8808 <ul>
8809 <li><small>foo</small></li>
8810 </ul>
8811 !! html/parsoid
8812 <small>
8813 <ul>
8814 <li> foo</li>
8815 </ul>
8816 </small>
8817 !!end
8818
8819 ## Ugly Parsoid output here
8820 ## Not sure what the right output is.
8821 !!test
8822 2. List embedded in a formatting tag
8823 !! wikitext
8824 <small>
8825 *a
8826 *b</small>
8827 !! html/php+tidy
8828 <ul>
8829 <li><small>a</small></li>
8830 <li><small>b</small></li>
8831 </ul>
8832 !! html/parsoid
8833 <small></small>
8834 <ul><small>
8835 <li>a</li>
8836 </small>
8837 <li><small>b</small></li>
8838 </ul>
8839 !!end
8840
8841 # Ugly Parsoid and PHP parser output here
8842 # Not sure if we want to make this a test!
8843 #
8844 ## !!test
8845 ## 3. Unclosed formatting tags in list elements
8846 ## !! wikitext
8847 ## *<small>a
8848 ## *<small>b
8849 ## !! html/php+tidy
8850 ## <ul>
8851 ## <li><small>a</small></li>
8852 ## <li><small><small>b</small></small></li>
8853 ## </ul>
8854 ## !! html/parsoid
8855 ## <ul>
8856 ## <li><small>a</small></li>
8857 ## <small>
8858 ## <li><small>b</small></li>
8859 ## </small></ul>
8860 ## !!end
8861
8862 # This is a bug in the PHP parser + tidy combination.
8863 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8864 # and then fostered out of the table by tidy.)
8865 # We believe the Parsoid output to be correct.
8866 !! test
8867 Table with missing opening <tr> tag
8868 !! options
8869 parsoid=wt2html,wt2wt
8870 !! wikitext
8871 <table>
8872 <td>foo</td>
8873 </tr>
8874 </table>
8875 !! html+tidy
8876 <table>
8877 <tr>
8878 <td>foo</td>
8879 </tr>
8880 </table>
8881 !! end
8882
8883 ###
8884 ### Magic Words
8885 ###
8886
8887 # Note that the current date is hard-coded as
8888 # 1970-01-01T00:02:03Z (a Thursday)
8889 # when running parser tests. The timezone is also fixed to GMT, so
8890 # local date will be identical to current date.
8891
8892 !! test
8893 Magic Word: {{CURRENTDAY}}
8894 !! wikitext
8895 {{CURRENTDAY}}
8896 !! html
8897 <p>1
8898 </p>
8899 !! end
8900
8901 !! test
8902 Magic Word: {{CURRENTDAY2}}
8903 !! wikitext
8904 {{CURRENTDAY2}}
8905 !! html
8906 <p>01
8907 </p>
8908 !! end
8909
8910 !! test
8911 Magic Word: {{CURRENTDAYNAME}}
8912 !! wikitext
8913 {{CURRENTDAYNAME}}
8914 !! html
8915 <p>Thursday
8916 </p>
8917 !! end
8918
8919 !! test
8920 Magic Word: {{CURRENTDOW}}
8921 !! wikitext
8922 {{CURRENTDOW}}
8923 !! html
8924 <p>4
8925 </p>
8926 !! end
8927
8928 !! test
8929 Magic Word: {{CURRENTMONTH}}
8930 !! wikitext
8931 {{CURRENTMONTH}}
8932 !! html
8933 <p>01
8934 </p>
8935 !! end
8936
8937 !! test
8938 Magic Word: {{CURRENTMONTH1}}
8939 !! wikitext
8940 {{CURRENTMONTH1}}
8941 !! html
8942 <p>1
8943 </p>
8944 !! end
8945
8946 !! test
8947 Magic Word: {{CURRENTMONTHABBREV}}
8948 !! wikitext
8949 {{CURRENTMONTHABBREV}}
8950 !! html
8951 <p>Jan
8952 </p>
8953 !! end
8954
8955 !! test
8956 Magic Word: {{CURRENTMONTHNAME}}
8957 !! wikitext
8958 {{CURRENTMONTHNAME}}
8959 !! html
8960 <p>January
8961 </p>
8962 !! end
8963
8964 !! test
8965 Magic Word: {{CURRENTMONTHNAMEGEN}}
8966 !! wikitext
8967 {{CURRENTMONTHNAMEGEN}}
8968 !! html
8969 <p>January
8970 </p>
8971 !! end
8972
8973 !! test
8974 Magic Word: {{CURRENTTIME}}
8975 !! wikitext
8976 {{CURRENTTIME}}
8977 !! html
8978 <p>00:02
8979 </p>
8980 !! end
8981
8982 !! test
8983 Magic Word: {{CURRENTHOUR}}
8984 !! wikitext
8985 {{CURRENTHOUR}}
8986 !! html
8987 <p>00
8988 </p>
8989 !! end
8990
8991 !! test
8992 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8993 !! wikitext
8994 {{CURRENTWEEK}}
8995 !! html
8996 <p>1
8997 </p>
8998 !! end
8999
9000 !! test
9001 Magic Word: {{CURRENTYEAR}}
9002 !! wikitext
9003 {{CURRENTYEAR}}
9004 !! html
9005 <p>1970
9006 </p>
9007 !! end
9008
9009 !! test
9010 Magic Word: {{CURRENTTIMESTAMP}}
9011 !! wikitext
9012 {{CURRENTTIMESTAMP}}
9013 !! html
9014 <p>19700101000203
9015 </p>
9016 !! end
9017
9018 !! test
9019 Magic Words LOCAL (UTC)
9020 !! wikitext
9021 * {{LOCALMONTH}}
9022 * {{LOCALMONTH1}}
9023 * {{LOCALMONTHNAME}}
9024 * {{LOCALMONTHNAMEGEN}}
9025 * {{LOCALMONTHABBREV}}
9026 * {{LOCALDAY}}
9027 * {{LOCALDAY2}}
9028 * {{LOCALDAYNAME}}
9029 * {{LOCALYEAR}}
9030 * {{LOCALTIME}}
9031 * {{LOCALHOUR}}
9032 * {{LOCALWEEK}}
9033 * {{LOCALDOW}}
9034 * {{LOCALTIMESTAMP}}
9035 !! html
9036 <ul><li> 01</li>
9037 <li> 1</li>
9038 <li> January</li>
9039 <li> January</li>
9040 <li> Jan</li>
9041 <li> 1</li>
9042 <li> 01</li>
9043 <li> Thursday</li>
9044 <li> 1970</li>
9045 <li> 00:02</li>
9046 <li> 00</li>
9047 <li> 1</li>
9048 <li> 4</li>
9049 <li> 19700101000203</li></ul>
9050
9051 !! end
9052
9053 !! test
9054 Magic Word: {{FULLPAGENAME}}
9055 !! options
9056 title=[[User:Ævar Arnfjörð Bjarmason]]
9057 !! wikitext
9058 {{FULLPAGENAME}}
9059 !! html
9060 <p>User:Ævar Arnfjörð Bjarmason
9061 </p>
9062 !! end
9063
9064 !! test
9065 Magic Word: {{FULLPAGENAMEE}}
9066 !! options
9067 title=[[User:Ævar Arnfjörð Bjarmason]]
9068 !! wikitext
9069 {{FULLPAGENAMEE}}
9070 !! html
9071 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9072 </p>
9073 !! end
9074
9075 !! test
9076 Magic Word: {{TALKSPACE}}
9077 !! options
9078 title=[[User:Ævar Arnfjörð Bjarmason]]
9079 !! wikitext
9080 {{TALKSPACE}}
9081 !! html
9082 <p>User talk
9083 </p>
9084 !! end
9085
9086 !! test
9087 Magic Word: {{TALKSPACE}}, same namespace
9088 !! options
9089 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9090 !! wikitext
9091 {{TALKSPACE}}
9092 !! html
9093 <p>User talk
9094 </p>
9095 !! end
9096
9097 !! test
9098 Magic Word: {{TALKSPACE}}, main namespace
9099 !! options
9100 title=[[Parser Test]]
9101 !! wikitext
9102 {{TALKSPACE}}
9103 !! html
9104 <p>Talk
9105 </p>
9106 !! end
9107
9108 !! test
9109 Magic Word: {{TALKSPACEE}}
9110 !! options
9111 title=[[User:Ævar Arnfjörð Bjarmason]]
9112 !! wikitext
9113 {{TALKSPACEE}}
9114 !! html
9115 <p>User_talk
9116 </p>
9117 !! end
9118
9119 !! test
9120 Magic Word: {{SUBJECTSPACE}}
9121 !! options
9122 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9123 !! wikitext
9124 {{SUBJECTSPACE}}
9125 !! html
9126 <p>User
9127 </p>
9128 !! end
9129
9130 !! test
9131 Magic Word: {{SUBJECTSPACE}}, same namespace
9132 !! options
9133 title=[[User:Ævar Arnfjörð Bjarmason]]
9134 !! wikitext
9135 {{SUBJECTSPACE}}
9136 !! html
9137 <p>User
9138 </p>
9139 !! end
9140
9141 !! test
9142 Magic Word: {{SUBJECTSPACE}}, main namespace
9143 !! options
9144 title=[[Parser Test]]
9145 !! wikitext
9146 {{SUBJECTSPACE}}
9147 !! html
9148
9149 !! end
9150
9151 !! test
9152 Magic Word: {{SUBJECTSPACEE}}
9153 !! options
9154 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9155 !! wikitext
9156 {{SUBJECTSPACEE}}
9157 !! html
9158 <p>User
9159 </p>
9160 !! end
9161
9162 !! test
9163 Magic Word: {{NAMESPACE}}
9164 !! options
9165 title=[[User:Ævar Arnfjörð Bjarmason]]
9166 !! wikitext
9167 {{NAMESPACE}}
9168 !! html
9169 <p>User
9170 </p>
9171 !! end
9172
9173 !! test
9174 Magic Word: {{NAMESPACEE}}
9175 !! options
9176 title=[[User:Ævar Arnfjörð Bjarmason]]
9177 !! wikitext
9178 {{NAMESPACEE}}
9179 !! html
9180 <p>User
9181 </p>
9182 !! end
9183
9184 !! test
9185 Magic Word: {{NAMESPACENUMBER}}
9186 !! options
9187 title=[[User:Ævar Arnfjörð Bjarmason]]
9188 !! wikitext
9189 {{NAMESPACENUMBER}}
9190 !! html
9191 <p>2
9192 </p>
9193 !! end
9194
9195 !! test
9196 Magic Word: {{SUBPAGENAME}}
9197 !! options
9198 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9199 !! wikitext
9200 {{SUBPAGENAME}}
9201 !! html
9202 <p>sub ö
9203 </p>
9204 !! end
9205
9206 !! test
9207 Magic Word: {{SUBPAGENAMEE}}
9208 !! options
9209 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9210 !! wikitext
9211 {{SUBPAGENAMEE}}
9212 !! html
9213 <p>sub_%C3%B6
9214 </p>
9215 !! end
9216
9217 !! test
9218 Magic Word: {{ROOTPAGENAME}}
9219 !! options
9220 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9221 !! wikitext
9222 {{ROOTPAGENAME}}
9223 !! html
9224 <p>Ævar Arnfjörð Bjarmason
9225 </p>
9226 !! end
9227
9228 !! test
9229 Magic Word: {{ROOTPAGENAMEE}}
9230 !! options
9231 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9232 !! wikitext
9233 {{ROOTPAGENAMEE}}
9234 !! html
9235 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9236 </p>
9237 !! end
9238
9239 !! test
9240 Magic Word: {{BASEPAGENAME}}
9241 !! options
9242 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9243 !! wikitext
9244 {{BASEPAGENAME}}
9245 !! html
9246 <p>Ævar Arnfjörð Bjarmason
9247 </p>
9248 !! end
9249
9250 !! test
9251 Magic Word: {{BASEPAGENAMEE}}
9252 !! options
9253 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9254 !! wikitext
9255 {{BASEPAGENAMEE}}
9256 !! html
9257 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9258 </p>
9259 !! end
9260
9261 !! test
9262 Magic Word: {{TALKPAGENAME}}
9263 !! options
9264 title=[[User:Ævar Arnfjörð Bjarmason]]
9265 !! wikitext
9266 {{TALKPAGENAME}}
9267 !! html
9268 <p>User talk:Ævar Arnfjörð Bjarmason
9269 </p>
9270 !! end
9271
9272 !! test
9273 Magic Word: {{TALKPAGENAMEE}}
9274 !! options
9275 title=[[User:Ævar Arnfjörð Bjarmason]]
9276 !! wikitext
9277 {{TALKPAGENAMEE}}
9278 !! html
9279 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9280 </p>
9281 !! end
9282
9283 !! test
9284 Magic Word: {{SUBJECTPAGENAME}}
9285 !! options
9286 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9287 !! wikitext
9288 {{SUBJECTPAGENAME}}
9289 !! html
9290 <p>User:Ævar Arnfjörð Bjarmason
9291 </p>
9292 !! end
9293
9294 !! test
9295 Magic Word: {{SUBJECTPAGENAMEE}}
9296 !! options
9297 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9298 !! wikitext
9299 {{SUBJECTPAGENAMEE}}
9300 !! html
9301 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9302 </p>
9303 !! end
9304
9305 !! test
9306 Magic Word: {{NUMBEROFFILES}}
9307 !! wikitext
9308 {{NUMBEROFFILES}}
9309 !! html
9310 <p>5
9311 </p>
9312 !! end
9313
9314 !! test
9315 Magic Word: {{PAGENAME}}
9316 !! options
9317 title=[[User:Ævar Arnfjörð Bjarmason]]
9318 !! wikitext
9319 {{PAGENAME}}
9320 !! html
9321 <p>Ævar Arnfjörð Bjarmason
9322 </p>
9323 !! end
9324
9325 !! test
9326 Magic Word: {{PAGENAME}} with metacharacters
9327 !! options
9328 title=[['foo & bar = baz']]
9329 !! wikitext
9330 ''{{PAGENAME}}''
9331 !! html/php
9332 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9333 </p>
9334 !! html+tidy
9335 <p><i>'foo &amp; bar = baz'</i></p>
9336 !! end
9337
9338 !! test
9339 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9340 !! options
9341 title=[[*RFC 1234 http://example.com/]]
9342 !! wikitext
9343 {{PAGENAME}}
9344 !! html/php
9345 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9346 </p>
9347 !! html+tidy
9348 <p>*RFC 1234 http://example.com/</p>
9349 !! end
9350
9351 !! test
9352 Magic Word: {{PAGENAMEE}}
9353 !! options
9354 title=[[User:Ævar Arnfjörð Bjarmason]]
9355 !! wikitext
9356 {{PAGENAMEE}}
9357 !! html
9358 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9359 </p>
9360 !! end
9361
9362 !! test
9363 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9364 !! options
9365 title=[[*RFC 1234 http://example.com/]]
9366 !! wikitext
9367 {{PAGENAMEE}}
9368 !! html/php
9369 <p>&#42;RFC_1234_http&#58;//example.com/
9370 </p>
9371 !! html+tidy
9372 <p>*RFC_1234_http://example.com/</p>
9373 !! end
9374
9375 !! test
9376 Magic Word: {{REVISIONID}}
9377 !! wikitext
9378 {{REVISIONID}}
9379 !! html
9380 <p>1337
9381 </p>
9382 !! end
9383
9384 !! test
9385 Magic Word: {{SCRIPTPATH}}
9386 !! wikitext
9387 {{SCRIPTPATH}}
9388 !! html
9389 <p>/
9390 </p>
9391 !! end
9392
9393 !! test
9394 Magic Word: {{STYLEPATH}}
9395 !! wikitext
9396 {{STYLEPATH}}
9397 !! html
9398 <p>/skins
9399 </p>
9400 !! end
9401
9402 !! test
9403 Magic Word: {{SERVER}}
9404 !! wikitext
9405 {{SERVER}}
9406 !! html
9407 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9408 </p>
9409 !! end
9410
9411 !! test
9412 Magic Word: {{SERVERNAME}}
9413 !! wikitext
9414 {{SERVERNAME}}
9415 !! html
9416 <p>example.org
9417 </p>
9418 !! end
9419
9420 !! test
9421 Magic Word: {{SITENAME}}
9422 !! wikitext
9423 {{SITENAME}}
9424 !! html
9425 <p>MediaWiki
9426 </p>
9427 !! end
9428
9429 !! test
9430 Case-sensitive magic words, when cased differently, should just be template transclusions
9431 !! wikitext
9432 {{CurrentMonth}}
9433 {{currentday}}
9434 {{cURreNTweEK}}
9435 {{currentHour}}
9436 !! html
9437 <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>
9438 <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>
9439 <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>
9440 <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>
9441 </p>
9442 !! end
9443
9444 !! test
9445 Case-insensitive magic words should still work with weird casing.
9446 !! wikitext
9447 {{sErVeRNaMe}}
9448 {{LCFirst:AOEU}}
9449 {{ucFIRST:aoeu}}
9450 {{SERver}}
9451 !! html
9452 <p>example.org
9453 aOEU
9454 Aoeu
9455 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9456 </p>
9457 !! end
9458
9459 # From plwiki:PLOS_ONE
9460 !! test
9461 Parsoid: Page property magic word with magic word contents
9462 !! wikitext
9463 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9464 !! html/parsoid
9465 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9466 !! end
9467
9468 !! test
9469 Parsoid: Template-generated DISPLAYTITLE
9470 !! wikitext
9471 {{{{echo|DISPLAYTITLE}}:Foo}}
9472 !! html/parsoid
9473 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9474 !! end
9475
9476 !! test
9477 Namespace 1 {{ns:1}}
9478 !! wikitext
9479 {{ns:1}}
9480 !! html
9481 <p>Talk
9482 </p>
9483 !! end
9484
9485 !! test
9486 Namespace 1 {{ns:01}}
9487 !! wikitext
9488 {{ns:01}}
9489 !! html
9490 <p>Talk
9491 </p>
9492 !! end
9493
9494 !! test
9495 Namespace 0 {{ns:0}} (bug 4783)
9496 !! wikitext
9497 {{ns:0}}
9498 !! html
9499
9500 !! end
9501
9502 !! test
9503 Namespace 0 {{ns:00}} (bug 4783)
9504 !! wikitext
9505 {{ns:00}}
9506 !! html
9507
9508 !! end
9509
9510 !! test
9511 Namespace -1 {{ns:-1}}
9512 !! wikitext
9513 {{ns:-1}}
9514 !! html
9515 <p>Special
9516 </p>
9517 !! end
9518
9519 !! test
9520 Namespace User {{ns:User}}
9521 !! wikitext
9522 {{ns:User}}
9523 !! html
9524 <p>User
9525 </p>
9526 !! end
9527
9528 !! test
9529 Namespace User talk {{ns:User_talk}}
9530 !! wikitext
9531 {{ns:User_talk}}
9532 !! html
9533 <p>User talk
9534 </p>
9535 !! end
9536
9537 !! test
9538 Namespace User talk {{ns:uSeR tAlK}}
9539 !! wikitext
9540 {{ns:uSeR tAlK}}
9541 !! html
9542 <p>User talk
9543 </p>
9544 !! end
9545
9546 !! test
9547 Namespace File {{ns:File}}
9548 !! wikitext
9549 {{ns:File}}
9550 !! html
9551 <p>File
9552 </p>
9553 !! end
9554
9555 !! test
9556 Namespace File {{ns:Image}}
9557 !! wikitext
9558 {{ns:Image}}
9559 !! html
9560 <p>File
9561 </p>
9562 !! end
9563
9564 !! test
9565 Namespace (lang=de) Benutzer {{ns:User}}
9566 !! options
9567 language=de
9568 !! wikitext
9569 {{ns:User}}
9570 !! html
9571 <p>Benutzer
9572 </p>
9573 !! end
9574
9575 !! test
9576 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9577 !! options
9578 language=de
9579 !! wikitext
9580 {{ns:3}}
9581 !! html
9582 <p>Benutzer Diskussion
9583 </p>
9584 !! end
9585
9586
9587 !! test
9588 Urlencode
9589 !! wikitext
9590 {{urlencode:hi world?!}}
9591 {{urlencode:hi world?!|WIKI}}
9592 {{urlencode:hi world?!|PATH}}
9593 {{urlencode:hi world?!|QUERY}}
9594 !! html
9595 <p>hi+world%3F%21
9596 hi_world%3F!
9597 hi%20world%3F%21
9598 hi+world%3F%21
9599 </p>
9600 !! end
9601
9602 !! test
9603 Magic Word: prioritize type info over data-parsoid
9604 !! options
9605 parsoid=html2wt
9606 !! html/parsoid
9607 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9608 !! wikitext
9609 __FORCETOC__
9610 !! end
9611
9612 !! test
9613 Magic Word: serialize on separate line (parsoid)
9614 !! options
9615 parsoid=wt2wt,html2wt
9616 !! wikitext
9617 foo
9618 __NOTOC__
9619 bar
9620 !! html
9621 foo<meta property="mw:PageProp/notoc"/>bar
9622 !! end
9623
9624 !! test
9625 Magic Word: rt non-english wikis
9626 !! options
9627 parsoid=wt2wt
9628 language=de
9629 !! wikitext
9630 __NOEDITSECTION__
9631 !! html
9632 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9633 !! end
9634
9635 ###
9636 ### Magic links
9637 ###
9638 !! test
9639 Magic links: internal link to RFC (bug 479)
9640 !! wikitext
9641 [[RFC 123]]
9642 !! html
9643 <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>
9644 </p>
9645 !! end
9646
9647 !! test
9648 Magic links: RFC (bug 479)
9649 !! wikitext
9650 RFC 822
9651 !! html
9652 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9653 </p>
9654 !! end
9655
9656 !! test
9657 Magic links: RFC (bug 65278)
9658 !! wikitext
9659 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9660 !! html
9661 <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.
9662 </p>
9663 !! end
9664
9665 !! test
9666 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9667 !! wikitext
9668 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9669 RFC
9670 822
9671 !! html
9672 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9673 RFC
9674 822
9675 </p>
9676 !! end
9677
9678 !! test
9679 Magic links: ISBN (bug 1937)
9680 !! wikitext
9681 ISBN 0-306-40615-2
9682 !! html
9683 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9684 </p>
9685 !! end
9686
9687 !! test
9688 Magic links: ISBN (bug 65278)
9689 !! wikitext
9690 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9691 !! html/php
9692 <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.
9693 </p>
9694 !! html/parsoid
9695 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9696 !! end
9697
9698 !! test
9699 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9700 !! wikitext
9701 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9702 ISBN
9703 9780316098113
9704 ISBN 978
9705 0316098113
9706 !! html
9707 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9708 ISBN
9709 9780316098113
9710 ISBN 978
9711 0316098113
9712 </p>
9713 !! end
9714
9715 !! test
9716 Magic links: PMID incorrectly converts space to underscore
9717 !! wikitext
9718 PMID 1234
9719 !! html
9720 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9721 </p>
9722 !! end
9723
9724 !! test
9725 Magic links: PMID (bug 65278)
9726 !! wikitext
9727 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9728 !! html
9729 <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.
9730 </p>
9731 !! end
9732
9733 !! test
9734 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9735 !! wikitext
9736 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9737 PMID
9738 1234
9739 !! html
9740 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9741 PMID
9742 1234
9743 </p>
9744 !! end
9745
9746 ###
9747 ### Templates
9748 ####
9749
9750 !! test
9751 Nonexistent template
9752 !! wikitext
9753 {{thistemplatedoesnotexist}}
9754 !! html
9755 <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>
9756 </p>
9757 !! end
9758
9759 !! test
9760 Template with invalid target containing tags
9761 !! wikitext
9762 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9763 !! html
9764 <p>{{a<b>b</b>|foo|a=b|a = b}}
9765 </p>
9766 !! end
9767
9768 !! test
9769 Template with invalid target containing unclosed tag
9770 !! wikitext
9771 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9772 !! html
9773 <p>{{a<b>|foo|a=b|a = b}}</b>
9774 </p>
9775 !! end
9776
9777 !! test
9778 Template with invalid target containing wikilink
9779 !! wikitext
9780 {{[[Main Page]]}}
9781 !! html/php
9782 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9783 </p>
9784 !! html/parsoid
9785 <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>
9786 !! end
9787
9788 !! test
9789 Template with just whitespace in it, bug #68421
9790 !! wikitext
9791 {{echo|{{ }}}}
9792 !! html/parsoid
9793 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
9794 !! end
9795
9796 !! article
9797 Template:test
9798 !! text
9799 This is a test template
9800 !! endarticle
9801
9802 !! test
9803 Simple template
9804 !! wikitext
9805 {{test}}
9806 !! html
9807 <p>This is a test template
9808 </p>
9809 !! end
9810
9811 !! test
9812 Template with explicit namespace
9813 !! wikitext
9814 {{Template:test}}
9815 !! html
9816 <p>This is a test template
9817 </p>
9818 !! end
9819
9820
9821 !! article
9822 Template:paramtest
9823 !! text
9824 This is a test template with parameter {{{param}}}
9825 !! endarticle
9826
9827 !! test
9828 Template parameter
9829 !! wikitext
9830 {{paramtest|param=foo}}
9831 !! html
9832 <p>This is a test template with parameter foo
9833 </p>
9834 !! end
9835
9836 !! article
9837 Template:paramtestnum
9838 !! text
9839 [[{{{1}}}|{{{2}}}]]
9840 !! endarticle
9841
9842 !! test
9843 Template unnamed parameter
9844 !! wikitext
9845 {{paramtestnum|Main Page|the main page}}
9846 !! html
9847 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9848 </p>
9849 !! end
9850
9851 !! article
9852 Template:templatesimple
9853 !! text
9854 (test)
9855 !! endarticle
9856
9857 !! article
9858 Template:templateredirect
9859 !! text
9860 #redirect [[Template:templatesimple]]
9861 !! endarticle
9862
9863 !! article
9864 Template:templateasargtestnum
9865 !! text
9866 {{{{{1}}}}}
9867 !! endarticle
9868
9869 !! article
9870 Template:templateasargtest
9871 !! text
9872 {{template{{{templ}}}}}
9873 !! endarticle
9874
9875 !! article
9876 Template:templateasargtest2
9877 !! text
9878 {{{{{templ}}}}}
9879 !! endarticle
9880
9881 !! test
9882 Template with template name as unnamed argument
9883 !! wikitext
9884 {{templateasargtestnum|templatesimple}}
9885 !! html
9886 <p>(test)
9887 </p>
9888 !! end
9889
9890 !! test
9891 Template with template name as argument
9892 !! wikitext
9893 {{templateasargtest|templ=simple}}
9894 !! html
9895 <p>(test)
9896 </p>
9897 !! end
9898
9899 !! test
9900 Template with template name as argument (2)
9901 !! wikitext
9902 {{templateasargtest2|templ=templatesimple}}
9903 !! html
9904 <p>(test)
9905 </p>
9906 !! end
9907
9908 !! article
9909 Template:templateasargtestdefault
9910 !! text
9911 {{{{{templ|templatesimple}}}}}
9912 !! endarticle
9913
9914 !! article
9915 Template:templa
9916 !! text
9917 '''templ'''
9918 !! endarticle
9919
9920 !! test
9921 Template with default value
9922 !! wikitext
9923 {{templateasargtestdefault}}
9924 !! html
9925 <p>(test)
9926 </p>
9927 !! end
9928
9929 !! test
9930 Template with default value (value set)
9931 !! wikitext
9932 {{templateasargtestdefault|templ=templa}}
9933 !! html
9934 <p><b>templ</b>
9935 </p>
9936 !! end
9937
9938 !! test
9939 Template redirect
9940 !! wikitext
9941 {{templateredirect}}
9942 !! html/php
9943 <p>(test)
9944 </p>
9945 !! html/parsoid
9946 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
9947 !! end
9948
9949 !! test
9950 Template with argument in separate line
9951 !! wikitext
9952 {{ templateasargtest |
9953 templ = simple }}
9954 !! html
9955 <p>(test)
9956 </p>
9957 !! end
9958
9959 !! test
9960 Template with complex template as argument
9961 !! wikitext
9962 {{paramtest|
9963 param ={{ templateasargtest |
9964 templ = simple }}}}
9965 !! html
9966 <p>This is a test template with parameter (test)
9967 </p>
9968 !! end
9969
9970 !! test
9971 Template with thumb image (with link in description)
9972 !! wikitext
9973 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9974 !! html/php
9975 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>
9976
9977 !! html+tidy
9978 <p>This is a test template with parameter</p>
9979 <div class="thumb tright">
9980 <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>
9981 <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>
9982 </div>
9983 </div>
9984 !! html/parsoid
9985 <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>
9986 !! end
9987
9988 !! article
9989 Template:complextemplate
9990 !! text
9991 {{{1}}} {{paramtest|
9992 param ={{{param}}}}}
9993 !! endarticle
9994
9995 !! test
9996 Template with complex arguments
9997 !! wikitext
9998 {{complextemplate|
9999 param ={{ templateasargtest |
10000 templ = simple }}|[[Template:complextemplate|link]]}}
10001 !! html
10002 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10003 </p>
10004 !! end
10005
10006 !! test
10007 BUG 553: link with two variables in a piped link
10008 !! wikitext
10009 {|
10010 |[[{{{1}}}|{{{2}}}]]
10011 |}
10012 !! html
10013 <table>
10014 <tr>
10015 <td>[[{{{1}}}|{{{2}}}]]
10016 </td></tr></table>
10017
10018 !! end
10019
10020 !! test
10021 Magic variable as template parameter
10022 !! wikitext
10023 {{paramtest|param={{SITENAME}}}}
10024 !! html
10025 <p>This is a test template with parameter MediaWiki
10026 </p>
10027 !! end
10028
10029 !! article
10030 Template:linktest
10031 !! text
10032 [[{{{param}}}|link]]
10033 !! endarticle
10034
10035 !! test
10036 Template parameter as link source
10037 !! wikitext
10038 {{linktest|param=Main Page}}
10039 !! html
10040 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10041 </p>
10042 !! end
10043
10044 !!article
10045 Template:paramtest2
10046 !! text
10047 including another template, {{paramtest|param={{{arg}}}}}
10048 !! endarticle
10049
10050 !! test
10051 Template passing argument to another template
10052 !! wikitext
10053 {{paramtest2|arg='hmm'}}
10054 !! html
10055 <p>including another template, This is a test template with parameter 'hmm'
10056 </p>
10057 !! end
10058
10059 !! article
10060 Template:Linktest2
10061 !! text
10062 Main Page
10063 !! endarticle
10064
10065 !! test
10066 Template as link source
10067 !! wikitext
10068 [[{{linktest2}}]]
10069
10070 [[{{linktest2}}|Main Page]]
10071
10072 [[{{linktest2}}]]Page
10073 !! html
10074 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10075 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10076 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10077 </p>
10078 !! end
10079
10080
10081 !! article
10082 Template:loop1
10083 !! text
10084 {{loop2}}
10085 !! endarticle
10086
10087 !! article
10088 Template:loop2
10089 !! text
10090 {{loop1}}
10091 !! endarticle
10092
10093 !! test
10094 Template infinite loop
10095 !! wikitext
10096 {{loop1}}
10097 !! html
10098 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10099 </p>
10100 !! end
10101
10102 !! test
10103 Template from main namespace
10104 !! wikitext
10105 {{:Main Page}}
10106 !! html
10107 <p>blah blah
10108 </p>
10109 !! end
10110
10111 !! article
10112 Template:table
10113 !! text
10114 {|
10115 | 1 || 2
10116 |-
10117 | 3 || 4
10118 |}
10119 !! endarticle
10120
10121 !! test
10122 BUG 529: Template with table, not included at beginning of line
10123 !! wikitext
10124 foo {{table}}
10125 !! html
10126 <p>foo
10127 </p>
10128 <table>
10129 <tr>
10130 <td> 1 </td>
10131 <td> 2
10132 </td></tr>
10133 <tr>
10134 <td> 3 </td>
10135 <td> 4
10136 </td></tr></table>
10137
10138 !! end
10139
10140 !! test
10141 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10142 !! wikitext
10143 foo
10144 {{table}}
10145 !! html
10146 <p>foo
10147 </p>
10148 <table>
10149 <tr>
10150 <td> 1 </td>
10151 <td> 2
10152 </td></tr>
10153 <tr>
10154 <td> 3 </td>
10155 <td> 4
10156 </td></tr></table>
10157
10158 !! end
10159
10160 !! test
10161 BUG 41: Template parameters shown as broken links
10162 !! wikitext
10163 {{{parameter}}}
10164 !! html
10165 <p>{{{parameter}}}
10166 </p>
10167 !! end
10168
10169 !! test
10170 Template with targets containing wikilinks
10171 !! wikitext
10172 {{[[foo]]}}
10173
10174 {{[[{{echo|foo}}]]}}
10175
10176 {{{{echo|[[foo}}]]}}
10177 !! html
10178 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10179 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10180 </p><p>{{[[foo}}]]
10181 </p>
10182 !! end
10183
10184 !! article
10185 Template:''
10186 !! text
10187 bar
10188 !! endarticle
10189
10190 !! test
10191 Templates: Double quotes as template target
10192 !! wikitext
10193 foo {{''}} baz
10194 !! html/php
10195 <p>foo bar baz
10196 </p>
10197 !! html/parsoid
10198 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10199 </p>
10200 !! end
10201
10202 !! article
10203 Template:MSGNW test
10204 !! text
10205 ''None'' of '''this''' should be
10206 * interpreted
10207 but rather passed unmodified
10208 {{test}}
10209 <gallery>
10210 File:Foobar.jpg
10211 </gallery>
10212 !! endarticle
10213
10214 # hmm, fix this or just deprecate msgnw and document its behavior?
10215 !! test
10216 msgnw keyword
10217 !! wikitext
10218 {{msgnw:MSGNW test}}
10219 !! html
10220 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10221 &#42; interpreted
10222 &#32;but rather passed unmodified
10223 &#123;&#123;test&#125;&#125;
10224 &#60;gallery&#62;
10225 File:Foobar.jpg
10226 &#60;/gallery&#62;
10227 </p>
10228 !! end
10229
10230 !! test
10231 int keyword
10232 !! wikitext
10233 {{int:youhavenewmessages|lots of money|not!}}
10234 !! html
10235 <p>You have lots of money (not!).
10236 </p>
10237 !! end
10238
10239 !! article
10240 Template:Includes
10241 !! text
10242 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10243 !! endarticle
10244
10245 !! test
10246 <includeonly> and <noinclude> being included
10247 !! wikitext
10248 {{Includes}}
10249 !! html
10250 <p>Foobar
10251 </p>
10252 !! end
10253
10254 !! article
10255 Template:Includes2
10256 !! text
10257 <onlyinclude>Foo</onlyinclude>bar
10258 !! endarticle
10259
10260 !! test
10261 <onlyinclude> being included
10262 !! wikitext
10263 {{Includes2}}
10264 !! html
10265 <p>Foo
10266 </p>
10267 !! end
10268
10269
10270 !! article
10271 Template:Includes3
10272 !! text
10273 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10274 !! endarticle
10275
10276 !! test
10277 <onlyinclude> and <includeonly> being included
10278 !! wikitext
10279 {{Includes3}}
10280 !! html
10281 <p>Foo
10282 </p>
10283 !! end
10284
10285 !! test
10286 <includeonly> and <noinclude> on a page
10287 !! wikitext
10288 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10289 !! html
10290 <p>Foozar
10291 </p>
10292 !! end
10293
10294 !! test
10295 Un-closed <noinclude>
10296 !! wikitext
10297 <noinclude>
10298 !! html
10299 !! end
10300
10301 !! test
10302 <onlyinclude> on a page
10303 !! wikitext
10304 <onlyinclude>Foo</onlyinclude>bar
10305 !! html
10306 <p>Foobar
10307 </p>
10308 !! end
10309
10310 !! test
10311 Un-closed <onlyinclude>
10312 !! wikitext
10313 <onlyinclude>
10314 !! html
10315 !! end
10316
10317 !!test
10318 Self-closed noinclude, includeonly, onlyinclude tags
10319 !! wikitext
10320 <noinclude />
10321 <includeonly />
10322 <onlyinclude />
10323 !! html
10324 <p><br />
10325 </p>
10326 !!end
10327
10328 !!test
10329 Unbalanced includeonly and noinclude tags
10330 !! wikitext
10331 {|
10332 |a</noinclude>
10333 |b</noinclude></noinclude>
10334 |c</noinclude></includeonly>
10335 |d</includeonly></includeonly>
10336 |}
10337 !! html
10338 <table>
10339 <tr>
10340 <td>a
10341 </td>
10342 <td>b
10343 </td>
10344 <td>c&lt;/includeonly&gt;
10345 </td>
10346 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10347 </td></tr></table>
10348
10349 !!end
10350
10351 !! article
10352 Template:Includeonly section
10353 !! text
10354 <includeonly>
10355 ==Includeonly section==
10356 </includeonly>
10357 ==Section T-1==
10358 !!endarticle
10359
10360 !! test
10361 Bug 6563: Edit link generation for section shown by <includeonly>
10362 !! wikitext
10363 {{includeonly section}}
10364 !! html
10365 <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>
10366 <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>
10367
10368 !! end
10369
10370 # Uses same input as the contents of [[Template:Includeonly section]]
10371 !! test
10372 Bug 6563: Section extraction for section shown by <includeonly>
10373 !! options
10374 section=T-2
10375 !! wikitext
10376 <includeonly>
10377 ==Includeonly section==
10378 </includeonly>
10379 ==Section T-2==
10380 !! html
10381 ==Section T-2==
10382 !! end
10383
10384 !! test
10385 Bug 6563: Edit link generation for section suppressed by <includeonly>
10386 !! wikitext
10387 <includeonly>
10388 ==Includeonly section==
10389 </includeonly>
10390 ==Section 1==
10391 !! html
10392 <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>
10393
10394 !! end
10395
10396 !! test
10397 Bug 6563: Section extraction for section suppressed by <includeonly>
10398 !! options
10399 section=1
10400 !! wikitext
10401 <includeonly>
10402 ==Includeonly section==
10403 </includeonly>
10404 ==Section 1==
10405 !! html
10406 ==Section 1==
10407 !! end
10408
10409 !! test
10410 Un-closed <includeonly>
10411 !! wikitext
10412 <includeonly>
10413 !! html
10414 !! end
10415
10416 !! test
10417 Includes and comments at SOL
10418 !! wikitext
10419 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10420
10421 <noinclude>
10422 some
10423 </noinclude>* stuff
10424 * here
10425
10426 <includeonly>can have stuff</includeonly>=== here ===
10427
10428 !! html/php
10429 <h2><span class="mw-headline" id="hu">hu</span></h2>
10430 <p>some
10431 </p>
10432 <ul><li> stuff</li>
10433 <li> here</li></ul>
10434 <h3><span class="mw-headline" id="here">here</span></h3>
10435
10436 !! html/parsoid
10437 <!-- 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>
10438
10439 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10440 <p>some</p>
10441 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10442 <li> here</li></ul>
10443
10444 <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>
10445
10446 !! end
10447
10448 # TODO: test with DOM fragment reuse!
10449 !! test
10450 Parsoid: DOM fragment reuse
10451 !! options
10452 parsoid=wt2wt,wt2html
10453 !! wikitext
10454 a{{echo|b<table></table>c}}d
10455
10456 a{{echo|b
10457 <table></table>
10458 c}}d
10459
10460 {{echo|a
10461
10462 <table></table>
10463
10464 b}}
10465 !! html
10466 <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","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
10467
10468 <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","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
10469 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10470 </span><p about="#mwt2">cd</p>
10471
10472 <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","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
10473
10474 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10475
10476 </span><p about="#mwt3">b</p>
10477 !! end
10478
10479 !! test
10480 Parsoid: Merge double tds (bug 50603)
10481 !! options
10482 parsoid
10483 !! wikitext
10484 {|
10485 |{{echo|{{!}} foo}}
10486 |}
10487 !! html
10488 <table><tbody>
10489 <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>
10490 </tbody></table>
10491 !! end
10492
10493 !! test
10494 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10495 !! options
10496 parsoid
10497 !! wikitext
10498 {{echo|<div>}}
10499 {|
10500 |{{echo|{{!}} foo}}
10501 |}
10502 {{echo|</div>}}
10503 !! html
10504 <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}}]}'>
10505 <table><tbody>
10506 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10507 </tbody></table>
10508 </div>
10509 !! end
10510
10511 ###
10512 ### <includeonly> and <noinclude> in attributes
10513 ###
10514 !!test
10515 0. includeonly around the entire attribute
10516 !! wikitext
10517 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10518 !! html
10519 <p><span id="v2">bar</span>
10520 </p>
10521 !!end
10522
10523 !!test
10524 1. includeonly in html attr key
10525 !! wikitext
10526 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10527 !! html
10528 <p><span id="foo">bar</span>
10529 </p>
10530 !!end
10531
10532 !!test
10533 2. includeonly in html attr value
10534 !! wikitext
10535 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10536 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10537 !! html
10538 <p><span id="v1">bar</span>
10539 <span id="v1">bar</span>
10540 </p>
10541 !!end
10542
10543 !!test
10544 3. includeonly in part of an attr value
10545 !! wikitext
10546 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10547 !! html
10548 <p><span style="color:red;">bar</span>
10549 </p>
10550 !!end
10551
10552 !!test
10553 4. includeonly in table attributes
10554 !! wikitext
10555 {|
10556 |- <noinclude>
10557 |-
10558 |a
10559 </noinclude>
10560 |- <includeonly>
10561 |-
10562 |b
10563 </includeonly>
10564 |}
10565 !! html
10566 <table>
10567
10568
10569 <tr>
10570 <td>a
10571 </td></tr>
10572 </table>
10573
10574 !!end
10575
10576 ###
10577 ### Token Stream Patcher tests
10578 ###
10579 ### These tests won't always pass wt2wt and other modes because
10580 ### on serialization, the table will be output on a new line.
10581 ### For now, we are blacklisting them, and using this to test selser.
10582 ###
10583
10584 !!test
10585 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10586 !!options
10587 parsoid=wt2html,wt2wt
10588 !!wikitext
10589 {{echo|}}{| width = '100%'
10590 |foo
10591 |}
10592 !!html/parsoid
10593 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10594 <tbody><tr><td>foo</td></tr>
10595 </tbody></table>
10596 !!end
10597
10598 !!test
10599 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10600 !!options
10601 parsoid=wt2html,wt2wt
10602 !!wikitext
10603 <includeonly>a</includeonly>{| {{{b}}}
10604 |c
10605 |}
10606 !!html/parsoid
10607 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
10608 <tbody><tr><td>c</td></tr>
10609 </tbody></table>
10610
10611 !!end
10612
10613 ###
10614 ### Testing parsing of templates where a template arg
10615 ### has the same name as the template itself.
10616 ###
10617
10618 !! article
10619 Template:quote
10620 !! text
10621 {{{quote|{{{1}}}}}}
10622 !! endarticle
10623
10624 !!test
10625 Templates: Template Name/Arg clash: 1. Use of positional param
10626 !! wikitext
10627 {{quote|foo}}
10628 !! html
10629 <p>foo
10630 </p>
10631 !!end
10632
10633 !!test
10634 Templates: Template Name/Arg clash: 2. Use of named param
10635 !! wikitext
10636 {{quote|quote=foo}}
10637 !! html
10638 <p>foo
10639 </p>
10640 !!end
10641
10642 !!test
10643 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10644 !! wikitext
10645 {{quote|quote}}
10646 !! html
10647 <p>quote
10648 </p>
10649 !!end
10650
10651 ###
10652 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10653 ###
10654
10655 !!test
10656 Templates: 1. Simple use
10657 !! wikitext
10658 {{echo|Foo}}
10659 !! html
10660 <p>Foo
10661 </p>
10662 !!end
10663
10664 !!test
10665 Templates: 2. Inside a block tag
10666 !! wikitext
10667 <div>{{echo|Foo}}</div>
10668 <blockquote>{{echo|Foo}}</blockquote>
10669 !! html
10670 <div>Foo</div>
10671 <blockquote>Foo</blockquote>
10672
10673 !! html+tidy
10674 <div>Foo</div>
10675 <blockquote>
10676 <p>Foo</p>
10677 </blockquote>
10678 !!end
10679
10680 !!test
10681 Templates: P-wrapping: 1a. Templates on consecutive lines
10682 !! wikitext
10683 {{echo|Foo}}
10684 {{echo|bar}}
10685 !! html
10686 <p>Foo
10687 bar
10688 </p>
10689 !!end
10690
10691 !!test
10692 Templates: P-wrapping: 1b. Templates on consecutive lines
10693 !! wikitext
10694 Foo
10695
10696 {{echo|bar}}
10697 {{echo|baz}}
10698 !! html
10699 <p>Foo
10700 </p><p>bar
10701 baz
10702 </p>
10703 !!end
10704
10705 !!test
10706 Templates: P-wrapping: 1c. Templates on consecutive lines
10707 !! wikitext
10708 {{echo|Foo}}
10709 {{echo|bar}} <div>baz</div>
10710 !! html
10711 <p>Foo
10712 </p>
10713 bar <div>baz</div>
10714
10715 !! html+tidy
10716 <p>Foo</p>
10717 <p>bar</p>
10718 <div>baz</div>
10719 !! end
10720
10721 !!test
10722 Templates: P-wrapping: 1d. Template preceded by comment-only line
10723 !!options
10724 parsoid
10725 !! wikitext
10726 <!-- foo -->
10727 {{echo|Bar}}
10728 !! html
10729 <!-- foo -->
10730
10731 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10732 !!end
10733
10734 !!test
10735 Templates: Inline Text: 1. Multiple template uses
10736 !! wikitext
10737 {{echo|Foo}}bar{{echo|baz}}
10738 !! html
10739 <p>Foobarbaz
10740 </p>
10741 !!end
10742
10743 !!test
10744 Templates: Inline Text: 2. Back-to-back template uses
10745 !! wikitext
10746 {{echo|Foo}}{{echo|bar}}
10747 !! html
10748 <p>Foobar
10749 </p>
10750 !!end
10751
10752 !!test
10753 Templates: Block Tags: 1. Multiple template uses
10754 !! wikitext
10755 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10756 !! html
10757 <div>Foo</div><div>bar</div><div>baz</div>
10758
10759 !!end
10760
10761 !!test
10762 Templates: Block Tags: 2. Back-to-back template uses
10763 !! wikitext
10764 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10765 !! html
10766 <div>Foo</div><div>bar</div>
10767
10768 !!end
10769
10770 # This is an edge case relating to paragraph wrapping.
10771 !!test
10772 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10773 !! wikitext
10774 {{echo|a
10775 b</p>}}
10776 !! html/parsoid
10777 <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
10778 b</p>
10779 !!end
10780
10781 !!test
10782 Templates: Links: 1. Simple example
10783 !! wikitext
10784 {{echo|[[Foo|bar]]}}
10785 !! html
10786 <p><a href="/wiki/Foo" title="Foo">bar</a>
10787 </p>
10788 !!end
10789
10790 !!test
10791 Templates: Links: 2. Generation of link href
10792 !! wikitext
10793 [[{{echo|Foo}}|bar]]
10794 !! html
10795 <p><a href="/wiki/Foo" title="Foo">bar</a>
10796 </p>
10797 !!end
10798
10799 !!test
10800 Templates: Links: 3. Generation of part of a link href
10801 !! wikitext
10802 [[Fo{{echo|o}}|bar]]
10803
10804 [[Foo{{echo|bar}}]]
10805
10806 [[Foo{{echo|bar}}baz]]
10807
10808 [[Foo{{echo|bar}}|bar]]
10809
10810 [[:Foo{{echo|bar}}]]
10811
10812 [[:Foo{{echo|bar}}|bar]]
10813 !! html
10814 <p><a href="/wiki/Foo" title="Foo">bar</a>
10815 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10816 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10817 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10818 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10819 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10820 </p>
10821 !!end
10822
10823 !!test
10824 Templates: Links: 4. Multiple templates generating link href
10825 !! wikitext
10826 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10827 !! html
10828 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10829 </p>
10830 !!end
10831
10832 !!test
10833 Templates: Links: 5. Generation of link text
10834 !! wikitext
10835 [[Foo|{{echo|bar}}]]
10836 !! html
10837 <p><a href="/wiki/Foo" title="Foo">bar</a>
10838 </p>
10839 !!end
10840
10841 !!test
10842 Templates: Links: 5. Nested templates (only outermost template should be marked)
10843 !! wikitext
10844 {{echo|[[{{echo|Foo}}|bar]]}}
10845 !! html
10846 <p><a href="/wiki/Foo" title="Foo">bar</a>
10847 </p>
10848 !!end
10849
10850 !!test
10851 Templates: HTML Tag: 1. Generation of HTML attr. key
10852 !! wikitext
10853 <div {{echo|style}}="color:red;">foo</div>
10854 !! html
10855 <div style="color:red;">foo</div>
10856
10857 !!end
10858
10859 !!test
10860 Templates: HTML Tag: 2. Generation of HTML attr. value
10861 !! wikitext
10862 <div style={{echo|'color:red;'}}>foo</div>
10863 !! html
10864 <div style="color:red;">foo</div>
10865
10866 !!end
10867
10868 !!test
10869 Templates: HTML Tag: 3. Generation of HTML attr key and value
10870 !! wikitext
10871 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10872 !! html
10873 <div style="color:red;">foo</div>
10874
10875 !!end
10876
10877 !!test
10878 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10879 !! wikitext
10880 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10881 !! html
10882 <div title="This is a long title with just one piece templated">foo</div>
10883
10884 !!end
10885
10886 !!test
10887 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10888 !! wikitext
10889 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10890 !! html
10891 <div title="This is a long title with just one piece templated">foo</div>
10892
10893 !!end
10894
10895 !!test
10896 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10897 !! wikitext
10898 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10899 !! html
10900 <div title="This is a long title with just one piece templated">foo</div>
10901
10902 !!end
10903
10904 # SSS FIXME: While it is great we added support for all this,
10905 # do we want to make this part of the spec? Maybe we want to
10906 # deprecate this kind of usage in the future?
10907 !!test
10908 Templates: HTML Tag: 7. Generation of partial attribute key string
10909 !! wikitext
10910 <div st{{echo|yle}}="color:red;">foo</div>
10911 !! html
10912 <div style="color:red;">foo</div>
10913
10914 !!end
10915
10916 !! test
10917 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10918 !! wikitext
10919 <div {{echo|1=id="v1"}}>bar</div>
10920 !! html
10921 <div id="v1">bar</div>
10922
10923 !!end
10924
10925 !! test
10926 Templates: HTML Tag: 9. Multiple template-generated attributes
10927 !! wikitext
10928 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10929 !! html
10930 <div id="v1" title="foo">bar</div>
10931
10932 !!end
10933
10934 !! test
10935 Templates: Support for templates generating attributes and content
10936 !! wikitext
10937 {| {{mixed_attr_content_template}}
10938 |-
10939 |bar
10940 |}
10941 !! html/php
10942 <table style="color:red;" title="T48811">
10943
10944 <tr>
10945 <td>foo
10946 </td></tr>
10947 <tr>
10948 <td>bar
10949 </td></tr></table>
10950
10951 !! html/parsoid
10952 <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|}"]}'>
10953 <tbody><tr>
10954 <td>foo</td></tr>
10955 <tr>
10956 <td>bar</td></tr>
10957 </tbody></table>
10958 !!end
10959
10960 !! test
10961 1. Entities and nowikis inside templated attributes should be handled correctly
10962 !! wikitext
10963 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
10964 !! html/php
10965 <div style="background:#f9f9f9;">foo</div>
10966
10967 !! html/parsoid
10968 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">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=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
10969 !! end
10970
10971 !! test
10972 2. Entities and nowikis inside templated attributes should be handled correctly
10973 !! wikitext
10974 {|
10975 |{{table_attribs_3}}
10976 |}
10977 !! html/php
10978 <table>
10979 <tr>
10980 <td style="background:#f9f9f9;">Foo
10981 </td></tr></table>
10982
10983 !! html/parsoid
10984 <table>
10985 <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>
10986 </tbody></table>
10987 !! end
10988
10989 !! test
10990 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
10991 !! wikitext
10992 {{tbl-start}}
10993 |{{table_attribs_3}}
10994 {{tbl-end}}
10995 !! html/php
10996 <table>
10997 <tr>
10998 <td style="background:#f9f9f9;">Foo
10999 </td></tr></table>
11000
11001 !! html/parsoid
11002 <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}}]}'>
11003 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11004 </tbody></table>
11005 !! end
11006
11007 !!test
11008 Templates: HTML Tables: 1. Generating start of a HTML table
11009 !! wikitext
11010 {{echo|<table><tr><td>foo</td>}}</tr></table>
11011 !! html
11012 <table><tr><td>foo</td></tr></table>
11013
11014 !!end
11015
11016 !!test
11017 Templates: HTML Tables: 2a. Generating middle of a HTML table
11018 !! wikitext
11019 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11020 !! html
11021 <table><tr><td>foo</td></tr></table>
11022
11023 !!end
11024
11025 !!test
11026 Templates: HTML Tables: 2b. Generating middle of a HTML table
11027 !! wikitext
11028 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11029 !! html
11030 <table><tr><td>foo</td></tr></table>
11031
11032 !!end
11033
11034 !!test
11035 Templates: HTML Tables: 3. Generating end of a HTML table
11036 !! wikitext
11037 <table><tr>{{echo|<td>foo</td></tr></table>}}
11038 !! html
11039 <table><tr><td>foo</td></tr></table>
11040
11041 !!end
11042
11043 !!test
11044 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11045 !! wikitext
11046 {{echo|<table>}}<tr><td>foo</td></tr></table>
11047 !! html
11048 <table><tr><td>foo</td></tr></table>
11049
11050 !!end
11051
11052 !!test
11053 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11054 !! wikitext
11055 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11056 !! html
11057 <table><tr><td>foo</td></tr></table>
11058
11059 !!end
11060
11061 !!test
11062 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11063 !! wikitext
11064 <table><tr>{{echo|<td>}}foo</td></tr></table>
11065 !! html
11066 <table><tr><td>foo</td></tr></table>
11067
11068 !!end
11069
11070 !!test
11071 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11072 !! wikitext
11073 <table><tr><td>foo{{echo|</td>}}</tr></table>
11074 !! html
11075 <table><tr><td>foo</td></tr></table>
11076
11077 !!end
11078
11079 !!test
11080 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11081 !! wikitext
11082 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11083 !! html
11084 <table><tr><td>foo</td></tr></table>
11085
11086 !!end
11087
11088 !!test
11089 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11090 !! wikitext
11091 <table><tr><td>foo</td></tr>{{echo|</table>}}
11092 !! html
11093 <table><tr><td>foo</td></tr></table>
11094
11095 !!end
11096
11097 !!test
11098 Templates: HTML Tables: 5. Proper fostering of categories from inside
11099 !!options
11100 parsoid=wt2html,wt2wt
11101 !! wikitext
11102 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11103 <!--Two categories (Bug 50330)-->
11104 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11105 !! html
11106 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11107 <!--Two categories (Bug 50330)-->
11108 <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>
11109 !!end
11110
11111 !!test
11112 Templates: Wiki Tables: 1a. Fostering of entire template content
11113 !! wikitext
11114 {|
11115 {{echo|a}}
11116 |}
11117 !! html
11118 <table>
11119 a
11120 <tr><td></td></tr></table>
11121
11122 !! html+tidy
11123 <p>a</p>
11124 <table>
11125 <tr>
11126 <td></td>
11127 </tr>
11128 </table>
11129 !! end
11130
11131 !!test
11132 Templates: Wiki Tables: 1b. Fostering of entire template content
11133 !! wikitext
11134 {|
11135 {{echo|<div>}}
11136 foo
11137 {{echo|</div>}}
11138 |}
11139 !! html
11140 <table>
11141 <div>
11142 <p>foo
11143 </p>
11144 </div>
11145 <tr><td></td></tr></table>
11146
11147 !! html+tidy
11148 <div>
11149 <p>foo</p>
11150 </div>
11151 <table>
11152 <tr>
11153 <td></td>
11154 </tr>
11155 </table>
11156 !! end
11157
11158 !!test
11159 Templates: Wiki Tables: 2. Fostering of partial template content
11160 !! wikitext
11161 {|
11162 {{echo|a
11163 <div>b</div>}}
11164 |}
11165 !! html
11166 <table>
11167 a
11168 <div>b</div>
11169 <tr><td></td></tr></table>
11170
11171 !! html+tidy
11172 <p>a</p>
11173 <div>b</div>
11174 <table>
11175 <tr>
11176 <td></td>
11177 </tr>
11178 </table>
11179 !! end
11180
11181 !!test
11182 Templates: Wiki Tables: 3. td-content via multiple templates
11183 !! wikitext
11184 {|
11185 {{echo|{{pipe}}a}}{{echo|b}}
11186 |}
11187 !! html
11188 <table>
11189 <tr>
11190 <td>ab
11191 </td></tr></table>
11192
11193 !!end
11194
11195 !!test
11196 Templates: Wiki Tables: 4. Templated tags, no content
11197 !! wikitext
11198 {{tbl-start}}
11199 {{tbl-end}}
11200 !! html
11201 <table>
11202 <tr><td></td></tr></table>
11203
11204 !!end
11205
11206 !!test
11207 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11208 !! wikitext
11209 {{tbl-start}}
11210 |foo
11211 {{tbl-end}}
11212 !! html
11213 <table>
11214 <tr>
11215 <td>foo
11216 </td></tr></table>
11217
11218 !!end
11219
11220 !!test
11221 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11222 !! wikitext
11223 {{tbl-start}}
11224 {{!}}foo
11225 {{tbl-end}}
11226 !! html
11227 <table>
11228 <tr>
11229 <td>foo
11230 </td></tr></table>
11231
11232 !!end
11233
11234 ## This test case is very specific to Parsoid's internals
11235 ## and is hence only tested for Parsoid's code. Parsoid uses
11236 ## a <meta> marker tag for <ref> tags and they are expanded
11237 ## much later. We are verifying that this <meta> tag usage
11238 ## doesn't prevent foster parenting.
11239 !!test
11240 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11241 !!wikitext
11242 {{PartialTable}}<ref>foo</ref>
11243 |}
11244
11245 <references />
11246 !!html/parsoid
11247 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
11248 <tbody>
11249 </tbody></table>
11250
11251 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
11252 !!end
11253
11254 !! test
11255 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11256 !! wikitext
11257 {{echo|
11258 {{{!}}
11259 {{!}}-}}
11260 <onlyinclude>
11261 |foo
11262 </onlyinclude>
11263 {{!}}}
11264 !! html/parsoid
11265 <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{{!}}}"]}'>
11266 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11267 <tbody><tr>
11268
11269 <td>foo
11270 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11271 </tbody></table>
11272 !! end
11273
11274 !!test
11275 Templates: Lists: Multi-line list-items via templates
11276 !! wikitext
11277 *{{echo|a {{nonexistent|
11278 unused}}}}
11279 *{{echo|b {{nonexistent|
11280 unused}}}}
11281 !! html
11282 <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>
11283 <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>
11284
11285 !!end
11286
11287 !!test
11288 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11289 !! wikitext
11290 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11291 !! html
11292 <p><i>ab</i>c<i>d</i>e
11293 </p>
11294 !!end
11295
11296 !!test
11297 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11298 (PHP parser generates misnested html)
11299 !! wikitext
11300 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11301 !! html/parsoid
11302 <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>
11303 !!end
11304
11305 !!test
11306 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11307 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11308 !! options
11309 parsoid=wt2html,wt2wt
11310 !! wikitext
11311 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11312 !! html
11313 <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>
11314 <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>
11315 <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>
11316 !!end
11317
11318 !!test
11319 Templates: Ugly nesting: 4. Divs opened/closed across templates
11320 !! wikitext
11321 a<div>b{{echo|c</div>d}}e
11322 !! html
11323 a<div>bc</div>de
11324
11325 !! html+tidy
11326 <p>a</p>
11327 <div>bc</div>
11328 <p>de</p>
11329 !! end
11330
11331 !!test
11332 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11333 (Parsoid-centric)
11334 !! options
11335 parsoid
11336 !! wikitext
11337 {|
11338 |{{echo|foo</table>}}
11339 |bar
11340 |}
11341 !! html
11342 <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|}"]}'>
11343
11344 <tbody>
11345 <tr>
11346 <td>foo</td></tr></tbody></table><span about="#mwt1">
11347 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11348 |}</span>
11349 !!end
11350
11351 !!test
11352 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11353 (Parsoid-centric)
11354 !! options
11355 parsoid
11356 !! wikitext
11357 <table>
11358 <tr>
11359 <td>
11360 <table>
11361 <tr>
11362 <td>1. {{echo|foo </table>}}</td>
11363 <td> bar </td>
11364 <td>2. {{echo|baz </table>}}</td>
11365 </tr>
11366 <tr>
11367 <td>abc</td>
11368 </tr>
11369 </table>
11370 </td>
11371 </tr>
11372 <tr>
11373 <td>xyz</td>
11374 </tr>
11375 </table>
11376 !! html
11377 <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>"]}'>
11378 <tbody><tr>
11379 <td>
11380 <table>
11381 <tbody><tr>
11382 <td>1. foo </td></tr></tbody></table></td>
11383 <td> bar </td>
11384 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11385 </span><span about="#mwt2">
11386 </span><span about="#mwt2">
11387 </span><span about="#mwt2">abc</span><span about="#mwt2">
11388 </span><span about="#mwt2">
11389 </span><span about="#mwt2">
11390 </span><span about="#mwt2">
11391 </span><span about="#mwt2">
11392 </span><span about="#mwt2">
11393 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11394 </span><span about="#mwt2">
11395 </span>
11396 !!end
11397
11398 !! test
11399 Templates: Ugly templates: 3. newline-only template parameter
11400 !! wikitext
11401 foo {{echo|
11402 }}
11403 !! html
11404 <p>foo
11405 </p>
11406 !! end
11407
11408 # This looks like a bug: a single newline triggers p/br for some reason.
11409 !! test
11410 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11411 !! wikitext
11412 {{echo|
11413 }}
11414 !! html
11415 <p><br />
11416 </p>
11417 !! end
11418
11419 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11420 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11421 !! test
11422 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11423 !! wikitext
11424 {{echo|<table>}}
11425 {{echo|<div>foo}}
11426 {{echo|</table>}}
11427 !! html/parsoid
11428 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
11429 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11430 </table>
11431 !! end
11432
11433 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11434 # that are "identical" and generate nesting cycles in the algorithm
11435 !! test
11436 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11437 !! wikitext
11438 {{echo|<table><tr><td><table>}}
11439 {{echo|<div>}}
11440 {{echo|</div>}}
11441 !! html/parsoid
11442 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
11443 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11444 </table></td></tr></tbody></table>
11445 !! end
11446
11447 !!test
11448 Parser Functions: 1. Simple example
11449 !! wikitext
11450 {{uc:foo}}
11451 !! html
11452 <p>FOO
11453 </p>
11454 !!end
11455
11456 !!test
11457 Parser Functions: 2. Nested use (only outermost should be marked up)
11458 !! wikitext
11459 {{uc:{{lc:FOO}}}}
11460 !! html
11461 <p>FOO
11462 </p>
11463 !!end
11464
11465 ###
11466 ### Pre-save transform tests
11467 ###
11468 !! test
11469 pre-save transform: subst:
11470 !! options
11471 PST
11472 !! wikitext
11473 {{subst:test}}
11474 !! html
11475 This is a test template
11476 !! end
11477
11478 !! test
11479 pre-save transform: normal template
11480 !! options
11481 PST
11482 !! wikitext
11483 {{test}}
11484 !! html
11485 {{test}}
11486 !! end
11487
11488 !! test
11489 pre-save transform: nonexistent template
11490 !! options
11491 PST
11492 !! wikitext
11493 {{thistemplatedoesnotexist}}
11494 !! html
11495 {{thistemplatedoesnotexist}}
11496 !! end
11497
11498
11499 !! test
11500 pre-save transform: subst magic variables
11501 !! options
11502 PST
11503 !! wikitext
11504 {{subst:SITENAME}}
11505 !! html
11506 MediaWiki
11507 !! end
11508
11509 # This is bug 89, which I fixed. -- wtm
11510 !! test
11511 pre-save transform: subst: templates with parameters
11512 !! options
11513 pst
11514 !! wikitext
11515 {{subst:paramtest|param="something else"}}
11516 !! html
11517 This is a test template with parameter "something else"
11518 !! end
11519
11520 !! article
11521 Template:nowikitest
11522 !! text
11523 <nowiki>'''not wiki'''</nowiki>
11524 !! endarticle
11525
11526 !! test
11527 pre-save transform: nowiki in subst (bug 1188)
11528 !! options
11529 pst
11530 !! wikitext
11531 {{subst:nowikitest}}
11532 !! html
11533 <nowiki>'''not wiki'''</nowiki>
11534 !! end
11535
11536
11537 !! article
11538 Template:commenttest
11539 !! text
11540 This template has <!-- a comment --> in it.
11541 !! endarticle
11542
11543 !! test
11544 pre-save transform: comment in subst (bug 1936)
11545 !! options
11546 pst
11547 !! wikitext
11548 {{subst:commenttest}}
11549 !! html
11550 This template has <!-- a comment --> in it.
11551 !! end
11552
11553 !! test
11554 pre-save transform: unclosed tag
11555 !! options
11556 pst noxml
11557 !! wikitext
11558 <nowiki>'''not wiki'''
11559 !! html
11560 <nowiki>'''not wiki'''
11561 !! end
11562
11563 !! test
11564 pre-save transform: mixed tag case
11565 !! options
11566 pst noxml
11567 !! wikitext
11568 <NOwiki>'''not wiki'''</noWIKI>
11569 !! html
11570 <NOwiki>'''not wiki'''</noWIKI>
11571 !! end
11572
11573 !! test
11574 pre-save transform: unclosed comment in <nowiki>
11575 !! options
11576 pst noxml
11577 !! wikitext
11578 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11579 !! html
11580 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11581 !!end
11582
11583 # Leading @ in this template definition works around a limitation
11584 # in parsoid's parserTests which otherwise strips the <span> from the
11585 # result (confusing it for a template wrapper)
11586 !! article
11587 Template:dangerous
11588 !!text
11589 @<span onmouseover="alert('crap')">Oh no</span>
11590 !!endarticle
11591
11592 !!test
11593 (confirming safety of fix for subst bug 1936)
11594 !! wikitext
11595 {{Template:dangerous}}
11596 !! html
11597 <p>@<span>Oh no</span>
11598 </p>
11599 !! end
11600
11601 !! test
11602 pre-save transform: comment containing gallery (bug 5024)
11603 !! options
11604 pst
11605 !! wikitext
11606 <!-- <gallery>data</gallery> -->
11607 !! html
11608 <!-- <gallery>data</gallery> -->
11609 !!end
11610
11611 !! test
11612 pre-save transform: comment containing extension
11613 !! options
11614 pst
11615 !! wikitext
11616 <!-- <tag>data</tag> -->
11617 !! html
11618 <!-- <tag>data</tag> -->
11619 !!end
11620
11621 !! test
11622 pre-save transform: comment containing nowiki
11623 !! options
11624 pst
11625 !! wikitext
11626 <!-- <nowiki>data</nowiki> -->
11627 !! html
11628 <!-- <nowiki>data</nowiki> -->
11629 !!end
11630
11631 !! test
11632 pre-save transform: <noinclude> in subst (bug 3298)
11633 !! options
11634 pst
11635 !! wikitext
11636 {{subst:Includes}}
11637 !! html
11638 Foobar
11639 !! end
11640
11641 !! test
11642 pre-save transform: <onlyinclude> in subst (bug 3298)
11643 !! options
11644 pst
11645 !! wikitext
11646 {{subst:Includes2}}
11647 !! html
11648 Foo
11649 !! end
11650
11651 !! article
11652 Template:SubstTest
11653 !!text
11654 {{<includeonly>subst:</includeonly>Includes}}
11655 !! endarticle
11656
11657 !! article
11658 Template:SafeSubstTest
11659 !! text
11660 {{<includeonly>safesubst:</includeonly>Includes}}
11661 !! endarticle
11662
11663 !! test
11664 bug 22297: safesubst: works during PST
11665 !! options
11666 pst
11667 !! wikitext
11668 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11669 !! html
11670 FoobarFoobar
11671 !! end
11672
11673 !! test
11674 bug 22297: safesubst: works during normal parse
11675 !! wikitext
11676 {{SafeSubstTest}}
11677 !! html
11678 <p>Foobar
11679 </p>
11680 !! end
11681
11682 !! test
11683 subst: does not work during normal parse
11684 !! wikitext
11685 {{SubstTest}}
11686 !! html
11687 <p>{{subst:Includes}}
11688 </p>
11689 !! end
11690
11691 !! test
11692 pre-save transform: context links ("pipe trick")
11693 !! options
11694 pst
11695 !! wikitext
11696 [[Article (context)|]]
11697 [[Bar:Article|]]
11698 [[:Bar:Article|]]
11699 [[Bar:Article (context)|]]
11700 [[:Bar:Article (context)|]]
11701 [[|Article]]
11702 [[|Article (context)]]
11703 [[Bar:X (Y) Z|]]
11704 [[:Bar:X (Y) Z|]]
11705 !! html
11706 [[Article (context)|Article]]
11707 [[Bar:Article|Article]]
11708 [[:Bar:Article|Article]]
11709 [[Bar:Article (context)|Article]]
11710 [[:Bar:Article (context)|Article]]
11711 [[Article]]
11712 [[Article (context)]]
11713 [[Bar:X (Y) Z|X (Y) Z]]
11714 [[:Bar:X (Y) Z|X (Y) Z]]
11715 !! end
11716
11717 !! test
11718 pre-save transform: context links ("pipe trick") with interwiki prefix
11719 !! options
11720 pst
11721 !! wikitext
11722 [[interwiki:Article|]]
11723 [[:interwiki:Article|]]
11724 [[interwiki:Bar:Article|]]
11725 [[:interwiki:Bar:Article|]]
11726 !! html
11727 [[interwiki:Article|Article]]
11728 [[:interwiki:Article|Article]]
11729 [[interwiki:Bar:Article|Bar:Article]]
11730 [[:interwiki:Bar:Article|Bar:Article]]
11731 !! end
11732
11733 !! test
11734 pre-save transform: context links ("pipe trick") with parens in title
11735 !! options
11736 pst title=[[Somearticle (context)]]
11737 !! wikitext
11738 [[|Article]]
11739 !! html
11740 [[Article (context)|Article]]
11741 !! end
11742
11743 !! test
11744 pre-save transform: context links ("pipe trick") with comma in title
11745 !! options
11746 pst title=[[Someplace, Somewhere]]
11747 !! wikitext
11748 [[|Otherplace]]
11749 [[Otherplace, Elsewhere|]]
11750 [[Otherplace, Elsewhere, Anywhere|]]
11751 !! html
11752 [[Otherplace, Somewhere|Otherplace]]
11753 [[Otherplace, Elsewhere|Otherplace]]
11754 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11755 !! end
11756
11757 !! test
11758 pre-save transform: context links ("pipe trick") with parens and comma
11759 !! options
11760 pst title=[[Someplace (IGNORED), Somewhere]]
11761 !! wikitext
11762 [[|Otherplace]]
11763 [[Otherplace (place), Elsewhere|]]
11764 !! html
11765 [[Otherplace, Somewhere|Otherplace]]
11766 [[Otherplace (place), Elsewhere|Otherplace]]
11767 !! end
11768
11769 !! test
11770 pre-save transform: context links ("pipe trick") with comma and parens
11771 !! options
11772 pst title=[[Who, me? (context)]]
11773 !! wikitext
11774 [[|Yes, you.]]
11775 [[Me, Myself, and I (1937 song)|]]
11776 !! html
11777 [[Yes, you. (context)|Yes, you.]]
11778 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11779 !! end
11780
11781 !! test
11782 pre-save transform: context links ("pipe trick") with namespace
11783 !! options
11784 pst title=[[Ns:Somearticle]]
11785 !! wikitext
11786 [[|Article]]
11787 !! html
11788 [[Ns:Article|Article]]
11789 !! end
11790
11791 !! test
11792 pre-save transform: context links ("pipe trick") with namespace and parens
11793 !! options
11794 pst title=[[Ns:Somearticle (context)]]
11795 !! wikitext
11796 [[|Article]]
11797 !! html
11798 [[Ns:Article (context)|Article]]
11799 !! end
11800
11801 !! test
11802 pre-save transform: context links ("pipe trick") with namespace and comma
11803 !! options
11804 pst title=[[Ns:Somearticle, Context, Whatever]]
11805 !! wikitext
11806 [[|Article]]
11807 !! html
11808 [[Ns:Article, Context, Whatever|Article]]
11809 !! end
11810
11811 !! test
11812 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11813 !! options
11814 pst title=[[Ns:Somearticle, Context (context)]]
11815 !! wikitext
11816 [[|Article]]
11817 !! html
11818 [[Ns:Article (context)|Article]]
11819 !! end
11820
11821 !! test
11822 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11823 !! options
11824 pst title=[[Ns:Somearticle (IGNORED), Context]]
11825 !! wikitext
11826 [[|Article]]
11827 !! html
11828 [[Ns:Article, Context|Article]]
11829 !! end
11830
11831 !! test
11832 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11833 !! options
11834 pst
11835 !! wikitext
11836 [[Article(context)|]]
11837 [[Bar:Article(context)|]]
11838 [[:Bar:Article(context)|]]
11839 [[|Article(context)]]
11840 [[Bar:X(Y)Z|]]
11841 [[:Bar:X(Y)Z|]]
11842 !! html
11843 [[Article(context)|Article]]
11844 [[Bar:Article(context)|Article]]
11845 [[:Bar:Article(context)|Article]]
11846 [[Article(context)]]
11847 [[Bar:X(Y)Z|X(Y)Z]]
11848 [[:Bar:X(Y)Z|X(Y)Z]]
11849 !! end
11850
11851 !! test
11852 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11853 !! options
11854 pst
11855 !! wikitext
11856 [[Article (context)|]]
11857 [[Bar:Article (context)|]]
11858 [[:Bar:Article (context)|]]
11859 [[|Article (context)]]
11860 [[Bar:X (Y) Z|]]
11861 [[:Bar:X (Y) Z|]]
11862 !! html
11863 [[Article (context)|Article]]
11864 [[Bar:Article (context)|Article]]
11865 [[:Bar:Article (context)|Article]]
11866 [[Article (context)]]
11867 [[Bar:X (Y) Z|X (Y) Z]]
11868 [[:Bar:X (Y) Z|X (Y) Z]]
11869 !! end
11870
11871 !! test
11872 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11873 !! options
11874 pst
11875 !! wikitext
11876 [[Article(context)|]]
11877 [[Bar:Article(context)|]]
11878 [[:Bar:Article(context)|]]
11879 [[|Article(context)]]
11880 [[Bar:X(Y)Z|]]
11881 [[:Bar:X(Y)Z|]]
11882 !! html
11883 [[Article(context)|Article]]
11884 [[Bar:Article(context)|Article]]
11885 [[:Bar:Article(context)|Article]]
11886 [[Article(context)]]
11887 [[Bar:X(Y)Z|X(Y)Z]]
11888 [[:Bar:X(Y)Z|X(Y)Z]]
11889 !! end
11890
11891 !! test
11892 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11893 !! options
11894 pst
11895 !! wikitext
11896 [[Article (context), context|]]
11897 [[Article (context),context|]]
11898 [[Bar:Article (context), context|]]
11899 [[Bar:Article (context),context|]]
11900 [[:Bar:Article (context), context|]]
11901 [[:Bar:Article (context),context|]]
11902 !! html
11903 [[Article (context), context|Article]]
11904 [[Article (context),context|Article]]
11905 [[Bar:Article (context), context|Article]]
11906 [[Bar:Article (context),context|Article]]
11907 [[:Bar:Article (context), context|Article]]
11908 [[:Bar:Article (context),context|Article]]
11909 !! end
11910
11911 !! test
11912 pre-save transform: trim trailing empty lines
11913 !! options
11914 pst
11915 !! wikitext
11916 Empty lines are trimmed
11917
11918
11919
11920
11921 !! html
11922 Empty lines are trimmed
11923 !! end
11924
11925 !! test
11926 pre-save transform: Signature expansion
11927 !! options
11928 pst
11929 !! wikitext
11930 * ~~~
11931 * <noinclude>~~~</noinclude>
11932 * <includeonly>~~~</includeonly>
11933 * <onlyinclude>~~~</onlyinclude>
11934 !! html
11935 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11936 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11937 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11938 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11939 !! end
11940
11941
11942 !! test
11943 pre-save transform: Signature expansion in nowiki tags (bug 93)
11944 !! options
11945 pst disabled
11946 !! wikitext
11947 Shall not expand:
11948
11949 <nowiki>~~~~</nowiki>
11950
11951 <includeonly><nowiki>~~~~</nowiki></includeonly>
11952
11953 <noinclude><nowiki>~~~~</nowiki></noinclude>
11954
11955 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11956
11957 {{subst:Foo}} shall be converted to FOO
11958
11959 As well as inside noinclude/onlyinclude
11960 <noinclude>{{subst:Foo}}</noinclude>
11961 <onlyinclude>{{subst:Foo}}</onlyinclude>
11962
11963 But not inside includeonly
11964 <includeonly>{{subst:Foo}}</includeonly>
11965 !! html
11966 Shall not expand:
11967
11968 <nowiki>~~~~</nowiki>
11969
11970 <includeonly><nowiki>~~~~</nowiki></includeonly>
11971
11972 <noinclude><nowiki>~~~~</nowiki></noinclude>
11973
11974 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11975
11976 FOO shall be converted to FOO
11977
11978 As well as inside noinclude/onlyinclude
11979 <noinclude>FOO</noinclude>
11980 <onlyinclude>FOO</onlyinclude>
11981
11982 But not inside includeonly
11983 <includeonly>{{subst:Foo}}</includeonly>
11984 !! end
11985
11986 !! test
11987 Parsoid: Recognize nowiki with trailing space in tags
11988 !! options
11989 parsoid=wt2html
11990 !! wikitext
11991 <nowiki ><div>[[foo]]</nowiki >
11992
11993 a<nowiki / >b
11994
11995 c<nowiki />d
11996
11997 e<nowiki/ >f
11998 !! html
11999 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12000 <p>ab</p>
12001 <p>cd</p>
12002 <p>ef</p>
12003 !! end
12004
12005 !! test
12006 Parsoid: Recognize nowiki with odd capitalization
12007 !! options
12008 parsoid=wt2html
12009 !! wikitext
12010 <noWikI ><div>[[foo]]</Nowiki >
12011 !! html
12012 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12013 !! end
12014
12015
12016 !! test
12017 Parsoid: Escape nowiki with trailing space in tags
12018 !! options
12019 parsoid=html2wt
12020 !! html
12021 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12022 <p>a&lt;nowiki /&gt;b</p>
12023 <p>c&lt;nowiki/ &gt;d</p>
12024 !! wikitext
12025 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12026
12027 a&lt;nowiki /&gt;b
12028
12029 c&lt;nowiki/ &gt;d
12030 !! end
12031
12032 !! test
12033 Parsoid: Escape weird noWikI capitalizations
12034 !! options
12035 parsoid=html2wt
12036 !! html
12037 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12038 !! wikitext
12039 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12040 !! end
12041
12042 ###
12043 ### Message transform tests
12044 ###
12045 !! test
12046 message transform: magic variables
12047 !! options
12048 msg
12049 !! wikitext
12050 {{SITENAME}}
12051 !! html
12052 MediaWiki
12053 !! end
12054
12055 !! test
12056 message transform: should not transform wiki markup
12057 !! options
12058 msg
12059 !! wikitext
12060 ''test''
12061 !! html
12062 ''test''
12063 !! end
12064
12065 !! test
12066 message transform: <noinclude> in transcluded template (bug 4926)
12067 !! options
12068 msg
12069 !! wikitext
12070 {{Includes}}
12071 !! html
12072 Foobar
12073 !! end
12074
12075 !! test
12076 message transform: <onlyinclude> in transcluded template (bug 4926)
12077 !! options
12078 msg
12079 !! wikitext
12080 {{Includes2}}
12081 !! html
12082 Foo
12083 !! end
12084
12085 !! test
12086 {{#special:}} page name, known
12087 !! options
12088 msg
12089 !! wikitext
12090 {{#special:Recentchanges}}
12091 !! html
12092 Special:RecentChanges
12093 !! end
12094
12095 !! test
12096 {{#special:}} page name with subpage, known
12097 !! options
12098 msg
12099 !! wikitext
12100 {{#special:Recentchanges/param}}
12101 !! html
12102 Special:RecentChanges/param
12103 !! end
12104
12105 !! test
12106 {{#special:}} page name, unknown
12107 !! options
12108 msg
12109 !! wikitext
12110 {{#special:foobar nonexistent}}
12111 !! html
12112 Special:Foobar nonexistent
12113 !! end
12114
12115 !! test
12116 {{#speciale:}} page name, known
12117 !! options
12118 msg
12119 !! wikitext
12120 {{#speciale:Recentchanges}}
12121 !! html
12122 Special:RecentChanges
12123 !! end
12124
12125 !! test
12126 {{#speciale:}} page name with subpage, known
12127 !! options
12128 msg
12129 !! wikitext
12130 {{#speciale:Recentchanges/param}}
12131 !! html
12132 Special:RecentChanges/param
12133 !! end
12134
12135 !! test
12136 {{#speciale:}} page name, unknown
12137 !! options
12138 msg
12139 !! wikitext
12140 {{#speciale:foobar nonexistent}}
12141 !! html
12142 Special:Foobar_nonexistent
12143 !! end
12144
12145 ###
12146 ### Images
12147 ###
12148 ### For Parsoid-specific tests, see
12149 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12150
12151 !! test
12152 Simple image
12153 !! options
12154 parsoid=wt2html,wt2wt,html2html
12155 !! wikitext
12156 [[Image:foobar.jpg]]
12157 !! html/php
12158 <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>
12159 </p>
12160 !! html/parsoid
12161 <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>
12162 !! end
12163
12164 !! test
12165 Simple image (using File: namespace, now canonical)
12166 !! wikitext
12167 [[File:Foobar.jpg]]
12168 !! html/php
12169 <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>
12170 </p>
12171 !! html/parsoid
12172 <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>
12173 !! end
12174
12175 !! test
12176 Right-aligned image
12177 !! wikitext
12178 [[File:Foobar.jpg|right]]
12179 !! html/php
12180 <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>
12181
12182 !! html/parsoid
12183 <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>
12184 !! end
12185
12186 !! test
12187 Image with caption
12188 !! wikitext
12189 [[File:Foobar.jpg|right|Caption text]]
12190 !! html/php
12191 <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>
12192
12193 !! html/parsoid
12194 <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>
12195 !! end
12196
12197 !! test
12198 Image with caption, bug 53312 #1
12199 !! wikitext
12200 [[File:Foobar.jpg|right|Caption page stuff]]
12201 !! html/php
12202 <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>
12203
12204 !! html/parsoid
12205 <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>
12206 !! end
12207
12208 !! test
12209 Image with caption, bug 53312 #2
12210 !! wikitext
12211 [[File:Foobar.jpg|right|Caption page=]]
12212 !! html/php
12213 <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>
12214
12215 !! html/parsoid
12216 <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>
12217 !! end
12218
12219 !! test
12220 Image with caption, bug 53312 #3
12221 !! wikitext
12222 [[File:Foobar.jpg|right|Caption page=stuff]]
12223 !! html/php
12224 <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>
12225
12226 !! html/parsoid
12227 <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>
12228 !! end
12229
12230 !! test
12231 Allow empty links in image captions (Bug 60753)
12232 !! options
12233 thumbsize=220
12234 !! wikitext
12235 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12236 [[]]
12237 [[Link2]]
12238 ]]
12239 !! html/php
12240 <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>
12241
12242 !! html/parsoid
12243 <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>
12244 [[]]
12245 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12246 </figcaption></figure>
12247 !! end
12248
12249 !! test
12250 Titles in unlinked images (T23454)
12251 !! wikitext
12252 [[File:Foobar.jpg|link=|stuff]]
12253 !! html/php
12254 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12255 </p>
12256 !! end
12257
12258 !! test
12259 Link with empty target
12260 !! wikitext
12261 [[]]
12262 !! html
12263 <p>[[]]
12264 </p>
12265 !! end
12266
12267 !! test
12268 Image with link trail
12269 !! wikitext
12270 Linktrails should not work for images: [[File:Foobar.jpg]]s
12271 !! html/php
12272 <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
12273 </p>
12274 !! html/parsoid
12275 <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>
12276 !! end
12277
12278 !! test
12279 Image with empty attribute
12280 !! options
12281 parsoid=wt2html,wt2wt,html2html
12282 !! wikitext
12283 [[File:Foobar.jpg|right||Caption text]]
12284 !! html/php
12285 <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>
12286
12287 !! html/parsoid
12288 <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>
12289 !! end
12290
12291 !! test
12292 1. Block image with individual attributes from templates
12293 !! wikitext
12294 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12295 !! html/php
12296 <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>
12297
12298 !! html/parsoid
12299 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><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"/></a><figcaption>This is a caption</figcaption></figure>
12300 !! end
12301
12302 !! test
12303 2. Block Image with individual attributes from templates
12304 !! wikitext
12305 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12306 !! html/php
12307 <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>
12308
12309 !! html/parsoid
12310 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><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"/></a><figcaption>This is a caption</figcaption></figure>
12311 !! end
12312
12313 !! test
12314 3. Inline image with individual attributes from templates
12315 !! wikitext
12316 [[File:Foobar.jpg|{{echo|50px}}]]
12317 !! html/php
12318 <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>
12319 </p>
12320 !! html/parsoid
12321 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">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"/></a></span></p>
12322 !! end
12323
12324 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12325 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12326 !! test
12327 Image with multiple attributes from the same template
12328 !! wikitext
12329 [[File:Foobar.jpg|{{image_attribs}}]]
12330 !! html/php
12331 <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>
12332
12333 !! html/parsoid
12334 <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>
12335 !! end
12336
12337 !! test
12338 Image with link tails
12339 !! options
12340 thumbsize=220
12341 !! wikitext
12342 123[[File:Foobar.jpg]]456
12343 123[[File:Foobar.jpg|right]]456
12344 123[[File:Foobar.jpg|thumb]]456
12345 !! html/php
12346 <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
12347 </p>
12348 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
12349 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
12350
12351 !! html/php+tidy
12352 <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>
12353 <p>123</p>
12354 <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>
12355 <p>456 123</p>
12356 <div class="thumb tright">
12357 <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>
12358 <div class="thumbcaption">
12359 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12360 </div>
12361 </div>
12362 </div>
12363 <p>456</p>
12364 !! html/parsoid
12365 <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>
12366 <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>
12367 <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>
12368 !! end
12369
12370 !! test
12371 Image with multiple captions -- only last one is accepted
12372 !! wikitext
12373 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12374 !! html/php
12375 <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>
12376
12377 !! html/parsoid
12378 <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>
12379 !! end
12380
12381 !! test
12382 Image with multiple widths -- use last
12383 !! wikitext
12384 [[File:Foobar.jpg|200px|300px|caption]]
12385 !! html/php
12386 <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>
12387 </p>
12388 !! html/parsoid
12389 <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>
12390 !! end
12391
12392 !! test
12393 Image with multiple alignments -- use first (bug 48664)
12394 !! options
12395 thumbsize=220
12396 !! wikitext
12397 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12398
12399 [[File:Foobar.jpg|middle|text-top|caption]]
12400 !! html/php
12401 <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>
12402 <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>
12403 </p>
12404 !! html/parsoid
12405 <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>
12406 <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>
12407 !! end
12408
12409 !! test
12410 Image with width attribute at different positions
12411 !! wikitext
12412 [[File:Foobar.jpg|200px|right|Caption]]
12413 [[File:Foobar.jpg|right|200px|Caption]]
12414 [[File:Foobar.jpg|right|Caption|200px]]
12415 !! html/php
12416 <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>
12417 <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>
12418 <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>
12419
12420 !! html/parsoid
12421 <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>
12422 <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>
12423 <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>
12424 !! end
12425
12426 # a sad bit of backward-compatibility
12427 !! test
12428 Image with size specified with pxpx (bug 13500, 51628)
12429 !! options
12430 parsoid=wt2html,wt2wt,html2html
12431 !! wikitext
12432 [[File:Foobar.jpg|20pxpx]]
12433 [[File:Foobar.jpg|200x20pxpx]]
12434 !! html/php
12435 <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>
12436 <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>
12437 </p>
12438 !! html/parsoid
12439 <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>
12440 !! end
12441
12442 !! test
12443 Image with link parameter, wiki target
12444 !! wikitext
12445 [[File:Foobar.jpg|link=Main Page]]
12446 !! html/php
12447 <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>
12448 </p>
12449 !! html/parsoid
12450 <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>
12451 !! end
12452
12453 # parsoid bug 49293 (part 1)
12454 !! test
12455 Image with link parameter, URL target
12456 !! wikitext
12457 [[File:Foobar.jpg|link=http://example.com/]]
12458 !! html/php
12459 <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>
12460 </p>
12461 !! html/parsoid
12462 <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>
12463 !! end
12464
12465 # parsoid bug 49293 (part 2)
12466 !! test
12467 Image with link parameter, protocol-less URL target
12468 !! wikitext
12469 [[File:Foobar.jpg|link=//example.com/]]
12470 !! html/php
12471 <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>
12472 </p>
12473 !! html/parsoid
12474 <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>
12475 !! end
12476
12477 !! test
12478 Image with link parameter, wgExternalLinkTarget
12479 !! wikitext
12480 [[Image:foobar.jpg|link=http://example.com/]]
12481 !! config
12482 wgExternalLinkTarget='foobar'
12483 !! html
12484 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12485 </p>
12486 !! end
12487
12488 !! test
12489 Image with link parameter, wgNoFollowLinks set to false
12490 !! wikitext
12491 [[Image:foobar.jpg|link=http://example.com/]]
12492 !! config
12493 wgNoFollowLinks=false
12494 !! html
12495 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12496 </p>
12497 !! end
12498
12499 !! test
12500 Image with link parameter, wgNoFollowDomainExceptions
12501 !! wikitext
12502 [[Image:foobar.jpg|link=http://example.com/]]
12503 !! config
12504 wgNoFollowDomainExceptions='example.com'
12505 !! html
12506 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12507 </p>
12508 !! end
12509
12510 !! test
12511 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12512 !! wikitext
12513 [[Image:foobar.jpg|link=http://example.com/|Title]]
12514 !! config
12515 wgExternalLinkTarget='foobar'
12516 !! html
12517 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12518 </p>
12519 !! end
12520
12521 !! test
12522 Image with empty link parameter
12523 !! wikitext
12524 [[File:Foobar.jpg|link=]]
12525 !! html/php
12526 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12527 </p>
12528 !! html/parsoid
12529 <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>
12530 !! end
12531
12532 !! test
12533 Image with link parameter (wiki target) and unnamed parameter
12534 !! wikitext
12535 [[File:Foobar.jpg|link=Main_Page|Title]]
12536 !! html/php
12537 <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>
12538 </p>
12539 !! html/parsoid
12540 <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>
12541 !! end
12542
12543 !! test
12544 Image with link parameter (URL target) and unnamed parameter
12545 !! wikitext
12546 [[File:Foobar.jpg|link=http://example.com/|Title]]
12547 !! html/php
12548 <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>
12549 </p>
12550 !! html/parsoid
12551 <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>
12552 !! end
12553
12554 !! test
12555 Thumbnail image with link parameter
12556 !! options
12557 thumbsize=220
12558 parsoid=wt2html,wt2wt,html2html
12559 !! wikitext
12560 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12561 !! html/php
12562 <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>
12563
12564 !! html/parsoid
12565 <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>
12566 !! end
12567
12568 !! test
12569 Manually-specified thumbnail image
12570 !! options
12571 thumbsize=220
12572 !! wikitext
12573 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12574 !! html/php
12575 <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>
12576
12577 !! html/parsoid
12578 <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>
12579 !! end
12580
12581 !! test
12582 Manually-specified thumbnail image with explicit link to wiki page
12583 !! options
12584 thumbsize=220
12585 parsoid=wt2html,wt2wt,html2html
12586 !! wikitext
12587 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12588 !! html/php
12589 <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>
12590
12591 !! html/parsoid
12592 <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>
12593 !! end
12594
12595 !! test
12596 Manually-specified thumbnail image with explicit link to url
12597 !! options
12598 thumbsize=220
12599 parsoid=wt2html,wt2wt,html2html
12600 !! wikitext
12601 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12602 !! html/php
12603 <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>
12604
12605 !! html/parsoid
12606 <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>
12607 !! end
12608
12609 !! test
12610 Manually-specified thumbnail image with explicit no link
12611 !! options
12612 thumbsize=220
12613 parsoid=wt2html,wt2wt,html2html
12614 !! wikitext
12615 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12616 !! html/php
12617 <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>
12618
12619 !! html/parsoid
12620 <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>
12621 !! end
12622
12623 !! test
12624 Manually-specified thumbnail image with explicit link and alt text
12625 !! options
12626 thumbsize=220
12627 parsoid=wt2html,wt2wt,html2html
12628 !! wikitext
12629 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12630 !! html/php
12631 <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>
12632
12633 !! html/parsoid
12634 <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>
12635 !! end
12636
12637 !! test
12638 Image with frame and link
12639 !! options
12640 parsoid=wt2html,wt2wt,html2html
12641 !! wikitext
12642 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12643 !! html/php
12644 <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>
12645
12646 !! html/parsoid
12647 <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>
12648 !! end
12649
12650 !! test
12651 Image with frame and link and explicit alt
12652 !! options
12653 parsoid=wt2html,wt2wt,html2html
12654 !! wikitext
12655 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12656 !! html/php
12657 <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>
12658
12659 !! html/parsoid
12660 <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>
12661 !! end
12662
12663 !! test
12664 Image with wiki markup in implicit alt
12665 !! options
12666 parsoid=wt2html,wt2wt,html2html
12667 !! wikitext
12668 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12669
12670 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12671 !! html/php
12672 <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>
12673 </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>
12674 </p>
12675 !! html/parsoid
12676 <p><span class="mw-default-size" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;testing '''bold''' in alt&quot;}"><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>
12677 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><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"/></a></span></p>
12678 !! end
12679
12680 !! test
12681 Alt image option should handle most kinds of wikitext without barfing
12682 !! wikitext
12683 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12684 !! html/php
12685 <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>
12686
12687 !! html/parsoid
12688 <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=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">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>
12689 !! end
12690
12691 ###################
12692 # Conflicting image format options.
12693 # First option specified should 'win'.
12694 # All three cases in each test should be identical.
12695
12696 !! test
12697 Image with 'frameless' first.
12698 !! options
12699 parsoid=wt2html,wt2wt,html2html
12700 !! wikitext
12701 [[File:Foobar.jpg|frameless|caption]]
12702
12703 [[File:Foobar.jpg|frameless|frame|caption]]
12704
12705 [[File:Foobar.jpg|frameless|thumb|caption]]
12706 !! html/php
12707 <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>
12708 </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>
12709 </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>
12710 </p>
12711 !! html/parsoid
12712 <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>
12713 <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>
12714 <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>
12715 !! end
12716
12717 !! test
12718 Image with 'frame' first.
12719 !! options
12720 parsoid=wt2html,wt2wt,html2html
12721 !! wikitext
12722 [[File:Foobar.jpg|frame|caption]]
12723 [[File:Foobar.jpg|frame|frameless|caption]]
12724 [[File:Foobar.jpg|frame|thumb|caption]]
12725 !! html/php
12726 <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>
12727 <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>
12728 <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>
12729
12730 !! html/parsoid
12731 <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>
12732 <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>
12733 <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>
12734 !! end
12735
12736 !! test
12737 Image with 'thumb' first.
12738 !! options
12739 parsoid=wt2html,wt2wt,html2html
12740 !! wikitext
12741 [[File:Foobar.jpg|thumb|caption]]
12742 [[File:Foobar.jpg|thumb|frameless|caption]]
12743 [[File:Foobar.jpg|thumb|frame|caption]]
12744 !! html/php
12745 <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>
12746 <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>
12747 <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>
12748
12749 !! html/parsoid
12750 <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>
12751 <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>
12752 <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>
12753 !! end
12754
12755 ###################
12756 # Image sizing.
12757 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12758 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12759 # Foobar has actual size of 1941x220
12760 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12761 # a scalable format.
12762 # 2. Framed images always ignore size options; always render at default size.
12763 # 3. "Unspecified format" and border are the only types which can be
12764 # enlarged.
12765
12766 !! test
12767 Image: "unspecified format" and border enlarge
12768 !! options
12769 parsoid=wt2html,wt2wt,html2html
12770 !! wikitext
12771 [[File:Foobar.jpg|2000px]]
12772
12773 [[File:Foobar.jpg|border|2000px]]
12774 !! html/php
12775 <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>
12776 </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>
12777 </p>
12778 !! html/parsoid
12779 <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>
12780 <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>
12781 !! end
12782
12783 !! test
12784 Image: "unspecified format" and border reduce
12785 !! options
12786 parsoid=wt2html,wt2wt,html2html
12787 !! wikitext
12788 [[File:Foobar.jpg|1000px]]
12789
12790 [[File:Foobar.jpg|border|1000px]]
12791 !! html/php
12792 <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>
12793 </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>
12794 </p>
12795 !! html/parsoid
12796 <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>
12797 <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>
12798 !! end
12799
12800 !! test
12801 Image: thumbs reduce
12802 !! options
12803 parsoid=wt2html,wt2wt,html2html
12804 !! wikitext
12805 [[File:Foobar.jpg|thumb|50px]]
12806 !! html/php
12807 <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>
12808
12809 !! html/parsoid
12810 <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>
12811 !! end
12812
12813 !! test
12814 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12815 !! options
12816 parsoid=wt2html,wt2wt,html2html
12817 !! wikitext
12818 [[File:Foobar.jpg|thumb|2000px]]
12819
12820 [[File:Foobar.svg|thumb|2000px]]
12821 !! html/php
12822 <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>
12823 <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>
12824
12825 !! html/parsoid
12826 <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>
12827 <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>
12828 !! end
12829
12830 !! test
12831 Image: frameless can reduce in size
12832 !! options
12833 parsoid=wt2html,wt2wt,html2html
12834 !! wikitext
12835 [[File:Foobar.jpg|frameless|50px]]
12836 !! html/php
12837 <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>
12838 </p>
12839 !! html/parsoid
12840 <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>
12841 !! end
12842
12843 !! test
12844 Image: bitmap frameless can't be enlarged past original size, but vector can
12845 !! options
12846 parsoid=wt2html,wt2wt,html2html
12847 !! wikitext
12848 [[File:Foobar.jpg|frameless|2000px]]
12849
12850 [[File:Foobar.svg|frameless|2000px]]
12851 !! html/php
12852 <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>
12853 </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>
12854 </p>
12855 !! html/parsoid
12856 <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>
12857 <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>
12858 !! end
12859
12860 !! test
12861 Image: framed images are always unscaled.
12862 !! options
12863 parsoid=wt2html,wt2wt,html2html
12864 !! wikitext
12865 [[File:Foobar.jpg|frame]]
12866
12867 [[File:Foobar.jpg|frame|50px]]
12868
12869 [[File:Foobar.jpg|frame|50x50px]]
12870
12871 [[File:Foobar.jpg|frame|2000px]]
12872 !! html/php
12873 <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>
12874 <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>
12875 <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>
12876 <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>
12877
12878 !! html/parsoid
12879 <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>
12880 <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>
12881 <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>
12882 <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>
12883 !! end
12884
12885 ###################
12886
12887 !! test
12888 Link to image page- image page normally doesn't exists, hence edit link
12889 Add test with existing image page
12890 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12891 !! wikitext
12892 [[:Image:test]]
12893 !! html
12894 <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>
12895 </p>
12896 !! end
12897
12898 !! test
12899 bug 18784 Link to non-existent image page with caption should use caption as link text
12900 !! wikitext
12901 [[:Image:test|caption]]
12902 !! html
12903 <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>
12904 </p>
12905 !! end
12906
12907 !! test
12908 Frameless image caption with a free URL
12909 !! wikitext
12910 [[File:Foobar.jpg|http://example.com]]
12911 !! html/php
12912 <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>
12913 </p>
12914 !! html/parsoid
12915 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"http://example.com"}'><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>
12916 !! end
12917
12918 !! test
12919 Thumbnail image caption with a free URL
12920 !! options
12921 thumbsize=220
12922 !! wikitext
12923 [[File:Foobar.jpg|thumb|http://example.com]]
12924 !! html/php
12925 <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>
12926
12927 !! html/parsoid
12928 <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>
12929 !! end
12930
12931 !! test
12932 Thumbnail image caption with a free URL and explicit alt
12933 !! options
12934 thumbsize=220
12935 parsoid=wt2html,wt2wt,html2html
12936 !! wikitext
12937 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12938 !! html/php
12939 <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>
12940
12941 !! html/parsoid
12942 <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>
12943 !! end
12944
12945 !! test
12946 SVG thumbnails with no language set
12947 !! options
12948 !! wikitext
12949 [[File:Foobar.svg|thumb|caption]]
12950 !! html/php
12951 <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>
12952
12953 !! html/parsoid
12954 <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>
12955 !! end
12956
12957 !! test
12958 SVG thumbnails with language de
12959 !! options
12960 parsoid=wt2html,wt2wt,html2html
12961 !! wikitext
12962 [[File:Foobar.svg|thumb|caption|lang=de]]
12963 !! html/php
12964 <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>
12965
12966 !! html/parsoid
12967 <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>
12968 !! end
12969
12970 !! test
12971 SVG thumbnails with invalid language code
12972 !! options
12973 parsoid=wt2html,wt2wt,html2html
12974 !! wikitext
12975 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12976 !! html/php
12977 <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>
12978
12979 !! html/parsoid
12980 <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>
12981 !! end
12982
12983 !! test
12984 BUG 1887: A ISBN with a thumbnail
12985 !! wikitext
12986 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12987 !! html/php
12988 <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>
12989
12990 !! html/parsoid
12991 <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:ExtLink">ISBN 1235467890</a></figcaption></figure>
12992 !! end
12993
12994 !! test
12995 BUG 1887: A RFC with a thumbnail
12996 !! wikitext
12997 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12998 !! html/php
12999 <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>
13000
13001 !! html/parsoid
13002 <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>
13003 !! end
13004
13005 !! test
13006 BUG 1887: A mailto link with a thumbnail
13007 !! wikitext
13008 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13009 !! html/php
13010 <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>
13011
13012 !! html/parsoid
13013 <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>
13014 !! end
13015
13016 # Pending resolution to bug 368
13017 !! test
13018 BUG 648: Frameless image caption with a link
13019 !! wikitext
13020 [[File:Foobar.jpg|text with a [[link]] in it]]
13021 !! html/php
13022 <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>
13023 </p>
13024 !! html/parsoid
13025 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><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>
13026 !! end
13027
13028 !! test
13029 BUG 648: Frameless image caption with a link (suffix)
13030 !! wikitext
13031 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13032 !! html/php
13033 <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>
13034 </p>
13035 !! html/parsoid
13036 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><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>
13037 !! end
13038
13039 !! test
13040 BUG 648: Frameless image caption with an interwiki link
13041 !! wikitext
13042 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13043 !! html/php
13044 <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>
13045 </p>
13046 !! html/parsoid
13047 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><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>
13048 !! end
13049
13050 !! test
13051 BUG 648: Frameless image caption with a piped interwiki link
13052 !! wikitext
13053 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13054 !! html/php
13055 <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>
13056 </p>
13057 !! html/parsoid
13058 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><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>
13059 !! end
13060
13061 !! test
13062 Escape HTML special chars in image alt text
13063 !! wikitext
13064 [[File:Foobar.jpg|& < > "]]
13065 !! html/php
13066 <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>
13067 </p>
13068 !! html/parsoid
13069 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp; &lt; > \""}'><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>
13070 !! end
13071
13072 !! test
13073 BUG 499: Alt text should have &#1234;, not &amp;1234;
13074 !! wikitext
13075 [[File:Foobar.jpg|&#9792;]]
13076 !! html/php
13077 <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>
13078 </p>
13079 !! html/parsoid
13080 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;#9792;"}'><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>
13081 !! end
13082
13083 !! test
13084 Broken image caption with link
13085 !! options
13086 parsoid=wt2html,wt2wt,html2html
13087 !! wikitext
13088 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13089 !! html/php
13090 <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.
13091 </p>
13092 !! html/parsoid
13093 <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>
13094 !! end
13095
13096 !! test
13097 Image caption containing another image
13098 !! wikitext
13099 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13100 !! html/php
13101 <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>
13102
13103 !! html/parsoid
13104 <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>
13105 !! end
13106
13107 !! test
13108 Image: caption containing a newline
13109 !! wikitext
13110 [[File:Foobar.jpg|This
13111 *is some text]]
13112 !! html/php
13113 <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>
13114 </p>
13115 !! html/parsoid
13116 <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>
13117 !!end
13118
13119 !!test
13120 Image: caption containing leading space
13121 (The leading space should not trigger nowiki escaping in wt2wt mode)
13122 !! wikitext
13123 [[File:Foobar.jpg|thumb| bar]]
13124 !! html/php
13125 <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>
13126
13127 !! html/parsoid
13128 <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>
13129 !!end
13130
13131 !! test
13132 Image: caption containing a table
13133 !! options
13134 parsoid=wt2html,wt2wt,html2html
13135 !! wikitext
13136 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13137 {|
13138 ! Foo !! Bar
13139 |-
13140 | Foo1 || Bar1
13141 |}
13142 and some more text.]]
13143 !! html/php
13144 <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>
13145
13146 !! html/parsoid
13147 <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
13148 <table>
13149 <tbody>
13150 <tr><th>Foo </th><th>Bar</th></tr>
13151 <tr>
13152 <td>Foo1 </td>
13153 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13154 !! end
13155
13156 !! test
13157 Bug 3090: External links other than http: in image captions
13158 !! wikitext
13159 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13160 !! html/php
13161 <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>
13162
13163 !! html/parsoid
13164 <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>
13165 !! end
13166
13167 !! test
13168 Custom class
13169 !! options
13170 parsoid=wt2html,wt2wt,html2html
13171 !! wikitext
13172 [[Image:foobar.jpg|a|class=b]]
13173 !! html/php
13174 <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>
13175 </p>
13176 !! html/parsoid
13177 <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>
13178 !! end
13179
13180 !! test
13181 Localized image handling (1).
13182 !! options
13183 parsoid=wt2html,wt2wt,html2html
13184 language=es
13185 !! wikitext
13186 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13187 !! html/php
13188 <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>
13189
13190 !! html/parsoid
13191 <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>
13192 !! end
13193
13194 !! test
13195 Localized image handling (2).
13196 !! options
13197 thumbsize=220
13198 parsoid=wt2html,wt2wt,html2html
13199 language=es
13200 !! wikitext
13201 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13202 !! html/php
13203 <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>
13204
13205 !! html/parsoid
13206 <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>
13207 !! end
13208
13209 !! test
13210 "border", "frameless" and "class" attributes on an image.
13211 !! options
13212 thumbsize=220
13213 parsoid=wt2html,wt2wt,html2html
13214 !! wikitext
13215 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13216 !! html/php
13217 <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>
13218 </p>
13219 !! html/parsoid
13220 <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>
13221 !! end
13222
13223 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13224 !! test
13225 Invalid image attributes (bug 62500)
13226 !! options
13227 thumbsize=220
13228 parsoid=wt2html,wt2wt,html2html
13229 !! wikitext
13230 [[File:Foobar.jpg|thumb|float|left|caption]]
13231
13232 [[File:Foobar.jpg|thumb|righ|caption]]
13233
13234 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13235 !! html/php
13236 <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>
13237 <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>
13238 <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>
13239
13240 !! html/parsoid
13241 <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>
13242 <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>
13243 <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>
13244 !! end
13245
13246 !! article
13247 File:Barfoo.jpg
13248 !! text
13249 #REDIRECT [[File:Barfoo.jpg]]
13250 !! endarticle
13251
13252 # FIXME: Parsoid should run this test -- but we'd need to teach the
13253 # mockAPI about the redirected Barfoo.jpg image.
13254 !! test
13255 Redirected image
13256 !! wikitext
13257 [[Image:Barfoo.jpg]]
13258 !! html/php
13259 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13260 </p>
13261 !! end
13262
13263 !! test
13264 Missing image with uploads disabled
13265 !! options
13266 wgEnableUploads=0
13267 !! wikitext
13268 [[File:Foobaz.jpg]]
13269 !! html/php
13270 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13271 </p>
13272 !! html/parsoid
13273 <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>
13274 !! end
13275
13276 # Parsoid-specific testing for images
13277 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13278 # Currently imperfect due to a flaw in the Parsoid testrunner
13279 # Work in progress
13280 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13281 # image tests.
13282
13283 !! test
13284 Parsoid-specific image handling - simple image with size and middle alignment
13285 !! wikitext
13286 [[File:Foobar.jpg|middle|50px]]
13287 !! html/parsoid
13288 <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>
13289 !! end
13290
13291 !! test
13292 Parsoid-specific image handling - simple image with size, middle alignment,
13293 non-standard namespace alias
13294 !! options
13295 parsoid=wt2wt,wt2html,html2html
13296 !! wikitext
13297 [[Image:Foobar.jpg|middle|50px]]
13298 !! html/parsoid
13299 <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>
13300 !! end
13301
13302 !! test
13303 Parsoid-specific image handling - simple image with size and middle alignment
13304 (existing content)
13305 !! wikitext
13306 [[File:Foobar.jpg|50px|middle]]
13307 !! html/parsoid
13308 <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>
13309 !! end
13310
13311 !! test
13312 Parsoid-specific image handling - simple image with size and middle alignment
13313 and non-standard namespace name
13314 !! options
13315 parsoid=wt2html,wt2wt,html2html
13316 !! wikitext
13317 [[Image:Foobar.jpg|50px|middle]]
13318 !! html/parsoid
13319 <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>
13320 !! end
13321
13322 !! test
13323 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13324 !! wikitext
13325 [[File:Foobar.jpg|500x10px|baseline|caption]]
13326 !! html/parsoid
13327 <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>
13328 !! end
13329
13330 !! test
13331 Parsoid-specific image handling - simple image with border and size spec
13332 !! wikitext
13333 [[File:Foobar.jpg|50px|border|caption]]
13334 !! html/parsoid
13335 <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>
13336 !! end
13337
13338 !! test
13339 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13340 !! wikitext
13341 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13342 !! html/parsoid
13343 <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>
13344 !! end
13345
13346 !! test
13347 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13348 (existing content)
13349 !! wikitext
13350 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13351 !! html/parsoid
13352 <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>
13353 !! end
13354
13355 !! test
13356 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13357 !! wikitext
13358 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13359 !! html/parsoid
13360 <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>
13361 !! end
13362
13363 !! test
13364 Parsoid-specific image handling - thumbnail with specific size, halign,
13365 valign, and caption (existing content)
13366 !! wikitext
13367 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13368 !! html/parsoid
13369 <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>
13370 !! end
13371
13372 !! test
13373 Parsoid-specific image handling - framed image with specific size and caption
13374 (size is ignored)
13375 !! options
13376 parsoid=wt2html,wt2wt,html2html
13377 !! wikitext
13378 [[File:Foobar.jpg|frame|500x50px|caption]]
13379 !! html/parsoid
13380 <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>
13381 !! end
13382
13383 !! test
13384 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13385 (size is ignored)
13386 !! options
13387 parsoid=wt2html,wt2wt,html2html
13388 !! wikitext
13389 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13390 !! html/parsoid
13391 <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>
13392 !! end
13393
13394 !! test
13395 Parsoid-specific image handling - frameless image with specific size, border, and caption
13396 !! wikitext
13397 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13398 !! html/parsoid
13399 <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>
13400 !! end
13401
13402 !! test
13403 Parsoid-specific image handling - simple image with a formatted caption
13404 !! wikitext
13405 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13406 !! html/parsoid
13407 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&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>"}'><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>
13408 !! end
13409
13410 !! test
13411 Parsoid-specific image handling - caption with a template in it
13412 !! wikitext
13413 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13414 !! html/parsoid
13415 <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>
13416 !! end
13417
13418 !! test
13419 Parsoid-specific image handling - caption with unbalanced tags in it
13420 !! options
13421 parsoid=wt2html,wt2wt,html2html
13422 !! wikitext
13423 foo
13424 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13425 bar
13426 !! html/parsoid
13427 <p>foo</p>
13428 <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>
13429 <p>bar</p>
13430 !! end
13431
13432 !! test
13433 Parsoid-specific image handling - empty caption (1)
13434 !! options
13435 parsoid=wt2html,wt2wt
13436 !! wikitext
13437 [[File:Foobar.jpg|thumb|]]
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 # empty captions don't get serialized unless we're in the "round trip" case
13443 !! test
13444 Parsoid-specific image handling - empty caption (2)
13445 !! options
13446 parsoid=html2wt
13447 !! html/parsoid
13448 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13449 <a href="./File:Foobar.jpg">
13450 <img resource="./File:Foobar.jpg"
13451 src="//example.com/images/3/3a/Foobar.jpg"
13452 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13453 height="25" width="220"/>
13454 </a>
13455 <figcaption></figcaption>
13456 </figure>
13457 !! wikitext
13458 [[File:Foobar.jpg|thumb]]
13459 !! end
13460
13461 !! test
13462 Parsoid-specific image handling - whitespace caption
13463 !! wikitext
13464 [[File:Foobar.jpg|thumb| ]]
13465 !! html/parsoid
13466 <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>
13467 !! end
13468
13469 !! test
13470 Parsoid-specific image handling - lang option
13471 !! wikitext
13472 foo
13473 [[File:Foobar.svg|lang=de|caption]]
13474 bar
13475 !! html/parsoid
13476 <p>foo
13477 <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>
13478 bar</p>
13479 !! end
13480
13481
13482 ###
13483 ### Subpages
13484 ###
13485 !! article
13486 Subpage test/subpage
13487 !! text
13488 foo
13489 !! endarticle
13490
13491 !! test
13492 Subpage link
13493 !! options
13494 subpage title=[[Subpage test]]
13495 !! wikitext
13496 [[/subpage]]
13497 !! html
13498 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13499 </p>
13500 !! end
13501
13502 !! test
13503 Subpage noslash link
13504 !! options
13505 subpage title=[[Subpage test]]
13506 !! wikitext
13507 [[/subpage/]]
13508 !! html
13509 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13510 </p>
13511 !! end
13512
13513 !! article
13514 Subpage test/1/2/subpage
13515 !! text
13516 blah
13517 !! endarticle
13518
13519 !! test
13520 Relative subpage noslash link
13521 !! options
13522 parsoid=wt2wt,wt2html,html2html
13523 subpage title=[[Subpage test/1/2/3/4]]
13524 !! wikitext
13525 [[../../subpage/]]
13526
13527 [[../../subpage]]
13528 !! html/php
13529 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13530 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13531 </p>
13532 !! html/parsoid
13533 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13534 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13535 !! end
13536
13537 !! test
13538 Parsoid: dot-slash prefixed wikilinks
13539 !! wikitext
13540 [[./foo]]
13541
13542 [[././bar]]
13543
13544 [[././baz/]]
13545 !! html/php
13546 <p>[[./foo]]
13547 </p><p>[[././bar]]
13548 </p><p>[[././baz/]]
13549 </p>
13550 !! html/parsoid
13551 <p>[[./foo]]
13552 </p><p>[[././bar]]
13553 </p><p>[[././baz/]]
13554 </p>
13555 !! end
13556
13557 !! test
13558 Render invalid page names as plain text (bug 51090)
13559 !! wikitext
13560 [[./../foo|bar]]
13561 [[foo�|bar]]
13562 [[foo/.|bar]]
13563 [[foo/..|bar]]
13564 [[foo~~~bar]]
13565 [[foo>bar]]
13566 [[foo[bar]]
13567 [[.]]
13568 [[..]]
13569 [[foo././bar]]
13570
13571 [[{{echo|./../foo}}|bar]]
13572 [[{{echo|foo/.}}|bar]]
13573 [[{{echo|foo/..}}|bar]]
13574 [[{{echo|foo~~~~bar}}]]
13575 [[{{echo|foo>bar}}]]
13576 [[{{echo|foo././bar}}]]
13577 [[{{echo|foo{bar}}]]
13578 [[{{echo|foo}bar}}]]
13579 [[{{echo|foo[bar}}]]
13580 [[{{echo|foo]bar}}]]
13581 [[{{echo|foo<bar}}]]
13582 !!html/php
13583 <p>[[./../foo|bar]]
13584 [[foo�|bar]]
13585 [[foo/.|bar]]
13586 [[foo/..|bar]]
13587 [[foo~~~bar]]
13588 [[foo&gt;bar]]
13589 [[foo[bar]]
13590 [[.]]
13591 [[..]]
13592 [[foo././bar]]
13593 </p><p>[[./../foo|bar]]
13594 [[foo/.|bar]]
13595 [[foo/..|bar]]
13596 [[foo~~~~bar]]
13597 [[foo&gt;bar]]
13598 [[foo././bar]]
13599 [[foo{bar]]
13600 [[foo}bar]]
13601 [[foo[bar]]
13602 [[foo]bar]]
13603 [[foo&lt;bar]]
13604 </p>
13605 !!html/parsoid
13606 <p>[[./../foo|bar]]
13607 [[foo�|bar]]
13608 [[foo/.|bar]]
13609 [[foo/..|bar]]
13610 [[foo~~~bar]]
13611 [[foo>bar]]
13612 [[foo[bar]]
13613 [[.]]
13614 [[..]]
13615 [[foo././bar]]</p>
13616
13617 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13618 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13619 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13620 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13621 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13622 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13623 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13624 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13625 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13626 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13627 [[<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>
13628 !!end
13629
13630 !! test
13631 Disabled subpages
13632 !! wikitext
13633 [[/subpage]]
13634 !! html
13635 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13636 </p>
13637 !! end
13638
13639 !! test
13640 BUG 561: {{/Subpage}}
13641 !! options
13642 subpage title=[[Page]]
13643 !! wikitext
13644 {{/Subpage}}
13645 !! html
13646 <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>
13647 </p>
13648 !! end
13649
13650 ###
13651 ### Categories
13652 ###
13653 !! article
13654 Category:MediaWiki User's Guide
13655 !! text
13656 blah
13657 !! endarticle
13658
13659 !! test
13660 Link to category
13661 !! wikitext
13662 [[:Category:MediaWiki User's Guide]]
13663 !! html
13664 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13665 </p>
13666 !! end
13667
13668 !! test
13669 Simple category
13670 !! options
13671 cat
13672 !! wikitext
13673 [[Category:MediaWiki User's Guide]]
13674 !! html
13675 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13676 !! end
13677
13678 !! test
13679 PAGESINCATEGORY invalid title fatal (r33546 fix)
13680 !! wikitext
13681 {{PAGESINCATEGORY:<bogus>}}
13682 !! html
13683 <p>0
13684 </p>
13685 !! end
13686
13687 !! test
13688 Category with different sort key
13689 !! options
13690 cat
13691 !! wikitext
13692 [[Category:MediaWiki User's Guide|Foo]]
13693 !! html
13694 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13695 !! end
13696
13697 !! test
13698 Category with identical sort key
13699 !! options
13700 cat
13701 !! wikitext
13702 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13703 !! html
13704 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13705 !! end
13706
13707 !! test
13708 Category with empty sort key
13709 !! options
13710 cat
13711 pst
13712 !! wikitext
13713 [[Category:MediaWiki User's Guide|]]
13714 !! html
13715 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13716 !! end
13717
13718 !! test
13719 Category with empty sort key and parentheses
13720 !! options
13721 cat
13722 pst
13723 !! wikitext
13724 [[Category:Foo (bar)|]]
13725 !! html
13726 [[Category:Foo (bar)|Foo]]
13727 !! end
13728
13729 !! test
13730 Category with link tail
13731 !! options
13732 cat
13733 pst
13734 !! wikitext
13735 123[[Category:Foo]]456
13736 !! html
13737 123[[Category:Foo]]456
13738 !! end
13739
13740 !! test
13741 Category with template
13742 !! options
13743 cat
13744 pst
13745 !! wikitext
13746 [[Category:{{echo|Foo}}]]
13747 !! html
13748 [[Category:{{echo|Foo}}]]
13749 !! end
13750
13751 !! test
13752 Category with template in sort key
13753 !! options
13754 cat
13755 pst
13756 !! wikitext
13757 [[Category:Foo|{{echo|Bar}}]]
13758 !! html
13759 [[Category:Foo|{{echo|Bar}}]]
13760 !! end
13761
13762 !! test
13763 Category with template in sort key and title
13764 !! options
13765 cat
13766 pst
13767 !! wikitext
13768 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13769 !! html
13770 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13771 !! end
13772
13773 !! test
13774 Category / paragraph interactions
13775 !! wikitext
13776 Foo [[Category:Baz]] Bar
13777
13778 Foo [[Category:Baz]]
13779 Bar
13780
13781 Foo
13782 [[Category:Baz]]
13783 Bar
13784
13785 Foo
13786 [[Category:Baz]] Bar
13787
13788 Foo
13789 [[Category:Baz]]
13790 [[Category:Baz]]
13791 [[Category:Baz]]
13792 Bar
13793
13794 [[Category:Baz]]
13795 [[Category:Baz]]
13796 [[Category:Baz]]
13797
13798 [[Category:Baz]]
13799 {{echo|[[Category:Baz]]}}
13800 [[Category:Baz]]
13801 !! html
13802 <p>Foo Bar
13803 </p><p>Foo
13804 Bar
13805 </p><p>Foo
13806 Bar
13807 </p><p>Foo Bar
13808 </p><p>Foo
13809 Bar
13810 </p>
13811 !! end
13812
13813 ## The whitespace on the empty line is part of the test. Please do not delete
13814 !! test
13815 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13816 !! options
13817 parsoid=wt2html,wt2wt
13818 !! wikitext
13819 This
13820
13821 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
13822
13823 {{echo|[[Category:Foo]] and so should this!}}
13824 !! html
13825 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
13826 </p>
13827 !! html/parsoid
13828 <p>This
13829
13830 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
13831
13832 <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>
13833 !! end
13834
13835 ## Parsoid will not try to wt2wt this while preserving newlines because
13836 ## it suppresses excess newlines within list items -- and we don't want to
13837 ## introduce a special case just for categories, which is, in reality somewhat
13838 ## odd behavior -- categories are unlikely to be used in list items like this
13839 ## in top-level pages and are only likely to show up in template-generated
13840 ## list items where this RT-ing is a non-issue.
13841 ##
13842 ## The whitespace on the empty line is part of the test. Please do not delete
13843 !! test
13844 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13845 !! options
13846 parsoid=wt2html
13847 !! wikitext
13848 * This
13849
13850 [[Category:Foo]] and this should be part of the same list item
13851 * So should this
13852
13853 {{echo|[[Category:Foo]] and this should be part of the same list item}}
13854 !! html
13855 <ul><li>This and this should be part of the same list item</li>
13856 <li>So should this and this should be part of the same list item</li></ul>
13857 !! html/parsoid
13858 <ul>
13859 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
13860 <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>
13861 </ul>
13862 !! end
13863
13864 ## Newlines and categories that follow the last item of a list
13865 ## are treated differently because this (list followed by categories)
13866 ## is an extremely common pattern on wikis.
13867 !! test
13868 3. Categories and newlines: newline suppression for last list item should RT properly
13869 !! wikitext
13870 * a
13871 * b
13872
13873 [[Category:Foo]]
13874
13875 [[Category:Bar]]
13876 [[Category:Baz]]
13877 !! html/parsoid
13878 <ul><li> a</li>
13879 <li> b</li></ul>
13880
13881 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13882
13883 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13884 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13885 !! end
13886
13887 !! test
13888 4. Categories and newlines: newline suppression for last list item should RT properly
13889 !! wikitext
13890 * a
13891 **** b
13892
13893 [[Category:Foo]]
13894 !! html/parsoid
13895 <ul><li> a
13896 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
13897
13898 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13899 !! end
13900
13901 ## only wt2html for this to make sure the algo only applies to the rightmost path
13902 !! test
13903 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
13904 !! options
13905 parsoid=wt2html
13906 !! wikitext
13907 * a
13908 ** b
13909 [[Category:Foo]]
13910 * c
13911 ** d
13912 [[Category:Foo]]
13913 !! html/parsoid
13914 <ul><li> a
13915 <ul><li> b
13916 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
13917 <li> c
13918 <ul><li> d</li></ul></li></ul>
13919 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13920 !! end
13921
13922 !! test
13923 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
13924 !! wikitext
13925 * a [[Category:Foo]]
13926 !! html/parsoid
13927 <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>
13928 !! end
13929
13930 # This test also demonstrates because of newline+category tunneling
13931 # through the list hander, template wrapping doesn't expand to the
13932 # containing list when the list item swallows the category.
13933 !! test
13934 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
13935 !! wikitext
13936 * {{echo|a
13937 [[Category:Foo]]}}
13938 !! html/parsoid
13939 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a</span><span about="#mwt1">
13940 </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>
13941 !! end
13942
13943 !! test
13944 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
13945 !! wikitext
13946 * a
13947
13948 {{echo|[[Category:Foo]]
13949 [[Category:Bar]]}}
13950 [[Category:Baz]]
13951 !! html/parsoid
13952 <ul><li> a</li></ul>
13953
13954 <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","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
13955 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13956 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13957 !! end
13958
13959 !! test
13960 Parsoid: Serialize link to category page with colon escape
13961 !! options
13962 parsoid
13963 !! wikitext
13964
13965 [[:Category:Foo]]
13966 [[:Category:Foo|Bar]]
13967 !! html
13968 <p>
13969 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13970 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13971 </p>
13972 !! end
13973
13974 # html2wt localizes the "Category" namespace.
13975 # XXX the <link> element needs an empty data-parsoid attribute, or
13976 # else the html2html test fails because spaces are inserted.
13977 !! test
13978 Link prefix/suffixes aren't applied to category links
13979 !! options
13980 parsoid=wt2html,wt2wt,html2html
13981 language=is
13982 !! wikitext
13983 x[[Category:Foo]]y
13984 !! html/php
13985 <p>xy
13986 </p>
13987 !! html/parsoid
13988 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
13989 !! end
13990
13991 !! test
13992 Parsoid: Serialize link to file page with colon escape
13993 !! options
13994 parsoid
13995 !! wikitext
13996
13997 [[:File:Foo.png]]
13998 [[:File:Foo.png|Bar]]
13999 !! html
14000 <p>
14001 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14002 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14003 </p>
14004 !! end
14005
14006 !! test
14007 Parsoid: Serialize a genuine category link without colon escape
14008 !! options
14009 parsoid
14010 !! wikitext
14011 [[Category:Foo]]
14012 [[Category:Foo|Bar]]
14013 !! html
14014 <link rel="mw:PageProp/Category" href="Category:Foo">
14015 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
14016 !! end
14017
14018 !! test
14019 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14020 !! options
14021 parsoid=html2wt
14022 !! html
14023 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14024 !! wikitext
14025 [[Category:Toxine bactérienne]]
14026 !! end
14027
14028 !! test
14029 Parsoid: Defaultsort
14030 !! wikitext
14031 {{DEFAULTSORT:Foo}}
14032 !! html/parsoid
14033 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14034 !! end
14035
14036 !! test
14037 Parsoid: Defaultsort (template-generated)
14038 !! wikitext
14039 {{{{echo|DEFAULTSORT}}:Foo}}
14040 !! html/parsoid
14041 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14042 !! end
14043
14044 ###
14045 ### Inter-language links
14046 ###
14047 !! test
14048 Interlanguage links
14049 !! options
14050 ill
14051 !! wikitext
14052 [[es:Alimento]]
14053 [[fr:Nourriture]]
14054 [[zh:食品]]
14055 !! html/php
14056 es:Alimento fr:Nourriture zh:食品
14057 !! html/parsoid
14058 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14059 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14060 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14061 !! end
14062
14063 !! test
14064 Duplicate interlanguage links (bug 24502)
14065 !! options
14066 ill
14067 !! wikitext
14068 [[es:1]]
14069 [[es:2]]
14070 [[fr:1]]
14071 [[fr:2]]
14072 !! html/php
14073 es:1 fr:1
14074 !! html/parsoid
14075 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14076 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14077 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14078 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14079 !! end
14080
14081 ###
14082 ### Sections
14083 ###
14084 !! test
14085 Basic section headings
14086 !! wikitext
14087 == Headline 1 ==
14088 Some text
14089
14090 ==Headline 2==
14091 More
14092 ===Smaller headline===
14093 Blah blah
14094 !! html
14095 <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>
14096 <p>Some text
14097 </p>
14098 <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>
14099 <p>More
14100 </p>
14101 <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>
14102 <p>Blah blah
14103 </p>
14104 !! end
14105
14106 !! test
14107 Section headings with TOC
14108 !! wikitext
14109 == Headline 1 ==
14110 === Subheadline 1 ===
14111 ===== Skipping a level =====
14112 ====== Skipping a level ======
14113
14114 == Headline 2 ==
14115 Some text
14116 ===Another headline===
14117 !! html
14118 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14119 <ul>
14120 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14121 <ul>
14122 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14123 <ul>
14124 <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>
14125 <ul>
14126 <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>
14127 </ul>
14128 </li>
14129 </ul>
14130 </li>
14131 </ul>
14132 </li>
14133 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14134 <ul>
14135 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14136 </ul>
14137 </li>
14138 </ul>
14139 </div>
14140
14141 <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>
14142 <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>
14143 <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>
14144 <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>
14145 <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>
14146 <p>Some text
14147 </p>
14148 <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>
14149
14150 !! end
14151
14152 !! test
14153 TOC anchors don't collide
14154 !! wikitext
14155 __FORCETOC__
14156 == Headline 2 ==
14157 == Headline ==
14158 == Headline 2 ==
14159 == Headline ==
14160 !! html/php
14161 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14162 <ul>
14163 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14164 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14165 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14166 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14167 </ul>
14168 </div>
14169
14170 <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>
14171 <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>
14172 <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>
14173 <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>
14174
14175 !! end
14176
14177 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14178 !! test
14179 Handling of sections up to level 6 and beyond
14180 !! wikitext
14181 = Level 1 Heading=
14182 == Level 2 Heading==
14183 === Level 3 Heading===
14184 ==== Level 4 Heading====
14185 ===== Level 5 Heading=====
14186 ====== Level 6 Heading======
14187 ======= Level 7 Heading=======
14188 ======== Level 8 Heading========
14189 ========= Level 9 Heading=========
14190 ========== Level 10 Heading==========
14191 !! html
14192 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14193 <ul>
14194 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14195 <ul>
14196 <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>
14197 <ul>
14198 <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>
14199 <ul>
14200 <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>
14201 <ul>
14202 <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>
14203 <ul>
14204 <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>
14205 <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>
14206 <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>
14207 <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>
14208 <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>
14209 </ul>
14210 </li>
14211 </ul>
14212 </li>
14213 </ul>
14214 </li>
14215 </ul>
14216 </li>
14217 </ul>
14218 </li>
14219 </ul>
14220 </div>
14221
14222 <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>
14223 <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>
14224 <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>
14225 <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>
14226 <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>
14227 <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>
14228 <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>
14229 <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>
14230 <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>
14231 <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>
14232
14233 !! end
14234
14235 !! test
14236 TOC regression (T11764)
14237 !! wikitext
14238 == title 1 ==
14239 === title 1.1 ===
14240 ==== title 1.1.1 ====
14241 === title 1.2 ===
14242 == title 2 ==
14243 === title 2.1 ===
14244 !! html
14245 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14246 <ul>
14247 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14248 <ul>
14249 <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>
14250 <ul>
14251 <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>
14252 </ul>
14253 </li>
14254 <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>
14255 </ul>
14256 </li>
14257 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14258 <ul>
14259 <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>
14260 </ul>
14261 </li>
14262 </ul>
14263 </div>
14264
14265 <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>
14266 <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>
14267 <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>
14268 <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>
14269 <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>
14270 <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>
14271
14272 !! end
14273
14274 !! test
14275 TOC for heading containing <span id="..."></span> (T96153)
14276 !! wikitext
14277 __FORCETOC__
14278 ==<span id="old-anchor"></span>New title==
14279 !! html/php
14280 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14281 <ul>
14282 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14283 </ul>
14284 </div>
14285
14286 <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>
14287
14288 !! end
14289
14290 !! test
14291 TOC with wgMaxTocLevel=3 (bug 6204)
14292 !! options
14293 wgMaxTocLevel=3
14294 !! wikitext
14295 == title 1 ==
14296 === title 1.1 ===
14297 ==== title 1.1.1 ====
14298 === title 1.2 ===
14299 == title 2 ==
14300 === title 2.1 ===
14301 !! html
14302 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14303 <ul>
14304 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14305 <ul>
14306 <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>
14307 <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>
14308 </ul>
14309 </li>
14310 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14311 <ul>
14312 <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>
14313 </ul>
14314 </li>
14315 </ul>
14316 </div>
14317
14318 <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>
14319 <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>
14320 <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>
14321 <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>
14322 <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>
14323 <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>
14324
14325 !! end
14326
14327 !! test
14328 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14329 !! options
14330 wgMaxTocLevel=3
14331 !! wikitext
14332 ==Section 1==
14333 ===Section 1.1===
14334 ====Section 1.1.1====
14335 ====Section 1.1.1.1====
14336 ==Section 2==
14337 !! html
14338 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14339 <ul>
14340 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14341 <ul>
14342 <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>
14343 </ul>
14344 </li>
14345 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14346 </ul>
14347 </div>
14348
14349 <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>
14350 <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>
14351 <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>
14352 <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>
14353 <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>
14354
14355 !! end
14356
14357
14358 !! test
14359 Resolving duplicate section names
14360 !! wikitext
14361 == Foo bar ==
14362 == Foo bar ==
14363 !! html
14364 <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>
14365 <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>
14366
14367 !! end
14368
14369 !! test
14370 Resolving duplicate section names with differing case (bug 10721)
14371 !! wikitext
14372 == Foo bar ==
14373 == Foo Bar ==
14374 !! html
14375 <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>
14376 <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>
14377
14378 !! end
14379
14380 !! article
14381 Template:sections
14382 !! text
14383 ===Section 1===
14384 ==Section 2==
14385 !! endarticle
14386
14387 !! test
14388 Template with sections, __NOTOC__
14389 !! wikitext
14390 __NOTOC__
14391 ==Section 0==
14392 {{sections}}
14393 ==Section 4==
14394 !! html
14395 <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>
14396 <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>
14397 <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>
14398 <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>
14399
14400 !! end
14401
14402 !! test
14403 __NOEDITSECTION__ keyword
14404 !! wikitext
14405 __NOEDITSECTION__
14406 ==Section 1==
14407 ==Section 2==
14408 !! html
14409 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14410 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14411
14412 !! end
14413
14414 !! test
14415 Link inside a section heading
14416 !! wikitext
14417 ==Section with a [[Main Page|link]] in it==
14418 !! html
14419 <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>
14420
14421 !! end
14422
14423 !! test
14424 TOC regression (T14077)
14425 !! wikitext
14426 __TOC__
14427 == title 1 ==
14428 === title 1.1 ===
14429 == title 2 ==
14430 !! html
14431 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14432 <ul>
14433 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14434 <ul>
14435 <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>
14436 </ul>
14437 </li>
14438 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14439 </ul>
14440 </div>
14441
14442 <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>
14443 <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>
14444 <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>
14445
14446 !! end
14447
14448 !! test
14449 BUG 1219 URL next to image (good)
14450 !! wikitext
14451 http://example.com [[File:Foobar.jpg]]
14452 !! html/php
14453 <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>
14454 </p>
14455 !! html/parsoid
14456 <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>
14457 !!end
14458
14459 !! test
14460 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14461 !! wikitext
14462 ===
14463 The line above must have a trailing space!
14464 === <!--
14465 --> <!-- -->
14466 But just in case it doesn't...
14467 !! html
14468 <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>
14469 <p>The line above must have a trailing space!
14470 </p>
14471 <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>
14472 <p>But just in case it doesn't...
14473 </p>
14474 !! end
14475
14476 !! test
14477 Header with special characters (bug 25462)
14478 !! wikitext
14479 The tooltips shall not show entities to the user (ie. be double escaped)
14480
14481 == text > text ==
14482 section 1
14483
14484 == text < text ==
14485 section 2
14486
14487 == text & text ==
14488 section 3
14489
14490 == text ' text ==
14491 section 4
14492
14493 == text " text ==
14494 section 5
14495 !! html
14496 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14497 </p>
14498 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14499 <ul>
14500 <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>
14501 <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>
14502 <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>
14503 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14504 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14505 </ul>
14506 </div>
14507
14508 <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>
14509 <p>section 1
14510 </p>
14511 <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>
14512 <p>section 2
14513 </p>
14514 <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>
14515 <p>section 3
14516 </p>
14517 <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>
14518 <p>section 4
14519 </p>
14520 <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>
14521 <p>section 5
14522 </p>
14523 !! end
14524
14525 !! test
14526 Header with space, plus and underscore as entity
14527 !! wikitext
14528 Id should not contain + for spaces
14529
14530 == Space between Text ==
14531 section 1
14532
14533 == Space-Entity&#32;between&#32;Text ==
14534 section 2
14535
14536 == Plus+between+Text ==
14537 section 3
14538
14539 == Plus-Entity&#43;between&#43;Text ==
14540 section 4
14541
14542 == Underscore_between_Text ==
14543 section 5
14544
14545 == Underscore-Entity&#95;between&#95;Text ==
14546 section 6
14547
14548 [[#Space between Text]]
14549 [[#Space-Entity&#32;between&#32;Text]]
14550 [[#Plus+between+Text]]
14551 [[#Plus-Entity&#43;between&#43;Text]]
14552 [[#Underscore_between_Text]]
14553 [[#Underscore-Entity&#95;between&#95;Text]]
14554 !! html
14555 <p>Id should not contain + for spaces
14556 </p>
14557 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14558 <ul>
14559 <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>
14560 <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>
14561 <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>
14562 <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>
14563 <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>
14564 <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>
14565 </ul>
14566 </div>
14567
14568 <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>
14569 <p>section 1
14570 </p>
14571 <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>
14572 <p>section 2
14573 </p>
14574 <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>
14575 <p>section 3
14576 </p>
14577 <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>
14578 <p>section 4
14579 </p>
14580 <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>
14581 <p>section 5
14582 </p>
14583 <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>
14584 <p>section 6
14585 </p><p><a href="#Space_between_Text">#Space between Text</a>
14586 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14587 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14588 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14589 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14590 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14591 </p>
14592 !! end
14593
14594 !! test
14595 Headers with excess '=' characters
14596 (Are similar tests necessary beyond the 1st level?)
14597 !! wikitext
14598 =foo==
14599 ==foo=
14600 =''italic'' heading==
14601 ==''italic'' heading=
14602 !! html
14603 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14604 <ul>
14605 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14606 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14607 <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>
14608 <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>
14609 </ul>
14610 </div>
14611
14612 <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>
14613 <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>
14614 <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>
14615 <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>
14616
14617 !! end
14618
14619 !! test
14620 HTML headers vs TOC (bug 23393)
14621 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14622 !! wikitext
14623 <h1>Header 1</h1>
14624 == Header 1.1 ==
14625 == Header 1.2 ==
14626
14627 <h1>Header 2
14628 </h1>
14629 == Header 2.1 ==
14630 == Header 2.2 ==
14631 __NOEDITSECTION__
14632 !! html
14633 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14634 <ul>
14635 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14636 <ul>
14637 <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>
14638 <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>
14639 </ul>
14640 </li>
14641 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14642 <ul>
14643 <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>
14644 <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>
14645 </ul>
14646 </li>
14647 </ul>
14648 </div>
14649
14650 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14651 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14652 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14653 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14654 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14655 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14656
14657 !! end
14658
14659 !! test
14660 Single-line or multiline-comments can follow headings
14661 !! options
14662 parsoid=wt2html,wt2wt
14663 !! wikitext
14664 ==foo==<!---->
14665 ==bar==<!--c1-->
14666 ==baz==<!--
14667 c2
14668 c3-->
14669 !! html
14670 <h2><span class="mw-headline" id="foo">foo</span></h2>
14671 <h2><span class="mw-headline" id="bar">bar</span></h2>
14672 <h2><span class="mw-headline" id="baz">baz</span></h2>
14673
14674 !! end
14675
14676 !! test
14677 BUG 1219 URL next to image (broken)
14678 !! wikitext
14679 http://example.com[[File:Foobar.jpg]]
14680 !! html/php
14681 <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>
14682 </p>
14683 !! html/parsoid
14684 <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>
14685 !!end
14686
14687 !! test
14688 Bug 1186 news: in the middle of text
14689 !! wikitext
14690 http://en.wikinews.org/wiki/Wikinews:Workplace
14691 !! html
14692 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14693 </p>
14694 !!end
14695
14696
14697 !! test
14698 Namespaced link must have a title
14699 !! wikitext
14700 [[Project:]]
14701 !! html
14702 <p>[[Project:]]
14703 </p>
14704 !!end
14705
14706 !! test
14707 Namespaced link must have a title (bad fragment version)
14708 !! wikitext
14709 [[Project:#fragment]]
14710 !! html
14711 <p>[[Project:#fragment]]
14712 </p>
14713 !!end
14714
14715
14716 ###
14717 ### HTML tags and HTML attributes
14718 ###
14719
14720 !! test
14721 div with no attributes
14722 !! wikitext
14723 <div>HTML rocks</div>
14724 !! html
14725 <div>HTML rocks</div>
14726
14727 !! end
14728
14729 !! test
14730 div with double-quoted attribute
14731 !! wikitext
14732 <div id="rock">HTML rocks</div>
14733 !! html
14734 <div id="rock">HTML rocks</div>
14735
14736 !! end
14737
14738 !! test
14739 div with single-quoted attribute
14740 !! wikitext
14741 <div id='rock'>HTML rocks</div>
14742 !! html
14743 <div id="rock">HTML rocks</div>
14744
14745 !! end
14746
14747 !! test
14748 div with unquoted attribute
14749 !! wikitext
14750 <div id=rock>HTML rocks</div>
14751 !! html
14752 <div id="rock">HTML rocks</div>
14753
14754 !! end
14755
14756 !! test
14757 div with illegal double attributes
14758 !! wikitext
14759 <div id="a" id="b">HTML rocks</div>
14760 !! html
14761 <div id="b">HTML rocks</div>
14762
14763 !!end
14764
14765 # FIXME: produce empty string instead of "class" in the PHP parser, following
14766 # the HTML5 spec.
14767 !! test
14768 div with empty attribute value, space before equals
14769 !! options
14770 parsoid
14771 !! wikitext
14772 <div class =>HTML rocks</div>
14773 !! html
14774 <div class="">HTML rocks</div>
14775
14776 !! end
14777
14778 !! test
14779 div with multiple empty attribute values
14780 !! options
14781 parsoid
14782 !! wikitext
14783 <div id= title=>HTML rocks</div>
14784 !! html
14785 <div id="" title="">HTML rocks</div>
14786
14787 !! end
14788
14789 !! test
14790 table with multiple empty attribute values
14791 !! options
14792 parsoid
14793 !! wikitext
14794 {| title= id=
14795 | hi
14796 |}
14797 !! html
14798 <table title="" id="">
14799 <tbody><tr><td> hi</td></tr>
14800 </tbody></table>
14801 !! end
14802
14803 !! test
14804 div with braces in attribute value
14805 !! wikitext
14806 <div title="{}">Foo</div>
14807 !! html/php
14808 <div title="&#123;}">Foo</div>
14809
14810 !! html/parsoid
14811 <div title="{}">Foo</div>
14812 !! end
14813
14814 # This it very inconsistent in the PHP parser: it returns
14815 # class="class" if there is a space between the name and the equal sign (see
14816 # 'div with empty attribute value, space before equals'), but strips the
14817 # attribute completely if the space is missing. We hope that not much content
14818 # depends on this, so are implementing the behavior below in Parsoid for
14819 # consistencies' sake.
14820 # FIXME: fix this behavior in the PHP parser?
14821 !! test
14822 div with empty attribute value, no space before equals
14823 !! options
14824 parsoid=wt2html,html2html
14825 !! wikitext
14826 <div class=>HTML rocks</div>
14827 !! html/php
14828 <div>HTML rocks</div>
14829
14830 !! html/parsoid
14831 <div class="">HTML rocks</div>
14832 !! end
14833
14834 !! test
14835 HTML multiple attributes correction
14836 !! wikitext
14837 <p class="error" class="awesome">Awesome!</p>
14838 !! html
14839 <p class="awesome">Awesome!</p>
14840
14841 !!end
14842
14843 !! test
14844 Table multiple attributes correction
14845 !! wikitext
14846 {|
14847 !+ class="error" class="awesome"| status
14848 |}
14849 !! html
14850 <table>
14851 <tr>
14852 <th class="awesome"> status
14853 </th></tr></table>
14854
14855 !!end
14856
14857 !! test
14858 DIV IN UPPERCASE
14859 !! wikitext
14860 <DIV ID="x">HTML ROCKS</DIV>
14861 !! html
14862 <div id="x">HTML ROCKS</div>
14863
14864 !!end
14865
14866 !! test
14867 Non-ASCII pseudo-tags are rendered as text
14868 !! wikitext
14869 <khyô>
14870 !! html
14871 <p>&lt;khyô&gt;
14872 </p>
14873 !! end
14874
14875 !! test
14876 Pseudo-tag with URL 'name' renders as url link
14877 !! wikitext
14878 <http://example.com/>
14879 !! html
14880 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14881 </p>
14882 !! end
14883
14884 !! test
14885 text with amp in the middle of nowhere
14886 !! wikitext
14887 Remember AT&T?
14888 !! html
14889 <p>Remember AT&amp;T?
14890 </p>
14891 !! end
14892
14893 !! test
14894 text with character entity: eacute
14895 !! wikitext
14896 I always thought &eacute; was a cute letter.
14897 !! html
14898 <p>I always thought &#233; was a cute letter.
14899 </p>
14900 !! html+tidy
14901 <p>I always thought é was a cute letter.</p>
14902 !! end
14903
14904 !! test
14905 text with entity-escaped character entity-like string: eacute
14906 !! wikitext
14907 I always thought &amp;eacute; was a cute letter.
14908 !! html
14909 <p>I always thought &amp;eacute; was a cute letter.
14910 </p>
14911 !! end
14912
14913 !! test
14914 text with undefined character entity: xacute
14915 !! wikitext
14916 I always thought &xacute; was a cute letter.
14917 !! html
14918 <p>I always thought &amp;xacute; was a cute letter.
14919 </p>
14920 !! end
14921
14922 # TODO: generalize to PHP parser?
14923 !! test
14924 HTML5 tags
14925 !! options
14926 parsoid
14927 !! wikitext
14928 <data value="5">five</data>
14929 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14930 <mark>This highlighted text</mark>
14931 !! html
14932 <p><data value="5">five</data>
14933 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14934 <mark>This highlighted text</mark></p>
14935 !! end
14936
14937 !! test
14938 HTML tag with leading space is parsed as text
14939 !! wikitext
14940 < div>foo< /div>
14941 !! html
14942 <p>&lt; div&gt;foo&lt; /div&gt;
14943 </p>
14944 !! end
14945
14946 ###
14947 ### Nesting tests (see bug 41545, 50604, 51081)
14948 ###
14949
14950 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14951 # Note that html2wt is considerably more difficult if we use <b> in
14952 # the test case, instead of <big>
14953 !! test
14954 Ensure that HTML adoption agency algorithm is properly implemented.
14955 !! wikitext
14956 <big>X<big>Y</big>Z</big>
14957 !! html
14958 <p><big>X<big>Y</big>Z</big>
14959 </p>
14960 !! end
14961
14962 # This was bug 41545 in the PHP parser.
14963 # Note that tidy doesn't handle this correctly.
14964 !! test
14965 Nesting of <kbd>
14966 !! wikitext
14967 <kbd>X<kbd>Y</kbd>Z</kbd>
14968 !! html
14969 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14970 </p>
14971 !! end
14972
14973 # The following cases were bug 51081 in the PHP parser.
14974 # Note that there are some other nestable tags (b, i, etc) which are
14975 # not covered; see bug 51081 for discussion.
14976
14977 # Note that tidy doesn't handle this correctly.
14978 !! test
14979 Nesting of <em>
14980 !! wikitext
14981 <em>X<em>Y</em>Z</em>
14982 !! html
14983 <p><em>X<em>Y</em>Z</em>
14984 </p>
14985 !! end
14986
14987 # Note that tidy doesn't handle this correctly.
14988 !! test
14989 Nesting of <strong>
14990 !! wikitext
14991 <strong>X<strong>Y</strong>Z</strong>
14992 !! html
14993 <p><strong>X<strong>Y</strong>Z</strong>
14994 </p>
14995 !! end
14996
14997 !! test
14998 Nesting of <q>
14999 !! wikitext
15000 <q>X<q>Y</q>Z</q>
15001 !! html+tidy
15002 <p><q>X<q>Y</q>Z</q></p>
15003 !! end
15004
15005 # Note that tidy doesn't handle this correctly.
15006 !! test
15007 Nesting of <ruby>
15008 !! wikitext
15009 <ruby>X<ruby>Y</ruby>Z</ruby>
15010 !! html
15011 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15012 </p>
15013 !! end
15014
15015 # Note that tidy doesn't handle this correctly.
15016 !! test
15017 Nesting of <bdo>
15018 !! wikitext
15019 <bdo>X<bdo>Y</bdo>Z</bdo>
15020 !! html
15021 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15022 </p>
15023 !! end
15024
15025
15026 ###
15027 ### Media links
15028 ###
15029
15030 !! test
15031 Media link
15032 !! wikitext
15033 [[Media:Foobar.jpg]]
15034 !! html
15035 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15036 </p>
15037 !! end
15038
15039 !! test
15040 Media link with text
15041 !! wikitext
15042 [[Media:Foobar.jpg|A neat file to look at]]
15043 !! html
15044 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15045 </p>
15046 !! end
15047
15048 # FIXME: this is still bad HTML tag nesting
15049 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15050 !! test
15051 Media link with nasty text
15052 !! wikitext
15053 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15054 !! html
15055 <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>
15056
15057 !! html+tidy
15058 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15059 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15060 !! end
15061
15062 !! test
15063 Media link to nonexistent file (bug 1702)
15064 !! wikitext
15065 [[Media:No such.jpg]]
15066 !! html
15067 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15068 </p>
15069 !! end
15070
15071 !! test
15072 Image link to nonexistent file (bug 1850 - good)
15073 !! wikitext
15074 [[File:No_such.jpg]]
15075 !! html/php
15076 <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>
15077 </p>
15078 !! html/parsoid
15079 <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>
15080 !! end
15081
15082 !! test
15083 :Image link to nonexistent file (bug 1850 - bad)
15084 !! wikitext
15085 [[:Image:No such.jpg]]
15086 !! html/php
15087 <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>
15088 </p>
15089 !! html/parsoid
15090 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15091 !! end
15092
15093
15094
15095 !! test
15096 Character reference normalization in link text (bug 1938)
15097 !! wikitext
15098 [[Main Page|this&that]]
15099 !! html
15100 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15101 </p>
15102 !!end
15103
15104 !! article
15105 אַ
15106 !! text
15107 Test for unicode normalization
15108
15109 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15110 !! endarticle
15111
15112 !! test
15113 (bug 19451) Links should refer to the normalized form.
15114 !! wikitext
15115 [[&#xFB2E;]]
15116 [[&#x5d0;&#x5b7;]]
15117 [[&#x5d0;ַ]]
15118 [[א&#x5b7;]]
15119 [[אַ]]
15120 !! html
15121 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15122 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15123 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15124 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15125 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15126 </p>
15127 !! end
15128
15129 !! test
15130 Empty attribute crash test (bug 2067)
15131 !! wikitext
15132 <font color="">foo</font>
15133 !! html
15134 <p><font color="">foo</font>
15135 </p>
15136 !! end
15137
15138 !! test
15139 Empty attribute crash test single-quotes (bug 2067)
15140 !! wikitext
15141 <font color=''>foo</font>
15142 !! html
15143 <p><font color="">foo</font>
15144 </p>
15145 !! end
15146
15147 !! test
15148 Attribute test: equals, then nothing
15149 !! wikitext
15150 <font color=>foo</font>
15151 !! html
15152 <p><font>foo</font>
15153 </p>
15154 !! end
15155
15156 !! test
15157 Attribute test: unquoted value
15158 !! wikitext
15159 <font color=x>foo</font>
15160 !! html
15161 <p><font color="x">foo</font>
15162 </p>
15163 !! end
15164
15165 !! test
15166 Attribute test: unquoted but illegal value (hash)
15167 !! wikitext
15168 <font color=#x>foo</font>
15169 !! html
15170 <p><font color="#x">foo</font>
15171 </p>
15172 !! end
15173
15174 !! test
15175 Attribute test: no value
15176 !! wikitext
15177 <font color>foo</font>
15178 !! html
15179 <p><font color="color">foo</font>
15180 </p>
15181 !! end
15182
15183 !! test
15184 Bug 2095: link with three closing brackets
15185 !! wikitext
15186 [[Main Page]]]
15187 !! html/php
15188 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15189 </p>
15190 !! html/parsoid
15191 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15192 !! end
15193
15194 !! test
15195 Bug 2095: link with pipe and three closing brackets
15196 !! wikitext
15197 [[Main Page|link]]]
15198 !! html/php
15199 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15200 </p>
15201 !! html/parsoid
15202 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15203 !! end
15204
15205 !! test
15206 Bug 2095: link with pipe and three closing brackets, version 2
15207 !! wikitext
15208 [[Main Page|[http://example.com/]]]
15209 !! html/php
15210 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15211 </p>
15212 !! html/parsoid
15213 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15214 !! end
15215
15216
15217 ###
15218 ### Safety
15219 ###
15220
15221 !! article
15222 Template:Dangerous attribute
15223 !! text
15224 " onmouseover="alert(document.cookie)
15225 !! endarticle
15226
15227 !! article
15228 Template:Dangerous style attribute
15229 !! text
15230 border-size: expression(alert(document.cookie))
15231 !! endarticle
15232
15233 !! article
15234 Template:Div style
15235 !! text
15236 <div style="float: right; {{{1}}}">Magic div</div>
15237 !! endarticle
15238
15239 !! test
15240 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15241 !! wikitext
15242 <div title="{{test}}"></div>
15243 !! html
15244 <div title="This is a test template"></div>
15245
15246 !! end
15247
15248 # Parsoid has enough context to handle this case
15249 !! test
15250 Bug 2304: HTML attribute safety (dangerous template; 2309)
15251 !! wikitext
15252 <div title="{{dangerous attribute}}"></div>
15253 !! html/php
15254 <div title=""></div>
15255
15256 !! html/parsoid
15257 <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=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
15258 !! end
15259
15260 !! test
15261 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15262 !! wikitext
15263 <div style="{{dangerous style attribute}}"></div>
15264 !! html
15265 <div style="/* insecure input */"></div>
15266
15267 !! end
15268
15269 !! test
15270 Bug 2304: HTML attribute safety (safe parameter; 2309)
15271 !! wikitext
15272 {{div style|width: 200px}}
15273 !! html
15274 <div style="float: right; width: 200px">Magic div</div>
15275
15276 !! end
15277
15278 !! test
15279 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15280 !! wikitext
15281 {{div style|width: expression(alert(document.cookie))}}
15282 !! html
15283 <div style="/* insecure input */">Magic div</div>
15284
15285 !! end
15286
15287 !! test
15288 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15289 !! wikitext
15290 {{div style|"><script>alert(document.cookie)</script>}}
15291 !! html
15292 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15293
15294 !! end
15295
15296 !! test
15297 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15298 !! wikitext
15299 {{div style|" ><script>alert(document.cookie)</script>}}
15300 !! html
15301 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15302
15303 !! end
15304
15305 !! test
15306 Bug 2304: HTML attribute safety (link)
15307 !! wikitext
15308 <div title="[[Main Page]]"></div>
15309 !! html
15310 <div title="&#91;&#91;Main Page]]"></div>
15311
15312 !! end
15313
15314 !! test
15315 Bug 2304: HTML attribute safety (italics)
15316 !! wikitext
15317 <div title="''foobar''"></div>
15318 !! html
15319 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15320
15321 !! end
15322
15323 !! test
15324 Bug 2304: HTML attribute safety (bold)
15325 !! wikitext
15326 <div title="'''foobar'''"></div>
15327 !! html
15328 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15329
15330 !! end
15331
15332
15333 !! test
15334 Bug 2304: HTML attribute safety (ISBN)
15335 !! wikitext
15336 <div title="ISBN 1234567890"></div>
15337 !! html
15338 <div title="&#73;SBN 1234567890"></div>
15339
15340 !! end
15341
15342 !! test
15343 Bug 2304: HTML attribute safety (RFC)
15344 !! wikitext
15345 <div title="RFC 1234"></div>
15346 !! html
15347 <div title="&#82;FC 1234"></div>
15348
15349 !! end
15350
15351 !! test
15352 Bug 2304: HTML attribute safety (PMID)
15353 !! wikitext
15354 <div title="PMID 1234567890"></div>
15355 !! html
15356 <div title="&#80;MID 1234567890"></div>
15357
15358 !! end
15359
15360 !! test
15361 Bug 2304: HTML attribute safety (web link)
15362 !! wikitext
15363 <div title="http://example.com/"></div>
15364 !! html
15365 <div title="http&#58;//example.com/"></div>
15366
15367 !! end
15368
15369 !! test
15370 Bug 2304: HTML attribute safety (named web link)
15371 !! wikitext
15372 <div title="[http://example.com/ link]"></div>
15373 !! html
15374 <div title="&#91;http&#58;//example.com/ link]"></div>
15375
15376 !! end
15377
15378 !! test
15379 Bug 3244: HTML attribute safety (extension; safe)
15380 !! wikitext
15381 <div style="<nowiki>background:blue</nowiki>"></div>
15382 !! html
15383 <div style="background:blue"></div>
15384
15385 !! end
15386
15387 !! test
15388 Bug 3244: HTML attribute safety (extension; unsafe)
15389 !! wikitext
15390 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15391 !! html
15392 <div style="/* insecure input */"></div>
15393
15394 !! end
15395
15396 # More MSIE fun discovered by Tom Gilder
15397
15398 !! test
15399 MSIE CSS safety test: spurious slash
15400 !! wikitext
15401 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15402 !! html
15403 <div style="/* insecure input */">evil</div>
15404
15405 !! end
15406
15407 !! test
15408 MSIE CSS safety test: hex code
15409 !! wikitext
15410 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15411 !! html
15412 <div style="/* insecure input */">evil</div>
15413
15414 !! end
15415
15416 !! test
15417 MSIE CSS safety test: comment in url
15418 !! wikitext
15419 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15420 !! html
15421 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15422
15423 !! end
15424
15425 !! test
15426 MSIE CSS safety test: comment in expression
15427 !! wikitext
15428 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15429 !! html
15430 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15431
15432 !! end
15433
15434 !! test
15435 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15436 !! wikitext
15437 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15438 !! html
15439 <p style="/* invalid control char */">A</p>
15440
15441 !! end
15442
15443 !! test
15444 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15445 !! wikitext
15446 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15447 <div style="top:EXPRESSION(alert())">B</div>
15448 !! html
15449 <p style="/* insecure input */">A</p>
15450 <div style="/* insecure input */">B</div>
15451
15452 !! end
15453
15454 !! test
15455 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15456 !! wikitext
15457 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15458 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15459 !! html
15460 <div style="/* insecure input */">A</div>
15461 <p style="/* insecure input */">B</p>
15462
15463 !! end
15464
15465 !! test
15466 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15467 !! wikitext
15468 <div style="background-image:url⁽javascript:alert())">A</div>
15469 <div style="background-image:url₍javascript:alert())">B</div>
15470 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15471 !! html
15472 <div style="/* insecure input */">A</div>
15473 <div style="/* insecure input */">B</div>
15474 <p style="/* insecure input */">C</p>
15475
15476 !! end
15477
15478 !! test
15479 Opera -o-link CSS
15480 !! wikitext
15481 <div
15482 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;"
15483 style="-o-link:attr(title);-o-link-source:current">X</div>
15484 !! html
15485 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15486
15487 !! end
15488
15489 !! test
15490 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15491 !! wikitext
15492 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15493 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15494 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15495 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15496 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15497 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15498 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15499 !! html
15500 <p style="/* insecure input */">A</p>
15501 <p style="/* insecure input */">B</p>
15502 <p style="/* insecure input */">C</p>
15503 <p style="/* insecure input */">D</p>
15504 <p style="/* insecure input */">E</p>
15505 <p style="/* insecure input */">F</p>
15506 <p style="/* insecure input */">G</p>
15507
15508 !! end
15509
15510 !! test
15511 Table attribute legitimate extension
15512 !! wikitext
15513 {|
15514 !+ style="<nowiki>color:blue</nowiki>"| status
15515 |}
15516 !! html
15517 <table>
15518 <tr>
15519 <th style="color:blue"> status
15520 </th></tr></table>
15521
15522 !!end
15523
15524 !! test
15525 Table attribute safety
15526 !! wikitext
15527 {|
15528 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15529 |}
15530 !! html
15531 <table>
15532 <tr>
15533 <th style="/* insecure input */"> status
15534 </th></tr></table>
15535
15536 !! end
15537
15538 !! test
15539 CSS line continuation 1
15540 !! wikitext
15541 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15542 !! html
15543 <div style="/* insecure input */"></div>
15544
15545 !! end
15546
15547 !! test
15548 CSS line continuation 2
15549 !! wikitext
15550 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15551 !! html
15552 <div style="/* insecure input */"></div>
15553
15554 !! end
15555
15556 !! article
15557 Template:Identity
15558 !! text
15559 {{{1}}}
15560 !! endarticle
15561
15562 !! test
15563 Expansion of multi-line templates in attribute values (bug 6255)
15564 !! wikitext
15565 <div style="background: {{identity|#00FF00}}">-</div>
15566 !! html
15567 <div style="background: #00FF00">-</div>
15568
15569 !! end
15570
15571
15572 !! test
15573 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15574 !! wikitext
15575 <div style="background:
15576 #00FF00">-</div>
15577 !! html/php
15578 <div style="background: #00FF00">-</div>
15579
15580 !! html/parsoid
15581 <div style="background:
15582 #00FF00">-</div>
15583 !! end
15584
15585 !! test
15586 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15587 !! wikitext
15588 <div style="background: &#10;#00FF00">-</div>
15589 !! html
15590 <div style="background: &#10;#00FF00">-</div>
15591
15592 !! end
15593
15594 !! test
15595 evil <math>-wiki-tags without Extension:Math enabled
15596 !! wikitext
15597 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15598 !! html+tidy
15599 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
15600 !! end
15601
15602 ###
15603 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15604 ###
15605 !! test
15606 Parser hook: empty input
15607 !! wikitext
15608 <tag></tag>
15609 !! html
15610 <pre>
15611 ''
15612 array (
15613 )
15614 </pre>
15615
15616 !! end
15617
15618 !! test
15619 Parser hook: empty input using terminated empty elements
15620 !! wikitext
15621 <tag/>
15622 !! html
15623 <pre>
15624 NULL
15625 array (
15626 )
15627 </pre>
15628
15629 !! end
15630
15631 !! test
15632 Parser hook: empty input using terminated empty elements (space before)
15633 !! wikitext
15634 <tag />
15635 !! html
15636 <pre>
15637 NULL
15638 array (
15639 )
15640 </pre>
15641
15642 !! end
15643
15644 !! test
15645 Parser hook: basic input
15646 !! wikitext
15647 <tag>input</tag>
15648 !! html
15649 <pre>
15650 'input'
15651 array (
15652 )
15653 </pre>
15654
15655 !! end
15656
15657
15658 !! test
15659 Parser hook: case insensitive
15660 !! wikitext
15661 <TAG>input</TAG>
15662 !! html
15663 <pre>
15664 'input'
15665 array (
15666 )
15667 </pre>
15668
15669 !! end
15670
15671
15672 !! test
15673 Parser hook: case insensitive, redux
15674 !! wikitext
15675 <TaG>input</TAg>
15676 !! html
15677 <pre>
15678 'input'
15679 array (
15680 )
15681 </pre>
15682
15683 !! end
15684
15685 !! test
15686 Parser hook: nested tags
15687 !! options
15688 noxml
15689 !! wikitext
15690 <tag><tag></tag></tag>
15691 !! html
15692 <pre>
15693 '<tag>'
15694 array (
15695 )
15696 </pre>&lt;/tag&gt;
15697
15698 !! end
15699
15700 !! test
15701 Parser hook: basic arguments
15702 !! wikitext
15703 <tag width=200 height = "100" depth = '50' square></tag>
15704 !! html
15705 <pre>
15706 ''
15707 array (
15708 'width' => '200',
15709 'height' => '100',
15710 'depth' => '50',
15711 'square' => 'square',
15712 )
15713 </pre>
15714
15715 !! end
15716
15717 !! test
15718 Parser hook: argument containing a forward slash (bug 5344)
15719 !! wikitext
15720 <tag filename='/tmp/bla'></tag>
15721 !! html
15722 <pre>
15723 ''
15724 array (
15725 'filename' => '/tmp/bla',
15726 )
15727 </pre>
15728
15729 !! end
15730
15731 !! test
15732 Parser hook: empty input using terminated empty elements (bug 2374)
15733 !! wikitext
15734 <tag foo=bar/>text
15735 !! html
15736 <pre>
15737 NULL
15738 array (
15739 'foo' => 'bar',
15740 )
15741 </pre>text
15742
15743 !! end
15744
15745 # </tag> should be output literally since there is no matching tag that begins it
15746 !! test
15747 Parser hook: basic arguments using terminated empty elements (bug 2374)
15748 !! wikitext
15749 <tag width=200 height = "100" depth = '50' square/>
15750 other stuff
15751 </tag>
15752 !! html
15753 <pre>
15754 NULL
15755 array (
15756 'width' => '200',
15757 'height' => '100',
15758 'depth' => '50',
15759 'square' => 'square',
15760 )
15761 </pre>
15762 <p>other stuff
15763 &lt;/tag&gt;
15764 </p>
15765 !! end
15766
15767 ###
15768 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15769 ###
15770
15771 !! test
15772 Parser hook: static parser hook not inside a comment
15773 !! wikitext
15774 <statictag>hello, world</statictag>
15775 <statictag action=flush/>
15776 !! html
15777 <p>hello, world
15778 </p>
15779 !! end
15780
15781
15782 !! test
15783 Parser hook: static parser hook inside a comment
15784 !! wikitext
15785 <!-- <statictag>hello, world</statictag> -->
15786 <statictag action=flush/>
15787 !! html
15788 <p><br />
15789 </p>
15790 !! end
15791
15792 # Nested template calls; this case was broken by Parser.php rev 1.506,
15793 # since reverted.
15794
15795 !! article
15796 Template:One-parameter
15797 !! text
15798 (My parameter is: {{{1}}})
15799 !! endarticle
15800
15801 !! article
15802 Template:Map-one-parameter
15803 !! text
15804 {{{{{1}}}|{{{2}}}}}
15805 !! endarticle
15806
15807 !! test
15808 Nested template calls
15809 !! wikitext
15810 {{Map-one-parameter|One-parameter|param}}
15811 !! html
15812 <p>(My parameter is: param)
15813 </p>
15814 !! end
15815
15816
15817 ###
15818 ### Sanitizer
15819 ###
15820
15821 # HTML+Tidy effectively strips out the empty tags completely
15822 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15823 # which Tidy would have done for the PHP parser had there been content inside it.
15824 !! test
15825 Sanitizer: Closing of open tags
15826 !! wikitext
15827 <s></s><table></table>
15828 !! html
15829 <s></s><table></table>
15830
15831 !! html/parsoid
15832 <p><s></s></p><table></table>
15833 !! end
15834
15835 !! test
15836 Sanitizer: Closing of open but not closed tags
15837 !! wikitext
15838 <s>foo
15839 !! html
15840 <p><s>foo</s>
15841 </p>
15842 !! end
15843
15844 !! test
15845 Sanitizer: Closing of closed but not open tags
15846 !! wikitext
15847 </s>
15848 !! html
15849 <p>&lt;/s&gt;
15850 </p>
15851 !! end
15852
15853 !! test
15854 Sanitizer: Closing of closed but not open table tags
15855 !! wikitext
15856 Table not started</td></tr></table>
15857 !! html
15858 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15859 </p>
15860 !! end
15861
15862 !! test
15863 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15864 !! wikitext
15865 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15866 !! html
15867 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15868 </p>
15869 !! end
15870
15871 # In HTML5, the restrictions are that id must contain at least one character,
15872 # and must not contain any space characters.
15873 !! test
15874 Sanitizer: Validating the contents of the id attribute (bug 4515)
15875 !! options
15876 disabled
15877 !! wikitext
15878 <br id="" /><br id="a space" />
15879 !! html
15880 Something ...
15881 !! end
15882
15883 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15884 !! test
15885 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15886 !! options
15887 disabled
15888 !! wikitext
15889 <br id="foo" /><br id="foo" />
15890 !! html
15891 Something need to be done. foo-2 ?
15892 !! end
15893
15894 !! test
15895 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15896 !! wikitext
15897 <div itemscope>
15898 <meta itemprop="hello" content="world">
15899 <meta http-equiv="refresh" content="5">
15900 <meta itemprop="hello" http-equiv="refresh" content="5">
15901 <link itemprop="hello" href="{{SERVER}}">
15902 <link rel="stylesheet" href="{{SERVER}}">
15903 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15904 </div>
15905 !! html
15906 <div itemscope="itemscope">
15907 <p> <meta itemprop="hello" content="world" />
15908 &lt;meta http-equiv="refresh" content="5"&gt;
15909 <meta itemprop="hello" content="5" />
15910 </p>
15911 <link itemprop="hello" href="http&#58;//example.org" />
15912 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15913 <link itemprop="hello" href="http&#58;//example.org" />
15914 </div>
15915
15916 !! end
15917
15918 !! test
15919 Language converter: output gets cut off unexpectedly (bug 5757)
15920 !! options
15921 language=zh
15922 !! wikitext
15923 this bit is safe: }-
15924
15925 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15926
15927 then we get cut off here: }-
15928
15929 all additional text is vanished
15930 !! html
15931 <p>this bit is safe: }-
15932 </p><p>but if we add a conversion instance: xxx
15933 </p><p>then we get cut off here: }-
15934 </p><p>all additional text is vanished
15935 </p>
15936 !! end
15937
15938 !! test
15939 Self closed html pairs (bug 5487)
15940 !! options
15941 !! wikitext
15942 <center><font id="bug" />Centered text</center>
15943 <div><font id="bug2" />In div text</div>
15944 !! html
15945 <center>&lt;font id="bug" /&gt;Centered text</center>
15946 <div>&lt;font id="bug2" /&gt;In div text</div>
15947
15948 !! end
15949
15950 #
15951 #
15952 #
15953
15954 !! test
15955 Punctuation: nbsp before exclamation
15956 !! wikitext
15957 C'est grave !
15958 !! html
15959 <p>C'est grave&#160;!
15960 </p>
15961 !! end
15962
15963 !! test
15964 Punctuation: CSS !important (bug 11874)
15965 !! wikitext
15966 <div style="width:50% !important">important</div>
15967 !! html
15968 <div style="width:50% !important">important</div>
15969
15970 !!end
15971
15972 !! test
15973 Punctuation: CSS ! important (bug 11874; with space after)
15974 !! wikitext
15975 <div style="width:50% ! important">important</div>
15976 !! html
15977 <div style="width:50% ! important">important</div>
15978
15979 !!end
15980
15981 !! test
15982 HTML bullet list, closed tags (bug 5497)
15983 !! wikitext
15984 <ul>
15985 <li>One</li>
15986 <li>Two</li>
15987 </ul>
15988 !! html/php
15989 <ul>
15990 <li>One</li>
15991 <li>Two</li>
15992 </ul>
15993
15994 !! html/parsoid
15995 <ul data-parsoid='{"stx":"html"}'>
15996 <li data-parsoid='{"stx":"html"}'>One</li>
15997 <li data-parsoid='{"stx":"html"}'>Two</li>
15998 </ul>
15999
16000 !! end
16001
16002 !! test
16003 HTML bullet list, unclosed tags (bug 5497)
16004 !! wikitext
16005 <ul>
16006 <li>One
16007 <li>Two
16008 </ul>
16009 !! html/php+tidy
16010 <ul>
16011 <li>One</li>
16012 <li>Two</li>
16013 </ul>
16014 !! html/parsoid
16015 <ul data-parsoid='{"stx":"html"}'>
16016 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16017 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16018 </ul>
16019
16020 !! end
16021
16022 !! test
16023 HTML ordered list, closed tags (bug 5497)
16024 !! wikitext
16025 <ol>
16026 <li>One</li>
16027 <li>Two</li>
16028 </ol>
16029 !! html/php
16030 <ol>
16031 <li>One</li>
16032 <li>Two</li>
16033 </ol>
16034
16035 !! html/parsoid
16036 <ol data-parsoid='{"stx":"html"}'>
16037 <li data-parsoid='{"stx":"html"}'>One</li>
16038 <li data-parsoid='{"stx":"html"}'>Two</li>
16039 </ol>
16040
16041 !! end
16042
16043 !! test
16044 HTML ordered list, unclosed tags (bug 5497)
16045 !! options
16046 !! wikitext
16047 <ol>
16048 <li>One
16049 <li>Two
16050 </ol>
16051 !! html/php+tidy
16052 <ol>
16053 <li>One</li>
16054 <li>Two</li>
16055 </ol>
16056 !! html/parsoid
16057 <ol data-parsoid='{"stx":"html"}'>
16058 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16059 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16060 </ol>
16061
16062 !! end
16063
16064 !! test
16065 HTML nested bullet list, closed tags (bug 5497)
16066 !! wikitext
16067 <ul>
16068 <li>One</li>
16069 <li>Two:
16070 <ul>
16071 <li>Sub-one</li>
16072 <li>Sub-two</li>
16073 </ul>
16074 </li>
16075 </ul>
16076 !! html
16077 <ul>
16078 <li>One</li>
16079 <li>Two:
16080 <ul>
16081 <li>Sub-one</li>
16082 <li>Sub-two</li>
16083 </ul>
16084 </li>
16085 </ul>
16086
16087 !! end
16088
16089 !! test
16090 HTML nested bullet list, open tags (bug 5497)
16091 !! wikitext
16092 <ul>
16093 <li>One
16094 <li>Two:
16095 <ul>
16096 <li>Sub-one
16097 <li>Sub-two
16098 </ul>
16099 </ul>
16100 !! html/php+tidy
16101 <ul>
16102 <li>One</li>
16103 <li>Two:
16104 <ul>
16105 <li>Sub-one</li>
16106 <li>Sub-two</li>
16107 </ul>
16108 </li>
16109 </ul>
16110 !! html/parsoid
16111 <ul>
16112 <li>One
16113 </li>
16114 <li>Two:
16115 <ul>
16116 <li>Sub-one
16117 </li>
16118 <li>Sub-two
16119 </li>
16120 </ul>
16121 </li>
16122 </ul>
16123
16124 !! end
16125
16126 !! test
16127 HTML nested ordered list, closed tags (bug 5497)
16128 !! wikitext
16129 <ol>
16130 <li>One</li>
16131 <li>Two:
16132 <ol>
16133 <li>Sub-one</li>
16134 <li>Sub-two</li>
16135 </ol>
16136 </li>
16137 </ol>
16138 !! html
16139 <ol>
16140 <li>One</li>
16141 <li>Two:
16142 <ol>
16143 <li>Sub-one</li>
16144 <li>Sub-two</li>
16145 </ol>
16146 </li>
16147 </ol>
16148
16149 !! end
16150
16151 !! test
16152 HTML nested ordered list, open tags (bug 5497)
16153 !! wikitext
16154 <ol>
16155 <li>One
16156 <li>Two:
16157 <ol>
16158 <li>Sub-one
16159 <li>Sub-two
16160 </ol>
16161 </ol>
16162 !! html/php
16163 <ol>
16164 <li>One
16165 <li>Two:
16166 <ol>
16167 <li>Sub-one
16168 <li>Sub-two
16169 </ol>
16170 </ol>
16171
16172 !! html/parsoid
16173 <ol>
16174 <li>One
16175 </li>
16176 <li>Two:
16177 <ol>
16178 <li>Sub-one
16179 </li>
16180 <li>Sub-two
16181 </li>
16182 </ol>
16183 </li>
16184 </ol>
16185
16186 !! end
16187
16188 !! test
16189 HTML ordered list item with parameters oddity
16190 !! wikitext
16191 <ol><li id="fragment">One</li>
16192 </ol>
16193 !! html
16194 <ol><li id="fragment">One</li>
16195 </ol>
16196
16197 !! end
16198
16199 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16200 !!test
16201 bug 5918: autonumbering
16202 !! wikitext
16203 [http://first/] [http://second] [ftp://ftp]
16204
16205 ftp://inlineftp
16206
16207 [mailto:enclosed@mail.tld With target]
16208
16209 [mailto:enclosed@mail.tld]
16210
16211 mailto:inline@mail.tld
16212 !! html/php
16213 <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>
16214 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16215 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16216 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16217 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16218 </p>
16219 !! html/parsoid
16220 <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>
16221 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16222 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16223 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16224 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16225 !! end
16226
16227
16228 #
16229 # Security and HTML correctness
16230 # From Nick Jenkins' fuzz testing
16231 #
16232
16233 !! test
16234 Fuzz testing: Parser13
16235 !! wikitext
16236 {|
16237 | http://a|
16238 !! html
16239 <table>
16240 <tr>
16241 <td>
16242 </td>
16243 </tr>
16244 </table>
16245
16246 !! end
16247
16248 !! test
16249 Fuzz testing: Parser14
16250 !! wikitext
16251 == onmouseover= ==
16252 http://__TOC__
16253 !! html
16254 <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>
16255 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16256 <ul>
16257 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16258 </ul>
16259 </div>
16260
16261
16262 !! html+tidy
16263 <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>
16264 <p>http://</p>
16265 <div id="toc" class="toc">
16266 <div id="toctitle">
16267 <h2>Contents</h2>
16268 </div>
16269 <ul>
16270 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16271 </ul>
16272 </div>
16273 <p></p>
16274 !! end
16275
16276 !! test
16277 Fuzz testing: Parser14-table
16278 !! wikitext
16279 ==a==
16280 {| STYLE=__TOC__
16281 !! html
16282 <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>
16283 <table style="&#95;_TOC&#95;_">
16284 <tr><td></td></tr>
16285 </table>
16286
16287 !! html+tidy
16288 <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>
16289 <table style="__TOC__">
16290 <tr>
16291 <td></td>
16292 </tr>
16293 </table>
16294 !! end
16295
16296 # Known to produce bogus xml (extra </td>)
16297 !! test
16298 Fuzz testing: Parser16
16299 !! options
16300 noxml
16301 !! wikitext
16302 {|
16303 !https://||||||
16304 !! html
16305 <table>
16306 <tr>
16307 <th>https://</th>
16308 <th></th>
16309 <th></th>
16310 <th>
16311 </td>
16312 </tr>
16313 </table>
16314
16315 !! html+tidy
16316 <table>
16317 <tr>
16318 <th>https://</th>
16319 <th></th>
16320 <th></th>
16321 <th></th>
16322 </tr>
16323 </table>
16324 !! end
16325
16326 !! test
16327 Fuzz testing: Parser21
16328 !! wikitext
16329 {|
16330 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16331 |
16332 !! html
16333 <table>
16334 <tr>
16335 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16336 </th>
16337 <td>
16338 </td>
16339 </tr>
16340 </table>
16341
16342 !! end
16343
16344 !! test
16345 Fuzz testing: Parser22
16346 !! wikitext
16347 http://===r:::https://b
16348
16349 {|
16350 !! html
16351 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16352 </p>
16353 <table>
16354 <tr><td></td></tr>
16355 </table>
16356
16357 !! end
16358
16359 # Known to produce bad XML for now
16360 !! test
16361 Fuzz testing: Parser24
16362 !! options
16363 noxml
16364 !! wikitext
16365 {|
16366 {{{|
16367 <u CLASS=
16368 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16369 <br style="onmouseover='alert(document.cookie);' " />
16370
16371 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16372 |
16373 !! html
16374 <table>
16375 {{{|
16376 <u class="&#124;">}}}} &gt;
16377 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16378
16379 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16380 <tr>
16381 <td></u>
16382 </td>
16383 </tr>
16384 </table>
16385
16386 !! end
16387
16388 # Note: the current result listed for this is not what the original one was,
16389 # but the original bug was JavaScript injection, which is fixed in any case.
16390 # It's not clear that the original result listed was any more correct than the
16391 # current one. Original result:
16392 # <p>{{{|
16393 # </p>
16394 # <li class="&#124;&#124;">
16395 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16396 !!test
16397 Fuzz testing: Parser25 (bug 6055)
16398 !! wikitext
16399 {{{
16400 |
16401 <LI CLASS=||
16402 >
16403 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16404 !! html
16405 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16406 </p>
16407 !! end
16408
16409 !!test
16410 Fuzz testing: URL adjacent extension (with space, clean)
16411 !! wikitext
16412 http://example.com <nowiki>junk</nowiki>
16413 !! html/php
16414 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16415 </p>
16416 !! html/parsoid
16417 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16418 !! end
16419
16420 !!test
16421 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16422 !! wikitext
16423 http://example.com<nowiki>junk</nowiki>
16424 !! html/php
16425 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16426 </p>
16427 !! html/parsoid
16428 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16429 !! end
16430
16431 !!test
16432 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16433 !! wikitext
16434 http://example.com<pre>junk</pre>
16435 !! html/php
16436 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16437
16438 !! html/php+tidy
16439 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16440 <pre>
16441 junk
16442 </pre>
16443 !! html/parsoid
16444 <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>
16445 !!end
16446
16447 !!test
16448 Fuzz testing: image with bogus manual thumbnail
16449 !! wikitext
16450 [[Image:foobar.jpg|thumbnail= ]]
16451 !! html/php
16452 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16453
16454 !! html/parsoid
16455 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' 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":{},"dsr":[2,30,null,null]}'><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>
16456 !!end
16457
16458 !! test
16459 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16460 !! wikitext
16461 <pre dir="&#10;"></pre>
16462 !! html
16463 <pre dir="&#10;"></pre>
16464
16465 !! end
16466
16467 !! test
16468 Parsing optional HTML elements (Bug 6171)
16469 !! options
16470 !! wikitext
16471 <table>
16472 <tr>
16473 <td> Some tabular data</td>
16474 <td> More tabular data ...
16475 <td> And yet som tabular data</td>
16476 </tr>
16477 </table>
16478 !! html
16479 <table>
16480 <tr>
16481 <td> Some tabular data</td>
16482 <td> More tabular data ...
16483 </td><td> And yet som tabular data</td>
16484 </tr>
16485 </table>
16486
16487 !! end
16488
16489 !! test
16490 Correct handling of <td>, <tr> (Bug 6171)
16491 !! options
16492 !! wikitext
16493 <table>
16494 <tr>
16495 <td> Some tabular data</td>
16496 <td> More tabular data ...</td>
16497 <td> And yet som tabular data</td>
16498 </tr>
16499 </table>
16500 !! html
16501 <table>
16502 <tr>
16503 <td> Some tabular data</td>
16504 <td> More tabular data ...</td>
16505 <td> And yet som tabular data</td>
16506 </tr>
16507 </table>
16508
16509 !! end
16510
16511
16512 !! test
16513 Parsing crashing regression (fr:JavaScript)
16514 !! wikitext
16515 </body></x>
16516 !! html
16517 <p>&lt;/body&gt;&lt;/x&gt;
16518 </p>
16519 !! end
16520
16521 !! test
16522 Inline wiki vs wiki block nesting
16523 !! wikitext
16524 '''Bold paragraph
16525
16526 New wiki paragraph
16527 !! html
16528 <p><b>Bold paragraph</b>
16529 </p><p>New wiki paragraph
16530 </p>
16531 !! end
16532
16533 # FIXME: The current php output is documented
16534 # and desired output is the parsoid target.
16535 !! test
16536 Inline HTML vs wiki block nesting
16537 !! wikitext
16538 <b>Bold paragraph
16539
16540 New wiki paragraph
16541 !! html/php
16542 <p><b>Bold paragraph
16543 </p><p>New wiki paragraph</b>
16544 </p>
16545 !! html/parsoid
16546 <p><b>Bold paragraph</b>
16547 </p><p>New wiki paragraph
16548 </p>
16549 !! end
16550
16551 # Original result was this:
16552 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16553 # </p>
16554 # While that might be marginally more intuitive, maybe, the six-apostrophe
16555 # construct is clearly pathological and the result stated here (which is what
16556 # the parser actually does) is about as reasonable as anything.
16557 !!test
16558 Mixing markup for italics and bold
16559 !! options
16560 !! wikitext
16561 '''bold''''''bold''bolditalics'''''
16562 !! html
16563 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16564 </p>
16565 !! end
16566
16567
16568 !! article
16569 Xyzzyx
16570 !! text
16571 Article for special page transclusion test
16572 !! endarticle
16573
16574 !! test
16575 Special page transclusion
16576 !! options
16577 !! wikitext
16578 {{Special:Prefixindex/Xyzzyx}}
16579 !! html
16580 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16581
16582 !! end
16583
16584 !! test
16585 Special page transclusion twice (bug 5021)
16586 !! options
16587 !! wikitext
16588 {{Special:Prefixindex/Xyzzyx}}
16589 {{Special:Prefixindex/Xyzzyx}}
16590 !! html
16591 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16592 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16593
16594 !! end
16595
16596 !! test
16597 Transclusion of default MediaWiki message
16598 !! wikitext
16599 {{MediaWiki:Mainpage}}
16600 !! html
16601 <p>Main Page
16602 </p>
16603 !! end
16604
16605 !! test
16606 Transclusion of nonexistent MediaWiki message
16607 !! wikitext
16608 {{MediaWiki:Mainpagexxx}}
16609 !! html
16610 <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>
16611 </p>
16612 !! end
16613
16614 !! test
16615 Transclusion of MediaWiki message with underscore
16616 !! wikitext
16617 {{MediaWiki:history_short}}
16618 !! html
16619 <p>History
16620 </p>
16621 !! end
16622
16623 !! test
16624 Transclusion of MediaWiki message with space
16625 !! wikitext
16626 {{MediaWiki:history short}}
16627 !! html
16628 <p>History
16629 </p>
16630 !! end
16631
16632 !! test
16633 Invalid header with following text
16634 !! wikitext
16635 = x = y
16636 !! html
16637 <p>= x = y
16638 </p>
16639 !! end
16640
16641
16642 !! test
16643 Section extraction test (section 0)
16644 !! options
16645 section=0
16646 !! wikitext
16647 start
16648 ==a==
16649 ===aa===
16650 ====aaa====
16651 ==b==
16652 ===ba===
16653 ===bb===
16654 ====bba====
16655 ===bc===
16656 ==c==
16657 ===ca===
16658 !! html
16659 start
16660 !! end
16661
16662 !! test
16663 Section extraction test (section 1)
16664 !! options
16665 section=1
16666 !! wikitext
16667 start
16668 ==a==
16669 ===aa===
16670 ====aaa====
16671 ==b==
16672 ===ba===
16673 ===bb===
16674 ====bba====
16675 ===bc===
16676 ==c==
16677 ===ca===
16678 !! html
16679 ==a==
16680 ===aa===
16681 ====aaa====
16682 !! end
16683
16684 !! test
16685 Section extraction test (section 2)
16686 !! options
16687 section=2
16688 !! wikitext
16689 start
16690 ==a==
16691 ===aa===
16692 ====aaa====
16693 ==b==
16694 ===ba===
16695 ===bb===
16696 ====bba====
16697 ===bc===
16698 ==c==
16699 ===ca===
16700 !! html
16701 ===aa===
16702 ====aaa====
16703 !! end
16704
16705 !! test
16706 Section extraction test (section 3)
16707 !! options
16708 section=3
16709 !! wikitext
16710 start
16711 ==a==
16712 ===aa===
16713 ====aaa====
16714 ==b==
16715 ===ba===
16716 ===bb===
16717 ====bba====
16718 ===bc===
16719 ==c==
16720 ===ca===
16721 !! html
16722 ====aaa====
16723 !! end
16724
16725 !! test
16726 Section extraction test (section 4)
16727 !! options
16728 section=4
16729 !! wikitext
16730 start
16731 ==a==
16732 ===aa===
16733 ====aaa====
16734 ==b==
16735 ===ba===
16736 ===bb===
16737 ====bba====
16738 ===bc===
16739 ==c==
16740 ===ca===
16741 !! html
16742 ==b==
16743 ===ba===
16744 ===bb===
16745 ====bba====
16746 ===bc===
16747 !! end
16748
16749 !! test
16750 Section extraction test (section 5)
16751 !! options
16752 section=5
16753 !! wikitext
16754 start
16755 ==a==
16756 ===aa===
16757 ====aaa====
16758 ==b==
16759 ===ba===
16760 ===bb===
16761 ====bba====
16762 ===bc===
16763 ==c==
16764 ===ca===
16765 !! html
16766 ===ba===
16767 !! end
16768
16769 !! test
16770 Section extraction test (section 6)
16771 !! options
16772 section=6
16773 !! wikitext
16774 start
16775 ==a==
16776 ===aa===
16777 ====aaa====
16778 ==b==
16779 ===ba===
16780 ===bb===
16781 ====bba====
16782 ===bc===
16783 ==c==
16784 ===ca===
16785 !! html
16786 ===bb===
16787 ====bba====
16788 !! end
16789
16790 !! test
16791 Section extraction test (section 7)
16792 !! options
16793 section=7
16794 !! wikitext
16795 start
16796 ==a==
16797 ===aa===
16798 ====aaa====
16799 ==b==
16800 ===ba===
16801 ===bb===
16802 ====bba====
16803 ===bc===
16804 ==c==
16805 ===ca===
16806 !! html
16807 ====bba====
16808 !! end
16809
16810 !! test
16811 Section extraction test (section 8)
16812 !! options
16813 section=8
16814 !! wikitext
16815 start
16816 ==a==
16817 ===aa===
16818 ====aaa====
16819 ==b==
16820 ===ba===
16821 ===bb===
16822 ====bba====
16823 ===bc===
16824 ==c==
16825 ===ca===
16826 !! html
16827 ===bc===
16828 !! end
16829
16830 !! test
16831 Section extraction test (section 9)
16832 !! options
16833 section=9
16834 !! wikitext
16835 start
16836 ==a==
16837 ===aa===
16838 ====aaa====
16839 ==b==
16840 ===ba===
16841 ===bb===
16842 ====bba====
16843 ===bc===
16844 ==c==
16845 ===ca===
16846 !! html
16847 ==c==
16848 ===ca===
16849 !! end
16850
16851 !! test
16852 Section extraction test (section 10)
16853 !! options
16854 section=10
16855 !! wikitext
16856 start
16857 ==a==
16858 ===aa===
16859 ====aaa====
16860 ==b==
16861 ===ba===
16862 ===bb===
16863 ====bba====
16864 ===bc===
16865 ==c==
16866 ===ca===
16867 !! html
16868 ===ca===
16869 !! end
16870
16871 !! test
16872 Section extraction test (nonexistent section 11)
16873 !! options
16874 section=11
16875 !! wikitext
16876 start
16877 ==a==
16878 ===aa===
16879 ====aaa====
16880 ==b==
16881 ===ba===
16882 ===bb===
16883 ====bba====
16884 ===bc===
16885 ==c==
16886 ===ca===
16887 !! html
16888 !! end
16889
16890 !! test
16891 Section extraction test with bogus heading (section 1)
16892 !! options
16893 section=1
16894 !! wikitext
16895 ==a==
16896 ==bogus== not a legal section
16897 ==b==
16898 !! html
16899 ==a==
16900 ==bogus== not a legal section
16901 !! end
16902
16903 !! test
16904 Section extraction test with bogus heading (section 2)
16905 !! options
16906 section=2
16907 !! wikitext
16908 ==a==
16909 ==bogus== not a legal section
16910 ==b==
16911 !! html
16912 ==b==
16913 !! end
16914
16915 !! test
16916 Section extraction test with comment after heading (section 1)
16917 !! options
16918 section=1
16919 !! wikitext
16920 ==a==
16921 ==b== <!-- -->
16922 ==c==
16923 !! html
16924 ==a==
16925 !! end
16926
16927 !! test
16928 Section extraction test with comment after heading (section 2)
16929 !! options
16930 section=2
16931 !! wikitext
16932 ==a==
16933 ==b== <!-- -->
16934 ==c==
16935 !! html
16936 ==b== <!-- -->
16937 !! end
16938
16939 !! test
16940 Section extraction test with bogus <nowiki> heading (section 1)
16941 !! options
16942 section=1
16943 !! wikitext
16944 ==a==
16945 ==bogus== <nowiki>not a legal section</nowiki>
16946 ==b==
16947 !! html
16948 ==a==
16949 ==bogus== <nowiki>not a legal section</nowiki>
16950 !! end
16951
16952 !! test
16953 Section extraction test with bogus <nowiki> heading (section 2)
16954 !! options
16955 section=2
16956 !! wikitext
16957 ==a==
16958 ==bogus== <nowiki>not a legal section</nowiki>
16959 ==b==
16960 !! html
16961 ==b==
16962 !! end
16963
16964
16965 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16966 # instead of respecting commented sections
16967 !! test
16968 Section extraction prefixed by comment (section 1)
16969 !! options
16970 section=1
16971 !! wikitext
16972 <!-- -->==sec1==
16973 ==sec2==
16974 !! html
16975 ==sec2==
16976 !!end
16977
16978 !! test
16979 Section extraction prefixed by comment (section 2)
16980 !! options
16981 section=2
16982 !! wikitext
16983 <!-- -->==sec1==
16984 ==sec2==
16985 !! html
16986
16987 !!end
16988
16989
16990 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16991 # instead of respecting HTML-style headings
16992 !! test
16993 Section extraction, mixed wiki and html (section 1)
16994 !! options
16995 section=1
16996 !! wikitext
16997 <h2>unmarked</h2>
16998 unmarked
16999 ==1==
17000 one
17001 ==2==
17002 two
17003 !! html
17004 ==1==
17005 one
17006 !! end
17007
17008 !! test
17009 Section extraction, mixed wiki and html (section 2)
17010 !! options
17011 section=2
17012 !! wikitext
17013 <h2>unmarked</h2>
17014 unmarked
17015 ==1==
17016 one
17017 ==2==
17018 two
17019 !! html
17020 ==2==
17021 two
17022 !! end
17023
17024
17025 # Formerly testing for bug 3342
17026 !! test
17027 Section extraction, heading surrounded by <noinclude>
17028 !! options
17029 section=1
17030 !! wikitext
17031 <noinclude>==unmarked==</noinclude>
17032 ==marked==
17033 !! html
17034 ==marked==
17035 !!end
17036
17037 # Test behavior of bug 19910
17038 !! test
17039 Sectiion with all-equals
17040 !! options
17041 section=2
17042 !! wikitext
17043 ===
17044 The line above must have a trailing space
17045 === <!--
17046 --> <!-- -->
17047 But just in case it doesn't...
17048 !! html
17049 === <!--
17050 --> <!-- -->
17051 But just in case it doesn't...
17052 !! end
17053
17054 !! test
17055 Section replacement test (section 0)
17056 !! options
17057 replace=0,"xxx"
17058 !! wikitext
17059 start
17060 ==a==
17061 ===aa===
17062 ====aaa====
17063 ==b==
17064 ===ba===
17065 ===bb===
17066 ====bba====
17067 ===bc===
17068 ==c==
17069 ===ca===
17070 !! html
17071 xxx
17072
17073 ==a==
17074 ===aa===
17075 ====aaa====
17076 ==b==
17077 ===ba===
17078 ===bb===
17079 ====bba====
17080 ===bc===
17081 ==c==
17082 ===ca===
17083 !! end
17084
17085 !! test
17086 Section replacement test (section 1)
17087 !! options
17088 replace=1,"xxx"
17089 !! wikitext
17090 start
17091 ==a==
17092 ===aa===
17093 ====aaa====
17094 ==b==
17095 ===ba===
17096 ===bb===
17097 ====bba====
17098 ===bc===
17099 ==c==
17100 ===ca===
17101 !! html
17102 start
17103 xxx
17104
17105 ==b==
17106 ===ba===
17107 ===bb===
17108 ====bba====
17109 ===bc===
17110 ==c==
17111 ===ca===
17112 !! end
17113
17114 !! test
17115 Section replacement test (section 2)
17116 !! options
17117 replace=2,"xxx"
17118 !! wikitext
17119 start
17120 ==a==
17121 ===aa===
17122 ====aaa====
17123 ==b==
17124 ===ba===
17125 ===bb===
17126 ====bba====
17127 ===bc===
17128 ==c==
17129 ===ca===
17130 !! html
17131 start
17132 ==a==
17133 xxx
17134
17135 ==b==
17136 ===ba===
17137 ===bb===
17138 ====bba====
17139 ===bc===
17140 ==c==
17141 ===ca===
17142 !! end
17143
17144 !! test
17145 Section replacement test (section 3)
17146 !! options
17147 replace=3,"xxx"
17148 !! wikitext
17149 start
17150 ==a==
17151 ===aa===
17152 ====aaa====
17153 ==b==
17154 ===ba===
17155 ===bb===
17156 ====bba====
17157 ===bc===
17158 ==c==
17159 ===ca===
17160 !! html
17161 start
17162 ==a==
17163 ===aa===
17164 xxx
17165
17166 ==b==
17167 ===ba===
17168 ===bb===
17169 ====bba====
17170 ===bc===
17171 ==c==
17172 ===ca===
17173 !! end
17174
17175 !! test
17176 Section replacement test (section 4)
17177 !! options
17178 replace=4,"xxx"
17179 !! wikitext
17180 start
17181 ==a==
17182 ===aa===
17183 ====aaa====
17184 ==b==
17185 ===ba===
17186 ===bb===
17187 ====bba====
17188 ===bc===
17189 ==c==
17190 ===ca===
17191 !! html
17192 start
17193 ==a==
17194 ===aa===
17195 ====aaa====
17196 xxx
17197
17198 ==c==
17199 ===ca===
17200 !! end
17201
17202 !! test
17203 Section replacement test (section 5)
17204 !! options
17205 replace=5,"xxx"
17206 !! wikitext
17207 start
17208 ==a==
17209 ===aa===
17210 ====aaa====
17211 ==b==
17212 ===ba===
17213 ===bb===
17214 ====bba====
17215 ===bc===
17216 ==c==
17217 ===ca===
17218 !! html
17219 start
17220 ==a==
17221 ===aa===
17222 ====aaa====
17223 ==b==
17224 xxx
17225
17226 ===bb===
17227 ====bba====
17228 ===bc===
17229 ==c==
17230 ===ca===
17231 !! end
17232
17233 !! test
17234 Section replacement test (section 6)
17235 !! options
17236 replace=6,"xxx"
17237 !! wikitext
17238 start
17239 ==a==
17240 ===aa===
17241 ====aaa====
17242 ==b==
17243 ===ba===
17244 ===bb===
17245 ====bba====
17246 ===bc===
17247 ==c==
17248 ===ca===
17249 !! html
17250 start
17251 ==a==
17252 ===aa===
17253 ====aaa====
17254 ==b==
17255 ===ba===
17256 xxx
17257
17258 ===bc===
17259 ==c==
17260 ===ca===
17261 !! end
17262
17263 !! test
17264 Section replacement test (section 7)
17265 !! options
17266 replace=7,"xxx"
17267 !! wikitext
17268 start
17269 ==a==
17270 ===aa===
17271 ====aaa====
17272 ==b==
17273 ===ba===
17274 ===bb===
17275 ====bba====
17276 ===bc===
17277 ==c==
17278 ===ca===
17279 !! html
17280 start
17281 ==a==
17282 ===aa===
17283 ====aaa====
17284 ==b==
17285 ===ba===
17286 ===bb===
17287 xxx
17288
17289 ===bc===
17290 ==c==
17291 ===ca===
17292 !! end
17293
17294 !! test
17295 Section replacement test (section 8)
17296 !! options
17297 replace=8,"xxx"
17298 !! wikitext
17299 start
17300 ==a==
17301 ===aa===
17302 ====aaa====
17303 ==b==
17304 ===ba===
17305 ===bb===
17306 ====bba====
17307 ===bc===
17308 ==c==
17309 ===ca===
17310 !! html
17311 start
17312 ==a==
17313 ===aa===
17314 ====aaa====
17315 ==b==
17316 ===ba===
17317 ===bb===
17318 ====bba====
17319 xxx
17320
17321 ==c==
17322 ===ca===
17323 !!end
17324
17325 !! test
17326 Section replacement test (section 9)
17327 !! options
17328 replace=9,"xxx"
17329 !! wikitext
17330 start
17331 ==a==
17332 ===aa===
17333 ====aaa====
17334 ==b==
17335 ===ba===
17336 ===bb===
17337 ====bba====
17338 ===bc===
17339 ==c==
17340 ===ca===
17341 !! html
17342 start
17343 ==a==
17344 ===aa===
17345 ====aaa====
17346 ==b==
17347 ===ba===
17348 ===bb===
17349 ====bba====
17350 ===bc===
17351 xxx
17352 !! end
17353
17354 !! test
17355 Section replacement test (section 10)
17356 !! options
17357 replace=10,"xxx"
17358 !! wikitext
17359 start
17360 ==a==
17361 ===aa===
17362 ====aaa====
17363 ==b==
17364 ===ba===
17365 ===bb===
17366 ====bba====
17367 ===bc===
17368 ==c==
17369 ===ca===
17370 !! html
17371 start
17372 ==a==
17373 ===aa===
17374 ====aaa====
17375 ==b==
17376 ===ba===
17377 ===bb===
17378 ====bba====
17379 ===bc===
17380 ==c==
17381 xxx
17382 !! end
17383
17384 !! test
17385 Section replacement test with initial whitespace (bug 13728)
17386 !! options
17387 replace=2,"xxx"
17388 !! wikitext
17389 Preformatted initial line
17390 ==a==
17391 ===a===
17392 !! html
17393 Preformatted initial line
17394 ==a==
17395 xxx
17396 !! end
17397
17398
17399 !! test
17400 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17401 !! options
17402 section=1
17403 !! wikitext
17404 ==a==
17405 a
17406 !! html
17407 ==a==
17408 a
17409 !! end
17410
17411 !! test
17412 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17413 !! options
17414 section=1
17415 !! wikitext
17416 ==a==
17417 a
17418 !! html
17419 ==a==
17420 a
17421 !! end
17422
17423
17424 !! test
17425 Section extraction, <pre> around bogus header (bug 10309)
17426 !! options
17427 noxml section=2
17428 !! wikitext
17429 == Section One ==
17430 <pre>
17431 =======
17432 </pre>
17433
17434 == Section Two ==
17435 stuff
17436 !! html
17437 == Section Two ==
17438 stuff
17439 !! end
17440
17441 !! test
17442 Section replacement, <pre> around bogus header (bug 10309)
17443 !! options
17444 noxml replace=2,"xxx"
17445 !! wikitext
17446 == Section One ==
17447 <pre>
17448 =======
17449 </pre>
17450
17451 == Section Two ==
17452 stuff
17453 !! html
17454 == Section One ==
17455 <pre>
17456 =======
17457 </pre>
17458
17459 xxx
17460 !! end
17461
17462
17463
17464 !! test
17465 Handling of &#x0A; in URLs
17466 !! wikitext
17467 ** irc://&#x0A;a
17468 !! html/php
17469 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17470
17471 !! html/parsoid
17472 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17473 a">irc://
17474 a</a></li></ul></li></ul>
17475 !! end
17476
17477 !! test
17478 Handling of %0A in URLs
17479 !! wikitext
17480 ** irc://%0Aa
17481 !! html/php
17482 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17483
17484 !! html/parsoid
17485 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17486 !! end
17487
17488
17489 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17490 !! test
17491 5 quotes, code coverage +1 line
17492 !! options
17493 parsoid=wt2html
17494 !! wikitext
17495 '''''
17496 !! html/php
17497 !! html/parsoid
17498 <p><b><i></i></b></p>
17499 !! end
17500
17501 # same html as previous, but wikitext adjusted to match parsoid html2wt
17502 # note that wt2html and html2html will put the <i> before the <b>
17503 !! test
17504 5 quotes, code coverage +1 line w/ nowiki (1)
17505 !! options
17506 parsoid=wt2wt,html2wt
17507 !! wikitext
17508 '''''<nowiki/>'''''
17509 !! html/php
17510 <p><i></i>
17511 </p>
17512 !! html/parsoid
17513 <p><b><i></i></b></p>
17514 !! end
17515
17516 # same as previous, just swapping the <i> and <b>
17517 !! test
17518 5 quotes, code coverage +1 line w/ nowiki (2)
17519 !! wikitext
17520 '''''<nowiki/>'''''
17521 !! html/php
17522 <p><i></i>
17523 </p>
17524 !! html/parsoid
17525 <p><i><b></b></i></p>
17526 !! end
17527
17528 !! test
17529 Special:Search page linking.
17530 !! wikitext
17531 {{Special:search}}
17532 !! html
17533 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17534 </p>
17535 !! end
17536
17537 !! test
17538 {{!}} is a magic word
17539 !! wikitext
17540 {{!}} is a magic word there and {{!}} is still a magic word here
17541 !! html/php
17542 <p>| is a magic word there and | is still a magic word here
17543 </p>
17544 !! html/parsoid
17545 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
17546 !! end
17547
17548 !! test
17549 Say the magic word
17550 !! options
17551 title=[[Parser test]]
17552 !! wikitext
17553 * {{PAGENAME}}
17554 * {{PAGENAMEE}}
17555 * {{FULLPAGENAME}}
17556 * {{FULLPAGENAMEE}}
17557 * {{BASEPAGENAME}}
17558 * {{BASEPAGENAMEE}}
17559 * {{SUBPAGENAME}}
17560 * {{SUBPAGENAMEE}}
17561 * {{ROOTPAGENAME}}
17562 * {{ROOTPAGENAMEE}}
17563 * {{TALKPAGENAME}}
17564 * {{TALKPAGENAMEE}}
17565 * {{SUBJECTPAGENAME}}
17566 * {{SUBJECTPAGENAMEE}}
17567 * {{NAMESPACEE}}
17568 * {{NAMESPACE}}
17569 * {{NAMESPACENUMBER}}
17570 * {{TALKSPACE}}
17571 * {{TALKSPACEE}}
17572 * {{SUBJECTSPACE}}
17573 * {{SUBJECTSPACEE}}
17574 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17575 !! html
17576 <ul><li> Parser test</li>
17577 <li> Parser_test</li>
17578 <li> Parser test</li>
17579 <li> Parser_test</li>
17580 <li> Parser test</li>
17581 <li> Parser_test</li>
17582 <li> Parser test</li>
17583 <li> Parser_test</li>
17584 <li> Parser test</li>
17585 <li> Parser_test</li>
17586 <li> Talk:Parser test</li>
17587 <li> Talk:Parser_test</li>
17588 <li> Parser test</li>
17589 <li> Parser_test</li>
17590 <li> </li>
17591 <li> </li>
17592 <li> 0</li>
17593 <li> Talk</li>
17594 <li> Talk</li>
17595 <li> </li>
17596 <li> </li>
17597 <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>
17598
17599 !! end
17600 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17601
17602 !! test
17603 Gallery
17604 !! wikitext
17605 <gallery>
17606 image1.png |
17607 image2.gif|||||
17608
17609 image3|
17610 image4 |300px| centre
17611 image5.svg| http://///////
17612 [[x|xx]]]]
17613 * image6
17614 </gallery>
17615 !! html
17616 <ul class="gallery mw-gallery-traditional">
17617 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17618 <div class="thumb" style="height: 150px;">Image1.png</div>
17619 <div class="gallerytext">
17620 </div>
17621 </div></li>
17622 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17623 <div class="thumb" style="height: 150px;">Image2.gif</div>
17624 <div class="gallerytext">
17625 <p>||||
17626 </p>
17627 </div>
17628 </div></li>
17629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17630 <div class="thumb" style="height: 150px;">Image3</div>
17631 <div class="gallerytext">
17632 </div>
17633 </div></li>
17634 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17635 <div class="thumb" style="height: 150px;">Image4</div>
17636 <div class="gallerytext">
17637 <p>300px| centre
17638 </p>
17639 </div>
17640 </div></li>
17641 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17642 <div class="thumb" style="height: 150px;">Image5.svg</div>
17643 <div class="gallerytext">
17644 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17645 </p>
17646 </div>
17647 </div></li>
17648 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17649 <div class="thumb" style="height: 150px;">* image6</div>
17650 <div class="gallerytext">
17651 </div>
17652 </div></li>
17653 </ul>
17654
17655 !! end
17656
17657 !! test
17658 Gallery (with options)
17659 !! wikitext
17660 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17661 File:Nonexistent.jpg|caption
17662 File:Nonexistent.jpg
17663 image:foobar.jpg|some '''caption''' [[Main Page]]
17664 image:foobar.jpg
17665 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17666 </gallery>
17667 !! html
17668 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17669 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17670 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17671 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17672 <div class="gallerytext">
17673 <p>caption
17674 </p>
17675 </div>
17676 </div></li>
17677 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17678 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17679 <div class="gallerytext">
17680 </div>
17681 </div></li>
17682 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17683 <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>
17684 <div class="gallerytext">
17685 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17686 </p>
17687 </div>
17688 </div></li>
17689 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17690 <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>
17691 <div class="gallerytext">
17692 </div>
17693 </div></li>
17694 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17695 <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>
17696 <div class="gallerytext">
17697 <p>Blabla|blabla.
17698 </p>
17699 </div>
17700 </div></li>
17701 </ul>
17702
17703 !! end
17704
17705 !! test
17706 Gallery with link that has fragment
17707 !! wikitext
17708 <gallery>
17709 image:foobar.jpg|link=Main_Page
17710 image:foobar.jpg|link=Main_Page#section
17711 image:foobar.jpg|link=Main Page#section|caption
17712 </gallery>
17713 !! html
17714 <ul class="gallery mw-gallery-traditional">
17715 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17716 <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>
17717 <div class="gallerytext">
17718 </div>
17719 </div></li>
17720 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17721 <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>
17722 <div class="gallerytext">
17723 </div>
17724 </div></li>
17725 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17726 <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>
17727 <div class="gallerytext">
17728 <p>caption
17729 </p>
17730 </div>
17731 </div></li>
17732 </ul>
17733
17734 !! end
17735
17736 !! test
17737 Gallery with wikitext inside caption
17738 !! wikitext
17739 <gallery>
17740 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17741 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17742 </gallery>
17743 !! html
17744 <ul class="gallery mw-gallery-traditional">
17745 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17746 <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>
17747 <div class="gallerytext">
17748 <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>
17749 </p>
17750 </div>
17751 </div></li>
17752 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17753 <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>
17754 <div class="gallerytext">
17755 <p>This is a test template
17756 </p>
17757 </div>
17758 </div></li>
17759 </ul>
17760
17761 !! end
17762
17763 !! test
17764 gallery (with showfilename option)
17765 !! wikitext
17766 <gallery showfilename>
17767 File:Nonexistent.jpg|caption
17768 File:Nonexistent.jpg
17769 image:foobar.jpg|some '''caption''' [[Main Page]]
17770 File:Foobar.jpg
17771 </gallery>
17772 !! html
17773 <ul class="gallery mw-gallery-traditional">
17774 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17775 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17776 <div class="gallerytext">
17777 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17778 caption
17779 </p>
17780 </div>
17781 </div></li>
17782 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17783 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17784 <div class="gallerytext">
17785 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17786 </p>
17787 </div>
17788 </div></li>
17789 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17790 <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>
17791 <div class="gallerytext">
17792 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17793 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17794 </p>
17795 </div>
17796 </div></li>
17797 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17798 <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>
17799 <div class="gallerytext">
17800 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17801 </p>
17802 </div>
17803 </div></li>
17804 </ul>
17805
17806 !! end
17807
17808 !! test
17809 Gallery (with namespace-less filenames)
17810 !! wikitext
17811 <gallery>
17812 File:Nonexistent.jpg
17813 Nonexistent.jpg
17814 image:foobar.jpg
17815 foobar.jpg
17816 </gallery>
17817 !! html
17818 <ul class="gallery mw-gallery-traditional">
17819 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17820 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17821 <div class="gallerytext">
17822 </div>
17823 </div></li>
17824 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17825 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17826 <div class="gallerytext">
17827 </div>
17828 </div></li>
17829 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17830 <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>
17831 <div class="gallerytext">
17832 </div>
17833 </div></li>
17834 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17835 <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>
17836 <div class="gallerytext">
17837 </div>
17838 </div></li>
17839 </ul>
17840
17841 !! end
17842
17843 !! test
17844 HTML Hex character encoding (spells the word "JavaScript")
17845 !! options
17846 parsoid=wt2html,wt2wt,html2html
17847 !! wikitext
17848 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17849 !! html/php
17850 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17851 </p>
17852 !! html/php+tidy
17853 <p>JavaScript</p>
17854 !! html/parsoid
17855 <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>
17856 !! end
17857
17858 !! test
17859 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17860 !! wikitext
17861 &#xsee;&#XSEE;
17862 !! html/php
17863 <p>&amp;#xsee;&amp;#XSEE;
17864 </p>
17865 !! html/parsoid
17866 <p>&amp;#xsee;&amp;#XSEE;</p>
17867 !! end
17868
17869 !! test
17870 HTML Hex character encoding mixed case
17871 !! options
17872 parsoid=wt2html,wt2wt,html2html
17873 !! wikitext
17874 &#xEE;&#Xee;
17875 !! html/php
17876 <p>&#xee;&#xee;
17877 </p>
17878 !! html/php+tidy
17879 <p>îî</p>
17880 !! html/parsoid
17881 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17882 !! end
17883
17884 !! test
17885 __FORCETOC__ override
17886 !! wikitext
17887 __NEWSECTIONLINK__
17888 __FORCETOC__
17889 !! html/php
17890 <p><br />
17891 </p>
17892 !! end
17893
17894 !! test
17895 ISBN code coverage
17896 !! wikitext
17897 ISBN 978-0-1234-56&#x20;789
17898 !! html
17899 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17900 </p>
17901 !! html+tidy
17902 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17903 !! html/parsoid
17904 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
17905 !! end
17906
17907 !! test
17908 ISBN followed by 5 spaces
17909 !! wikitext
17910 ISBN
17911 !! html
17912 <p>ISBN
17913 </p>
17914 !! end
17915
17916 !! test
17917 Double ISBN
17918 !! wikitext
17919 ISBN ISBN 1234567890
17920 !! html/php
17921 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17922 </p>
17923 !! html/parsoid
17924 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17925 !! end
17926
17927 !! test
17928 ISBN with an X
17929 !! wikitext
17930 ISBN 3-462-04561-X
17931 ISBN 080442957X
17932 ISBN 978080442957X
17933 !! html/php
17934 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17935 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17936 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17937 </p>
17938 !! html/parsoid
17939 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17940 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17941 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17942 !! end
17943
17944 !! test
17945 ISBN with empty prefix (parsoid test)
17946 !! wikitext
17947 ISBN 1234567890
17948 !! html/php
17949 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17950 </p>
17951 !! html/parsoid
17952 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17953 !! end
17954
17955 !! test
17956 Bug 22905: <abbr> followed by ISBN followed by </a>
17957 !! wikitext
17958 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17959 !! html/php
17960 <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>
17961 </p>
17962 !! html/parsoid
17963 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
17964 !! end
17965
17966 !! test
17967 Double RFC
17968 !! wikitext
17969 RFC RFC 1234
17970 !! html
17971 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17972 </p>
17973 !! end
17974
17975 !! test
17976 Double RFC with a wiki link
17977 !! wikitext
17978 RFC [[RFC 1234]]
17979 !! html
17980 <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>
17981 </p>
17982 !! end
17983
17984 !! test
17985 RFC code coverage
17986 !! wikitext
17987 RFC 983&#x20;987
17988 !! html
17989 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17990 </p>
17991 !! html+tidy
17992 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17993 !! end
17994
17995 !! test
17996 Centre-aligned image
17997 !! wikitext
17998 [[Image:foobar.jpg|centre]]
17999 !! html
18000 <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>
18001
18002 !!end
18003
18004 !! test
18005 None-aligned image
18006 !! wikitext
18007 [[Image:foobar.jpg|none]]
18008 !! html
18009 <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>
18010
18011 !!end
18012
18013 !! test
18014 Width + Height sized image (using px) (height is ignored)
18015 !! wikitext
18016 [[Image:foobar.jpg|640x480px]]
18017 !! html
18018 <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>
18019 </p>
18020 !!end
18021
18022 !! test
18023 Width-sized image (using px, no following whitespace)
18024 !! wikitext
18025 [[Image:foobar.jpg|640px]]
18026 !! html
18027 <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>
18028 </p>
18029 !!end
18030
18031 !! test
18032 Width-sized image (using px, with following whitespace - test regression from r39467)
18033 !! wikitext
18034 [[Image:foobar.jpg|640px ]]
18035 !! html
18036 <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>
18037 </p>
18038 !!end
18039
18040 !! test
18041 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18042 !! wikitext
18043 [[Image:foobar.jpg| 640px]]
18044 !! html
18045 <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>
18046 </p>
18047 !!end
18048
18049 !! test
18050 Image with page parameter
18051 !! options
18052 djvu
18053 !! wikitext
18054 [[File:LoremIpsum.djvu|page=2]]
18055 !! html/php
18056 <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>
18057 </p>
18058 !! html/parsoid
18059 <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>
18060 !! end
18061
18062 !! test
18063 Another italics / bold test
18064 !! wikitext
18065 ''' ''x'
18066 !! html
18067 <pre>'<i> </i>x'
18068 </pre>
18069 !!end
18070
18071 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18072 !! test
18073 dt/dd/dl test
18074 !! wikitext
18075 :;;;::
18076 !! html/php
18077 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18078
18079 !! html/parsoid
18080 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18081
18082 !!end
18083
18084
18085 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18086 !! test
18087 Images with the "|" character in the comment
18088 !! wikitext
18089 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18090 !! html/php
18091 <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>
18092
18093 !! html/parsoid
18094 <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>
18095 !! end
18096
18097 !! test
18098 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18099 !! wikitext
18100 <html><script>alert(1);</script></html>
18101 !! html
18102 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18103 </p>
18104 !! end
18105
18106 !! test
18107 HTML with raw HTML ($wgRawHtml==true)
18108 !! options
18109 wgRawHtml=1
18110 !! wikitext
18111 <html><script>alert(1);</script></html>
18112 !! html
18113 <p><script>alert(1);</script>
18114 </p>
18115 !! end
18116
18117 !! test
18118 Parents of subpages, one level up
18119 !! options
18120 subpage title=[[Subpage test/L1/L2/L3]]
18121 !! wikitext
18122 [[../|L2]]
18123 !! html
18124 <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>
18125 </p>
18126 !! end
18127
18128
18129 !! test
18130 Parents of subpages, one level up, not named
18131 !! options
18132 subpage title=[[Subpage test/L1/L2/L3]]
18133 !! wikitext
18134 [[../]]
18135 !! html
18136 <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>
18137 </p>
18138 !! end
18139
18140
18141
18142 !! test
18143 Parents of subpages, two levels up
18144 !! options
18145 subpage title=[[Subpage test/L1/L2/L3]]
18146 !! wikitext
18147 [[../../|L1]]2
18148
18149 [[../../|L1]]l
18150 !! html
18151 <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
18152 </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>
18153 </p>
18154 !! end
18155
18156 !! test
18157 Parents of subpages, two levels up, without trailing slash or name.
18158 !! options
18159 subpage title=[[Subpage test/L1/L2/L3]]
18160 !! wikitext
18161 [[../..]]
18162 !! html
18163 <p>[[../..]]
18164 </p>
18165 !! end
18166
18167 !! test
18168 Parents of subpages, two levels up, with lots of extra trailing slashes.
18169 !! options
18170 subpage title=[[Subpage test/L1/L2/L3]]
18171 !! wikitext
18172 [[../../////]]
18173 !! html
18174 <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>
18175 </p>
18176 !! end
18177
18178 !! article
18179 Subpage test/L1/L2/L3Sibling
18180 !! text
18181 Sibling article
18182 !! endarticle
18183
18184 !! test
18185 Transclusion of a sibling page (one level up)
18186 !! options
18187 subpage title=[[Subpage test/L1/L2/L3]]
18188 !! wikitext
18189 {{../L3Sibling}}
18190 !! html
18191 <p>Sibling article
18192 </p>
18193 !! end
18194
18195 !! test
18196 Transclusion of a child page
18197 !! options
18198 subpage title=[[Subpage test/L1/L2]]
18199 !! wikitext
18200 {{/L3Sibling}}
18201 !! html
18202 <p>Sibling article
18203 </p>
18204 !! end
18205
18206 !! test
18207 Non-transclusion because of too many up levels
18208 !! options
18209 subpage title=[[Subpage test/L1/L2/L3]]
18210 !! wikitext
18211 {{../../../../More than parent}}
18212 !! html
18213 <p>{{../../../../More than parent}}
18214 </p>
18215 !! end
18216
18217 !! test
18218 Definition list code coverage
18219 !! wikitext
18220 ; title : def
18221 ; title : def
18222 ;title: def
18223 !! html/php
18224 <dl><dt> title &#160;</dt>
18225 <dd> def</dd>
18226 <dt> title&#160;</dt>
18227 <dd> def</dd>
18228 <dt>title</dt>
18229 <dd> def</dd></dl>
18230
18231 !! html/parsoid
18232 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18233 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18234 <dt>title</dt><dd> def</dd></dl>
18235 !! end
18236
18237 !! test
18238 Don't fall for the self-closing div
18239 !! wikitext
18240 <div>hello world</div/>
18241 !! html
18242 <div>hello world</div>
18243
18244 !! end
18245
18246 !! test
18247 MSGNW magic word
18248 !! wikitext
18249 {{MSGNW:msg}}
18250 !! html
18251 <p>&#91;&#91;:Template:Msg&#93;&#93;
18252 </p>
18253 !! end
18254
18255 !! test
18256 RAW magic word
18257 !! wikitext
18258 {{RAW:QUERTY}}
18259 !! html
18260 <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>
18261 </p>
18262 !! end
18263
18264 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18265 !! test
18266 Always escape literal '>' in output, not just after '<'
18267 !! wikitext
18268 ><>
18269 !! html
18270 <p>&gt;&lt;&gt;
18271 </p>
18272 !! end
18273
18274 !! test
18275 Template caching
18276 !! wikitext
18277 {{Test}}
18278 {{Test}}
18279 !! html
18280 <p>This is a test template
18281 This is a test template
18282 </p>
18283 !! end
18284
18285
18286 !! article
18287 MediaWiki:Fake
18288 !! text
18289 ==header==
18290 !! endarticle
18291
18292 !! test
18293 Inclusion of !userCanEdit() content
18294 !! wikitext
18295 {{MediaWiki:Fake}}
18296 !! html
18297 <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>
18298
18299 !! end
18300
18301
18302 !! test
18303 Out-of-order TOC heading levels
18304 !! wikitext
18305 ==2==
18306 ======6======
18307 ===3===
18308 =1=
18309 =====5=====
18310 ==2==
18311 !! html
18312 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18313 <ul>
18314 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18315 <ul>
18316 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18317 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18318 </ul>
18319 </li>
18320 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18321 <ul>
18322 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18323 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18324 </ul>
18325 </li>
18326 </ul>
18327 </div>
18328
18329 <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>
18330 <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>
18331 <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>
18332 <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>
18333 <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>
18334 <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>
18335
18336 !! end
18337
18338
18339 !! test
18340 ISBN with a dummy number
18341 !! wikitext
18342 ISBN ---
18343 !! html
18344 <p>ISBN ---
18345 </p>
18346 !! end
18347
18348
18349 !! test
18350 ISBN with space-delimited number
18351 !! wikitext
18352 ISBN 92 9017 032 8
18353 !! html
18354 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18355 </p>
18356 !! end
18357
18358
18359 !! test
18360 ISBN with multiple spaces, no number
18361 !! wikitext
18362 ISBN foo
18363 !! html
18364 <p>ISBN foo
18365 </p>
18366 !! end
18367
18368
18369 !! test
18370 ISBN length
18371 !! wikitext
18372 ISBN 123456789
18373
18374 ISBN 1234567890
18375
18376 ISBN 12345678901
18377 !! html
18378 <p>ISBN 123456789
18379 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18380 </p><p>ISBN 12345678901
18381 </p>
18382 !! end
18383
18384
18385 !! test
18386 ISBN with trailing year (bug 8110)
18387 !! wikitext
18388 ISBN 1-234-56789-0 - 2006
18389
18390 ISBN 1 234 56789 0 - 2006
18391 !! html
18392 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18393 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18394 </p>
18395 !! end
18396
18397
18398 !! test
18399 anchorencode
18400 !! wikitext
18401 {{anchorencode:foo bar©#%n}}
18402 !! html
18403 <p>foo_bar.C2.A9.23.25n
18404 </p>
18405 !! end
18406
18407 !! test
18408 anchorencode trims spaces
18409 !! wikitext
18410 {{anchorencode: __pretty__please__}}
18411 !! html
18412 <p>pretty_please
18413 </p>
18414 !! end
18415
18416 !! test
18417 anchorencode deals with links
18418 !! wikitext
18419 {{anchorencode: [[hello|world]] [[hi]]}}
18420 !! html
18421 <p>world_hi
18422 </p>
18423 !! end
18424
18425 !! test
18426 anchorencode deals with templates
18427 !! wikitext
18428 {{anchorencode: {{Foo}} }}
18429 !! html
18430 <p>FOO
18431 </p>
18432 !! end
18433
18434 !! test
18435 anchorencode encodes like the TOC generator: (bug 18431)
18436 !! wikitext
18437 === _ +:.3A%3A&&amp;]] ===
18438 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18439 __NOEDITSECTION__
18440 !! html
18441 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18442 <p>.2B:.3A.253A.26.26.5D.5D
18443 </p>
18444 !! end
18445
18446 !! test
18447 Bug 6200: blockquotes and paragraph formatting
18448 !! wikitext
18449 <blockquote>
18450 foo
18451 </blockquote>
18452
18453 bar
18454
18455 baz
18456 !! html
18457 <blockquote>
18458 <p>foo
18459 </p>
18460 </blockquote>
18461 <p>bar
18462 </p>
18463 <pre>baz
18464 </pre>
18465 !! end
18466
18467 !! test
18468 Bug 8293: Use of center tag ruins paragraph formatting
18469 !! wikitext
18470 <center>
18471 foo
18472 </center>
18473
18474 bar
18475
18476 baz
18477 !! html
18478 <center>
18479 <p>foo
18480 </p>
18481 </center>
18482 <p>bar
18483 </p>
18484 <pre>baz
18485 </pre>
18486 !! end
18487
18488 !!test
18489 Parsing of overlapping (improperly nested) inline html tags
18490 !! wikitext
18491 <span><s>x</span></s>
18492 !! html/php
18493 <p><span><s>x&lt;/span&gt;</s></span>
18494 </p>
18495 !! html/parsoid
18496 <p><span><s>x</s></span>
18497 </p>
18498 !!end
18499
18500 ###
18501 ### Language variants related tests
18502 ###
18503 !! test
18504 Self-link in language variants
18505 !! options
18506 title=[[Dunav]] language=sr
18507 !! wikitext
18508 Both [[Dunav]] and [[Дунав]] are names for this river.
18509 !! html
18510 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18511 </p>
18512 !!end
18513
18514 !! article
18515 Дуна
18516 !! text
18517 content
18518 !! endarticle
18519
18520 !! test
18521 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18522 !! options
18523 title=[[Duna]] language=sr
18524 !! wikitext
18525 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18526 !! html
18527 <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.
18528 </p>
18529 !! end
18530
18531 !! test
18532 Link to a section of a variant of this title shouldn't be parsed as self-link
18533 !! options
18534 title=[[Duna]] language=sr
18535 !! wikitext
18536 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18537 !! html
18538 <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.
18539 </p>
18540 !! end
18541
18542 !! test
18543 Link to pages in language variants
18544 !! options
18545 language=sr
18546 !! wikitext
18547 Main Page can be written as [[Маин Паге]]
18548 !! html
18549 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18550 </p>
18551 !!end
18552
18553
18554 !! test
18555 Multiple links to pages in language variants
18556 !! options
18557 language=sr
18558 !! wikitext
18559 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18560 !! html
18561 <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>.
18562 </p>
18563 !!end
18564
18565
18566 !! test
18567 Simple template in language variants
18568 !! options
18569 language=sr
18570 !! wikitext
18571 {{тест}}
18572 !! html
18573 <p>This is a test template
18574 </p>
18575 !! end
18576
18577
18578 !! test
18579 Template with explicit namespace in language variants
18580 !! options
18581 language=sr
18582 !! wikitext
18583 {{Template:тест}}
18584 !! html
18585 <p>This is a test template
18586 </p>
18587 !! end
18588
18589
18590 !! test
18591 Basic test for template parameter in language variants
18592 !! options
18593 language=sr
18594 !! wikitext
18595 {{парамтест|param=foo}}
18596 !! html
18597 <p>This is a test template with parameter foo
18598 </p>
18599 !! end
18600
18601
18602 !! test
18603 Simple category in language variants
18604 !! options
18605 language=sr cat
18606 !! wikitext
18607 [[Category:МедиаWики Усер'с Гуиде]]
18608 !! html
18609 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
18610 !! end
18611
18612
18613 !! article
18614 Category:分类
18615 !! text
18616 blah
18617 !! endarticle
18618
18619 !! article
18620 Category:分類
18621 !! text
18622 blah
18623 !! endarticle
18624
18625 !! test
18626 Don't convert blue categorylinks to another variant (bug 33210)
18627 !! options
18628 language=zh cat
18629 !! wikitext
18630 [[A]][[Category:分类]]
18631 !! html
18632 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18633 !! end
18634
18635
18636 !! test
18637 Stripping -{}- tags (language variants)
18638 !! options
18639 language=sr
18640 !! wikitext
18641 Latin proverb: -{Ne nuntium necare}-
18642 !! html
18643 <p>Latin proverb: Ne nuntium necare
18644 </p>
18645 !! end
18646
18647
18648 !! test
18649 Prevent conversion with -{}- tags (language variants)
18650 !! options
18651 language=sr variant=sr-ec
18652 !! wikitext
18653 Latinski: -{Ne nuntium necare}-
18654 !! html
18655 <p>Латински: Ne nuntium necare
18656 </p>
18657 !! end
18658
18659
18660 !! test
18661 Prevent conversion of text with -{}- tags (language variants)
18662 !! options
18663 language=sr variant=sr-ec
18664 !! wikitext
18665 Latinski: -{Ne nuntium necare}-
18666 !! html
18667 <p>Латински: Ne nuntium necare
18668 </p>
18669 !! end
18670
18671
18672 !! test
18673 Prevent conversion of links with -{}- tags (language variants)
18674 !! options
18675 language=sr variant=sr-ec
18676 !! wikitext
18677 -{[[Main Page]]}-
18678 !! html
18679 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18680 </p>
18681 !! end
18682
18683
18684 !! test
18685 -{}- tags within headlines (within html for parserConvert())
18686 !! options
18687 language=sr variant=sr-ec
18688 !! wikitext
18689 == -{Naslov}- ==
18690 !! html
18691 <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>
18692
18693 !! end
18694
18695
18696 !! test
18697 Explicit definition of language variant alternatives
18698 !! options
18699 language=zh variant=zh-tw
18700 !! wikitext
18701 -{zh:China;zh-tw:Taiwan}-, not China
18702 !! html
18703 <p>Taiwan, not China
18704 </p>
18705 !! end
18706
18707
18708 !! test
18709 Conversion around HTML tags
18710 !! options
18711 language=sr variant=sr-ec
18712 !! wikitext
18713 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18714 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18715 !! html
18716 <p>
18717 <span title="ЛаCтин">ски</span>
18718 </p>
18719 !! end
18720
18721
18722 !! test
18723 Explicit session-wise language variant mapping (A flag and - flag)
18724 !! options
18725 language=zh variant=zh-tw
18726 !! wikitext
18727 Taiwan is not China.
18728 But -{A|zh:China;zh-tw:Taiwan}- is China,
18729 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18730 and -{China}- is China.
18731 !! html
18732 <p>Taiwan is not China.
18733 But Taiwan is Taiwan,
18734 (This should be stripped!)
18735 and China is China.
18736 </p>
18737 !! end
18738
18739 !! test
18740 Explicit session-wise language variant mapping (H flag for hide)
18741 !! options
18742 language=zh variant=zh-tw
18743 !! wikitext
18744 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18745 Taiwan is China.
18746 !! html
18747 <p>(This should be stripped!)
18748 Taiwan is Taiwan.
18749 </p>
18750 !! end
18751
18752 !! test
18753 Adding explicit conversion rule for title (T flag)
18754 !! options
18755 language=zh variant=zh-tw showtitle
18756 !! wikitext
18757 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18758 !! html
18759 Taiwan
18760 <p>Should be stripped!
18761 </p>
18762 !! end
18763
18764 !! test
18765 Testing that changing the language variant here in the tests actually works
18766 !! options
18767 language=zh variant=zh showtitle
18768 !! wikitext
18769 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18770 !! html
18771 China
18772 <p>Should be stripped!
18773 </p>
18774 !! end
18775
18776 !! test
18777 Recursive conversion of alt and title attrs shouldn't clear converter state
18778 !! options
18779 language=zh variant=zh-cn showtitle
18780 !! wikitext
18781 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18782 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18783 !! html
18784 China
18785 <p>
18786 Should be stripped<span title="Exclamation">!</span>
18787 </p>
18788 !! end
18789
18790 !! test
18791 Bug 24072: more test on conversion rule for title
18792 !! options
18793 language=zh variant=zh-tw showtitle
18794 !! wikitext
18795 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18796 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18797 !! html
18798 Taiwan
18799 <p>This should be stripped!
18800 This won't take interferes with the title rule.
18801 </p>
18802 !! end
18803
18804 !! test
18805 Partly disable title conversion if variant == main language code
18806 !! options
18807 language=zh variant=zh title=[[ZH]] showtitle
18808 !! wikitext
18809 -{T|zh-cn:CN;zh-tw:TW}-
18810 !! html
18811 ZH
18812 <p>
18813 </p>
18814 !! end
18815
18816 !! test
18817 Partly disable title conversion if variant == main language code, more
18818 !! options
18819 language=zh variant=zh title=[[ZH]] showtitle
18820 !! wikitext
18821 -{T|TW}-
18822 !! html
18823 ZH
18824 <p>
18825 </p>
18826 !! end
18827
18828 !! test
18829 Raw output of variant escape tags (R flag)
18830 !! options
18831 language=zh variant=zh-tw
18832 !! wikitext
18833 Raw: -{R|zh:China;zh-tw:Taiwan}-
18834 !! html
18835 <p>Raw: zh:China;zh-tw:Taiwan
18836 </p>
18837 !! end
18838
18839 !! test
18840 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18841 !! options
18842 language=zh variant=zh-cn
18843 !! input
18844 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18845 !! result
18846 <p>0
18847 </p>
18848 !! end
18849
18850 !! test
18851 Conversion rules from [numeric-only string] to [something else] (T48634)
18852 !! options
18853 language=zh variant=zh-cn
18854 !! input
18855 -{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
18856 !! result
18857 <p>D12345EE12345
18858 </p>
18859 !! end
18860
18861 !! test
18862 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18863 !! options
18864 language=zh variant=zh-cn
18865 !! input
18866 -{H|zh-cn:foo;zh-tw:;}-foobar
18867 !! result
18868 <p>foobar
18869 </p>
18870 !! end
18871
18872 !! test
18873 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
18874 !! options
18875 language=zh variant=zh-cn
18876 !! input
18877 -{H|=>zh-cn:foo;}-foobar
18878 !! result
18879 <p>foobar
18880 </p>
18881 !! end
18882
18883 !! test
18884 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
18885 !! options
18886 language=zh variant=zh-cn
18887 !! input
18888 -{H|}-foobar
18889 !! result
18890 <p>foobar
18891 </p>
18892 !! end
18893
18894 !! test
18895 Nested using of manual convert syntax
18896 !! options
18897 language=zh variant=zh-hk
18898 !! wikitext
18899 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18900 !! html
18901 <p>Nested: Hello Hong Kong!
18902 </p>
18903 !! end
18904
18905 !! test
18906 Proper conversion of text in external links
18907 !! options
18908 language=sr variant=sr-ec
18909 !! wikitext
18910 http://www.google.com
18911 gopher://www.google.com
18912 [http://www.google.com http://www.google.com]
18913 [gopher://www.google.com gopher://www.google.com]
18914 [https://www.google.com irc://www.google.com]
18915 [ftp://www.google.com www.google.com/ftp://dir]
18916 [//www.google.com www.google.com]
18917 !! html
18918 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18919 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18920 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18921 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18922 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18923 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18924 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18925 </p>
18926 !! end
18927
18928 !! test
18929 Do not convert roman numbers to language variants
18930 !! options
18931 language=sr variant=sr-ec
18932 !! wikitext
18933 Fridrih IV je car.
18934 !! html
18935 <p>Фридрих IV је цар.
18936 </p>
18937 !! end
18938
18939 !! test
18940 Unclosed language converter markup "-{"
18941 !! options
18942 language=sr
18943 !! wikitext
18944 -{T|hello
18945 !! html
18946 <p>-{T|hello
18947 </p>
18948 !! end
18949
18950 !! test
18951 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18952 !! options
18953 language=sr
18954 !! wikitext
18955 -{R|=&gt;}-
18956 !! html
18957 <p>=&gt;
18958 </p>
18959 !!end
18960
18961 !! test
18962 Don't break link parsing if language converter markup is in the caption.
18963 !! options
18964 language=sr variant=sr-ec
18965 !! wikitext
18966 [[Main Page|-{R|main page}-]]
18967 !! html
18968 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18969 </p>
18970 !! end
18971
18972 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18973 !! test
18974 Don't break image parsing if language converter markup is in the caption.
18975 !! options
18976 language=sr
18977 !! wikitext
18978 [[File:Foobar.jpg|-{R|caption}-]]
18979 !! html/parsoid
18980 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
18981 </p>
18982 !! end
18983
18984 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18985 !! test
18986 Don't break list handling if language converter markup is in the item.
18987 !! options
18988 language=zh variant=zh-cn
18989 !! wikitext
18990 ;-{zh-cn:AAA;zh-tw:BBB}-
18991 !! html/php
18992 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18993
18994 !! html/parsoid
18995 <dl><dt>AAA
18996 </dt></dl>
18997 !! end
18998
18999 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19000 !! test
19001 Don't break table handling if language converter markup is in the cell.
19002 !! options
19003 language=sr variant=sr-ec
19004 !! wikitext
19005 {|
19006 |-
19007 | -{R|B}-
19008 |}
19009 !! html/php
19010 <table>
19011
19012 <tr>
19013 <td>Б}-
19014 </td></tr></table>
19015
19016 !! html/parsoid
19017 <table>
19018
19019 <tr>
19020 <td> B
19021 </td></tr></table>
19022
19023 !! end
19024
19025 !! test
19026 Bug 529: Uncovered bullet
19027 !! wikitext
19028 * Foo {{bullet}}
19029 !! html
19030 <ul><li> Foo </li>
19031 <li> Bar</li></ul>
19032
19033 !! end
19034
19035 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19036 # Templates in Wikipedia rely on this behavior, as tidy has always been
19037 # enabled there. These tests are normally run *without* tidy, so specify the
19038 # full output here.
19039 # To test realistic parsing behavior, apply a tidy-like transformation to both
19040 # the expected output and your parser's output.
19041 !! test
19042 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19043 !! wikitext
19044 ******* Foo {{bullet}}
19045 !! html
19046 <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>
19047 <li> Bar</li></ul>
19048
19049 !! end
19050
19051 !! test
19052 Bug 529: Uncovered table already at line-start
19053 !! wikitext
19054 x
19055
19056 {{table}}
19057 y
19058 !! html
19059 <p>x
19060 </p>
19061 <table>
19062 <tr>
19063 <td> 1 </td>
19064 <td> 2
19065 </td></tr>
19066 <tr>
19067 <td> 3 </td>
19068 <td> 4
19069 </td></tr></table>
19070 <p>y
19071 </p>
19072 !! end
19073
19074 !! test
19075 Bug 529: Uncovered bullet in parser function result
19076 !! wikitext
19077 * Foo {{lc:{{bullet}} }}
19078 !! html
19079 <ul><li> Foo </li>
19080 <li> bar</li></ul>
19081
19082 !! end
19083
19084 !! test
19085 Bug 5678: Double-parsed template argument
19086 !! wikitext
19087 {{lc:{{{1}}}|hello}}
19088 !! html
19089 <p>{{{1}}}
19090 </p>
19091 !! end
19092
19093 !! test
19094 Bug 5678: Double-parsed template invocation
19095 !! wikitext
19096 {{lc:{{paramtest {{!}} param = hello }} }}
19097 !! html
19098 <p>{{paramtest | param = hello }}
19099 </p>
19100 !! end
19101
19102 !! test
19103 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19104 !! options
19105 language=cs
19106 title=[[Main Page]]
19107 !! wikitext
19108 {{PRVNÍVELKÉ:ěščř}}
19109 {{prvnívelké:ěščř}}
19110 {{PRVNÍMALÉ:ěščř}}
19111 {{prvnímalé:ěščř}}
19112 {{MALÁ:ěščř}}
19113 {{malá:ěščř}}
19114 {{VELKÁ:ěščř}}
19115 {{velká:ěščř}}
19116 !! html
19117 <p>Ěščř
19118 Ěščř
19119 ěščř
19120 ěščř
19121 ěščř
19122 ěščř
19123 ĚŠČŘ
19124 ĚŠČŘ
19125 </p>
19126 !! end
19127
19128 !! test
19129 Morwen/13: Unclosed link followed by heading
19130 !! wikitext
19131 [[link
19132 ==heading==
19133 !! html
19134 <p>[[link
19135 </p>
19136 <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>
19137
19138 !! end
19139
19140 !! test
19141 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19142 !! wikitext
19143 {{foo|
19144 =heading=
19145 !! html
19146 <p>{{foo|
19147 </p>
19148 <h1><span class="mw-headline" id="heading">heading</span></h1>
19149
19150 !! end
19151
19152 !! test
19153 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19154 !! wikitext
19155 {{foo|
19156 ==heading==
19157 !! html
19158 <p>{{foo|
19159 </p>
19160 <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>
19161
19162 !! end
19163
19164 !! test
19165 Tildes in comments
19166 !! options
19167 pst
19168 !! wikitext
19169 <!-- ~~~~ -->
19170 !! html
19171 <!-- ~~~~ -->
19172 !! end
19173
19174 !! test
19175 Paragraphs inside divs (no extra line breaks)
19176 !! wikitext
19177 <div>Line one
19178
19179 Line two</div>
19180 !! html
19181 <div>Line one
19182 Line two</div>
19183
19184 !! end
19185
19186 !! test
19187 Paragraphs inside divs (extra line break on open)
19188 !! wikitext
19189 <div>
19190 Line one
19191
19192 Line two</div>
19193 !! html
19194 <div>
19195 <p>Line one
19196 </p>
19197 Line two</div>
19198
19199 !! end
19200
19201 !! test
19202 Paragraphs inside divs (extra line break on close)
19203 !! wikitext
19204 <div>Line one
19205
19206 Line two
19207 </div>
19208 !! html
19209 <div>Line one
19210 <p>Line two
19211 </p>
19212 </div>
19213
19214 !! end
19215
19216 !! test
19217 Paragraphs inside divs (extra line break on open and close)
19218 !! wikitext
19219 <div>
19220 Line one
19221
19222 Line two
19223 </div>
19224 !! html
19225 <div>
19226 <p>Line one
19227 </p><p>Line two
19228 </p>
19229 </div>
19230
19231 !! end
19232
19233 !! test
19234 Nesting tags, paragraphs on lines which begin with <div>
19235 !! wikitext
19236 <div></div><strong>A
19237 B</strong>
19238 !! html/php+tidy
19239 <p><strong>A</strong></p>
19240 <p><strong>B</strong></p>
19241 !! html/parsoid
19242 <div></div>
19243 <p><strong>A
19244 B</strong>
19245 </p>
19246 !! end
19247
19248 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19249 !! test
19250 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19251 !! wikitext
19252 <blockquote>Line one
19253
19254 Line two</blockquote>
19255 !! html
19256 <blockquote>Line one
19257 Line two</blockquote>
19258
19259 !! html+tidy
19260 <blockquote>
19261 <p>Line one Line two</p>
19262 </blockquote>
19263 !! end
19264
19265 !! test
19266 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19267 !! wikitext
19268 <blockquote>
19269 Line one
19270
19271 Line two</blockquote>
19272 !! html
19273 <blockquote>
19274 <p>Line one
19275 </p>
19276 Line two</blockquote>
19277
19278 !! html+tidy
19279 <blockquote>
19280 <p>Line one</p>
19281 Line two</blockquote>
19282 !! end
19283
19284 !! test
19285 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19286 !! wikitext
19287 <blockquote>Line one
19288
19289 Line two
19290 </blockquote>
19291 !! html
19292 <blockquote>Line one
19293 <p>Line two
19294 </p>
19295 </blockquote>
19296
19297 !! html+tidy
19298 <blockquote>
19299 <p>Line one</p>
19300 <p>Line two</p>
19301 </blockquote>
19302 !! end
19303
19304 !! test
19305 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19306 !! wikitext
19307 <blockquote>
19308 Line one
19309
19310 Line two
19311 </blockquote>
19312 !! html
19313 <blockquote>
19314 <p>Line one
19315 </p><p>Line two
19316 </p>
19317 </blockquote>
19318
19319 !! html+tidy
19320 <blockquote>
19321 <p>Line one</p>
19322 <p>Line two</p>
19323 </blockquote>
19324 !! end
19325
19326 !! test
19327 Paragraphs inside blockquotes/divs (no extra line breaks)
19328 !! wikitext
19329 <blockquote><div>Line one
19330
19331 Line two</div></blockquote>
19332 !! html
19333 <blockquote><div>Line one
19334 Line two</div></blockquote>
19335
19336 !! end
19337
19338 !! test
19339 Paragraphs inside blockquotes/divs (extra line break on open)
19340 !! wikitext
19341 <blockquote><div>
19342 Line one
19343
19344 Line two</div></blockquote>
19345 !! html
19346 <blockquote><div>
19347 <p>Line one
19348 </p>
19349 Line two</div></blockquote>
19350
19351 !! end
19352
19353 !! test
19354 Paragraphs inside blockquotes/divs (extra line break on close)
19355 !! wikitext
19356 <blockquote><div>Line one
19357
19358 Line two
19359 </div></blockquote>
19360 !! html
19361 <blockquote><div>Line one
19362 <p>Line two
19363 </p>
19364 </div></blockquote>
19365
19366 !! end
19367
19368 !! test
19369 Paragraphs inside blockquotes/divs (extra line break on open and close)
19370 !! wikitext
19371 <blockquote><div>
19372 Line one
19373
19374 Line two
19375 </div></blockquote>
19376 !! html
19377 <blockquote><div>
19378 <p>Line one
19379 </p><p>Line two
19380 </p>
19381 </div></blockquote>
19382
19383 !! end
19384
19385 !! test
19386 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19387 !! options
19388 wgLinkHolderBatchSize=0
19389 !! wikitext
19390 [[meatball:1]]
19391 [[meatball:2]]
19392 [[meatball:3]]
19393 !! html
19394 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19395 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19396 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19397 </p>
19398 !! end
19399
19400 !! test
19401 Free external link invading image caption
19402 !! wikitext
19403 [[Image:Foobar.jpg|thumb|http://x|hello]]
19404 !! html
19405 <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>
19406
19407 !! end
19408
19409 !! test
19410 Bug 15196: localised external link numbers
19411 !! options
19412 language=fa
19413 !! wikitext
19414 [http://en.wikipedia.org/]
19415 !! html/php
19416 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19417 </p>
19418 !! html/parsoid
19419 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19420 !! end
19421
19422 !! test
19423 Multibyte character in padleft
19424 !! wikitext
19425 {{padleft:-Hello|7|Æ}}
19426 !! html
19427 <p>Æ-Hello
19428 </p>
19429 !! end
19430
19431 !! test
19432 Multibyte character in padright
19433 !! wikitext
19434 {{padright:Hello-|7|Æ}}
19435 !! html
19436 <p>Hello-Æ
19437 </p>
19438 !! end
19439
19440 !!test
19441 formatdate parser function
19442 !! wikitext
19443 {{#formatdate:2009-03-24}}
19444 !! html
19445 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19446 </p>
19447 !! end
19448
19449 !!test
19450 formatdate parser function, with default format
19451 !! wikitext
19452 {{#formatdate:2009-03-24|mdy}}
19453 !! html
19454 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19455 </p>
19456 !! end
19457
19458 !! test
19459 Spacing of numbers in formatted dates
19460 !! wikitext
19461 {{#formatdate:January 15}}
19462 !! html
19463 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19464 </p>
19465 !! end
19466
19467 !! test
19468 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
19469 !! options
19470 language=nl title=[[MediaWiki:Common.css]]
19471 !! wikitext
19472 {{#formatdate:2009-03-24|dmy}}
19473 !! html
19474 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19475 </p>
19476 !! end
19477
19478 #
19479 #
19480 #
19481
19482 #
19483 # Edit comments
19484 #
19485
19486 !! test
19487 Edit comment with link
19488 !! options
19489 comment
19490 !! wikitext
19491 I like the [[Main Page]] a lot
19492 !! html
19493 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19494 !!end
19495
19496 !! test
19497 Edit comment with link and link text
19498 !! options
19499 comment
19500 !! wikitext
19501 I like the [[Main Page|best pages]] a lot
19502 !! html
19503 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19504 !!end
19505
19506 !! test
19507 Edit comment with link and link text with suffix
19508 !! options
19509 comment
19510 !! wikitext
19511 I like the [[Main Page|best page]]s a lot
19512 !! html
19513 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19514 !!end
19515
19516 !! test
19517 Edit comment with section link (non-local, eg in history list)
19518 !! options
19519 comment title=[[Main Page]]
19520 !! wikitext
19521 /* External links */ removed bogus entries
19522 !! html
19523 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19524 !!end
19525
19526 !! test
19527 Edit comment with section link and text before it (non-local, eg in history list)
19528 !! options
19529 comment title=[[Main Page]]
19530 !! wikitext
19531 pre-comment text /* External links */ removed bogus entries
19532 !! html
19533 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>
19534 !!end
19535
19536 !! test
19537 Edit comment with section link (local, eg in diff view)
19538 !! options
19539 comment local title=[[Main Page]]
19540 !! wikitext
19541 /* External links */ removed bogus entries
19542 !! html
19543 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19544 !!end
19545
19546 !! test
19547 Edit comment with subpage link (bug 14080)
19548 !! options
19549 comment
19550 subpage
19551 title=[[Subpage test]]
19552 !! wikitext
19553 Poked at a [[/subpage]] here...
19554 !! html
19555 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19556 !!end
19557
19558 !! test
19559 Edit comment with subpage link and link text (bug 14080)
19560 !! options
19561 comment
19562 subpage
19563 title=[[Subpage test]]
19564 !! wikitext
19565 Poked at a [[/subpage|neat little page]] here...
19566 !! html
19567 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19568 !!end
19569
19570 !! test
19571 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19572 !! options
19573 comment
19574 title=[[Subpage test]]
19575 !! wikitext
19576 Poked at a [[/subpage]] here...
19577 !! html
19578 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...
19579 !!end
19580
19581 !! test
19582 Edit comment with bare anchor link (local, as on diff)
19583 !! options
19584 comment
19585 local
19586 title=[[Main Page]]
19587 !! wikitext
19588 [[#section]]
19589 !! html
19590 <a href="#section">#section</a>
19591 !! end
19592
19593 !! test
19594 Edit comment with bare anchor link (non-local, as on history)
19595 !! options
19596 comment
19597 title=[[Main Page]]
19598 !! wikitext
19599 [[#section]]
19600 !! html
19601 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19602 !! end
19603
19604 !! test
19605 Anchor starting with underscore
19606 !! wikitext
19607 [[#_ref|One]]
19608 !! html
19609 <p><a href="#_ref">One</a>
19610 </p>
19611 !! end
19612
19613 !! test
19614 Id starting with underscore
19615 !! wikitext
19616 <div id="_ref"></div>
19617 !! html
19618 <div id="_ref"></div>
19619
19620 !! end
19621
19622 !! test
19623 Space normalisation on autocomment (bug 22784)
19624 !! options
19625 comment
19626 title=[[Main Page]]
19627 !! wikitext
19628 /* __hello__world__ */
19629 !! html
19630 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19631 !! end
19632
19633 !! test
19634 percent-encoding and + signs in comments (Bug 26410)
19635 !! options
19636 comment
19637 !! wikitext
19638 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19639 !! html/php
19640 <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>
19641 !! end
19642
19643 # Parsoid doesn't support this yet: see bug 73581
19644 # but it *should* omit the 'src' attribute if the image is bad.
19645 # PHP side of tests was disabled in
19646 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19647 # because of issues in the PHP parserTests infrastructure
19648 # (but the output below is indeed what the PHP side emits)
19649 !! test
19650 Bad images - basic functionality
19651 !! wikitext
19652 [[File:Bad.jpg]]
19653 !! DISABLED/html/php
19654 !! html/parsoid
19655 <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>
19656 !! end
19657
19658 !! test
19659 Bad images - bug 16039: text after bad image disappears
19660 !! wikitext
19661 Foo bar
19662 [[File:Bad.jpg]]
19663 Bar foo
19664 !! DISABLED/html/php
19665 <p>Foo bar
19666 </p><p>Bar foo
19667 </p>
19668 !! html/parsoid
19669 <p>Foo bar
19670 <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>
19671 Bar foo</p>
19672 !! end
19673
19674 !! test
19675 Verify that displaytitle works (bug #22501) no displaytitle
19676 !! options
19677 showtitle
19678 !! config
19679 wgAllowDisplayTitle=true
19680 wgRestrictDisplayTitle=false
19681 !! wikitext
19682 this is not the the title
19683 !! html
19684 Parser test
19685 <p>this is not the the title
19686 </p>
19687 !! end
19688
19689 !! test
19690 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19691 !! options
19692 showtitle
19693 title=[[Screen]]
19694 !! config
19695 wgAllowDisplayTitle=true
19696 wgRestrictDisplayTitle=false
19697 !! wikitext
19698 this is not the the title
19699 {{DISPLAYTITLE:whatever}}
19700 !! html
19701 whatever
19702 <p>this is not the the title
19703 </p>
19704 !! end
19705
19706 !! test
19707 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19708 !! options
19709 showtitle
19710 title=[[Screen]]
19711 !! config
19712 wgAllowDisplayTitle=true
19713 wgRestrictDisplayTitle=true
19714 !! wikitext
19715 this is not the the title
19716 {{DISPLAYTITLE:whatever}}
19717 !! html
19718 Screen
19719 <p>this is not the the title
19720 </p>
19721 !! end
19722
19723 !! test
19724 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19725 !! options
19726 showtitle
19727 title=[[Screen]]
19728 !! config
19729 wgAllowDisplayTitle=true
19730 wgRestrictDisplayTitle=true
19731 !! wikitext
19732 this is not the the title
19733 {{DISPLAYTITLE:screen}}
19734 !! html
19735 screen
19736 <p>this is not the the title
19737 </p>
19738 !! end
19739
19740 !! test
19741 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19742 !! options
19743 showtitle
19744 title=[[Screen]]
19745 !! config
19746 wgAllowDisplayTitle=false
19747 !! wikitext
19748 this is not the the title
19749 {{DISPLAYTITLE:screen}}
19750 !! html
19751 Screen
19752 <p>this is not the the title
19753 <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>
19754 </p>
19755 !! end
19756
19757 !! test
19758 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19759 !! options
19760 showtitle
19761 title=[[Screen]]
19762 !! config
19763 wgAllowDisplayTitle=false
19764 !! wikitext
19765 this is not the the title
19766 !! html
19767 Screen
19768 <p>this is not the the title
19769 </p>
19770 !! end
19771
19772 !! test
19773 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19774 !! options
19775 showtitle
19776 title=[[Screen]]
19777 !! config
19778 wgAllowDisplayTitle=true
19779 wgRestrictDisplayTitle=true
19780 !! wikitext
19781 this is not the the title
19782 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19783 !! html
19784 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19785 <p>this is not the the title
19786 </p>
19787 !! end
19788
19789 !! test
19790 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19791 !! options
19792 showtitle
19793 title=[[Screen]]
19794 !! config
19795 wgAllowDisplayTitle=true
19796 wgRestrictDisplayTitle=true
19797 !! wikitext
19798 this is not the the title
19799 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19800 !! html
19801 <span style="color: red;">s</span>creen
19802 <p>this is not the the title
19803 </p>
19804 !! end
19805
19806 !! test
19807 Page status indicators: Empty name is invalid
19808 !! options
19809 showindicators
19810 !! wikitext
19811 <indicator name=" "></indicator>
19812 <indicator></indicator>
19813 !! html
19814 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19815 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19816 </p>
19817 !! end
19818
19819 !! test
19820 Page status indicators: Weird syntaxes that are okay
19821 !! options
19822 showindicators
19823 !! wikitext
19824 <indicator name="empty" />
19825 <indicator name></indicator>
19826 !! html
19827 empty=
19828 name=
19829 <p><br />
19830 </p>
19831 !! end
19832
19833 !! test
19834 Page status indicators: Torture test
19835 !! options
19836 showindicators
19837 !! wikitext
19838 <indicator name="01">hello world</indicator>
19839 <indicator name="02">[[Main Page]]</indicator>
19840 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19841 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19842 <indicator name="05">* foo
19843 * bar</indicator>
19844 <indicator name="06"><nowiki>foo</nowiki></indicator>
19845 <indicator name="07"> Preformatted</indicator>
19846 <indicator name="08"><div>Broken tag</indicator>
19847 <indicator name="09">{| class=wikitable
19848 | cell
19849 |}</indicator>
19850 <indicator name="10">Two
19851
19852 paragraphs</indicator>
19853 !! html
19854 01=hello world
19855 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19856 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" />
19857 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>
19858 05=<ul><li> foo</li>
19859 <li> bar</li></ul>
19860
19861 06=foo
19862 07=<pre>Preformatted
19863 </pre>
19864 08=<div>Broken tag</div>
19865
19866 09=<table class="wikitable">
19867 <tr>
19868 <td> cell
19869 </td></tr></table>
19870
19871 10=<p>Two
19872 </p><p>paragraphs
19873 </p>
19874 <p><br />
19875 </p><p><br />
19876 </p><p><br />
19877 </p><p><br />
19878 </p><p><br />
19879 </p>
19880 !! end
19881
19882 !! test
19883 preload: check <noinclude> and <includeonly>
19884 !! options
19885 preload
19886 !! wikitext
19887 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19888 !! html
19889 Hello kind world.
19890 !! end
19891
19892 !! test
19893 preload: check <onlyinclude>
19894 !! options
19895 preload
19896 !! wikitext
19897 Goodbye <onlyinclude>Hello world</onlyinclude>
19898 !! html
19899 Hello world
19900 !! end
19901
19902 !! test
19903 preload: can pass tags through if we want to
19904 !! options
19905 preload
19906 !! wikitext
19907 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19908 !! html
19909 <includeonly>Hello world</includeonly>
19910 !! end
19911
19912 !! test
19913 preload: check that it doesn't try to do tricks
19914 !! options
19915 preload
19916 !! wikitext
19917 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19918 !! html
19919 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19920 !! end
19921
19922 !! test
19923 Play a bit with r67090 and bug 3158
19924 !! wikitext
19925 <div style="width:50% !important">&nbsp;</div>
19926 <div style="width:50%&nbsp;!important">&nbsp;</div>
19927 <div style="width:50%&#160;!important">&nbsp;</div>
19928 <div style="border : solid;">&nbsp;</div>
19929 !! html/php
19930 <div style="width:50% !important">&#160;</div>
19931 <div style="width:50% !important">&#160;</div>
19932 <div style="width:50% !important">&#160;</div>
19933 <div style="border&#160;: solid;">&#160;</div>
19934
19935 !! html/parsoid
19936 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19937 <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>
19938 <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>
19939 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19940
19941 !! end
19942
19943 !! test
19944 HTML5 data attributes
19945 !! wikitext
19946 <span data-foo="bar">Baz</span>
19947 <p data-abc-def_hij="">Quuz</p>
19948 !! html
19949 <p><span data-foo="bar">Baz</span>
19950 </p>
19951 <p data-abc-def_hij="">Quuz</p>
19952
19953 !! end
19954
19955 !! test
19956 percent-encoding and + signs in internal links (Bug 26410)
19957 !! wikitext
19958 [[User:+%]] [[Page+title%]]
19959 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19960 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19961 [[%33%45]] [[%33%45+]]
19962 !! html/php
19963 <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>
19964 <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>
19965 <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>
19966 <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>
19967 </p>
19968 !! html/parsoid
19969 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%25" title="Page+title%">Page+title%</a>
19970 <a rel="mw:WikiLink" href="%25+" title="%+">%+</a> <a rel="mw:WikiLink" href="%25+" title="%+">%20</a> <a rel="mw:WikiLink" href="%25+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%25+r" title="%+r">%+r</a>
19971 <a rel="mw:WikiLink" href="%25" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</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":"[[bar]]"}'><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>
19972 <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>
19973 !! end
19974
19975 !! test
19976 Special characters in embedded file links (bug 27679)
19977 !! wikitext
19978 [[File:Contains & ampersand.jpg]]
19979 [[File:Does not exist.jpg|Title with & ampersand]]
19980 !! html/php
19981 <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>
19982 <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>
19983 </p>
19984 !! html/parsoid
19985 <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>
19986 <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; 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>
19987 !! end
19988
19989 !! test
19990 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19991 !! wikitext
19992 Text&apos;s been normalized?
19993 !! html
19994 <p>Text&#39;s been normalized?
19995 </p>
19996 !! end
19997
19998 !! test
19999 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20000 !! wikitext
20001 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20002 !! html
20003 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20004 </p>
20005 !! end
20006
20007 !! test
20008 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20009 !! wikitext
20010 [http://www.example.org/ ideograms]
20011 !! html
20012 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20013 </p>
20014 !! end
20015
20016 !! test
20017 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20018 !! wikitext
20019 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20020 !! html
20021 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20022 </p>
20023 !! end
20024
20025 !! article
20026 Mediawiki:loop1
20027 !! text
20028 {{Identical|A}}
20029 !! endarticle
20030
20031 !! article
20032 Mediawiki:loop2
20033 !! text
20034 {{Identical|B}}
20035 !! endarticle
20036
20037 !! article
20038 Template:Identical
20039 !! text
20040 {{int:loop1}}
20041 {{int:loop2}}
20042 !! endarticle
20043
20044 !! test
20045 Bug 31098 Template which includes system messages which includes the template
20046 !! wikitext
20047 {{Identical}}
20048 !! html
20049 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20050 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20051 </p>
20052 !! end
20053
20054 !! test
20055 Bug31490 Turkish: ucfirst 'blah'
20056 !! options
20057 language=tr
20058 !! wikitext
20059 {{ucfirst:blah}}
20060 !! html
20061 <p>Blah
20062 </p>
20063 !! end
20064
20065 !! test
20066 Bug31490 Turkish: ucfirst 'ix'
20067 !! options
20068 language=tr
20069 !! wikitext
20070 {{ucfirst:ix}}
20071 !! html
20072 <p>İx
20073 </p>
20074 !! end
20075
20076 !! test
20077 Bug31490 Turkish: lcfirst 'BLAH'
20078 !! options
20079 language=tr
20080 !! wikitext
20081 {{lcfirst:BLAH}}
20082 !! html
20083 <p>bLAH
20084 </p>
20085 !! end
20086
20087 !! test
20088 Bug31490 Turkish: ucfırst (with a dotless i)
20089 !! options
20090 language=tr
20091 !! wikitext
20092 {{ucfırst:blah}}
20093 !! html
20094 <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>
20095 </p>
20096 !! end
20097
20098 !! test
20099 Bug31490 ucfırst (with a dotless i) with English language
20100 !! options
20101 language=en
20102 !! wikitext
20103 {{ucfırst:blah}}
20104 !! html
20105 <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>
20106 </p>
20107 !! end
20108
20109 !! test
20110 Bug 26375: TOC with italics
20111 !! options
20112 title=[[Main Page]]
20113 !! wikitext
20114 __TOC__
20115 == ''Lost'' episodes ==
20116 !! html
20117 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20118 <ul>
20119 <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>
20120 </ul>
20121 </div>
20122
20123 <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>
20124
20125 !! end
20126
20127 !! test
20128 Bug 26375: TOC with bold
20129 !! options
20130 title=[[Main Page]]
20131 !! wikitext
20132 __TOC__
20133 == '''should be bold''' then normal text ==
20134 !! html
20135 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20136 <ul>
20137 <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>
20138 </ul>
20139 </div>
20140
20141 <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>
20142
20143 !! end
20144
20145 !! test
20146 Bug 33845: Headings become cursive in TOC when they contain an image
20147 !! options
20148 title=[[Main Page]]
20149 !! wikitext
20150 __TOC__
20151 == Image [[Image:foobar.jpg]] ==
20152 !! html
20153 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20154 <ul>
20155 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20156 </ul>
20157 </div>
20158
20159 <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>
20160
20161 !! end
20162
20163 !! test
20164 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20165 !! options
20166 title=[[Main Page]]
20167 !! wikitext
20168 __TOC__
20169 == <blockquote>Quote</blockquote> ==
20170 !! html
20171 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20172 <ul>
20173 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20174 </ul>
20175 </div>
20176
20177 <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>
20178
20179 !! html+tidy
20180 <p></p>
20181 <div id="toc" class="toc">
20182 <div id="toctitle">
20183 <h2>Contents</h2>
20184 </div>
20185 <ul>
20186 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20187 </ul>
20188 </div>
20189 <p></p>
20190 <h2><span class="mw-headline" id="Quote"></span></h2>
20191 <blockquote>
20192 <p><span class="mw-headline" id="Quote">Quote</span></p>
20193 </blockquote>
20194 <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>
20195 !! end
20196
20197 !! test
20198 Unclosed tags in TOC
20199 !! options
20200 title=[[Main Page]]
20201 !! wikitext
20202 __TOC__
20203 == Proof: 2 < 3 ==
20204 <small>Hanc marginis exiguitas non caperet.</small>
20205 QED
20206 !! html
20207 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20208 <ul>
20209 <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>
20210 </ul>
20211 </div>
20212
20213 <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>
20214 <p><small>Hanc marginis exiguitas non caperet.</small>
20215 QED
20216 </p>
20217 !! end
20218
20219 !! test
20220 Multiple tags in TOC
20221 !! wikitext
20222 __TOC__
20223 == <i>Foo</i> <b>Bar</b> ==
20224
20225 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20226 !! html
20227 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20228 <ul>
20229 <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>
20230 <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>
20231 </ul>
20232 </div>
20233
20234 <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>
20235 <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>
20236
20237 !! html+tidy
20238 <p></p>
20239 <div id="toc" class="toc">
20240 <div id="toctitle">
20241 <h2>Contents</h2>
20242 </div>
20243 <ul>
20244 <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>
20245 <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>
20246 </ul>
20247 </div>
20248 <p></p>
20249 <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>
20250 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20251 <blockquote>
20252 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20253 </blockquote>
20254 <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>
20255 !! end
20256
20257 !! test
20258 Tags with parameters in TOC
20259 !! wikitext
20260 __TOC__
20261 == <sup class="in-h2">Hello</sup> ==
20262
20263 == <sup class="a > b">Evilbye</sup> ==
20264 !! html
20265 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20266 <ul>
20267 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20268 <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>
20269 </ul>
20270 </div>
20271
20272 <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>
20273 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> 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>
20274
20275 !! end
20276
20277 !! test
20278 span tags with directionality in TOC
20279 !! wikitext
20280 __TOC__
20281 == <span dir="ltr">C++</span> ==
20282
20283 == <span dir="rtl">זבנג!</span> ==
20284
20285 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20286
20287 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20288
20289 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20290 !! html
20291 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20292 <ul>
20293 <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>
20294 <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>
20295 <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>
20296 <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>
20297 <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>
20298 </ul>
20299 </div>
20300
20301 <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>
20302 <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>
20303 <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>
20304 <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>
20305 <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>
20306
20307 !! end
20308
20309 !! test
20310 Bug 72884: bdi element in ToC
20311 !! wikitext
20312 __TOC__
20313 == <bdi>test</bdi> ==
20314 !! html
20315 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20316 <ul>
20317 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20318 </ul>
20319 </div>
20320
20321 <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>
20322
20323 !! end
20324
20325 # Note that the html output does not have the <p></p>, but the
20326 # html+tidy output *does*. This is because the empty <p></p> is
20327 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20328 !! test
20329 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20330 !! wikitext
20331 __TOC__
20332 == x ==
20333 !! html
20334 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20335 <ul>
20336 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20337 </ul>
20338 </div>
20339
20340 <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>
20341
20342 !! html+tidy
20343 <p></p>
20344 <div id="toc" class="toc">
20345 <div id="toctitle">
20346 <h2>Contents</h2>
20347 </div>
20348 <ul>
20349 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20350 </ul>
20351 </div>
20352 <p></p>
20353 <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>
20354 !! end
20355
20356 !! article
20357 MediaWiki:Bug32057
20358 !! text
20359 == {{int:headline_sample}} ==
20360 !! endarticle
20361
20362 !! test
20363 Bug 32057: Title needed when expanding <h> nodes.
20364 !! options
20365 title=[[Main Page]]
20366 !! wikitext
20367 {{int:Bug32057}}
20368 !! html
20369 <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>
20370
20371 !! end
20372
20373 !! test
20374 Strip marker in urlencode
20375 !! wikitext
20376 {{urlencode:x<nowiki/>y}}
20377 {{urlencode:x<nowiki/>y|wiki}}
20378 {{urlencode:x<nowiki/>y|path}}
20379 {{urlencode:x<pre id="one">two</pre>y}}
20380 !! html
20381 <p>xy
20382 xy
20383 xy
20384 xy
20385 </p>
20386 !! end
20387
20388 !! test
20389 Strip marker in lc
20390 !! wikitext
20391 {{lc:x<nowiki/>y}}
20392 !! html
20393 <p>xy
20394 </p>
20395 !! end
20396
20397 !! test
20398 Strip marker in uc
20399 !! wikitext
20400 {{uc:x<nowiki/>y}}
20401 !! html
20402 <p>XY
20403 </p>
20404 !! end
20405
20406 !! test
20407 Strip marker in formatNum
20408 !! wikitext
20409 {{formatnum:1<nowiki/>2}}
20410 {{formatnum:1<nowiki/>2|R}}
20411 !! html
20412 <p>12
20413 12
20414 </p>
20415 !! end
20416
20417 !! test
20418 Check noCommafy in formatNum
20419 !! options
20420 language=be-tarask
20421 !! wikitext
20422 {{formatnum:123456.78}}
20423 {{formatnum:123456.78|NOSEP}}
20424 !! html
20425 <p>123 456,78
20426 123456.78
20427 </p>
20428 !! end
20429
20430 !! test
20431 Wrong option for formatNum (bug 56199)
20432 !! wikitext
20433 {{formatnum:1,234.56|Random}}
20434 {{formatnum:1,234.56|EVERYTHING}}
20435 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20436 !! html
20437 <p>1,234.56
20438 1,234.56
20439 1,234.56
20440 </p>
20441 !! end
20442
20443 !! test
20444 Strip marker in grammar
20445 !! options
20446 language=fi
20447 !! wikitext
20448 {{grammar:elative|foo<nowiki/>bar}}
20449 !! html
20450 <p>foobarista
20451 </p>
20452 !! end
20453
20454 !! test
20455 Strip marker in padleft
20456 !! wikitext
20457 {{padleft:|2|x<nowiki/>y}}
20458 !! html
20459 <p>xy
20460 </p>
20461 !! end
20462
20463 !! test
20464 Strip marker in padright
20465 !! wikitext
20466 {{padright:|2|x<nowiki/>y}}
20467 !! html
20468 <p>xy
20469 </p>
20470 !! end
20471
20472 !! test
20473 Strip marker in anchorencode
20474 !! wikitext
20475 {{anchorencode:x<nowiki/>y}}
20476 !! html
20477 <p>xy
20478 </p>
20479 !! end
20480
20481 !! test
20482 nowiki inside link inside heading (bug 18295)
20483 !! wikitext
20484 ==[[foo|x<nowiki>y</nowiki>z]]==
20485 !! html
20486 <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>
20487
20488 !! end
20489
20490 !! test
20491 new support for bdi element (bug 31817)
20492 !! wikitext
20493 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20494 !! html
20495 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20496
20497 !!end
20498
20499 !! test
20500 Ignore pipe between table row attributes
20501 !! wikitext
20502 {|
20503 | quux
20504 |- id=foo | style='color: red'
20505 | bar
20506 |}
20507 !! html
20508 <table>
20509 <tr>
20510 <td> quux
20511 </td></tr>
20512 <tr id="foo" style="color: red">
20513 <td> bar
20514 </td></tr></table>
20515
20516 !! end
20517
20518 !!test
20519 Gallery override link with WikiLink (bug 34852)
20520 !! wikitext
20521 <gallery>
20522 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20523 </gallery>
20524 !! html
20525 <ul class="gallery mw-gallery-traditional">
20526 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20527 <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>
20528 <div class="gallerytext">
20529 <p>caption
20530 </p>
20531 </div>
20532 </div></li>
20533 </ul>
20534
20535 !! end
20536
20537 !!test
20538 Gallery override link with absolute external link (bug 34852)
20539 !! wikitext
20540 <gallery>
20541 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20542 </gallery>
20543 !! html
20544 <ul class="gallery mw-gallery-traditional">
20545 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20546 <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>
20547 <div class="gallerytext">
20548 <p>caption
20549 </p>
20550 </div>
20551 </div></li>
20552 </ul>
20553
20554 !! end
20555
20556 !!test
20557 Gallery override link with malicious javascript (bug 34852)
20558 !! wikitext
20559 <gallery>
20560 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20561 </gallery>
20562 !! html
20563 <ul class="gallery mw-gallery-traditional">
20564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20565 <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>
20566 <div class="gallerytext">
20567 <p>caption
20568 </p>
20569 </div>
20570 </div></li>
20571 </ul>
20572
20573 !! end
20574
20575 !!test
20576 Gallery with invalid title as link (bug 43964)
20577 !! wikitext
20578 <gallery>
20579 File:foobar.jpg|link=<
20580 </gallery>
20581 !! html
20582 <ul class="gallery mw-gallery-traditional">
20583 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20584 <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>
20585 <div class="gallerytext">
20586 </div>
20587 </div></li>
20588 </ul>
20589
20590 !! end
20591
20592 !!test
20593 Language parser function
20594 !! wikitext
20595 {{#language:ar}}
20596 !! html
20597 <p>العربية
20598 </p>
20599 !! end
20600
20601 !!test
20602 Padleft and padright as substr
20603 !! wikitext
20604 {{padleft:|3|abcde}}
20605 {{padright:|3|abcde}}
20606 !! html
20607 <p>abc
20608 abc
20609 </p>
20610 !! end
20611
20612 !!test
20613 Special parser function
20614 !! wikitext
20615 {{#special:RandomPage}}
20616 {{#special:BaDtItLe}}
20617 {{#special:Foobar}}
20618 !! html
20619 <p>Special:Random
20620 Special:Badtitle
20621 Special:Foobar
20622 </p>
20623 !! end
20624
20625 !!test
20626 Bug 34939 - Case insensitive link parsing ([HttP://])
20627 !! wikitext
20628 [HttP://MediaWiki.Org/]
20629 !! html/php
20630 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20631 </p>
20632 !! html/parsoid
20633 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20634 !! end
20635
20636 !!test
20637 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20638 !! wikitext
20639 [HttP://MediaWiki.Org/ MediaWiki]
20640 !! html
20641 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20642 </p>
20643 !! end
20644
20645 !!test
20646 Bug 34939 - Case insensitive link parsing (HttP://)
20647 !! wikitext
20648 HttP://MediaWiki.Org/
20649 !! html/php
20650 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20651 </p>
20652 !! html/parsoid
20653 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20654 !! end
20655
20656 !!test
20657 Disable TOC
20658 !! options
20659 notoc
20660 !! wikitext
20661 Lead
20662 == Section 1 ==
20663 == Section 2 ==
20664 == Section 3 ==
20665 == Section 4 ==
20666 == Section 5 ==
20667 !! html
20668 <p>Lead
20669 </p>
20670
20671 <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>
20672 <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>
20673 <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>
20674 <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>
20675 <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>
20676
20677 !! end
20678
20679
20680 ###
20681 ### Parsoid-specific tests
20682 ### Parsoid-PHP parser incompatibilities
20683 ###
20684 !!test
20685 1. SOL-sensitive wikitext tokens as template-args
20686 !!options
20687 parsoid=wt2html,wt2wt
20688 !! wikitext
20689 {{echo|*a}}
20690 {{echo|#a}}
20691 {{echo|:a}}
20692 !! html
20693 <span about="#mwt1" typeof="mw:Transclusion">
20694 </span><ul about="#mwt1"><li>a</li>
20695 </ul>
20696 <span about="#mwt2" typeof="mw:Transclusion">
20697 </span><ol about="#mwt2"><li>a</li>
20698 </ol>
20699 <span about="#mwt3" typeof="mw:Transclusion">
20700 </span><dl about="#mwt3"><dd>a</dd>
20701 </dl>
20702 !!end
20703
20704 #### -----------------------------------------------------------------
20705 #### Parsoid-specific functionality tests
20706 #### -----------------------------------------------------------------
20707
20708 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20709 # We know wt2wt will fail, but we expect selser to pass.
20710 # Due to the nature of our testing, wt2wt and selser tests will enter the
20711 # blacklist and we'll catch selser regressions based on changes to the
20712 # blacklist entries for selser tests.
20713 !! test
20714 1. Bad treebuilder fixup of formatting elt is cleaned up
20715 !! options
20716 parsoid=wt2html,wt2wt
20717 !! wikitext
20718 {|
20719 |
20720 <small>
20721 [[Image:Foobar.jpg|right|Test]]
20722 </small>
20723 |}
20724 !! html/parsoid
20725 <table>
20726 <tbody><tr><td>
20727 <small>
20728 <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>
20729 </small>
20730 </td></tr>
20731 </tbody></table>
20732 !! end
20733
20734 !! test
20735 2. Bad treebuilder fixup of formatting elt is cleaned up
20736 !! options
20737 parsoid=wt2html,wt2wt
20738 !! wikitext
20739 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20740
20741 <small>[[Image:Foobar.jpg|right|300px]]</small>
20742 !! html/parsoid
20743
20744 <p><b>foo</b></p>
20745 <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>
20746 <p><b>bar</b></p>
20747 <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>
20748 !! end
20749
20750 #### ----------------------------------------------------------------
20751 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20752 #### tags. Parsoid's output for these tags differs from that of the
20753 #### PHP parser.
20754 #### ----------------------------------------------------------------
20755
20756 !!test
20757 Ref: 1. ref-location should be replaced with an index span
20758 !!options
20759 parsoid
20760 !! wikitext
20761 A <ref>foo</ref>
20762 B <ref name="x">foo</ref>
20763 C <ref name="y" />
20764 <references />
20765 !! html
20766 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
20767 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
20768 C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
20769 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20770 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20771 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
20772 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
20773 </ol>
20774 !!end
20775
20776 !!test
20777 Ref: 2. ref-tags with identical names should all get the same index
20778 !!options
20779 parsoid
20780 !! wikitext
20781 A <ref name="x">foo</ref>
20782 B <ref name="x" />
20783 <references />
20784 !! html
20785 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
20786 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20787 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20788 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20789 </ol>
20790 !!end
20791
20792 !!test
20793 Ref: 3. spaces in ref-names should be ignored
20794 !!options
20795 parsoid
20796 !! wikitext
20797 A <ref name="x">foo</ref>
20798 B <ref name=" x " />
20799 C <ref name= x />
20800 <references />
20801 !! html
20802 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
20803 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
20804 C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20805 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20806 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20807 </ol>
20808 !!end
20809
20810 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20811 !!test
20812 Ref: 4. 'constructor' should be accepted as a valid ref-name
20813 !!options
20814 parsoid
20815 !! wikitext
20816 A <ref name="constructor">foo</ref>
20817 <references />
20818 !! html
20819 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20820 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20821 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
20822 </ol>
20823 !!end
20824
20825 !!test
20826 Ref: 5. body should accept generic wikitext
20827 !!options
20828 parsoid
20829 !! wikitext
20830 A <ref>
20831 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20832 </ref>
20833
20834 <references />
20835 !! html
20836 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20837
20838 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20839 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">This is a <b><a rel="mw:WikiLink" href="Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
20840 </span></li>
20841 </ol>
20842 !!end
20843
20844 !!test
20845 Ref: 6. indent-pres should not be output in ref-body
20846 !!options
20847 parsoid
20848 !! wikitext
20849 A <ref>
20850 foo
20851 bar
20852 baz
20853 </ref>
20854
20855 <references />
20856 !! html
20857 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20858
20859 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20860 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
20861 bar
20862 baz
20863 </span></li>
20864 </ol>
20865 !!end
20866
20867 !!test
20868 Ref: 7. No p-wrapping in ref-body
20869 !!options
20870 parsoid
20871 !! wikitext
20872 A <ref>
20873 foo
20874
20875 bar
20876
20877
20878 baz
20879
20880
20881
20882 booz
20883 </ref>
20884
20885 <references />
20886 !! html
20887 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20888
20889 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20890 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
20891
20892 bar
20893
20894
20895 baz
20896
20897
20898
20899 booz
20900 </span></li>
20901 </ol>
20902 !!end
20903
20904 !!test
20905 Ref: 8. transclusion wikitext has lower precedence
20906 !!options
20907 parsoid
20908 !! wikitext
20909 A <ref> foo {{echo|</ref> B C}}
20910
20911 <references />
20912 !! html
20913 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C<span typeof="mw:Nowiki">}}</span></p>
20914 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20915 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <span typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
20916 </ol>
20917 !!end
20918
20919 !!test
20920 Ref: 9. unclosed comments should not leak out of ref-body
20921 !!options
20922 parsoid
20923 !! wikitext
20924 A <ref> foo <!--</ref> B C
20925 <references />
20926 !! html
20927 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
20928 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20929 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
20930 </ol>
20931 !!end
20932
20933 !!test
20934 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20935 !!options
20936 parsoid
20937 !! wikitext
20938 A <ref> <b> foo </ref> B C
20939
20940 <references />
20941 !! html
20942 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
20943
20944
20945 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20946 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
20947 </ol>
20948 !!end
20949
20950 !!test
20951 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20952 !!options
20953 parsoid
20954 !! wikitext
20955 A <ref>foo</ref> B
20956 C <ref>bar</ref> D
20957 <references />
20958 !! html
20959 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
20960 C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
20961 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20962 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20963 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20964 </ol>
20965 !!end
20966
20967 !!test
20968 Ref: 12. ref-tags act as trailing newline migration barrier
20969 !! wikitext
20970 <!--the newline at the end of this line moves out of the p tag-->a
20971
20972 b<!--the newline at the end of this line stays inside the p tag--> <ref />
20973 <ref />
20974
20975 c
20976 <references />
20977 !! html/parsoid
20978 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
20979
20980
20981 <p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
20982 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
20983
20984 <p>c</p>
20985 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20986 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
20987 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
20988 !!end
20989
20990 !!test
20991 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20992 !!options
20993 parsoid
20994 !! wikitext
20995 <ref>foo</ref> A
20996 <ref>bar
20997 </ref> B
20998 <references />
20999 !! html
21000 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
21001 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
21002 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21003 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21004 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
21005 </span></li>
21006 </ol>
21007 !!end
21008
21009 !!test
21010 Ref: 14. A nested ref-tag should be emitted as plain text
21011 !!options
21012 parsoid
21013 !! wikitext
21014 <ref>foo <ref>bar</ref> baz</ref>
21015
21016 <references />
21017 !! html
21018 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21019 </p>
21020 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21021 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
21022 </ol>
21023 !!end
21024
21025 !!test
21026 Ref: 15. ref-tags with identical names should get identical indexes
21027 !!options
21028 parsoid
21029 !! wikitext
21030 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21031 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21032
21033 <references />
21034 !! html
21035 <p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
21036 B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
21037
21038 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
21039 </ol>
21040 !!end
21041
21042 ## We don't bother wt2wt-ing non-standard whitespace
21043 !!test
21044 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21045 !!options
21046 parsoid=wt2html
21047 !! wikitext
21048 A <ref >foo</ref >
21049
21050 <references />
21051 !! html
21052 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21053 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21054 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
21055 !!end
21056
21057 !!test
21058 Ref: 17. Generate valid HTML5 id/about attributes
21059 !!options
21060 parsoid
21061 !!wikitext
21062 <ref name="a b">foo</ref>
21063
21064 <references />
21065 !!html
21066 <p><span class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1"><span class="mw-reflink-text">[1]</span></a></span>
21067 </p>
21068
21069 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21070 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li>
21071 </ol>
21072 !!end
21073
21074 !!test
21075 Ref: 18. T58916: Extension attributes should be parsed as plain text
21076 !!options
21077 parsoid
21078 !!wikitext
21079 <ref name="{{echo|a}}">foo</ref>
21080
21081 <references />
21082 !!html
21083 <p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
21084 </p>
21085
21086 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21087 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
21088 </ol>
21089 !!end
21090
21091 !!test
21092 Ref: 19. ref-tags with identical name encodings should get identical indexes
21093 !!options
21094 parsoid
21095 !! wikitext
21096 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21097
21098 <references />
21099 !! html
21100 <p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
21101 </p>
21102 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21103 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
21104 </ol>
21105 !!end
21106
21107 !!test
21108 Ref: 20. ref-tags with identical names but different content should keep it
21109 !!options
21110 parsoid
21111 !! wikitext
21112 A <ref name="foo">Foo one</ref>
21113 B <ref name="foo">Foo two</ref>
21114 C <ref name="foo" />
21115
21116 <references />
21117 !! html
21118 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
21119 B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
21120 C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21121
21122 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
21123 </ol>
21124 !!end
21125
21126 !!test
21127 References: 1. references tag without any refs should be handled properly
21128 !! wikitext
21129 <references />
21130 !! html/parsoid
21131 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21132 !!end
21133
21134 !!test
21135 References: 2. references tag with group only outputs references from that group
21136 !! wikitext
21137 A <ref group="a">foo</ref>
21138 B <ref group="b">bar</ref>
21139 C <ref>baz</ref>
21140
21141 <references group="a" />
21142 <references />
21143 <references group="b" />
21144 !! html/parsoid
21145 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21146 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
21147 C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
21148
21149 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21150 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21151 </ol>
21152 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21153 <li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
21154 </ol>
21155 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21156 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21157 </ol>
21158 !!end
21159
21160 !!test
21161 References: 3. ref list should be cleared after processing references
21162 !! wikitext
21163 A <ref>foo</ref>
21164
21165 <references />
21166
21167 B <ref>bar</ref>
21168
21169 <references />
21170 !! html/parsoid
21171 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21172
21173 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21174 </ol>
21175
21176 <p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
21177
21178 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21179 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21180 </ol>
21181 !!end
21182
21183 !!test
21184 References: 4. only referenced group should be cleared after processing references
21185 !! wikitext
21186 A <ref group="a">afoo</ref>
21187 B <ref>bfoo</ref>
21188
21189 <references group="a" />
21190
21191 C <ref>cfoo</ref>
21192
21193 <references />
21194 !! html/parsoid
21195 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21196 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
21197
21198 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
21199 </ol>
21200
21201 <p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
21202
21203 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
21204 </ol>
21205 !!end
21206
21207 !!test
21208 References: 5. ref tags in references should be processed while ignoring all other content
21209 !! wikitext
21210 A <ref name="a" />
21211 B <ref name="b">bar</ref>
21212
21213 <references>
21214 <ref name="a">foo</ref>
21215 This should just get lost.
21216 </references>
21217 !! html/parsoid
21218 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
21219 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
21220
21221
21222 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
21223 </ol>
21224 !!end
21225
21226 !!test
21227 References: 6. <references /> from a transclusion
21228 !! wikitext
21229 <ref>Foo</ref> {{echo|<references />}}
21230 !! html/parsoid
21231 <p><span about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p> <ol class="mw-references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
21232 </ol>
21233 !!end
21234
21235 !! test
21236 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21237 !! wikitext
21238 A <ref>foo bar for a</ref>
21239 B <ref group="X" name="b" />
21240
21241 <references />
21242
21243 <references group="X">
21244 <ref name="b">foo</ref>
21245 </references>
21246 !! html/parsoid
21247 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21248 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
21249 </p>
21250
21251 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21252 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
21253 </ol>
21254
21255 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
21256 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
21257 </ol>
21258 !! end
21259
21260 !! test
21261 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21262 !! wikitext
21263 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21264 <references />
21265 !! html/parsoid
21266 <p>X<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21267 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
21268 </ol>
21269 !!end
21270
21271 # This test only works in wt2html now as the <references /> are always generated
21272 # unless selser is active. Once T72722 is fixed, we should add a changes test
21273 # here to ensure that unrelated changes don't add the new <references /> in
21274 # wt2wt.
21275 !! test
21276 References: 9. Generate missing references list at the end
21277 !! wikitext
21278 A <ref>foo</ref>
21279 B <ref group="inexistent">bar</ref>
21280 !! html/parsoid
21281 <p>A <span class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
21282 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21283 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21284 </ol>
21285 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21286 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21287 </ol>
21288 !! end
21289
21290 !! test
21291 References: 10. New <references/> shouldn't be added for unrelated edits.
21292 !! options
21293 parsoid={
21294 "modes": ["selser"],
21295 "changes": [["#x", "remove"]],
21296 "selser": "noauto"
21297 }
21298 !! wikitext
21299 Unrelated text<span id="x"> that's going to disappear</span>.
21300 A <ref>foo</ref>
21301 !! wikitext/edited
21302 Unrelated text.
21303 A <ref>foo</ref>
21304 !!end
21305
21306 !! test
21307 Entities in ref name
21308 !! wikitext
21309 <ref name="test &amp; me">hi</ref>
21310 <references />
21311 !! html/parsoid
21312 <p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21313 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21314 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
21315 </ol>
21316 !! end
21317
21318 # This test is wt2html only because we're permitting the serializer to produce
21319 # dirty diffs, normalizing the unclosed references to the self-closed version.
21320 !! test
21321 Generate references for unclosed references tag
21322 !! options
21323 parsoid=wt2html
21324 !! wikitext
21325 a<ref>foo</ref>
21326
21327 <references>
21328 !! html/parsoid
21329 <p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21330 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21331 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
21332 !! end
21333
21334 !! test
21335 New reference serializes on its own line
21336 !! options
21337 parsoid=wt2wt,html2wt
21338 !! wikitext
21339 foo
21340 <references />
21341 !! html/parsoid
21342 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21343 !! end
21344
21345 #### ----------------------------------------------------------------
21346 #### Parsoid-only testing of Parsoid's impl of LST
21347 #### Not implemented yet, see
21348 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21349 #### ----------------------------------------------------------------
21350
21351 !!test
21352 LST Sections: 1. Simple section start and end
21353 !! wikitext
21354 <section begin="2011-05-16" />
21355 <section end="2014-04-10 (MW 1.23wmf22)" />
21356 !! html/parsoid
21357 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21358 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21359 !! end
21360
21361 #--------- Test stripping of empty nodes in template content ----------
21362 !!test
21363 Empty LI and TR nodes should be stripped from template content
21364 !!wikitext
21365 {{EmptyLITest}}
21366 {{EmptyTRTest}}
21367 !!html/parsoid
21368 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21369 <li>a</li>
21370 <li>b</li>
21371 </ul>
21372 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21373 <tbody>
21374 <tr>
21375 <td>foo</td>
21376 </tr>
21377 <tr>
21378 <td>bar</td>
21379 </tr>
21380 </tbody>
21381 </table>
21382 !!end
21383
21384 !!test
21385 Empty LI and TR nodes should not be stripped from top-level content
21386 !!wikitext
21387 * a
21388 *
21389 * b
21390 {|
21391 |-
21392 |-
21393 |foo
21394 |}
21395 !!html/parsoid
21396 <ul>
21397 <li> a</li>
21398 <li></li>
21399 <li> b</li>
21400 </ul>
21401 <table>
21402 <tbody>
21403 <tr></tr>
21404 <tr>
21405 <td>foo</td>
21406 </tr>
21407 </tbody>
21408 </table>
21409 !!end
21410
21411 !!test
21412 Empty TR nodes should not be stripped if they have any attributes set
21413 !!wikitext
21414 {{EmptyTRWithHTMLAttrTest}}
21415 !!html/parsoid
21416 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21417 <tr align="center"></tr>
21418 <tr><td>foo</td></tr>
21419 <tr align="center"></tr>
21420 <tr><td>bar</td></tr>
21421 </table>
21422 !!end
21423
21424 #### ----------------------------------------------------------------
21425 #### The following section of tests are primarily to test
21426 #### wikitext escaping capabilities of Parsoid. Given that
21427 #### escaping can be done any number of ways, the wikitext (input)
21428 #### is always adjusted to reflect how Parsoid adds nowiki
21429 #### escape tags.
21430 ####
21431 #### We are marking several tests as parsoid-only since the
21432 #### HTML in the result section is different from what the
21433 #### PHP parser generates for it.
21434 #### ----------------------------------------------------------------
21435
21436
21437 #### --------------- Headings ---------------
21438 #### 0. Unnested
21439 #### 1. Nested inside html <h1>=foo=</h1>
21440 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21441 #### 3. Nested inside html with wikitext split by html tags
21442 #### 4. No escape needed
21443 #### 5. Empty headings <h1></h1>
21444 #### 6. Heading chars in SOL context
21445 #### ----------------------------------------
21446 !! test
21447 Headings: 0. Unnested
21448 !! options
21449 parsoid
21450 !! wikitext
21451 <nowiki>=foo=</nowiki>
21452
21453 <nowiki> =foo= </nowiki>
21454 <!--cmt-->
21455 <nowiki>=foo=</nowiki>
21456
21457 =foo''a''<nowiki>=</nowiki>
21458 !! html
21459 <p><span typeof="mw:Nowiki">=foo=</span></p>
21460
21461 <p><span typeof="mw:Nowiki"> =foo= </span>
21462 <!--cmt-->
21463 <span typeof="mw:Nowiki">=foo=</span></p>
21464
21465 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21466 !!end
21467
21468 # New headings and existing headings are handled differently
21469 !! test
21470 Headings: 1. Nested inside html
21471 !! options
21472 parsoid=html2wt
21473 !! html
21474 <h1>=foo=</h1>
21475 <h2>=foo=</h2>
21476 <h3>=foo=</h3>
21477
21478 <h1 data-parsoid=''>=foo=</h1>
21479 <h2 data-parsoid=''>=foo=</h2>
21480 <h3 data-parsoid=''>=foo=</h3>
21481 <h4 data-parsoid=''>=foo=</h4>
21482 <h5 data-parsoid=''>=foo=</h5>
21483 <h6 data-parsoid=''>=foo=</h6>
21484 !! wikitext
21485 = =foo= =
21486
21487 == =foo= ==
21488
21489 === =foo= ===
21490
21491 =<nowiki>=foo=</nowiki>=
21492 ==<nowiki>=foo=</nowiki>==
21493 ===<nowiki>=foo=</nowiki>===
21494 ====<nowiki>=foo=</nowiki>====
21495 =====<nowiki>=foo=</nowiki>=====
21496 ======<nowiki>=foo=</nowiki>======
21497
21498 !!end
21499
21500 !! test
21501 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21502 !! options
21503 parsoid=html2wt
21504 !! html
21505 <h1>foo</h1>*bar
21506 <h1>foo</h1>=bar
21507 <h1>foo</h1>=bar=
21508 !! wikitext
21509 = foo =
21510 <nowiki>*</nowiki>bar
21511
21512 = foo =
21513 =bar
21514
21515 = foo =
21516 <nowiki>=bar=</nowiki>
21517 !!end
21518
21519 !! test
21520 Headings: 3. Nested inside html with wikitext split by html tags
21521 !! options
21522 parsoid=html2wt,wt2wt
21523 !! wikitext
21524 = ='''bold'''<nowiki>foo=</nowiki> =
21525 !! html/parsoid
21526 <h1>=<b>bold</b>foo=</h1>
21527 !!end
21528
21529 !! test
21530 Headings: 4a. No escaping needed (testing just h1 and h2)
21531 !! wikitext
21532 = =foo =
21533
21534 = foo= =
21535
21536 = =foo= =
21537
21538 = =foo= bar =
21539
21540 == =foo ==
21541
21542 == foo= ==
21543
21544 = = =
21545
21546 = ''=''foo= =
21547 !! html/parsoid
21548 <h1>=foo</h1>
21549 <h1>foo=</h1>
21550 <h1> =foo= </h1>
21551 <h1>=foo= bar</h1>
21552 <h2>=foo</h2>
21553 <h2>foo=</h2>
21554 <h1>=</h1>
21555 <h1><i>=</i>foo=</h1>
21556 !!end
21557
21558 !! test
21559 Headings: 4b. No escaping needed (inside p-tags)
21560 !! options
21561 parsoid=html2wt
21562 !! html
21563 <p>===
21564 =foo= x
21565 =foo= <s></s>
21566 </p>
21567 !! wikitext
21568 ===
21569 =foo= x
21570 =foo= <s></s>
21571 !!end
21572
21573 !! test
21574 Headings: 5. Empty headings
21575 !! wikitext
21576 =<nowiki/>=
21577
21578 ==<nowiki/>==
21579
21580 ===<nowiki/>===
21581
21582 ====<nowiki/>====
21583
21584 =====<nowiki/>=====
21585
21586 ======<nowiki/>======
21587 !! html/parsoid
21588 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21589
21590 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21591
21592 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21593
21594 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21595
21596 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21597
21598 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21599 !!end
21600
21601 !! test
21602 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21603 !! options
21604 parsoid
21605 !! wikitext
21606 <nowiki>=a=</nowiki>
21607
21608 <nowiki>=a=</nowiki>
21609
21610 <nowiki>=a=</nowiki>
21611
21612 <nowiki>=a=</nowiki>
21613 !! html
21614 <p>=a=</p>
21615 <p>=a= </p>
21616 <p>=a= </p>
21617 <p>=a= </p>
21618 !!end
21619
21620 !! test
21621 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21622 !! options
21623 parsoid
21624 !! wikitext
21625 <nowiki>=a=
21626 b</nowiki>
21627
21628 <nowiki>=a=
21629 b</nowiki>
21630
21631 <nowiki>=a=
21632 b</nowiki>
21633
21634 <nowiki>=a=
21635 b</nowiki>
21636 !! html
21637 <p>=a=
21638 b</p>
21639 <p>=a=
21640 b</p>
21641 <p>=a=
21642 b</p>
21643 <p>=a=
21644 b</p>
21645 </p>
21646 !!end
21647
21648 !! test
21649 Headings: 6c. Heading chars in SOL context (leading newline break)
21650 !! options
21651 parsoid
21652 !! wikitext
21653 a
21654 <nowiki>=b=</nowiki>
21655 !! html
21656 <p>a
21657 =b=</p>
21658 !!end
21659
21660 !! test
21661 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21662 !! options
21663 parsoid
21664 !! wikitext
21665 <!--c0--><nowiki>=a=</nowiki>
21666
21667 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21668 !! html
21669 <p><!--c0-->=a=</p>
21670 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21671 !!end
21672
21673 !! test
21674 Headings: 6d. Heading chars in SOL context (No escaping needed)
21675 !! options
21676 parsoid=html2wt
21677 !! html
21678 =a=<div>b</div>
21679 !! wikitext
21680 =a=<div>b</div>
21681 !!end
21682
21683 !! test
21684 Headings: 7. Insert a newline between new content and headings
21685 !! options
21686 parsoid=html2wt
21687 !! html
21688 <h2>NEW</h2>
21689 <p>new</p>
21690 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21691 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21692 !! wikitext
21693 == NEW ==
21694 new
21695
21696 ==A==
21697 a
21698
21699 !! end
21700
21701 #### --------------- Lists ---------------
21702 #### 0. Outside nests (*foo, etc.)
21703 #### 1. Nested inside html <ul><li>*foo</li></ul>
21704 #### 2. Inside definition lists
21705 #### 3. Only bullets at start should be escaped
21706 #### 4. No escapes needed
21707 #### 5. No unnecessary escapes
21708 #### 6. Escape bullets in SOL position
21709 #### 7. Escape bullets in a multi-line context
21710 #### ----------------------------------------
21711
21712 !! test
21713 Lists: 0. Outside nests
21714 !! wikitext
21715 <nowiki>*</nowiki>foo
21716
21717 <nowiki>#</nowiki>foo
21718
21719 <nowiki>;Foo:</nowiki>bar
21720 !! html
21721 <p>*foo
21722 </p><p>#foo
21723 </p><p>;Foo:bar
21724 </p>
21725 !!end
21726
21727 !! test
21728 Lists: 1. Nested inside html
21729 !! wikitext
21730 *<nowiki>*foo</nowiki>
21731
21732 *<nowiki>#foo</nowiki>
21733
21734 *<nowiki>:foo</nowiki>
21735
21736 *<nowiki>;foo</nowiki>
21737
21738 #<nowiki>*foo</nowiki>
21739
21740 #<nowiki>#foo</nowiki>
21741
21742 #<nowiki>:foo</nowiki>
21743
21744 #<nowiki>;foo</nowiki>
21745 !! html
21746 <ul><li>*foo</li></ul>
21747 <ul><li>#foo</li></ul>
21748 <ul><li>:foo</li></ul>
21749 <ul><li>;foo</li></ul>
21750 <ol><li>*foo</li></ol>
21751 <ol><li>#foo</li></ol>
21752 <ol><li>:foo</li></ol>
21753 <ol><li>;foo</li></ol>
21754
21755 !!end
21756
21757 !! test
21758 Lists: 2. Inside definition lists
21759 !! wikitext
21760 ;<nowiki>;foo</nowiki>
21761
21762 ;<nowiki>:foo</nowiki>
21763
21764 ;<nowiki>:foo</nowiki>
21765 :bar
21766
21767 :<nowiki>:foo</nowiki>
21768 !! html
21769 <dl><dt>;foo</dt></dl>
21770 <dl><dt>:foo</dt></dl>
21771 <dl><dt>:foo</dt>
21772 <dd>bar</dd></dl>
21773 <dl><dd>:foo</dd></dl>
21774
21775 !!end
21776
21777 !! test
21778 Lists: 3. Only bullets at start of text should be escaped
21779 !! wikitext
21780 *<nowiki>*foo*bar</nowiki>
21781
21782 *<nowiki>*foo</nowiki>''it''*bar
21783 !! html
21784 <ul><li>*foo*bar</li></ul>
21785 <ul><li>*foo<i>it</i>*bar</li></ul>
21786
21787 !!end
21788
21789 !! test
21790 Lists: 4. No escapes needed
21791 !! options
21792 parsoid
21793 !! wikitext
21794 *foo*bar
21795
21796 *''foo''*bar
21797
21798 *[[Foo]]: bar
21799
21800 *[[Foo]]*bar
21801 !! html
21802 <ul>
21803 <li>foo*bar
21804 </li>
21805 </ul>
21806 <ul>
21807 <li><i>foo</i>*bar
21808 </li>
21809 </ul>
21810 <ul>
21811 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21812 </li>
21813 </ul>
21814 <ul>
21815 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21816 </li>
21817 </ul>
21818 !!end
21819
21820 !! test
21821 Lists: 5. No unnecessary escapes
21822 !! wikitext
21823 * bar <span><nowiki>[[foo]]</nowiki></span>
21824
21825 * =bar <span><nowiki>[[foo]]</nowiki></span>
21826
21827 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21828
21829 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21830
21831 * =bar <span>foo]]</span>=
21832
21833 * <s></s>: a
21834
21835 * ''* foo''
21836 !! html
21837 <ul><li> bar <span>[[foo]]</span></li></ul>
21838 <ul><li> =bar <span>[[foo]]</span></li></ul>
21839 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21840 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21841 <ul><li> =bar <span>foo]]</span>=</li></ul>
21842 <ul><li> <s></s>: a</li></ul>
21843 <ul><li> <i>* foo</i></li></ul>
21844
21845 !!end
21846
21847 !! test
21848 Lists: 6. Escape bullets in SOL position
21849 !! options
21850 parsoid=html2wt
21851 !! html
21852 <p><!--cmt-->*foo</p>
21853 !! wikitext
21854 <!--cmt--><nowiki>*</nowiki>foo
21855 !!end
21856
21857 !! test
21858 Lists: 7. Escape bullets in a multi-line context
21859 !! wikitext
21860 a
21861 <nowiki>*</nowiki>b
21862 !! html
21863 <p>a
21864 *b
21865 </p>
21866 !!end
21867
21868 !! test
21869 Lists: 8. Escape colons only if not present in tags
21870 !! options
21871 parsoid=html2wt
21872 !! html
21873 <dl><dt>a:b<i>c:d</i></dt></dl>
21874 !! wikitext
21875 ; <nowiki>a:b</nowiki>''c:d''
21876 !! end
21877
21878 #### --------------- HRs ---------------
21879 #### 1. Single line
21880 #### -----------------------------------
21881
21882 !! test
21883 HRs: 1. Single line
21884 !! wikitext
21885 ----<nowiki>----</nowiki>
21886 ----=foo=
21887 ----*foo
21888 !! html+tidy
21889 <hr />
21890 <p>----</p>
21891 <hr />
21892 <p>=foo=</p>
21893 <hr />
21894 <p>*foo</p>
21895 !! end
21896
21897 #### --------------- Tables ---------------
21898 #### 1a. Simple example
21899 #### 1b. No escaping needed (!foo)
21900 #### 1c. No escaping needed (|foo)
21901 #### 1d. No escaping needed (|}foo)
21902 ####
21903 #### 2a. Nested in td (<td>foo|bar</td>)
21904 #### 2b. Nested in td (<td>foo||bar</td>)
21905 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21906 ####
21907 #### 3a. Nested in th (<th>foo!bar</th>)
21908 #### 3b. Nested in th (<th>foo!!bar</th>)
21909 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21910 ####
21911 #### 4a. Escape -
21912 #### 4b. Escape +
21913 #### 4c. No escaping needed
21914 #### --------------------------------------
21915
21916 !! test
21917 Tables: 1a. Simple example
21918 !! wikitext
21919 <nowiki>{|
21920 |}</nowiki>
21921 !! html
21922 <p>{|
21923 |}
21924 </p>
21925 !! end
21926
21927 !! test
21928 Tables: 1b. No escaping needed
21929 !! wikitext
21930 !foo
21931 !! html
21932 <p>!foo
21933 </p>
21934 !! end
21935
21936 !! test
21937 Tables: 1c. No escaping needed
21938 !! wikitext
21939 |foo
21940 !! html
21941 <p>|foo
21942 </p>
21943 !! end
21944
21945 !! test
21946 Tables: 1d. No escaping needed
21947 !! wikitext
21948 |}foo
21949 !! html
21950 <p>|}foo
21951 </p>
21952 !! end
21953
21954 !! test
21955 Tables: 2a. Nested in td
21956 !! options
21957 parsoid=html2wt
21958 !! html/parsoid
21959 <table><tbody><tr>
21960 <td>foo|bar</td></tr>
21961 <tr><td>x<div>a|b</div></td>
21962 </tbody></table>
21963 !! wikitext
21964 {|
21965 |<nowiki>foo|bar</nowiki>
21966 |-
21967 |x<div><nowiki>a|b</nowiki></div>
21968 |}
21969 !! html/php+tidy
21970 <table>
21971 <tr>
21972 <td>foo|bar</td>
21973 </tr>
21974 <tr>
21975 <td>x
21976 <div>a|b</div>
21977 </td>
21978 </tr>
21979 </table>
21980 !! end
21981
21982 !! test
21983 Tables: 2b. Nested in td
21984 !! options
21985 parsoid=html2wt
21986 !! html/parsoid
21987 <table><tbody><tr>
21988 <td>foo||bar</td>
21989 <td>a<i>b||c</i></td>
21990 <td>a<i><div>b||c</div></i></td>
21991 </tr></tbody></table>
21992 !! wikitext
21993 {|
21994 |<nowiki>foo||bar</nowiki>
21995 |a''<nowiki>b||c</nowiki>''
21996 |a''<div><nowiki>b||c</nowiki></div>''
21997 |}
21998 !! html/php
21999 <table>
22000 <tr>
22001 <td>foo||bar
22002 </td>
22003 <td>a<i>b||c</i>
22004 </td>
22005 <td>a<i><div>b||c</div></i>
22006 </td></tr></table>
22007
22008 !! end
22009
22010 !! test
22011 Tables: 2c. Nested in td -- no escaping needed
22012 !! wikitext
22013 {|
22014
22015 |foo!!bar
22016 |}
22017 !! html/*
22018 <table>
22019
22020 <tr>
22021 <td>foo!!bar
22022 </td></tr></table>
22023
22024 !! end
22025
22026 !! test
22027 Tables: 3a. Nested in th
22028 !! wikitext
22029 {|
22030
22031 !foo!bar
22032 |}
22033 !! html/*
22034 <table>
22035
22036 <tr>
22037 <th>foo!bar
22038 </th></tr></table>
22039
22040 !! end
22041
22042 !! test
22043 Tables: 3b. Nested in th
22044 !! options
22045 parsoid=html2wt
22046 !! html/parsoid
22047 <table><tbody>
22048 <tr><th>foo!!bar</th>
22049 <th><i>foo|bar</i></th>
22050 <th><i>foo!!bar</i></th>
22051 <th><i><span>foo!!bar</span></i></th>
22052 </tr></tbody></table>
22053 !! wikitext
22054 {|
22055 !<nowiki>foo!!bar</nowiki>
22056 !''<nowiki>foo|bar</nowiki>''
22057 !''<nowiki>foo!!bar</nowiki>''
22058 !''<span><nowiki>foo!!bar</nowiki></span>''
22059 |}
22060 !! html/php
22061 <table>
22062 <tr>
22063 <th>foo!!bar
22064 </th>
22065 <th><i>foo|bar</i>
22066 </th>
22067 <th><i>foo!!bar</i>
22068 </th>
22069 <th><i><span>foo!!bar</span></i>
22070 </th></tr></table>
22071
22072 !! end
22073
22074 !! test
22075 Tables: 3c. Nested in th
22076 !! options
22077 parsoid=html2wt
22078 !! html/parsoid
22079 <table><tbody>
22080 <tr><th>foo||bar</th>
22081 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22082 </tr></tbody></table>
22083 !! wikitext
22084 {|
22085 !<nowiki>foo||bar</nowiki>
22086 !<nowiki>foo||bar</nowiki>
22087 |}
22088 !! html/php
22089 <table>
22090 <tr>
22091 <th>foo||bar
22092 </th>
22093 <th>foo||bar
22094 </th></tr></table>
22095
22096 !! end
22097
22098 !! test
22099 Tables: 4a. Escape -
22100 !! options
22101 parsoid=html2wt
22102 !! html/*
22103 <table>
22104
22105 <tr>
22106 <th>-bar
22107 </th></tr>
22108 <tr>
22109 <td>-bar
22110 </td></tr></table>
22111
22112 !! wikitext
22113 {|
22114
22115 !-bar
22116
22117 |-
22118 |<nowiki>-bar</nowiki>
22119 |}
22120 !! end
22121
22122 !! test
22123 Tables: 4b. Escape +
22124 !! options
22125 parsoid=html2wt
22126 !! html/*
22127 <table>
22128
22129 <tr>
22130 <th>+bar
22131 </th></tr>
22132 <tr>
22133 <td>+bar
22134 </td></tr></table>
22135
22136 !! wikitext
22137 {|
22138
22139 !+bar
22140
22141 |-
22142 |<nowiki>+bar</nowiki>
22143 |}
22144 !! end
22145
22146 !! test
22147 Tables: 4c. No escaping needed
22148 !! wikitext
22149 {|
22150 |foo-bar
22151 |foo+bar
22152 |-
22153 |''foo''-bar
22154 |''foo''+bar
22155 |-
22156 |foo
22157 bar|baz
22158 +bar
22159 -bar
22160 |-
22161 |x
22162 <div>a|b</div>
22163 |}
22164 !! html/php
22165 <table>
22166 <tr>
22167 <td>foo-bar
22168 </td>
22169 <td>foo+bar
22170 </td></tr>
22171 <tr>
22172 <td><i>foo</i>-bar
22173 </td>
22174 <td><i>foo</i>+bar
22175 </td></tr>
22176 <tr>
22177 <td>foo
22178 <p>bar|baz
22179 +bar
22180 -bar
22181 </p>
22182 </td></tr>
22183 <tr>
22184 <td>x
22185 <div>a|b</div>
22186 </td></tr></table>
22187
22188 !! html/parsoid
22189 <table><tbody>
22190 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22191 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22192 <tr><td>foo
22193 <p>bar|baz
22194 +bar
22195 -bar</p></td></tr>
22196 <tr><td>x
22197 <div>a|b</div></td>
22198 </tbody></table>
22199 !! end
22200
22201 !! test
22202 Tables: 4d. No escaping needed
22203 !! wikitext
22204 {|
22205 |[[Foo]]-bar
22206 ||+1
22207 ||-2
22208 |}
22209 !! html/php
22210 <table>
22211 <tr>
22212 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22213 </td>
22214 <td>+1
22215 </td>
22216 <td>-2
22217 </td></tr></table>
22218
22219 !! html/parsoid
22220 <table>
22221 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22222 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22223 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22224 </tbody></table>
22225 !! end
22226
22227 !! test
22228 Tables: Digest broken attributes on table and tr tag
22229 !! options
22230 parsoid=wt2html
22231 !! wikitext
22232 {| || |} ++
22233 |- || || ++ --
22234 |- > [
22235 |}
22236 !! html
22237 <table>
22238 <tbody>
22239 <tr></tr>
22240 <tr></tr>
22241 </tbody></table>
22242 !! end
22243
22244 !! test
22245 T97430: Don't emit empty nowiki pairs around marker meta tags
22246 !! options
22247 parsoid=html2wt
22248 !! html
22249 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22250 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22251 !! wikitext
22252 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22253 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22254 !! end
22255
22256 !! test
22257 Unclosed xmlish element in table line shouldn't eat end delimiters
22258 !! wikitext
22259 {|
22260 | <foo
22261 | bar>
22262 |}
22263 !! html/php
22264 <table>
22265 <tr>
22266 <td> &lt;foo
22267 </td>
22268 <td> bar&gt;
22269 </td></tr></table>
22270
22271 !! html/parsoid
22272 <table>
22273 <tbody><tr><td> &lt;foo</td>
22274 <td> bar></td></tr>
22275 </tbody></table>
22276 !! end
22277
22278 #### --------------- Links ----------------
22279 #### 1. Quote marks in link text
22280 #### 2. Wikilinks: Escapes needed
22281 #### 3. Wikilinks: No escapes needed
22282 #### 4. Extlinks: Escapes needed
22283 #### 5. Extlinks: No escapes needed
22284 #### --------------------------------------
22285 !! test
22286 Links 1. WikiLinks: No escapes needed
22287 !! wikitext
22288 [[Foo|Foo''boo'']]
22289 [[Foo|[Foobar]]]
22290 [[Foo|x [Foobar] x]]
22291 !! html/php
22292 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22293 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22294 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22295 </p>
22296 !! html/parsoid
22297 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22298 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22299 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22300 !! end
22301
22302 !! test
22303 Links 2. WikiLinks: Escapes needed
22304 !! options
22305 parsoid=html2wt
22306 !! html/parsoid
22307 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22308 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22309 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22310 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22311 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22312 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22313 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22314 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22315 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22316 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22317 !! wikitext
22318 [[Foo|<nowiki>Foobar]</nowiki>]]
22319 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22320 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22321 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22322 [[Foo|<nowiki>|Bar</nowiki>]]
22323 [[Foo|<nowiki>]]bar</nowiki>]]
22324 [[Foo|<nowiki>[[bar</nowiki>]]
22325 [[Foo|<nowiki>x [[ y</nowiki>]]
22326 [[Foo|<nowiki>x ]] y</nowiki>]]
22327 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22328 !! html/php
22329 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22330 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22331 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22332 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22333 <a href="/wiki/Foo" title="Foo">|Bar</a>
22334 <a href="/wiki/Foo" title="Foo">]]bar</a>
22335 <a href="/wiki/Foo" title="Foo">[[bar</a>
22336 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22337 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22338 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22339 </p>
22340 !! end
22341
22342 !! test
22343 Links 3. WikiLinks: No escapes needed
22344 !! wikitext
22345 [[Foo|[Foobar]]
22346 [[Foo|foo|bar]]
22347 !! html/php
22348 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22349 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22350 </p>
22351 !! html/parsoid
22352 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22353 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22354 !! end
22355
22356 !! test
22357 Links 4. ExtLinks: Escapes needed
22358 !! options
22359 parsoid=html2wt
22360 !! html/parsoid
22361 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22362 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22363 <p>[http://google.com]</p>
22364 <p>[http://google.com google]</p>
22365 !! wikitext
22366 [http://google.com <nowiki>[google]</nowiki>]
22367 [http://google.com <nowiki>google]</nowiki>]
22368
22369 <nowiki>[http://google.com]</nowiki>
22370
22371 <nowiki>[http://google.com google]</nowiki>
22372
22373 !! html/php
22374 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22375 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22376 </p><p>[http://google.com]
22377 </p><p>[http://google.com google]
22378 </p>
22379 !! end
22380
22381 !! test
22382 Links 5. ExtLinks: No escapes needed
22383 !! wikitext
22384 [http://google.com [google]
22385 !! html/php
22386 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22387 </p>
22388 !! html/parsoid
22389 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22390 !! end
22391
22392 !! test
22393 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22394 !! html/parsoid
22395 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22396 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22397 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22398 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22399 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22400 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22401 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22402 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22403 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22404 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22405 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22406 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22407 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22408 </p>
22409 !! wikitext
22410 x<nowiki/>http://example.com<nowiki/>y
22411 http://example.com<nowiki/>?x
22412 http://example.com<nowiki/>&x
22413 http://example.com<nowiki/>'x
22414 http://example.com<nowiki/>,x
22415 http://example.com<nowiki/>.x
22416 http://example.com<nowiki/>;x
22417 http://example.com<nowiki/>:x
22418 http://example.com<nowiki/>;x
22419 http://example.com<nowiki/>!x
22420 http://example.com<nowiki/>=x
22421 http://example.com<nowiki/>(x)
22422 http://example.com(x<nowiki/>)
22423 !! end
22424
22425 !! test
22426 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22427 !! html/parsoid
22428 <p>x
22429 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22430 y
22431 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22432 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22433 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22434 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22435 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22436 </p>
22437 !! wikitext
22438 x
22439 http://example.com
22440 y
22441 "http://example.com"
22442 (http://example.com)
22443 (http://example.com) foo
22444 http://example.com,
22445 http://example.com, foo
22446 !! html/php
22447 <p>x
22448 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22449 y
22450 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22451 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22452 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22453 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22454 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22455 </p>
22456 !! end
22457
22458 !! test
22459 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22460 !! html/parsoid
22461 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22462 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22463 !! wikitext
22464 http://example.com.,;:!?\
22465 -http://example.com:
22466 !! html/php
22467 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22468 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22469 </p>
22470 !! end
22471
22472 !! test
22473 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22474 !! html/parsoid
22475 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22476 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22477 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22478 !! wikitext
22479 RFC 123<nowiki/>4
22480 RFC 123<nowiki/>y
22481 X<nowiki/>RFC 123<nowiki/>y
22482 !! end
22483
22484 !! test
22485 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22486 !! html/parsoid
22487 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22488 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22489 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22490 </p>
22491 !! wikitext
22492 RFC 123?foo
22493 RFC 123&foo
22494 -RFC 123-
22495 !! html/php
22496 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22497 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22498 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22499 </p>
22500 !! end
22501
22502 !! test
22503 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22504 !! html/parsoid
22505 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22506 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22507 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22508 !! wikitext
22509 PMID 123<nowiki/>4
22510 PMID 123<nowiki/>y
22511 X<nowiki/>PMID 123<nowiki/>y
22512 !! end
22513
22514 !! test
22515 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22516 !! html/parsoid
22517 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22518 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22519 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22520 </p>
22521 !! wikitext
22522 PMID 123?foo
22523 PMID 123&foo
22524 -PMID 123-
22525 !! html/php
22526 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22527 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22528 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22529 </p>
22530 !! end
22531
22532 !! test
22533 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22534 !! html/parsoid
22535 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22536 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22537 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22538 </p>
22539 !! wikitext
22540 ISBN 1234567890<nowiki/>1
22541 ISBN 1234567890<nowiki/>x
22542 a<nowiki/>ISBN 1234567890<nowiki/>b
22543 !! end
22544
22545 !! test
22546 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22547 !! html/parsoid
22548 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22549 !! wikitext
22550 -ISBN 1234567890's
22551 !! html/php
22552 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22553 </p>
22554 !! end
22555
22556 !! test
22557 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22558 !! options
22559 parsoid=html2wt
22560 !! html/*
22561 <p>this is not a link: http://example.com
22562 </p>
22563 !! wikitext
22564 this is not a link: <nowiki>http://example.com</nowiki>
22565 !! end
22566
22567 !! test
22568 Links 15. Link trails can't become link prefixes.
22569 !! options
22570 language=is
22571 !! wikitext
22572 [[Söfnuður]]-[[00]]
22573 !! html/php
22574 <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>
22575 </p>
22576 !! html/parsoid
22577 <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>
22578 !! end
22579
22580 #### --------------- Quotes ---------------
22581 #### 1. Quotes inside <b> and <i>
22582 #### 2. Link fragments separated by <i> and <b> tags
22583 #### 3. Link fragments inside <i> and <b>
22584 #### 4. No escaping needed
22585 #### --------------------------------------
22586 !! test
22587 1a. Quotes inside <b> and <i>
22588 !! options
22589 parsoid=html2wt,wt2wt
22590 !! wikitext
22591 ''<nowiki/>'foo'''
22592 ''<nowiki>''foo''</nowiki>''
22593 ''<nowiki>'''foo'''</nowiki>''
22594 ''foo''<nowiki/>'s
22595 '''<nowiki/>'foo''''
22596 '''<nowiki>''foo''</nowiki>'''
22597 '''<nowiki>'''foo'''</nowiki>'''
22598 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22599 '''foo'''<nowiki/>'s
22600 '''foo''
22601 ''foo''<nowiki/>'
22602 ''foo'''<nowiki/>'
22603 '''foo''<nowiki/>'
22604 ''''foo'''
22605 '''foo'''<nowiki/>'
22606 ''''foo'''<nowiki/>'
22607 ''fools'<span> errand</span>''
22608 ''<span>fool</span>'s errand''
22609 '<nowiki/>''foo'' bar '''baz''
22610 a|!*#-:;+-~[]{}b'''x''
22611 !! html/*
22612 <p><i>'foo'</i>
22613 <i>''foo''</i>
22614 <i>'''foo'''</i>
22615 <i>foo</i>'s
22616 <b>'foo'</b>
22617 <b>''foo''</b>
22618 <b>'''foo'''</b>
22619 <b>foo'<i>bar'</i>baz</b>
22620 <b>foo</b>'s
22621 '<i>foo</i>
22622 <i>foo</i>'
22623 <i>foo'</i>'
22624 '<i>foo</i>'
22625 '<b>foo</b>
22626 <b>foo</b>'
22627 '<b>foo</b>'
22628 <i>fools'<span> errand</span></i>
22629 <i><span>fool</span>'s errand</i>
22630 '<i>foo</i> bar '<i>baz</i>
22631 a|!*#-:;+-~[]{}b'<i>x</i>
22632 </p>
22633 !! end
22634
22635 !! test
22636 1b. Quotes inside <b> and <i> with other tags on same line
22637 !! options
22638 parsoid=html2wt,wt2wt
22639 !! wikitext
22640 '''a'' foo ''[[bar]]''
22641 ''a''' foo ''[[bar]]''
22642 ''a''' foo '''{{echo|[[bar]]}}'''
22643 [[foo]] x'''[[bar]]''
22644 '''foo'' <ref>test</ref>
22645 '''foo'' <div title="name">test</div>
22646 '''foo'' and <br> bar
22647 <references />
22648 !! html
22649 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22650 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22651 <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>
22652 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22653 '<i>foo</i> <span class="mw-ref" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22654 '<i>foo</i> <div title="name">test</div>
22655 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22656 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22657 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
22658 </ol>
22659 !! end
22660
22661 !! test
22662 2. Link fragments separated by <i> and <b> tags
22663 !! wikitext
22664 [[''foo''<nowiki>hello]]</nowiki>
22665
22666 [['''foo'''<nowiki>hello]]</nowiki>
22667 !! html
22668 <p>[[<i>foo</i>hello]]
22669 </p><p>[[<b>foo</b>hello]]
22670 </p>
22671 !! end
22672
22673 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22674 # this is one of the shortcomings of this format
22675 !! test
22676 3. Link fragments inside <i> and <b>
22677 !! wikitext
22678 ''[[foo''<nowiki>]]</nowiki>
22679
22680 '''[[foo'''<nowiki>]]</nowiki>
22681 !! html
22682 <p><i>[[foo</i>]]
22683 </p><p><b>[[foo</b>]]
22684 </p>
22685 !! end
22686
22687 !! test
22688 4. No escaping needed
22689 !! wikitext
22690 '<span>''bar''</span>'
22691 '<span>'''bar'''</span>'
22692 'a:b'foo
22693 !! html
22694 <p>'<span><i>bar</i></span>'
22695 '<span><b>bar</b></span>'
22696 'a:b'foo
22697 </p>
22698 !! end
22699
22700 #### ----------- Paragraphs ---------------
22701 #### 1. No unnecessary escapes
22702 #### --------------------------------------
22703
22704 !! test
22705 1. No unnecessary escapes
22706 !! wikitext
22707 bar <span><nowiki>[[foo]]</nowiki></span>
22708
22709 =bar <span><nowiki>[[foo]]</nowiki></span>
22710
22711 [[bar <span><nowiki>[[foo]]</nowiki></span>
22712
22713 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22714
22715 =bar <span>foo]]</span><nowiki>=</nowiki>
22716 !! html
22717 <p>bar <span>[[foo]]</span>
22718 </p><p>=bar <span>[[foo]]</span>
22719 </p><p>[[bar <span>[[foo]]</span>
22720 </p><p>]]bar <span>[[foo]]</span>
22721 </p><p>=bar <span>foo]]</span>=
22722 </p>
22723 !!end
22724
22725 #### ----------------------- PRE --------------------------
22726 #### 1. Leading whitespace in SOL context should be escaped
22727 #### ------------------------------------------------------
22728 !! test
22729 1. Leading whitespace in SOL context should be escaped
22730 !! options
22731 parsoid
22732 !! wikitext
22733 <nowiki> </nowiki>a
22734
22735 <nowiki> </nowiki> a
22736
22737 <nowiki> </nowiki>a(tab)
22738
22739 <nowiki> </nowiki> a
22740 <!--cmt-->
22741 <nowiki> </nowiki> a
22742
22743 a
22744 <nowiki> </nowiki>b
22745
22746 a
22747 <nowiki> </nowiki>b
22748
22749 a
22750 <nowiki> </nowiki> b
22751 !! html
22752 <p> a</p>
22753 <p> a</p>
22754 <p> a(tab)</p>
22755 <p> a</p>
22756 <p><!--cmt--> a</p>
22757 <p>a
22758 b</p>
22759 <p>a
22760 b</p>
22761 <p>a
22762 b</p>
22763 !! end
22764
22765 !! test
22766 2. Leading whitespace in non-indent-pre contexts should not be escaped
22767 !! options
22768 parsoid
22769 !! wikitext
22770 foo <ref>''a''
22771 b</ref>
22772 <references />
22773 !! html
22774 <p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22775 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22776 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
22777 b</span></li>
22778 </ol>
22779 !! end
22780
22781 !! test
22782 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22783 !! options
22784 parsoid
22785 !! wikitext
22786 <blockquote>
22787 a
22788 <span>b</span>
22789 c
22790 </blockquote>
22791 !! html
22792 <blockquote>
22793 <p>
22794 a
22795 <span>b</span>
22796 c</p>
22797 </blockquote>
22798 !! end
22799
22800 !! test
22801 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22802 !! options
22803 parsoid
22804 !! wikitext
22805 [[File:Foobar.jpg|thumb|caption]]
22806 !! html/parsoid
22807 <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>
22808 !! end
22809
22810 !! test
22811 5. Nowiki escaping should account for indent-pres
22812 !! options
22813 parsoid=html2wt
22814 !! html
22815 <pre>==foo==</pre>
22816 !! wikitext
22817 ==foo==
22818 !! end
22819
22820 !!test
22821 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
22822 !! options
22823 parsoid
22824 !! wikitext
22825 * foo
22826 * bar
22827 !! html
22828 <pre>
22829 * foo
22830 * bar
22831 </pre>
22832 !! end
22833
22834 #### --------------- Behavior Switches --------------------
22835
22836 !! test
22837 1. Valid behavior switches should be escaped
22838 !! options
22839 parsoid=html2wt
22840 !! html
22841 __TOC__
22842 <i>__TOC__</i>
22843 !! wikitext
22844 <nowiki>__TOC__</nowiki>
22845 ''<nowiki>__TOC__</nowiki>''
22846 !! end
22847
22848 !! test
22849 2. Invalid behavior switches should not be escaped
22850 !! options
22851 parsoid=html2wt
22852 !! html
22853 __TOO__
22854 __|__
22855 !! wikitext
22856 __TOO__
22857 __|__
22858 !! end
22859
22860 # We use indent-pre as an indirect way to test for sol-transparent behavior.
22861 !! test
22862 Behavior switches should be SOL-transparent
22863 !! wikitext
22864 __TOC__
22865
22866 <!-- this one's bogus -->
22867 __TOO__
22868
22869 __TOC__ foo
22870
22871 __TOC__ bar
22872 !! html/parsoid
22873 <meta property="mw:PageProp/toc" />
22874
22875 <!-- this one's bogus -->
22876 <pre>__TOO__</pre>
22877
22878 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
22879
22880 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
22881 !! end
22882
22883 #### --------------- HTML tags ---------------
22884 #### 1. a tags
22885 #### 2. other tags
22886 #### 3. multi-line html tag
22887 #### 4. extension tags
22888 #### -----------------------------------------
22889 !! test
22890 1. a tags
22891 !! options
22892 parsoid
22893 !! wikitext
22894 <a href="http://google.com">google</a>
22895 !! html
22896 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22897 !! end
22898
22899 !! test
22900 2. other tags
22901 !! wikitext
22902 * <nowiki><div>foo</div></nowiki>
22903 * <nowiki><div style="color:red">foo</div></nowiki>
22904 * <nowiki><td></nowiki>
22905 !! html
22906 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22907 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22908 <li> &lt;td&gt;</li></ul>
22909
22910 !! end
22911
22912 !! test
22913 3. multi-line html tag
22914 !! wikitext
22915 <nowiki><div
22916 >foo</div
22917 ></nowiki>
22918 !! html
22919 <p>&lt;div
22920 &gt;foo&lt;/div
22921 &gt;
22922 </p>
22923 !! end
22924
22925 !! test
22926 4. extension tags
22927 !! wikitext
22928 <nowiki><ref>foo</ref></nowiki>
22929
22930 <nowiki><ref>bar</nowiki>
22931
22932 baz<nowiki></ref></nowiki>
22933 !! html
22934 <p>&lt;ref&gt;foo&lt;/ref&gt;
22935 </p><p>&lt;ref&gt;bar
22936 </p><p>baz&lt;/ref&gt;
22937 </p>
22938 !! end
22939
22940 #### --------------- Others ---------------
22941 !! test
22942 Escaping nowikis
22943 !! wikitext
22944 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22945 !! html
22946 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22947 </p>
22948 !! end
22949
22950 ## The quote-char in the input is necessary for triggering the bug
22951 !! test
22952 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22953 !! options
22954 parsoid=wt2wt,html2wt
22955 !! wikitext
22956 foo's bar :
22957 !! html
22958 <p>foo's bar :</p>
22959 !! end
22960
22961 !! test
22962
22963 Tag-like HTML structures are passed through as text
22964 !! wikitext
22965 <x y>
22966
22967 <x.y>
22968
22969 <x-y>
22970
22971 1>2
22972
22973 x<y
22974
22975 a>b
22976
22977 1<d e>f
22978 !! html
22979 <p>&lt;x y&gt;
22980 </p><p>&lt;x.y&gt;
22981 </p><p>&lt;x-y&gt;
22982 </p><p>1&gt;2
22983 </p><p>x&lt;y
22984 </p><p>a&gt;b
22985 </p><p>1&lt;d e&gt;f
22986 </p>
22987 !! end
22988
22989 !! test
22990 HTML tag with necessary entities in attributes
22991 !! wikitext
22992 <span title="&amp;amp;">foo</span>
22993 !! html
22994 <p><span title="&amp;amp;">foo</span>
22995 </p>
22996 !! end
22997
22998 !! test
22999 HTML tag with 'unnecessary' entity encoding in attributes
23000 !! wikitext
23001 <span title="&amp;">foo</span>
23002 !! html
23003 <p><span title="&amp;">foo</span>
23004 </p>
23005 !! end
23006
23007 !! test
23008 HTML tag with broken attribute value quoting
23009 !! wikitext
23010 <span title="Hello world>Foo</span>
23011 !! html/php
23012 <p><span>Foo</span>
23013 </p>
23014 !! html/parsoid
23015 <p><span title="Hello world">Foo</span>
23016 </p>
23017 !! end
23018
23019 !! test
23020 Parsoid-only: HTML tag with broken attribute value quoting
23021 !! options
23022 parsoid
23023 !! wikitext
23024 <span title="Hello world>Foo</span>
23025 !! html
23026 <p><span title="Hello world">Foo</span>
23027 </p>
23028 !! end
23029
23030 !! test
23031 Table with broken attribute value quoting
23032 !! wikitext
23033 {|
23034 | title="Hello world|Foo
23035 |}
23036 !! html/php
23037 <table>
23038 <tr>
23039 <td>Foo
23040 </td></tr></table>
23041
23042 !! html/parsoid
23043 <table>
23044 <tr>
23045 <td title="Hello world">Foo
23046 </td></tr></table>
23047
23048 !! end
23049
23050 !! test
23051 Table with broken attribute value quoting on consecutive lines
23052 !! wikitext
23053 {|
23054 | title="Hello world|Foo
23055 | style="color:red|Bar
23056 |}
23057 !! html/php
23058 <table>
23059 <tr>
23060 <td>Foo
23061 </td>
23062 <td>Bar
23063 </td></tr></table>
23064
23065 !! html/parsoid
23066 <table><tbody>
23067 <tr>
23068 <td title="Hello world">Foo
23069 </td><td style="color: red">Bar
23070 </td></tr></tbody></table>
23071
23072 !! end
23073
23074 !! test
23075 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23076 !! options
23077 parsoid
23078 !! wikitext
23079 {{}}
23080 !! html
23081 {{}}
23082 !! end
23083
23084 !! test
23085 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23086 !! options
23087 parsoid
23088 !! wikitext
23089 }}{{
23090 !! html
23091 }}{{
23092 !! end
23093
23094 !!test
23095 Accept empty td cell attribute
23096 !! wikitext
23097 {|
23098 | align="center" | foo || |
23099 |}
23100 !! html
23101 <table>
23102 <tr>
23103 <td align="center"> foo </td>
23104 <td>
23105 </td></tr></table>
23106
23107 !!end
23108
23109 !!test
23110 Non-empty attributes in th-cells
23111 !! wikitext
23112 {|
23113 ! Foo !! style="color: red" | Bar
23114 |}
23115 !! html
23116 <table>
23117 <tr>
23118 <th> Foo </th>
23119 <th style="color: red"> Bar
23120 </th></tr></table>
23121
23122 !!end
23123
23124 !!test
23125 Accept empty attributes in th-cells
23126 !! wikitext
23127 {|
23128 !| foo !!| bar
23129 |}
23130 !! html
23131 <table>
23132 <tr>
23133 <th> foo </th>
23134 <th> bar
23135 </th></tr></table>
23136
23137 !!end
23138
23139 !!test
23140 Empty table rows go away
23141 !! wikitext
23142 {|
23143 | Hello
23144 | there
23145 |- class="foo"
23146 |-
23147 |}
23148 !! html
23149 <table>
23150 <tr>
23151 <td> Hello
23152 </td>
23153 <td> there
23154 </td></tr>
23155
23156 </table>
23157
23158 !! end
23159
23160 ###
23161 ### Parsoid-centric tests for testing RTing of inter-element separators
23162 ### Edge cases not tested by existing parser tests and specific to
23163 ### Parsoid-specific serialization strategies.
23164 ###
23165
23166 !!test
23167 RT-ed inter-element separators should be valid separators
23168 !! wikitext
23169 {|
23170 |- [[foo]]
23171 |}
23172 !! html
23173 <table>
23174
23175 </table>
23176
23177 !!end
23178
23179 # Parsoid-only since PHP parser relies on Tidy for correct output
23180 !!test
23181 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23182 !!options
23183 parsoid
23184 !! wikitext
23185 {|
23186 |<small>foo
23187 bar
23188 |}
23189
23190 {|
23191 |<small>foo<small>
23192 |}
23193 !! html
23194 <table>
23195 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23196 <p>bar</p></small></td></tr>
23197 </tbody></table>
23198
23199 <table>
23200 <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>
23201 </tbody></table>
23202 !!end
23203
23204 # Note that the "style" attribute is really a template parameter here.
23205 # The = would have to be {{=}} if you wanted the literal.
23206 !!test
23207 Empty TD followed by TD with tpl-generated attribute
23208 !! wikitext
23209 {|
23210 |-
23211 |
23212 |{{echo|style='color:red'}}|foo
23213 |}
23214 !! html
23215 <table>
23216
23217 <tr>
23218 <td>
23219 </td>
23220 <td>foo
23221 </td></tr></table>
23222
23223 !!end
23224
23225 !!test
23226 Indented table with an empty td
23227 !! wikitext
23228 {|
23229 |-
23230 |
23231 |foo
23232 |}
23233 !! html
23234 <table>
23235
23236 <tr>
23237 <td>
23238 </td>
23239 <td>foo
23240 </td></tr></table>
23241
23242 !!end
23243
23244 ## We have some newline diffs RT-ing this edge case
23245 ## and it is not important enough -- we seem to be emitting
23246 ## at most 2 newlines after a </tr> and this is unrelated to
23247 ## the issue from T85627 that this is testing.
23248 !!test
23249 Indented table with blank lines in between (T85627)
23250 !! options
23251 parsoid=wt2html
23252 !! wikitext
23253 {|
23254 |foo
23255
23256
23257 |}
23258 !! html
23259 <table>
23260
23261 <tr>
23262 <td>foo
23263 </td></tr></table>
23264
23265 !!end
23266
23267 !!test
23268 Indented block & table
23269 !! wikitext
23270 <div>foo</div>
23271 {|
23272 |foo
23273 |}
23274 !! html/php
23275 <div>foo</div>
23276 <table>
23277 <tr>
23278 <td>foo
23279 </td></tr></table>
23280
23281 !! html/parsoid
23282 <div data-parsoid='{"stx":"html"}'>foo</div>
23283 <table><tbody>
23284 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23285 </tbody></table>
23286 !!end
23287
23288 !! test
23289 Indent and comment before table row
23290 !! wikitext
23291 {|
23292 <!--hi-->|-
23293 | there
23294 |}
23295 !! html/php
23296 <table>
23297
23298 <tr>
23299 <td> there
23300 </td></tr></table>
23301
23302 !! html/parsoid
23303 <table>
23304 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23305 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23306 </tbody></table>
23307 !! end
23308
23309 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23310 !!test
23311 Empty TR followed by a template-generated TR
23312 !!options
23313 parsoid
23314 !! wikitext
23315 {|
23316 |-
23317 {{echo|<tr><td>foo</td></tr>}}
23318 |}
23319 !! html
23320 <table>
23321 <tbody>
23322 <tr></tr>
23323 <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}}]}'>
23324 <td>foo</td></tr>
23325 </tbody></table>
23326 !!end
23327
23328 ## PHP and parsoid output differ for this, and since this is primarily
23329 ## for testing Parsoid's serializer, marking this Parsoid only
23330 !!test
23331 Empty TR followed by mixed-ws-comment line should RT correctly
23332 !!options
23333 parsoid
23334 !! wikitext
23335 {|
23336 |-
23337 <!--c-->
23338 |-
23339 <!--c--> <!--d-->
23340 |}
23341 !! html
23342 <table>
23343 <tbody>
23344 <tr></tr>
23345 <!--c-->
23346 <tr>
23347 <!--c--> </tr><!--d-->
23348 </tbody></table>
23349
23350 !!end
23351
23352 !!test
23353 Multi-line image caption generated by templates with/without trailing newlines
23354 !! wikitext
23355 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23356 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23357 !! html/parsoid
23358 <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>
23359 <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>
23360 !!end
23361
23362 !! test
23363 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23364 !! options
23365 parsoid=html2wt
23366 !! html/parsoid
23367 <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>
23368
23369 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23370 !! wikitext
23371 <includeonly>foo</includeonly>
23372 new para
23373
23374 [[Category:Foo]]
23375
23376 = new heading =
23377 !! end
23378
23379 ## PHP emits broken html for this, and since this is primarily
23380 ## a Parsoid serializer test, marking this Parsoid only
23381 !!test
23382 Improperly nested inline or quotes tags with whitespace in between
23383 !! wikitext
23384 <span> <s>x</span> </s>
23385 ''' ''x''' ''
23386 !! html/parsoid
23387 <p><span> <s>x</s></span><s> </s>
23388 <b> <i>x</i></b><i> </i>
23389 </p>
23390 !!end
23391
23392 !!test
23393 Encapsulate protected attributes from wt
23394 !! wikitext
23395 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23396 !! html/parsoid
23397 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
23398 </body>
23399 !!end
23400
23401 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23402 ## Having nested or stray pre tags results in the attempt to add duplicates,
23403 ## causing an assertion fail. This test tries to prevent that situation.
23404 !!test
23405 Ensure ParagraphWrapper can deal with stray closing pre tags
23406 !!options
23407 parsoid=wt2html
23408 !! wikitext
23409 plain text</pre>
23410 !! html/parsoid
23411 plain text
23412 !!end
23413
23414 !!test
23415 1. Ensure fostered text content is wrapped in element nodes
23416 !!options
23417 parsoid=wt2html
23418 !! wikitext
23419 <table>hi</table><table>ho</table>
23420 !! html/parsoid
23421 <p>hi</p>
23422 <table></table>
23423 <p>ho</p>
23424 <table></table>
23425 !!end
23426
23427 !!test
23428 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23429 !!options
23430 parsoid=wt2html,wt2wt
23431 !! wikitext
23432 <table>
23433 <tr> || ||
23434 <td> a
23435 </table>
23436 !! html/parsoid
23437 <p> || ||
23438 </p><table>
23439 <tbody><tr><td> a</td></tr>
23440 </tbody></table>
23441 !!end
23442
23443 !!test
23444 Encapsulation properly handles null DSR information from foster box
23445 !!options
23446 parsoid=wt2html,wt2wt
23447 !! wikitext
23448 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23449 !! html/parsoid
23450 <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>
23451 !!end
23452
23453 !!test
23454 1. Encapsulate foster-parented transclusion content
23455 !!options
23456 parsoid=wt2wt,wt2html
23457 !! wikitext
23458 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23459 !! html/parsoid
23460 <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>
23461 <tbody>
23462 <tr>
23463 <td>bar</td>
23464 </tr>
23465 </tbody>
23466 </table>
23467 !!end
23468
23469 !!test
23470 2. Encapsulate foster-parented transclusion content
23471 !!options
23472 parsoid=wt2wt,wt2html
23473 !! wikitext
23474 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23475 !! html/parsoid
23476 <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>
23477 <table>
23478 <tbody>
23479 <tr>
23480 <td>bar</td>
23481 </tr>
23482 </tbody>
23483 </table>
23484 !!end
23485
23486 !!test
23487 3. Encapsulate foster-parented transclusion content
23488 !!options
23489 parsoid=wt2wt,wt2html
23490 !! wikitext
23491 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23492 !! html/parsoid
23493 <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;]}">
23494 <p>foo</p>
23495 </div>
23496 <table>
23497 <tbody>
23498 <tr>
23499 <td>bar</td>
23500 </tr>
23501 </tbody>
23502 </table>
23503 !!end
23504
23505 !!test
23506 4. Encapsulate foster-parented transclusion content
23507 !!options
23508 parsoid=wt2wt,wt2html
23509 !! wikitext
23510 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23511 !! html/parsoid
23512 <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;]}">
23513 <p>foo</p>
23514 </div>
23515 <table>
23516 <tbody>
23517 <tr>
23518 <td>bar</td>
23519 </tr>
23520 </tbody>
23521 </table>
23522 !!end
23523
23524 !!test
23525 5. Encapsulate foster-parented transclusion content
23526 !!options
23527 parsoid=wt2wt,wt2html
23528 !! wikitext
23529 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23530 !! html/parsoid
23531 <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>
23532 <table>
23533 <tbody>
23534 <tr>
23535 <td>
23536 <div>
23537 <p>foo</p>
23538 </div>
23539 </td>
23540 </tr>
23541 </tbody>
23542 </table>
23543 !!end
23544
23545 !!test
23546 6. Encapsulate foster-parented transclusion content
23547 !!options
23548 parsoid=wt2wt,wt2html
23549 !! wikitext
23550 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23551 !! html/parsoid
23552 <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>
23553 <table>
23554 <tbody>
23555 <tr>
23556 <td>
23557 <div>
23558 <p>foo</p>
23559 </div>
23560 </td>
23561 </tr>
23562 </tbody>
23563 </table>
23564 <p>ok</p>
23565 !!end
23566
23567 !!test
23568 7. Encapsulate foster-parented transclusion content
23569 !!options
23570 parsoid=wt2wt,wt2html
23571 !! wikitext
23572 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23573 !! html/parsoid
23574 <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>
23575 <table>
23576 <tbody>
23577 <tr>
23578 <td>bar</td>
23579 </tr>
23580 </tbody>
23581 </table>
23582 !!end
23583
23584 # Note that the wt is broken on purpose: the = should be {{=}} if you
23585 # don't want it to be a template parameter key.
23586 !!test
23587 8. Encapsulate foster-parented transclusion content
23588 !!options
23589 parsoid=wt2wt,wt2html
23590 !! wikitext
23591 {{echo|a
23592 }}{|{{echo|style='color:red'}}
23593 |-
23594 |b
23595 |}
23596 !! html/parsoid
23597 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23598 <span> </span>
23599 <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>
23600 <table>
23601 <tbody>
23602 <tr>
23603 <td>b</td>
23604 </tr>
23605 </tbody>
23606 </table>
23607 !!end
23608
23609 !!test
23610 9. Encapsulate foster-parented transclusion content
23611 !!options
23612 parsoid=wt2wt,wt2html
23613 !! wikitext
23614 <table>{{echo|hi</table>hello}}
23615 !! html/parsoid
23616 <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","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
23617 !!end
23618
23619 !!test
23620 Table in fosterable position
23621 !!options
23622 parsoid=wt2html,wt2wt
23623 !! wikitext
23624 {{OpenTable}}
23625 <div>
23626 {|
23627 |}
23628 </div>
23629 |}
23630 !! html/parsoid
23631 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
23632 </span>
23633 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23634
23635 <table>
23636 </table>
23637 !!end
23638
23639 # Parsoid only for bug 64747
23640 !! test
23641 Properly encapsulate empty-content transclusions in fosterable positions
23642 !! wikitext
23643 <table>
23644 {{#if:|
23645 <td>foo</td>
23646 }}
23647 </table>
23648 !! html/parsoid
23649 <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","spc":["","","",""]}]]}'>
23650
23651 </table>
23652 !! end
23653
23654 !!test
23655 Support <object> element with .data attribute
23656 !!options
23657 parsoid=html2wt
23658 !! html/parsoid
23659 <object data="test.swf"></object>
23660 !! wikitext
23661 <object data="test.swf"></object>
23662 !!end
23663
23664 !! test
23665 Don't block XML namespace declaration
23666 !! wikitext
23667 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23668 !! html/php
23669 <p><span>MediaWiki</span>
23670 </p>
23671 !! html/parsoid
23672 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23673 !! end
23674
23675 # -----------------------------------------------------------------
23676 # The following section of tests are primarily to spec requirements
23677 # around serialization of new/edited content.
23678 #
23679 # All these tests are marked Parsoid html2wt and html2html only
23680 # ----------------------------------------------------------------
23681
23682 # 'mi' is a localinterwiki prefix as well as a language
23683 !! test
23684 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23685 !! options
23686 parsoid=html2wt
23687 !! html
23688 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23689 !! wikitext
23690 [[Foo]]
23691 !! end
23692
23693 # See T93839
23694 !! test
23695 New wikilinks should be serialized properly
23696 !! options
23697 parsoid=html2wt
23698 !! html
23699 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23700 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23701 !! wikitext
23702 [[Foo]]
23703 [[Foo]]
23704 !! end
23705
23706 !! test
23707 New wiki links (href variations)
23708 !! options
23709 parsoid=html2wt
23710 !! html
23711 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23712 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23713 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23714 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23715 !! wikitext
23716 [[Foo_bar]]
23717 [[Foo_bar]]
23718 [[Foo_bar]]
23719 [[Toxine bactérienne]]
23720 !! end
23721
23722 !! test
23723 New wiki links (content string variations)
23724 !! options
23725 parsoid=html2wt
23726 !! html
23727 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23728 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23729 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23730 !! wikitext
23731 [[Foo_bar]]
23732 [[Foo bar]]
23733 [[Foo_bar|./Foo_bar]]
23734 !! end
23735
23736 !! test
23737 New category links (href variations)
23738 !! options
23739 parsoid=html2wt
23740 !! html
23741 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23742 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23743 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23744 !! wikitext
23745 [[Category:Toxine bactérienne]]
23746 [[Category:Toxine bactérienne]]
23747 [[Category:Toxine bactérienne]]
23748 !! end
23749
23750 !! test
23751 New sol transparent links don't need indent-pre nowiki protection
23752 !! options
23753 parsoid=html2wt
23754 language=de
23755 !! html
23756 <link rel="mw:PageProp/redirect" href="./Main_Page">
23757 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23758 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23759 !! wikitext
23760 #WEITERLEITUNG [[Main Page]]
23761 <!-- this is good --> [[Category:Good]]
23762 <!-- this is great --> [[Kategorie:Great]]
23763 !! end
23764
23765 !! test
23766 New interlanguage links (href variations)
23767 !! options
23768 parsoid=html2wt
23769 !! html
23770 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23771 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23772 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23773 !! wikitext
23774 [[es:Toxine bactérienne]]
23775 [[es:Toxine_bactérienne]]
23776 [[es:Toxine_bactérienne]]
23777 !! end
23778
23779 !! test
23780 Image: Modifying size of an image (1)
23781 !! options
23782 parsoid={
23783 "modes": ["wt2wt"],
23784 "changes": [
23785 ["img[height]", "attr", "height", "22"],
23786 ["img[width]", "attr", "width", "200"]
23787 ]
23788 }
23789 !! wikitext
23790 [[Image:Foobar.jpg|230x230px]]
23791 !! wikitext/edited
23792 [[Image:Foobar.jpg|200x200px]]
23793 !!end
23794
23795 !! test
23796 Image: Modifying size of an image (2)
23797 !! options
23798 parsoid={
23799 "modes": ["wt2wt"],
23800 "changes": [
23801 ["img[height]", "attr", "height", "100"],
23802 ["img[width]", "attr", "width", "500"]
23803 ]
23804 }
23805 !! wikitext
23806 [[Image:Foobar.jpg|230x230px]]
23807 !! wikitext/edited
23808 [[Image:Foobar.jpg|500x500px]]
23809 !!end
23810
23811 # Change in size is ignored so long as class='mw-default-size'
23812 !! test
23813 Image: Modifying size of an image (3)
23814 !! options
23815 parsoid={
23816 "modes": ["wt2wt"],
23817 "changes": [
23818 ["figure[class]", "removeClass", "mw-default-size"],
23819 ["figure img", "attr", "height", "19"],
23820 ["figure img", "attr", "width", "170"]
23821 ]
23822 }
23823 !! wikitext
23824 [[Image:Foobar.jpg|thumb]]
23825 !! wikitext/edited
23826 [[Image:Foobar.jpg|thumb|170x170px]]
23827 !!end
23828
23829 !! test
23830 Image: Modifying alignment of an image (bug 48665)
23831 !! options
23832 parsoid={
23833 "modes": ["wt2wt"],
23834 "changes": [
23835 ["figure[class]", "removeClass", "mw-halign-right"],
23836 ["figure[class]", "addClass", "mw-halign-left"]
23837 ]
23838 }
23839 !! wikitext
23840 [[Image:Foobar.jpg|thumb|caption|right]]
23841 !! wikitext/edited
23842 [[Image:Foobar.jpg|thumb|caption|left]]
23843 !! end
23844
23845 !! test
23846 Image: Modifying mw-default-size of an frameless image (bug 62805)
23847 !! options
23848 parsoid={
23849 "modes": ["wt2wt"],
23850 "changes": [
23851 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23852 ]
23853 }
23854 !! wikitext
23855 [[Image:Foobar.jpg|frameless|right]]
23856 !! wikitext/edited
23857 [[Image:Foobar.jpg|frameless|right|220x220px]]
23858 !! end
23859
23860 !! test
23861 Image: Modifying valign of an image (bug 49221)
23862 !! options
23863 parsoid={
23864 "modes": ["wt2wt"],
23865 "changes": [
23866 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23867 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23868 ]
23869 }
23870 !! wikitext
23871 [[File:Foobar.jpg|20px|middle]]
23872 !! wikitext/edited
23873 [[File:Foobar.jpg|20px|text-top]]
23874 !! end
23875
23876 !! test
23877 Image: Modifying alt attribute of an image (bug 56400)
23878 !! options
23879 parsoid={
23880 "modes": ["wt2wt"],
23881 "changes": [
23882 ["img[alt]", "attr", "alt", "some alternate edited text"]
23883 ]
23884 }
23885 !! wikitext
23886 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23887 !! wikitext/edited
23888 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23889 !!end
23890
23891 !! test
23892 Image: Modifying caption of an image
23893 !! options
23894 parsoid={
23895 "modes": ["wt2wt"],
23896 "changes": [
23897 ["figcaption", "text", "new caption"]
23898 ]
23899 }
23900 !! wikitext
23901 [[Image:Foobar.jpg|thumb|original caption]]
23902 !! wikitext/edited
23903 [[Image:Foobar.jpg|thumb|new caption]]
23904 !!end
23905
23906 !! test
23907 Image: empty alt attribute (bug 48924)
23908 !! options
23909 parsoid
23910 !! wikitext
23911 [[File:Foobar.jpg|thumb|alt=|bar]]
23912 !! html
23913 <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>
23914 !! end
23915
23916 #!! test
23917 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23918 #!! options
23919 #parsoid=html2wt
23920 #language=ar
23921 #!! html
23922 #<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>
23923 #!! wikitext
23924 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23925 #!! end
23926
23927 !! test
23928 Image: Block level image should have \n before and after
23929 !! wikitext
23930 123
23931 [[File:Foobar.jpg|right|thumb|150x150px]]
23932 456
23933 !! html/parsoid
23934 <p>123</p>
23935 <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>
23936 <p>456</p>
23937 !!end
23938
23939 !! test
23940 Image: New block level image should have \n before and after (existing content)
23941 !! wikitext
23942 123
23943 [[File:Foobar.jpg|right|thumb|150x150px]]
23944 456
23945 !! html/parsoid
23946 <p>123</p>
23947 <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>
23948 <p>456</p>
23949 !!end
23950
23951 !! test
23952 Image: upright option (parsoid)
23953 !! wikitext
23954 [[File:Foobar.jpg|thumb|upright|caption]]
23955 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23956 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23957 !! html/parsoid
23958 <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>
23959 <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>
23960 <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>
23961 !!end
23962
23963 !! test
23964 Image: upright option is ignored on inline and frame images (parsoid)
23965 !! wikitext
23966 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23967 !! html/parsoid
23968 <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>
23969 !!end
23970
23971 !! test
23972 Image: from basic HTML (1)
23973 !! options
23974 parsoid=html2wt
23975 !! html/parsoid
23976 <span typeof="mw:Image">
23977 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23978 </span>
23979 !! wikitext
23980 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23981 !! end
23982
23983 !! test
23984 Image: from basic HTML (2)
23985 !! options
23986 parsoid=html2wt
23987 !! html/parsoid
23988 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23989 !! wikitext
23990 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23991 !! end
23992
23993 !! test
23994 Image: from basic HTML (3)
23995 !! options
23996 parsoid=html2wt
23997 !! html/parsoid
23998 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
23999 !! wikitext
24000 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24001 !! end
24002
24003 !! test
24004 Image: from basic HTML (4)
24005 !! options
24006 parsoid=html2wt
24007 !! html/parsoid
24008 <img src="./File:Foobar.jpg">
24009 !! wikitext
24010 [[File:Foobar.jpg|link=]]
24011 !! end
24012
24013 !! test
24014 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24015 !! options
24016 parsoid=html2wt
24017 !! html
24018 <ul>
24019 <li><p>foo</p></li>
24020 </ul>
24021 !! wikitext
24022 * foo
24023 !! end
24024
24025 !! test
24026 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24027 !! options
24028 parsoid=html2wt
24029 !! html
24030 <ul> <li>foo</li></ul>
24031 !! wikitext
24032 * foo
24033 !! end
24034
24035 !! test
24036 Don't strip leading whitespace when handling indent-pre suppressing tags
24037 !! options
24038 parsoid=html2wt
24039 !! html
24040 <table>
24041 <tr><td> indented row</td></tr>
24042 </table>
24043 <blockquote><p>
24044 <b>This is very bold of you!</b>
24045 </p>
24046 <table><tr><td>
24047 indented cell (no pre-wrapping!)
24048 </td></tr></table>
24049 </blockquote>
24050 <p>foo</p>
24051 <div>bar</div>
24052 !! wikitext
24053 {|
24054 | indented row
24055 |}
24056 <blockquote>
24057 '''This is very bold of you!'''
24058
24059 {|
24060 |
24061 indented cell (no pre-wrapping!)
24062 |}
24063 </blockquote>
24064 foo
24065 <div>bar</div>
24066 !! end
24067
24068 !! test
24069 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24070 !! options
24071 parsoid=html2wt
24072 !! wikitext
24073 foo
24074 <nowiki> </nowiki><span>bar</span>
24075
24076 <span>foo2
24077 <nowiki> </nowiki></span>bar2
24078
24079 <div>foo</div>
24080 <nowiki> </nowiki><span>bar</span>
24081
24082 <div>
24083 <nowiki> </nowiki><span>foo</span>
24084 </div>
24085 !! html
24086 <p>foo</p>
24087 <span>bar</span>
24088
24089 <span>foo2
24090 </span>bar2
24091
24092 <div>foo</div>
24093 <span>bar</span>
24094
24095 <div>
24096 <span>foo</span>
24097 </div>
24098 !! end
24099
24100 !! test
24101 Lists: Dont insert newlines in a serialized list item.
24102 !! options
24103 parsoid=html2wt
24104 !! html
24105 <ul><li>a<br>b</li><li>c</li></ul>
24106 !! wikitext
24107 * a<br>b
24108 * c
24109 !! end
24110
24111 !! test
24112 Headings: Force sol-transparent links and behavior switches to serialize before/after
24113 !! options
24114 parsoid=html2wt
24115 !! html
24116 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24117 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24118
24119 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24120 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24121
24122 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24123
24124 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24125 !! wikitext
24126 == hello there ==
24127 [[Category:A1]]
24128 [[Category:A2]]
24129
24130 == hi pal ==
24131
24132 <!--foo--> [[Category:A3]]
24133
24134 == how goes it ==
24135
24136 == it goes well ==
24137 [[Category:A4]] <!--bar-->
24138
24139 ==howdy [[Category:A5]] ==
24140
24141 __TOC__
24142
24143 == ok ==
24144 !! end
24145
24146 !! test
24147 Headings: Don't hoist metas that come from templates
24148 !! options
24149 parsoid=html2wt
24150 !! html
24151 <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>
24152 !! wikitext
24153 == {{echo|foo [[Category:Foo]]}} ==
24154 !! end
24155
24156 !! test
24157 Headings: Category in ref isn't hoisted
24158 !! options
24159 parsoid=html2wt
24160 !! html
24161 <h2> foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> </h2>
24162
24163 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
24164 !! wikitext
24165 == foo <ref>bar
24166 [[Category:Baz]] </ref> ==
24167
24168 <references />
24169 !! end
24170
24171 !! test
24172 Parsoid: Serialize positional parameters with = in them as named parameter
24173 !! options
24174 parsoid=html2wt
24175 !! html
24176 <p about="#mwt1" typeof="mw:Transclusion"
24177 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24178
24179 <p about="#mwt1" typeof="mw:Transclusion"
24180 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24181
24182 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24183 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24184 <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' 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>
24185 !! wikitext
24186 {{echo|1 = f=oo}}
24187
24188 {{echo|1 = f=oo|2 = bar}}
24189
24190 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24191 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24192 {{echo|<nowiki>f=oo</nowiki>|bar}}
24193 !! end
24194
24195 !! test
24196 Parsoid: Serialize positional parameters with = in extlink as named parameter
24197 !! options
24198 parsoid=html2wt
24199 !! html
24200 <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>
24201 !! wikitext
24202 {{echo|1 = http://stuff?is=ok}}
24203 !! end
24204
24205 !! test
24206 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24207 !! options
24208 parsoid=html2wt
24209 !! html
24210 <div>a<p>b</p></div>
24211 <div>a
24212 <p>b</p></div>
24213 <div>
24214 a
24215 <p>b</p></div>
24216 !! wikitext
24217 <div>a
24218 b
24219 </div>
24220 <div>a
24221 b
24222 </div>
24223 <div>
24224 a
24225
24226 b
24227 </div>
24228 !! end
24229
24230 !! test
24231 Substrings resembling wikitext in hrefs should not get nowiki escapes
24232 !! options
24233 parsoid=html2wt
24234 !! html
24235 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24236 !! wikitext
24237 [[Foo''bar''baz]]
24238 !! end
24239
24240 !! test
24241 Enforce single-line context in the serializer
24242 !! options
24243 parsoid=html2wt
24244 !! html
24245 <h2>testing
24246 123</h2>
24247
24248 <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">
24249 </span><span about="#mwt1">you</span> </h2>
24250
24251 <h2> foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> </h2>
24252
24253 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
24254 there</span></li></ol>
24255
24256 <ul><li>asd
24257 sdf</li></ul>
24258
24259 <ul><li>foo
24260 bar
24261 baz</li>
24262 <li>foo <b>bar</b>
24263 baz</li></ul>
24264 !! wikitext
24265 == testing 123 ==
24266
24267 == hi {{bogus|there
24268 you}} ==
24269
24270 == foo <ref>hello
24271 there</ref> ==
24272
24273 <references />
24274
24275 * asd sdf
24276
24277 * foo bar baz
24278 * foo '''bar''' baz
24279 !! end
24280
24281 !! test
24282 Serialize new placeholder space without spans
24283 !! options
24284 parsoid=html2wt
24285 !! html
24286 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24287
24288 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24289
24290 <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>
24291 !! wikitext
24292 foo : bar
24293
24294 foo : bar
24295
24296 <ref>foo : bar</ref>ok
24297 !! end
24298
24299
24300 #-----------------------
24301 # Tag minimization tests
24302 #-----------------------
24303
24304 !! test
24305 1. I/B quote minimization: wikitext-only tags should be combined
24306 !! options
24307 parsoid=html2wt
24308 !! html
24309 <p><i>A</i><i>B</i></p>
24310 <p><b>A</b><b>B</b></p>
24311 <p><i>A</i><b><i>B</i></b></p>
24312 <p><b>A</b><i><b>B</b></i></p>
24313 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24314 <p><i><b>A</b></i><i><b>B</b></i></p>
24315 <p><i><b>A</b></i><b><i>B</i></b></p>
24316 <p><b><i>A</i></b><i><b>B</b></i></p>
24317 !! wikitext
24318 ''AB''
24319
24320 '''AB'''
24321
24322 ''A'''B'''''
24323
24324 '''A''B'''''
24325
24326 '''A''BC''D'''
24327
24328 '''''AB'''''
24329
24330 '''''AB'''''
24331
24332 '''''AB'''''
24333 !! end
24334
24335 !! test
24336 2. I/B quote minimization: wikitext and html tags should not be combined
24337 !! options
24338 parsoid=html2wt
24339 !! html
24340 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24341 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24342 !! wikitext
24343 ''A''<i>B</i>
24344
24345 ''A''<nowiki/>'''<i>B</i>'''
24346 !! end
24347
24348 !! test
24349 3. I/B quote minimization: templated content stops minimization
24350 !! options
24351 parsoid=html2wt
24352 !! html
24353 <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>
24354 <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>
24355 !! wikitext
24356 ''A''{{echo|''B''}}
24357
24358 ''A''{{echo|'''''B'''''}}
24359 !! end
24360
24361 !! test
24362 4. I/B quote minimization: new content should be mimimized with adjacent old content
24363 !! options
24364 parsoid=html2wt
24365 !! html
24366 <p><i>A</i><i>B</i></p>
24367 <p><b>A</b><b>B</b></p>
24368 <p><i>A</i><b><i>B</i></b></p>
24369 !! wikitext
24370 ''AB''
24371
24372 '''AB'''
24373
24374 ''A'''B'''''
24375 !! end
24376
24377 !! test
24378 5a. Merge adjacent quote nodes if they've been edited
24379 !! options
24380 parsoid={
24381 "modes": ["wt2wt", "selser"],
24382 "changes": [
24383 ["p", "contents", "remove", ":contains('b')"]
24384 ]
24385 }
24386 !! wikitext
24387 ''a''b''c''
24388 !! wikitext/edited
24389 ''ac''
24390 !! end
24391
24392 !! test
24393 5b. Merge adjacent quote nodes if they've been edited
24394 !! options
24395 parsoid={
24396 "modes": ["wt2wt", "selser"],
24397 "changes": [
24398 ["#x", "remove"]
24399 ]
24400 }
24401 !! wikitext
24402 ''a''<span id="x">b</span>''c''
24403 !! wikitext/edited
24404 ''ac''
24405 !! end
24406
24407 !! test
24408 1. Merge adjacent link nodes as long as at least one element is new
24409 !! options
24410 parsoid={
24411 "modes": ["html2wt"],
24412 "scrubWikitext": true
24413 }
24414 !! html
24415 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24416 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24417 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24418 !! wikitext
24419 [[Football]]
24420 [[Football]]
24421 [[Football|Foot]][[Football|ball]]
24422 !! end
24423
24424 !! test
24425 2. Merge adjacent link nodes and enable additional normalizations
24426 !! options
24427 parsoid={
24428 "modes": ["html2wt"],
24429 "scrubWikitext": true
24430 }
24431 !! html
24432 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24433 !! wikitext
24434 [[Football|''Football'']]
24435 !! end
24436
24437 !! test
24438 3. Don't merge adjacent link nodes if scrubWikitext is false
24439 !! options
24440 parsoid={
24441 "modes": ["html2wt"],
24442 "scrubWikitext": false
24443 }
24444 !! html
24445 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24446 !! wikitext
24447 [[Football|Foot]][[Football|ball]]
24448 !! end
24449
24450 #------------------------------
24451 # End of tag minimization tests
24452 #------------------------------
24453
24454 !!test
24455 Bug 54262: New entities
24456 !! options
24457 parsoid=html2wt
24458 !! wikitext
24459 &nbsp;
24460 !! html
24461 <span typeof="mw:Entity">&nbsp;</span>
24462 !! end
24463
24464 ## Note that there is no wikitext output for 'unknownproperty' ##
24465 ## Unknown magic words are silently dropped ##
24466
24467 !! test
24468 Magic words
24469 !! options
24470 parsoid=html2wt
24471 !! html/parsoid
24472 <meta property='mw:PageProp/toc' />
24473 <meta property='mw:PageProp/notoc' />
24474 <meta property='mw:PageProp/forcetoc' />
24475 <meta property='mw:PageProp/index' />
24476 <meta property='mw:PageProp/noindex' />
24477 <meta property='mw:PageProp/nogallery' />
24478 <meta property='mw:PageProp/noeditsection' />
24479 <meta property='mw:PageProp/notitleconvert' />
24480 <meta property='mw:PageProp/nocontentconvert' />
24481 <meta property='mw:PageProp/unknownproperty' />
24482 !! wikitext
24483 __TOC__
24484 __NOTOC__
24485 __FORCETOC__
24486 __INDEX__
24487 __NOINDEX__
24488 __NOGALLERY__
24489 __NOEDITSECTION__
24490 __NOTITLECONVERT__
24491 __NOCONTENTCONVERT__
24492 !! end
24493
24494 !! test
24495 Consecutive <pre>s should not get merged
24496 !! options
24497 parsoid=html2wt,html2html
24498 !! html
24499 <pre>a</pre><pre>b</pre>
24500
24501 <pre>c
24502 </pre><pre>
24503 d</pre>
24504
24505 <pre>e
24506
24507 </pre><pre>
24508
24509 f</pre>
24510 !! wikitext
24511 a
24512
24513 b
24514
24515 c
24516
24517 d
24518
24519 e
24520
24521
24522
24523 f
24524 !! end
24525
24526 !! test
24527 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24528 !! options
24529 parsoid=html2wt
24530 !! html
24531 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24532 !! wikitext
24533 [[Special:BookSources/1234567890|ISBN 1234567895]]
24534 !! end
24535
24536 !! test
24537 Edited RFC links not serializable as RFC links should serialize as extlinks
24538 !! options
24539 parsoid=html2wt
24540 !! html
24541 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24542 !! wikitext
24543 [//tools.ietf.org/html/rfc123 New RFC]
24544 !! end
24545
24546 !! test
24547 Edited PMID links not serializable as PMID links should serialize as extlinks
24548 !! options
24549 parsoid=html2wt
24550 !! html
24551 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24552 !! wikitext
24553 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24554 !! end
24555
24556 !! test
24557 WTS of autolinks with trailing/surrounding context
24558 !! options
24559 parsoid=html2wt
24560 !! html/parsoid
24561 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24562 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24563 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24564 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24565 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24566 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24567 !! wikitext
24568 http://cscott.net<nowiki/>'''foo'''
24569
24570 http://cscott.net<b>foo</b>
24571
24572 '''http://cscott.net<nowiki/>'''
24573
24574 '''http://cscott.net '''
24575
24576 '''http://cscott.net<nowiki/>x'''
24577
24578 http://cscott.net<nowiki/>x
24579 !! end
24580
24581 !! test
24582 WTS of autolinks with nowikis (round-trip)
24583 !! wikitext
24584 x<nowiki/>http://cscott.net<nowiki/>x
24585 !! html/parsoid
24586 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24587 !! end
24588
24589 # this is the "easy" test because it leaves in place all the
24590 # data-parsoid information indicating this is an autolink
24591 !! test
24592 WTS of autolinks with escapes (editing)
24593 !! options
24594 parsoid={
24595 "modes": ["wt2wt"],
24596 "changes": [
24597 [ "meta", "remove" ]
24598 ]
24599 }
24600 !! wikitext
24601 x<nowiki/>http://cscott.net<nowiki/>x
24602 !! wikitext/edited
24603 x<nowiki/>http://cscott.net<nowiki/>x
24604 !! end
24605
24606 !! test
24607 Edited Redirect link should emit a non-piped wikitext link
24608 !! options
24609 parsoid=html2wt
24610 !! html
24611 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
24612 !! wikitext
24613 #REDIRECT [[Bar]]
24614 !! end
24615
24616 !! test
24617 T75121: Infer extension name from typeOf if data-mw is not present
24618 !! options
24619 parsoid=html2wt
24620 !! html
24621 <div typeOf="mw:Extension/foo"></div>
24622 !! wikitext
24623 <foo />
24624 !! end
24625
24626 # Note that the <p> wrapping isn't present in PHP parser output
24627 # The important thing for this test is that P-wrapping doesn't
24628 # interfere with the <nowiki> protection for leading - in <td>
24629 # (which isn't necessary for <th>).
24630 !! test
24631 T88318: p-wrapped dash in table.
24632 !! options
24633 parsoid=html2wt,wt2wt
24634 !! html/parsoid
24635 <table><tbody>
24636 <tr><th><p>-</p></th><th><p>- </p></th></tr>
24637 <tr><td><p>-</p></td><td><p>- </p></td></tr>
24638 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
24639 </tbody></table>
24640 !! wikitext
24641 {|
24642 !-
24643 !-
24644 |-
24645 |<nowiki>-</nowiki>
24646 |<nowiki>- </nowiki>
24647 |-
24648 |<small>-</small>
24649 |<br>
24650 -
24651 |<br>
24652 -
24653 |}
24654 !! html/php+tidy
24655 <table>
24656 <tr>
24657 <th>-</th>
24658 <th>-</th>
24659 </tr>
24660 <tr>
24661 <td>-</td>
24662 <td>-</td>
24663 </tr>
24664 <tr>
24665 <td><small>-</small></td>
24666 <td><br />
24667 <p>-</p>
24668 </td>
24669 <td><br />
24670 <p>-</p>
24671 </td>
24672 </tr>
24673 </table>
24674 !! end
24675
24676 !! test
24677 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
24678 !! options
24679 parsoid=html2wt
24680 !! html
24681 <table id='mwAb'>
24682 <td id='mwAc'>foo</td>
24683 <td id='serialize-this'>bar</td>
24684 </table>
24685 !! wikitext
24686 {|
24687 |foo
24688 | id="serialize-this" |bar
24689 |}
24690 !! end
24691
24692 !! test
24693 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24694 !! options
24695 parsoid=html2wt
24696 !! html
24697 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24698 !! wikitext
24699 <div id="hello">ok</div>
24700 !! end
24701
24702 !! test
24703 WTS change modes
24704 !! options
24705 parsoid={
24706 "modes": ["wt2wt"],
24707 "changes": [
24708 [ "#xyz", "before", "<b>before</b> stuff " ],
24709 [ "#xyz", "after", " stuff <i>after</i>" ],
24710 [ "#xyz", "html", "x <b>y</b> z" ]
24711 ]
24712 }
24713 !! wikitext
24714 <span id="xyz">hello</span>
24715 !! wikitext/edited
24716 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24717 !! end
24718
24719 !! test
24720 Never serialize a-tag as html, regardless of what data-parsoid has to say
24721 !! options
24722 parsoid=html2wt
24723 !! html
24724 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24725 !! wikitext
24726 [[Foo]]
24727 !! end
24728
24729 ## SSS FIXME: This is broken output nevertheless.
24730 ## What might be a reasonable non-broken output for this?
24731 ## This is an edge case unlikely to be seen in production
24732 ## that I am not wasting more time on this right now.
24733 !! test
24734 Never serialize a-tag as html, no matter what attributes it has
24735 !! options
24736 parsoid=html2wt
24737 !! html
24738 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
24739 !! wikitext
24740 [http://boo.org http://boohoo.org]
24741 !! end
24742
24743 # --------------------------------------------
24744 # Tests spec'ing wikitext serialization norms |
24745 # --------------------------------------------
24746
24747 !! test
24748 Lists: Add space after bullets
24749 !! options
24750 parsoid=html2wt
24751 !! html
24752 <ul>
24753 <li>foo</li>
24754 <li> bar</li>
24755 <li><span> baz</span></li>
24756 </ul>
24757 !! wikitext
24758 * foo
24759 * bar
24760 * <span> baz</span>
24761 !! end
24762
24763 !! test
24764 Headings: Add space before/after == (T53744)
24765 !! options
24766 parsoid=html2wt
24767 !! html
24768 <h2>foo</h2>
24769 <h2> bar</h2>
24770 <h2>baz </h2>
24771 <h2><span> baz</span></h2>
24772
24773 <!-- Even after hoisted content -->
24774 <h2> <link href="Category:A2" rel="mw:PageProp/Category" />ok</h2>
24775 !! wikitext
24776 == foo ==
24777
24778 == bar ==
24779
24780 == baz ==
24781
24782 == <span> baz</span> ==
24783
24784 <!-- Even after hoisted content -->
24785 [[Category:A2]]
24786
24787 == ok ==
24788 !! end
24789
24790 !! test
24791 1. Headings: suppress newly created empty headings
24792 !! options
24793 parsoid={
24794 "modes": ["html2wt"],
24795 "scrubWikitext": true
24796 }
24797 !! html
24798 <h2></h2>
24799 !! wikitext
24800 !! end
24801
24802 !! test
24803 2. Headings: don't suppress empty headings if scrubWikitext is false
24804 !! options
24805 parsoid=html2wt
24806 !! html
24807 <h2></h2>
24808 !! wikitext
24809 ==<nowiki/>==
24810 !! end
24811
24812 !! test
24813 3. Headings: don't suppress empty headings for existing headings even if scrubWikitext is true
24814 !! options
24815 parsoid={
24816 "modes": ["html2wt"],
24817 "scrubWikitext": true
24818 }
24819 !! html
24820 <h2 data-parsoid='{}'></h2>
24821 !! wikitext
24822 ==<nowiki/>==
24823 !! end
24824
24825 !! test
24826 1. WT Quote Tags: suppress newly created empty style tags
24827 !! options
24828 parsoid={
24829 "modes": ["html2wt"],
24830 "scrubWikitext": true
24831 }
24832 !! html
24833 <i></i><b></b>
24834 !! wikitext
24835 !! end
24836
24837 !! test
24838 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
24839 !! options
24840 parsoid=html2wt
24841 !! html
24842 <i></i><b></b>
24843 !! wikitext
24844 ''<nowiki/>'''''<nowiki/>'''
24845 !! end
24846
24847 !! test
24848 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
24849 !! options
24850 parsoid={
24851 "modes": ["html2wt"],
24852 "scrubWikitext": true
24853 }
24854 !! html
24855 <p> hi</p>
24856 !! wikitext
24857 hi
24858 !! end
24859
24860 !! test
24861 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
24862 !! options
24863 parsoid=html2wt
24864 !! html
24865 <p> hi</p>
24866 !! wikitext
24867 <nowiki> </nowiki>hi
24868 !! end
24869
24870 # ---------------------------------------------------
24871 # End of tests spec'ing wikitext serialization norms |
24872 # ---------------------------------------------------
24873
24874 # -----------------------------------------------------------------
24875 # End of section for Parsoid-only html2wt tests for serialization
24876 # of new content
24877 # -----------------------------------------------------------------
24878
24879 # -----------------------------------------------------------------
24880 # The following section of tests are primarily to spec behavior of
24881 # the selective serializer. All these tests have manual selser
24882 # changes. The automated selser changes for all tests handle the
24883 # wide variation of changes, but these tests here capture specs
24884 # deterministically.
24885 # ----------------------------------------------------------------
24886
24887 ## T90517
24888 !! test
24889 Selser: New comments should not be lost
24890 !! options
24891 parsoid={
24892 "modes": ["selser"],
24893 "changes": [
24894 [ "#a", "after", "<!--c1-->" ],
24895 [ "#b", "before", "<!--c2-->" ]
24896 ]
24897 }
24898 !! wikitext
24899 <span id="a">a</span>
24900
24901 <span id="b">b</span>
24902 !! wikitext/edited
24903 <span id="a">a</span><!--c1-->
24904
24905 <!--c2--><span id="b">b</span>
24906 !! end
24907
24908 ## T89383
24909 !! test
24910 Selser: Check for validity of DSR before using it
24911 !! options
24912 parsoid={
24913 "modes": ["selser"],
24914 "changes": [
24915 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
24916 ]
24917 }
24918 !! wikitext
24919 <span id="a">a</span>
24920 !! wikitext/edited
24921 {{DISPLAYTITLE:foo}}
24922 <span id="a">a</span>
24923 !! end
24924
24925 !! test
24926 1. DOMDiff: Changes to <ref> content should be looked up using id
24927 !! options
24928 parsoid={
24929 "modes": ["selser"],
24930 "changes": [
24931 ["#X", "after", "bar"],
24932 ["#Y", "after", "baz"]
24933 ]
24934 }
24935 !! wikitext
24936 X <ref><span id="X">foo</span></ref>
24937 Y <ref name="a" />
24938 <references>
24939 <ref name="a"><span id="Y">foo</span></ref>
24940 </references>
24941 !! wikitext/edited
24942 X <ref><span id="X">foo</span>bar</ref>
24943 Y <ref name="a" />
24944 <references>
24945 <ref name="a"><span id="Y">foo</span>baz</ref>
24946 </references>
24947 !! end
24948
24949 !! test
24950 2. DOMDiff: Changes to <ref> content should be looked up using id
24951 !! options
24952 parsoid={
24953 "modes": ["selser"],
24954 "changes": [
24955 ["#Z", "after", "bar"]
24956 ]
24957 }
24958 !! wikitext
24959 A <ref>foo bar for a</ref>
24960 B <ref group="X" name="b" />
24961
24962 <references />
24963
24964 <references group="X">
24965 <ref name="b"><span id="Z">foo</span></ref>
24966 </references>
24967 !! wikitext/edited
24968 A <ref>foo bar for a</ref>
24969 B <ref group="X" name="b" />
24970
24971 <references />
24972
24973 <references group="X">
24974 <ref name="b"><span id="Z">foo</span>bar</ref>
24975 </references>
24976 !! end