Escape return of {{int:}} if message not exists
[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 !! test
10240 int keyword - non-existing message
10241 !! wikitext
10242 {{int:var}}
10243 !! html
10244 <p>&lt;var&gt;
10245 </p>
10246 !! end
10247
10248 !! article
10249 Template:Includes
10250 !! text
10251 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10252 !! endarticle
10253
10254 !! test
10255 <includeonly> and <noinclude> being included
10256 !! wikitext
10257 {{Includes}}
10258 !! html
10259 <p>Foobar
10260 </p>
10261 !! end
10262
10263 !! article
10264 Template:Includes2
10265 !! text
10266 <onlyinclude>Foo</onlyinclude>bar
10267 !! endarticle
10268
10269 !! test
10270 <onlyinclude> being included
10271 !! wikitext
10272 {{Includes2}}
10273 !! html
10274 <p>Foo
10275 </p>
10276 !! end
10277
10278
10279 !! article
10280 Template:Includes3
10281 !! text
10282 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10283 !! endarticle
10284
10285 !! test
10286 <onlyinclude> and <includeonly> being included
10287 !! wikitext
10288 {{Includes3}}
10289 !! html
10290 <p>Foo
10291 </p>
10292 !! end
10293
10294 !! test
10295 <includeonly> and <noinclude> on a page
10296 !! wikitext
10297 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10298 !! html
10299 <p>Foozar
10300 </p>
10301 !! end
10302
10303 !! test
10304 Un-closed <noinclude>
10305 !! wikitext
10306 <noinclude>
10307 !! html
10308 !! end
10309
10310 !! test
10311 <onlyinclude> on a page
10312 !! wikitext
10313 <onlyinclude>Foo</onlyinclude>bar
10314 !! html
10315 <p>Foobar
10316 </p>
10317 !! end
10318
10319 !! test
10320 Un-closed <onlyinclude>
10321 !! wikitext
10322 <onlyinclude>
10323 !! html
10324 !! end
10325
10326 !!test
10327 Self-closed noinclude, includeonly, onlyinclude tags
10328 !! wikitext
10329 <noinclude />
10330 <includeonly />
10331 <onlyinclude />
10332 !! html
10333 <p><br />
10334 </p>
10335 !!end
10336
10337 !!test
10338 Unbalanced includeonly and noinclude tags
10339 !! wikitext
10340 {|
10341 |a</noinclude>
10342 |b</noinclude></noinclude>
10343 |c</noinclude></includeonly>
10344 |d</includeonly></includeonly>
10345 |}
10346 !! html
10347 <table>
10348 <tr>
10349 <td>a
10350 </td>
10351 <td>b
10352 </td>
10353 <td>c&lt;/includeonly&gt;
10354 </td>
10355 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10356 </td></tr></table>
10357
10358 !!end
10359
10360 !! article
10361 Template:Includeonly section
10362 !! text
10363 <includeonly>
10364 ==Includeonly section==
10365 </includeonly>
10366 ==Section T-1==
10367 !!endarticle
10368
10369 !! test
10370 Bug 6563: Edit link generation for section shown by <includeonly>
10371 !! wikitext
10372 {{includeonly section}}
10373 !! html
10374 <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>
10375 <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>
10376
10377 !! end
10378
10379 # Uses same input as the contents of [[Template:Includeonly section]]
10380 !! test
10381 Bug 6563: Section extraction for section shown by <includeonly>
10382 !! options
10383 section=T-2
10384 !! wikitext
10385 <includeonly>
10386 ==Includeonly section==
10387 </includeonly>
10388 ==Section T-2==
10389 !! html
10390 ==Section T-2==
10391 !! end
10392
10393 !! test
10394 Bug 6563: Edit link generation for section suppressed by <includeonly>
10395 !! wikitext
10396 <includeonly>
10397 ==Includeonly section==
10398 </includeonly>
10399 ==Section 1==
10400 !! html
10401 <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>
10402
10403 !! end
10404
10405 !! test
10406 Bug 6563: Section extraction for section suppressed by <includeonly>
10407 !! options
10408 section=1
10409 !! wikitext
10410 <includeonly>
10411 ==Includeonly section==
10412 </includeonly>
10413 ==Section 1==
10414 !! html
10415 ==Section 1==
10416 !! end
10417
10418 !! test
10419 Un-closed <includeonly>
10420 !! wikitext
10421 <includeonly>
10422 !! html
10423 !! end
10424
10425 !! test
10426 Includes and comments at SOL
10427 !! wikitext
10428 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10429
10430 <noinclude>
10431 some
10432 </noinclude>* stuff
10433 * here
10434
10435 <includeonly>can have stuff</includeonly>=== here ===
10436
10437 !! html/php
10438 <h2><span class="mw-headline" id="hu">hu</span></h2>
10439 <p>some
10440 </p>
10441 <ul><li> stuff</li>
10442 <li> here</li></ul>
10443 <h3><span class="mw-headline" id="here">here</span></h3>
10444
10445 !! html/parsoid
10446 <!-- 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>
10447
10448 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10449 <p>some</p>
10450 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10451 <li> here</li></ul>
10452
10453 <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>
10454
10455 !! end
10456
10457 # TODO: test with DOM fragment reuse!
10458 !! test
10459 Parsoid: DOM fragment reuse
10460 !! options
10461 parsoid=wt2wt,wt2html
10462 !! wikitext
10463 a{{echo|b<table></table>c}}d
10464
10465 a{{echo|b
10466 <table></table>
10467 c}}d
10468
10469 {{echo|a
10470
10471 <table></table>
10472
10473 b}}
10474 !! html
10475 <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>
10476
10477 <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">
10478 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10479 </span><p about="#mwt2">cd</p>
10480
10481 <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">
10482
10483 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10484
10485 </span><p about="#mwt3">b</p>
10486 !! end
10487
10488 !! test
10489 Parsoid: Merge double tds (bug 50603)
10490 !! options
10491 parsoid
10492 !! wikitext
10493 {|
10494 |{{echo|{{!}} foo}}
10495 |}
10496 !! html
10497 <table><tbody>
10498 <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>
10499 </tbody></table>
10500 !! end
10501
10502 !! test
10503 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10504 !! options
10505 parsoid
10506 !! wikitext
10507 {{echo|<div>}}
10508 {|
10509 |{{echo|{{!}} foo}}
10510 |}
10511 {{echo|</div>}}
10512 !! html
10513 <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}}]}'>
10514 <table><tbody>
10515 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10516 </tbody></table>
10517 </div>
10518 !! end
10519
10520 ###
10521 ### <includeonly> and <noinclude> in attributes
10522 ###
10523 !!test
10524 0. includeonly around the entire attribute
10525 !! wikitext
10526 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10527 !! html
10528 <p><span id="v2">bar</span>
10529 </p>
10530 !!end
10531
10532 !!test
10533 1. includeonly in html attr key
10534 !! wikitext
10535 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10536 !! html
10537 <p><span id="foo">bar</span>
10538 </p>
10539 !!end
10540
10541 !!test
10542 2. includeonly in html attr value
10543 !! wikitext
10544 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10545 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10546 !! html
10547 <p><span id="v1">bar</span>
10548 <span id="v1">bar</span>
10549 </p>
10550 !!end
10551
10552 !!test
10553 3. includeonly in part of an attr value
10554 !! wikitext
10555 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10556 !! html
10557 <p><span style="color:red;">bar</span>
10558 </p>
10559 !!end
10560
10561 !!test
10562 4. includeonly in table attributes
10563 !! wikitext
10564 {|
10565 |- <noinclude>
10566 |-
10567 |a
10568 </noinclude>
10569 |- <includeonly>
10570 |-
10571 |b
10572 </includeonly>
10573 |}
10574 !! html
10575 <table>
10576
10577
10578 <tr>
10579 <td>a
10580 </td></tr>
10581 </table>
10582
10583 !!end
10584
10585 ###
10586 ### Token Stream Patcher tests
10587 ###
10588 ### These tests won't always pass wt2wt and other modes because
10589 ### on serialization, the table will be output on a new line.
10590 ### For now, we are blacklisting them, and using this to test selser.
10591 ###
10592
10593 !!test
10594 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10595 !!options
10596 parsoid=wt2html,wt2wt
10597 !!wikitext
10598 {{echo|}}{| width = '100%'
10599 |foo
10600 |}
10601 !!html/parsoid
10602 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10603 <tbody><tr><td>foo</td></tr>
10604 </tbody></table>
10605 !!end
10606
10607 !!test
10608 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10609 !!options
10610 parsoid=wt2html,wt2wt
10611 !!wikitext
10612 <includeonly>a</includeonly>{| {{{b}}}
10613 |c
10614 |}
10615 !!html/parsoid
10616 <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}}}":""}}'>
10617 <tbody><tr><td>c</td></tr>
10618 </tbody></table>
10619
10620 !!end
10621
10622 ###
10623 ### Testing parsing of templates where a template arg
10624 ### has the same name as the template itself.
10625 ###
10626
10627 !! article
10628 Template:quote
10629 !! text
10630 {{{quote|{{{1}}}}}}
10631 !! endarticle
10632
10633 !!test
10634 Templates: Template Name/Arg clash: 1. Use of positional param
10635 !! wikitext
10636 {{quote|foo}}
10637 !! html
10638 <p>foo
10639 </p>
10640 !!end
10641
10642 !!test
10643 Templates: Template Name/Arg clash: 2. Use of named param
10644 !! wikitext
10645 {{quote|quote=foo}}
10646 !! html
10647 <p>foo
10648 </p>
10649 !!end
10650
10651 !!test
10652 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10653 !! wikitext
10654 {{quote|quote}}
10655 !! html
10656 <p>quote
10657 </p>
10658 !!end
10659
10660 ###
10661 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10662 ###
10663
10664 !!test
10665 Templates: 1. Simple use
10666 !! wikitext
10667 {{echo|Foo}}
10668 !! html
10669 <p>Foo
10670 </p>
10671 !!end
10672
10673 !!test
10674 Templates: 2. Inside a block tag
10675 !! wikitext
10676 <div>{{echo|Foo}}</div>
10677 <blockquote>{{echo|Foo}}</blockquote>
10678 !! html
10679 <div>Foo</div>
10680 <blockquote>Foo</blockquote>
10681
10682 !! html+tidy
10683 <div>Foo</div>
10684 <blockquote>
10685 <p>Foo</p>
10686 </blockquote>
10687 !!end
10688
10689 !!test
10690 Templates: P-wrapping: 1a. Templates on consecutive lines
10691 !! wikitext
10692 {{echo|Foo}}
10693 {{echo|bar}}
10694 !! html
10695 <p>Foo
10696 bar
10697 </p>
10698 !!end
10699
10700 !!test
10701 Templates: P-wrapping: 1b. Templates on consecutive lines
10702 !! wikitext
10703 Foo
10704
10705 {{echo|bar}}
10706 {{echo|baz}}
10707 !! html
10708 <p>Foo
10709 </p><p>bar
10710 baz
10711 </p>
10712 !!end
10713
10714 !!test
10715 Templates: P-wrapping: 1c. Templates on consecutive lines
10716 !! wikitext
10717 {{echo|Foo}}
10718 {{echo|bar}} <div>baz</div>
10719 !! html
10720 <p>Foo
10721 </p>
10722 bar <div>baz</div>
10723
10724 !! html+tidy
10725 <p>Foo</p>
10726 <p>bar</p>
10727 <div>baz</div>
10728 !! end
10729
10730 !!test
10731 Templates: P-wrapping: 1d. Template preceded by comment-only line
10732 !!options
10733 parsoid
10734 !! wikitext
10735 <!-- foo -->
10736 {{echo|Bar}}
10737 !! html
10738 <!-- foo -->
10739
10740 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10741 !!end
10742
10743 !!test
10744 Templates: Inline Text: 1. Multiple template uses
10745 !! wikitext
10746 {{echo|Foo}}bar{{echo|baz}}
10747 !! html
10748 <p>Foobarbaz
10749 </p>
10750 !!end
10751
10752 !!test
10753 Templates: Inline Text: 2. Back-to-back template uses
10754 !! wikitext
10755 {{echo|Foo}}{{echo|bar}}
10756 !! html
10757 <p>Foobar
10758 </p>
10759 !!end
10760
10761 !!test
10762 Templates: Block Tags: 1. Multiple template uses
10763 !! wikitext
10764 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10765 !! html
10766 <div>Foo</div><div>bar</div><div>baz</div>
10767
10768 !!end
10769
10770 !!test
10771 Templates: Block Tags: 2. Back-to-back template uses
10772 !! wikitext
10773 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10774 !! html
10775 <div>Foo</div><div>bar</div>
10776
10777 !!end
10778
10779 # This is an edge case relating to paragraph wrapping.
10780 !!test
10781 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10782 !! wikitext
10783 {{echo|a
10784 b</p>}}
10785 !! html/parsoid
10786 <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
10787 b</p>
10788 !!end
10789
10790 !!test
10791 Templates: Links: 1. Simple example
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: 2. Generation of link href
10801 !! wikitext
10802 [[{{echo|Foo}}|bar]]
10803 !! html
10804 <p><a href="/wiki/Foo" title="Foo">bar</a>
10805 </p>
10806 !!end
10807
10808 !!test
10809 Templates: Links: 3. Generation of part of a link href
10810 !! wikitext
10811 [[Fo{{echo|o}}|bar]]
10812
10813 [[Foo{{echo|bar}}]]
10814
10815 [[Foo{{echo|bar}}baz]]
10816
10817 [[Foo{{echo|bar}}|bar]]
10818
10819 [[:Foo{{echo|bar}}]]
10820
10821 [[:Foo{{echo|bar}}|bar]]
10822 !! html
10823 <p><a href="/wiki/Foo" title="Foo">bar</a>
10824 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10825 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10826 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10827 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10828 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10829 </p>
10830 !!end
10831
10832 !!test
10833 Templates: Links: 4. Multiple templates generating link href
10834 !! wikitext
10835 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10836 !! html
10837 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10838 </p>
10839 !!end
10840
10841 !!test
10842 Templates: Links: 5. Generation of link text
10843 !! wikitext
10844 [[Foo|{{echo|bar}}]]
10845 !! html
10846 <p><a href="/wiki/Foo" title="Foo">bar</a>
10847 </p>
10848 !!end
10849
10850 !!test
10851 Templates: Links: 5. Nested templates (only outermost template should be marked)
10852 !! wikitext
10853 {{echo|[[{{echo|Foo}}|bar]]}}
10854 !! html
10855 <p><a href="/wiki/Foo" title="Foo">bar</a>
10856 </p>
10857 !!end
10858
10859 !!test
10860 Templates: HTML Tag: 1. Generation of HTML attr. key
10861 !! wikitext
10862 <div {{echo|style}}="color:red;">foo</div>
10863 !! html
10864 <div style="color:red;">foo</div>
10865
10866 !!end
10867
10868 !!test
10869 Templates: HTML Tag: 2. Generation of HTML attr. value
10870 !! wikitext
10871 <div 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: 3. Generation of HTML attr key and value
10879 !! wikitext
10880 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10881 !! html
10882 <div style="color:red;">foo</div>
10883
10884 !!end
10885
10886 !!test
10887 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10888 !! wikitext
10889 <div title="{{echo|This is a long title}} with just 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: 5. Generation of middle piece of HTML attr value
10897 !! wikitext
10898 <div title="This is a long title with just {{echo|one piece}} 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 !!test
10905 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10906 !! wikitext
10907 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10908 !! html
10909 <div title="This is a long title with just one piece templated">foo</div>
10910
10911 !!end
10912
10913 # SSS FIXME: While it is great we added support for all this,
10914 # do we want to make this part of the spec? Maybe we want to
10915 # deprecate this kind of usage in the future?
10916 !!test
10917 Templates: HTML Tag: 7. Generation of partial attribute key string
10918 !! wikitext
10919 <div st{{echo|yle}}="color:red;">foo</div>
10920 !! html
10921 <div style="color:red;">foo</div>
10922
10923 !!end
10924
10925 !! test
10926 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10927 !! wikitext
10928 <div {{echo|1=id="v1"}}>bar</div>
10929 !! html
10930 <div id="v1">bar</div>
10931
10932 !!end
10933
10934 !! test
10935 Templates: HTML Tag: 9. Multiple template-generated attributes
10936 !! wikitext
10937 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10938 !! html
10939 <div id="v1" title="foo">bar</div>
10940
10941 !!end
10942
10943 !! test
10944 Templates: Support for templates generating attributes and content
10945 !! wikitext
10946 {| {{mixed_attr_content_template}}
10947 |-
10948 |bar
10949 |}
10950 !! html/php
10951 <table style="color:red;" title="T48811">
10952
10953 <tr>
10954 <td>foo
10955 </td></tr>
10956 <tr>
10957 <td>bar
10958 </td></tr></table>
10959
10960 !! html/parsoid
10961 <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|}"]}'>
10962 <tbody><tr>
10963 <td>foo</td></tr>
10964 <tr>
10965 <td>bar</td></tr>
10966 </tbody></table>
10967 !!end
10968
10969 !! test
10970 1. Entities and nowikis inside templated attributes should be handled correctly
10971 !! wikitext
10972 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
10973 !! html/php
10974 <div style="background:#f9f9f9;">foo</div>
10975
10976 !! html/parsoid
10977 <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>
10978 !! end
10979
10980 !! test
10981 2. Entities and nowikis inside templated attributes should be handled correctly
10982 !! wikitext
10983 {|
10984 |{{table_attribs_3}}
10985 |}
10986 !! html/php
10987 <table>
10988 <tr>
10989 <td style="background:#f9f9f9;">Foo
10990 </td></tr></table>
10991
10992 !! html/parsoid
10993 <table>
10994 <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>
10995 </tbody></table>
10996 !! end
10997
10998 !! test
10999 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11000 !! wikitext
11001 {{tbl-start}}
11002 |{{table_attribs_3}}
11003 {{tbl-end}}
11004 !! html/php
11005 <table>
11006 <tr>
11007 <td style="background:#f9f9f9;">Foo
11008 </td></tr></table>
11009
11010 !! html/parsoid
11011 <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}}]}'>
11012 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11013 </tbody></table>
11014 !! end
11015
11016 !!test
11017 Templates: HTML Tables: 1. Generating start of a HTML table
11018 !! wikitext
11019 {{echo|<table><tr><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: 2a. Generating middle of a HTML table
11027 !! wikitext
11028 <table><tr>{{echo|<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: 2b. Generating middle of a HTML table
11036 !! wikitext
11037 <table>{{echo|<tr><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: 3. Generating end of a HTML table
11045 !! wikitext
11046 <table><tr>{{echo|<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: 4a. Generating a single tag of a HTML table
11054 !! wikitext
11055 {{echo|<table>}}<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: 4b. Generating a single tag of a HTML table
11063 !! wikitext
11064 <table>{{echo|<tr>}}<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: 4c. Generating a single tag of a HTML table
11072 !! wikitext
11073 <table><tr>{{echo|<td>}}foo</td></tr></table>
11074 !! html
11075 <table><tr><td>foo</td></tr></table>
11076
11077 !!end
11078
11079 !!test
11080 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11081 !! wikitext
11082 <table><tr><td>foo{{echo|</td>}}</tr></table>
11083 !! html
11084 <table><tr><td>foo</td></tr></table>
11085
11086 !!end
11087
11088 !!test
11089 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11090 !! wikitext
11091 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11092 !! html
11093 <table><tr><td>foo</td></tr></table>
11094
11095 !!end
11096
11097 !!test
11098 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11099 !! wikitext
11100 <table><tr><td>foo</td></tr>{{echo|</table>}}
11101 !! html
11102 <table><tr><td>foo</td></tr></table>
11103
11104 !!end
11105
11106 !!test
11107 Templates: HTML Tables: 5. Proper fostering of categories from inside
11108 !!options
11109 parsoid=wt2html,wt2wt
11110 !! wikitext
11111 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11112 <!--Two categories (Bug 50330)-->
11113 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11114 !! html
11115 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11116 <!--Two categories (Bug 50330)-->
11117 <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>
11118 !!end
11119
11120 !!test
11121 Templates: Wiki Tables: 1a. Fostering of entire template content
11122 !! wikitext
11123 {|
11124 {{echo|a}}
11125 |}
11126 !! html
11127 <table>
11128 a
11129 <tr><td></td></tr></table>
11130
11131 !! html+tidy
11132 <p>a</p>
11133 <table>
11134 <tr>
11135 <td></td>
11136 </tr>
11137 </table>
11138 !! end
11139
11140 !!test
11141 Templates: Wiki Tables: 1b. Fostering of entire template content
11142 !! wikitext
11143 {|
11144 {{echo|<div>}}
11145 foo
11146 {{echo|</div>}}
11147 |}
11148 !! html
11149 <table>
11150 <div>
11151 <p>foo
11152 </p>
11153 </div>
11154 <tr><td></td></tr></table>
11155
11156 !! html+tidy
11157 <div>
11158 <p>foo</p>
11159 </div>
11160 <table>
11161 <tr>
11162 <td></td>
11163 </tr>
11164 </table>
11165 !! end
11166
11167 !!test
11168 Templates: Wiki Tables: 2. Fostering of partial template content
11169 !! wikitext
11170 {|
11171 {{echo|a
11172 <div>b</div>}}
11173 |}
11174 !! html
11175 <table>
11176 a
11177 <div>b</div>
11178 <tr><td></td></tr></table>
11179
11180 !! html+tidy
11181 <p>a</p>
11182 <div>b</div>
11183 <table>
11184 <tr>
11185 <td></td>
11186 </tr>
11187 </table>
11188 !! end
11189
11190 !!test
11191 Templates: Wiki Tables: 3. td-content via multiple templates
11192 !! wikitext
11193 {|
11194 {{echo|{{pipe}}a}}{{echo|b}}
11195 |}
11196 !! html
11197 <table>
11198 <tr>
11199 <td>ab
11200 </td></tr></table>
11201
11202 !!end
11203
11204 !!test
11205 Templates: Wiki Tables: 4. Templated tags, no content
11206 !! wikitext
11207 {{tbl-start}}
11208 {{tbl-end}}
11209 !! html
11210 <table>
11211 <tr><td></td></tr></table>
11212
11213 !!end
11214
11215 !!test
11216 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11217 !! wikitext
11218 {{tbl-start}}
11219 |foo
11220 {{tbl-end}}
11221 !! html
11222 <table>
11223 <tr>
11224 <td>foo
11225 </td></tr></table>
11226
11227 !!end
11228
11229 !!test
11230 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11231 !! wikitext
11232 {{tbl-start}}
11233 {{!}}foo
11234 {{tbl-end}}
11235 !! html
11236 <table>
11237 <tr>
11238 <td>foo
11239 </td></tr></table>
11240
11241 !!end
11242
11243 ## This test case is very specific to Parsoid's internals
11244 ## and is hence only tested for Parsoid's code. Parsoid uses
11245 ## a <meta> marker tag for <ref> tags and they are expanded
11246 ## much later. We are verifying that this <meta> tag usage
11247 ## doesn't prevent foster parenting.
11248 !!test
11249 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11250 !!wikitext
11251 {{PartialTable}}<ref>foo</ref>
11252 |}
11253
11254 <references />
11255 !!html/parsoid
11256 <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">
11257 <tbody>
11258 </tbody></table>
11259
11260 <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>
11261 !!end
11262
11263 !! test
11264 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11265 !! wikitext
11266 {{echo|
11267 {{{!}}
11268 {{!}}-}}
11269 <onlyinclude>
11270 |foo
11271 </onlyinclude>
11272 {{!}}}
11273 !! html/parsoid
11274 <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{{!}}}"]}'>
11275 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11276 <tbody><tr>
11277
11278 <td>foo
11279 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11280 </tbody></table>
11281 !! end
11282
11283 !!test
11284 Templates: Lists: Multi-line list-items via templates
11285 !! wikitext
11286 *{{echo|a {{nonexistent|
11287 unused}}}}
11288 *{{echo|b {{nonexistent|
11289 unused}}}}
11290 !! html
11291 <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>
11292 <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>
11293
11294 !!end
11295
11296 !!test
11297 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11298 !! wikitext
11299 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11300 !! html
11301 <p><i>ab</i>c<i>d</i>e
11302 </p>
11303 !!end
11304
11305 !!test
11306 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11307 (PHP parser generates misnested html)
11308 !! wikitext
11309 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11310 !! html/parsoid
11311 <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>
11312 !!end
11313
11314 !!test
11315 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11316 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11317 !! options
11318 parsoid=wt2html,wt2wt
11319 !! wikitext
11320 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11321 !! html
11322 <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>
11323 <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>
11324 <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>
11325 !!end
11326
11327 !!test
11328 Templates: Ugly nesting: 4. Divs opened/closed across templates
11329 !! wikitext
11330 a<div>b{{echo|c</div>d}}e
11331 !! html
11332 a<div>bc</div>de
11333
11334 !! html+tidy
11335 <p>a</p>
11336 <div>bc</div>
11337 <p>de</p>
11338 !! end
11339
11340 !!test
11341 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11342 (Parsoid-centric)
11343 !! options
11344 parsoid
11345 !! wikitext
11346 {|
11347 |{{echo|foo</table>}}
11348 |bar
11349 |}
11350 !! html
11351 <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|}"]}'>
11352
11353 <tbody>
11354 <tr>
11355 <td>foo</td></tr></tbody></table><span about="#mwt1">
11356 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11357 |}</span>
11358 !!end
11359
11360 !!test
11361 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11362 (Parsoid-centric)
11363 !! options
11364 parsoid
11365 !! wikitext
11366 <table>
11367 <tr>
11368 <td>
11369 <table>
11370 <tr>
11371 <td>1. {{echo|foo </table>}}</td>
11372 <td> bar </td>
11373 <td>2. {{echo|baz </table>}}</td>
11374 </tr>
11375 <tr>
11376 <td>abc</td>
11377 </tr>
11378 </table>
11379 </td>
11380 </tr>
11381 <tr>
11382 <td>xyz</td>
11383 </tr>
11384 </table>
11385 !! html
11386 <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>"]}'>
11387 <tbody><tr>
11388 <td>
11389 <table>
11390 <tbody><tr>
11391 <td>1. foo </td></tr></tbody></table></td>
11392 <td> bar </td>
11393 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11394 </span><span about="#mwt2">
11395 </span><span about="#mwt2">
11396 </span><span about="#mwt2">abc</span><span about="#mwt2">
11397 </span><span about="#mwt2">
11398 </span><span about="#mwt2">
11399 </span><span about="#mwt2">
11400 </span><span about="#mwt2">
11401 </span><span about="#mwt2">
11402 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11403 </span><span about="#mwt2">
11404 </span>
11405 !!end
11406
11407 !! test
11408 Templates: Ugly templates: 3. newline-only template parameter
11409 !! wikitext
11410 foo {{echo|
11411 }}
11412 !! html
11413 <p>foo
11414 </p>
11415 !! end
11416
11417 # This looks like a bug: a single newline triggers p/br for some reason.
11418 !! test
11419 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11420 !! wikitext
11421 {{echo|
11422 }}
11423 !! html
11424 <p><br />
11425 </p>
11426 !! end
11427
11428 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11429 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11430 !! test
11431 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11432 !! wikitext
11433 {{echo|<table>}}
11434 {{echo|<div>foo}}
11435 {{echo|</table>}}
11436 !! html/parsoid
11437 <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
11438 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11439 </table>
11440 !! end
11441
11442 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11443 # that are "identical" and generate nesting cycles in the algorithm
11444 !! test
11445 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11446 !! wikitext
11447 {{echo|<table><tr><td><table>}}
11448 {{echo|<div>}}
11449 {{echo|</div>}}
11450 !! html/parsoid
11451 <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"}'>
11452 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11453 </table></td></tr></tbody></table>
11454 !! end
11455
11456 !!test
11457 Parser Functions: 1. Simple example
11458 !! wikitext
11459 {{uc:foo}}
11460 !! html
11461 <p>FOO
11462 </p>
11463 !!end
11464
11465 !!test
11466 Parser Functions: 2. Nested use (only outermost should be marked up)
11467 !! wikitext
11468 {{uc:{{lc:FOO}}}}
11469 !! html
11470 <p>FOO
11471 </p>
11472 !!end
11473
11474 ###
11475 ### Pre-save transform tests
11476 ###
11477 !! test
11478 pre-save transform: subst:
11479 !! options
11480 PST
11481 !! wikitext
11482 {{subst:test}}
11483 !! html
11484 This is a test template
11485 !! end
11486
11487 !! test
11488 pre-save transform: normal template
11489 !! options
11490 PST
11491 !! wikitext
11492 {{test}}
11493 !! html
11494 {{test}}
11495 !! end
11496
11497 !! test
11498 pre-save transform: nonexistent template
11499 !! options
11500 PST
11501 !! wikitext
11502 {{thistemplatedoesnotexist}}
11503 !! html
11504 {{thistemplatedoesnotexist}}
11505 !! end
11506
11507
11508 !! test
11509 pre-save transform: subst magic variables
11510 !! options
11511 PST
11512 !! wikitext
11513 {{subst:SITENAME}}
11514 !! html
11515 MediaWiki
11516 !! end
11517
11518 # This is bug 89, which I fixed. -- wtm
11519 !! test
11520 pre-save transform: subst: templates with parameters
11521 !! options
11522 pst
11523 !! wikitext
11524 {{subst:paramtest|param="something else"}}
11525 !! html
11526 This is a test template with parameter "something else"
11527 !! end
11528
11529 !! article
11530 Template:nowikitest
11531 !! text
11532 <nowiki>'''not wiki'''</nowiki>
11533 !! endarticle
11534
11535 !! test
11536 pre-save transform: nowiki in subst (bug 1188)
11537 !! options
11538 pst
11539 !! wikitext
11540 {{subst:nowikitest}}
11541 !! html
11542 <nowiki>'''not wiki'''</nowiki>
11543 !! end
11544
11545
11546 !! article
11547 Template:commenttest
11548 !! text
11549 This template has <!-- a comment --> in it.
11550 !! endarticle
11551
11552 !! test
11553 pre-save transform: comment in subst (bug 1936)
11554 !! options
11555 pst
11556 !! wikitext
11557 {{subst:commenttest}}
11558 !! html
11559 This template has <!-- a comment --> in it.
11560 !! end
11561
11562 !! test
11563 pre-save transform: unclosed tag
11564 !! options
11565 pst noxml
11566 !! wikitext
11567 <nowiki>'''not wiki'''
11568 !! html
11569 <nowiki>'''not wiki'''
11570 !! end
11571
11572 !! test
11573 pre-save transform: mixed tag case
11574 !! options
11575 pst noxml
11576 !! wikitext
11577 <NOwiki>'''not wiki'''</noWIKI>
11578 !! html
11579 <NOwiki>'''not wiki'''</noWIKI>
11580 !! end
11581
11582 !! test
11583 pre-save transform: unclosed comment in <nowiki>
11584 !! options
11585 pst noxml
11586 !! wikitext
11587 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11588 !! html
11589 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11590 !!end
11591
11592 # Leading @ in this template definition works around a limitation
11593 # in parsoid's parserTests which otherwise strips the <span> from the
11594 # result (confusing it for a template wrapper)
11595 !! article
11596 Template:dangerous
11597 !!text
11598 @<span onmouseover="alert('crap')">Oh no</span>
11599 !!endarticle
11600
11601 !!test
11602 (confirming safety of fix for subst bug 1936)
11603 !! wikitext
11604 {{Template:dangerous}}
11605 !! html
11606 <p>@<span>Oh no</span>
11607 </p>
11608 !! end
11609
11610 !! test
11611 pre-save transform: comment containing gallery (bug 5024)
11612 !! options
11613 pst
11614 !! wikitext
11615 <!-- <gallery>data</gallery> -->
11616 !! html
11617 <!-- <gallery>data</gallery> -->
11618 !!end
11619
11620 !! test
11621 pre-save transform: comment containing extension
11622 !! options
11623 pst
11624 !! wikitext
11625 <!-- <tag>data</tag> -->
11626 !! html
11627 <!-- <tag>data</tag> -->
11628 !!end
11629
11630 !! test
11631 pre-save transform: comment containing nowiki
11632 !! options
11633 pst
11634 !! wikitext
11635 <!-- <nowiki>data</nowiki> -->
11636 !! html
11637 <!-- <nowiki>data</nowiki> -->
11638 !!end
11639
11640 !! test
11641 pre-save transform: <noinclude> in subst (bug 3298)
11642 !! options
11643 pst
11644 !! wikitext
11645 {{subst:Includes}}
11646 !! html
11647 Foobar
11648 !! end
11649
11650 !! test
11651 pre-save transform: <onlyinclude> in subst (bug 3298)
11652 !! options
11653 pst
11654 !! wikitext
11655 {{subst:Includes2}}
11656 !! html
11657 Foo
11658 !! end
11659
11660 !! article
11661 Template:SubstTest
11662 !!text
11663 {{<includeonly>subst:</includeonly>Includes}}
11664 !! endarticle
11665
11666 !! article
11667 Template:SafeSubstTest
11668 !! text
11669 {{<includeonly>safesubst:</includeonly>Includes}}
11670 !! endarticle
11671
11672 !! test
11673 bug 22297: safesubst: works during PST
11674 !! options
11675 pst
11676 !! wikitext
11677 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11678 !! html
11679 FoobarFoobar
11680 !! end
11681
11682 !! test
11683 bug 22297: safesubst: works during normal parse
11684 !! wikitext
11685 {{SafeSubstTest}}
11686 !! html
11687 <p>Foobar
11688 </p>
11689 !! end
11690
11691 !! test
11692 subst: does not work during normal parse
11693 !! wikitext
11694 {{SubstTest}}
11695 !! html
11696 <p>{{subst:Includes}}
11697 </p>
11698 !! end
11699
11700 !! test
11701 pre-save transform: context links ("pipe trick")
11702 !! options
11703 pst
11704 !! wikitext
11705 [[Article (context)|]]
11706 [[Bar:Article|]]
11707 [[:Bar:Article|]]
11708 [[Bar:Article (context)|]]
11709 [[:Bar:Article (context)|]]
11710 [[|Article]]
11711 [[|Article (context)]]
11712 [[Bar:X (Y) Z|]]
11713 [[:Bar:X (Y) Z|]]
11714 !! html
11715 [[Article (context)|Article]]
11716 [[Bar:Article|Article]]
11717 [[:Bar:Article|Article]]
11718 [[Bar:Article (context)|Article]]
11719 [[:Bar:Article (context)|Article]]
11720 [[Article]]
11721 [[Article (context)]]
11722 [[Bar:X (Y) Z|X (Y) Z]]
11723 [[:Bar:X (Y) Z|X (Y) Z]]
11724 !! end
11725
11726 !! test
11727 pre-save transform: context links ("pipe trick") with interwiki prefix
11728 !! options
11729 pst
11730 !! wikitext
11731 [[interwiki:Article|]]
11732 [[:interwiki:Article|]]
11733 [[interwiki:Bar:Article|]]
11734 [[:interwiki:Bar:Article|]]
11735 !! html
11736 [[interwiki:Article|Article]]
11737 [[:interwiki:Article|Article]]
11738 [[interwiki:Bar:Article|Bar:Article]]
11739 [[:interwiki:Bar:Article|Bar:Article]]
11740 !! end
11741
11742 !! test
11743 pre-save transform: context links ("pipe trick") with parens in title
11744 !! options
11745 pst title=[[Somearticle (context)]]
11746 !! wikitext
11747 [[|Article]]
11748 !! html
11749 [[Article (context)|Article]]
11750 !! end
11751
11752 !! test
11753 pre-save transform: context links ("pipe trick") with comma in title
11754 !! options
11755 pst title=[[Someplace, Somewhere]]
11756 !! wikitext
11757 [[|Otherplace]]
11758 [[Otherplace, Elsewhere|]]
11759 [[Otherplace, Elsewhere, Anywhere|]]
11760 !! html
11761 [[Otherplace, Somewhere|Otherplace]]
11762 [[Otherplace, Elsewhere|Otherplace]]
11763 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11764 !! end
11765
11766 !! test
11767 pre-save transform: context links ("pipe trick") with parens and comma
11768 !! options
11769 pst title=[[Someplace (IGNORED), Somewhere]]
11770 !! wikitext
11771 [[|Otherplace]]
11772 [[Otherplace (place), Elsewhere|]]
11773 !! html
11774 [[Otherplace, Somewhere|Otherplace]]
11775 [[Otherplace (place), Elsewhere|Otherplace]]
11776 !! end
11777
11778 !! test
11779 pre-save transform: context links ("pipe trick") with comma and parens
11780 !! options
11781 pst title=[[Who, me? (context)]]
11782 !! wikitext
11783 [[|Yes, you.]]
11784 [[Me, Myself, and I (1937 song)|]]
11785 !! html
11786 [[Yes, you. (context)|Yes, you.]]
11787 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11788 !! end
11789
11790 !! test
11791 pre-save transform: context links ("pipe trick") with namespace
11792 !! options
11793 pst title=[[Ns:Somearticle]]
11794 !! wikitext
11795 [[|Article]]
11796 !! html
11797 [[Ns:Article|Article]]
11798 !! end
11799
11800 !! test
11801 pre-save transform: context links ("pipe trick") with namespace and parens
11802 !! options
11803 pst title=[[Ns:Somearticle (context)]]
11804 !! wikitext
11805 [[|Article]]
11806 !! html
11807 [[Ns:Article (context)|Article]]
11808 !! end
11809
11810 !! test
11811 pre-save transform: context links ("pipe trick") with namespace and comma
11812 !! options
11813 pst title=[[Ns:Somearticle, Context, Whatever]]
11814 !! wikitext
11815 [[|Article]]
11816 !! html
11817 [[Ns:Article, Context, Whatever|Article]]
11818 !! end
11819
11820 !! test
11821 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11822 !! options
11823 pst title=[[Ns:Somearticle, Context (context)]]
11824 !! wikitext
11825 [[|Article]]
11826 !! html
11827 [[Ns:Article (context)|Article]]
11828 !! end
11829
11830 !! test
11831 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11832 !! options
11833 pst title=[[Ns:Somearticle (IGNORED), Context]]
11834 !! wikitext
11835 [[|Article]]
11836 !! html
11837 [[Ns:Article, Context|Article]]
11838 !! end
11839
11840 !! test
11841 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11842 !! options
11843 pst
11844 !! wikitext
11845 [[Article(context)|]]
11846 [[Bar:Article(context)|]]
11847 [[:Bar:Article(context)|]]
11848 [[|Article(context)]]
11849 [[Bar:X(Y)Z|]]
11850 [[:Bar:X(Y)Z|]]
11851 !! html
11852 [[Article(context)|Article]]
11853 [[Bar:Article(context)|Article]]
11854 [[:Bar:Article(context)|Article]]
11855 [[Article(context)]]
11856 [[Bar:X(Y)Z|X(Y)Z]]
11857 [[:Bar:X(Y)Z|X(Y)Z]]
11858 !! end
11859
11860 !! test
11861 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11862 !! options
11863 pst
11864 !! wikitext
11865 [[Article (context)|]]
11866 [[Bar:Article (context)|]]
11867 [[:Bar:Article (context)|]]
11868 [[|Article (context)]]
11869 [[Bar:X (Y) Z|]]
11870 [[:Bar:X (Y) Z|]]
11871 !! html
11872 [[Article (context)|Article]]
11873 [[Bar:Article (context)|Article]]
11874 [[:Bar:Article (context)|Article]]
11875 [[Article (context)]]
11876 [[Bar:X (Y) Z|X (Y) Z]]
11877 [[:Bar:X (Y) Z|X (Y) Z]]
11878 !! end
11879
11880 !! test
11881 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11882 !! options
11883 pst
11884 !! wikitext
11885 [[Article(context)|]]
11886 [[Bar:Article(context)|]]
11887 [[:Bar:Article(context)|]]
11888 [[|Article(context)]]
11889 [[Bar:X(Y)Z|]]
11890 [[:Bar:X(Y)Z|]]
11891 !! html
11892 [[Article(context)|Article]]
11893 [[Bar:Article(context)|Article]]
11894 [[:Bar:Article(context)|Article]]
11895 [[Article(context)]]
11896 [[Bar:X(Y)Z|X(Y)Z]]
11897 [[:Bar:X(Y)Z|X(Y)Z]]
11898 !! end
11899
11900 !! test
11901 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11902 !! options
11903 pst
11904 !! wikitext
11905 [[Article (context), context|]]
11906 [[Article (context),context|]]
11907 [[Bar:Article (context), context|]]
11908 [[Bar:Article (context),context|]]
11909 [[:Bar:Article (context), context|]]
11910 [[:Bar:Article (context),context|]]
11911 !! html
11912 [[Article (context), context|Article]]
11913 [[Article (context),context|Article]]
11914 [[Bar:Article (context), context|Article]]
11915 [[Bar:Article (context),context|Article]]
11916 [[:Bar:Article (context), context|Article]]
11917 [[:Bar:Article (context),context|Article]]
11918 !! end
11919
11920 !! test
11921 pre-save transform: trim trailing empty lines
11922 !! options
11923 pst
11924 !! wikitext
11925 Empty lines are trimmed
11926
11927
11928
11929
11930 !! html
11931 Empty lines are trimmed
11932 !! end
11933
11934 !! test
11935 pre-save transform: Signature expansion
11936 !! options
11937 pst
11938 !! wikitext
11939 * ~~~
11940 * <noinclude>~~~</noinclude>
11941 * <includeonly>~~~</includeonly>
11942 * <onlyinclude>~~~</onlyinclude>
11943 !! html
11944 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11945 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11946 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11947 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11948 !! end
11949
11950
11951 !! test
11952 pre-save transform: Signature expansion in nowiki tags (bug 93)
11953 !! options
11954 pst disabled
11955 !! wikitext
11956 Shall not expand:
11957
11958 <nowiki>~~~~</nowiki>
11959
11960 <includeonly><nowiki>~~~~</nowiki></includeonly>
11961
11962 <noinclude><nowiki>~~~~</nowiki></noinclude>
11963
11964 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11965
11966 {{subst:Foo}} shall be converted to FOO
11967
11968 As well as inside noinclude/onlyinclude
11969 <noinclude>{{subst:Foo}}</noinclude>
11970 <onlyinclude>{{subst:Foo}}</onlyinclude>
11971
11972 But not inside includeonly
11973 <includeonly>{{subst:Foo}}</includeonly>
11974 !! html
11975 Shall not expand:
11976
11977 <nowiki>~~~~</nowiki>
11978
11979 <includeonly><nowiki>~~~~</nowiki></includeonly>
11980
11981 <noinclude><nowiki>~~~~</nowiki></noinclude>
11982
11983 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11984
11985 FOO shall be converted to FOO
11986
11987 As well as inside noinclude/onlyinclude
11988 <noinclude>FOO</noinclude>
11989 <onlyinclude>FOO</onlyinclude>
11990
11991 But not inside includeonly
11992 <includeonly>{{subst:Foo}}</includeonly>
11993 !! end
11994
11995 !! test
11996 Parsoid: Recognize nowiki with trailing space in tags
11997 !! options
11998 parsoid=wt2html
11999 !! wikitext
12000 <nowiki ><div>[[foo]]</nowiki >
12001
12002 a<nowiki / >b
12003
12004 c<nowiki />d
12005
12006 e<nowiki/ >f
12007 !! html
12008 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12009 <p>ab</p>
12010 <p>cd</p>
12011 <p>ef</p>
12012 !! end
12013
12014 !! test
12015 Parsoid: Recognize nowiki with odd capitalization
12016 !! options
12017 parsoid=wt2html
12018 !! wikitext
12019 <noWikI ><div>[[foo]]</Nowiki >
12020 !! html
12021 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12022 !! end
12023
12024
12025 !! test
12026 Parsoid: Escape nowiki with trailing space in tags
12027 !! options
12028 parsoid=html2wt
12029 !! html
12030 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12031 <p>a&lt;nowiki /&gt;b</p>
12032 <p>c&lt;nowiki/ &gt;d</p>
12033 !! wikitext
12034 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12035
12036 a&lt;nowiki /&gt;b
12037
12038 c&lt;nowiki/ &gt;d
12039 !! end
12040
12041 !! test
12042 Parsoid: Escape weird noWikI capitalizations
12043 !! options
12044 parsoid=html2wt
12045 !! html
12046 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12047 !! wikitext
12048 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12049 !! end
12050
12051 ###
12052 ### Message transform tests
12053 ###
12054 !! test
12055 message transform: magic variables
12056 !! options
12057 msg
12058 !! wikitext
12059 {{SITENAME}}
12060 !! html
12061 MediaWiki
12062 !! end
12063
12064 !! test
12065 message transform: should not transform wiki markup
12066 !! options
12067 msg
12068 !! wikitext
12069 ''test''
12070 !! html
12071 ''test''
12072 !! end
12073
12074 !! test
12075 message transform: <noinclude> in transcluded template (bug 4926)
12076 !! options
12077 msg
12078 !! wikitext
12079 {{Includes}}
12080 !! html
12081 Foobar
12082 !! end
12083
12084 !! test
12085 message transform: <onlyinclude> in transcluded template (bug 4926)
12086 !! options
12087 msg
12088 !! wikitext
12089 {{Includes2}}
12090 !! html
12091 Foo
12092 !! end
12093
12094 !! test
12095 {{#special:}} page name, known
12096 !! options
12097 msg
12098 !! wikitext
12099 {{#special:Recentchanges}}
12100 !! html
12101 Special:RecentChanges
12102 !! end
12103
12104 !! test
12105 {{#special:}} page name with subpage, known
12106 !! options
12107 msg
12108 !! wikitext
12109 {{#special:Recentchanges/param}}
12110 !! html
12111 Special:RecentChanges/param
12112 !! end
12113
12114 !! test
12115 {{#special:}} page name, unknown
12116 !! options
12117 msg
12118 !! wikitext
12119 {{#special:foobar nonexistent}}
12120 !! html
12121 Special:Foobar nonexistent
12122 !! end
12123
12124 !! test
12125 {{#speciale:}} page name, known
12126 !! options
12127 msg
12128 !! wikitext
12129 {{#speciale:Recentchanges}}
12130 !! html
12131 Special:RecentChanges
12132 !! end
12133
12134 !! test
12135 {{#speciale:}} page name with subpage, known
12136 !! options
12137 msg
12138 !! wikitext
12139 {{#speciale:Recentchanges/param}}
12140 !! html
12141 Special:RecentChanges/param
12142 !! end
12143
12144 !! test
12145 {{#speciale:}} page name, unknown
12146 !! options
12147 msg
12148 !! wikitext
12149 {{#speciale:foobar nonexistent}}
12150 !! html
12151 Special:Foobar_nonexistent
12152 !! end
12153
12154 ###
12155 ### Images
12156 ###
12157 ### For Parsoid-specific tests, see
12158 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12159
12160 !! test
12161 Simple image
12162 !! options
12163 parsoid=wt2html,wt2wt,html2html
12164 !! wikitext
12165 [[Image:foobar.jpg]]
12166 !! html/php
12167 <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>
12168 </p>
12169 !! html/parsoid
12170 <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>
12171 !! end
12172
12173 !! test
12174 Simple image (using File: namespace, now canonical)
12175 !! wikitext
12176 [[File:Foobar.jpg]]
12177 !! html/php
12178 <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>
12179 </p>
12180 !! html/parsoid
12181 <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>
12182 !! end
12183
12184 !! test
12185 Right-aligned image
12186 !! wikitext
12187 [[File:Foobar.jpg|right]]
12188 !! html/php
12189 <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>
12190
12191 !! html/parsoid
12192 <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>
12193 !! end
12194
12195 !! test
12196 Image with caption
12197 !! wikitext
12198 [[File:Foobar.jpg|right|Caption text]]
12199 !! html/php
12200 <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>
12201
12202 !! html/parsoid
12203 <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>
12204 !! end
12205
12206 !! test
12207 Image with caption, bug 53312 #1
12208 !! wikitext
12209 [[File:Foobar.jpg|right|Caption page stuff]]
12210 !! html/php
12211 <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>
12212
12213 !! html/parsoid
12214 <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>
12215 !! end
12216
12217 !! test
12218 Image with caption, bug 53312 #2
12219 !! wikitext
12220 [[File:Foobar.jpg|right|Caption page=]]
12221 !! html/php
12222 <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>
12223
12224 !! html/parsoid
12225 <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>
12226 !! end
12227
12228 !! test
12229 Image with caption, bug 53312 #3
12230 !! wikitext
12231 [[File:Foobar.jpg|right|Caption page=stuff]]
12232 !! html/php
12233 <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>
12234
12235 !! html/parsoid
12236 <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>
12237 !! end
12238
12239 !! test
12240 Allow empty links in image captions (Bug 60753)
12241 !! options
12242 thumbsize=220
12243 !! wikitext
12244 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12245 [[]]
12246 [[Link2]]
12247 ]]
12248 !! html/php
12249 <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>
12250
12251 !! html/parsoid
12252 <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>
12253 [[]]
12254 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12255 </figcaption></figure>
12256 !! end
12257
12258 !! test
12259 Titles in unlinked images (T23454)
12260 !! wikitext
12261 [[File:Foobar.jpg|link=|stuff]]
12262 !! html/php
12263 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12264 </p>
12265 !! end
12266
12267 !! test
12268 Link with empty target
12269 !! wikitext
12270 [[]]
12271 !! html
12272 <p>[[]]
12273 </p>
12274 !! end
12275
12276 !! test
12277 Image with link trail
12278 !! wikitext
12279 Linktrails should not work for images: [[File:Foobar.jpg]]s
12280 !! html/php
12281 <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
12282 </p>
12283 !! html/parsoid
12284 <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>
12285 !! end
12286
12287 !! test
12288 Image with empty attribute
12289 !! options
12290 parsoid=wt2html,wt2wt,html2html
12291 !! wikitext
12292 [[File:Foobar.jpg|right||Caption text]]
12293 !! html/php
12294 <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>
12295
12296 !! html/parsoid
12297 <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>
12298 !! end
12299
12300 !! test
12301 1. Block image with individual attributes from templates
12302 !! wikitext
12303 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12304 !! html/php
12305 <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>
12306
12307 !! html/parsoid
12308 <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>
12309 !! end
12310
12311 !! test
12312 2. Block Image with individual attributes from templates
12313 !! wikitext
12314 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12315 !! html/php
12316 <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>
12317
12318 !! html/parsoid
12319 <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>
12320 !! end
12321
12322 !! test
12323 3. Inline image with individual attributes from templates
12324 !! wikitext
12325 [[File:Foobar.jpg|{{echo|50px}}]]
12326 !! html/php
12327 <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>
12328 </p>
12329 !! html/parsoid
12330 <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>
12331 !! end
12332
12333 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12334 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12335 !! test
12336 Image with multiple attributes from the same template
12337 !! wikitext
12338 [[File:Foobar.jpg|{{image_attribs}}]]
12339 !! html/php
12340 <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>
12341
12342 !! html/parsoid
12343 <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>
12344 !! end
12345
12346 !! test
12347 Image with link tails
12348 !! options
12349 thumbsize=220
12350 !! wikitext
12351 123[[File:Foobar.jpg]]456
12352 123[[File:Foobar.jpg|right]]456
12353 123[[File:Foobar.jpg|thumb]]456
12354 !! html/php
12355 <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
12356 </p>
12357 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
12358 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
12359
12360 !! html/php+tidy
12361 <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>
12362 <p>123</p>
12363 <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>
12364 <p>456 123</p>
12365 <div class="thumb tright">
12366 <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>
12367 <div class="thumbcaption">
12368 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12369 </div>
12370 </div>
12371 </div>
12372 <p>456</p>
12373 !! html/parsoid
12374 <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>
12375 <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>
12376 <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>
12377 !! end
12378
12379 !! test
12380 Image with multiple captions -- only last one is accepted
12381 !! wikitext
12382 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12383 !! html/php
12384 <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>
12385
12386 !! html/parsoid
12387 <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>
12388 !! end
12389
12390 !! test
12391 Image with multiple widths -- use last
12392 !! wikitext
12393 [[File:Foobar.jpg|200px|300px|caption]]
12394 !! html/php
12395 <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>
12396 </p>
12397 !! html/parsoid
12398 <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>
12399 !! end
12400
12401 !! test
12402 Image with multiple alignments -- use first (bug 48664)
12403 !! options
12404 thumbsize=220
12405 !! wikitext
12406 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12407
12408 [[File:Foobar.jpg|middle|text-top|caption]]
12409 !! html/php
12410 <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>
12411 <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>
12412 </p>
12413 !! html/parsoid
12414 <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>
12415 <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>
12416 !! end
12417
12418 !! test
12419 Image with width attribute at different positions
12420 !! wikitext
12421 [[File:Foobar.jpg|200px|right|Caption]]
12422 [[File:Foobar.jpg|right|200px|Caption]]
12423 [[File:Foobar.jpg|right|Caption|200px]]
12424 !! html/php
12425 <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>
12426 <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>
12427 <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>
12428
12429 !! html/parsoid
12430 <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>
12431 <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>
12432 <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>
12433 !! end
12434
12435 # a sad bit of backward-compatibility
12436 !! test
12437 Image with size specified with pxpx (bug 13500, 51628)
12438 !! options
12439 parsoid=wt2html,wt2wt,html2html
12440 !! wikitext
12441 [[File:Foobar.jpg|20pxpx]]
12442 [[File:Foobar.jpg|200x20pxpx]]
12443 !! html/php
12444 <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>
12445 <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>
12446 </p>
12447 !! html/parsoid
12448 <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>
12449 !! end
12450
12451 !! test
12452 Image with link parameter, wiki target
12453 !! wikitext
12454 [[File:Foobar.jpg|link=Main Page]]
12455 !! html/php
12456 <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>
12457 </p>
12458 !! html/parsoid
12459 <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>
12460 !! end
12461
12462 # parsoid bug 49293 (part 1)
12463 !! test
12464 Image with link parameter, URL target
12465 !! wikitext
12466 [[File:Foobar.jpg|link=http://example.com/]]
12467 !! html/php
12468 <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>
12469 </p>
12470 !! html/parsoid
12471 <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>
12472 !! end
12473
12474 # parsoid bug 49293 (part 2)
12475 !! test
12476 Image with link parameter, protocol-less URL target
12477 !! wikitext
12478 [[File:Foobar.jpg|link=//example.com/]]
12479 !! html/php
12480 <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>
12481 </p>
12482 !! html/parsoid
12483 <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>
12484 !! end
12485
12486 !! test
12487 Image with link parameter, wgExternalLinkTarget
12488 !! wikitext
12489 [[Image:foobar.jpg|link=http://example.com/]]
12490 !! config
12491 wgExternalLinkTarget='foobar'
12492 !! html
12493 <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>
12494 </p>
12495 !! end
12496
12497 !! test
12498 Image with link parameter, wgNoFollowLinks set to false
12499 !! wikitext
12500 [[Image:foobar.jpg|link=http://example.com/]]
12501 !! config
12502 wgNoFollowLinks=false
12503 !! html
12504 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12505 </p>
12506 !! end
12507
12508 !! test
12509 Image with link parameter, wgNoFollowDomainExceptions
12510 !! wikitext
12511 [[Image:foobar.jpg|link=http://example.com/]]
12512 !! config
12513 wgNoFollowDomainExceptions='example.com'
12514 !! html
12515 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12516 </p>
12517 !! end
12518
12519 !! test
12520 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12521 !! wikitext
12522 [[Image:foobar.jpg|link=http://example.com/|Title]]
12523 !! config
12524 wgExternalLinkTarget='foobar'
12525 !! html
12526 <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>
12527 </p>
12528 !! end
12529
12530 !! test
12531 Image with empty link parameter
12532 !! wikitext
12533 [[File:Foobar.jpg|link=]]
12534 !! html/php
12535 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12536 </p>
12537 !! html/parsoid
12538 <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>
12539 !! end
12540
12541 !! test
12542 Image with link parameter (wiki target) and unnamed parameter
12543 !! wikitext
12544 [[File:Foobar.jpg|link=Main_Page|Title]]
12545 !! html/php
12546 <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>
12547 </p>
12548 !! html/parsoid
12549 <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>
12550 !! end
12551
12552 !! test
12553 Image with link parameter (URL target) and unnamed parameter
12554 !! wikitext
12555 [[File:Foobar.jpg|link=http://example.com/|Title]]
12556 !! html/php
12557 <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>
12558 </p>
12559 !! html/parsoid
12560 <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>
12561 !! end
12562
12563 !! test
12564 Thumbnail image with link parameter
12565 !! options
12566 thumbsize=220
12567 parsoid=wt2html,wt2wt,html2html
12568 !! wikitext
12569 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12570 !! html/php
12571 <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>
12572
12573 !! html/parsoid
12574 <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>
12575 !! end
12576
12577 !! test
12578 Manually-specified thumbnail image
12579 !! options
12580 thumbsize=220
12581 !! wikitext
12582 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12583 !! html/php
12584 <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>
12585
12586 !! html/parsoid
12587 <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>
12588 !! end
12589
12590 !! test
12591 Manually-specified thumbnail image with explicit link to wiki page
12592 !! options
12593 thumbsize=220
12594 parsoid=wt2html,wt2wt,html2html
12595 !! wikitext
12596 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12597 !! html/php
12598 <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>
12599
12600 !! html/parsoid
12601 <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>
12602 !! end
12603
12604 !! test
12605 Manually-specified thumbnail image with explicit link to url
12606 !! options
12607 thumbsize=220
12608 parsoid=wt2html,wt2wt,html2html
12609 !! wikitext
12610 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12611 !! html/php
12612 <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>
12613
12614 !! html/parsoid
12615 <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>
12616 !! end
12617
12618 !! test
12619 Manually-specified thumbnail image with explicit no link
12620 !! options
12621 thumbsize=220
12622 parsoid=wt2html,wt2wt,html2html
12623 !! wikitext
12624 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12625 !! html/php
12626 <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>
12627
12628 !! html/parsoid
12629 <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>
12630 !! end
12631
12632 !! test
12633 Manually-specified thumbnail image with explicit link and alt text
12634 !! options
12635 thumbsize=220
12636 parsoid=wt2html,wt2wt,html2html
12637 !! wikitext
12638 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12639 !! html/php
12640 <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>
12641
12642 !! html/parsoid
12643 <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>
12644 !! end
12645
12646 !! test
12647 Image with frame and link
12648 !! options
12649 parsoid=wt2html,wt2wt,html2html
12650 !! wikitext
12651 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12652 !! html/php
12653 <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>
12654
12655 !! html/parsoid
12656 <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>
12657 !! end
12658
12659 !! test
12660 Image with frame and link and explicit alt
12661 !! options
12662 parsoid=wt2html,wt2wt,html2html
12663 !! wikitext
12664 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12665 !! html/php
12666 <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>
12667
12668 !! html/parsoid
12669 <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>
12670 !! end
12671
12672 !! test
12673 Image with wiki markup in implicit alt
12674 !! options
12675 parsoid=wt2html,wt2wt,html2html
12676 !! wikitext
12677 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12678
12679 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12680 !! html/php
12681 <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>
12682 </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>
12683 </p>
12684 !! html/parsoid
12685 <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>
12686 <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>
12687 !! end
12688
12689 !! test
12690 Alt image option should handle most kinds of wikitext without barfing
12691 !! wikitext
12692 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12693 !! html/php
12694 <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>
12695
12696 !! html/parsoid
12697 <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>
12698 !! end
12699
12700 ###################
12701 # Conflicting image format options.
12702 # First option specified should 'win'.
12703 # All three cases in each test should be identical.
12704
12705 !! test
12706 Image with 'frameless' first.
12707 !! options
12708 parsoid=wt2html,wt2wt,html2html
12709 !! wikitext
12710 [[File:Foobar.jpg|frameless|caption]]
12711
12712 [[File:Foobar.jpg|frameless|frame|caption]]
12713
12714 [[File:Foobar.jpg|frameless|thumb|caption]]
12715 !! html/php
12716 <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>
12717 </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>
12718 </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>
12719 </p>
12720 !! html/parsoid
12721 <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>
12722 <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>
12723 <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>
12724 !! end
12725
12726 !! test
12727 Image with 'frame' first.
12728 !! options
12729 parsoid=wt2html,wt2wt,html2html
12730 !! wikitext
12731 [[File:Foobar.jpg|frame|caption]]
12732 [[File:Foobar.jpg|frame|frameless|caption]]
12733 [[File:Foobar.jpg|frame|thumb|caption]]
12734 !! html/php
12735 <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>
12736 <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>
12737 <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>
12738
12739 !! html/parsoid
12740 <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>
12741 <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>
12742 <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>
12743 !! end
12744
12745 !! test
12746 Image with 'thumb' first.
12747 !! options
12748 parsoid=wt2html,wt2wt,html2html
12749 !! wikitext
12750 [[File:Foobar.jpg|thumb|caption]]
12751 [[File:Foobar.jpg|thumb|frameless|caption]]
12752 [[File:Foobar.jpg|thumb|frame|caption]]
12753 !! html/php
12754 <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>
12755 <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>
12756 <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>
12757
12758 !! html/parsoid
12759 <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>
12760 <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>
12761 <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>
12762 !! end
12763
12764 ###################
12765 # Image sizing.
12766 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12767 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12768 # Foobar has actual size of 1941x220
12769 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12770 # a scalable format.
12771 # 2. Framed images always ignore size options; always render at default size.
12772 # 3. "Unspecified format" and border are the only types which can be
12773 # enlarged.
12774
12775 !! test
12776 Image: "unspecified format" and border enlarge
12777 !! options
12778 parsoid=wt2html,wt2wt,html2html
12779 !! wikitext
12780 [[File:Foobar.jpg|2000px]]
12781
12782 [[File:Foobar.jpg|border|2000px]]
12783 !! html/php
12784 <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>
12785 </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>
12786 </p>
12787 !! html/parsoid
12788 <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>
12789 <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>
12790 !! end
12791
12792 !! test
12793 Image: "unspecified format" and border reduce
12794 !! options
12795 parsoid=wt2html,wt2wt,html2html
12796 !! wikitext
12797 [[File:Foobar.jpg|1000px]]
12798
12799 [[File:Foobar.jpg|border|1000px]]
12800 !! html/php
12801 <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>
12802 </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>
12803 </p>
12804 !! html/parsoid
12805 <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>
12806 <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>
12807 !! end
12808
12809 !! test
12810 Image: thumbs reduce
12811 !! options
12812 parsoid=wt2html,wt2wt,html2html
12813 !! wikitext
12814 [[File:Foobar.jpg|thumb|50px]]
12815 !! html/php
12816 <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>
12817
12818 !! html/parsoid
12819 <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>
12820 !! end
12821
12822 !! test
12823 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12824 !! options
12825 parsoid=wt2html,wt2wt,html2html
12826 !! wikitext
12827 [[File:Foobar.jpg|thumb|2000px]]
12828
12829 [[File:Foobar.svg|thumb|2000px]]
12830 !! html/php
12831 <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>
12832 <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>
12833
12834 !! html/parsoid
12835 <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>
12836 <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>
12837 !! end
12838
12839 !! test
12840 Image: frameless can reduce in size
12841 !! options
12842 parsoid=wt2html,wt2wt,html2html
12843 !! wikitext
12844 [[File:Foobar.jpg|frameless|50px]]
12845 !! html/php
12846 <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>
12847 </p>
12848 !! html/parsoid
12849 <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>
12850 !! end
12851
12852 !! test
12853 Image: bitmap frameless can't be enlarged past original size, but vector can
12854 !! options
12855 parsoid=wt2html,wt2wt,html2html
12856 !! wikitext
12857 [[File:Foobar.jpg|frameless|2000px]]
12858
12859 [[File:Foobar.svg|frameless|2000px]]
12860 !! html/php
12861 <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>
12862 </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>
12863 </p>
12864 !! html/parsoid
12865 <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>
12866 <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>
12867 !! end
12868
12869 !! test
12870 Image: framed images are always unscaled.
12871 !! options
12872 parsoid=wt2html,wt2wt,html2html
12873 !! wikitext
12874 [[File:Foobar.jpg|frame]]
12875
12876 [[File:Foobar.jpg|frame|50px]]
12877
12878 [[File:Foobar.jpg|frame|50x50px]]
12879
12880 [[File:Foobar.jpg|frame|2000px]]
12881 !! html/php
12882 <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>
12883 <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>
12884 <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>
12885 <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>
12886
12887 !! html/parsoid
12888 <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>
12889 <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>
12890 <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>
12891 <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>
12892 !! end
12893
12894 ###################
12895
12896 !! test
12897 Link to image page- image page normally doesn't exists, hence edit link
12898 Add test with existing image page
12899 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12900 !! wikitext
12901 [[:Image:test]]
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)">Image:test</a>
12904 </p>
12905 !! end
12906
12907 !! test
12908 bug 18784 Link to non-existent image page with caption should use caption as link text
12909 !! wikitext
12910 [[:Image:test|caption]]
12911 !! html
12912 <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>
12913 </p>
12914 !! end
12915
12916 !! test
12917 Frameless image caption with a free URL
12918 !! wikitext
12919 [[File:Foobar.jpg|http://example.com]]
12920 !! html/php
12921 <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>
12922 </p>
12923 !! html/parsoid
12924 <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>
12925 !! end
12926
12927 !! test
12928 Thumbnail image caption with a free URL
12929 !! options
12930 thumbsize=220
12931 !! wikitext
12932 [[File:Foobar.jpg|thumb|http://example.com]]
12933 !! html/php
12934 <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>
12935
12936 !! html/parsoid
12937 <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>
12938 !! end
12939
12940 !! test
12941 Thumbnail image caption with a free URL and explicit alt
12942 !! options
12943 thumbsize=220
12944 parsoid=wt2html,wt2wt,html2html
12945 !! wikitext
12946 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12947 !! html/php
12948 <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>
12949
12950 !! html/parsoid
12951 <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>
12952 !! end
12953
12954 !! test
12955 SVG thumbnails with no language set
12956 !! options
12957 !! wikitext
12958 [[File:Foobar.svg|thumb|caption]]
12959 !! html/php
12960 <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>
12961
12962 !! html/parsoid
12963 <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>
12964 !! end
12965
12966 !! test
12967 SVG thumbnails with language de
12968 !! options
12969 parsoid=wt2html,wt2wt,html2html
12970 !! wikitext
12971 [[File:Foobar.svg|thumb|caption|lang=de]]
12972 !! html/php
12973 <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>
12974
12975 !! html/parsoid
12976 <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>
12977 !! end
12978
12979 !! test
12980 SVG thumbnails with invalid language code
12981 !! options
12982 parsoid=wt2html,wt2wt,html2html
12983 !! wikitext
12984 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12985 !! html/php
12986 <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>
12987
12988 !! html/parsoid
12989 <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>
12990 !! end
12991
12992 !! test
12993 BUG 1887: A ISBN with a thumbnail
12994 !! wikitext
12995 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12996 !! html/php
12997 <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>
12998
12999 !! html/parsoid
13000 <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>
13001 !! end
13002
13003 !! test
13004 BUG 1887: A RFC with a thumbnail
13005 !! wikitext
13006 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13007 !! html/php
13008 <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>
13009
13010 !! html/parsoid
13011 <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>
13012 !! end
13013
13014 !! test
13015 BUG 1887: A mailto link with a thumbnail
13016 !! wikitext
13017 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13018 !! html/php
13019 <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>
13020
13021 !! html/parsoid
13022 <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>
13023 !! end
13024
13025 # Pending resolution to bug 368
13026 !! test
13027 BUG 648: Frameless image caption with a link
13028 !! wikitext
13029 [[File:Foobar.jpg|text with a [[link]] in it]]
13030 !! html/php
13031 <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>
13032 </p>
13033 !! html/parsoid
13034 <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>
13035 !! end
13036
13037 !! test
13038 BUG 648: Frameless image caption with a link (suffix)
13039 !! wikitext
13040 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13041 !! html/php
13042 <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>
13043 </p>
13044 !! html/parsoid
13045 <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>
13046 !! end
13047
13048 !! test
13049 BUG 648: Frameless image caption with an interwiki link
13050 !! wikitext
13051 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13052 !! html/php
13053 <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>
13054 </p>
13055 !! html/parsoid
13056 <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>
13057 !! end
13058
13059 !! test
13060 BUG 648: Frameless image caption with a piped interwiki link
13061 !! wikitext
13062 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13063 !! html/php
13064 <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>
13065 </p>
13066 !! html/parsoid
13067 <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>
13068 !! end
13069
13070 !! test
13071 Escape HTML special chars in image alt text
13072 !! wikitext
13073 [[File:Foobar.jpg|& < > "]]
13074 !! html/php
13075 <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>
13076 </p>
13077 !! html/parsoid
13078 <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>
13079 !! end
13080
13081 !! test
13082 BUG 499: Alt text should have &#1234;, not &amp;1234;
13083 !! wikitext
13084 [[File:Foobar.jpg|&#9792;]]
13085 !! html/php
13086 <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>
13087 </p>
13088 !! html/parsoid
13089 <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>
13090 !! end
13091
13092 !! test
13093 Broken image caption with link
13094 !! options
13095 parsoid=wt2html,wt2wt,html2html
13096 !! wikitext
13097 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13098 !! html/php
13099 <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.
13100 </p>
13101 !! html/parsoid
13102 <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>
13103 !! end
13104
13105 !! test
13106 Image caption containing another image
13107 !! wikitext
13108 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13109 !! html/php
13110 <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>
13111
13112 !! html/parsoid
13113 <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>
13114 !! end
13115
13116 !! test
13117 Image: caption containing a newline
13118 !! wikitext
13119 [[File:Foobar.jpg|This
13120 *is some text]]
13121 !! html/php
13122 <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>
13123 </p>
13124 !! html/parsoid
13125 <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>
13126 !!end
13127
13128 !!test
13129 Image: caption containing leading space
13130 (The leading space should not trigger nowiki escaping in wt2wt mode)
13131 !! wikitext
13132 [[File:Foobar.jpg|thumb| bar]]
13133 !! html/php
13134 <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>
13135
13136 !! html/parsoid
13137 <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>
13138 !!end
13139
13140 !! test
13141 Image: caption containing a table
13142 !! options
13143 parsoid=wt2html,wt2wt,html2html
13144 !! wikitext
13145 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13146 {|
13147 ! Foo !! Bar
13148 |-
13149 | Foo1 || Bar1
13150 |}
13151 and some more text.]]
13152 !! html/php
13153 <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>
13154
13155 !! html/parsoid
13156 <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
13157 <table>
13158 <tbody>
13159 <tr><th>Foo </th><th>Bar</th></tr>
13160 <tr>
13161 <td>Foo1 </td>
13162 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13163 !! end
13164
13165 !! test
13166 Bug 3090: External links other than http: in image captions
13167 !! wikitext
13168 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13169 !! html/php
13170 <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>
13171
13172 !! html/parsoid
13173 <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>
13174 !! end
13175
13176 !! test
13177 Custom class
13178 !! options
13179 parsoid=wt2html,wt2wt,html2html
13180 !! wikitext
13181 [[Image:foobar.jpg|a|class=b]]
13182 !! html/php
13183 <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>
13184 </p>
13185 !! html/parsoid
13186 <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>
13187 !! end
13188
13189 !! test
13190 Localized image handling (1).
13191 !! options
13192 parsoid=wt2html,wt2wt,html2html
13193 language=es
13194 !! wikitext
13195 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13196 !! html/php
13197 <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>
13198
13199 !! html/parsoid
13200 <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>
13201 !! end
13202
13203 !! test
13204 Localized image handling (2).
13205 !! options
13206 thumbsize=220
13207 parsoid=wt2html,wt2wt,html2html
13208 language=es
13209 !! wikitext
13210 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13211 !! html/php
13212 <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>
13213
13214 !! html/parsoid
13215 <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>
13216 !! end
13217
13218 !! test
13219 "border", "frameless" and "class" attributes on an image.
13220 !! options
13221 thumbsize=220
13222 parsoid=wt2html,wt2wt,html2html
13223 !! wikitext
13224 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13225 !! html/php
13226 <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>
13227 </p>
13228 !! html/parsoid
13229 <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>
13230 !! end
13231
13232 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13233 !! test
13234 Invalid image attributes (bug 62500)
13235 !! options
13236 thumbsize=220
13237 parsoid=wt2html,wt2wt,html2html
13238 !! wikitext
13239 [[File:Foobar.jpg|thumb|float|left|caption]]
13240
13241 [[File:Foobar.jpg|thumb|righ|caption]]
13242
13243 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13244 !! html/php
13245 <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>
13246 <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>
13247 <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>
13248
13249 !! html/parsoid
13250 <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>
13251 <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>
13252 <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>
13253 !! end
13254
13255 !! article
13256 File:Barfoo.jpg
13257 !! text
13258 #REDIRECT [[File:Barfoo.jpg]]
13259 !! endarticle
13260
13261 # FIXME: Parsoid should run this test -- but we'd need to teach the
13262 # mockAPI about the redirected Barfoo.jpg image.
13263 !! test
13264 Redirected image
13265 !! wikitext
13266 [[Image:Barfoo.jpg]]
13267 !! html/php
13268 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13269 </p>
13270 !! end
13271
13272 !! test
13273 Missing image with uploads disabled
13274 !! options
13275 wgEnableUploads=0
13276 !! wikitext
13277 [[File:Foobaz.jpg]]
13278 !! html/php
13279 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13280 </p>
13281 !! html/parsoid
13282 <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>
13283 !! end
13284
13285 # Parsoid-specific testing for images
13286 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13287 # Currently imperfect due to a flaw in the Parsoid testrunner
13288 # Work in progress
13289 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13290 # image tests.
13291
13292 !! test
13293 Parsoid-specific image handling - simple image with size and middle alignment
13294 !! wikitext
13295 [[File:Foobar.jpg|middle|50px]]
13296 !! html/parsoid
13297 <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>
13298 !! end
13299
13300 !! test
13301 Parsoid-specific image handling - simple image with size, middle alignment,
13302 non-standard namespace alias
13303 !! options
13304 parsoid=wt2wt,wt2html,html2html
13305 !! wikitext
13306 [[Image:Foobar.jpg|middle|50px]]
13307 !! html/parsoid
13308 <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>
13309 !! end
13310
13311 !! test
13312 Parsoid-specific image handling - simple image with size and middle alignment
13313 (existing content)
13314 !! wikitext
13315 [[File:Foobar.jpg|50px|middle]]
13316 !! html/parsoid
13317 <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>
13318 !! end
13319
13320 !! test
13321 Parsoid-specific image handling - simple image with size and middle alignment
13322 and non-standard namespace name
13323 !! options
13324 parsoid=wt2html,wt2wt,html2html
13325 !! wikitext
13326 [[Image:Foobar.jpg|50px|middle]]
13327 !! html/parsoid
13328 <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>
13329 !! end
13330
13331 !! test
13332 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13333 !! wikitext
13334 [[File:Foobar.jpg|500x10px|baseline|caption]]
13335 !! html/parsoid
13336 <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>
13337 !! end
13338
13339 !! test
13340 Parsoid-specific image handling - simple image with border and size spec
13341 !! wikitext
13342 [[File:Foobar.jpg|50px|border|caption]]
13343 !! html/parsoid
13344 <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>
13345 !! end
13346
13347 !! test
13348 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13349 !! wikitext
13350 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13351 !! html/parsoid
13352 <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>
13353 !! end
13354
13355 !! test
13356 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13357 (existing content)
13358 !! wikitext
13359 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13360 !! html/parsoid
13361 <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>
13362 !! end
13363
13364 !! test
13365 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13366 !! wikitext
13367 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13368 !! html/parsoid
13369 <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>
13370 !! end
13371
13372 !! test
13373 Parsoid-specific image handling - thumbnail with specific size, halign,
13374 valign, and caption (existing content)
13375 !! wikitext
13376 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13377 !! html/parsoid
13378 <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>
13379 !! end
13380
13381 !! test
13382 Parsoid-specific image handling - framed image with specific size and caption
13383 (size is ignored)
13384 !! options
13385 parsoid=wt2html,wt2wt,html2html
13386 !! wikitext
13387 [[File:Foobar.jpg|frame|500x50px|caption]]
13388 !! html/parsoid
13389 <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>
13390 !! end
13391
13392 !! test
13393 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13394 (size is ignored)
13395 !! options
13396 parsoid=wt2html,wt2wt,html2html
13397 !! wikitext
13398 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13399 !! html/parsoid
13400 <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>
13401 !! end
13402
13403 !! test
13404 Parsoid-specific image handling - frameless image with specific size, border, and caption
13405 !! wikitext
13406 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13407 !! html/parsoid
13408 <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>
13409 !! end
13410
13411 !! test
13412 Parsoid-specific image handling - simple image with a formatted caption
13413 !! wikitext
13414 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13415 !! html/parsoid
13416 <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>
13417 !! end
13418
13419 !! test
13420 Parsoid-specific image handling - caption with a template in it
13421 !! wikitext
13422 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13423 !! html/parsoid
13424 <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>
13425 !! end
13426
13427 !! test
13428 Parsoid-specific image handling - caption with unbalanced tags in it
13429 !! options
13430 parsoid=wt2html,wt2wt,html2html
13431 !! wikitext
13432 foo
13433 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13434 bar
13435 !! html/parsoid
13436 <p>foo</p>
13437 <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>
13438 <p>bar</p>
13439 !! end
13440
13441 !! test
13442 Parsoid-specific image handling - empty caption (1)
13443 !! options
13444 parsoid=wt2html,wt2wt
13445 !! wikitext
13446 [[File:Foobar.jpg|thumb|]]
13447 !! html/parsoid
13448 <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>
13449 !! end
13450
13451 # empty captions don't get serialized unless we're in the "round trip" case
13452 !! test
13453 Parsoid-specific image handling - empty caption (2)
13454 !! options
13455 parsoid=html2wt
13456 !! html/parsoid
13457 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13458 <a href="./File:Foobar.jpg">
13459 <img resource="./File:Foobar.jpg"
13460 src="//example.com/images/3/3a/Foobar.jpg"
13461 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13462 height="25" width="220"/>
13463 </a>
13464 <figcaption></figcaption>
13465 </figure>
13466 !! wikitext
13467 [[File:Foobar.jpg|thumb]]
13468 !! end
13469
13470 !! test
13471 Parsoid-specific image handling - whitespace caption
13472 !! wikitext
13473 [[File:Foobar.jpg|thumb| ]]
13474 !! html/parsoid
13475 <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>
13476 !! end
13477
13478 !! test
13479 Parsoid-specific image handling - lang option
13480 !! wikitext
13481 foo
13482 [[File:Foobar.svg|lang=de|caption]]
13483 bar
13484 !! html/parsoid
13485 <p>foo
13486 <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>
13487 bar</p>
13488 !! end
13489
13490
13491 ###
13492 ### Subpages
13493 ###
13494 !! article
13495 Subpage test/subpage
13496 !! text
13497 foo
13498 !! endarticle
13499
13500 !! test
13501 Subpage link
13502 !! options
13503 subpage title=[[Subpage test]]
13504 !! wikitext
13505 [[/subpage]]
13506 !! html
13507 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13508 </p>
13509 !! end
13510
13511 !! test
13512 Subpage noslash link
13513 !! options
13514 subpage title=[[Subpage test]]
13515 !! wikitext
13516 [[/subpage/]]
13517 !! html
13518 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13519 </p>
13520 !! end
13521
13522 !! article
13523 Subpage test/1/2/subpage
13524 !! text
13525 blah
13526 !! endarticle
13527
13528 !! test
13529 Relative subpage noslash link
13530 !! options
13531 parsoid=wt2wt,wt2html,html2html
13532 subpage title=[[Subpage test/1/2/3/4]]
13533 !! wikitext
13534 [[../../subpage/]]
13535
13536 [[../../subpage]]
13537 !! html/php
13538 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13539 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13540 </p>
13541 !! html/parsoid
13542 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13543 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13544 !! end
13545
13546 !! test
13547 Parsoid: dot-slash prefixed wikilinks
13548 !! wikitext
13549 [[./foo]]
13550
13551 [[././bar]]
13552
13553 [[././baz/]]
13554 !! html/php
13555 <p>[[./foo]]
13556 </p><p>[[././bar]]
13557 </p><p>[[././baz/]]
13558 </p>
13559 !! html/parsoid
13560 <p>[[./foo]]
13561 </p><p>[[././bar]]
13562 </p><p>[[././baz/]]
13563 </p>
13564 !! end
13565
13566 !! test
13567 Render invalid page names as plain text (bug 51090)
13568 !! wikitext
13569 [[./../foo|bar]]
13570 [[foo�|bar]]
13571 [[foo/.|bar]]
13572 [[foo/..|bar]]
13573 [[foo~~~bar]]
13574 [[foo>bar]]
13575 [[foo[bar]]
13576 [[.]]
13577 [[..]]
13578 [[foo././bar]]
13579
13580 [[{{echo|./../foo}}|bar]]
13581 [[{{echo|foo/.}}|bar]]
13582 [[{{echo|foo/..}}|bar]]
13583 [[{{echo|foo~~~~bar}}]]
13584 [[{{echo|foo>bar}}]]
13585 [[{{echo|foo././bar}}]]
13586 [[{{echo|foo{bar}}]]
13587 [[{{echo|foo}bar}}]]
13588 [[{{echo|foo[bar}}]]
13589 [[{{echo|foo]bar}}]]
13590 [[{{echo|foo<bar}}]]
13591 !!html/php
13592 <p>[[./../foo|bar]]
13593 [[foo�|bar]]
13594 [[foo/.|bar]]
13595 [[foo/..|bar]]
13596 [[foo~~~bar]]
13597 [[foo&gt;bar]]
13598 [[foo[bar]]
13599 [[.]]
13600 [[..]]
13601 [[foo././bar]]
13602 </p><p>[[./../foo|bar]]
13603 [[foo/.|bar]]
13604 [[foo/..|bar]]
13605 [[foo~~~~bar]]
13606 [[foo&gt;bar]]
13607 [[foo././bar]]
13608 [[foo{bar]]
13609 [[foo}bar]]
13610 [[foo[bar]]
13611 [[foo]bar]]
13612 [[foo&lt;bar]]
13613 </p>
13614 !!html/parsoid
13615 <p>[[./../foo|bar]]
13616 [[foo�|bar]]
13617 [[foo/.|bar]]
13618 [[foo/..|bar]]
13619 [[foo~~~bar]]
13620 [[foo>bar]]
13621 [[foo[bar]]
13622 [[.]]
13623 [[..]]
13624 [[foo././bar]]</p>
13625
13626 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13627 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13628 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13629 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13630 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13631 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13632 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13633 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13634 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13635 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13636 [[<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>
13637 !!end
13638
13639 !! test
13640 Disabled subpages
13641 !! wikitext
13642 [[/subpage]]
13643 !! html
13644 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13645 </p>
13646 !! end
13647
13648 !! test
13649 BUG 561: {{/Subpage}}
13650 !! options
13651 subpage title=[[Page]]
13652 !! wikitext
13653 {{/Subpage}}
13654 !! html
13655 <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>
13656 </p>
13657 !! end
13658
13659 ###
13660 ### Categories
13661 ###
13662 !! article
13663 Category:MediaWiki User's Guide
13664 !! text
13665 blah
13666 !! endarticle
13667
13668 !! test
13669 Link to category
13670 !! wikitext
13671 [[:Category:MediaWiki User's Guide]]
13672 !! html
13673 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13674 </p>
13675 !! end
13676
13677 !! test
13678 Simple category
13679 !! options
13680 cat
13681 !! wikitext
13682 [[Category:MediaWiki User's Guide]]
13683 !! html
13684 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13685 !! end
13686
13687 !! test
13688 PAGESINCATEGORY invalid title fatal (r33546 fix)
13689 !! wikitext
13690 {{PAGESINCATEGORY:<bogus>}}
13691 !! html
13692 <p>0
13693 </p>
13694 !! end
13695
13696 !! test
13697 Category with different sort key
13698 !! options
13699 cat
13700 !! wikitext
13701 [[Category:MediaWiki User's Guide|Foo]]
13702 !! html
13703 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13704 !! end
13705
13706 !! test
13707 Category with identical sort key
13708 !! options
13709 cat
13710 !! wikitext
13711 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13712 !! html
13713 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13714 !! end
13715
13716 !! test
13717 Category with empty sort key
13718 !! options
13719 cat
13720 pst
13721 !! wikitext
13722 [[Category:MediaWiki User's Guide|]]
13723 !! html
13724 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13725 !! end
13726
13727 !! test
13728 Category with empty sort key and parentheses
13729 !! options
13730 cat
13731 pst
13732 !! wikitext
13733 [[Category:Foo (bar)|]]
13734 !! html
13735 [[Category:Foo (bar)|Foo]]
13736 !! end
13737
13738 !! test
13739 Category with link tail
13740 !! options
13741 cat
13742 pst
13743 !! wikitext
13744 123[[Category:Foo]]456
13745 !! html
13746 123[[Category:Foo]]456
13747 !! end
13748
13749 !! test
13750 Category with template
13751 !! options
13752 cat
13753 pst
13754 !! wikitext
13755 [[Category:{{echo|Foo}}]]
13756 !! html
13757 [[Category:{{echo|Foo}}]]
13758 !! end
13759
13760 !! test
13761 Category with template in sort key
13762 !! options
13763 cat
13764 pst
13765 !! wikitext
13766 [[Category:Foo|{{echo|Bar}}]]
13767 !! html
13768 [[Category:Foo|{{echo|Bar}}]]
13769 !! end
13770
13771 !! test
13772 Category with template in sort key and title
13773 !! options
13774 cat
13775 pst
13776 !! wikitext
13777 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13778 !! html
13779 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13780 !! end
13781
13782 !! test
13783 Category / paragraph interactions
13784 !! wikitext
13785 Foo [[Category:Baz]] Bar
13786
13787 Foo [[Category:Baz]]
13788 Bar
13789
13790 Foo
13791 [[Category:Baz]]
13792 Bar
13793
13794 Foo
13795 [[Category:Baz]] Bar
13796
13797 Foo
13798 [[Category:Baz]]
13799 [[Category:Baz]]
13800 [[Category:Baz]]
13801 Bar
13802
13803 [[Category:Baz]]
13804 [[Category:Baz]]
13805 [[Category:Baz]]
13806
13807 [[Category:Baz]]
13808 {{echo|[[Category:Baz]]}}
13809 [[Category:Baz]]
13810 !! html
13811 <p>Foo Bar
13812 </p><p>Foo
13813 Bar
13814 </p><p>Foo
13815 Bar
13816 </p><p>Foo Bar
13817 </p><p>Foo
13818 Bar
13819 </p>
13820 !! end
13821
13822 ## The whitespace on the empty line is part of the test. Please do not delete
13823 !! test
13824 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13825 !! options
13826 parsoid=wt2html,wt2wt
13827 !! wikitext
13828 This
13829
13830 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
13831
13832 {{echo|[[Category:Foo]] and so should this!}}
13833 !! html
13834 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
13835 </p>
13836 !! html/parsoid
13837 <p>This
13838
13839 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
13840
13841 <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>
13842 !! end
13843
13844 ## Parsoid will not try to wt2wt this while preserving newlines because
13845 ## it suppresses excess newlines within list items -- and we don't want to
13846 ## introduce a special case just for categories, which is, in reality somewhat
13847 ## odd behavior -- categories are unlikely to be used in list items like this
13848 ## in top-level pages and are only likely to show up in template-generated
13849 ## list items where this RT-ing is a non-issue.
13850 ##
13851 ## The whitespace on the empty line is part of the test. Please do not delete
13852 !! test
13853 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13854 !! options
13855 parsoid=wt2html
13856 !! wikitext
13857 * This
13858
13859 [[Category:Foo]] and this should be part of the same list item
13860 * So should this
13861
13862 {{echo|[[Category:Foo]] and this should be part of the same list item}}
13863 !! html
13864 <ul><li>This and this should be part of the same list item</li>
13865 <li>So should this and this should be part of the same list item</li></ul>
13866 !! html/parsoid
13867 <ul>
13868 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
13869 <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>
13870 </ul>
13871 !! end
13872
13873 ## Newlines and categories that follow the last item of a list
13874 ## are treated differently because this (list followed by categories)
13875 ## is an extremely common pattern on wikis.
13876 !! test
13877 3. Categories and newlines: newline suppression for last list item should RT properly
13878 !! wikitext
13879 * a
13880 * b
13881
13882 [[Category:Foo]]
13883
13884 [[Category:Bar]]
13885 [[Category:Baz]]
13886 !! html/parsoid
13887 <ul><li> a</li>
13888 <li> b</li></ul>
13889
13890 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13891
13892 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13893 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13894 !! end
13895
13896 !! test
13897 4. Categories and newlines: newline suppression for last list item should RT properly
13898 !! wikitext
13899 * a
13900 **** b
13901
13902 [[Category:Foo]]
13903 !! html/parsoid
13904 <ul><li> a
13905 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
13906
13907 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13908 !! end
13909
13910 ## only wt2html for this to make sure the algo only applies to the rightmost path
13911 !! test
13912 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
13913 !! options
13914 parsoid=wt2html
13915 !! wikitext
13916 * a
13917 ** b
13918 [[Category:Foo]]
13919 * c
13920 ** d
13921 [[Category:Foo]]
13922 !! html/parsoid
13923 <ul><li> a
13924 <ul><li> b
13925 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
13926 <li> c
13927 <ul><li> d</li></ul></li></ul>
13928 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13929 !! end
13930
13931 !! test
13932 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
13933 !! wikitext
13934 * a [[Category:Foo]]
13935 !! html/parsoid
13936 <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>
13937 !! end
13938
13939 # This test also demonstrates because of newline+category tunneling
13940 # through the list hander, template wrapping doesn't expand to the
13941 # containing list when the list item swallows the category.
13942 !! test
13943 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
13944 !! wikitext
13945 * {{echo|a
13946 [[Category:Foo]]}}
13947 !! html/parsoid
13948 <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">
13949 </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>
13950 !! end
13951
13952 !! test
13953 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
13954 !! wikitext
13955 * a
13956
13957 {{echo|[[Category:Foo]]
13958 [[Category:Bar]]}}
13959 [[Category:Baz]]
13960 !! html/parsoid
13961 <ul><li> a</li></ul>
13962
13963 <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">
13964 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13965 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13966 !! end
13967
13968 !! test
13969 Parsoid: Serialize link to category page with colon escape
13970 !! options
13971 parsoid
13972 !! wikitext
13973
13974 [[:Category:Foo]]
13975 [[:Category:Foo|Bar]]
13976 !! html
13977 <p>
13978 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13979 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13980 </p>
13981 !! end
13982
13983 # html2wt localizes the "Category" namespace.
13984 # XXX the <link> element needs an empty data-parsoid attribute, or
13985 # else the html2html test fails because spaces are inserted.
13986 !! test
13987 Link prefix/suffixes aren't applied to category links
13988 !! options
13989 parsoid=wt2html,wt2wt,html2html
13990 language=is
13991 !! wikitext
13992 x[[Category:Foo]]y
13993 !! html/php
13994 <p>xy
13995 </p>
13996 !! html/parsoid
13997 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
13998 !! end
13999
14000 !! test
14001 Parsoid: Serialize link to file page with colon escape
14002 !! options
14003 parsoid
14004 !! wikitext
14005
14006 [[:File:Foo.png]]
14007 [[:File:Foo.png|Bar]]
14008 !! html
14009 <p>
14010 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14011 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14012 </p>
14013 !! end
14014
14015 !! test
14016 Parsoid: Serialize a genuine category link without colon escape
14017 !! options
14018 parsoid
14019 !! wikitext
14020 [[Category:Foo]]
14021 [[Category:Foo|Bar]]
14022 !! html
14023 <link rel="mw:PageProp/Category" href="Category:Foo">
14024 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
14025 !! end
14026
14027 !! test
14028 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14029 !! options
14030 parsoid=html2wt
14031 !! html
14032 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14033 !! wikitext
14034 [[Category:Toxine bactérienne]]
14035 !! end
14036
14037 !! test
14038 Parsoid: Defaultsort
14039 !! wikitext
14040 {{DEFAULTSORT:Foo}}
14041 !! html/parsoid
14042 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14043 !! end
14044
14045 !! test
14046 Parsoid: Defaultsort (template-generated)
14047 !! wikitext
14048 {{{{echo|DEFAULTSORT}}:Foo}}
14049 !! html/parsoid
14050 <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}}]}'/>
14051 !! end
14052
14053 ###
14054 ### Inter-language links
14055 ###
14056 !! test
14057 Interlanguage links
14058 !! options
14059 ill
14060 !! wikitext
14061 [[es:Alimento]]
14062 [[fr:Nourriture]]
14063 [[zh:食品]]
14064 !! html/php
14065 es:Alimento fr:Nourriture zh:食品
14066 !! html/parsoid
14067 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14068 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14069 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14070 !! end
14071
14072 !! test
14073 Duplicate interlanguage links (bug 24502)
14074 !! options
14075 ill
14076 !! wikitext
14077 [[es:1]]
14078 [[es:2]]
14079 [[fr:1]]
14080 [[fr:2]]
14081 !! html/php
14082 es:1 fr:1
14083 !! html/parsoid
14084 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14085 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14086 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14087 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14088 !! end
14089
14090 ###
14091 ### Sections
14092 ###
14093 !! test
14094 Basic section headings
14095 !! wikitext
14096 == Headline 1 ==
14097 Some text
14098
14099 ==Headline 2==
14100 More
14101 ===Smaller headline===
14102 Blah blah
14103 !! html
14104 <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>
14105 <p>Some text
14106 </p>
14107 <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>
14108 <p>More
14109 </p>
14110 <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>
14111 <p>Blah blah
14112 </p>
14113 !! end
14114
14115 !! test
14116 Section headings with TOC
14117 !! wikitext
14118 == Headline 1 ==
14119 === Subheadline 1 ===
14120 ===== Skipping a level =====
14121 ====== Skipping a level ======
14122
14123 == Headline 2 ==
14124 Some text
14125 ===Another headline===
14126 !! html
14127 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14128 <ul>
14129 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14130 <ul>
14131 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14132 <ul>
14133 <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>
14134 <ul>
14135 <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>
14136 </ul>
14137 </li>
14138 </ul>
14139 </li>
14140 </ul>
14141 </li>
14142 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14143 <ul>
14144 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14145 </ul>
14146 </li>
14147 </ul>
14148 </div>
14149
14150 <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>
14151 <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>
14152 <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>
14153 <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>
14154 <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>
14155 <p>Some text
14156 </p>
14157 <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>
14158
14159 !! end
14160
14161 !! test
14162 TOC anchors don't collide
14163 !! wikitext
14164 __FORCETOC__
14165 == Headline 2 ==
14166 == Headline ==
14167 == Headline 2 ==
14168 == Headline ==
14169 !! html/php
14170 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14171 <ul>
14172 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14173 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14174 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14175 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14176 </ul>
14177 </div>
14178
14179 <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>
14180 <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>
14181 <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>
14182 <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>
14183
14184 !! end
14185
14186 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14187 !! test
14188 Handling of sections up to level 6 and beyond
14189 !! wikitext
14190 = Level 1 Heading=
14191 == Level 2 Heading==
14192 === Level 3 Heading===
14193 ==== Level 4 Heading====
14194 ===== Level 5 Heading=====
14195 ====== Level 6 Heading======
14196 ======= Level 7 Heading=======
14197 ======== Level 8 Heading========
14198 ========= Level 9 Heading=========
14199 ========== Level 10 Heading==========
14200 !! html
14201 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14202 <ul>
14203 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14204 <ul>
14205 <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>
14206 <ul>
14207 <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>
14208 <ul>
14209 <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>
14210 <ul>
14211 <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>
14212 <ul>
14213 <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>
14214 <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>
14215 <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>
14216 <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>
14217 <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>
14218 </ul>
14219 </li>
14220 </ul>
14221 </li>
14222 </ul>
14223 </li>
14224 </ul>
14225 </li>
14226 </ul>
14227 </li>
14228 </ul>
14229 </div>
14230
14231 <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>
14232 <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>
14233 <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>
14234 <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>
14235 <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>
14236 <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>
14237 <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>
14238 <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>
14239 <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>
14240 <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>
14241
14242 !! end
14243
14244 !! test
14245 TOC regression (T11764)
14246 !! wikitext
14247 == title 1 ==
14248 === title 1.1 ===
14249 ==== title 1.1.1 ====
14250 === title 1.2 ===
14251 == title 2 ==
14252 === title 2.1 ===
14253 !! html
14254 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14255 <ul>
14256 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14257 <ul>
14258 <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>
14259 <ul>
14260 <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>
14261 </ul>
14262 </li>
14263 <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>
14264 </ul>
14265 </li>
14266 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14267 <ul>
14268 <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>
14269 </ul>
14270 </li>
14271 </ul>
14272 </div>
14273
14274 <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>
14275 <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>
14276 <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>
14277 <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>
14278 <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>
14279 <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>
14280
14281 !! end
14282
14283 !! test
14284 TOC for heading containing <span id="..."></span> (T96153)
14285 !! wikitext
14286 __FORCETOC__
14287 ==<span id="old-anchor"></span>New title==
14288 !! html/php
14289 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14290 <ul>
14291 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14292 </ul>
14293 </div>
14294
14295 <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>
14296
14297 !! end
14298
14299 !! test
14300 TOC with wgMaxTocLevel=3 (bug 6204)
14301 !! options
14302 wgMaxTocLevel=3
14303 !! wikitext
14304 == title 1 ==
14305 === title 1.1 ===
14306 ==== title 1.1.1 ====
14307 === title 1.2 ===
14308 == title 2 ==
14309 === title 2.1 ===
14310 !! html
14311 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14312 <ul>
14313 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14314 <ul>
14315 <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>
14316 <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>
14317 </ul>
14318 </li>
14319 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14320 <ul>
14321 <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>
14322 </ul>
14323 </li>
14324 </ul>
14325 </div>
14326
14327 <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>
14328 <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>
14329 <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>
14330 <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>
14331 <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>
14332 <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>
14333
14334 !! end
14335
14336 !! test
14337 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14338 !! options
14339 wgMaxTocLevel=3
14340 !! wikitext
14341 ==Section 1==
14342 ===Section 1.1===
14343 ====Section 1.1.1====
14344 ====Section 1.1.1.1====
14345 ==Section 2==
14346 !! html
14347 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14348 <ul>
14349 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14350 <ul>
14351 <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>
14352 </ul>
14353 </li>
14354 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14355 </ul>
14356 </div>
14357
14358 <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>
14359 <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>
14360 <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>
14361 <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>
14362 <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>
14363
14364 !! end
14365
14366
14367 !! test
14368 Resolving duplicate section names
14369 !! wikitext
14370 == Foo bar ==
14371 == Foo bar ==
14372 !! html
14373 <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>
14374 <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>
14375
14376 !! end
14377
14378 !! test
14379 Resolving duplicate section names with differing case (bug 10721)
14380 !! wikitext
14381 == Foo bar ==
14382 == Foo Bar ==
14383 !! html
14384 <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>
14385 <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>
14386
14387 !! end
14388
14389 !! article
14390 Template:sections
14391 !! text
14392 ===Section 1===
14393 ==Section 2==
14394 !! endarticle
14395
14396 !! test
14397 Template with sections, __NOTOC__
14398 !! wikitext
14399 __NOTOC__
14400 ==Section 0==
14401 {{sections}}
14402 ==Section 4==
14403 !! html
14404 <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>
14405 <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>
14406 <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>
14407 <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>
14408
14409 !! end
14410
14411 !! test
14412 __NOEDITSECTION__ keyword
14413 !! wikitext
14414 __NOEDITSECTION__
14415 ==Section 1==
14416 ==Section 2==
14417 !! html
14418 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14419 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14420
14421 !! end
14422
14423 !! test
14424 Link inside a section heading
14425 !! wikitext
14426 ==Section with a [[Main Page|link]] in it==
14427 !! html
14428 <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>
14429
14430 !! end
14431
14432 !! test
14433 TOC regression (T14077)
14434 !! wikitext
14435 __TOC__
14436 == title 1 ==
14437 === title 1.1 ===
14438 == title 2 ==
14439 !! html
14440 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14441 <ul>
14442 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14443 <ul>
14444 <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>
14445 </ul>
14446 </li>
14447 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14448 </ul>
14449 </div>
14450
14451 <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>
14452 <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>
14453 <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>
14454
14455 !! end
14456
14457 !! test
14458 BUG 1219 URL next to image (good)
14459 !! wikitext
14460 http://example.com [[File:Foobar.jpg]]
14461 !! html/php
14462 <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>
14463 </p>
14464 !! html/parsoid
14465 <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>
14466 !!end
14467
14468 !! test
14469 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14470 !! wikitext
14471 ===
14472 The line above must have a trailing space!
14473 === <!--
14474 --> <!-- -->
14475 But just in case it doesn't...
14476 !! html
14477 <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>
14478 <p>The line above must have a trailing space!
14479 </p>
14480 <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>
14481 <p>But just in case it doesn't...
14482 </p>
14483 !! end
14484
14485 !! test
14486 Header with special characters (bug 25462)
14487 !! wikitext
14488 The tooltips shall not show entities to the user (ie. be double escaped)
14489
14490 == text > text ==
14491 section 1
14492
14493 == text < text ==
14494 section 2
14495
14496 == text & text ==
14497 section 3
14498
14499 == text ' text ==
14500 section 4
14501
14502 == text " text ==
14503 section 5
14504 !! html
14505 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14506 </p>
14507 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14508 <ul>
14509 <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>
14510 <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>
14511 <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>
14512 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14513 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14514 </ul>
14515 </div>
14516
14517 <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>
14518 <p>section 1
14519 </p>
14520 <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>
14521 <p>section 2
14522 </p>
14523 <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>
14524 <p>section 3
14525 </p>
14526 <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>
14527 <p>section 4
14528 </p>
14529 <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>
14530 <p>section 5
14531 </p>
14532 !! end
14533
14534 !! test
14535 Header with space, plus and underscore as entity
14536 !! wikitext
14537 Id should not contain + for spaces
14538
14539 == Space between Text ==
14540 section 1
14541
14542 == Space-Entity&#32;between&#32;Text ==
14543 section 2
14544
14545 == Plus+between+Text ==
14546 section 3
14547
14548 == Plus-Entity&#43;between&#43;Text ==
14549 section 4
14550
14551 == Underscore_between_Text ==
14552 section 5
14553
14554 == Underscore-Entity&#95;between&#95;Text ==
14555 section 6
14556
14557 [[#Space between Text]]
14558 [[#Space-Entity&#32;between&#32;Text]]
14559 [[#Plus+between+Text]]
14560 [[#Plus-Entity&#43;between&#43;Text]]
14561 [[#Underscore_between_Text]]
14562 [[#Underscore-Entity&#95;between&#95;Text]]
14563 !! html
14564 <p>Id should not contain + for spaces
14565 </p>
14566 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14567 <ul>
14568 <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>
14569 <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>
14570 <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>
14571 <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>
14572 <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>
14573 <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>
14574 </ul>
14575 </div>
14576
14577 <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>
14578 <p>section 1
14579 </p>
14580 <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>
14581 <p>section 2
14582 </p>
14583 <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>
14584 <p>section 3
14585 </p>
14586 <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>
14587 <p>section 4
14588 </p>
14589 <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>
14590 <p>section 5
14591 </p>
14592 <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>
14593 <p>section 6
14594 </p><p><a href="#Space_between_Text">#Space between Text</a>
14595 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14596 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14597 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14598 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14599 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14600 </p>
14601 !! end
14602
14603 !! test
14604 Headers with excess '=' characters
14605 (Are similar tests necessary beyond the 1st level?)
14606 !! wikitext
14607 =foo==
14608 ==foo=
14609 =''italic'' heading==
14610 ==''italic'' heading=
14611 !! html
14612 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14613 <ul>
14614 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14615 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14616 <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>
14617 <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>
14618 </ul>
14619 </div>
14620
14621 <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>
14622 <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>
14623 <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>
14624 <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>
14625
14626 !! end
14627
14628 !! test
14629 HTML headers vs TOC (bug 23393)
14630 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14631 !! wikitext
14632 <h1>Header 1</h1>
14633 == Header 1.1 ==
14634 == Header 1.2 ==
14635
14636 <h1>Header 2
14637 </h1>
14638 == Header 2.1 ==
14639 == Header 2.2 ==
14640 __NOEDITSECTION__
14641 !! html
14642 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14643 <ul>
14644 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14645 <ul>
14646 <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>
14647 <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>
14648 </ul>
14649 </li>
14650 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14651 <ul>
14652 <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>
14653 <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>
14654 </ul>
14655 </li>
14656 </ul>
14657 </div>
14658
14659 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14660 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14661 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14662 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14663 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14664 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14665
14666 !! end
14667
14668 !! test
14669 Single-line or multiline-comments can follow headings
14670 !! options
14671 parsoid=wt2html,wt2wt
14672 !! wikitext
14673 ==foo==<!---->
14674 ==bar==<!--c1-->
14675 ==baz==<!--
14676 c2
14677 c3-->
14678 !! html
14679 <h2><span class="mw-headline" id="foo">foo</span></h2>
14680 <h2><span class="mw-headline" id="bar">bar</span></h2>
14681 <h2><span class="mw-headline" id="baz">baz</span></h2>
14682
14683 !! end
14684
14685 !! test
14686 BUG 1219 URL next to image (broken)
14687 !! wikitext
14688 http://example.com[[File:Foobar.jpg]]
14689 !! html/php
14690 <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>
14691 </p>
14692 !! html/parsoid
14693 <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>
14694 !!end
14695
14696 !! test
14697 Bug 1186 news: in the middle of text
14698 !! wikitext
14699 http://en.wikinews.org/wiki/Wikinews:Workplace
14700 !! html
14701 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14702 </p>
14703 !!end
14704
14705
14706 !! test
14707 Namespaced link must have a title
14708 !! wikitext
14709 [[Project:]]
14710 !! html
14711 <p>[[Project:]]
14712 </p>
14713 !!end
14714
14715 !! test
14716 Namespaced link must have a title (bad fragment version)
14717 !! wikitext
14718 [[Project:#fragment]]
14719 !! html
14720 <p>[[Project:#fragment]]
14721 </p>
14722 !!end
14723
14724
14725 ###
14726 ### HTML tags and HTML attributes
14727 ###
14728
14729 !! test
14730 div with no attributes
14731 !! wikitext
14732 <div>HTML rocks</div>
14733 !! html
14734 <div>HTML rocks</div>
14735
14736 !! end
14737
14738 !! test
14739 div with double-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 single-quoted 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 unquoted attribute
14758 !! wikitext
14759 <div id=rock>HTML rocks</div>
14760 !! html
14761 <div id="rock">HTML rocks</div>
14762
14763 !! end
14764
14765 !! test
14766 div with illegal double attributes
14767 !! wikitext
14768 <div id="a" id="b">HTML rocks</div>
14769 !! html
14770 <div id="b">HTML rocks</div>
14771
14772 !!end
14773
14774 # FIXME: produce empty string instead of "class" in the PHP parser, following
14775 # the HTML5 spec.
14776 !! test
14777 div with empty attribute value, space before equals
14778 !! options
14779 parsoid
14780 !! wikitext
14781 <div class =>HTML rocks</div>
14782 !! html
14783 <div class="">HTML rocks</div>
14784
14785 !! end
14786
14787 !! test
14788 div with multiple empty attribute values
14789 !! options
14790 parsoid
14791 !! wikitext
14792 <div id= title=>HTML rocks</div>
14793 !! html
14794 <div id="" title="">HTML rocks</div>
14795
14796 !! end
14797
14798 !! test
14799 table with multiple empty attribute values
14800 !! options
14801 parsoid
14802 !! wikitext
14803 {| title= id=
14804 | hi
14805 |}
14806 !! html
14807 <table title="" id="">
14808 <tbody><tr><td> hi</td></tr>
14809 </tbody></table>
14810 !! end
14811
14812 !! test
14813 div with braces in attribute value
14814 !! wikitext
14815 <div title="{}">Foo</div>
14816 !! html/php
14817 <div title="&#123;}">Foo</div>
14818
14819 !! html/parsoid
14820 <div title="{}">Foo</div>
14821 !! end
14822
14823 # This it very inconsistent in the PHP parser: it returns
14824 # class="class" if there is a space between the name and the equal sign (see
14825 # 'div with empty attribute value, space before equals'), but strips the
14826 # attribute completely if the space is missing. We hope that not much content
14827 # depends on this, so are implementing the behavior below in Parsoid for
14828 # consistencies' sake.
14829 # FIXME: fix this behavior in the PHP parser?
14830 !! test
14831 div with empty attribute value, no space before equals
14832 !! options
14833 parsoid=wt2html,html2html
14834 !! wikitext
14835 <div class=>HTML rocks</div>
14836 !! html/php
14837 <div>HTML rocks</div>
14838
14839 !! html/parsoid
14840 <div class="">HTML rocks</div>
14841 !! end
14842
14843 !! test
14844 HTML multiple attributes correction
14845 !! wikitext
14846 <p class="error" class="awesome">Awesome!</p>
14847 !! html
14848 <p class="awesome">Awesome!</p>
14849
14850 !!end
14851
14852 !! test
14853 Table multiple attributes correction
14854 !! wikitext
14855 {|
14856 !+ class="error" class="awesome"| status
14857 |}
14858 !! html
14859 <table>
14860 <tr>
14861 <th class="awesome"> status
14862 </th></tr></table>
14863
14864 !!end
14865
14866 !! test
14867 DIV IN UPPERCASE
14868 !! wikitext
14869 <DIV ID="x">HTML ROCKS</DIV>
14870 !! html
14871 <div id="x">HTML ROCKS</div>
14872
14873 !!end
14874
14875 !! test
14876 Non-ASCII pseudo-tags are rendered as text
14877 !! wikitext
14878 <khyô>
14879 !! html
14880 <p>&lt;khyô&gt;
14881 </p>
14882 !! end
14883
14884 !! test
14885 Pseudo-tag with URL 'name' renders as url link
14886 !! wikitext
14887 <http://example.com/>
14888 !! html
14889 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14890 </p>
14891 !! end
14892
14893 !! test
14894 text with amp in the middle of nowhere
14895 !! wikitext
14896 Remember AT&T?
14897 !! html
14898 <p>Remember AT&amp;T?
14899 </p>
14900 !! end
14901
14902 !! test
14903 text with character entity: eacute
14904 !! wikitext
14905 I always thought &eacute; was a cute letter.
14906 !! html
14907 <p>I always thought &#233; was a cute letter.
14908 </p>
14909 !! html+tidy
14910 <p>I always thought é was a cute letter.</p>
14911 !! end
14912
14913 !! test
14914 text with entity-escaped character entity-like string: eacute
14915 !! wikitext
14916 I always thought &amp;eacute; was a cute letter.
14917 !! html
14918 <p>I always thought &amp;eacute; was a cute letter.
14919 </p>
14920 !! end
14921
14922 !! test
14923 text with undefined character entity: xacute
14924 !! wikitext
14925 I always thought &xacute; was a cute letter.
14926 !! html
14927 <p>I always thought &amp;xacute; was a cute letter.
14928 </p>
14929 !! end
14930
14931 # TODO: generalize to PHP parser?
14932 !! test
14933 HTML5 tags
14934 !! options
14935 parsoid
14936 !! wikitext
14937 <data value="5">five</data>
14938 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14939 <mark>This highlighted text</mark>
14940 !! html
14941 <p><data value="5">five</data>
14942 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14943 <mark>This highlighted text</mark></p>
14944 !! end
14945
14946 !! test
14947 HTML tag with leading space is parsed as text
14948 !! wikitext
14949 < div>foo< /div>
14950 !! html
14951 <p>&lt; div&gt;foo&lt; /div&gt;
14952 </p>
14953 !! end
14954
14955 ###
14956 ### Nesting tests (see bug 41545, 50604, 51081)
14957 ###
14958
14959 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14960 # Note that html2wt is considerably more difficult if we use <b> in
14961 # the test case, instead of <big>
14962 !! test
14963 Ensure that HTML adoption agency algorithm is properly implemented.
14964 !! wikitext
14965 <big>X<big>Y</big>Z</big>
14966 !! html
14967 <p><big>X<big>Y</big>Z</big>
14968 </p>
14969 !! end
14970
14971 # This was bug 41545 in the PHP parser.
14972 # Note that tidy doesn't handle this correctly.
14973 !! test
14974 Nesting of <kbd>
14975 !! wikitext
14976 <kbd>X<kbd>Y</kbd>Z</kbd>
14977 !! html
14978 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14979 </p>
14980 !! end
14981
14982 # The following cases were bug 51081 in the PHP parser.
14983 # Note that there are some other nestable tags (b, i, etc) which are
14984 # not covered; see bug 51081 for discussion.
14985
14986 # Note that tidy doesn't handle this correctly.
14987 !! test
14988 Nesting of <em>
14989 !! wikitext
14990 <em>X<em>Y</em>Z</em>
14991 !! html
14992 <p><em>X<em>Y</em>Z</em>
14993 </p>
14994 !! end
14995
14996 # Note that tidy doesn't handle this correctly.
14997 !! test
14998 Nesting of <strong>
14999 !! wikitext
15000 <strong>X<strong>Y</strong>Z</strong>
15001 !! html
15002 <p><strong>X<strong>Y</strong>Z</strong>
15003 </p>
15004 !! end
15005
15006 !! test
15007 Nesting of <q>
15008 !! wikitext
15009 <q>X<q>Y</q>Z</q>
15010 !! html+tidy
15011 <p><q>X<q>Y</q>Z</q></p>
15012 !! end
15013
15014 # Note that tidy doesn't handle this correctly.
15015 !! test
15016 Nesting of <ruby>
15017 !! wikitext
15018 <ruby>X<ruby>Y</ruby>Z</ruby>
15019 !! html
15020 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15021 </p>
15022 !! end
15023
15024 # Note that tidy doesn't handle this correctly.
15025 !! test
15026 Nesting of <bdo>
15027 !! wikitext
15028 <bdo>X<bdo>Y</bdo>Z</bdo>
15029 !! html
15030 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15031 </p>
15032 !! end
15033
15034
15035 ###
15036 ### Media links
15037 ###
15038
15039 !! test
15040 Media link
15041 !! wikitext
15042 [[Media:Foobar.jpg]]
15043 !! html
15044 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15045 </p>
15046 !! end
15047
15048 !! test
15049 Media link with text
15050 !! wikitext
15051 [[Media:Foobar.jpg|A neat file to look at]]
15052 !! html
15053 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15054 </p>
15055 !! end
15056
15057 # FIXME: this is still bad HTML tag nesting
15058 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15059 !! test
15060 Media link with nasty text
15061 !! wikitext
15062 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15063 !! html
15064 <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>
15065
15066 !! html+tidy
15067 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15068 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15069 !! end
15070
15071 !! test
15072 Media link to nonexistent file (bug 1702)
15073 !! wikitext
15074 [[Media:No such.jpg]]
15075 !! html
15076 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15077 </p>
15078 !! end
15079
15080 !! test
15081 Image link to nonexistent file (bug 1850 - good)
15082 !! wikitext
15083 [[File:No_such.jpg]]
15084 !! html/php
15085 <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>
15086 </p>
15087 !! html/parsoid
15088 <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>
15089 !! end
15090
15091 !! test
15092 :Image link to nonexistent file (bug 1850 - bad)
15093 !! wikitext
15094 [[:Image:No such.jpg]]
15095 !! html/php
15096 <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>
15097 </p>
15098 !! html/parsoid
15099 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15100 !! end
15101
15102
15103
15104 !! test
15105 Character reference normalization in link text (bug 1938)
15106 !! wikitext
15107 [[Main Page|this&that]]
15108 !! html
15109 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15110 </p>
15111 !!end
15112
15113 !! article
15114 אַ
15115 !! text
15116 Test for unicode normalization
15117
15118 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15119 !! endarticle
15120
15121 !! test
15122 (bug 19451) Links should refer to the normalized form.
15123 !! wikitext
15124 [[&#xFB2E;]]
15125 [[&#x5d0;&#x5b7;]]
15126 [[&#x5d0;ַ]]
15127 [[א&#x5b7;]]
15128 [[אַ]]
15129 !! html
15130 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15131 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15132 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15133 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15134 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15135 </p>
15136 !! end
15137
15138 !! test
15139 Empty attribute crash test (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 Empty attribute crash test single-quotes (bug 2067)
15149 !! wikitext
15150 <font color=''>foo</font>
15151 !! html
15152 <p><font color="">foo</font>
15153 </p>
15154 !! end
15155
15156 !! test
15157 Attribute test: equals, then nothing
15158 !! wikitext
15159 <font color=>foo</font>
15160 !! html
15161 <p><font>foo</font>
15162 </p>
15163 !! end
15164
15165 !! test
15166 Attribute test: unquoted value
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: unquoted but illegal value (hash)
15176 !! wikitext
15177 <font color=#x>foo</font>
15178 !! html
15179 <p><font color="#x">foo</font>
15180 </p>
15181 !! end
15182
15183 !! test
15184 Attribute test: no value
15185 !! wikitext
15186 <font color>foo</font>
15187 !! html
15188 <p><font color="color">foo</font>
15189 </p>
15190 !! end
15191
15192 !! test
15193 Bug 2095: link with three closing brackets
15194 !! wikitext
15195 [[Main Page]]]
15196 !! html/php
15197 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15198 </p>
15199 !! html/parsoid
15200 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15201 !! end
15202
15203 !! test
15204 Bug 2095: link with pipe and three closing brackets
15205 !! wikitext
15206 [[Main Page|link]]]
15207 !! html/php
15208 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15209 </p>
15210 !! html/parsoid
15211 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15212 !! end
15213
15214 !! test
15215 Bug 2095: link with pipe and three closing brackets, version 2
15216 !! wikitext
15217 [[Main Page|[http://example.com/]]]
15218 !! html/php
15219 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15220 </p>
15221 !! html/parsoid
15222 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15223 !! end
15224
15225
15226 ###
15227 ### Safety
15228 ###
15229
15230 !! article
15231 Template:Dangerous attribute
15232 !! text
15233 " onmouseover="alert(document.cookie)
15234 !! endarticle
15235
15236 !! article
15237 Template:Dangerous style attribute
15238 !! text
15239 border-size: expression(alert(document.cookie))
15240 !! endarticle
15241
15242 !! article
15243 Template:Div style
15244 !! text
15245 <div style="float: right; {{{1}}}">Magic div</div>
15246 !! endarticle
15247
15248 !! test
15249 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15250 !! wikitext
15251 <div title="{{test}}"></div>
15252 !! html
15253 <div title="This is a test template"></div>
15254
15255 !! end
15256
15257 # Parsoid has enough context to handle this case
15258 !! test
15259 Bug 2304: HTML attribute safety (dangerous template; 2309)
15260 !! wikitext
15261 <div title="{{dangerous attribute}}"></div>
15262 !! html/php
15263 <div title=""></div>
15264
15265 !! html/parsoid
15266 <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>
15267 !! end
15268
15269 !! test
15270 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15271 !! wikitext
15272 <div style="{{dangerous style attribute}}"></div>
15273 !! html
15274 <div style="/* insecure input */"></div>
15275
15276 !! end
15277
15278 !! test
15279 Bug 2304: HTML attribute safety (safe parameter; 2309)
15280 !! wikitext
15281 {{div style|width: 200px}}
15282 !! html
15283 <div style="float: right; width: 200px">Magic div</div>
15284
15285 !! end
15286
15287 !! test
15288 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15289 !! wikitext
15290 {{div style|width: expression(alert(document.cookie))}}
15291 !! html
15292 <div style="/* insecure input */">Magic div</div>
15293
15294 !! end
15295
15296 !! test
15297 Bug 2304: HTML attribute safety (unsafe breakout parameter; 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 (unsafe breakout parameter 2; 2309)
15307 !! wikitext
15308 {{div style|" ><script>alert(document.cookie)</script>}}
15309 !! html
15310 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15311
15312 !! end
15313
15314 !! test
15315 Bug 2304: HTML attribute safety (link)
15316 !! wikitext
15317 <div title="[[Main Page]]"></div>
15318 !! html
15319 <div title="&#91;&#91;Main Page]]"></div>
15320
15321 !! end
15322
15323 !! test
15324 Bug 2304: HTML attribute safety (italics)
15325 !! wikitext
15326 <div title="''foobar''"></div>
15327 !! html
15328 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15329
15330 !! end
15331
15332 !! test
15333 Bug 2304: HTML attribute safety (bold)
15334 !! wikitext
15335 <div title="'''foobar'''"></div>
15336 !! html
15337 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15338
15339 !! end
15340
15341
15342 !! test
15343 Bug 2304: HTML attribute safety (ISBN)
15344 !! wikitext
15345 <div title="ISBN 1234567890"></div>
15346 !! html
15347 <div title="&#73;SBN 1234567890"></div>
15348
15349 !! end
15350
15351 !! test
15352 Bug 2304: HTML attribute safety (RFC)
15353 !! wikitext
15354 <div title="RFC 1234"></div>
15355 !! html
15356 <div title="&#82;FC 1234"></div>
15357
15358 !! end
15359
15360 !! test
15361 Bug 2304: HTML attribute safety (PMID)
15362 !! wikitext
15363 <div title="PMID 1234567890"></div>
15364 !! html
15365 <div title="&#80;MID 1234567890"></div>
15366
15367 !! end
15368
15369 !! test
15370 Bug 2304: HTML attribute safety (web link)
15371 !! wikitext
15372 <div title="http://example.com/"></div>
15373 !! html
15374 <div title="http&#58;//example.com/"></div>
15375
15376 !! end
15377
15378 !! test
15379 Bug 2304: HTML attribute safety (named web link)
15380 !! wikitext
15381 <div title="[http://example.com/ link]"></div>
15382 !! html
15383 <div title="&#91;http&#58;//example.com/ link]"></div>
15384
15385 !! end
15386
15387 !! test
15388 Bug 3244: HTML attribute safety (extension; safe)
15389 !! wikitext
15390 <div style="<nowiki>background:blue</nowiki>"></div>
15391 !! html
15392 <div style="background:blue"></div>
15393
15394 !! end
15395
15396 !! test
15397 Bug 3244: HTML attribute safety (extension; unsafe)
15398 !! wikitext
15399 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15400 !! html
15401 <div style="/* insecure input */"></div>
15402
15403 !! end
15404
15405 # More MSIE fun discovered by Tom Gilder
15406
15407 !! test
15408 MSIE CSS safety test: spurious slash
15409 !! wikitext
15410 <div style="background-image:u\rl(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: hex code
15418 !! wikitext
15419 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15420 !! html
15421 <div style="/* insecure input */">evil</div>
15422
15423 !! end
15424
15425 !! test
15426 MSIE CSS safety test: comment in url
15427 !! wikitext
15428 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15429 !! html
15430 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15431
15432 !! end
15433
15434 !! test
15435 MSIE CSS safety test: comment in expression
15436 !! wikitext
15437 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15438 !! html
15439 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15440
15441 !! end
15442
15443 !! test
15444 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15445 !! wikitext
15446 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15447 !! html
15448 <p style="/* invalid control char */">A</p>
15449
15450 !! end
15451
15452 !! test
15453 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15454 !! wikitext
15455 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15456 <div style="top:EXPRESSION(alert())">B</div>
15457 !! html
15458 <p style="/* insecure input */">A</p>
15459 <div style="/* insecure input */">B</div>
15460
15461 !! end
15462
15463 !! test
15464 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15465 !! wikitext
15466 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15467 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15468 !! html
15469 <div style="/* insecure input */">A</div>
15470 <p style="/* insecure input */">B</p>
15471
15472 !! end
15473
15474 !! test
15475 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15476 !! wikitext
15477 <div style="background-image:url⁽javascript:alert())">A</div>
15478 <div style="background-image:url₍javascript:alert())">B</div>
15479 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15480 !! html
15481 <div style="/* insecure input */">A</div>
15482 <div style="/* insecure input */">B</div>
15483 <p style="/* insecure input */">C</p>
15484
15485 !! end
15486
15487 !! test
15488 Opera -o-link CSS
15489 !! wikitext
15490 <div
15491 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;"
15492 style="-o-link:attr(title);-o-link-source:current">X</div>
15493 !! html
15494 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15495
15496 !! end
15497
15498 !! test
15499 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15500 !! wikitext
15501 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15502 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15503 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15504 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15505 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15506 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15507 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15508 !! html
15509 <p style="/* insecure input */">A</p>
15510 <p style="/* insecure input */">B</p>
15511 <p style="/* insecure input */">C</p>
15512 <p style="/* insecure input */">D</p>
15513 <p style="/* insecure input */">E</p>
15514 <p style="/* insecure input */">F</p>
15515 <p style="/* insecure input */">G</p>
15516
15517 !! end
15518
15519 !! test
15520 Table attribute legitimate extension
15521 !! wikitext
15522 {|
15523 !+ style="<nowiki>color:blue</nowiki>"| status
15524 |}
15525 !! html
15526 <table>
15527 <tr>
15528 <th style="color:blue"> status
15529 </th></tr></table>
15530
15531 !!end
15532
15533 !! test
15534 Table attribute safety
15535 !! wikitext
15536 {|
15537 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15538 |}
15539 !! html
15540 <table>
15541 <tr>
15542 <th style="/* insecure input */"> status
15543 </th></tr></table>
15544
15545 !! end
15546
15547 !! test
15548 CSS line continuation 1
15549 !! wikitext
15550 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15551 !! html
15552 <div style="/* insecure input */"></div>
15553
15554 !! end
15555
15556 !! test
15557 CSS line continuation 2
15558 !! wikitext
15559 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15560 !! html
15561 <div style="/* insecure input */"></div>
15562
15563 !! end
15564
15565 !! article
15566 Template:Identity
15567 !! text
15568 {{{1}}}
15569 !! endarticle
15570
15571 !! test
15572 Expansion of multi-line templates in attribute values (bug 6255)
15573 !! wikitext
15574 <div style="background: {{identity|#00FF00}}">-</div>
15575 !! html
15576 <div style="background: #00FF00">-</div>
15577
15578 !! end
15579
15580
15581 !! test
15582 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15583 !! wikitext
15584 <div style="background:
15585 #00FF00">-</div>
15586 !! html/php
15587 <div style="background: #00FF00">-</div>
15588
15589 !! html/parsoid
15590 <div style="background:
15591 #00FF00">-</div>
15592 !! end
15593
15594 !! test
15595 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15596 !! wikitext
15597 <div style="background: &#10;#00FF00">-</div>
15598 !! html
15599 <div style="background: &#10;#00FF00">-</div>
15600
15601 !! end
15602
15603 !! test
15604 evil <math>-wiki-tags without Extension:Math enabled
15605 !! wikitext
15606 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15607 !! html+tidy
15608 <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>
15609 !! end
15610
15611 ###
15612 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15613 ###
15614 !! test
15615 Parser hook: empty input
15616 !! wikitext
15617 <tag></tag>
15618 !! html
15619 <pre>
15620 ''
15621 array (
15622 )
15623 </pre>
15624
15625 !! end
15626
15627 !! test
15628 Parser hook: empty input using terminated empty elements
15629 !! wikitext
15630 <tag/>
15631 !! html
15632 <pre>
15633 NULL
15634 array (
15635 )
15636 </pre>
15637
15638 !! end
15639
15640 !! test
15641 Parser hook: empty input using terminated empty elements (space before)
15642 !! wikitext
15643 <tag />
15644 !! html
15645 <pre>
15646 NULL
15647 array (
15648 )
15649 </pre>
15650
15651 !! end
15652
15653 !! test
15654 Parser hook: basic input
15655 !! wikitext
15656 <tag>input</tag>
15657 !! html
15658 <pre>
15659 'input'
15660 array (
15661 )
15662 </pre>
15663
15664 !! end
15665
15666
15667 !! test
15668 Parser hook: case insensitive
15669 !! wikitext
15670 <TAG>input</TAG>
15671 !! html
15672 <pre>
15673 'input'
15674 array (
15675 )
15676 </pre>
15677
15678 !! end
15679
15680
15681 !! test
15682 Parser hook: case insensitive, redux
15683 !! wikitext
15684 <TaG>input</TAg>
15685 !! html
15686 <pre>
15687 'input'
15688 array (
15689 )
15690 </pre>
15691
15692 !! end
15693
15694 !! test
15695 Parser hook: nested tags
15696 !! options
15697 noxml
15698 !! wikitext
15699 <tag><tag></tag></tag>
15700 !! html
15701 <pre>
15702 '<tag>'
15703 array (
15704 )
15705 </pre>&lt;/tag&gt;
15706
15707 !! end
15708
15709 !! test
15710 Parser hook: basic arguments
15711 !! wikitext
15712 <tag width=200 height = "100" depth = '50' square></tag>
15713 !! html
15714 <pre>
15715 ''
15716 array (
15717 'width' => '200',
15718 'height' => '100',
15719 'depth' => '50',
15720 'square' => 'square',
15721 )
15722 </pre>
15723
15724 !! end
15725
15726 !! test
15727 Parser hook: argument containing a forward slash (bug 5344)
15728 !! wikitext
15729 <tag filename='/tmp/bla'></tag>
15730 !! html
15731 <pre>
15732 ''
15733 array (
15734 'filename' => '/tmp/bla',
15735 )
15736 </pre>
15737
15738 !! end
15739
15740 !! test
15741 Parser hook: empty input using terminated empty elements (bug 2374)
15742 !! wikitext
15743 <tag foo=bar/>text
15744 !! html
15745 <pre>
15746 NULL
15747 array (
15748 'foo' => 'bar',
15749 )
15750 </pre>text
15751
15752 !! end
15753
15754 # </tag> should be output literally since there is no matching tag that begins it
15755 !! test
15756 Parser hook: basic arguments using terminated empty elements (bug 2374)
15757 !! wikitext
15758 <tag width=200 height = "100" depth = '50' square/>
15759 other stuff
15760 </tag>
15761 !! html
15762 <pre>
15763 NULL
15764 array (
15765 'width' => '200',
15766 'height' => '100',
15767 'depth' => '50',
15768 'square' => 'square',
15769 )
15770 </pre>
15771 <p>other stuff
15772 &lt;/tag&gt;
15773 </p>
15774 !! end
15775
15776 ###
15777 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15778 ###
15779
15780 !! test
15781 Parser hook: static parser hook not inside a comment
15782 !! wikitext
15783 <statictag>hello, world</statictag>
15784 <statictag action=flush/>
15785 !! html
15786 <p>hello, world
15787 </p>
15788 !! end
15789
15790
15791 !! test
15792 Parser hook: static parser hook inside a comment
15793 !! wikitext
15794 <!-- <statictag>hello, world</statictag> -->
15795 <statictag action=flush/>
15796 !! html
15797 <p><br />
15798 </p>
15799 !! end
15800
15801 # Nested template calls; this case was broken by Parser.php rev 1.506,
15802 # since reverted.
15803
15804 !! article
15805 Template:One-parameter
15806 !! text
15807 (My parameter is: {{{1}}})
15808 !! endarticle
15809
15810 !! article
15811 Template:Map-one-parameter
15812 !! text
15813 {{{{{1}}}|{{{2}}}}}
15814 !! endarticle
15815
15816 !! test
15817 Nested template calls
15818 !! wikitext
15819 {{Map-one-parameter|One-parameter|param}}
15820 !! html
15821 <p>(My parameter is: param)
15822 </p>
15823 !! end
15824
15825
15826 ###
15827 ### Sanitizer
15828 ###
15829
15830 # HTML+Tidy effectively strips out the empty tags completely
15831 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15832 # which Tidy would have done for the PHP parser had there been content inside it.
15833 !! test
15834 Sanitizer: Closing of open tags
15835 !! wikitext
15836 <s></s><table></table>
15837 !! html
15838 <s></s><table></table>
15839
15840 !! html/parsoid
15841 <p><s></s></p><table></table>
15842 !! end
15843
15844 !! test
15845 Sanitizer: Closing of open but not closed tags
15846 !! wikitext
15847 <s>foo
15848 !! html
15849 <p><s>foo</s>
15850 </p>
15851 !! end
15852
15853 !! test
15854 Sanitizer: Closing of closed but not open tags
15855 !! wikitext
15856 </s>
15857 !! html
15858 <p>&lt;/s&gt;
15859 </p>
15860 !! end
15861
15862 !! test
15863 Sanitizer: Closing of closed but not open table tags
15864 !! wikitext
15865 Table not started</td></tr></table>
15866 !! html
15867 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15868 </p>
15869 !! end
15870
15871 !! test
15872 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15873 !! wikitext
15874 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15875 !! html
15876 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15877 </p>
15878 !! end
15879
15880 # In HTML5, the restrictions are that id must contain at least one character,
15881 # and must not contain any space characters.
15882 !! test
15883 Sanitizer: Validating the contents of the id attribute (bug 4515)
15884 !! options
15885 disabled
15886 !! wikitext
15887 <br id="" /><br id="a space" />
15888 !! html
15889 Something ...
15890 !! end
15891
15892 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15893 !! test
15894 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15895 !! options
15896 disabled
15897 !! wikitext
15898 <br id="foo" /><br id="foo" />
15899 !! html
15900 Something need to be done. foo-2 ?
15901 !! end
15902
15903 !! test
15904 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15905 !! wikitext
15906 <div itemscope>
15907 <meta itemprop="hello" content="world">
15908 <meta http-equiv="refresh" content="5">
15909 <meta itemprop="hello" http-equiv="refresh" content="5">
15910 <link itemprop="hello" href="{{SERVER}}">
15911 <link rel="stylesheet" href="{{SERVER}}">
15912 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15913 </div>
15914 !! html
15915 <div itemscope="itemscope">
15916 <p> <meta itemprop="hello" content="world" />
15917 &lt;meta http-equiv="refresh" content="5"&gt;
15918 <meta itemprop="hello" content="5" />
15919 </p>
15920 <link itemprop="hello" href="http&#58;//example.org" />
15921 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15922 <link itemprop="hello" href="http&#58;//example.org" />
15923 </div>
15924
15925 !! end
15926
15927 !! test
15928 Language converter: output gets cut off unexpectedly (bug 5757)
15929 !! options
15930 language=zh
15931 !! wikitext
15932 this bit is safe: }-
15933
15934 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15935
15936 then we get cut off here: }-
15937
15938 all additional text is vanished
15939 !! html
15940 <p>this bit is safe: }-
15941 </p><p>but if we add a conversion instance: xxx
15942 </p><p>then we get cut off here: }-
15943 </p><p>all additional text is vanished
15944 </p>
15945 !! end
15946
15947 !! test
15948 Self closed html pairs (bug 5487)
15949 !! options
15950 !! wikitext
15951 <center><font id="bug" />Centered text</center>
15952 <div><font id="bug2" />In div text</div>
15953 !! html
15954 <center>&lt;font id="bug" /&gt;Centered text</center>
15955 <div>&lt;font id="bug2" /&gt;In div text</div>
15956
15957 !! end
15958
15959 #
15960 #
15961 #
15962
15963 !! test
15964 Punctuation: nbsp before exclamation
15965 !! wikitext
15966 C'est grave !
15967 !! html
15968 <p>C'est grave&#160;!
15969 </p>
15970 !! end
15971
15972 !! test
15973 Punctuation: CSS !important (bug 11874)
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 Punctuation: CSS ! important (bug 11874; with space after)
15983 !! wikitext
15984 <div style="width:50% ! important">important</div>
15985 !! html
15986 <div style="width:50% ! important">important</div>
15987
15988 !!end
15989
15990 !! test
15991 HTML bullet list, closed tags (bug 5497)
15992 !! wikitext
15993 <ul>
15994 <li>One</li>
15995 <li>Two</li>
15996 </ul>
15997 !! html/php
15998 <ul>
15999 <li>One</li>
16000 <li>Two</li>
16001 </ul>
16002
16003 !! html/parsoid
16004 <ul data-parsoid='{"stx":"html"}'>
16005 <li data-parsoid='{"stx":"html"}'>One</li>
16006 <li data-parsoid='{"stx":"html"}'>Two</li>
16007 </ul>
16008
16009 !! end
16010
16011 !! test
16012 HTML bullet list, unclosed tags (bug 5497)
16013 !! wikitext
16014 <ul>
16015 <li>One
16016 <li>Two
16017 </ul>
16018 !! html/php+tidy
16019 <ul>
16020 <li>One</li>
16021 <li>Two</li>
16022 </ul>
16023 !! html/parsoid
16024 <ul data-parsoid='{"stx":"html"}'>
16025 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16026 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16027 </ul>
16028
16029 !! end
16030
16031 !! test
16032 HTML ordered list, closed tags (bug 5497)
16033 !! wikitext
16034 <ol>
16035 <li>One</li>
16036 <li>Two</li>
16037 </ol>
16038 !! html/php
16039 <ol>
16040 <li>One</li>
16041 <li>Two</li>
16042 </ol>
16043
16044 !! html/parsoid
16045 <ol data-parsoid='{"stx":"html"}'>
16046 <li data-parsoid='{"stx":"html"}'>One</li>
16047 <li data-parsoid='{"stx":"html"}'>Two</li>
16048 </ol>
16049
16050 !! end
16051
16052 !! test
16053 HTML ordered list, unclosed tags (bug 5497)
16054 !! options
16055 !! wikitext
16056 <ol>
16057 <li>One
16058 <li>Two
16059 </ol>
16060 !! html/php+tidy
16061 <ol>
16062 <li>One</li>
16063 <li>Two</li>
16064 </ol>
16065 !! html/parsoid
16066 <ol data-parsoid='{"stx":"html"}'>
16067 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16068 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16069 </ol>
16070
16071 !! end
16072
16073 !! test
16074 HTML nested bullet list, closed tags (bug 5497)
16075 !! wikitext
16076 <ul>
16077 <li>One</li>
16078 <li>Two:
16079 <ul>
16080 <li>Sub-one</li>
16081 <li>Sub-two</li>
16082 </ul>
16083 </li>
16084 </ul>
16085 !! html
16086 <ul>
16087 <li>One</li>
16088 <li>Two:
16089 <ul>
16090 <li>Sub-one</li>
16091 <li>Sub-two</li>
16092 </ul>
16093 </li>
16094 </ul>
16095
16096 !! end
16097
16098 !! test
16099 HTML nested bullet list, open tags (bug 5497)
16100 !! wikitext
16101 <ul>
16102 <li>One
16103 <li>Two:
16104 <ul>
16105 <li>Sub-one
16106 <li>Sub-two
16107 </ul>
16108 </ul>
16109 !! html/php+tidy
16110 <ul>
16111 <li>One</li>
16112 <li>Two:
16113 <ul>
16114 <li>Sub-one</li>
16115 <li>Sub-two</li>
16116 </ul>
16117 </li>
16118 </ul>
16119 !! html/parsoid
16120 <ul>
16121 <li>One
16122 </li>
16123 <li>Two:
16124 <ul>
16125 <li>Sub-one
16126 </li>
16127 <li>Sub-two
16128 </li>
16129 </ul>
16130 </li>
16131 </ul>
16132
16133 !! end
16134
16135 !! test
16136 HTML nested ordered list, closed tags (bug 5497)
16137 !! wikitext
16138 <ol>
16139 <li>One</li>
16140 <li>Two:
16141 <ol>
16142 <li>Sub-one</li>
16143 <li>Sub-two</li>
16144 </ol>
16145 </li>
16146 </ol>
16147 !! html
16148 <ol>
16149 <li>One</li>
16150 <li>Two:
16151 <ol>
16152 <li>Sub-one</li>
16153 <li>Sub-two</li>
16154 </ol>
16155 </li>
16156 </ol>
16157
16158 !! end
16159
16160 !! test
16161 HTML nested ordered list, open tags (bug 5497)
16162 !! wikitext
16163 <ol>
16164 <li>One
16165 <li>Two:
16166 <ol>
16167 <li>Sub-one
16168 <li>Sub-two
16169 </ol>
16170 </ol>
16171 !! html/php
16172 <ol>
16173 <li>One
16174 <li>Two:
16175 <ol>
16176 <li>Sub-one
16177 <li>Sub-two
16178 </ol>
16179 </ol>
16180
16181 !! html/parsoid
16182 <ol>
16183 <li>One
16184 </li>
16185 <li>Two:
16186 <ol>
16187 <li>Sub-one
16188 </li>
16189 <li>Sub-two
16190 </li>
16191 </ol>
16192 </li>
16193 </ol>
16194
16195 !! end
16196
16197 !! test
16198 HTML ordered list item with parameters oddity
16199 !! wikitext
16200 <ol><li id="fragment">One</li>
16201 </ol>
16202 !! html
16203 <ol><li id="fragment">One</li>
16204 </ol>
16205
16206 !! end
16207
16208 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16209 !!test
16210 bug 5918: autonumbering
16211 !! wikitext
16212 [http://first/] [http://second] [ftp://ftp]
16213
16214 ftp://inlineftp
16215
16216 [mailto:enclosed@mail.tld With target]
16217
16218 [mailto:enclosed@mail.tld]
16219
16220 mailto:inline@mail.tld
16221 !! html/php
16222 <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>
16223 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16224 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16225 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16226 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16227 </p>
16228 !! html/parsoid
16229 <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>
16230 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16231 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16232 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16233 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16234 !! end
16235
16236
16237 #
16238 # Security and HTML correctness
16239 # From Nick Jenkins' fuzz testing
16240 #
16241
16242 !! test
16243 Fuzz testing: Parser13
16244 !! wikitext
16245 {|
16246 | http://a|
16247 !! html
16248 <table>
16249 <tr>
16250 <td>
16251 </td>
16252 </tr>
16253 </table>
16254
16255 !! end
16256
16257 !! test
16258 Fuzz testing: Parser14
16259 !! wikitext
16260 == onmouseover= ==
16261 http://__TOC__
16262 !! html
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 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16265 <ul>
16266 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16267 </ul>
16268 </div>
16269
16270
16271 !! html+tidy
16272 <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>
16273 <p>http://</p>
16274 <div id="toc" class="toc">
16275 <div id="toctitle">
16276 <h2>Contents</h2>
16277 </div>
16278 <ul>
16279 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16280 </ul>
16281 </div>
16282 <p></p>
16283 !! end
16284
16285 !! test
16286 Fuzz testing: Parser14-table
16287 !! wikitext
16288 ==a==
16289 {| STYLE=__TOC__
16290 !! html
16291 <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>
16292 <table style="&#95;_TOC&#95;_">
16293 <tr><td></td></tr>
16294 </table>
16295
16296 !! html+tidy
16297 <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>
16298 <table style="__TOC__">
16299 <tr>
16300 <td></td>
16301 </tr>
16302 </table>
16303 !! end
16304
16305 # Known to produce bogus xml (extra </td>)
16306 !! test
16307 Fuzz testing: Parser16
16308 !! options
16309 noxml
16310 !! wikitext
16311 {|
16312 !https://||||||
16313 !! html
16314 <table>
16315 <tr>
16316 <th>https://</th>
16317 <th></th>
16318 <th></th>
16319 <th>
16320 </td>
16321 </tr>
16322 </table>
16323
16324 !! html+tidy
16325 <table>
16326 <tr>
16327 <th>https://</th>
16328 <th></th>
16329 <th></th>
16330 <th></th>
16331 </tr>
16332 </table>
16333 !! end
16334
16335 !! test
16336 Fuzz testing: Parser21
16337 !! wikitext
16338 {|
16339 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16340 |
16341 !! html
16342 <table>
16343 <tr>
16344 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16345 </th>
16346 <td>
16347 </td>
16348 </tr>
16349 </table>
16350
16351 !! end
16352
16353 !! test
16354 Fuzz testing: Parser22
16355 !! wikitext
16356 http://===r:::https://b
16357
16358 {|
16359 !! html
16360 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16361 </p>
16362 <table>
16363 <tr><td></td></tr>
16364 </table>
16365
16366 !! end
16367
16368 # Known to produce bad XML for now
16369 !! test
16370 Fuzz testing: Parser24
16371 !! options
16372 noxml
16373 !! wikitext
16374 {|
16375 {{{|
16376 <u CLASS=
16377 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16378 <br style="onmouseover='alert(document.cookie);' " />
16379
16380 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16381 |
16382 !! html
16383 <table>
16384 {{{|
16385 <u class="&#124;">}}}} &gt;
16386 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16387
16388 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16389 <tr>
16390 <td></u>
16391 </td>
16392 </tr>
16393 </table>
16394
16395 !! end
16396
16397 # Note: the current result listed for this is not what the original one was,
16398 # but the original bug was JavaScript injection, which is fixed in any case.
16399 # It's not clear that the original result listed was any more correct than the
16400 # current one. Original result:
16401 # <p>{{{|
16402 # </p>
16403 # <li class="&#124;&#124;">
16404 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16405 !!test
16406 Fuzz testing: Parser25 (bug 6055)
16407 !! wikitext
16408 {{{
16409 |
16410 <LI CLASS=||
16411 >
16412 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16413 !! html
16414 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16415 </p>
16416 !! end
16417
16418 !!test
16419 Fuzz testing: URL adjacent extension (with space, clean)
16420 !! wikitext
16421 http://example.com <nowiki>junk</nowiki>
16422 !! html/php
16423 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16424 </p>
16425 !! html/parsoid
16426 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16427 !! end
16428
16429 !!test
16430 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16431 !! wikitext
16432 http://example.com<nowiki>junk</nowiki>
16433 !! html/php
16434 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16435 </p>
16436 !! html/parsoid
16437 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16438 !! end
16439
16440 !!test
16441 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16442 !! wikitext
16443 http://example.com<pre>junk</pre>
16444 !! html/php
16445 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16446
16447 !! html/php+tidy
16448 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16449 <pre>
16450 junk
16451 </pre>
16452 !! html/parsoid
16453 <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>
16454 !!end
16455
16456 !!test
16457 Fuzz testing: image with bogus manual thumbnail
16458 !! wikitext
16459 [[Image:foobar.jpg|thumbnail= ]]
16460 !! html/php
16461 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16462
16463 !! html/parsoid
16464 <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>
16465 !!end
16466
16467 !! test
16468 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16469 !! wikitext
16470 <pre dir="&#10;"></pre>
16471 !! html
16472 <pre dir="&#10;"></pre>
16473
16474 !! end
16475
16476 !! test
16477 Parsing optional HTML elements (Bug 6171)
16478 !! options
16479 !! wikitext
16480 <table>
16481 <tr>
16482 <td> Some tabular data</td>
16483 <td> More tabular data ...
16484 <td> And yet som tabular data</td>
16485 </tr>
16486 </table>
16487 !! html
16488 <table>
16489 <tr>
16490 <td> Some tabular data</td>
16491 <td> More tabular data ...
16492 </td><td> And yet som tabular data</td>
16493 </tr>
16494 </table>
16495
16496 !! end
16497
16498 !! test
16499 Correct handling of <td>, <tr> (Bug 6171)
16500 !! options
16501 !! wikitext
16502 <table>
16503 <tr>
16504 <td> Some tabular data</td>
16505 <td> More tabular data ...</td>
16506 <td> And yet som tabular data</td>
16507 </tr>
16508 </table>
16509 !! html
16510 <table>
16511 <tr>
16512 <td> Some tabular data</td>
16513 <td> More tabular data ...</td>
16514 <td> And yet som tabular data</td>
16515 </tr>
16516 </table>
16517
16518 !! end
16519
16520
16521 !! test
16522 Parsing crashing regression (fr:JavaScript)
16523 !! wikitext
16524 </body></x>
16525 !! html
16526 <p>&lt;/body&gt;&lt;/x&gt;
16527 </p>
16528 !! end
16529
16530 !! test
16531 Inline wiki vs wiki block nesting
16532 !! wikitext
16533 '''Bold paragraph
16534
16535 New wiki paragraph
16536 !! html
16537 <p><b>Bold paragraph</b>
16538 </p><p>New wiki paragraph
16539 </p>
16540 !! end
16541
16542 # FIXME: The current php output is documented
16543 # and desired output is the parsoid target.
16544 !! test
16545 Inline HTML vs wiki block nesting
16546 !! wikitext
16547 <b>Bold paragraph
16548
16549 New wiki paragraph
16550 !! html/php
16551 <p><b>Bold paragraph
16552 </p><p>New wiki paragraph</b>
16553 </p>
16554 !! html/parsoid
16555 <p><b>Bold paragraph</b>
16556 </p><p>New wiki paragraph
16557 </p>
16558 !! end
16559
16560 # Original result was this:
16561 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16562 # </p>
16563 # While that might be marginally more intuitive, maybe, the six-apostrophe
16564 # construct is clearly pathological and the result stated here (which is what
16565 # the parser actually does) is about as reasonable as anything.
16566 !!test
16567 Mixing markup for italics and bold
16568 !! options
16569 !! wikitext
16570 '''bold''''''bold''bolditalics'''''
16571 !! html
16572 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16573 </p>
16574 !! end
16575
16576
16577 !! article
16578 Xyzzyx
16579 !! text
16580 Article for special page transclusion test
16581 !! endarticle
16582
16583 !! test
16584 Special page transclusion
16585 !! options
16586 !! wikitext
16587 {{Special:Prefixindex/Xyzzyx}}
16588 !! html
16589 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16590
16591 !! end
16592
16593 !! test
16594 Special page transclusion twice (bug 5021)
16595 !! options
16596 !! wikitext
16597 {{Special:Prefixindex/Xyzzyx}}
16598 {{Special:Prefixindex/Xyzzyx}}
16599 !! html
16600 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16601 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16602
16603 !! end
16604
16605 !! test
16606 Transclusion of default MediaWiki message
16607 !! wikitext
16608 {{MediaWiki:Mainpage}}
16609 !! html
16610 <p>Main Page
16611 </p>
16612 !! end
16613
16614 !! test
16615 Transclusion of nonexistent MediaWiki message
16616 !! wikitext
16617 {{MediaWiki:Mainpagexxx}}
16618 !! html
16619 <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>
16620 </p>
16621 !! end
16622
16623 !! test
16624 Transclusion of MediaWiki message with underscore
16625 !! wikitext
16626 {{MediaWiki:history_short}}
16627 !! html
16628 <p>History
16629 </p>
16630 !! end
16631
16632 !! test
16633 Transclusion of MediaWiki message with space
16634 !! wikitext
16635 {{MediaWiki:history short}}
16636 !! html
16637 <p>History
16638 </p>
16639 !! end
16640
16641 !! test
16642 Invalid header with following text
16643 !! wikitext
16644 = x = y
16645 !! html
16646 <p>= x = y
16647 </p>
16648 !! end
16649
16650
16651 !! test
16652 Section extraction test (section 0)
16653 !! options
16654 section=0
16655 !! wikitext
16656 start
16657 ==a==
16658 ===aa===
16659 ====aaa====
16660 ==b==
16661 ===ba===
16662 ===bb===
16663 ====bba====
16664 ===bc===
16665 ==c==
16666 ===ca===
16667 !! html
16668 start
16669 !! end
16670
16671 !! test
16672 Section extraction test (section 1)
16673 !! options
16674 section=1
16675 !! wikitext
16676 start
16677 ==a==
16678 ===aa===
16679 ====aaa====
16680 ==b==
16681 ===ba===
16682 ===bb===
16683 ====bba====
16684 ===bc===
16685 ==c==
16686 ===ca===
16687 !! html
16688 ==a==
16689 ===aa===
16690 ====aaa====
16691 !! end
16692
16693 !! test
16694 Section extraction test (section 2)
16695 !! options
16696 section=2
16697 !! wikitext
16698 start
16699 ==a==
16700 ===aa===
16701 ====aaa====
16702 ==b==
16703 ===ba===
16704 ===bb===
16705 ====bba====
16706 ===bc===
16707 ==c==
16708 ===ca===
16709 !! html
16710 ===aa===
16711 ====aaa====
16712 !! end
16713
16714 !! test
16715 Section extraction test (section 3)
16716 !! options
16717 section=3
16718 !! wikitext
16719 start
16720 ==a==
16721 ===aa===
16722 ====aaa====
16723 ==b==
16724 ===ba===
16725 ===bb===
16726 ====bba====
16727 ===bc===
16728 ==c==
16729 ===ca===
16730 !! html
16731 ====aaa====
16732 !! end
16733
16734 !! test
16735 Section extraction test (section 4)
16736 !! options
16737 section=4
16738 !! wikitext
16739 start
16740 ==a==
16741 ===aa===
16742 ====aaa====
16743 ==b==
16744 ===ba===
16745 ===bb===
16746 ====bba====
16747 ===bc===
16748 ==c==
16749 ===ca===
16750 !! html
16751 ==b==
16752 ===ba===
16753 ===bb===
16754 ====bba====
16755 ===bc===
16756 !! end
16757
16758 !! test
16759 Section extraction test (section 5)
16760 !! options
16761 section=5
16762 !! wikitext
16763 start
16764 ==a==
16765 ===aa===
16766 ====aaa====
16767 ==b==
16768 ===ba===
16769 ===bb===
16770 ====bba====
16771 ===bc===
16772 ==c==
16773 ===ca===
16774 !! html
16775 ===ba===
16776 !! end
16777
16778 !! test
16779 Section extraction test (section 6)
16780 !! options
16781 section=6
16782 !! wikitext
16783 start
16784 ==a==
16785 ===aa===
16786 ====aaa====
16787 ==b==
16788 ===ba===
16789 ===bb===
16790 ====bba====
16791 ===bc===
16792 ==c==
16793 ===ca===
16794 !! html
16795 ===bb===
16796 ====bba====
16797 !! end
16798
16799 !! test
16800 Section extraction test (section 7)
16801 !! options
16802 section=7
16803 !! wikitext
16804 start
16805 ==a==
16806 ===aa===
16807 ====aaa====
16808 ==b==
16809 ===ba===
16810 ===bb===
16811 ====bba====
16812 ===bc===
16813 ==c==
16814 ===ca===
16815 !! html
16816 ====bba====
16817 !! end
16818
16819 !! test
16820 Section extraction test (section 8)
16821 !! options
16822 section=8
16823 !! wikitext
16824 start
16825 ==a==
16826 ===aa===
16827 ====aaa====
16828 ==b==
16829 ===ba===
16830 ===bb===
16831 ====bba====
16832 ===bc===
16833 ==c==
16834 ===ca===
16835 !! html
16836 ===bc===
16837 !! end
16838
16839 !! test
16840 Section extraction test (section 9)
16841 !! options
16842 section=9
16843 !! wikitext
16844 start
16845 ==a==
16846 ===aa===
16847 ====aaa====
16848 ==b==
16849 ===ba===
16850 ===bb===
16851 ====bba====
16852 ===bc===
16853 ==c==
16854 ===ca===
16855 !! html
16856 ==c==
16857 ===ca===
16858 !! end
16859
16860 !! test
16861 Section extraction test (section 10)
16862 !! options
16863 section=10
16864 !! wikitext
16865 start
16866 ==a==
16867 ===aa===
16868 ====aaa====
16869 ==b==
16870 ===ba===
16871 ===bb===
16872 ====bba====
16873 ===bc===
16874 ==c==
16875 ===ca===
16876 !! html
16877 ===ca===
16878 !! end
16879
16880 !! test
16881 Section extraction test (nonexistent section 11)
16882 !! options
16883 section=11
16884 !! wikitext
16885 start
16886 ==a==
16887 ===aa===
16888 ====aaa====
16889 ==b==
16890 ===ba===
16891 ===bb===
16892 ====bba====
16893 ===bc===
16894 ==c==
16895 ===ca===
16896 !! html
16897 !! end
16898
16899 !! test
16900 Section extraction test with bogus heading (section 1)
16901 !! options
16902 section=1
16903 !! wikitext
16904 ==a==
16905 ==bogus== not a legal section
16906 ==b==
16907 !! html
16908 ==a==
16909 ==bogus== not a legal section
16910 !! end
16911
16912 !! test
16913 Section extraction test with bogus heading (section 2)
16914 !! options
16915 section=2
16916 !! wikitext
16917 ==a==
16918 ==bogus== not a legal section
16919 ==b==
16920 !! html
16921 ==b==
16922 !! end
16923
16924 !! test
16925 Section extraction test with comment after heading (section 1)
16926 !! options
16927 section=1
16928 !! wikitext
16929 ==a==
16930 ==b== <!-- -->
16931 ==c==
16932 !! html
16933 ==a==
16934 !! end
16935
16936 !! test
16937 Section extraction test with comment after heading (section 2)
16938 !! options
16939 section=2
16940 !! wikitext
16941 ==a==
16942 ==b== <!-- -->
16943 ==c==
16944 !! html
16945 ==b== <!-- -->
16946 !! end
16947
16948 !! test
16949 Section extraction test with bogus <nowiki> heading (section 1)
16950 !! options
16951 section=1
16952 !! wikitext
16953 ==a==
16954 ==bogus== <nowiki>not a legal section</nowiki>
16955 ==b==
16956 !! html
16957 ==a==
16958 ==bogus== <nowiki>not a legal section</nowiki>
16959 !! end
16960
16961 !! test
16962 Section extraction test with bogus <nowiki> heading (section 2)
16963 !! options
16964 section=2
16965 !! wikitext
16966 ==a==
16967 ==bogus== <nowiki>not a legal section</nowiki>
16968 ==b==
16969 !! html
16970 ==b==
16971 !! end
16972
16973
16974 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16975 # instead of respecting commented sections
16976 !! test
16977 Section extraction prefixed by comment (section 1)
16978 !! options
16979 section=1
16980 !! wikitext
16981 <!-- -->==sec1==
16982 ==sec2==
16983 !! html
16984 ==sec2==
16985 !!end
16986
16987 !! test
16988 Section extraction prefixed by comment (section 2)
16989 !! options
16990 section=2
16991 !! wikitext
16992 <!-- -->==sec1==
16993 ==sec2==
16994 !! html
16995
16996 !!end
16997
16998
16999 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17000 # instead of respecting HTML-style headings
17001 !! test
17002 Section extraction, mixed wiki and html (section 1)
17003 !! options
17004 section=1
17005 !! wikitext
17006 <h2>unmarked</h2>
17007 unmarked
17008 ==1==
17009 one
17010 ==2==
17011 two
17012 !! html
17013 ==1==
17014 one
17015 !! end
17016
17017 !! test
17018 Section extraction, mixed wiki and html (section 2)
17019 !! options
17020 section=2
17021 !! wikitext
17022 <h2>unmarked</h2>
17023 unmarked
17024 ==1==
17025 one
17026 ==2==
17027 two
17028 !! html
17029 ==2==
17030 two
17031 !! end
17032
17033
17034 # Formerly testing for bug 3342
17035 !! test
17036 Section extraction, heading surrounded by <noinclude>
17037 !! options
17038 section=1
17039 !! wikitext
17040 <noinclude>==unmarked==</noinclude>
17041 ==marked==
17042 !! html
17043 ==marked==
17044 !!end
17045
17046 # Test behavior of bug 19910
17047 !! test
17048 Sectiion with all-equals
17049 !! options
17050 section=2
17051 !! wikitext
17052 ===
17053 The line above must have a trailing space
17054 === <!--
17055 --> <!-- -->
17056 But just in case it doesn't...
17057 !! html
17058 === <!--
17059 --> <!-- -->
17060 But just in case it doesn't...
17061 !! end
17062
17063 !! test
17064 Section replacement test (section 0)
17065 !! options
17066 replace=0,"xxx"
17067 !! wikitext
17068 start
17069 ==a==
17070 ===aa===
17071 ====aaa====
17072 ==b==
17073 ===ba===
17074 ===bb===
17075 ====bba====
17076 ===bc===
17077 ==c==
17078 ===ca===
17079 !! html
17080 xxx
17081
17082 ==a==
17083 ===aa===
17084 ====aaa====
17085 ==b==
17086 ===ba===
17087 ===bb===
17088 ====bba====
17089 ===bc===
17090 ==c==
17091 ===ca===
17092 !! end
17093
17094 !! test
17095 Section replacement test (section 1)
17096 !! options
17097 replace=1,"xxx"
17098 !! wikitext
17099 start
17100 ==a==
17101 ===aa===
17102 ====aaa====
17103 ==b==
17104 ===ba===
17105 ===bb===
17106 ====bba====
17107 ===bc===
17108 ==c==
17109 ===ca===
17110 !! html
17111 start
17112 xxx
17113
17114 ==b==
17115 ===ba===
17116 ===bb===
17117 ====bba====
17118 ===bc===
17119 ==c==
17120 ===ca===
17121 !! end
17122
17123 !! test
17124 Section replacement test (section 2)
17125 !! options
17126 replace=2,"xxx"
17127 !! wikitext
17128 start
17129 ==a==
17130 ===aa===
17131 ====aaa====
17132 ==b==
17133 ===ba===
17134 ===bb===
17135 ====bba====
17136 ===bc===
17137 ==c==
17138 ===ca===
17139 !! html
17140 start
17141 ==a==
17142 xxx
17143
17144 ==b==
17145 ===ba===
17146 ===bb===
17147 ====bba====
17148 ===bc===
17149 ==c==
17150 ===ca===
17151 !! end
17152
17153 !! test
17154 Section replacement test (section 3)
17155 !! options
17156 replace=3,"xxx"
17157 !! wikitext
17158 start
17159 ==a==
17160 ===aa===
17161 ====aaa====
17162 ==b==
17163 ===ba===
17164 ===bb===
17165 ====bba====
17166 ===bc===
17167 ==c==
17168 ===ca===
17169 !! html
17170 start
17171 ==a==
17172 ===aa===
17173 xxx
17174
17175 ==b==
17176 ===ba===
17177 ===bb===
17178 ====bba====
17179 ===bc===
17180 ==c==
17181 ===ca===
17182 !! end
17183
17184 !! test
17185 Section replacement test (section 4)
17186 !! options
17187 replace=4,"xxx"
17188 !! wikitext
17189 start
17190 ==a==
17191 ===aa===
17192 ====aaa====
17193 ==b==
17194 ===ba===
17195 ===bb===
17196 ====bba====
17197 ===bc===
17198 ==c==
17199 ===ca===
17200 !! html
17201 start
17202 ==a==
17203 ===aa===
17204 ====aaa====
17205 xxx
17206
17207 ==c==
17208 ===ca===
17209 !! end
17210
17211 !! test
17212 Section replacement test (section 5)
17213 !! options
17214 replace=5,"xxx"
17215 !! wikitext
17216 start
17217 ==a==
17218 ===aa===
17219 ====aaa====
17220 ==b==
17221 ===ba===
17222 ===bb===
17223 ====bba====
17224 ===bc===
17225 ==c==
17226 ===ca===
17227 !! html
17228 start
17229 ==a==
17230 ===aa===
17231 ====aaa====
17232 ==b==
17233 xxx
17234
17235 ===bb===
17236 ====bba====
17237 ===bc===
17238 ==c==
17239 ===ca===
17240 !! end
17241
17242 !! test
17243 Section replacement test (section 6)
17244 !! options
17245 replace=6,"xxx"
17246 !! wikitext
17247 start
17248 ==a==
17249 ===aa===
17250 ====aaa====
17251 ==b==
17252 ===ba===
17253 ===bb===
17254 ====bba====
17255 ===bc===
17256 ==c==
17257 ===ca===
17258 !! html
17259 start
17260 ==a==
17261 ===aa===
17262 ====aaa====
17263 ==b==
17264 ===ba===
17265 xxx
17266
17267 ===bc===
17268 ==c==
17269 ===ca===
17270 !! end
17271
17272 !! test
17273 Section replacement test (section 7)
17274 !! options
17275 replace=7,"xxx"
17276 !! wikitext
17277 start
17278 ==a==
17279 ===aa===
17280 ====aaa====
17281 ==b==
17282 ===ba===
17283 ===bb===
17284 ====bba====
17285 ===bc===
17286 ==c==
17287 ===ca===
17288 !! html
17289 start
17290 ==a==
17291 ===aa===
17292 ====aaa====
17293 ==b==
17294 ===ba===
17295 ===bb===
17296 xxx
17297
17298 ===bc===
17299 ==c==
17300 ===ca===
17301 !! end
17302
17303 !! test
17304 Section replacement test (section 8)
17305 !! options
17306 replace=8,"xxx"
17307 !! wikitext
17308 start
17309 ==a==
17310 ===aa===
17311 ====aaa====
17312 ==b==
17313 ===ba===
17314 ===bb===
17315 ====bba====
17316 ===bc===
17317 ==c==
17318 ===ca===
17319 !! html
17320 start
17321 ==a==
17322 ===aa===
17323 ====aaa====
17324 ==b==
17325 ===ba===
17326 ===bb===
17327 ====bba====
17328 xxx
17329
17330 ==c==
17331 ===ca===
17332 !!end
17333
17334 !! test
17335 Section replacement test (section 9)
17336 !! options
17337 replace=9,"xxx"
17338 !! wikitext
17339 start
17340 ==a==
17341 ===aa===
17342 ====aaa====
17343 ==b==
17344 ===ba===
17345 ===bb===
17346 ====bba====
17347 ===bc===
17348 ==c==
17349 ===ca===
17350 !! html
17351 start
17352 ==a==
17353 ===aa===
17354 ====aaa====
17355 ==b==
17356 ===ba===
17357 ===bb===
17358 ====bba====
17359 ===bc===
17360 xxx
17361 !! end
17362
17363 !! test
17364 Section replacement test (section 10)
17365 !! options
17366 replace=10,"xxx"
17367 !! wikitext
17368 start
17369 ==a==
17370 ===aa===
17371 ====aaa====
17372 ==b==
17373 ===ba===
17374 ===bb===
17375 ====bba====
17376 ===bc===
17377 ==c==
17378 ===ca===
17379 !! html
17380 start
17381 ==a==
17382 ===aa===
17383 ====aaa====
17384 ==b==
17385 ===ba===
17386 ===bb===
17387 ====bba====
17388 ===bc===
17389 ==c==
17390 xxx
17391 !! end
17392
17393 !! test
17394 Section replacement test with initial whitespace (bug 13728)
17395 !! options
17396 replace=2,"xxx"
17397 !! wikitext
17398 Preformatted initial line
17399 ==a==
17400 ===a===
17401 !! html
17402 Preformatted initial line
17403 ==a==
17404 xxx
17405 !! end
17406
17407
17408 !! test
17409 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17410 !! options
17411 section=1
17412 !! wikitext
17413 ==a==
17414 a
17415 !! html
17416 ==a==
17417 a
17418 !! end
17419
17420 !! test
17421 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17422 !! options
17423 section=1
17424 !! wikitext
17425 ==a==
17426 a
17427 !! html
17428 ==a==
17429 a
17430 !! end
17431
17432
17433 !! test
17434 Section extraction, <pre> around bogus header (bug 10309)
17435 !! options
17436 noxml section=2
17437 !! wikitext
17438 == Section One ==
17439 <pre>
17440 =======
17441 </pre>
17442
17443 == Section Two ==
17444 stuff
17445 !! html
17446 == Section Two ==
17447 stuff
17448 !! end
17449
17450 !! test
17451 Section replacement, <pre> around bogus header (bug 10309)
17452 !! options
17453 noxml replace=2,"xxx"
17454 !! wikitext
17455 == Section One ==
17456 <pre>
17457 =======
17458 </pre>
17459
17460 == Section Two ==
17461 stuff
17462 !! html
17463 == Section One ==
17464 <pre>
17465 =======
17466 </pre>
17467
17468 xxx
17469 !! end
17470
17471
17472
17473 !! test
17474 Handling of &#x0A; in URLs
17475 !! wikitext
17476 ** irc://&#x0A;a
17477 !! html/php
17478 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17479
17480 !! html/parsoid
17481 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17482 a">irc://
17483 a</a></li></ul></li></ul>
17484 !! end
17485
17486 !! test
17487 Handling of %0A in URLs
17488 !! wikitext
17489 ** irc://%0Aa
17490 !! html/php
17491 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17492
17493 !! html/parsoid
17494 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17495 !! end
17496
17497
17498 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17499 !! test
17500 5 quotes, code coverage +1 line
17501 !! options
17502 parsoid=wt2html
17503 !! wikitext
17504 '''''
17505 !! html/php
17506 !! html/parsoid
17507 <p><b><i></i></b></p>
17508 !! end
17509
17510 # same html as previous, but wikitext adjusted to match parsoid html2wt
17511 # note that wt2html and html2html will put the <i> before the <b>
17512 !! test
17513 5 quotes, code coverage +1 line w/ nowiki (1)
17514 !! options
17515 parsoid=wt2wt,html2wt
17516 !! wikitext
17517 '''''<nowiki/>'''''
17518 !! html/php
17519 <p><i></i>
17520 </p>
17521 !! html/parsoid
17522 <p><b><i></i></b></p>
17523 !! end
17524
17525 # same as previous, just swapping the <i> and <b>
17526 !! test
17527 5 quotes, code coverage +1 line w/ nowiki (2)
17528 !! wikitext
17529 '''''<nowiki/>'''''
17530 !! html/php
17531 <p><i></i>
17532 </p>
17533 !! html/parsoid
17534 <p><i><b></b></i></p>
17535 !! end
17536
17537 !! test
17538 Special:Search page linking.
17539 !! wikitext
17540 {{Special:search}}
17541 !! html
17542 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17543 </p>
17544 !! end
17545
17546 !! test
17547 {{!}} is a magic word
17548 !! wikitext
17549 {{!}} is a magic word there and {{!}} is still a magic word here
17550 !! html/php
17551 <p>| is a magic word there and | is still a magic word here
17552 </p>
17553 !! html/parsoid
17554 <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>
17555 !! end
17556
17557 !! test
17558 Say the magic word
17559 !! options
17560 title=[[Parser test]]
17561 !! wikitext
17562 * {{PAGENAME}}
17563 * {{PAGENAMEE}}
17564 * {{FULLPAGENAME}}
17565 * {{FULLPAGENAMEE}}
17566 * {{BASEPAGENAME}}
17567 * {{BASEPAGENAMEE}}
17568 * {{SUBPAGENAME}}
17569 * {{SUBPAGENAMEE}}
17570 * {{ROOTPAGENAME}}
17571 * {{ROOTPAGENAMEE}}
17572 * {{TALKPAGENAME}}
17573 * {{TALKPAGENAMEE}}
17574 * {{SUBJECTPAGENAME}}
17575 * {{SUBJECTPAGENAMEE}}
17576 * {{NAMESPACEE}}
17577 * {{NAMESPACE}}
17578 * {{NAMESPACENUMBER}}
17579 * {{TALKSPACE}}
17580 * {{TALKSPACEE}}
17581 * {{SUBJECTSPACE}}
17582 * {{SUBJECTSPACEE}}
17583 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17584 !! html
17585 <ul><li> Parser test</li>
17586 <li> Parser_test</li>
17587 <li> Parser test</li>
17588 <li> Parser_test</li>
17589 <li> Parser test</li>
17590 <li> Parser_test</li>
17591 <li> Parser test</li>
17592 <li> Parser_test</li>
17593 <li> Parser test</li>
17594 <li> Parser_test</li>
17595 <li> Talk:Parser test</li>
17596 <li> Talk:Parser_test</li>
17597 <li> Parser test</li>
17598 <li> Parser_test</li>
17599 <li> </li>
17600 <li> </li>
17601 <li> 0</li>
17602 <li> Talk</li>
17603 <li> Talk</li>
17604 <li> </li>
17605 <li> </li>
17606 <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>
17607
17608 !! end
17609 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17610
17611 !! test
17612 Gallery
17613 !! wikitext
17614 <gallery>
17615 image1.png |
17616 image2.gif|||||
17617
17618 image3|
17619 image4 |300px| centre
17620 image5.svg| http://///////
17621 [[x|xx]]]]
17622 * image6
17623 </gallery>
17624 !! html
17625 <ul class="gallery mw-gallery-traditional">
17626 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17627 <div class="thumb" style="height: 150px;">Image1.png</div>
17628 <div class="gallerytext">
17629 </div>
17630 </div></li>
17631 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17632 <div class="thumb" style="height: 150px;">Image2.gif</div>
17633 <div class="gallerytext">
17634 <p>||||
17635 </p>
17636 </div>
17637 </div></li>
17638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17639 <div class="thumb" style="height: 150px;">Image3</div>
17640 <div class="gallerytext">
17641 </div>
17642 </div></li>
17643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17644 <div class="thumb" style="height: 150px;">Image4</div>
17645 <div class="gallerytext">
17646 <p>300px| centre
17647 </p>
17648 </div>
17649 </div></li>
17650 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17651 <div class="thumb" style="height: 150px;">Image5.svg</div>
17652 <div class="gallerytext">
17653 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17654 </p>
17655 </div>
17656 </div></li>
17657 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17658 <div class="thumb" style="height: 150px;">* image6</div>
17659 <div class="gallerytext">
17660 </div>
17661 </div></li>
17662 </ul>
17663
17664 !! end
17665
17666 !! test
17667 Gallery (with options)
17668 !! wikitext
17669 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17670 File:Nonexistent.jpg|caption
17671 File:Nonexistent.jpg
17672 image:foobar.jpg|some '''caption''' [[Main Page]]
17673 image:foobar.jpg
17674 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17675 </gallery>
17676 !! html
17677 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17678 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17679 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17680 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17681 <div class="gallerytext">
17682 <p>caption
17683 </p>
17684 </div>
17685 </div></li>
17686 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17687 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17688 <div class="gallerytext">
17689 </div>
17690 </div></li>
17691 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17692 <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>
17693 <div class="gallerytext">
17694 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17695 </p>
17696 </div>
17697 </div></li>
17698 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17699 <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>
17700 <div class="gallerytext">
17701 </div>
17702 </div></li>
17703 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17704 <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>
17705 <div class="gallerytext">
17706 <p>Blabla|blabla.
17707 </p>
17708 </div>
17709 </div></li>
17710 </ul>
17711
17712 !! end
17713
17714 !! test
17715 Gallery with link that has fragment
17716 !! wikitext
17717 <gallery>
17718 image:foobar.jpg|link=Main_Page
17719 image:foobar.jpg|link=Main_Page#section
17720 image:foobar.jpg|link=Main Page#section|caption
17721 </gallery>
17722 !! html
17723 <ul class="gallery mw-gallery-traditional">
17724 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17725 <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>
17726 <div class="gallerytext">
17727 </div>
17728 </div></li>
17729 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17730 <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>
17731 <div class="gallerytext">
17732 </div>
17733 </div></li>
17734 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17735 <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>
17736 <div class="gallerytext">
17737 <p>caption
17738 </p>
17739 </div>
17740 </div></li>
17741 </ul>
17742
17743 !! end
17744
17745 !! test
17746 Gallery with wikitext inside caption
17747 !! wikitext
17748 <gallery>
17749 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17750 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17751 </gallery>
17752 !! html
17753 <ul class="gallery mw-gallery-traditional">
17754 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17755 <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>
17756 <div class="gallerytext">
17757 <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>
17758 </p>
17759 </div>
17760 </div></li>
17761 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17762 <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>
17763 <div class="gallerytext">
17764 <p>This is a test template
17765 </p>
17766 </div>
17767 </div></li>
17768 </ul>
17769
17770 !! end
17771
17772 !! test
17773 gallery (with showfilename option)
17774 !! wikitext
17775 <gallery showfilename>
17776 File:Nonexistent.jpg|caption
17777 File:Nonexistent.jpg
17778 image:foobar.jpg|some '''caption''' [[Main Page]]
17779 File:Foobar.jpg
17780 </gallery>
17781 !! html
17782 <ul class="gallery mw-gallery-traditional">
17783 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17784 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17785 <div class="gallerytext">
17786 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17787 caption
17788 </p>
17789 </div>
17790 </div></li>
17791 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17792 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17793 <div class="gallerytext">
17794 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17795 </p>
17796 </div>
17797 </div></li>
17798 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17799 <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>
17800 <div class="gallerytext">
17801 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17802 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17803 </p>
17804 </div>
17805 </div></li>
17806 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17807 <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>
17808 <div class="gallerytext">
17809 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17810 </p>
17811 </div>
17812 </div></li>
17813 </ul>
17814
17815 !! end
17816
17817 !! test
17818 Gallery (with namespace-less filenames)
17819 !! wikitext
17820 <gallery>
17821 File:Nonexistent.jpg
17822 Nonexistent.jpg
17823 image:foobar.jpg
17824 foobar.jpg
17825 </gallery>
17826 !! html
17827 <ul class="gallery mw-gallery-traditional">
17828 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17829 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17830 <div class="gallerytext">
17831 </div>
17832 </div></li>
17833 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17834 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17835 <div class="gallerytext">
17836 </div>
17837 </div></li>
17838 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17839 <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>
17840 <div class="gallerytext">
17841 </div>
17842 </div></li>
17843 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17844 <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>
17845 <div class="gallerytext">
17846 </div>
17847 </div></li>
17848 </ul>
17849
17850 !! end
17851
17852 !! test
17853 HTML Hex character encoding (spells the word "JavaScript")
17854 !! options
17855 parsoid=wt2html,wt2wt,html2html
17856 !! wikitext
17857 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17858 !! html/php
17859 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17860 </p>
17861 !! html/php+tidy
17862 <p>JavaScript</p>
17863 !! html/parsoid
17864 <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>
17865 !! end
17866
17867 !! test
17868 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17869 !! wikitext
17870 &#xsee;&#XSEE;
17871 !! html/php
17872 <p>&amp;#xsee;&amp;#XSEE;
17873 </p>
17874 !! html/parsoid
17875 <p>&amp;#xsee;&amp;#XSEE;</p>
17876 !! end
17877
17878 !! test
17879 HTML Hex character encoding mixed case
17880 !! options
17881 parsoid=wt2html,wt2wt,html2html
17882 !! wikitext
17883 &#xEE;&#Xee;
17884 !! html/php
17885 <p>&#xee;&#xee;
17886 </p>
17887 !! html/php+tidy
17888 <p>îî</p>
17889 !! html/parsoid
17890 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17891 !! end
17892
17893 !! test
17894 __FORCETOC__ override
17895 !! wikitext
17896 __NEWSECTIONLINK__
17897 __FORCETOC__
17898 !! html/php
17899 <p><br />
17900 </p>
17901 !! end
17902
17903 !! test
17904 ISBN code coverage
17905 !! wikitext
17906 ISBN 978-0-1234-56&#x20;789
17907 !! html
17908 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17909 </p>
17910 !! html+tidy
17911 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17912 !! html/parsoid
17913 <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>
17914 !! end
17915
17916 !! test
17917 ISBN followed by 5 spaces
17918 !! wikitext
17919 ISBN
17920 !! html
17921 <p>ISBN
17922 </p>
17923 !! end
17924
17925 !! test
17926 Double ISBN
17927 !! wikitext
17928 ISBN ISBN 1234567890
17929 !! html/php
17930 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17931 </p>
17932 !! html/parsoid
17933 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17934 !! end
17935
17936 !! test
17937 ISBN with an X
17938 !! wikitext
17939 ISBN 3-462-04561-X
17940 ISBN 080442957X
17941 ISBN 978080442957X
17942 !! html/php
17943 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17944 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17945 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17946 </p>
17947 !! html/parsoid
17948 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17949 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17950 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17951 !! end
17952
17953 !! test
17954 ISBN with empty prefix (parsoid test)
17955 !! wikitext
17956 ISBN 1234567890
17957 !! html/php
17958 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17959 </p>
17960 !! html/parsoid
17961 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17962 !! end
17963
17964 !! test
17965 Bug 22905: <abbr> followed by ISBN followed by </a>
17966 !! wikitext
17967 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17968 !! html/php
17969 <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>
17970 </p>
17971 !! html/parsoid
17972 <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>
17973 !! end
17974
17975 !! test
17976 Double RFC
17977 !! wikitext
17978 RFC RFC 1234
17979 !! html
17980 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17981 </p>
17982 !! end
17983
17984 !! test
17985 Double RFC with a wiki link
17986 !! wikitext
17987 RFC [[RFC 1234]]
17988 !! html
17989 <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>
17990 </p>
17991 !! end
17992
17993 !! test
17994 RFC code coverage
17995 !! wikitext
17996 RFC 983&#x20;987
17997 !! html
17998 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17999 </p>
18000 !! html+tidy
18001 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18002 !! end
18003
18004 !! test
18005 Centre-aligned image
18006 !! wikitext
18007 [[Image:foobar.jpg|centre]]
18008 !! html
18009 <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>
18010
18011 !!end
18012
18013 !! test
18014 None-aligned image
18015 !! wikitext
18016 [[Image:foobar.jpg|none]]
18017 !! html
18018 <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>
18019
18020 !!end
18021
18022 !! test
18023 Width + Height sized image (using px) (height is ignored)
18024 !! wikitext
18025 [[Image:foobar.jpg|640x480px]]
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, no following whitespace)
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 following 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 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18051 !! wikitext
18052 [[Image:foobar.jpg| 640px]]
18053 !! html
18054 <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>
18055 </p>
18056 !!end
18057
18058 !! test
18059 Image with page parameter
18060 !! options
18061 djvu
18062 !! wikitext
18063 [[File:LoremIpsum.djvu|page=2]]
18064 !! html/php
18065 <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>
18066 </p>
18067 !! html/parsoid
18068 <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>
18069 !! end
18070
18071 !! test
18072 Another italics / bold test
18073 !! wikitext
18074 ''' ''x'
18075 !! html
18076 <pre>'<i> </i>x'
18077 </pre>
18078 !!end
18079
18080 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18081 !! test
18082 dt/dd/dl test
18083 !! wikitext
18084 :;;;::
18085 !! html/php
18086 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18087
18088 !! html/parsoid
18089 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18090
18091 !!end
18092
18093
18094 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18095 !! test
18096 Images with the "|" character in the comment
18097 !! wikitext
18098 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18099 !! html/php
18100 <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>
18101
18102 !! html/parsoid
18103 <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>
18104 !! end
18105
18106 !! test
18107 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18108 !! wikitext
18109 <html><script>alert(1);</script></html>
18110 !! html
18111 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18112 </p>
18113 !! end
18114
18115 !! test
18116 HTML with raw HTML ($wgRawHtml==true)
18117 !! options
18118 wgRawHtml=1
18119 !! wikitext
18120 <html><script>alert(1);</script></html>
18121 !! html
18122 <p><script>alert(1);</script>
18123 </p>
18124 !! end
18125
18126 !! test
18127 Parents of subpages, one level up
18128 !! options
18129 subpage title=[[Subpage test/L1/L2/L3]]
18130 !! wikitext
18131 [[../|L2]]
18132 !! html
18133 <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>
18134 </p>
18135 !! end
18136
18137
18138 !! test
18139 Parents of subpages, one level up, not named
18140 !! options
18141 subpage title=[[Subpage test/L1/L2/L3]]
18142 !! wikitext
18143 [[../]]
18144 !! html
18145 <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>
18146 </p>
18147 !! end
18148
18149
18150
18151 !! test
18152 Parents of subpages, two levels up
18153 !! options
18154 subpage title=[[Subpage test/L1/L2/L3]]
18155 !! wikitext
18156 [[../../|L1]]2
18157
18158 [[../../|L1]]l
18159 !! html
18160 <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
18161 </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>
18162 </p>
18163 !! end
18164
18165 !! test
18166 Parents of subpages, two levels up, without trailing slash or name.
18167 !! options
18168 subpage title=[[Subpage test/L1/L2/L3]]
18169 !! wikitext
18170 [[../..]]
18171 !! html
18172 <p>[[../..]]
18173 </p>
18174 !! end
18175
18176 !! test
18177 Parents of subpages, two levels up, with lots of extra trailing slashes.
18178 !! options
18179 subpage title=[[Subpage test/L1/L2/L3]]
18180 !! wikitext
18181 [[../../////]]
18182 !! html
18183 <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>
18184 </p>
18185 !! end
18186
18187 !! article
18188 Subpage test/L1/L2/L3Sibling
18189 !! text
18190 Sibling article
18191 !! endarticle
18192
18193 !! test
18194 Transclusion of a sibling page (one level up)
18195 !! options
18196 subpage title=[[Subpage test/L1/L2/L3]]
18197 !! wikitext
18198 {{../L3Sibling}}
18199 !! html
18200 <p>Sibling article
18201 </p>
18202 !! end
18203
18204 !! test
18205 Transclusion of a child page
18206 !! options
18207 subpage title=[[Subpage test/L1/L2]]
18208 !! wikitext
18209 {{/L3Sibling}}
18210 !! html
18211 <p>Sibling article
18212 </p>
18213 !! end
18214
18215 !! test
18216 Non-transclusion because of too many up levels
18217 !! options
18218 subpage title=[[Subpage test/L1/L2/L3]]
18219 !! wikitext
18220 {{../../../../More than parent}}
18221 !! html
18222 <p>{{../../../../More than parent}}
18223 </p>
18224 !! end
18225
18226 !! test
18227 Definition list code coverage
18228 !! wikitext
18229 ; title : def
18230 ; title : def
18231 ;title: def
18232 !! html/php
18233 <dl><dt> title &#160;</dt>
18234 <dd> def</dd>
18235 <dt> title&#160;</dt>
18236 <dd> def</dd>
18237 <dt>title</dt>
18238 <dd> def</dd></dl>
18239
18240 !! html/parsoid
18241 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18242 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18243 <dt>title</dt><dd> def</dd></dl>
18244 !! end
18245
18246 !! test
18247 Don't fall for the self-closing div
18248 !! wikitext
18249 <div>hello world</div/>
18250 !! html
18251 <div>hello world</div>
18252
18253 !! end
18254
18255 !! test
18256 MSGNW magic word
18257 !! wikitext
18258 {{MSGNW:msg}}
18259 !! html
18260 <p>&#91;&#91;:Template:Msg&#93;&#93;
18261 </p>
18262 !! end
18263
18264 !! test
18265 RAW magic word
18266 !! wikitext
18267 {{RAW:QUERTY}}
18268 !! html
18269 <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>
18270 </p>
18271 !! end
18272
18273 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18274 !! test
18275 Always escape literal '>' in output, not just after '<'
18276 !! wikitext
18277 ><>
18278 !! html
18279 <p>&gt;&lt;&gt;
18280 </p>
18281 !! end
18282
18283 !! test
18284 Template caching
18285 !! wikitext
18286 {{Test}}
18287 {{Test}}
18288 !! html
18289 <p>This is a test template
18290 This is a test template
18291 </p>
18292 !! end
18293
18294
18295 !! article
18296 MediaWiki:Fake
18297 !! text
18298 ==header==
18299 !! endarticle
18300
18301 !! test
18302 Inclusion of !userCanEdit() content
18303 !! wikitext
18304 {{MediaWiki:Fake}}
18305 !! html
18306 <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>
18307
18308 !! end
18309
18310
18311 !! test
18312 Out-of-order TOC heading levels
18313 !! wikitext
18314 ==2==
18315 ======6======
18316 ===3===
18317 =1=
18318 =====5=====
18319 ==2==
18320 !! html
18321 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18322 <ul>
18323 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18324 <ul>
18325 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18326 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18327 </ul>
18328 </li>
18329 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18330 <ul>
18331 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18332 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18333 </ul>
18334 </li>
18335 </ul>
18336 </div>
18337
18338 <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>
18339 <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>
18340 <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>
18341 <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>
18342 <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>
18343 <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>
18344
18345 !! end
18346
18347
18348 !! test
18349 ISBN with a dummy number
18350 !! wikitext
18351 ISBN ---
18352 !! html
18353 <p>ISBN ---
18354 </p>
18355 !! end
18356
18357
18358 !! test
18359 ISBN with space-delimited number
18360 !! wikitext
18361 ISBN 92 9017 032 8
18362 !! html
18363 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18364 </p>
18365 !! end
18366
18367
18368 !! test
18369 ISBN with multiple spaces, no number
18370 !! wikitext
18371 ISBN foo
18372 !! html
18373 <p>ISBN foo
18374 </p>
18375 !! end
18376
18377
18378 !! test
18379 ISBN length
18380 !! wikitext
18381 ISBN 123456789
18382
18383 ISBN 1234567890
18384
18385 ISBN 12345678901
18386 !! html
18387 <p>ISBN 123456789
18388 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18389 </p><p>ISBN 12345678901
18390 </p>
18391 !! end
18392
18393
18394 !! test
18395 ISBN with trailing year (bug 8110)
18396 !! wikitext
18397 ISBN 1-234-56789-0 - 2006
18398
18399 ISBN 1 234 56789 0 - 2006
18400 !! html
18401 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18402 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18403 </p>
18404 !! end
18405
18406
18407 !! test
18408 anchorencode
18409 !! wikitext
18410 {{anchorencode:foo bar©#%n}}
18411 !! html
18412 <p>foo_bar.C2.A9.23.25n
18413 </p>
18414 !! end
18415
18416 !! test
18417 anchorencode trims spaces
18418 !! wikitext
18419 {{anchorencode: __pretty__please__}}
18420 !! html
18421 <p>pretty_please
18422 </p>
18423 !! end
18424
18425 !! test
18426 anchorencode deals with links
18427 !! wikitext
18428 {{anchorencode: [[hello|world]] [[hi]]}}
18429 !! html
18430 <p>world_hi
18431 </p>
18432 !! end
18433
18434 !! test
18435 anchorencode deals with templates
18436 !! wikitext
18437 {{anchorencode: {{Foo}} }}
18438 !! html
18439 <p>FOO
18440 </p>
18441 !! end
18442
18443 !! test
18444 anchorencode encodes like the TOC generator: (bug 18431)
18445 !! wikitext
18446 === _ +:.3A%3A&&amp;]] ===
18447 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18448 __NOEDITSECTION__
18449 !! html
18450 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18451 <p>.2B:.3A.253A.26.26.5D.5D
18452 </p>
18453 !! end
18454
18455 !! test
18456 Bug 6200: blockquotes and paragraph formatting
18457 !! wikitext
18458 <blockquote>
18459 foo
18460 </blockquote>
18461
18462 bar
18463
18464 baz
18465 !! html
18466 <blockquote>
18467 <p>foo
18468 </p>
18469 </blockquote>
18470 <p>bar
18471 </p>
18472 <pre>baz
18473 </pre>
18474 !! end
18475
18476 !! test
18477 Bug 8293: Use of center tag ruins paragraph formatting
18478 !! wikitext
18479 <center>
18480 foo
18481 </center>
18482
18483 bar
18484
18485 baz
18486 !! html
18487 <center>
18488 <p>foo
18489 </p>
18490 </center>
18491 <p>bar
18492 </p>
18493 <pre>baz
18494 </pre>
18495 !! end
18496
18497 !!test
18498 Parsing of overlapping (improperly nested) inline html tags
18499 !! wikitext
18500 <span><s>x</span></s>
18501 !! html/php
18502 <p><span><s>x&lt;/span&gt;</s></span>
18503 </p>
18504 !! html/parsoid
18505 <p><span><s>x</s></span>
18506 </p>
18507 !!end
18508
18509 ###
18510 ### Language variants related tests
18511 ###
18512 !! test
18513 Self-link in language variants
18514 !! options
18515 title=[[Dunav]] language=sr
18516 !! wikitext
18517 Both [[Dunav]] and [[Дунав]] are names for this river.
18518 !! html
18519 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18520 </p>
18521 !!end
18522
18523 !! article
18524 Дуна
18525 !! text
18526 content
18527 !! endarticle
18528
18529 !! test
18530 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18531 !! options
18532 title=[[Duna]] language=sr
18533 !! wikitext
18534 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18535 !! html
18536 <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.
18537 </p>
18538 !! end
18539
18540 !! test
18541 Link to a section of a variant of this title shouldn't be parsed as self-link
18542 !! options
18543 title=[[Duna]] language=sr
18544 !! wikitext
18545 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18546 !! html
18547 <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.
18548 </p>
18549 !! end
18550
18551 !! test
18552 Link to pages in language variants
18553 !! options
18554 language=sr
18555 !! wikitext
18556 Main Page can be written as [[Маин Паге]]
18557 !! html
18558 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18559 </p>
18560 !!end
18561
18562
18563 !! test
18564 Multiple links to pages in language variants
18565 !! options
18566 language=sr
18567 !! wikitext
18568 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18569 !! html
18570 <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>.
18571 </p>
18572 !!end
18573
18574
18575 !! test
18576 Simple template in language variants
18577 !! options
18578 language=sr
18579 !! wikitext
18580 {{тест}}
18581 !! html
18582 <p>This is a test template
18583 </p>
18584 !! end
18585
18586
18587 !! test
18588 Template with explicit namespace in language variants
18589 !! options
18590 language=sr
18591 !! wikitext
18592 {{Template:тест}}
18593 !! html
18594 <p>This is a test template
18595 </p>
18596 !! end
18597
18598
18599 !! test
18600 Basic test for template parameter in language variants
18601 !! options
18602 language=sr
18603 !! wikitext
18604 {{парамтест|param=foo}}
18605 !! html
18606 <p>This is a test template with parameter foo
18607 </p>
18608 !! end
18609
18610
18611 !! test
18612 Simple category in language variants
18613 !! options
18614 language=sr cat
18615 !! wikitext
18616 [[Category:МедиаWики Усер'с Гуиде]]
18617 !! html
18618 <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>
18619 !! end
18620
18621
18622 !! article
18623 Category:分类
18624 !! text
18625 blah
18626 !! endarticle
18627
18628 !! article
18629 Category:分類
18630 !! text
18631 blah
18632 !! endarticle
18633
18634 !! test
18635 Don't convert blue categorylinks to another variant (bug 33210)
18636 !! options
18637 language=zh cat
18638 !! wikitext
18639 [[A]][[Category:分类]]
18640 !! html
18641 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18642 !! end
18643
18644
18645 !! test
18646 Stripping -{}- tags (language variants)
18647 !! options
18648 language=sr
18649 !! wikitext
18650 Latin proverb: -{Ne nuntium necare}-
18651 !! html
18652 <p>Latin proverb: Ne nuntium necare
18653 </p>
18654 !! end
18655
18656
18657 !! test
18658 Prevent conversion with -{}- tags (language variants)
18659 !! options
18660 language=sr variant=sr-ec
18661 !! wikitext
18662 Latinski: -{Ne nuntium necare}-
18663 !! html
18664 <p>Латински: Ne nuntium necare
18665 </p>
18666 !! end
18667
18668
18669 !! test
18670 Prevent conversion of text with -{}- tags (language variants)
18671 !! options
18672 language=sr variant=sr-ec
18673 !! wikitext
18674 Latinski: -{Ne nuntium necare}-
18675 !! html
18676 <p>Латински: Ne nuntium necare
18677 </p>
18678 !! end
18679
18680
18681 !! test
18682 Prevent conversion of links with -{}- tags (language variants)
18683 !! options
18684 language=sr variant=sr-ec
18685 !! wikitext
18686 -{[[Main Page]]}-
18687 !! html
18688 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18689 </p>
18690 !! end
18691
18692
18693 !! test
18694 -{}- tags within headlines (within html for parserConvert())
18695 !! options
18696 language=sr variant=sr-ec
18697 !! wikitext
18698 == -{Naslov}- ==
18699 !! html
18700 <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>
18701
18702 !! end
18703
18704
18705 !! test
18706 Explicit definition of language variant alternatives
18707 !! options
18708 language=zh variant=zh-tw
18709 !! wikitext
18710 -{zh:China;zh-tw:Taiwan}-, not China
18711 !! html
18712 <p>Taiwan, not China
18713 </p>
18714 !! end
18715
18716
18717 !! test
18718 Conversion around HTML tags
18719 !! options
18720 language=sr variant=sr-ec
18721 !! wikitext
18722 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18723 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18724 !! html
18725 <p>
18726 <span title="ЛаCтин">ски</span>
18727 </p>
18728 !! end
18729
18730
18731 !! test
18732 Explicit session-wise language variant mapping (A flag and - flag)
18733 !! options
18734 language=zh variant=zh-tw
18735 !! wikitext
18736 Taiwan is not China.
18737 But -{A|zh:China;zh-tw:Taiwan}- is China,
18738 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18739 and -{China}- is China.
18740 !! html
18741 <p>Taiwan is not China.
18742 But Taiwan is Taiwan,
18743 (This should be stripped!)
18744 and China is China.
18745 </p>
18746 !! end
18747
18748 !! test
18749 Explicit session-wise language variant mapping (H flag for hide)
18750 !! options
18751 language=zh variant=zh-tw
18752 !! wikitext
18753 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18754 Taiwan is China.
18755 !! html
18756 <p>(This should be stripped!)
18757 Taiwan is Taiwan.
18758 </p>
18759 !! end
18760
18761 !! test
18762 Adding explicit conversion rule for title (T flag)
18763 !! options
18764 language=zh variant=zh-tw showtitle
18765 !! wikitext
18766 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18767 !! html
18768 Taiwan
18769 <p>Should be stripped!
18770 </p>
18771 !! end
18772
18773 !! test
18774 Testing that changing the language variant here in the tests actually works
18775 !! options
18776 language=zh variant=zh showtitle
18777 !! wikitext
18778 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18779 !! html
18780 China
18781 <p>Should be stripped!
18782 </p>
18783 !! end
18784
18785 !! test
18786 Recursive conversion of alt and title attrs shouldn't clear converter state
18787 !! options
18788 language=zh variant=zh-cn showtitle
18789 !! wikitext
18790 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18791 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18792 !! html
18793 China
18794 <p>
18795 Should be stripped<span title="Exclamation">!</span>
18796 </p>
18797 !! end
18798
18799 !! test
18800 Bug 24072: more test on conversion rule for title
18801 !! options
18802 language=zh variant=zh-tw showtitle
18803 !! wikitext
18804 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18805 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18806 !! html
18807 Taiwan
18808 <p>This should be stripped!
18809 This won't take interferes with the title rule.
18810 </p>
18811 !! end
18812
18813 !! test
18814 Partly disable title conversion if variant == main language code
18815 !! options
18816 language=zh variant=zh title=[[ZH]] showtitle
18817 !! wikitext
18818 -{T|zh-cn:CN;zh-tw:TW}-
18819 !! html
18820 ZH
18821 <p>
18822 </p>
18823 !! end
18824
18825 !! test
18826 Partly disable title conversion if variant == main language code, more
18827 !! options
18828 language=zh variant=zh title=[[ZH]] showtitle
18829 !! wikitext
18830 -{T|TW}-
18831 !! html
18832 ZH
18833 <p>
18834 </p>
18835 !! end
18836
18837 !! test
18838 Raw output of variant escape tags (R flag)
18839 !! options
18840 language=zh variant=zh-tw
18841 !! wikitext
18842 Raw: -{R|zh:China;zh-tw:Taiwan}-
18843 !! html
18844 <p>Raw: zh:China;zh-tw:Taiwan
18845 </p>
18846 !! end
18847
18848 !! test
18849 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18850 !! options
18851 language=zh variant=zh-cn
18852 !! input
18853 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18854 !! result
18855 <p>0
18856 </p>
18857 !! end
18858
18859 !! test
18860 Conversion rules from [numeric-only string] to [something else] (T48634)
18861 !! options
18862 language=zh variant=zh-cn
18863 !! input
18864 -{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
18865 !! result
18866 <p>D12345EE12345
18867 </p>
18868 !! end
18869
18870 !! test
18871 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18872 !! options
18873 language=zh variant=zh-cn
18874 !! input
18875 -{H|zh-cn:foo;zh-tw:;}-foobar
18876 !! result
18877 <p>foobar
18878 </p>
18879 !! end
18880
18881 !! test
18882 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
18883 !! options
18884 language=zh variant=zh-cn
18885 !! input
18886 -{H|=>zh-cn:foo;}-foobar
18887 !! result
18888 <p>foobar
18889 </p>
18890 !! end
18891
18892 !! test
18893 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
18894 !! options
18895 language=zh variant=zh-cn
18896 !! input
18897 -{H|}-foobar
18898 !! result
18899 <p>foobar
18900 </p>
18901 !! end
18902
18903 !! test
18904 Nested using of manual convert syntax
18905 !! options
18906 language=zh variant=zh-hk
18907 !! wikitext
18908 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18909 !! html
18910 <p>Nested: Hello Hong Kong!
18911 </p>
18912 !! end
18913
18914 !! test
18915 Proper conversion of text in external links
18916 !! options
18917 language=sr variant=sr-ec
18918 !! wikitext
18919 http://www.google.com
18920 gopher://www.google.com
18921 [http://www.google.com http://www.google.com]
18922 [gopher://www.google.com gopher://www.google.com]
18923 [https://www.google.com irc://www.google.com]
18924 [ftp://www.google.com www.google.com/ftp://dir]
18925 [//www.google.com www.google.com]
18926 !! html
18927 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18928 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18929 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18930 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18931 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18932 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18933 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18934 </p>
18935 !! end
18936
18937 !! test
18938 Do not convert roman numbers to language variants
18939 !! options
18940 language=sr variant=sr-ec
18941 !! wikitext
18942 Fridrih IV je car.
18943 !! html
18944 <p>Фридрих IV је цар.
18945 </p>
18946 !! end
18947
18948 !! test
18949 Unclosed language converter markup "-{"
18950 !! options
18951 language=sr
18952 !! wikitext
18953 -{T|hello
18954 !! html
18955 <p>-{T|hello
18956 </p>
18957 !! end
18958
18959 !! test
18960 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18961 !! options
18962 language=sr
18963 !! wikitext
18964 -{R|=&gt;}-
18965 !! html
18966 <p>=&gt;
18967 </p>
18968 !!end
18969
18970 !! test
18971 Don't break link parsing if language converter markup is in the caption.
18972 !! options
18973 language=sr variant=sr-ec
18974 !! wikitext
18975 [[Main Page|-{R|main page}-]]
18976 !! html
18977 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18978 </p>
18979 !! end
18980
18981 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18982 !! test
18983 Don't break image parsing if language converter markup is in the caption.
18984 !! options
18985 language=sr
18986 !! wikitext
18987 [[File:Foobar.jpg|-{R|caption}-]]
18988 !! html/parsoid
18989 <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>
18990 </p>
18991 !! end
18992
18993 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18994 !! test
18995 Don't break list handling if language converter markup is in the item.
18996 !! options
18997 language=zh variant=zh-cn
18998 !! wikitext
18999 ;-{zh-cn:AAA;zh-tw:BBB}-
19000 !! html/php
19001 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19002
19003 !! html/parsoid
19004 <dl><dt>AAA
19005 </dt></dl>
19006 !! end
19007
19008 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19009 !! test
19010 Don't break table handling if language converter markup is in the cell.
19011 !! options
19012 language=sr variant=sr-ec
19013 !! wikitext
19014 {|
19015 |-
19016 | -{R|B}-
19017 |}
19018 !! html/php
19019 <table>
19020
19021 <tr>
19022 <td>Б}-
19023 </td></tr></table>
19024
19025 !! html/parsoid
19026 <table>
19027
19028 <tr>
19029 <td> B
19030 </td></tr></table>
19031
19032 !! end
19033
19034 !! test
19035 Bug 529: Uncovered bullet
19036 !! wikitext
19037 * Foo {{bullet}}
19038 !! html
19039 <ul><li> Foo </li>
19040 <li> Bar</li></ul>
19041
19042 !! end
19043
19044 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19045 # Templates in Wikipedia rely on this behavior, as tidy has always been
19046 # enabled there. These tests are normally run *without* tidy, so specify the
19047 # full output here.
19048 # To test realistic parsing behavior, apply a tidy-like transformation to both
19049 # the expected output and your parser's output.
19050 !! test
19051 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19052 !! wikitext
19053 ******* Foo {{bullet}}
19054 !! html
19055 <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>
19056 <li> Bar</li></ul>
19057
19058 !! end
19059
19060 !! test
19061 Bug 529: Uncovered table already at line-start
19062 !! wikitext
19063 x
19064
19065 {{table}}
19066 y
19067 !! html
19068 <p>x
19069 </p>
19070 <table>
19071 <tr>
19072 <td> 1 </td>
19073 <td> 2
19074 </td></tr>
19075 <tr>
19076 <td> 3 </td>
19077 <td> 4
19078 </td></tr></table>
19079 <p>y
19080 </p>
19081 !! end
19082
19083 !! test
19084 Bug 529: Uncovered bullet in parser function result
19085 !! wikitext
19086 * Foo {{lc:{{bullet}} }}
19087 !! html
19088 <ul><li> Foo </li>
19089 <li> bar</li></ul>
19090
19091 !! end
19092
19093 !! test
19094 Bug 5678: Double-parsed template argument
19095 !! wikitext
19096 {{lc:{{{1}}}|hello}}
19097 !! html
19098 <p>{{{1}}}
19099 </p>
19100 !! end
19101
19102 !! test
19103 Bug 5678: Double-parsed template invocation
19104 !! wikitext
19105 {{lc:{{paramtest {{!}} param = hello }} }}
19106 !! html
19107 <p>{{paramtest | param = hello }}
19108 </p>
19109 !! end
19110
19111 !! test
19112 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19113 !! options
19114 language=cs
19115 title=[[Main Page]]
19116 !! wikitext
19117 {{PRVNÍVELKÉ:ěščř}}
19118 {{prvnívelké:ěščř}}
19119 {{PRVNÍMALÉ:ěščř}}
19120 {{prvnímalé:ěščř}}
19121 {{MALÁ:ěščř}}
19122 {{malá:ěščř}}
19123 {{VELKÁ:ěščř}}
19124 {{velká:ěščř}}
19125 !! html
19126 <p>Ěščř
19127 Ěščř
19128 ěščř
19129 ěščř
19130 ěščř
19131 ěščř
19132 ĚŠČŘ
19133 ĚŠČŘ
19134 </p>
19135 !! end
19136
19137 !! test
19138 Morwen/13: Unclosed link followed by heading
19139 !! wikitext
19140 [[link
19141 ==heading==
19142 !! html
19143 <p>[[link
19144 </p>
19145 <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>
19146
19147 !! end
19148
19149 !! test
19150 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19151 !! wikitext
19152 {{foo|
19153 =heading=
19154 !! html
19155 <p>{{foo|
19156 </p>
19157 <h1><span class="mw-headline" id="heading">heading</span></h1>
19158
19159 !! end
19160
19161 !! test
19162 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19163 !! wikitext
19164 {{foo|
19165 ==heading==
19166 !! html
19167 <p>{{foo|
19168 </p>
19169 <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>
19170
19171 !! end
19172
19173 !! test
19174 Tildes in comments
19175 !! options
19176 pst
19177 !! wikitext
19178 <!-- ~~~~ -->
19179 !! html
19180 <!-- ~~~~ -->
19181 !! end
19182
19183 !! test
19184 Paragraphs inside divs (no extra line breaks)
19185 !! wikitext
19186 <div>Line one
19187
19188 Line two</div>
19189 !! html
19190 <div>Line one
19191 Line two</div>
19192
19193 !! end
19194
19195 !! test
19196 Paragraphs inside divs (extra line break on open)
19197 !! wikitext
19198 <div>
19199 Line one
19200
19201 Line two</div>
19202 !! html
19203 <div>
19204 <p>Line one
19205 </p>
19206 Line two</div>
19207
19208 !! end
19209
19210 !! test
19211 Paragraphs inside divs (extra line break on close)
19212 !! wikitext
19213 <div>Line one
19214
19215 Line two
19216 </div>
19217 !! html
19218 <div>Line one
19219 <p>Line two
19220 </p>
19221 </div>
19222
19223 !! end
19224
19225 !! test
19226 Paragraphs inside divs (extra line break on open and close)
19227 !! wikitext
19228 <div>
19229 Line one
19230
19231 Line two
19232 </div>
19233 !! html
19234 <div>
19235 <p>Line one
19236 </p><p>Line two
19237 </p>
19238 </div>
19239
19240 !! end
19241
19242 !! test
19243 Nesting tags, paragraphs on lines which begin with <div>
19244 !! wikitext
19245 <div></div><strong>A
19246 B</strong>
19247 !! html/php+tidy
19248 <p><strong>A</strong></p>
19249 <p><strong>B</strong></p>
19250 !! html/parsoid
19251 <div></div>
19252 <p><strong>A
19253 B</strong>
19254 </p>
19255 !! end
19256
19257 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19258 !! test
19259 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19260 !! wikitext
19261 <blockquote>Line one
19262
19263 Line two</blockquote>
19264 !! html
19265 <blockquote>Line one
19266 Line two</blockquote>
19267
19268 !! html+tidy
19269 <blockquote>
19270 <p>Line one Line two</p>
19271 </blockquote>
19272 !! end
19273
19274 !! test
19275 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19276 !! wikitext
19277 <blockquote>
19278 Line one
19279
19280 Line two</blockquote>
19281 !! html
19282 <blockquote>
19283 <p>Line one
19284 </p>
19285 Line two</blockquote>
19286
19287 !! html+tidy
19288 <blockquote>
19289 <p>Line one</p>
19290 Line two</blockquote>
19291 !! end
19292
19293 !! test
19294 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19295 !! wikitext
19296 <blockquote>Line one
19297
19298 Line two
19299 </blockquote>
19300 !! html
19301 <blockquote>Line one
19302 <p>Line two
19303 </p>
19304 </blockquote>
19305
19306 !! html+tidy
19307 <blockquote>
19308 <p>Line one</p>
19309 <p>Line two</p>
19310 </blockquote>
19311 !! end
19312
19313 !! test
19314 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19315 !! wikitext
19316 <blockquote>
19317 Line one
19318
19319 Line two
19320 </blockquote>
19321 !! html
19322 <blockquote>
19323 <p>Line one
19324 </p><p>Line two
19325 </p>
19326 </blockquote>
19327
19328 !! html+tidy
19329 <blockquote>
19330 <p>Line one</p>
19331 <p>Line two</p>
19332 </blockquote>
19333 !! end
19334
19335 !! test
19336 Paragraphs inside blockquotes/divs (no extra line breaks)
19337 !! wikitext
19338 <blockquote><div>Line one
19339
19340 Line two</div></blockquote>
19341 !! html
19342 <blockquote><div>Line one
19343 Line two</div></blockquote>
19344
19345 !! end
19346
19347 !! test
19348 Paragraphs inside blockquotes/divs (extra line break on open)
19349 !! wikitext
19350 <blockquote><div>
19351 Line one
19352
19353 Line two</div></blockquote>
19354 !! html
19355 <blockquote><div>
19356 <p>Line one
19357 </p>
19358 Line two</div></blockquote>
19359
19360 !! end
19361
19362 !! test
19363 Paragraphs inside blockquotes/divs (extra line break on close)
19364 !! wikitext
19365 <blockquote><div>Line one
19366
19367 Line two
19368 </div></blockquote>
19369 !! html
19370 <blockquote><div>Line one
19371 <p>Line two
19372 </p>
19373 </div></blockquote>
19374
19375 !! end
19376
19377 !! test
19378 Paragraphs inside blockquotes/divs (extra line break on open and close)
19379 !! wikitext
19380 <blockquote><div>
19381 Line one
19382
19383 Line two
19384 </div></blockquote>
19385 !! html
19386 <blockquote><div>
19387 <p>Line one
19388 </p><p>Line two
19389 </p>
19390 </div></blockquote>
19391
19392 !! end
19393
19394 !! test
19395 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19396 !! options
19397 wgLinkHolderBatchSize=0
19398 !! wikitext
19399 [[meatball:1]]
19400 [[meatball:2]]
19401 [[meatball:3]]
19402 !! html
19403 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19404 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19405 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19406 </p>
19407 !! end
19408
19409 !! test
19410 Free external link invading image caption
19411 !! wikitext
19412 [[Image:Foobar.jpg|thumb|http://x|hello]]
19413 !! html
19414 <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>
19415
19416 !! end
19417
19418 !! test
19419 Bug 15196: localised external link numbers
19420 !! options
19421 language=fa
19422 !! wikitext
19423 [http://en.wikipedia.org/]
19424 !! html/php
19425 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19426 </p>
19427 !! html/parsoid
19428 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19429 !! end
19430
19431 !! test
19432 Multibyte character in padleft
19433 !! wikitext
19434 {{padleft:-Hello|7|Æ}}
19435 !! html
19436 <p>Æ-Hello
19437 </p>
19438 !! end
19439
19440 !! test
19441 Multibyte character in padright
19442 !! wikitext
19443 {{padright:Hello-|7|Æ}}
19444 !! html
19445 <p>Hello-Æ
19446 </p>
19447 !! end
19448
19449 !!test
19450 formatdate parser function
19451 !! wikitext
19452 {{#formatdate:2009-03-24}}
19453 !! html
19454 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19455 </p>
19456 !! end
19457
19458 !!test
19459 formatdate parser function, with default format
19460 !! wikitext
19461 {{#formatdate:2009-03-24|mdy}}
19462 !! html
19463 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19464 </p>
19465 !! end
19466
19467 !! test
19468 Spacing of numbers in formatted dates
19469 !! wikitext
19470 {{#formatdate:January 15}}
19471 !! html
19472 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19473 </p>
19474 !! end
19475
19476 !! test
19477 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
19478 !! options
19479 language=nl title=[[MediaWiki:Common.css]]
19480 !! wikitext
19481 {{#formatdate:2009-03-24|dmy}}
19482 !! html
19483 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19484 </p>
19485 !! end
19486
19487 #
19488 #
19489 #
19490
19491 #
19492 # Edit comments
19493 #
19494
19495 !! test
19496 Edit comment with link
19497 !! options
19498 comment
19499 !! wikitext
19500 I like the [[Main Page]] a lot
19501 !! html
19502 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19503 !!end
19504
19505 !! test
19506 Edit comment with link and link text
19507 !! options
19508 comment
19509 !! wikitext
19510 I like the [[Main Page|best pages]] a lot
19511 !! html
19512 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19513 !!end
19514
19515 !! test
19516 Edit comment with link and link text with suffix
19517 !! options
19518 comment
19519 !! wikitext
19520 I like the [[Main Page|best page]]s a lot
19521 !! html
19522 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19523 !!end
19524
19525 !! test
19526 Edit comment with section link (non-local, eg in history list)
19527 !! options
19528 comment title=[[Main Page]]
19529 !! wikitext
19530 /* External links */ removed bogus entries
19531 !! html
19532 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19533 !!end
19534
19535 !! test
19536 Edit comment with section link and text before it (non-local, eg in history list)
19537 !! options
19538 comment title=[[Main Page]]
19539 !! wikitext
19540 pre-comment text /* External links */ removed bogus entries
19541 !! html
19542 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>
19543 !!end
19544
19545 !! test
19546 Edit comment with section link (local, eg in diff view)
19547 !! options
19548 comment local title=[[Main Page]]
19549 !! wikitext
19550 /* External links */ removed bogus entries
19551 !! html
19552 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19553 !!end
19554
19555 !! test
19556 Edit comment with subpage link (bug 14080)
19557 !! options
19558 comment
19559 subpage
19560 title=[[Subpage test]]
19561 !! wikitext
19562 Poked at a [[/subpage]] here...
19563 !! html
19564 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19565 !!end
19566
19567 !! test
19568 Edit comment with subpage link and link text (bug 14080)
19569 !! options
19570 comment
19571 subpage
19572 title=[[Subpage test]]
19573 !! wikitext
19574 Poked at a [[/subpage|neat little page]] here...
19575 !! html
19576 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19577 !!end
19578
19579 !! test
19580 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19581 !! options
19582 comment
19583 title=[[Subpage test]]
19584 !! wikitext
19585 Poked at a [[/subpage]] here...
19586 !! html
19587 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...
19588 !!end
19589
19590 !! test
19591 Edit comment with bare anchor link (local, as on diff)
19592 !! options
19593 comment
19594 local
19595 title=[[Main Page]]
19596 !! wikitext
19597 [[#section]]
19598 !! html
19599 <a href="#section">#section</a>
19600 !! end
19601
19602 !! test
19603 Edit comment with bare anchor link (non-local, as on history)
19604 !! options
19605 comment
19606 title=[[Main Page]]
19607 !! wikitext
19608 [[#section]]
19609 !! html
19610 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19611 !! end
19612
19613 !! test
19614 Anchor starting with underscore
19615 !! wikitext
19616 [[#_ref|One]]
19617 !! html
19618 <p><a href="#_ref">One</a>
19619 </p>
19620 !! end
19621
19622 !! test
19623 Id starting with underscore
19624 !! wikitext
19625 <div id="_ref"></div>
19626 !! html
19627 <div id="_ref"></div>
19628
19629 !! end
19630
19631 !! test
19632 Space normalisation on autocomment (bug 22784)
19633 !! options
19634 comment
19635 title=[[Main Page]]
19636 !! wikitext
19637 /* __hello__world__ */
19638 !! html
19639 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19640 !! end
19641
19642 !! test
19643 percent-encoding and + signs in comments (Bug 26410)
19644 !! options
19645 comment
19646 !! wikitext
19647 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19648 !! html/php
19649 <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>
19650 !! end
19651
19652 # Parsoid doesn't support this yet: see bug 73581
19653 # but it *should* omit the 'src' attribute if the image is bad.
19654 # PHP side of tests was disabled in
19655 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19656 # because of issues in the PHP parserTests infrastructure
19657 # (but the output below is indeed what the PHP side emits)
19658 !! test
19659 Bad images - basic functionality
19660 !! wikitext
19661 [[File:Bad.jpg]]
19662 !! DISABLED/html/php
19663 !! html/parsoid
19664 <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>
19665 !! end
19666
19667 !! test
19668 Bad images - bug 16039: text after bad image disappears
19669 !! wikitext
19670 Foo bar
19671 [[File:Bad.jpg]]
19672 Bar foo
19673 !! DISABLED/html/php
19674 <p>Foo bar
19675 </p><p>Bar foo
19676 </p>
19677 !! html/parsoid
19678 <p>Foo bar
19679 <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>
19680 Bar foo</p>
19681 !! end
19682
19683 !! test
19684 Verify that displaytitle works (bug #22501) no displaytitle
19685 !! options
19686 showtitle
19687 !! config
19688 wgAllowDisplayTitle=true
19689 wgRestrictDisplayTitle=false
19690 !! wikitext
19691 this is not the the title
19692 !! html
19693 Parser test
19694 <p>this is not the the title
19695 </p>
19696 !! end
19697
19698 !! test
19699 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19700 !! options
19701 showtitle
19702 title=[[Screen]]
19703 !! config
19704 wgAllowDisplayTitle=true
19705 wgRestrictDisplayTitle=false
19706 !! wikitext
19707 this is not the the title
19708 {{DISPLAYTITLE:whatever}}
19709 !! html
19710 whatever
19711 <p>this is not the the title
19712 </p>
19713 !! end
19714
19715 !! test
19716 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19717 !! options
19718 showtitle
19719 title=[[Screen]]
19720 !! config
19721 wgAllowDisplayTitle=true
19722 wgRestrictDisplayTitle=true
19723 !! wikitext
19724 this is not the the title
19725 {{DISPLAYTITLE:whatever}}
19726 !! html
19727 Screen
19728 <p>this is not the the title
19729 </p>
19730 !! end
19731
19732 !! test
19733 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19734 !! options
19735 showtitle
19736 title=[[Screen]]
19737 !! config
19738 wgAllowDisplayTitle=true
19739 wgRestrictDisplayTitle=true
19740 !! wikitext
19741 this is not the the title
19742 {{DISPLAYTITLE:screen}}
19743 !! html
19744 screen
19745 <p>this is not the the title
19746 </p>
19747 !! end
19748
19749 !! test
19750 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19751 !! options
19752 showtitle
19753 title=[[Screen]]
19754 !! config
19755 wgAllowDisplayTitle=false
19756 !! wikitext
19757 this is not the the title
19758 {{DISPLAYTITLE:screen}}
19759 !! html
19760 Screen
19761 <p>this is not the the title
19762 <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>
19763 </p>
19764 !! end
19765
19766 !! test
19767 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19768 !! options
19769 showtitle
19770 title=[[Screen]]
19771 !! config
19772 wgAllowDisplayTitle=false
19773 !! wikitext
19774 this is not the the title
19775 !! html
19776 Screen
19777 <p>this is not the the title
19778 </p>
19779 !! end
19780
19781 !! test
19782 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19783 !! options
19784 showtitle
19785 title=[[Screen]]
19786 !! config
19787 wgAllowDisplayTitle=true
19788 wgRestrictDisplayTitle=true
19789 !! wikitext
19790 this is not the the title
19791 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19792 !! html
19793 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19794 <p>this is not the the title
19795 </p>
19796 !! end
19797
19798 !! test
19799 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19800 !! options
19801 showtitle
19802 title=[[Screen]]
19803 !! config
19804 wgAllowDisplayTitle=true
19805 wgRestrictDisplayTitle=true
19806 !! wikitext
19807 this is not the the title
19808 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19809 !! html
19810 <span style="color: red;">s</span>creen
19811 <p>this is not the the title
19812 </p>
19813 !! end
19814
19815 !! test
19816 Page status indicators: Empty name is invalid
19817 !! options
19818 showindicators
19819 !! wikitext
19820 <indicator name=" "></indicator>
19821 <indicator></indicator>
19822 !! html
19823 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19824 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19825 </p>
19826 !! end
19827
19828 !! test
19829 Page status indicators: Weird syntaxes that are okay
19830 !! options
19831 showindicators
19832 !! wikitext
19833 <indicator name="empty" />
19834 <indicator name></indicator>
19835 !! html
19836 empty=
19837 name=
19838 <p><br />
19839 </p>
19840 !! end
19841
19842 !! test
19843 Page status indicators: Torture test
19844 !! options
19845 showindicators
19846 !! wikitext
19847 <indicator name="01">hello world</indicator>
19848 <indicator name="02">[[Main Page]]</indicator>
19849 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19850 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19851 <indicator name="05">* foo
19852 * bar</indicator>
19853 <indicator name="06"><nowiki>foo</nowiki></indicator>
19854 <indicator name="07"> Preformatted</indicator>
19855 <indicator name="08"><div>Broken tag</indicator>
19856 <indicator name="09">{| class=wikitable
19857 | cell
19858 |}</indicator>
19859 <indicator name="10">Two
19860
19861 paragraphs</indicator>
19862 !! html
19863 01=hello world
19864 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19865 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" />
19866 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>
19867 05=<ul><li> foo</li>
19868 <li> bar</li></ul>
19869
19870 06=foo
19871 07=<pre>Preformatted
19872 </pre>
19873 08=<div>Broken tag</div>
19874
19875 09=<table class="wikitable">
19876 <tr>
19877 <td> cell
19878 </td></tr></table>
19879
19880 10=<p>Two
19881 </p><p>paragraphs
19882 </p>
19883 <p><br />
19884 </p><p><br />
19885 </p><p><br />
19886 </p><p><br />
19887 </p><p><br />
19888 </p>
19889 !! end
19890
19891 !! test
19892 preload: check <noinclude> and <includeonly>
19893 !! options
19894 preload
19895 !! wikitext
19896 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19897 !! html
19898 Hello kind world.
19899 !! end
19900
19901 !! test
19902 preload: check <onlyinclude>
19903 !! options
19904 preload
19905 !! wikitext
19906 Goodbye <onlyinclude>Hello world</onlyinclude>
19907 !! html
19908 Hello world
19909 !! end
19910
19911 !! test
19912 preload: can pass tags through if we want to
19913 !! options
19914 preload
19915 !! wikitext
19916 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19917 !! html
19918 <includeonly>Hello world</includeonly>
19919 !! end
19920
19921 !! test
19922 preload: check that it doesn't try to do tricks
19923 !! options
19924 preload
19925 !! wikitext
19926 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19927 !! html
19928 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19929 !! end
19930
19931 !! test
19932 Play a bit with r67090 and bug 3158
19933 !! wikitext
19934 <div style="width:50% !important">&nbsp;</div>
19935 <div style="width:50%&nbsp;!important">&nbsp;</div>
19936 <div style="width:50%&#160;!important">&nbsp;</div>
19937 <div style="border : solid;">&nbsp;</div>
19938 !! html/php
19939 <div style="width:50% !important">&#160;</div>
19940 <div style="width:50% !important">&#160;</div>
19941 <div style="width:50% !important">&#160;</div>
19942 <div style="border&#160;: solid;">&#160;</div>
19943
19944 !! html/parsoid
19945 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19946 <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>
19947 <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>
19948 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19949
19950 !! end
19951
19952 !! test
19953 HTML5 data attributes
19954 !! wikitext
19955 <span data-foo="bar">Baz</span>
19956 <p data-abc-def_hij="">Quuz</p>
19957 !! html
19958 <p><span data-foo="bar">Baz</span>
19959 </p>
19960 <p data-abc-def_hij="">Quuz</p>
19961
19962 !! end
19963
19964 !! test
19965 percent-encoding and + signs in internal links (Bug 26410)
19966 !! wikitext
19967 [[User:+%]] [[Page+title%]]
19968 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19969 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19970 [[%33%45]] [[%33%45+]]
19971 !! html/php
19972 <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>
19973 <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>
19974 <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>
19975 <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>
19976 </p>
19977 !! html/parsoid
19978 <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>
19979 <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>
19980 <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>
19981 <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>
19982 !! end
19983
19984 !! test
19985 Special characters in embedded file links (bug 27679)
19986 !! wikitext
19987 [[File:Contains & ampersand.jpg]]
19988 [[File:Does not exist.jpg|Title with & ampersand]]
19989 !! html/php
19990 <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>
19991 <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>
19992 </p>
19993 !! html/parsoid
19994 <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>
19995 <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>
19996 !! end
19997
19998 !! test
19999 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20000 !! wikitext
20001 Text&apos;s been normalized?
20002 !! html
20003 <p>Text&#39;s been normalized?
20004 </p>
20005 !! end
20006
20007 !! test
20008 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20009 !! wikitext
20010 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20011 !! html
20012 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20013 </p>
20014 !! end
20015
20016 !! test
20017 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20018 !! wikitext
20019 [http://www.example.org/ ideograms]
20020 !! html
20021 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20022 </p>
20023 !! end
20024
20025 !! test
20026 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20027 !! wikitext
20028 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20029 !! html
20030 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20031 </p>
20032 !! end
20033
20034 !! article
20035 Mediawiki:loop1
20036 !! text
20037 {{Identical|A}}
20038 !! endarticle
20039
20040 !! article
20041 Mediawiki:loop2
20042 !! text
20043 {{Identical|B}}
20044 !! endarticle
20045
20046 !! article
20047 Template:Identical
20048 !! text
20049 {{int:loop1}}
20050 {{int:loop2}}
20051 !! endarticle
20052
20053 !! test
20054 Bug 31098 Template which includes system messages which includes the template
20055 !! wikitext
20056 {{Identical}}
20057 !! html
20058 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20059 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20060 </p>
20061 !! end
20062
20063 !! test
20064 Bug31490 Turkish: ucfirst 'blah'
20065 !! options
20066 language=tr
20067 !! wikitext
20068 {{ucfirst:blah}}
20069 !! html
20070 <p>Blah
20071 </p>
20072 !! end
20073
20074 !! test
20075 Bug31490 Turkish: ucfirst 'ix'
20076 !! options
20077 language=tr
20078 !! wikitext
20079 {{ucfirst:ix}}
20080 !! html
20081 <p>İx
20082 </p>
20083 !! end
20084
20085 !! test
20086 Bug31490 Turkish: lcfirst 'BLAH'
20087 !! options
20088 language=tr
20089 !! wikitext
20090 {{lcfirst:BLAH}}
20091 !! html
20092 <p>bLAH
20093 </p>
20094 !! end
20095
20096 !! test
20097 Bug31490 Turkish: ucfırst (with a dotless i)
20098 !! options
20099 language=tr
20100 !! wikitext
20101 {{ucfırst:blah}}
20102 !! html
20103 <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>
20104 </p>
20105 !! end
20106
20107 !! test
20108 Bug31490 ucfırst (with a dotless i) with English language
20109 !! options
20110 language=en
20111 !! wikitext
20112 {{ucfırst:blah}}
20113 !! html
20114 <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>
20115 </p>
20116 !! end
20117
20118 !! test
20119 Bug 26375: TOC with italics
20120 !! options
20121 title=[[Main Page]]
20122 !! wikitext
20123 __TOC__
20124 == ''Lost'' episodes ==
20125 !! html
20126 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20127 <ul>
20128 <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>
20129 </ul>
20130 </div>
20131
20132 <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>
20133
20134 !! end
20135
20136 !! test
20137 Bug 26375: TOC with bold
20138 !! options
20139 title=[[Main Page]]
20140 !! wikitext
20141 __TOC__
20142 == '''should be bold''' then normal text ==
20143 !! html
20144 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20145 <ul>
20146 <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>
20147 </ul>
20148 </div>
20149
20150 <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>
20151
20152 !! end
20153
20154 !! test
20155 Bug 33845: Headings become cursive in TOC when they contain an image
20156 !! options
20157 title=[[Main Page]]
20158 !! wikitext
20159 __TOC__
20160 == Image [[Image:foobar.jpg]] ==
20161 !! html
20162 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20163 <ul>
20164 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20165 </ul>
20166 </div>
20167
20168 <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>
20169
20170 !! end
20171
20172 !! test
20173 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20174 !! options
20175 title=[[Main Page]]
20176 !! wikitext
20177 __TOC__
20178 == <blockquote>Quote</blockquote> ==
20179 !! html
20180 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20181 <ul>
20182 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20183 </ul>
20184 </div>
20185
20186 <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>
20187
20188 !! html+tidy
20189 <p></p>
20190 <div id="toc" class="toc">
20191 <div id="toctitle">
20192 <h2>Contents</h2>
20193 </div>
20194 <ul>
20195 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20196 </ul>
20197 </div>
20198 <p></p>
20199 <h2><span class="mw-headline" id="Quote"></span></h2>
20200 <blockquote>
20201 <p><span class="mw-headline" id="Quote">Quote</span></p>
20202 </blockquote>
20203 <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>
20204 !! end
20205
20206 !! test
20207 Unclosed tags in TOC
20208 !! options
20209 title=[[Main Page]]
20210 !! wikitext
20211 __TOC__
20212 == Proof: 2 < 3 ==
20213 <small>Hanc marginis exiguitas non caperet.</small>
20214 QED
20215 !! html
20216 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20217 <ul>
20218 <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>
20219 </ul>
20220 </div>
20221
20222 <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>
20223 <p><small>Hanc marginis exiguitas non caperet.</small>
20224 QED
20225 </p>
20226 !! end
20227
20228 !! test
20229 Multiple tags in TOC
20230 !! wikitext
20231 __TOC__
20232 == <i>Foo</i> <b>Bar</b> ==
20233
20234 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20235 !! html
20236 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20237 <ul>
20238 <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>
20239 <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>
20240 </ul>
20241 </div>
20242
20243 <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>
20244 <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>
20245
20246 !! html+tidy
20247 <p></p>
20248 <div id="toc" class="toc">
20249 <div id="toctitle">
20250 <h2>Contents</h2>
20251 </div>
20252 <ul>
20253 <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>
20254 <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>
20255 </ul>
20256 </div>
20257 <p></p>
20258 <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>
20259 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20260 <blockquote>
20261 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20262 </blockquote>
20263 <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>
20264 !! end
20265
20266 !! test
20267 Tags with parameters in TOC
20268 !! wikitext
20269 __TOC__
20270 == <sup class="in-h2">Hello</sup> ==
20271
20272 == <sup class="a > b">Evilbye</sup> ==
20273 !! html
20274 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20275 <ul>
20276 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20277 <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>
20278 </ul>
20279 </div>
20280
20281 <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>
20282 <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>
20283
20284 !! end
20285
20286 !! test
20287 span tags with directionality in TOC
20288 !! wikitext
20289 __TOC__
20290 == <span dir="ltr">C++</span> ==
20291
20292 == <span dir="rtl">זבנג!</span> ==
20293
20294 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20295
20296 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20297
20298 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20299 !! html
20300 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20301 <ul>
20302 <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>
20303 <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>
20304 <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>
20305 <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>
20306 <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>
20307 </ul>
20308 </div>
20309
20310 <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>
20311 <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>
20312 <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>
20313 <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>
20314 <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>
20315
20316 !! end
20317
20318 !! test
20319 Bug 72884: bdi element in ToC
20320 !! wikitext
20321 __TOC__
20322 == <bdi>test</bdi> ==
20323 !! html
20324 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20325 <ul>
20326 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20327 </ul>
20328 </div>
20329
20330 <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>
20331
20332 !! end
20333
20334 # Note that the html output does not have the <p></p>, but the
20335 # html+tidy output *does*. This is because the empty <p></p> is
20336 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20337 !! test
20338 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20339 !! wikitext
20340 __TOC__
20341 == x ==
20342 !! html
20343 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20344 <ul>
20345 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20346 </ul>
20347 </div>
20348
20349 <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>
20350
20351 !! html+tidy
20352 <p></p>
20353 <div id="toc" class="toc">
20354 <div id="toctitle">
20355 <h2>Contents</h2>
20356 </div>
20357 <ul>
20358 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20359 </ul>
20360 </div>
20361 <p></p>
20362 <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>
20363 !! end
20364
20365 !! article
20366 MediaWiki:Bug32057
20367 !! text
20368 == {{int:headline_sample}} ==
20369 !! endarticle
20370
20371 !! test
20372 Bug 32057: Title needed when expanding <h> nodes.
20373 !! options
20374 title=[[Main Page]]
20375 !! wikitext
20376 {{int:Bug32057}}
20377 !! html
20378 <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>
20379
20380 !! end
20381
20382 !! test
20383 Strip marker in urlencode
20384 !! wikitext
20385 {{urlencode:x<nowiki/>y}}
20386 {{urlencode:x<nowiki/>y|wiki}}
20387 {{urlencode:x<nowiki/>y|path}}
20388 {{urlencode:x<pre id="one">two</pre>y}}
20389 !! html
20390 <p>xy
20391 xy
20392 xy
20393 xy
20394 </p>
20395 !! end
20396
20397 !! test
20398 Strip marker in lc
20399 !! wikitext
20400 {{lc:x<nowiki/>y}}
20401 !! html
20402 <p>xy
20403 </p>
20404 !! end
20405
20406 !! test
20407 Strip marker in uc
20408 !! wikitext
20409 {{uc:x<nowiki/>y}}
20410 !! html
20411 <p>XY
20412 </p>
20413 !! end
20414
20415 !! test
20416 Strip marker in formatNum
20417 !! wikitext
20418 {{formatnum:1<nowiki/>2}}
20419 {{formatnum:1<nowiki/>2|R}}
20420 !! html
20421 <p>12
20422 12
20423 </p>
20424 !! end
20425
20426 !! test
20427 Check noCommafy in formatNum
20428 !! options
20429 language=be-tarask
20430 !! wikitext
20431 {{formatnum:123456.78}}
20432 {{formatnum:123456.78|NOSEP}}
20433 !! html
20434 <p>123 456,78
20435 123456.78
20436 </p>
20437 !! end
20438
20439 !! test
20440 Wrong option for formatNum (bug 56199)
20441 !! wikitext
20442 {{formatnum:1,234.56|Random}}
20443 {{formatnum:1,234.56|EVERYTHING}}
20444 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20445 !! html
20446 <p>1,234.56
20447 1,234.56
20448 1,234.56
20449 </p>
20450 !! end
20451
20452 !! test
20453 Strip marker in grammar
20454 !! options
20455 language=fi
20456 !! wikitext
20457 {{grammar:elative|foo<nowiki/>bar}}
20458 !! html
20459 <p>foobarista
20460 </p>
20461 !! end
20462
20463 !! test
20464 Strip marker in padleft
20465 !! wikitext
20466 {{padleft:|2|x<nowiki/>y}}
20467 !! html
20468 <p>xy
20469 </p>
20470 !! end
20471
20472 !! test
20473 Strip marker in padright
20474 !! wikitext
20475 {{padright:|2|x<nowiki/>y}}
20476 !! html
20477 <p>xy
20478 </p>
20479 !! end
20480
20481 !! test
20482 Strip marker in anchorencode
20483 !! wikitext
20484 {{anchorencode:x<nowiki/>y}}
20485 !! html
20486 <p>xy
20487 </p>
20488 !! end
20489
20490 !! test
20491 nowiki inside link inside heading (bug 18295)
20492 !! wikitext
20493 ==[[foo|x<nowiki>y</nowiki>z]]==
20494 !! html
20495 <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>
20496
20497 !! end
20498
20499 !! test
20500 new support for bdi element (bug 31817)
20501 !! wikitext
20502 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20503 !! html
20504 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20505
20506 !!end
20507
20508 !! test
20509 Ignore pipe between table row attributes
20510 !! wikitext
20511 {|
20512 | quux
20513 |- id=foo | style='color: red'
20514 | bar
20515 |}
20516 !! html
20517 <table>
20518 <tr>
20519 <td> quux
20520 </td></tr>
20521 <tr id="foo" style="color: red">
20522 <td> bar
20523 </td></tr></table>
20524
20525 !! end
20526
20527 !!test
20528 Gallery override link with WikiLink (bug 34852)
20529 !! wikitext
20530 <gallery>
20531 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20532 </gallery>
20533 !! html
20534 <ul class="gallery mw-gallery-traditional">
20535 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20536 <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>
20537 <div class="gallerytext">
20538 <p>caption
20539 </p>
20540 </div>
20541 </div></li>
20542 </ul>
20543
20544 !! end
20545
20546 !!test
20547 Gallery override link with absolute external link (bug 34852)
20548 !! wikitext
20549 <gallery>
20550 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20551 </gallery>
20552 !! html
20553 <ul class="gallery mw-gallery-traditional">
20554 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20555 <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>
20556 <div class="gallerytext">
20557 <p>caption
20558 </p>
20559 </div>
20560 </div></li>
20561 </ul>
20562
20563 !! end
20564
20565 !!test
20566 Gallery override link with malicious javascript (bug 34852)
20567 !! wikitext
20568 <gallery>
20569 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20570 </gallery>
20571 !! html
20572 <ul class="gallery mw-gallery-traditional">
20573 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20574 <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>
20575 <div class="gallerytext">
20576 <p>caption
20577 </p>
20578 </div>
20579 </div></li>
20580 </ul>
20581
20582 !! end
20583
20584 !!test
20585 Gallery with invalid title as link (bug 43964)
20586 !! wikitext
20587 <gallery>
20588 File:foobar.jpg|link=<
20589 </gallery>
20590 !! html
20591 <ul class="gallery mw-gallery-traditional">
20592 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20593 <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>
20594 <div class="gallerytext">
20595 </div>
20596 </div></li>
20597 </ul>
20598
20599 !! end
20600
20601 !!test
20602 Language parser function
20603 !! wikitext
20604 {{#language:ar}}
20605 !! html
20606 <p>العربية
20607 </p>
20608 !! end
20609
20610 !!test
20611 Padleft and padright as substr
20612 !! wikitext
20613 {{padleft:|3|abcde}}
20614 {{padright:|3|abcde}}
20615 !! html
20616 <p>abc
20617 abc
20618 </p>
20619 !! end
20620
20621 !!test
20622 Special parser function
20623 !! wikitext
20624 {{#special:RandomPage}}
20625 {{#special:BaDtItLe}}
20626 {{#special:Foobar}}
20627 !! html
20628 <p>Special:Random
20629 Special:Badtitle
20630 Special:Foobar
20631 </p>
20632 !! end
20633
20634 !!test
20635 Bug 34939 - Case insensitive link parsing ([HttP://])
20636 !! wikitext
20637 [HttP://MediaWiki.Org/]
20638 !! html/php
20639 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20640 </p>
20641 !! html/parsoid
20642 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20643 !! end
20644
20645 !!test
20646 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20647 !! wikitext
20648 [HttP://MediaWiki.Org/ MediaWiki]
20649 !! html
20650 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20651 </p>
20652 !! end
20653
20654 !!test
20655 Bug 34939 - Case insensitive link parsing (HttP://)
20656 !! wikitext
20657 HttP://MediaWiki.Org/
20658 !! html/php
20659 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20660 </p>
20661 !! html/parsoid
20662 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20663 !! end
20664
20665 !!test
20666 Disable TOC
20667 !! options
20668 notoc
20669 !! wikitext
20670 Lead
20671 == Section 1 ==
20672 == Section 2 ==
20673 == Section 3 ==
20674 == Section 4 ==
20675 == Section 5 ==
20676 !! html
20677 <p>Lead
20678 </p>
20679
20680 <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>
20681 <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>
20682 <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>
20683 <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>
20684 <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>
20685
20686 !! end
20687
20688
20689 ###
20690 ### Parsoid-specific tests
20691 ### Parsoid-PHP parser incompatibilities
20692 ###
20693 !!test
20694 1. SOL-sensitive wikitext tokens as template-args
20695 !!options
20696 parsoid=wt2html,wt2wt
20697 !! wikitext
20698 {{echo|*a}}
20699 {{echo|#a}}
20700 {{echo|:a}}
20701 !! html
20702 <span about="#mwt1" typeof="mw:Transclusion">
20703 </span><ul about="#mwt1"><li>a</li>
20704 </ul>
20705 <span about="#mwt2" typeof="mw:Transclusion">
20706 </span><ol about="#mwt2"><li>a</li>
20707 </ol>
20708 <span about="#mwt3" typeof="mw:Transclusion">
20709 </span><dl about="#mwt3"><dd>a</dd>
20710 </dl>
20711 !!end
20712
20713 #### -----------------------------------------------------------------
20714 #### Parsoid-specific functionality tests
20715 #### -----------------------------------------------------------------
20716
20717 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20718 # We know wt2wt will fail, but we expect selser to pass.
20719 # Due to the nature of our testing, wt2wt and selser tests will enter the
20720 # blacklist and we'll catch selser regressions based on changes to the
20721 # blacklist entries for selser tests.
20722 !! test
20723 1. Bad treebuilder fixup of formatting elt is cleaned up
20724 !! options
20725 parsoid=wt2html,wt2wt
20726 !! wikitext
20727 {|
20728 |
20729 <small>
20730 [[Image:Foobar.jpg|right|Test]]
20731 </small>
20732 |}
20733 !! html/parsoid
20734 <table>
20735 <tbody><tr><td>
20736 <small>
20737 <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>
20738 </small>
20739 </td></tr>
20740 </tbody></table>
20741 !! end
20742
20743 !! test
20744 2. Bad treebuilder fixup of formatting elt is cleaned up
20745 !! options
20746 parsoid=wt2html,wt2wt
20747 !! wikitext
20748 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20749
20750 <small>[[Image:Foobar.jpg|right|300px]]</small>
20751 !! html/parsoid
20752
20753 <p><b>foo</b></p>
20754 <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>
20755 <p><b>bar</b></p>
20756 <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>
20757 !! end
20758
20759 #### ----------------------------------------------------------------
20760 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20761 #### tags. Parsoid's output for these tags differs from that of the
20762 #### PHP parser.
20763 #### ----------------------------------------------------------------
20764
20765 !!test
20766 Ref: 1. ref-location should be replaced with an index span
20767 !!options
20768 parsoid
20769 !! wikitext
20770 A <ref>foo</ref>
20771 B <ref name="x">foo</ref>
20772 C <ref name="y" />
20773 <references />
20774 !! html
20775 <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>
20776 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>
20777 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>
20778 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20779 <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>
20780 <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>
20781 <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>
20782 </ol>
20783 !!end
20784
20785 !!test
20786 Ref: 2. ref-tags with identical names should all get the same index
20787 !!options
20788 parsoid
20789 !! wikitext
20790 A <ref name="x">foo</ref>
20791 B <ref name="x" />
20792 <references />
20793 !! html
20794 <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>
20795 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>
20796 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20797 <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>
20798 </ol>
20799 !!end
20800
20801 !!test
20802 Ref: 3. spaces in ref-names should be ignored
20803 !!options
20804 parsoid
20805 !! wikitext
20806 A <ref name="x">foo</ref>
20807 B <ref name=" x " />
20808 C <ref name= x />
20809 <references />
20810 !! html
20811 <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>
20812 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>
20813 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>
20814 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20815 <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>
20816 </ol>
20817 !!end
20818
20819 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20820 !!test
20821 Ref: 4. 'constructor' should be accepted as a valid ref-name
20822 !!options
20823 parsoid
20824 !! wikitext
20825 A <ref name="constructor">foo</ref>
20826 <references />
20827 !! html
20828 <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>
20829 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20830 <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>
20831 </ol>
20832 !!end
20833
20834 !!test
20835 Ref: 5. body should accept generic wikitext
20836 !!options
20837 parsoid
20838 !! wikitext
20839 A <ref>
20840 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20841 </ref>
20842
20843 <references />
20844 !! html
20845 <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>
20846
20847 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20848 <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>
20849 </span></li>
20850 </ol>
20851 !!end
20852
20853 !!test
20854 Ref: 6. indent-pres should not be output in ref-body
20855 !!options
20856 parsoid
20857 !! wikitext
20858 A <ref>
20859 foo
20860 bar
20861 baz
20862 </ref>
20863
20864 <references />
20865 !! html
20866 <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>
20867
20868 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20869 <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
20870 bar
20871 baz
20872 </span></li>
20873 </ol>
20874 !!end
20875
20876 !!test
20877 Ref: 7. No p-wrapping in ref-body
20878 !!options
20879 parsoid
20880 !! wikitext
20881 A <ref>
20882 foo
20883
20884 bar
20885
20886
20887 baz
20888
20889
20890
20891 booz
20892 </ref>
20893
20894 <references />
20895 !! html
20896 <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>
20897
20898 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20899 <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
20900
20901 bar
20902
20903
20904 baz
20905
20906
20907
20908 booz
20909 </span></li>
20910 </ol>
20911 !!end
20912
20913 !!test
20914 Ref: 8. transclusion wikitext has lower precedence
20915 !!options
20916 parsoid
20917 !! wikitext
20918 A <ref> foo {{echo|</ref> B C}}
20919
20920 <references />
20921 !! html
20922 <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>
20923 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20924 <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>
20925 </ol>
20926 !!end
20927
20928 !!test
20929 Ref: 9. unclosed comments should not leak out of ref-body
20930 !!options
20931 parsoid
20932 !! wikitext
20933 A <ref> foo <!--</ref> B C
20934 <references />
20935 !! html
20936 <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>
20937 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20938 <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>
20939 </ol>
20940 !!end
20941
20942 !!test
20943 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20944 !!options
20945 parsoid
20946 !! wikitext
20947 A <ref> <b> foo </ref> B C
20948
20949 <references />
20950 !! html
20951 <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>
20952
20953
20954 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20955 <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>
20956 </ol>
20957 !!end
20958
20959 !!test
20960 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20961 !!options
20962 parsoid
20963 !! wikitext
20964 A <ref>foo</ref> B
20965 C <ref>bar</ref> D
20966 <references />
20967 !! html
20968 <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
20969 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>
20970 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20971 <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>
20972 <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>
20973 </ol>
20974 !!end
20975
20976 !!test
20977 Ref: 12. ref-tags act as trailing newline migration barrier
20978 !! wikitext
20979 <!--the newline at the end of this line moves out of the p tag-->a
20980
20981 b<!--the newline at the end of this line stays inside the p tag--> <ref />
20982 <ref />
20983
20984 c
20985 <references />
20986 !! html/parsoid
20987 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
20988
20989
20990 <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>
20991 <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>
20992
20993 <p>c</p>
20994 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20995 <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>
20996 <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>
20997 !!end
20998
20999 !!test
21000 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21001 !!options
21002 parsoid
21003 !! wikitext
21004 <ref>foo</ref> A
21005 <ref>bar
21006 </ref> B
21007 <references />
21008 !! html
21009 <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
21010 <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>
21011 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21012 <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>
21013 <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
21014 </span></li>
21015 </ol>
21016 !!end
21017
21018 !!test
21019 Ref: 14. A nested ref-tag should be emitted as plain text
21020 !!options
21021 parsoid
21022 !! wikitext
21023 <ref>foo <ref>bar</ref> baz</ref>
21024
21025 <references />
21026 !! html
21027 <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>
21028 </p>
21029 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21030 <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>
21031 </ol>
21032 !!end
21033
21034 !!test
21035 Ref: 15. ref-tags with identical names should get identical indexes
21036 !!options
21037 parsoid
21038 !! wikitext
21039 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21040 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21041
21042 <references />
21043 !! html
21044 <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>
21045 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>
21046
21047 <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>
21048 </ol>
21049 !!end
21050
21051 ## We don't bother wt2wt-ing non-standard whitespace
21052 !!test
21053 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21054 !!options
21055 parsoid=wt2html
21056 !! wikitext
21057 A <ref >foo</ref >
21058
21059 <references />
21060 !! html
21061 <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>
21062 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21063 <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>
21064 !!end
21065
21066 !!test
21067 Ref: 17. Generate valid HTML5 id/about attributes
21068 !!options
21069 parsoid
21070 !!wikitext
21071 <ref name="a b">foo</ref>
21072
21073 <references />
21074 !!html
21075 <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>
21076 </p>
21077
21078 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21079 <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>
21080 </ol>
21081 !!end
21082
21083 !!test
21084 Ref: 18. T58916: Extension attributes should be parsed as plain text
21085 !!options
21086 parsoid
21087 !!wikitext
21088 <ref name="{{echo|a}}">foo</ref>
21089
21090 <references />
21091 !!html
21092 <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>
21093 </p>
21094
21095 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21096 <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>
21097 </ol>
21098 !!end
21099
21100 !!test
21101 Ref: 19. ref-tags with identical name encodings should get identical indexes
21102 !!options
21103 parsoid
21104 !! wikitext
21105 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21106
21107 <references />
21108 !! html
21109 <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>
21110 </p>
21111 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21112 <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>
21113 </ol>
21114 !!end
21115
21116 !!test
21117 Ref: 20. ref-tags with identical names but different content should keep it
21118 !!options
21119 parsoid
21120 !! wikitext
21121 A <ref name="foo">Foo one</ref>
21122 B <ref name="foo">Foo two</ref>
21123 C <ref name="foo" />
21124
21125 <references />
21126 !! html
21127 <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>
21128 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>
21129 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>
21130
21131 <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>
21132 </ol>
21133 !!end
21134
21135 !!test
21136 References: 1. references tag without any refs should be handled properly
21137 !! wikitext
21138 <references />
21139 !! html/parsoid
21140 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21141 !!end
21142
21143 !!test
21144 References: 2. references tag with group only outputs references from that group
21145 !! wikitext
21146 A <ref group="a">foo</ref>
21147 B <ref group="b">bar</ref>
21148 C <ref>baz</ref>
21149
21150 <references group="a" />
21151 <references />
21152 <references group="b" />
21153 !! html/parsoid
21154 <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>
21155 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>
21156 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>
21157
21158 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21159 <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>
21160 </ol>
21161 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21162 <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>
21163 </ol>
21164 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21165 <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>
21166 </ol>
21167 !!end
21168
21169 !!test
21170 References: 3. ref list should be cleared after processing references
21171 !! wikitext
21172 A <ref>foo</ref>
21173
21174 <references />
21175
21176 B <ref>bar</ref>
21177
21178 <references />
21179 !! html/parsoid
21180 <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>
21181
21182 <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>
21183 </ol>
21184
21185 <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>
21186
21187 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21188 <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>
21189 </ol>
21190 !!end
21191
21192 !!test
21193 References: 4. only referenced group should be cleared after processing references
21194 !! wikitext
21195 A <ref group="a">afoo</ref>
21196 B <ref>bfoo</ref>
21197
21198 <references group="a" />
21199
21200 C <ref>cfoo</ref>
21201
21202 <references />
21203 !! html/parsoid
21204 <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>
21205 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>
21206
21207 <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>
21208 </ol>
21209
21210 <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>
21211
21212 <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>
21213 </ol>
21214 !!end
21215
21216 !!test
21217 References: 5. ref tags in references should be processed while ignoring all other content
21218 !! wikitext
21219 A <ref name="a" />
21220 B <ref name="b">bar</ref>
21221
21222 <references>
21223 <ref name="a">foo</ref>
21224 This should just get lost.
21225 </references>
21226 !! html/parsoid
21227 <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>
21228 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>
21229
21230
21231 <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>
21232 </ol>
21233 !!end
21234
21235 !!test
21236 References: 6. <references /> from a transclusion
21237 !! wikitext
21238 <ref>Foo</ref> {{echo|<references />}}
21239 !! html/parsoid
21240 <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>
21241 </ol>
21242 !!end
21243
21244 !! test
21245 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21246 !! wikitext
21247 A <ref>foo bar for a</ref>
21248 B <ref group="X" name="b" />
21249
21250 <references />
21251
21252 <references group="X">
21253 <ref name="b">foo</ref>
21254 </references>
21255 !! html/parsoid
21256 <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>
21257 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>
21258 </p>
21259
21260 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21261 <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>
21262 </ol>
21263
21264 <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"}}'>
21265 <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>
21266 </ol>
21267 !! end
21268
21269 !! test
21270 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21271 !! wikitext
21272 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21273 <references />
21274 !! html/parsoid
21275 <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>
21276 <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>
21277 </ol>
21278 !!end
21279
21280 # This test only works in wt2html now as the <references /> are always generated
21281 # unless selser is active. Once T72722 is fixed, we should add a changes test
21282 # here to ensure that unrelated changes don't add the new <references /> in
21283 # wt2wt.
21284 !! test
21285 References: 9. Generate missing references list at the end
21286 !! wikitext
21287 A <ref>foo</ref>
21288 B <ref group="inexistent">bar</ref>
21289 !! html/parsoid
21290 <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>
21291 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21292 <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>
21293 </ol>
21294 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21295 <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>
21296 </ol>
21297 !! end
21298
21299 !! test
21300 References: 10. New <references/> shouldn't be added for unrelated edits.
21301 !! options
21302 parsoid={
21303 "modes": ["selser"],
21304 "changes": [["#x", "remove"]],
21305 "selser": "noauto"
21306 }
21307 !! wikitext
21308 Unrelated text<span id="x"> that's going to disappear</span>.
21309 A <ref>foo</ref>
21310 !! wikitext/edited
21311 Unrelated text.
21312 A <ref>foo</ref>
21313 !!end
21314
21315 !! test
21316 Entities in ref name
21317 !! wikitext
21318 <ref name="test &amp; me">hi</ref>
21319 <references />
21320 !! html/parsoid
21321 <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>
21322 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21323 <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>
21324 </ol>
21325 !! end
21326
21327 # This test is wt2html only because we're permitting the serializer to produce
21328 # dirty diffs, normalizing the unclosed references to the self-closed version.
21329 !! test
21330 Generate references for unclosed references tag
21331 !! options
21332 parsoid=wt2html
21333 !! wikitext
21334 a<ref>foo</ref>
21335
21336 <references>
21337 !! html/parsoid
21338 <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>
21339 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21340 <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>
21341 !! end
21342
21343 !! test
21344 New reference serializes on its own line
21345 !! options
21346 parsoid=wt2wt,html2wt
21347 !! wikitext
21348 foo
21349 <references />
21350 !! html/parsoid
21351 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21352 !! end
21353
21354 #### ----------------------------------------------------------------
21355 #### Parsoid-only testing of Parsoid's impl of LST
21356 #### Not implemented yet, see
21357 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21358 #### ----------------------------------------------------------------
21359
21360 !!test
21361 LST Sections: 1. Simple section start and end
21362 !! wikitext
21363 <section begin="2011-05-16" />
21364 <section end="2014-04-10 (MW 1.23wmf22)" />
21365 !! html/parsoid
21366 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21367 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21368 !! end
21369
21370 #--------- Test stripping of empty nodes in template content ----------
21371 !!test
21372 Empty LI and TR nodes should be stripped from template content
21373 !!wikitext
21374 {{EmptyLITest}}
21375 {{EmptyTRTest}}
21376 !!html/parsoid
21377 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21378 <li>a</li>
21379 <li>b</li>
21380 </ul>
21381 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21382 <tbody>
21383 <tr>
21384 <td>foo</td>
21385 </tr>
21386 <tr>
21387 <td>bar</td>
21388 </tr>
21389 </tbody>
21390 </table>
21391 !!end
21392
21393 !!test
21394 Empty LI and TR nodes should not be stripped from top-level content
21395 !!wikitext
21396 * a
21397 *
21398 * b
21399 {|
21400 |-
21401 |-
21402 |foo
21403 |}
21404 !!html/parsoid
21405 <ul>
21406 <li> a</li>
21407 <li></li>
21408 <li> b</li>
21409 </ul>
21410 <table>
21411 <tbody>
21412 <tr></tr>
21413 <tr>
21414 <td>foo</td>
21415 </tr>
21416 </tbody>
21417 </table>
21418 !!end
21419
21420 !!test
21421 Empty TR nodes should not be stripped if they have any attributes set
21422 !!wikitext
21423 {{EmptyTRWithHTMLAttrTest}}
21424 !!html/parsoid
21425 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21426 <tr align="center"></tr>
21427 <tr><td>foo</td></tr>
21428 <tr align="center"></tr>
21429 <tr><td>bar</td></tr>
21430 </table>
21431 !!end
21432
21433 #### ----------------------------------------------------------------
21434 #### The following section of tests are primarily to test
21435 #### wikitext escaping capabilities of Parsoid. Given that
21436 #### escaping can be done any number of ways, the wikitext (input)
21437 #### is always adjusted to reflect how Parsoid adds nowiki
21438 #### escape tags.
21439 ####
21440 #### We are marking several tests as parsoid-only since the
21441 #### HTML in the result section is different from what the
21442 #### PHP parser generates for it.
21443 #### ----------------------------------------------------------------
21444
21445
21446 #### --------------- Headings ---------------
21447 #### 0. Unnested
21448 #### 1. Nested inside html <h1>=foo=</h1>
21449 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21450 #### 3. Nested inside html with wikitext split by html tags
21451 #### 4. No escape needed
21452 #### 5. Empty headings <h1></h1>
21453 #### 6. Heading chars in SOL context
21454 #### ----------------------------------------
21455 !! test
21456 Headings: 0. Unnested
21457 !! options
21458 parsoid
21459 !! wikitext
21460 <nowiki>=foo=</nowiki>
21461
21462 <nowiki> =foo= </nowiki>
21463 <!--cmt-->
21464 <nowiki>=foo=</nowiki>
21465
21466 =foo''a''<nowiki>=</nowiki>
21467 !! html
21468 <p><span typeof="mw:Nowiki">=foo=</span></p>
21469
21470 <p><span typeof="mw:Nowiki"> =foo= </span>
21471 <!--cmt-->
21472 <span typeof="mw:Nowiki">=foo=</span></p>
21473
21474 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21475 !!end
21476
21477 # New headings and existing headings are handled differently
21478 !! test
21479 Headings: 1. Nested inside html
21480 !! options
21481 parsoid=html2wt
21482 !! html
21483 <h1>=foo=</h1>
21484 <h2>=foo=</h2>
21485 <h3>=foo=</h3>
21486
21487 <h1 data-parsoid=''>=foo=</h1>
21488 <h2 data-parsoid=''>=foo=</h2>
21489 <h3 data-parsoid=''>=foo=</h3>
21490 <h4 data-parsoid=''>=foo=</h4>
21491 <h5 data-parsoid=''>=foo=</h5>
21492 <h6 data-parsoid=''>=foo=</h6>
21493 !! wikitext
21494 = =foo= =
21495
21496 == =foo= ==
21497
21498 === =foo= ===
21499
21500 =<nowiki>=foo=</nowiki>=
21501 ==<nowiki>=foo=</nowiki>==
21502 ===<nowiki>=foo=</nowiki>===
21503 ====<nowiki>=foo=</nowiki>====
21504 =====<nowiki>=foo=</nowiki>=====
21505 ======<nowiki>=foo=</nowiki>======
21506
21507 !!end
21508
21509 !! test
21510 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21511 !! options
21512 parsoid=html2wt
21513 !! html
21514 <h1>foo</h1>*bar
21515 <h1>foo</h1>=bar
21516 <h1>foo</h1>=bar=
21517 !! wikitext
21518 = foo =
21519 <nowiki>*</nowiki>bar
21520
21521 = foo =
21522 =bar
21523
21524 = foo =
21525 <nowiki>=bar=</nowiki>
21526 !!end
21527
21528 !! test
21529 Headings: 3. Nested inside html with wikitext split by html tags
21530 !! options
21531 parsoid=html2wt,wt2wt
21532 !! wikitext
21533 = ='''bold'''<nowiki>foo=</nowiki> =
21534 !! html/parsoid
21535 <h1>=<b>bold</b>foo=</h1>
21536 !!end
21537
21538 !! test
21539 Headings: 4a. No escaping needed (testing just h1 and h2)
21540 !! wikitext
21541 = =foo =
21542
21543 = foo= =
21544
21545 = =foo= =
21546
21547 = =foo= bar =
21548
21549 == =foo ==
21550
21551 == foo= ==
21552
21553 = = =
21554
21555 = ''=''foo= =
21556 !! html/parsoid
21557 <h1>=foo</h1>
21558 <h1>foo=</h1>
21559 <h1> =foo= </h1>
21560 <h1>=foo= bar</h1>
21561 <h2>=foo</h2>
21562 <h2>foo=</h2>
21563 <h1>=</h1>
21564 <h1><i>=</i>foo=</h1>
21565 !!end
21566
21567 !! test
21568 Headings: 4b. No escaping needed (inside p-tags)
21569 !! options
21570 parsoid=html2wt
21571 !! html
21572 <p>===
21573 =foo= x
21574 =foo= <s></s>
21575 </p>
21576 !! wikitext
21577 ===
21578 =foo= x
21579 =foo= <s></s>
21580 !!end
21581
21582 !! test
21583 Headings: 5. Empty headings
21584 !! wikitext
21585 =<nowiki/>=
21586
21587 ==<nowiki/>==
21588
21589 ===<nowiki/>===
21590
21591 ====<nowiki/>====
21592
21593 =====<nowiki/>=====
21594
21595 ======<nowiki/>======
21596 !! html/parsoid
21597 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21598
21599 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21600
21601 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21602
21603 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21604
21605 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21606
21607 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21608 !!end
21609
21610 !! test
21611 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21612 !! options
21613 parsoid
21614 !! wikitext
21615 <nowiki>=a=</nowiki>
21616
21617 <nowiki>=a=</nowiki>
21618
21619 <nowiki>=a=</nowiki>
21620
21621 <nowiki>=a=</nowiki>
21622 !! html
21623 <p>=a=</p>
21624 <p>=a= </p>
21625 <p>=a= </p>
21626 <p>=a= </p>
21627 !!end
21628
21629 !! test
21630 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21631 !! options
21632 parsoid
21633 !! wikitext
21634 <nowiki>=a=
21635 b</nowiki>
21636
21637 <nowiki>=a=
21638 b</nowiki>
21639
21640 <nowiki>=a=
21641 b</nowiki>
21642
21643 <nowiki>=a=
21644 b</nowiki>
21645 !! html
21646 <p>=a=
21647 b</p>
21648 <p>=a=
21649 b</p>
21650 <p>=a=
21651 b</p>
21652 <p>=a=
21653 b</p>
21654 </p>
21655 !!end
21656
21657 !! test
21658 Headings: 6c. Heading chars in SOL context (leading newline break)
21659 !! options
21660 parsoid
21661 !! wikitext
21662 a
21663 <nowiki>=b=</nowiki>
21664 !! html
21665 <p>a
21666 =b=</p>
21667 !!end
21668
21669 !! test
21670 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21671 !! options
21672 parsoid
21673 !! wikitext
21674 <!--c0--><nowiki>=a=</nowiki>
21675
21676 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21677 !! html
21678 <p><!--c0-->=a=</p>
21679 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21680 !!end
21681
21682 !! test
21683 Headings: 6d. Heading chars in SOL context (No escaping needed)
21684 !! options
21685 parsoid=html2wt
21686 !! html
21687 =a=<div>b</div>
21688 !! wikitext
21689 =a=<div>b</div>
21690 !!end
21691
21692 !! test
21693 Headings: 7. Insert a newline between new content and headings
21694 !! options
21695 parsoid=html2wt
21696 !! html
21697 <h2>NEW</h2>
21698 <p>new</p>
21699 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21700 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21701 !! wikitext
21702 == NEW ==
21703 new
21704
21705 ==A==
21706 a
21707
21708 !! end
21709
21710 #### --------------- Lists ---------------
21711 #### 0. Outside nests (*foo, etc.)
21712 #### 1. Nested inside html <ul><li>*foo</li></ul>
21713 #### 2. Inside definition lists
21714 #### 3. Only bullets at start should be escaped
21715 #### 4. No escapes needed
21716 #### 5. No unnecessary escapes
21717 #### 6. Escape bullets in SOL position
21718 #### 7. Escape bullets in a multi-line context
21719 #### ----------------------------------------
21720
21721 !! test
21722 Lists: 0. Outside nests
21723 !! wikitext
21724 <nowiki>*</nowiki>foo
21725
21726 <nowiki>#</nowiki>foo
21727
21728 <nowiki>;Foo:</nowiki>bar
21729 !! html
21730 <p>*foo
21731 </p><p>#foo
21732 </p><p>;Foo:bar
21733 </p>
21734 !!end
21735
21736 !! test
21737 Lists: 1. Nested inside html
21738 !! wikitext
21739 *<nowiki>*foo</nowiki>
21740
21741 *<nowiki>#foo</nowiki>
21742
21743 *<nowiki>:foo</nowiki>
21744
21745 *<nowiki>;foo</nowiki>
21746
21747 #<nowiki>*foo</nowiki>
21748
21749 #<nowiki>#foo</nowiki>
21750
21751 #<nowiki>:foo</nowiki>
21752
21753 #<nowiki>;foo</nowiki>
21754 !! html
21755 <ul><li>*foo</li></ul>
21756 <ul><li>#foo</li></ul>
21757 <ul><li>:foo</li></ul>
21758 <ul><li>;foo</li></ul>
21759 <ol><li>*foo</li></ol>
21760 <ol><li>#foo</li></ol>
21761 <ol><li>:foo</li></ol>
21762 <ol><li>;foo</li></ol>
21763
21764 !!end
21765
21766 !! test
21767 Lists: 2. Inside definition lists
21768 !! wikitext
21769 ;<nowiki>;foo</nowiki>
21770
21771 ;<nowiki>:foo</nowiki>
21772
21773 ;<nowiki>:foo</nowiki>
21774 :bar
21775
21776 :<nowiki>:foo</nowiki>
21777 !! html
21778 <dl><dt>;foo</dt></dl>
21779 <dl><dt>:foo</dt></dl>
21780 <dl><dt>:foo</dt>
21781 <dd>bar</dd></dl>
21782 <dl><dd>:foo</dd></dl>
21783
21784 !!end
21785
21786 !! test
21787 Lists: 3. Only bullets at start of text should be escaped
21788 !! wikitext
21789 *<nowiki>*foo*bar</nowiki>
21790
21791 *<nowiki>*foo</nowiki>''it''*bar
21792 !! html
21793 <ul><li>*foo*bar</li></ul>
21794 <ul><li>*foo<i>it</i>*bar</li></ul>
21795
21796 !!end
21797
21798 !! test
21799 Lists: 4. No escapes needed
21800 !! options
21801 parsoid
21802 !! wikitext
21803 *foo*bar
21804
21805 *''foo''*bar
21806
21807 *[[Foo]]: bar
21808
21809 *[[Foo]]*bar
21810 !! html
21811 <ul>
21812 <li>foo*bar
21813 </li>
21814 </ul>
21815 <ul>
21816 <li><i>foo</i>*bar
21817 </li>
21818 </ul>
21819 <ul>
21820 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21821 </li>
21822 </ul>
21823 <ul>
21824 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21825 </li>
21826 </ul>
21827 !!end
21828
21829 !! test
21830 Lists: 5. No unnecessary escapes
21831 !! wikitext
21832 * bar <span><nowiki>[[foo]]</nowiki></span>
21833
21834 * =bar <span><nowiki>[[foo]]</nowiki></span>
21835
21836 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21837
21838 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21839
21840 * =bar <span>foo]]</span>=
21841
21842 * <s></s>: a
21843
21844 * ''* foo''
21845 !! html
21846 <ul><li> bar <span>[[foo]]</span></li></ul>
21847 <ul><li> =bar <span>[[foo]]</span></li></ul>
21848 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21849 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21850 <ul><li> =bar <span>foo]]</span>=</li></ul>
21851 <ul><li> <s></s>: a</li></ul>
21852 <ul><li> <i>* foo</i></li></ul>
21853
21854 !!end
21855
21856 !! test
21857 Lists: 6. Escape bullets in SOL position
21858 !! options
21859 parsoid=html2wt
21860 !! html
21861 <p><!--cmt-->*foo</p>
21862 !! wikitext
21863 <!--cmt--><nowiki>*</nowiki>foo
21864 !!end
21865
21866 !! test
21867 Lists: 7. Escape bullets in a multi-line context
21868 !! wikitext
21869 a
21870 <nowiki>*</nowiki>b
21871 !! html
21872 <p>a
21873 *b
21874 </p>
21875 !!end
21876
21877 !! test
21878 Lists: 8. Escape colons only if not present in tags
21879 !! options
21880 parsoid=html2wt
21881 !! html
21882 <dl><dt>a:b<i>c:d</i></dt></dl>
21883 !! wikitext
21884 ; <nowiki>a:b</nowiki>''c:d''
21885 !! end
21886
21887 #### --------------- HRs ---------------
21888 #### 1. Single line
21889 #### -----------------------------------
21890
21891 !! test
21892 HRs: 1. Single line
21893 !! wikitext
21894 ----<nowiki>----</nowiki>
21895 ----=foo=
21896 ----*foo
21897 !! html+tidy
21898 <hr />
21899 <p>----</p>
21900 <hr />
21901 <p>=foo=</p>
21902 <hr />
21903 <p>*foo</p>
21904 !! end
21905
21906 #### --------------- Tables ---------------
21907 #### 1a. Simple example
21908 #### 1b. No escaping needed (!foo)
21909 #### 1c. No escaping needed (|foo)
21910 #### 1d. No escaping needed (|}foo)
21911 ####
21912 #### 2a. Nested in td (<td>foo|bar</td>)
21913 #### 2b. Nested in td (<td>foo||bar</td>)
21914 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21915 ####
21916 #### 3a. Nested in th (<th>foo!bar</th>)
21917 #### 3b. Nested in th (<th>foo!!bar</th>)
21918 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21919 ####
21920 #### 4a. Escape -
21921 #### 4b. Escape +
21922 #### 4c. No escaping needed
21923 #### --------------------------------------
21924
21925 !! test
21926 Tables: 1a. Simple example
21927 !! wikitext
21928 <nowiki>{|
21929 |}</nowiki>
21930 !! html
21931 <p>{|
21932 |}
21933 </p>
21934 !! end
21935
21936 !! test
21937 Tables: 1b. No escaping needed
21938 !! wikitext
21939 !foo
21940 !! html
21941 <p>!foo
21942 </p>
21943 !! end
21944
21945 !! test
21946 Tables: 1c. No escaping needed
21947 !! wikitext
21948 |foo
21949 !! html
21950 <p>|foo
21951 </p>
21952 !! end
21953
21954 !! test
21955 Tables: 1d. No escaping needed
21956 !! wikitext
21957 |}foo
21958 !! html
21959 <p>|}foo
21960 </p>
21961 !! end
21962
21963 !! test
21964 Tables: 2a. Nested in td
21965 !! options
21966 parsoid=html2wt
21967 !! html/parsoid
21968 <table><tbody><tr>
21969 <td>foo|bar</td></tr>
21970 <tr><td>x<div>a|b</div></td>
21971 </tbody></table>
21972 !! wikitext
21973 {|
21974 |<nowiki>foo|bar</nowiki>
21975 |-
21976 |x<div><nowiki>a|b</nowiki></div>
21977 |}
21978 !! html/php+tidy
21979 <table>
21980 <tr>
21981 <td>foo|bar</td>
21982 </tr>
21983 <tr>
21984 <td>x
21985 <div>a|b</div>
21986 </td>
21987 </tr>
21988 </table>
21989 !! end
21990
21991 !! test
21992 Tables: 2b. Nested in td
21993 !! options
21994 parsoid=html2wt
21995 !! html/parsoid
21996 <table><tbody><tr>
21997 <td>foo||bar</td>
21998 <td>a<i>b||c</i></td>
21999 <td>a<i><div>b||c</div></i></td>
22000 </tr></tbody></table>
22001 !! wikitext
22002 {|
22003 |<nowiki>foo||bar</nowiki>
22004 |a''<nowiki>b||c</nowiki>''
22005 |a''<div><nowiki>b||c</nowiki></div>''
22006 |}
22007 !! html/php
22008 <table>
22009 <tr>
22010 <td>foo||bar
22011 </td>
22012 <td>a<i>b||c</i>
22013 </td>
22014 <td>a<i><div>b||c</div></i>
22015 </td></tr></table>
22016
22017 !! end
22018
22019 !! test
22020 Tables: 2c. Nested in td -- no escaping needed
22021 !! wikitext
22022 {|
22023
22024 |foo!!bar
22025 |}
22026 !! html/*
22027 <table>
22028
22029 <tr>
22030 <td>foo!!bar
22031 </td></tr></table>
22032
22033 !! end
22034
22035 !! test
22036 Tables: 3a. Nested in th
22037 !! wikitext
22038 {|
22039
22040 !foo!bar
22041 |}
22042 !! html/*
22043 <table>
22044
22045 <tr>
22046 <th>foo!bar
22047 </th></tr></table>
22048
22049 !! end
22050
22051 !! test
22052 Tables: 3b. Nested in th
22053 !! options
22054 parsoid=html2wt
22055 !! html/parsoid
22056 <table><tbody>
22057 <tr><th>foo!!bar</th>
22058 <th><i>foo|bar</i></th>
22059 <th><i>foo!!bar</i></th>
22060 <th><i><span>foo!!bar</span></i></th>
22061 </tr></tbody></table>
22062 !! wikitext
22063 {|
22064 !<nowiki>foo!!bar</nowiki>
22065 !''<nowiki>foo|bar</nowiki>''
22066 !''<nowiki>foo!!bar</nowiki>''
22067 !''<span><nowiki>foo!!bar</nowiki></span>''
22068 |}
22069 !! html/php
22070 <table>
22071 <tr>
22072 <th>foo!!bar
22073 </th>
22074 <th><i>foo|bar</i>
22075 </th>
22076 <th><i>foo!!bar</i>
22077 </th>
22078 <th><i><span>foo!!bar</span></i>
22079 </th></tr></table>
22080
22081 !! end
22082
22083 !! test
22084 Tables: 3c. Nested in th
22085 !! options
22086 parsoid=html2wt
22087 !! html/parsoid
22088 <table><tbody>
22089 <tr><th>foo||bar</th>
22090 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22091 </tr></tbody></table>
22092 !! wikitext
22093 {|
22094 !<nowiki>foo||bar</nowiki>
22095 !<nowiki>foo||bar</nowiki>
22096 |}
22097 !! html/php
22098 <table>
22099 <tr>
22100 <th>foo||bar
22101 </th>
22102 <th>foo||bar
22103 </th></tr></table>
22104
22105 !! end
22106
22107 !! test
22108 Tables: 4a. Escape -
22109 !! options
22110 parsoid=html2wt
22111 !! html/*
22112 <table>
22113
22114 <tr>
22115 <th>-bar
22116 </th></tr>
22117 <tr>
22118 <td>-bar
22119 </td></tr></table>
22120
22121 !! wikitext
22122 {|
22123
22124 !-bar
22125
22126 |-
22127 |<nowiki>-bar</nowiki>
22128 |}
22129 !! end
22130
22131 !! test
22132 Tables: 4b. Escape +
22133 !! options
22134 parsoid=html2wt
22135 !! html/*
22136 <table>
22137
22138 <tr>
22139 <th>+bar
22140 </th></tr>
22141 <tr>
22142 <td>+bar
22143 </td></tr></table>
22144
22145 !! wikitext
22146 {|
22147
22148 !+bar
22149
22150 |-
22151 |<nowiki>+bar</nowiki>
22152 |}
22153 !! end
22154
22155 !! test
22156 Tables: 4c. No escaping needed
22157 !! wikitext
22158 {|
22159 |foo-bar
22160 |foo+bar
22161 |-
22162 |''foo''-bar
22163 |''foo''+bar
22164 |-
22165 |foo
22166 bar|baz
22167 +bar
22168 -bar
22169 |-
22170 |x
22171 <div>a|b</div>
22172 |}
22173 !! html/php
22174 <table>
22175 <tr>
22176 <td>foo-bar
22177 </td>
22178 <td>foo+bar
22179 </td></tr>
22180 <tr>
22181 <td><i>foo</i>-bar
22182 </td>
22183 <td><i>foo</i>+bar
22184 </td></tr>
22185 <tr>
22186 <td>foo
22187 <p>bar|baz
22188 +bar
22189 -bar
22190 </p>
22191 </td></tr>
22192 <tr>
22193 <td>x
22194 <div>a|b</div>
22195 </td></tr></table>
22196
22197 !! html/parsoid
22198 <table><tbody>
22199 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22200 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22201 <tr><td>foo
22202 <p>bar|baz
22203 +bar
22204 -bar</p></td></tr>
22205 <tr><td>x
22206 <div>a|b</div></td>
22207 </tbody></table>
22208 !! end
22209
22210 !! test
22211 Tables: 4d. No escaping needed
22212 !! wikitext
22213 {|
22214 |[[Foo]]-bar
22215 ||+1
22216 ||-2
22217 |}
22218 !! html/php
22219 <table>
22220 <tr>
22221 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22222 </td>
22223 <td>+1
22224 </td>
22225 <td>-2
22226 </td></tr></table>
22227
22228 !! html/parsoid
22229 <table>
22230 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22231 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22232 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22233 </tbody></table>
22234 !! end
22235
22236 !! test
22237 Tables: Digest broken attributes on table and tr tag
22238 !! options
22239 parsoid=wt2html
22240 !! wikitext
22241 {| || |} ++
22242 |- || || ++ --
22243 |- > [
22244 |}
22245 !! html
22246 <table>
22247 <tbody>
22248 <tr></tr>
22249 <tr></tr>
22250 </tbody></table>
22251 !! end
22252
22253 !! test
22254 T97430: Don't emit empty nowiki pairs around marker meta tags
22255 !! options
22256 parsoid=html2wt
22257 !! html
22258 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22259 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22260 !! wikitext
22261 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22262 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22263 !! end
22264
22265 !! test
22266 Unclosed xmlish element in table line shouldn't eat end delimiters
22267 !! wikitext
22268 {|
22269 | <foo
22270 | bar>
22271 |}
22272 !! html/php
22273 <table>
22274 <tr>
22275 <td> &lt;foo
22276 </td>
22277 <td> bar&gt;
22278 </td></tr></table>
22279
22280 !! html/parsoid
22281 <table>
22282 <tbody><tr><td> &lt;foo</td>
22283 <td> bar></td></tr>
22284 </tbody></table>
22285 !! end
22286
22287 #### --------------- Links ----------------
22288 #### 1. Quote marks in link text
22289 #### 2. Wikilinks: Escapes needed
22290 #### 3. Wikilinks: No escapes needed
22291 #### 4. Extlinks: Escapes needed
22292 #### 5. Extlinks: No escapes needed
22293 #### --------------------------------------
22294 !! test
22295 Links 1. WikiLinks: No escapes needed
22296 !! wikitext
22297 [[Foo|Foo''boo'']]
22298 [[Foo|[Foobar]]]
22299 [[Foo|x [Foobar] x]]
22300 !! html/php
22301 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22302 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22303 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22304 </p>
22305 !! html/parsoid
22306 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22307 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22308 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22309 !! end
22310
22311 !! test
22312 Links 2. WikiLinks: Escapes needed
22313 !! options
22314 parsoid=html2wt
22315 !! html/parsoid
22316 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22317 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22318 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22319 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22320 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22321 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22322 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22323 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22324 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22325 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22326 !! wikitext
22327 [[Foo|<nowiki>Foobar]</nowiki>]]
22328 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22329 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22330 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22331 [[Foo|<nowiki>|Bar</nowiki>]]
22332 [[Foo|<nowiki>]]bar</nowiki>]]
22333 [[Foo|<nowiki>[[bar</nowiki>]]
22334 [[Foo|<nowiki>x [[ y</nowiki>]]
22335 [[Foo|<nowiki>x ]] y</nowiki>]]
22336 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22337 !! html/php
22338 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22339 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22340 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22341 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22342 <a href="/wiki/Foo" title="Foo">|Bar</a>
22343 <a href="/wiki/Foo" title="Foo">]]bar</a>
22344 <a href="/wiki/Foo" title="Foo">[[bar</a>
22345 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22346 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22347 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22348 </p>
22349 !! end
22350
22351 !! test
22352 Links 3. WikiLinks: No escapes needed
22353 !! wikitext
22354 [[Foo|[Foobar]]
22355 [[Foo|foo|bar]]
22356 !! html/php
22357 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22358 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22359 </p>
22360 !! html/parsoid
22361 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22362 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22363 !! end
22364
22365 !! test
22366 Links 4. ExtLinks: Escapes needed
22367 !! options
22368 parsoid=html2wt
22369 !! html/parsoid
22370 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22371 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22372 <p>[http://google.com]</p>
22373 <p>[http://google.com google]</p>
22374 !! wikitext
22375 [http://google.com <nowiki>[google]</nowiki>]
22376 [http://google.com <nowiki>google]</nowiki>]
22377
22378 <nowiki>[http://google.com]</nowiki>
22379
22380 <nowiki>[http://google.com google]</nowiki>
22381
22382 !! html/php
22383 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22384 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22385 </p><p>[http://google.com]
22386 </p><p>[http://google.com google]
22387 </p>
22388 !! end
22389
22390 !! test
22391 Links 5. ExtLinks: No escapes needed
22392 !! wikitext
22393 [http://google.com [google]
22394 !! html/php
22395 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22396 </p>
22397 !! html/parsoid
22398 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22399 !! end
22400
22401 !! test
22402 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22403 !! html/parsoid
22404 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
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>&amp;x
22407 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22408 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22409 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22410 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22411 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22412 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22413 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22414 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22415 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22416 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22417 </p>
22418 !! wikitext
22419 x<nowiki/>http://example.com<nowiki/>y
22420 http://example.com<nowiki/>?x
22421 http://example.com<nowiki/>&x
22422 http://example.com<nowiki/>'x
22423 http://example.com<nowiki/>,x
22424 http://example.com<nowiki/>.x
22425 http://example.com<nowiki/>;x
22426 http://example.com<nowiki/>:x
22427 http://example.com<nowiki/>;x
22428 http://example.com<nowiki/>!x
22429 http://example.com<nowiki/>=x
22430 http://example.com<nowiki/>(x)
22431 http://example.com(x<nowiki/>)
22432 !! end
22433
22434 !! test
22435 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22436 !! html/parsoid
22437 <p>x
22438 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22439 y
22440 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22441 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22442 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22443 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22444 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22445 </p>
22446 !! wikitext
22447 x
22448 http://example.com
22449 y
22450 "http://example.com"
22451 (http://example.com)
22452 (http://example.com) foo
22453 http://example.com,
22454 http://example.com, foo
22455 !! html/php
22456 <p>x
22457 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22458 y
22459 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22460 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22461 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22462 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22463 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22464 </p>
22465 !! end
22466
22467 !! test
22468 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22469 !! html/parsoid
22470 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22471 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22472 !! wikitext
22473 http://example.com.,;:!?\
22474 -http://example.com:
22475 !! html/php
22476 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22477 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22478 </p>
22479 !! end
22480
22481 !! test
22482 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22483 !! html/parsoid
22484 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22485 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22486 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22487 !! wikitext
22488 RFC 123<nowiki/>4
22489 RFC 123<nowiki/>y
22490 X<nowiki/>RFC 123<nowiki/>y
22491 !! end
22492
22493 !! test
22494 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22495 !! html/parsoid
22496 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22497 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22498 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22499 </p>
22500 !! wikitext
22501 RFC 123?foo
22502 RFC 123&foo
22503 -RFC 123-
22504 !! html/php
22505 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22506 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22507 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22508 </p>
22509 !! end
22510
22511 !! test
22512 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22513 !! html/parsoid
22514 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22515 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22516 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22517 !! wikitext
22518 PMID 123<nowiki/>4
22519 PMID 123<nowiki/>y
22520 X<nowiki/>PMID 123<nowiki/>y
22521 !! end
22522
22523 !! test
22524 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22525 !! html/parsoid
22526 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22527 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22528 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22529 </p>
22530 !! wikitext
22531 PMID 123?foo
22532 PMID 123&foo
22533 -PMID 123-
22534 !! html/php
22535 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22536 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22537 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22538 </p>
22539 !! end
22540
22541 !! test
22542 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22543 !! html/parsoid
22544 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22545 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22546 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22547 </p>
22548 !! wikitext
22549 ISBN 1234567890<nowiki/>1
22550 ISBN 1234567890<nowiki/>x
22551 a<nowiki/>ISBN 1234567890<nowiki/>b
22552 !! end
22553
22554 !! test
22555 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22556 !! html/parsoid
22557 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22558 !! wikitext
22559 -ISBN 1234567890's
22560 !! html/php
22561 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22562 </p>
22563 !! end
22564
22565 !! test
22566 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22567 !! options
22568 parsoid=html2wt
22569 !! html/*
22570 <p>this is not a link: http://example.com
22571 </p>
22572 !! wikitext
22573 this is not a link: <nowiki>http://example.com</nowiki>
22574 !! end
22575
22576 !! test
22577 Links 15. Link trails can't become link prefixes.
22578 !! options
22579 language=is
22580 !! wikitext
22581 [[Söfnuður]]-[[00]]
22582 !! html/php
22583 <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>
22584 </p>
22585 !! html/parsoid
22586 <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>
22587 !! end
22588
22589 #### --------------- Quotes ---------------
22590 #### 1. Quotes inside <b> and <i>
22591 #### 2. Link fragments separated by <i> and <b> tags
22592 #### 3. Link fragments inside <i> and <b>
22593 #### 4. No escaping needed
22594 #### --------------------------------------
22595 !! test
22596 1a. Quotes inside <b> and <i>
22597 !! options
22598 parsoid=html2wt,wt2wt
22599 !! wikitext
22600 ''<nowiki/>'foo'''
22601 ''<nowiki>''foo''</nowiki>''
22602 ''<nowiki>'''foo'''</nowiki>''
22603 ''foo''<nowiki/>'s
22604 '''<nowiki/>'foo''''
22605 '''<nowiki>''foo''</nowiki>'''
22606 '''<nowiki>'''foo'''</nowiki>'''
22607 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22608 '''foo'''<nowiki/>'s
22609 '''foo''
22610 ''foo''<nowiki/>'
22611 ''foo'''<nowiki/>'
22612 '''foo''<nowiki/>'
22613 ''''foo'''
22614 '''foo'''<nowiki/>'
22615 ''''foo'''<nowiki/>'
22616 ''fools'<span> errand</span>''
22617 ''<span>fool</span>'s errand''
22618 '<nowiki/>''foo'' bar '''baz''
22619 a|!*#-:;+-~[]{}b'''x''
22620 !! html/*
22621 <p><i>'foo'</i>
22622 <i>''foo''</i>
22623 <i>'''foo'''</i>
22624 <i>foo</i>'s
22625 <b>'foo'</b>
22626 <b>''foo''</b>
22627 <b>'''foo'''</b>
22628 <b>foo'<i>bar'</i>baz</b>
22629 <b>foo</b>'s
22630 '<i>foo</i>
22631 <i>foo</i>'
22632 <i>foo'</i>'
22633 '<i>foo</i>'
22634 '<b>foo</b>
22635 <b>foo</b>'
22636 '<b>foo</b>'
22637 <i>fools'<span> errand</span></i>
22638 <i><span>fool</span>'s errand</i>
22639 '<i>foo</i> bar '<i>baz</i>
22640 a|!*#-:;+-~[]{}b'<i>x</i>
22641 </p>
22642 !! end
22643
22644 !! test
22645 1b. Quotes inside <b> and <i> with other tags on same line
22646 !! options
22647 parsoid=html2wt,wt2wt
22648 !! wikitext
22649 '''a'' foo ''[[bar]]''
22650 ''a''' foo ''[[bar]]''
22651 ''a''' foo '''{{echo|[[bar]]}}'''
22652 [[foo]] x'''[[bar]]''
22653 '''foo'' <ref>test</ref>
22654 '''foo'' <div title="name">test</div>
22655 '''foo'' and <br> bar
22656 <references />
22657 !! html
22658 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22659 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22660 <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>
22661 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22662 '<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>
22663 '<i>foo</i> <div title="name">test</div>
22664 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22665 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22666 <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>
22667 </ol>
22668 !! end
22669
22670 !! test
22671 2. Link fragments separated by <i> and <b> tags
22672 !! wikitext
22673 [[''foo''<nowiki>hello]]</nowiki>
22674
22675 [['''foo'''<nowiki>hello]]</nowiki>
22676 !! html
22677 <p>[[<i>foo</i>hello]]
22678 </p><p>[[<b>foo</b>hello]]
22679 </p>
22680 !! end
22681
22682 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22683 # this is one of the shortcomings of this format
22684 !! test
22685 3. Link fragments inside <i> and <b>
22686 !! wikitext
22687 ''[[foo''<nowiki>]]</nowiki>
22688
22689 '''[[foo'''<nowiki>]]</nowiki>
22690 !! html
22691 <p><i>[[foo</i>]]
22692 </p><p><b>[[foo</b>]]
22693 </p>
22694 !! end
22695
22696 !! test
22697 4. No escaping needed
22698 !! wikitext
22699 '<span>''bar''</span>'
22700 '<span>'''bar'''</span>'
22701 'a:b'foo
22702 !! html
22703 <p>'<span><i>bar</i></span>'
22704 '<span><b>bar</b></span>'
22705 'a:b'foo
22706 </p>
22707 !! end
22708
22709 #### ----------- Paragraphs ---------------
22710 #### 1. No unnecessary escapes
22711 #### --------------------------------------
22712
22713 !! test
22714 1. No unnecessary escapes
22715 !! wikitext
22716 bar <span><nowiki>[[foo]]</nowiki></span>
22717
22718 =bar <span><nowiki>[[foo]]</nowiki></span>
22719
22720 [[bar <span><nowiki>[[foo]]</nowiki></span>
22721
22722 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22723
22724 =bar <span>foo]]</span><nowiki>=</nowiki>
22725 !! html
22726 <p>bar <span>[[foo]]</span>
22727 </p><p>=bar <span>[[foo]]</span>
22728 </p><p>[[bar <span>[[foo]]</span>
22729 </p><p>]]bar <span>[[foo]]</span>
22730 </p><p>=bar <span>foo]]</span>=
22731 </p>
22732 !!end
22733
22734 #### ----------------------- PRE --------------------------
22735 #### 1. Leading whitespace in SOL context should be escaped
22736 #### ------------------------------------------------------
22737 !! test
22738 1. Leading whitespace in SOL context should be escaped
22739 !! options
22740 parsoid
22741 !! wikitext
22742 <nowiki> </nowiki>a
22743
22744 <nowiki> </nowiki> a
22745
22746 <nowiki> </nowiki>a(tab)
22747
22748 <nowiki> </nowiki> a
22749 <!--cmt-->
22750 <nowiki> </nowiki> a
22751
22752 a
22753 <nowiki> </nowiki>b
22754
22755 a
22756 <nowiki> </nowiki>b
22757
22758 a
22759 <nowiki> </nowiki> b
22760 !! html
22761 <p> a</p>
22762 <p> a</p>
22763 <p> a(tab)</p>
22764 <p> a</p>
22765 <p><!--cmt--> a</p>
22766 <p>a
22767 b</p>
22768 <p>a
22769 b</p>
22770 <p>a
22771 b</p>
22772 !! end
22773
22774 !! test
22775 2. Leading whitespace in non-indent-pre contexts should not be escaped
22776 !! options
22777 parsoid
22778 !! wikitext
22779 foo <ref>''a''
22780 b</ref>
22781 <references />
22782 !! html
22783 <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>
22784 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22785 <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>
22786 b</span></li>
22787 </ol>
22788 !! end
22789
22790 !! test
22791 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22792 !! options
22793 parsoid
22794 !! wikitext
22795 <blockquote>
22796 a
22797 <span>b</span>
22798 c
22799 </blockquote>
22800 !! html
22801 <blockquote>
22802 <p>
22803 a
22804 <span>b</span>
22805 c</p>
22806 </blockquote>
22807 !! end
22808
22809 !! test
22810 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22811 !! options
22812 parsoid
22813 !! wikitext
22814 [[File:Foobar.jpg|thumb|caption]]
22815 !! html/parsoid
22816 <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>
22817 !! end
22818
22819 !! test
22820 5. Nowiki escaping should account for indent-pres
22821 !! options
22822 parsoid=html2wt
22823 !! html
22824 <pre>==foo==</pre>
22825 !! wikitext
22826 ==foo==
22827 !! end
22828
22829 !!test
22830 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
22831 !! options
22832 parsoid
22833 !! wikitext
22834 * foo
22835 * bar
22836 !! html
22837 <pre>
22838 * foo
22839 * bar
22840 </pre>
22841 !! end
22842
22843 #### --------------- Behavior Switches --------------------
22844
22845 !! test
22846 1. Valid behavior switches should be escaped
22847 !! options
22848 parsoid=html2wt
22849 !! html
22850 __TOC__
22851 <i>__TOC__</i>
22852 !! wikitext
22853 <nowiki>__TOC__</nowiki>
22854 ''<nowiki>__TOC__</nowiki>''
22855 !! end
22856
22857 !! test
22858 2. Invalid behavior switches should not be escaped
22859 !! options
22860 parsoid=html2wt
22861 !! html
22862 __TOO__
22863 __|__
22864 !! wikitext
22865 __TOO__
22866 __|__
22867 !! end
22868
22869 # We use indent-pre as an indirect way to test for sol-transparent behavior.
22870 !! test
22871 Behavior switches should be SOL-transparent
22872 !! wikitext
22873 __TOC__
22874
22875 <!-- this one's bogus -->
22876 __TOO__
22877
22878 __TOC__ foo
22879
22880 __TOC__ bar
22881 !! html/parsoid
22882 <meta property="mw:PageProp/toc" />
22883
22884 <!-- this one's bogus -->
22885 <pre>__TOO__</pre>
22886
22887 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
22888
22889 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
22890 !! end
22891
22892 #### --------------- HTML tags ---------------
22893 #### 1. a tags
22894 #### 2. other tags
22895 #### 3. multi-line html tag
22896 #### 4. extension tags
22897 #### -----------------------------------------
22898 !! test
22899 1. a tags
22900 !! options
22901 parsoid
22902 !! wikitext
22903 <a href="http://google.com">google</a>
22904 !! html
22905 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22906 !! end
22907
22908 !! test
22909 2. other tags
22910 !! wikitext
22911 * <nowiki><div>foo</div></nowiki>
22912 * <nowiki><div style="color:red">foo</div></nowiki>
22913 * <nowiki><td></nowiki>
22914 !! html
22915 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22916 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22917 <li> &lt;td&gt;</li></ul>
22918
22919 !! end
22920
22921 !! test
22922 3. multi-line html tag
22923 !! wikitext
22924 <nowiki><div
22925 >foo</div
22926 ></nowiki>
22927 !! html
22928 <p>&lt;div
22929 &gt;foo&lt;/div
22930 &gt;
22931 </p>
22932 !! end
22933
22934 !! test
22935 4. extension tags
22936 !! wikitext
22937 <nowiki><ref>foo</ref></nowiki>
22938
22939 <nowiki><ref>bar</nowiki>
22940
22941 baz<nowiki></ref></nowiki>
22942 !! html
22943 <p>&lt;ref&gt;foo&lt;/ref&gt;
22944 </p><p>&lt;ref&gt;bar
22945 </p><p>baz&lt;/ref&gt;
22946 </p>
22947 !! end
22948
22949 #### --------------- Others ---------------
22950 !! test
22951 Escaping nowikis
22952 !! wikitext
22953 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22954 !! html
22955 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22956 </p>
22957 !! end
22958
22959 ## The quote-char in the input is necessary for triggering the bug
22960 !! test
22961 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22962 !! options
22963 parsoid=wt2wt,html2wt
22964 !! wikitext
22965 foo's bar :
22966 !! html
22967 <p>foo's bar :</p>
22968 !! end
22969
22970 !! test
22971
22972 Tag-like HTML structures are passed through as text
22973 !! wikitext
22974 <x y>
22975
22976 <x.y>
22977
22978 <x-y>
22979
22980 1>2
22981
22982 x<y
22983
22984 a>b
22985
22986 1<d e>f
22987 !! html
22988 <p>&lt;x y&gt;
22989 </p><p>&lt;x.y&gt;
22990 </p><p>&lt;x-y&gt;
22991 </p><p>1&gt;2
22992 </p><p>x&lt;y
22993 </p><p>a&gt;b
22994 </p><p>1&lt;d e&gt;f
22995 </p>
22996 !! end
22997
22998 !! test
22999 HTML tag with necessary entities in attributes
23000 !! wikitext
23001 <span title="&amp;amp;">foo</span>
23002 !! html
23003 <p><span title="&amp;amp;">foo</span>
23004 </p>
23005 !! end
23006
23007 !! test
23008 HTML tag with 'unnecessary' entity encoding in attributes
23009 !! wikitext
23010 <span title="&amp;">foo</span>
23011 !! html
23012 <p><span title="&amp;">foo</span>
23013 </p>
23014 !! end
23015
23016 !! test
23017 HTML tag with broken attribute value quoting
23018 !! wikitext
23019 <span title="Hello world>Foo</span>
23020 !! html/php
23021 <p><span>Foo</span>
23022 </p>
23023 !! html/parsoid
23024 <p><span title="Hello world">Foo</span>
23025 </p>
23026 !! end
23027
23028 !! test
23029 Parsoid-only: HTML tag with broken attribute value quoting
23030 !! options
23031 parsoid
23032 !! wikitext
23033 <span title="Hello world>Foo</span>
23034 !! html
23035 <p><span title="Hello world">Foo</span>
23036 </p>
23037 !! end
23038
23039 !! test
23040 Table with broken attribute value quoting
23041 !! wikitext
23042 {|
23043 | title="Hello world|Foo
23044 |}
23045 !! html/php
23046 <table>
23047 <tr>
23048 <td>Foo
23049 </td></tr></table>
23050
23051 !! html/parsoid
23052 <table>
23053 <tr>
23054 <td title="Hello world">Foo
23055 </td></tr></table>
23056
23057 !! end
23058
23059 !! test
23060 Table with broken attribute value quoting on consecutive lines
23061 !! wikitext
23062 {|
23063 | title="Hello world|Foo
23064 | style="color:red|Bar
23065 |}
23066 !! html/php
23067 <table>
23068 <tr>
23069 <td>Foo
23070 </td>
23071 <td>Bar
23072 </td></tr></table>
23073
23074 !! html/parsoid
23075 <table><tbody>
23076 <tr>
23077 <td title="Hello world">Foo
23078 </td><td style="color: red">Bar
23079 </td></tr></tbody></table>
23080
23081 !! end
23082
23083 !! test
23084 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23085 !! options
23086 parsoid
23087 !! wikitext
23088 {{}}
23089 !! html
23090 {{}}
23091 !! end
23092
23093 !! test
23094 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23095 !! options
23096 parsoid
23097 !! wikitext
23098 }}{{
23099 !! html
23100 }}{{
23101 !! end
23102
23103 !!test
23104 Accept empty td cell attribute
23105 !! wikitext
23106 {|
23107 | align="center" | foo || |
23108 |}
23109 !! html
23110 <table>
23111 <tr>
23112 <td align="center"> foo </td>
23113 <td>
23114 </td></tr></table>
23115
23116 !!end
23117
23118 !!test
23119 Non-empty attributes in th-cells
23120 !! wikitext
23121 {|
23122 ! Foo !! style="color: red" | Bar
23123 |}
23124 !! html
23125 <table>
23126 <tr>
23127 <th> Foo </th>
23128 <th style="color: red"> Bar
23129 </th></tr></table>
23130
23131 !!end
23132
23133 !!test
23134 Accept empty attributes in th-cells
23135 !! wikitext
23136 {|
23137 !| foo !!| bar
23138 |}
23139 !! html
23140 <table>
23141 <tr>
23142 <th> foo </th>
23143 <th> bar
23144 </th></tr></table>
23145
23146 !!end
23147
23148 !!test
23149 Empty table rows go away
23150 !! wikitext
23151 {|
23152 | Hello
23153 | there
23154 |- class="foo"
23155 |-
23156 |}
23157 !! html
23158 <table>
23159 <tr>
23160 <td> Hello
23161 </td>
23162 <td> there
23163 </td></tr>
23164
23165 </table>
23166
23167 !! end
23168
23169 ###
23170 ### Parsoid-centric tests for testing RTing of inter-element separators
23171 ### Edge cases not tested by existing parser tests and specific to
23172 ### Parsoid-specific serialization strategies.
23173 ###
23174
23175 !!test
23176 RT-ed inter-element separators should be valid separators
23177 !! wikitext
23178 {|
23179 |- [[foo]]
23180 |}
23181 !! html
23182 <table>
23183
23184 </table>
23185
23186 !!end
23187
23188 # Parsoid-only since PHP parser relies on Tidy for correct output
23189 !!test
23190 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23191 !!options
23192 parsoid
23193 !! wikitext
23194 {|
23195 |<small>foo
23196 bar
23197 |}
23198
23199 {|
23200 |<small>foo<small>
23201 |}
23202 !! html
23203 <table>
23204 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23205 <p>bar</p></small></td></tr>
23206 </tbody></table>
23207
23208 <table>
23209 <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>
23210 </tbody></table>
23211 !!end
23212
23213 # Note that the "style" attribute is really a template parameter here.
23214 # The = would have to be {{=}} if you wanted the literal.
23215 !!test
23216 Empty TD followed by TD with tpl-generated attribute
23217 !! wikitext
23218 {|
23219 |-
23220 |
23221 |{{echo|style='color:red'}}|foo
23222 |}
23223 !! html
23224 <table>
23225
23226 <tr>
23227 <td>
23228 </td>
23229 <td>foo
23230 </td></tr></table>
23231
23232 !!end
23233
23234 !!test
23235 Indented table with an empty td
23236 !! wikitext
23237 {|
23238 |-
23239 |
23240 |foo
23241 |}
23242 !! html
23243 <table>
23244
23245 <tr>
23246 <td>
23247 </td>
23248 <td>foo
23249 </td></tr></table>
23250
23251 !!end
23252
23253 ## We have some newline diffs RT-ing this edge case
23254 ## and it is not important enough -- we seem to be emitting
23255 ## at most 2 newlines after a </tr> and this is unrelated to
23256 ## the issue from T85627 that this is testing.
23257 !!test
23258 Indented table with blank lines in between (T85627)
23259 !! options
23260 parsoid=wt2html
23261 !! wikitext
23262 {|
23263 |foo
23264
23265
23266 |}
23267 !! html
23268 <table>
23269
23270 <tr>
23271 <td>foo
23272 </td></tr></table>
23273
23274 !!end
23275
23276 !!test
23277 Indented block & table
23278 !! wikitext
23279 <div>foo</div>
23280 {|
23281 |foo
23282 |}
23283 !! html/php
23284 <div>foo</div>
23285 <table>
23286 <tr>
23287 <td>foo
23288 </td></tr></table>
23289
23290 !! html/parsoid
23291 <div data-parsoid='{"stx":"html"}'>foo</div>
23292 <table><tbody>
23293 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23294 </tbody></table>
23295 !!end
23296
23297 !! test
23298 Indent and comment before table row
23299 !! wikitext
23300 {|
23301 <!--hi-->|-
23302 | there
23303 |}
23304 !! html/php
23305 <table>
23306
23307 <tr>
23308 <td> there
23309 </td></tr></table>
23310
23311 !! html/parsoid
23312 <table>
23313 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23314 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23315 </tbody></table>
23316 !! end
23317
23318 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23319 !!test
23320 Empty TR followed by a template-generated TR
23321 !!options
23322 parsoid
23323 !! wikitext
23324 {|
23325 |-
23326 {{echo|<tr><td>foo</td></tr>}}
23327 |}
23328 !! html
23329 <table>
23330 <tbody>
23331 <tr></tr>
23332 <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}}]}'>
23333 <td>foo</td></tr>
23334 </tbody></table>
23335 !!end
23336
23337 ## PHP and parsoid output differ for this, and since this is primarily
23338 ## for testing Parsoid's serializer, marking this Parsoid only
23339 !!test
23340 Empty TR followed by mixed-ws-comment line should RT correctly
23341 !!options
23342 parsoid
23343 !! wikitext
23344 {|
23345 |-
23346 <!--c-->
23347 |-
23348 <!--c--> <!--d-->
23349 |}
23350 !! html
23351 <table>
23352 <tbody>
23353 <tr></tr>
23354 <!--c-->
23355 <tr>
23356 <!--c--> </tr><!--d-->
23357 </tbody></table>
23358
23359 !!end
23360
23361 !!test
23362 Multi-line image caption generated by templates with/without trailing newlines
23363 !! wikitext
23364 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23365 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23366 !! html/parsoid
23367 <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>
23368 <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>
23369 !!end
23370
23371 !! test
23372 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23373 !! options
23374 parsoid=html2wt
23375 !! html/parsoid
23376 <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>
23377
23378 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23379 !! wikitext
23380 <includeonly>foo</includeonly>
23381 new para
23382
23383 [[Category:Foo]]
23384
23385 = new heading =
23386 !! end
23387
23388 ## PHP emits broken html for this, and since this is primarily
23389 ## a Parsoid serializer test, marking this Parsoid only
23390 !!test
23391 Improperly nested inline or quotes tags with whitespace in between
23392 !! wikitext
23393 <span> <s>x</span> </s>
23394 ''' ''x''' ''
23395 !! html/parsoid
23396 <p><span> <s>x</s></span><s> </s>
23397 <b> <i>x</i></b><i> </i>
23398 </p>
23399 !!end
23400
23401 !!test
23402 Encapsulate protected attributes from wt
23403 !! wikitext
23404 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23405 !! html/parsoid
23406 <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>
23407 </body>
23408 !!end
23409
23410 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23411 ## Having nested or stray pre tags results in the attempt to add duplicates,
23412 ## causing an assertion fail. This test tries to prevent that situation.
23413 !!test
23414 Ensure ParagraphWrapper can deal with stray closing pre tags
23415 !!options
23416 parsoid=wt2html
23417 !! wikitext
23418 plain text</pre>
23419 !! html/parsoid
23420 plain text
23421 !!end
23422
23423 !!test
23424 1. Ensure fostered text content is wrapped in element nodes
23425 !!options
23426 parsoid=wt2html
23427 !! wikitext
23428 <table>hi</table><table>ho</table>
23429 !! html/parsoid
23430 <p>hi</p>
23431 <table></table>
23432 <p>ho</p>
23433 <table></table>
23434 !!end
23435
23436 !!test
23437 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23438 !!options
23439 parsoid=wt2html,wt2wt
23440 !! wikitext
23441 <table>
23442 <tr> || ||
23443 <td> a
23444 </table>
23445 !! html/parsoid
23446 <p> || ||
23447 </p><table>
23448 <tbody><tr><td> a</td></tr>
23449 </tbody></table>
23450 !!end
23451
23452 !!test
23453 Encapsulation properly handles null DSR information from foster box
23454 !!options
23455 parsoid=wt2html,wt2wt
23456 !! wikitext
23457 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23458 !! html/parsoid
23459 <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>
23460 !!end
23461
23462 !!test
23463 1. Encapsulate foster-parented transclusion content
23464 !!options
23465 parsoid=wt2wt,wt2html
23466 !! wikitext
23467 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23468 !! html/parsoid
23469 <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>
23470 <tbody>
23471 <tr>
23472 <td>bar</td>
23473 </tr>
23474 </tbody>
23475 </table>
23476 !!end
23477
23478 !!test
23479 2. Encapsulate foster-parented transclusion content
23480 !!options
23481 parsoid=wt2wt,wt2html
23482 !! wikitext
23483 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23484 !! html/parsoid
23485 <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>
23486 <table>
23487 <tbody>
23488 <tr>
23489 <td>bar</td>
23490 </tr>
23491 </tbody>
23492 </table>
23493 !!end
23494
23495 !!test
23496 3. Encapsulate foster-parented transclusion content
23497 !!options
23498 parsoid=wt2wt,wt2html
23499 !! wikitext
23500 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23501 !! html/parsoid
23502 <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;]}">
23503 <p>foo</p>
23504 </div>
23505 <table>
23506 <tbody>
23507 <tr>
23508 <td>bar</td>
23509 </tr>
23510 </tbody>
23511 </table>
23512 !!end
23513
23514 !!test
23515 4. Encapsulate foster-parented transclusion content
23516 !!options
23517 parsoid=wt2wt,wt2html
23518 !! wikitext
23519 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23520 !! html/parsoid
23521 <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;]}">
23522 <p>foo</p>
23523 </div>
23524 <table>
23525 <tbody>
23526 <tr>
23527 <td>bar</td>
23528 </tr>
23529 </tbody>
23530 </table>
23531 !!end
23532
23533 !!test
23534 5. Encapsulate foster-parented transclusion content
23535 !!options
23536 parsoid=wt2wt,wt2html
23537 !! wikitext
23538 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23539 !! html/parsoid
23540 <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>
23541 <table>
23542 <tbody>
23543 <tr>
23544 <td>
23545 <div>
23546 <p>foo</p>
23547 </div>
23548 </td>
23549 </tr>
23550 </tbody>
23551 </table>
23552 !!end
23553
23554 !!test
23555 6. Encapsulate foster-parented transclusion content
23556 !!options
23557 parsoid=wt2wt,wt2html
23558 !! wikitext
23559 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23560 !! html/parsoid
23561 <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>
23562 <table>
23563 <tbody>
23564 <tr>
23565 <td>
23566 <div>
23567 <p>foo</p>
23568 </div>
23569 </td>
23570 </tr>
23571 </tbody>
23572 </table>
23573 <p>ok</p>
23574 !!end
23575
23576 !!test
23577 7. Encapsulate foster-parented transclusion content
23578 !!options
23579 parsoid=wt2wt,wt2html
23580 !! wikitext
23581 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23582 !! html/parsoid
23583 <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>
23584 <table>
23585 <tbody>
23586 <tr>
23587 <td>bar</td>
23588 </tr>
23589 </tbody>
23590 </table>
23591 !!end
23592
23593 # Note that the wt is broken on purpose: the = should be {{=}} if you
23594 # don't want it to be a template parameter key.
23595 !!test
23596 8. Encapsulate foster-parented transclusion content
23597 !!options
23598 parsoid=wt2wt,wt2html
23599 !! wikitext
23600 {{echo|a
23601 }}{|{{echo|style='color:red'}}
23602 |-
23603 |b
23604 |}
23605 !! html/parsoid
23606 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23607 <span> </span>
23608 <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>
23609 <table>
23610 <tbody>
23611 <tr>
23612 <td>b</td>
23613 </tr>
23614 </tbody>
23615 </table>
23616 !!end
23617
23618 !!test
23619 9. Encapsulate foster-parented transclusion content
23620 !!options
23621 parsoid=wt2wt,wt2html
23622 !! wikitext
23623 <table>{{echo|hi</table>hello}}
23624 !! html/parsoid
23625 <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>
23626 !!end
23627
23628 !!test
23629 Table in fosterable position
23630 !!options
23631 parsoid=wt2html,wt2wt
23632 !! wikitext
23633 {{OpenTable}}
23634 <div>
23635 {|
23636 |}
23637 </div>
23638 |}
23639 !! html/parsoid
23640 <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">
23641 </span>
23642 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23643
23644 <table>
23645 </table>
23646 !!end
23647
23648 # Parsoid only for bug 64747
23649 !! test
23650 Properly encapsulate empty-content transclusions in fosterable positions
23651 !! wikitext
23652 <table>
23653 {{#if:|
23654 <td>foo</td>
23655 }}
23656 </table>
23657 !! html/parsoid
23658 <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":["","","",""]}]]}'>
23659
23660 </table>
23661 !! end
23662
23663 !!test
23664 Support <object> element with .data attribute
23665 !!options
23666 parsoid=html2wt
23667 !! html/parsoid
23668 <object data="test.swf"></object>
23669 !! wikitext
23670 <object data="test.swf"></object>
23671 !!end
23672
23673 !! test
23674 Don't block XML namespace declaration
23675 !! wikitext
23676 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23677 !! html/php
23678 <p><span>MediaWiki</span>
23679 </p>
23680 !! html/parsoid
23681 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23682 !! end
23683
23684 # -----------------------------------------------------------------
23685 # The following section of tests are primarily to spec requirements
23686 # around serialization of new/edited content.
23687 #
23688 # All these tests are marked Parsoid html2wt and html2html only
23689 # ----------------------------------------------------------------
23690
23691 # 'mi' is a localinterwiki prefix as well as a language
23692 !! test
23693 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23694 !! options
23695 parsoid=html2wt
23696 !! html
23697 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23698 !! wikitext
23699 [[Foo]]
23700 !! end
23701
23702 # See T93839
23703 !! test
23704 New wikilinks should be serialized properly
23705 !! options
23706 parsoid=html2wt
23707 !! html
23708 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23709 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23710 !! wikitext
23711 [[Foo]]
23712 [[Foo]]
23713 !! end
23714
23715 !! test
23716 New wiki links (href variations)
23717 !! options
23718 parsoid=html2wt
23719 !! html
23720 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23721 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23722 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23723 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23724 !! wikitext
23725 [[Foo_bar]]
23726 [[Foo_bar]]
23727 [[Foo_bar]]
23728 [[Toxine bactérienne]]
23729 !! end
23730
23731 !! test
23732 New wiki links (content string variations)
23733 !! options
23734 parsoid=html2wt
23735 !! html
23736 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23737 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23738 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23739 !! wikitext
23740 [[Foo_bar]]
23741 [[Foo bar]]
23742 [[Foo_bar|./Foo_bar]]
23743 !! end
23744
23745 !! test
23746 New category links (href variations)
23747 !! options
23748 parsoid=html2wt
23749 !! html
23750 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23751 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23752 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23753 !! wikitext
23754 [[Category:Toxine bactérienne]]
23755 [[Category:Toxine bactérienne]]
23756 [[Category:Toxine bactérienne]]
23757 !! end
23758
23759 !! test
23760 New sol transparent links don't need indent-pre nowiki protection
23761 !! options
23762 parsoid=html2wt
23763 language=de
23764 !! html
23765 <link rel="mw:PageProp/redirect" href="./Main_Page">
23766 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23767 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23768 !! wikitext
23769 #WEITERLEITUNG [[Main Page]]
23770 <!-- this is good --> [[Category:Good]]
23771 <!-- this is great --> [[Kategorie:Great]]
23772 !! end
23773
23774 !! test
23775 New interlanguage links (href variations)
23776 !! options
23777 parsoid=html2wt
23778 !! html
23779 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23780 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23781 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23782 !! wikitext
23783 [[es:Toxine bactérienne]]
23784 [[es:Toxine_bactérienne]]
23785 [[es:Toxine_bactérienne]]
23786 !! end
23787
23788 !! test
23789 Image: Modifying size of an image (1)
23790 !! options
23791 parsoid={
23792 "modes": ["wt2wt"],
23793 "changes": [
23794 ["img[height]", "attr", "height", "22"],
23795 ["img[width]", "attr", "width", "200"]
23796 ]
23797 }
23798 !! wikitext
23799 [[Image:Foobar.jpg|230x230px]]
23800 !! wikitext/edited
23801 [[Image:Foobar.jpg|200x200px]]
23802 !!end
23803
23804 !! test
23805 Image: Modifying size of an image (2)
23806 !! options
23807 parsoid={
23808 "modes": ["wt2wt"],
23809 "changes": [
23810 ["img[height]", "attr", "height", "100"],
23811 ["img[width]", "attr", "width", "500"]
23812 ]
23813 }
23814 !! wikitext
23815 [[Image:Foobar.jpg|230x230px]]
23816 !! wikitext/edited
23817 [[Image:Foobar.jpg|500x500px]]
23818 !!end
23819
23820 # Change in size is ignored so long as class='mw-default-size'
23821 !! test
23822 Image: Modifying size of an image (3)
23823 !! options
23824 parsoid={
23825 "modes": ["wt2wt"],
23826 "changes": [
23827 ["figure[class]", "removeClass", "mw-default-size"],
23828 ["figure img", "attr", "height", "19"],
23829 ["figure img", "attr", "width", "170"]
23830 ]
23831 }
23832 !! wikitext
23833 [[Image:Foobar.jpg|thumb]]
23834 !! wikitext/edited
23835 [[Image:Foobar.jpg|thumb|170x170px]]
23836 !!end
23837
23838 !! test
23839 Image: Modifying alignment of an image (bug 48665)
23840 !! options
23841 parsoid={
23842 "modes": ["wt2wt"],
23843 "changes": [
23844 ["figure[class]", "removeClass", "mw-halign-right"],
23845 ["figure[class]", "addClass", "mw-halign-left"]
23846 ]
23847 }
23848 !! wikitext
23849 [[Image:Foobar.jpg|thumb|caption|right]]
23850 !! wikitext/edited
23851 [[Image:Foobar.jpg|thumb|caption|left]]
23852 !! end
23853
23854 !! test
23855 Image: Modifying mw-default-size of an frameless image (bug 62805)
23856 !! options
23857 parsoid={
23858 "modes": ["wt2wt"],
23859 "changes": [
23860 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23861 ]
23862 }
23863 !! wikitext
23864 [[Image:Foobar.jpg|frameless|right]]
23865 !! wikitext/edited
23866 [[Image:Foobar.jpg|frameless|right|220x220px]]
23867 !! end
23868
23869 !! test
23870 Image: Modifying valign of an image (bug 49221)
23871 !! options
23872 parsoid={
23873 "modes": ["wt2wt"],
23874 "changes": [
23875 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23876 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23877 ]
23878 }
23879 !! wikitext
23880 [[File:Foobar.jpg|20px|middle]]
23881 !! wikitext/edited
23882 [[File:Foobar.jpg|20px|text-top]]
23883 !! end
23884
23885 !! test
23886 Image: Modifying alt attribute of an image (bug 56400)
23887 !! options
23888 parsoid={
23889 "modes": ["wt2wt"],
23890 "changes": [
23891 ["img[alt]", "attr", "alt", "some alternate edited text"]
23892 ]
23893 }
23894 !! wikitext
23895 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23896 !! wikitext/edited
23897 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23898 !!end
23899
23900 !! test
23901 Image: Modifying caption of an image
23902 !! options
23903 parsoid={
23904 "modes": ["wt2wt"],
23905 "changes": [
23906 ["figcaption", "text", "new caption"]
23907 ]
23908 }
23909 !! wikitext
23910 [[Image:Foobar.jpg|thumb|original caption]]
23911 !! wikitext/edited
23912 [[Image:Foobar.jpg|thumb|new caption]]
23913 !!end
23914
23915 !! test
23916 Image: empty alt attribute (bug 48924)
23917 !! options
23918 parsoid
23919 !! wikitext
23920 [[File:Foobar.jpg|thumb|alt=|bar]]
23921 !! html
23922 <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>
23923 !! end
23924
23925 #!! test
23926 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23927 #!! options
23928 #parsoid=html2wt
23929 #language=ar
23930 #!! html
23931 #<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>
23932 #!! wikitext
23933 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23934 #!! end
23935
23936 !! test
23937 Image: Block level image should have \n before and after
23938 !! wikitext
23939 123
23940 [[File:Foobar.jpg|right|thumb|150x150px]]
23941 456
23942 !! html/parsoid
23943 <p>123</p>
23944 <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>
23945 <p>456</p>
23946 !!end
23947
23948 !! test
23949 Image: New block level image should have \n before and after (existing content)
23950 !! wikitext
23951 123
23952 [[File:Foobar.jpg|right|thumb|150x150px]]
23953 456
23954 !! html/parsoid
23955 <p>123</p>
23956 <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>
23957 <p>456</p>
23958 !!end
23959
23960 !! test
23961 Image: upright option (parsoid)
23962 !! wikitext
23963 [[File:Foobar.jpg|thumb|upright|caption]]
23964 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23965 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23966 !! html/parsoid
23967 <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>
23968 <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>
23969 <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>
23970 !!end
23971
23972 !! test
23973 Image: upright option is ignored on inline and frame images (parsoid)
23974 !! wikitext
23975 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23976 !! html/parsoid
23977 <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>
23978 !!end
23979
23980 !! test
23981 Image: from basic HTML (1)
23982 !! options
23983 parsoid=html2wt
23984 !! html/parsoid
23985 <span typeof="mw:Image">
23986 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23987 </span>
23988 !! wikitext
23989 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23990 !! end
23991
23992 !! test
23993 Image: from basic HTML (2)
23994 !! options
23995 parsoid=html2wt
23996 !! html/parsoid
23997 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23998 !! wikitext
23999 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24000 !! end
24001
24002 !! test
24003 Image: from basic HTML (3)
24004 !! options
24005 parsoid=html2wt
24006 !! html/parsoid
24007 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24008 !! wikitext
24009 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24010 !! end
24011
24012 !! test
24013 Image: from basic HTML (4)
24014 !! options
24015 parsoid=html2wt
24016 !! html/parsoid
24017 <img src="./File:Foobar.jpg">
24018 !! wikitext
24019 [[File:Foobar.jpg|link=]]
24020 !! end
24021
24022 !! test
24023 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24024 !! options
24025 parsoid=html2wt
24026 !! html
24027 <ul>
24028 <li><p>foo</p></li>
24029 </ul>
24030 !! wikitext
24031 * foo
24032 !! end
24033
24034 !! test
24035 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24036 !! options
24037 parsoid=html2wt
24038 !! html
24039 <ul> <li>foo</li></ul>
24040 !! wikitext
24041 * foo
24042 !! end
24043
24044 !! test
24045 Don't strip leading whitespace when handling indent-pre suppressing tags
24046 !! options
24047 parsoid=html2wt
24048 !! html
24049 <table>
24050 <tr><td> indented row</td></tr>
24051 </table>
24052 <blockquote><p>
24053 <b>This is very bold of you!</b>
24054 </p>
24055 <table><tr><td>
24056 indented cell (no pre-wrapping!)
24057 </td></tr></table>
24058 </blockquote>
24059 <p>foo</p>
24060 <div>bar</div>
24061 !! wikitext
24062 {|
24063 | indented row
24064 |}
24065 <blockquote>
24066 '''This is very bold of you!'''
24067
24068 {|
24069 |
24070 indented cell (no pre-wrapping!)
24071 |}
24072 </blockquote>
24073 foo
24074 <div>bar</div>
24075 !! end
24076
24077 !! test
24078 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24079 !! options
24080 parsoid=html2wt
24081 !! wikitext
24082 foo
24083 <nowiki> </nowiki><span>bar</span>
24084
24085 <span>foo2
24086 <nowiki> </nowiki></span>bar2
24087
24088 <div>foo</div>
24089 <nowiki> </nowiki><span>bar</span>
24090
24091 <div>
24092 <nowiki> </nowiki><span>foo</span>
24093 </div>
24094 !! html
24095 <p>foo</p>
24096 <span>bar</span>
24097
24098 <span>foo2
24099 </span>bar2
24100
24101 <div>foo</div>
24102 <span>bar</span>
24103
24104 <div>
24105 <span>foo</span>
24106 </div>
24107 !! end
24108
24109 !! test
24110 Lists: Dont insert newlines in a serialized list item.
24111 !! options
24112 parsoid=html2wt
24113 !! html
24114 <ul><li>a<br>b</li><li>c</li></ul>
24115 !! wikitext
24116 * a<br>b
24117 * c
24118 !! end
24119
24120 !! test
24121 Headings: Force sol-transparent links and behavior switches to serialize before/after
24122 !! options
24123 parsoid=html2wt
24124 !! html
24125 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24126 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24127
24128 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24129 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24130
24131 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24132
24133 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24134 !! wikitext
24135 == hello there ==
24136 [[Category:A1]]
24137 [[Category:A2]]
24138
24139 == hi pal ==
24140
24141 <!--foo--> [[Category:A3]]
24142
24143 == how goes it ==
24144
24145 == it goes well ==
24146 [[Category:A4]] <!--bar-->
24147
24148 ==howdy [[Category:A5]] ==
24149
24150 __TOC__
24151
24152 == ok ==
24153 !! end
24154
24155 !! test
24156 Headings: Don't hoist metas that come from templates
24157 !! options
24158 parsoid=html2wt
24159 !! html
24160 <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>
24161 !! wikitext
24162 == {{echo|foo [[Category:Foo]]}} ==
24163 !! end
24164
24165 !! test
24166 Headings: Category in ref isn't hoisted
24167 !! options
24168 parsoid=html2wt
24169 !! html
24170 <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>
24171
24172 <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>
24173 !! wikitext
24174 == foo <ref>bar
24175 [[Category:Baz]] </ref> ==
24176
24177 <references />
24178 !! end
24179
24180 !! test
24181 Parsoid: Serialize positional parameters with = in them as named parameter
24182 !! options
24183 parsoid=html2wt
24184 !! html
24185 <p about="#mwt1" typeof="mw:Transclusion"
24186 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24187
24188 <p about="#mwt1" typeof="mw:Transclusion"
24189 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24190
24191 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24192 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24193 <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>
24194 !! wikitext
24195 {{echo|1 = f=oo}}
24196
24197 {{echo|1 = f=oo|2 = bar}}
24198
24199 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24200 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24201 {{echo|<nowiki>f=oo</nowiki>|bar}}
24202 !! end
24203
24204 !! test
24205 Parsoid: Serialize positional parameters with = in extlink as named parameter
24206 !! options
24207 parsoid=html2wt
24208 !! html
24209 <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>
24210 !! wikitext
24211 {{echo|1 = http://stuff?is=ok}}
24212 !! end
24213
24214 !! test
24215 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24216 !! options
24217 parsoid=html2wt
24218 !! html
24219 <div>a<p>b</p></div>
24220 <div>a
24221 <p>b</p></div>
24222 <div>
24223 a
24224 <p>b</p></div>
24225 !! wikitext
24226 <div>a
24227 b
24228 </div>
24229 <div>a
24230 b
24231 </div>
24232 <div>
24233 a
24234
24235 b
24236 </div>
24237 !! end
24238
24239 !! test
24240 Substrings resembling wikitext in hrefs should not get nowiki escapes
24241 !! options
24242 parsoid=html2wt
24243 !! html
24244 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24245 !! wikitext
24246 [[Foo''bar''baz]]
24247 !! end
24248
24249 !! test
24250 Enforce single-line context in the serializer
24251 !! options
24252 parsoid=html2wt
24253 !! html
24254 <h2>testing
24255 123</h2>
24256
24257 <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">
24258 </span><span about="#mwt1">you</span> </h2>
24259
24260 <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>
24261
24262 <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
24263 there</span></li></ol>
24264
24265 <ul><li>asd
24266 sdf</li></ul>
24267
24268 <ul><li>foo
24269 bar
24270 baz</li>
24271 <li>foo <b>bar</b>
24272 baz</li></ul>
24273 !! wikitext
24274 == testing 123 ==
24275
24276 == hi {{bogus|there
24277 you}} ==
24278
24279 == foo <ref>hello
24280 there</ref> ==
24281
24282 <references />
24283
24284 * asd sdf
24285
24286 * foo bar baz
24287 * foo '''bar''' baz
24288 !! end
24289
24290 !! test
24291 Serialize new placeholder space without spans
24292 !! options
24293 parsoid=html2wt
24294 !! html
24295 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24296
24297 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24298
24299 <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>
24300 !! wikitext
24301 foo : bar
24302
24303 foo : bar
24304
24305 <ref>foo : bar</ref>ok
24306 !! end
24307
24308
24309 #-----------------------
24310 # Tag minimization tests
24311 #-----------------------
24312
24313 !! test
24314 1. I/B quote minimization: wikitext-only tags should be combined
24315 !! options
24316 parsoid=html2wt
24317 !! html
24318 <p><i>A</i><i>B</i></p>
24319 <p><b>A</b><b>B</b></p>
24320 <p><i>A</i><b><i>B</i></b></p>
24321 <p><b>A</b><i><b>B</b></i></p>
24322 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24323 <p><i><b>A</b></i><i><b>B</b></i></p>
24324 <p><i><b>A</b></i><b><i>B</i></b></p>
24325 <p><b><i>A</i></b><i><b>B</b></i></p>
24326 !! wikitext
24327 ''AB''
24328
24329 '''AB'''
24330
24331 ''A'''B'''''
24332
24333 '''A''B'''''
24334
24335 '''A''BC''D'''
24336
24337 '''''AB'''''
24338
24339 '''''AB'''''
24340
24341 '''''AB'''''
24342 !! end
24343
24344 !! test
24345 2. I/B quote minimization: wikitext and html tags should not be combined
24346 !! options
24347 parsoid=html2wt
24348 !! html
24349 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24350 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24351 !! wikitext
24352 ''A''<i>B</i>
24353
24354 ''A''<nowiki/>'''<i>B</i>'''
24355 !! end
24356
24357 !! test
24358 3. I/B quote minimization: templated content stops minimization
24359 !! options
24360 parsoid=html2wt
24361 !! html
24362 <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>
24363 <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>
24364 !! wikitext
24365 ''A''{{echo|''B''}}
24366
24367 ''A''{{echo|'''''B'''''}}
24368 !! end
24369
24370 !! test
24371 4. I/B quote minimization: new content should be mimimized with adjacent old content
24372 !! options
24373 parsoid=html2wt
24374 !! html
24375 <p><i>A</i><i>B</i></p>
24376 <p><b>A</b><b>B</b></p>
24377 <p><i>A</i><b><i>B</i></b></p>
24378 !! wikitext
24379 ''AB''
24380
24381 '''AB'''
24382
24383 ''A'''B'''''
24384 !! end
24385
24386 !! test
24387 5a. Merge adjacent quote nodes if they've been edited
24388 !! options
24389 parsoid={
24390 "modes": ["wt2wt", "selser"],
24391 "changes": [
24392 ["p", "contents", "remove", ":contains('b')"]
24393 ]
24394 }
24395 !! wikitext
24396 ''a''b''c''
24397 !! wikitext/edited
24398 ''ac''
24399 !! end
24400
24401 !! test
24402 5b. Merge adjacent quote nodes if they've been edited
24403 !! options
24404 parsoid={
24405 "modes": ["wt2wt", "selser"],
24406 "changes": [
24407 ["#x", "remove"]
24408 ]
24409 }
24410 !! wikitext
24411 ''a''<span id="x">b</span>''c''
24412 !! wikitext/edited
24413 ''ac''
24414 !! end
24415
24416 !! test
24417 1. Merge adjacent link nodes as long as at least one element is new
24418 !! options
24419 parsoid={
24420 "modes": ["html2wt"],
24421 "scrubWikitext": true
24422 }
24423 !! html
24424 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24425 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24426 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24427 !! wikitext
24428 [[Football]]
24429 [[Football]]
24430 [[Football|Foot]][[Football|ball]]
24431 !! end
24432
24433 !! test
24434 2. Merge adjacent link nodes and enable additional normalizations
24435 !! options
24436 parsoid={
24437 "modes": ["html2wt"],
24438 "scrubWikitext": true
24439 }
24440 !! html
24441 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24442 !! wikitext
24443 [[Football|''Football'']]
24444 !! end
24445
24446 !! test
24447 3. Don't merge adjacent link nodes if scrubWikitext is false
24448 !! options
24449 parsoid={
24450 "modes": ["html2wt"],
24451 "scrubWikitext": false
24452 }
24453 !! html
24454 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24455 !! wikitext
24456 [[Football|Foot]][[Football|ball]]
24457 !! end
24458
24459 #------------------------------
24460 # End of tag minimization tests
24461 #------------------------------
24462
24463 !!test
24464 Bug 54262: New entities
24465 !! options
24466 parsoid=html2wt
24467 !! wikitext
24468 &nbsp;
24469 !! html
24470 <span typeof="mw:Entity">&nbsp;</span>
24471 !! end
24472
24473 ## Note that there is no wikitext output for 'unknownproperty' ##
24474 ## Unknown magic words are silently dropped ##
24475
24476 !! test
24477 Magic words
24478 !! options
24479 parsoid=html2wt
24480 !! html/parsoid
24481 <meta property='mw:PageProp/toc' />
24482 <meta property='mw:PageProp/notoc' />
24483 <meta property='mw:PageProp/forcetoc' />
24484 <meta property='mw:PageProp/index' />
24485 <meta property='mw:PageProp/noindex' />
24486 <meta property='mw:PageProp/nogallery' />
24487 <meta property='mw:PageProp/noeditsection' />
24488 <meta property='mw:PageProp/notitleconvert' />
24489 <meta property='mw:PageProp/nocontentconvert' />
24490 <meta property='mw:PageProp/unknownproperty' />
24491 !! wikitext
24492 __TOC__
24493 __NOTOC__
24494 __FORCETOC__
24495 __INDEX__
24496 __NOINDEX__
24497 __NOGALLERY__
24498 __NOEDITSECTION__
24499 __NOTITLECONVERT__
24500 __NOCONTENTCONVERT__
24501 !! end
24502
24503 !! test
24504 Consecutive <pre>s should not get merged
24505 !! options
24506 parsoid=html2wt,html2html
24507 !! html
24508 <pre>a</pre><pre>b</pre>
24509
24510 <pre>c
24511 </pre><pre>
24512 d</pre>
24513
24514 <pre>e
24515
24516 </pre><pre>
24517
24518 f</pre>
24519 !! wikitext
24520 a
24521
24522 b
24523
24524 c
24525
24526 d
24527
24528 e
24529
24530
24531
24532 f
24533 !! end
24534
24535 !! test
24536 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24537 !! options
24538 parsoid=html2wt
24539 !! html
24540 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24541 !! wikitext
24542 [[Special:BookSources/1234567890|ISBN 1234567895]]
24543 !! end
24544
24545 !! test
24546 Edited RFC links not serializable as RFC links should serialize as extlinks
24547 !! options
24548 parsoid=html2wt
24549 !! html
24550 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24551 !! wikitext
24552 [//tools.ietf.org/html/rfc123 New RFC]
24553 !! end
24554
24555 !! test
24556 Edited PMID links not serializable as PMID links should serialize as extlinks
24557 !! options
24558 parsoid=html2wt
24559 !! html
24560 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24561 !! wikitext
24562 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24563 !! end
24564
24565 !! test
24566 WTS of autolinks with trailing/surrounding context
24567 !! options
24568 parsoid=html2wt
24569 !! html/parsoid
24570 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24571 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24572 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24573 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24574 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24575 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24576 !! wikitext
24577 http://cscott.net<nowiki/>'''foo'''
24578
24579 http://cscott.net<b>foo</b>
24580
24581 '''http://cscott.net<nowiki/>'''
24582
24583 '''http://cscott.net '''
24584
24585 '''http://cscott.net<nowiki/>x'''
24586
24587 http://cscott.net<nowiki/>x
24588 !! end
24589
24590 !! test
24591 WTS of autolinks with nowikis (round-trip)
24592 !! wikitext
24593 x<nowiki/>http://cscott.net<nowiki/>x
24594 !! html/parsoid
24595 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24596 !! end
24597
24598 # this is the "easy" test because it leaves in place all the
24599 # data-parsoid information indicating this is an autolink
24600 !! test
24601 WTS of autolinks with escapes (editing)
24602 !! options
24603 parsoid={
24604 "modes": ["wt2wt"],
24605 "changes": [
24606 [ "meta", "remove" ]
24607 ]
24608 }
24609 !! wikitext
24610 x<nowiki/>http://cscott.net<nowiki/>x
24611 !! wikitext/edited
24612 x<nowiki/>http://cscott.net<nowiki/>x
24613 !! end
24614
24615 !! test
24616 Edited Redirect link should emit a non-piped wikitext link
24617 !! options
24618 parsoid=html2wt
24619 !! html
24620 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
24621 !! wikitext
24622 #REDIRECT [[Bar]]
24623 !! end
24624
24625 !! test
24626 T75121: Infer extension name from typeOf if data-mw is not present
24627 !! options
24628 parsoid=html2wt
24629 !! html
24630 <div typeOf="mw:Extension/foo"></div>
24631 !! wikitext
24632 <foo />
24633 !! end
24634
24635 # Note that the <p> wrapping isn't present in PHP parser output
24636 # The important thing for this test is that P-wrapping doesn't
24637 # interfere with the <nowiki> protection for leading - in <td>
24638 # (which isn't necessary for <th>).
24639 !! test
24640 T88318: p-wrapped dash in table.
24641 !! options
24642 parsoid=html2wt,wt2wt
24643 !! html/parsoid
24644 <table><tbody>
24645 <tr><th><p>-</p></th><th><p>- </p></th></tr>
24646 <tr><td><p>-</p></td><td><p>- </p></td></tr>
24647 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
24648 </tbody></table>
24649 !! wikitext
24650 {|
24651 !-
24652 !-
24653 |-
24654 |<nowiki>-</nowiki>
24655 |<nowiki>- </nowiki>
24656 |-
24657 |<small>-</small>
24658 |<br>
24659 -
24660 |<br>
24661 -
24662 |}
24663 !! html/php+tidy
24664 <table>
24665 <tr>
24666 <th>-</th>
24667 <th>-</th>
24668 </tr>
24669 <tr>
24670 <td>-</td>
24671 <td>-</td>
24672 </tr>
24673 <tr>
24674 <td><small>-</small></td>
24675 <td><br />
24676 <p>-</p>
24677 </td>
24678 <td><br />
24679 <p>-</p>
24680 </td>
24681 </tr>
24682 </table>
24683 !! end
24684
24685 !! test
24686 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
24687 !! options
24688 parsoid=html2wt
24689 !! html
24690 <table id='mwAb'>
24691 <td id='mwAc'>foo</td>
24692 <td id='serialize-this'>bar</td>
24693 </table>
24694 !! wikitext
24695 {|
24696 |foo
24697 | id="serialize-this" |bar
24698 |}
24699 !! end
24700
24701 !! test
24702 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24703 !! options
24704 parsoid=html2wt
24705 !! html
24706 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24707 !! wikitext
24708 <div id="hello">ok</div>
24709 !! end
24710
24711 !! test
24712 WTS change modes
24713 !! options
24714 parsoid={
24715 "modes": ["wt2wt"],
24716 "changes": [
24717 [ "#xyz", "before", "<b>before</b> stuff " ],
24718 [ "#xyz", "after", " stuff <i>after</i>" ],
24719 [ "#xyz", "html", "x <b>y</b> z" ]
24720 ]
24721 }
24722 !! wikitext
24723 <span id="xyz">hello</span>
24724 !! wikitext/edited
24725 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24726 !! end
24727
24728 !! test
24729 Never serialize a-tag as html, regardless of what data-parsoid has to say
24730 !! options
24731 parsoid=html2wt
24732 !! html
24733 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24734 !! wikitext
24735 [[Foo]]
24736 !! end
24737
24738 ## SSS FIXME: This is broken output nevertheless.
24739 ## What might be a reasonable non-broken output for this?
24740 ## This is an edge case unlikely to be seen in production
24741 ## that I am not wasting more time on this right now.
24742 !! test
24743 Never serialize a-tag as html, no matter what attributes it has
24744 !! options
24745 parsoid=html2wt
24746 !! html
24747 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
24748 !! wikitext
24749 [http://boo.org http://boohoo.org]
24750 !! end
24751
24752 # --------------------------------------------
24753 # Tests spec'ing wikitext serialization norms |
24754 # --------------------------------------------
24755
24756 !! test
24757 Lists: Add space after bullets
24758 !! options
24759 parsoid=html2wt
24760 !! html
24761 <ul>
24762 <li>foo</li>
24763 <li> bar</li>
24764 <li><span> baz</span></li>
24765 </ul>
24766 !! wikitext
24767 * foo
24768 * bar
24769 * <span> baz</span>
24770 !! end
24771
24772 !! test
24773 Headings: Add space before/after == (T53744)
24774 !! options
24775 parsoid=html2wt
24776 !! html
24777 <h2>foo</h2>
24778 <h2> bar</h2>
24779 <h2>baz </h2>
24780 <h2><span> baz</span></h2>
24781
24782 <!-- Even after hoisted content -->
24783 <h2> <link href="Category:A2" rel="mw:PageProp/Category" />ok</h2>
24784 !! wikitext
24785 == foo ==
24786
24787 == bar ==
24788
24789 == baz ==
24790
24791 == <span> baz</span> ==
24792
24793 <!-- Even after hoisted content -->
24794 [[Category:A2]]
24795
24796 == ok ==
24797 !! end
24798
24799 !! test
24800 1. Headings: suppress newly created empty headings
24801 !! options
24802 parsoid={
24803 "modes": ["html2wt"],
24804 "scrubWikitext": true
24805 }
24806 !! html
24807 <h2></h2>
24808 !! wikitext
24809 !! end
24810
24811 !! test
24812 2. Headings: don't suppress empty headings if scrubWikitext is false
24813 !! options
24814 parsoid=html2wt
24815 !! html
24816 <h2></h2>
24817 !! wikitext
24818 ==<nowiki/>==
24819 !! end
24820
24821 !! test
24822 3. Headings: don't suppress empty headings for existing headings even if scrubWikitext is true
24823 !! options
24824 parsoid={
24825 "modes": ["html2wt"],
24826 "scrubWikitext": true
24827 }
24828 !! html
24829 <h2 data-parsoid='{}'></h2>
24830 !! wikitext
24831 ==<nowiki/>==
24832 !! end
24833
24834 !! test
24835 1. WT Quote Tags: suppress newly created empty style tags
24836 !! options
24837 parsoid={
24838 "modes": ["html2wt"],
24839 "scrubWikitext": true
24840 }
24841 !! html
24842 <i></i><b></b>
24843 !! wikitext
24844 !! end
24845
24846 !! test
24847 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
24848 !! options
24849 parsoid=html2wt
24850 !! html
24851 <i></i><b></b>
24852 !! wikitext
24853 ''<nowiki/>'''''<nowiki/>'''
24854 !! end
24855
24856 !! test
24857 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
24858 !! options
24859 parsoid={
24860 "modes": ["html2wt"],
24861 "scrubWikitext": true
24862 }
24863 !! html
24864 <p> hi</p>
24865 !! wikitext
24866 hi
24867 !! end
24868
24869 !! test
24870 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
24871 !! options
24872 parsoid=html2wt
24873 !! html
24874 <p> hi</p>
24875 !! wikitext
24876 <nowiki> </nowiki>hi
24877 !! end
24878
24879 # ---------------------------------------------------
24880 # End of tests spec'ing wikitext serialization norms |
24881 # ---------------------------------------------------
24882
24883 # -----------------------------------------------------------------
24884 # End of section for Parsoid-only html2wt tests for serialization
24885 # of new content
24886 # -----------------------------------------------------------------
24887
24888 # -----------------------------------------------------------------
24889 # The following section of tests are primarily to spec behavior of
24890 # the selective serializer. All these tests have manual selser
24891 # changes. The automated selser changes for all tests handle the
24892 # wide variation of changes, but these tests here capture specs
24893 # deterministically.
24894 # ----------------------------------------------------------------
24895
24896 ## T90517
24897 !! test
24898 Selser: New comments should not be lost
24899 !! options
24900 parsoid={
24901 "modes": ["selser"],
24902 "changes": [
24903 [ "#a", "after", "<!--c1-->" ],
24904 [ "#b", "before", "<!--c2-->" ]
24905 ]
24906 }
24907 !! wikitext
24908 <span id="a">a</span>
24909
24910 <span id="b">b</span>
24911 !! wikitext/edited
24912 <span id="a">a</span><!--c1-->
24913
24914 <!--c2--><span id="b">b</span>
24915 !! end
24916
24917 ## T89383
24918 !! test
24919 Selser: Check for validity of DSR before using it
24920 !! options
24921 parsoid={
24922 "modes": ["selser"],
24923 "changes": [
24924 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
24925 ]
24926 }
24927 !! wikitext
24928 <span id="a">a</span>
24929 !! wikitext/edited
24930 {{DISPLAYTITLE:foo}}
24931 <span id="a">a</span>
24932 !! end
24933
24934 !! test
24935 1. DOMDiff: Changes to <ref> content should be looked up using id
24936 !! options
24937 parsoid={
24938 "modes": ["selser"],
24939 "changes": [
24940 ["#X", "after", "bar"],
24941 ["#Y", "after", "baz"]
24942 ]
24943 }
24944 !! wikitext
24945 X <ref><span id="X">foo</span></ref>
24946 Y <ref name="a" />
24947 <references>
24948 <ref name="a"><span id="Y">foo</span></ref>
24949 </references>
24950 !! wikitext/edited
24951 X <ref><span id="X">foo</span>bar</ref>
24952 Y <ref name="a" />
24953 <references>
24954 <ref name="a"><span id="Y">foo</span>baz</ref>
24955 </references>
24956 !! end
24957
24958 !! test
24959 2. DOMDiff: Changes to <ref> content should be looked up using id
24960 !! options
24961 parsoid={
24962 "modes": ["selser"],
24963 "changes": [
24964 ["#Z", "after", "bar"]
24965 ]
24966 }
24967 !! wikitext
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></ref>
24975 </references>
24976 !! wikitext/edited
24977 A <ref>foo bar for a</ref>
24978 B <ref group="X" name="b" />
24979
24980 <references />
24981
24982 <references group="X">
24983 <ref name="b"><span id="Z">foo</span>bar</ref>
24984 </references>
24985 !! end