Merge "Empty attribute syntax"
[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="" />
8277 <br title="" />
8278 <br />
8279 <br title="bar" />
8280 <br title="bar" />
8281 <br title="bar/" />
8282 </p>
8283 !! html/parsoid
8284 <p><br title="" />
8285 <br title="" />
8286 <br title="" />
8287 <br title="bar" />
8288 <br title="bar" />
8289 <br title="bar/" />
8290 </p>
8291 !! end
8292
8293 !! test
8294 Horizontal ruler (should it add that extra space?)
8295 !! wikitext
8296 <hr>
8297 <hr >
8298 foo <hr
8299 > bar
8300 !! html+tidy
8301 <hr />
8302 <hr />
8303 <p>foo</p>
8304 <hr />
8305 <p>bar</p>
8306 !! end
8307
8308 !! test
8309 Horizontal ruler -- 4+ dashes render hr
8310 !! wikitext
8311 ----
8312 !! html
8313 <hr />
8314
8315 !! end
8316
8317 !! test
8318 Horizontal ruler -- eats additional dashes on the same line
8319 !! wikitext
8320 ---------
8321 !! html
8322 <hr />
8323
8324 !! end
8325
8326 !! test
8327 Horizontal ruler -- does not collapse dashes on consecutive lines
8328 !! wikitext
8329 ----
8330 ----
8331 !! html
8332 <hr />
8333 <hr />
8334
8335 !! end
8336
8337 !! test
8338 Horizontal ruler -- <4 dashes render as plain text
8339 !! wikitext
8340 ---
8341 !! html
8342 <p>---
8343 </p>
8344 !! end
8345
8346 !! test
8347 Horizontal ruler -- Supports content following dashes on same line
8348 !! wikitext
8349 ---- Foo
8350 !! html
8351 <hr /> Foo
8352
8353 !! html+tidy
8354 <hr />
8355 <p>Foo</p>
8356 !! end
8357
8358 ###
8359 ### Block-level elements
8360 ###
8361 !! test
8362 Common list
8363 !! wikitext
8364 *Common list
8365 * item 2
8366 *item 3
8367 !! html
8368 <ul><li>Common list</li>
8369 <li> item 2</li>
8370 <li>item 3</li></ul>
8371
8372 !! end
8373
8374 !! test
8375 Numbered list
8376 !! wikitext
8377 #Numbered list
8378 #item 2
8379 # item 3
8380 !! html
8381 <ol><li>Numbered list</li>
8382 <li>item 2</li>
8383 <li> item 3</li></ol>
8384
8385 !! end
8386
8387 !! test
8388 Mixed list
8389 !! wikitext
8390 *Mixed list
8391 *# with numbers
8392 ** and bullets
8393 *# and numbers
8394 *bullets again
8395 **bullet level 2
8396 ***bullet level 3
8397 ***#Number on level 4
8398 **bullet level 2
8399 **#Number on level 3
8400 **#Number on level 3
8401 *#number level 2
8402 *Level 1
8403 *** Level 3
8404 #** Level 3, but ordered
8405 !! html
8406 <ul><li>Mixed list
8407 <ol><li> with numbers</li></ol>
8408 <ul><li> and bullets</li></ul>
8409 <ol><li> and numbers</li></ol></li>
8410 <li>bullets again
8411 <ul><li>bullet level 2
8412 <ul><li>bullet level 3
8413 <ol><li>Number on level 4</li></ol></li></ul></li>
8414 <li>bullet level 2
8415 <ol><li>Number on level 3</li>
8416 <li>Number on level 3</li></ol></li></ul>
8417 <ol><li>number level 2</li></ol></li>
8418 <li>Level 1
8419 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8420 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8421
8422 !! end
8423
8424 !! test
8425 Nested lists 1
8426 !! wikitext
8427 *foo
8428 **bar
8429 !! html
8430 <ul><li>foo
8431 <ul><li>bar</li></ul></li></ul>
8432
8433 !! end
8434
8435 !! test
8436 Nested lists 2
8437 !! wikitext
8438 **foo
8439 *bar
8440 !! html
8441 <ul><li><ul><li>foo</li></ul></li>
8442 <li>bar</li></ul>
8443
8444 !! end
8445
8446 !! test
8447 Nested lists 3 (first element empty)
8448 !! wikitext
8449 *
8450 **bar
8451 !! html
8452 <ul><li>
8453 <ul><li>bar</li></ul></li></ul>
8454
8455 !! end
8456
8457 !! test
8458 Nested lists 4 (first element empty)
8459 !! wikitext
8460 **
8461 *bar
8462 !! html
8463 <ul><li><ul><li></li></ul></li>
8464 <li>bar</li></ul>
8465
8466 !! end
8467
8468 !! test
8469 Nested lists 5 (both elements empty)
8470 !! wikitext
8471 **
8472 *
8473 !! html
8474 <ul><li><ul><li></li></ul></li>
8475 <li></li></ul>
8476
8477 !! end
8478
8479 !! test
8480 Nested lists 6 (both elements empty)
8481 !! wikitext
8482 *
8483 **
8484 !! html
8485 <ul><li>
8486 <ul><li></li></ul></li></ul>
8487
8488 !! end
8489
8490 !! test
8491 Nested lists 7 (skip initial nesting levels)
8492 !! wikitext
8493 *** foo
8494 !! html
8495 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8496
8497 !! end
8498
8499 !! test
8500 Nested lists 8 (multiple nesting transitions)
8501 !! wikitext
8502 * foo
8503 *** bar
8504 ** baz
8505 * boo
8506 !! html
8507 <ul><li> foo
8508 <ul><li><ul><li> bar</li></ul></li>
8509 <li> baz</li></ul></li>
8510 <li> boo</li></ul>
8511
8512 !! end
8513
8514 !! test
8515 Nested lists 9 (extension interaction)
8516 !! options
8517 parsoid
8518 !! wikitext
8519 *<references />
8520 !! html/parsoid
8521 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8522 !! end
8523
8524 !! test
8525 1. Lists with start-of-line-transparent tokens before bullets: Comments
8526 !! wikitext
8527 *foo
8528 *<!--cmt-->bar
8529 <!--cmt-->*baz
8530 !! html
8531 <ul><li>foo</li>
8532 <li>bar</li>
8533 <li>baz</li></ul>
8534
8535 !! end
8536
8537 !! test
8538 2. Lists with start-of-line-transparent tokens before bullets: Template close
8539 !! wikitext
8540 *foo {{echo|bar
8541 }}*baz
8542 !! html
8543 <ul><li>foo bar</li>
8544 <li>baz</li></ul>
8545
8546 !! end
8547
8548 !! test
8549 List items are not parsed correctly following a <pre> block (bug 785)
8550 !! wikitext
8551 * <pre>foo</pre>
8552 * <pre>bar</pre>
8553 * zar
8554 !! html/php
8555 <ul><li> <pre>foo</pre></li>
8556 <li> <pre>bar</pre></li>
8557 <li> zar</li></ul>
8558
8559 !! html/parsoid
8560 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8561 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8562 <li> zar</li></ul>
8563 !! end
8564
8565 !! test
8566 List items from template
8567 !! wikitext
8568
8569 {{inner list}}
8570 * item 2
8571
8572 * item 0
8573 {{inner list}}
8574 * item 2
8575
8576 * item 0
8577 * notSOL{{inner list}}
8578 * item 2
8579 !! html
8580 <ul><li> item 1</li>
8581 <li> item 2</li></ul>
8582 <ul><li> item 0</li>
8583 <li> item 1</li>
8584 <li> item 2</li></ul>
8585 <ul><li> item 0</li>
8586 <li> notSOL</li>
8587 <li> item 1</li>
8588 <li> item 2</li></ul>
8589
8590 !! end
8591
8592 !! test
8593 List interrupted by empty line or heading
8594 !! wikitext
8595 * foo
8596
8597 ** bar
8598 == A heading ==
8599 * Another list item
8600 !! html
8601 <ul><li> foo</li></ul>
8602 <ul><li><ul><li> bar</li></ul></li></ul>
8603 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8604 <ul><li> Another list item</li></ul>
8605
8606 !!end
8607
8608 !!test
8609 Multiple list tags generated by templates
8610 !! wikitext
8611 {{echo|<li>}}a
8612 {{echo|<li>}}b
8613 {{echo|<li>}}c
8614 !! html
8615 <li>a
8616 <li>b
8617 <li>c</li>
8618 </li>
8619 </li>
8620
8621 !! html+tidy
8622 <ul>
8623 <li>a</li>
8624 <li>b</li>
8625 <li>c</li>
8626 </ul>
8627 !!end
8628
8629 !!test
8630 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8631 !! wikitext
8632 *a
8633 <!--This line will NOT split the list-->
8634 *b
8635 <!--This line will NOT split the list either-->
8636 *c
8637 <!--foo--> <!----> <!--This line NOT split the list either-->
8638 *d
8639 !! html
8640 <ul><li>a</li>
8641 <li>b</li>
8642 <li>c</li>
8643 <li>d</li></ul>
8644
8645 !!end
8646
8647 !!test
8648 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8649 !! wikitext
8650 *a
8651 <!--This line will NOT split the list-->
8652 *b
8653 <!--This line will NOT split the list either-->
8654 *c
8655 <!--foo--> <!----> <!--This line NOT split the list
8656 either-->
8657 *d
8658 !! html
8659 <ul><li>a</li>
8660 <li>b</li>
8661 <li>c</li>
8662 <li>d</li></ul>
8663
8664 !!end
8665
8666 !!test
8667 Test the li-hack
8668 (The PHP parser relies on Tidy for the hack)
8669 !!options
8670 parsoid=wt2html,wt2wt
8671 !! wikitext
8672 * foo
8673 * <li>li-hack
8674 * {{echo|<li>templated li-hack}}
8675 * <!--foo--> <li> unsupported li-hack with preceding comments
8676
8677 <ul>
8678 <li><li>not a li-hack
8679 </li>
8680 </ul>
8681 !! html+tidy
8682 <ul>
8683 <li>foo</li>
8684 <li>li-hack</li>
8685 <li>templated li-hack</li>
8686 <li>unsupported li-hack with preceding comments</li>
8687 </ul>
8688 <ul>
8689 <li>not a li-hack</li>
8690 </ul>
8691 !!end
8692
8693 !! test
8694 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8695 !! options
8696 parsoid
8697 !! wikitext
8698 # foo
8699 ## bar
8700 * foo
8701 ** bar
8702 : foo
8703 :: bar
8704 !! html
8705 <ol>
8706 <li> foo<ol>
8707 <li> bar</li>
8708 </ol></li>
8709 </ol><ul>
8710 <li> foo<ul>
8711 <li> bar</li>
8712 </ul></li>
8713 </ul><dl>
8714 <dd> foo<dl>
8715 <dd> bar</dd>
8716 </dl></dd>
8717 </dl>
8718 !! end
8719
8720 !! test
8721 Parsoid: Test of whitespace serialization with Templated bullets
8722 !! options
8723 parsoid
8724 !! wikitext
8725 * {{bullet}}
8726 !! html
8727 <ul>
8728 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8729 </ul>
8730 !! end
8731
8732 # ------------------------------------------------------------------------
8733 # The next set of tests are about Parsoid's ability to handle badly nested
8734 # tags (parse, minimize scope of fixup, and roundtrip back)
8735 # ------------------------------------------------------------------------
8736
8737 !! test
8738 Unbalanced closing block tags break a list
8739 (php parser relies on Tidy to fix up)
8740 !! wikitext
8741 <div>
8742 *a</div><div>
8743 *b</div>
8744 !! html+tidy
8745 <div>
8746 <ul>
8747 <li>a</li>
8748 </ul>
8749 </div>
8750 <div>
8751 <ul>
8752 <li>b</li>
8753 </ul>
8754 </div>
8755 !! end
8756
8757 # Parsoid fails this test, but it might be tricky to support properly.
8758 # See bug 68395.
8759 !! test
8760 Unbalanced closing non-block tags don't break a list
8761 (php parser relies on Tidy to fix up)
8762 !! wikitext
8763 <span>
8764 *a</span><span>
8765 *b</span>
8766 !! html/php+tidy
8767 <ul>
8768 <li><span>a</span></li>
8769 <li><span>b</span></li>
8770 </ul>
8771 !! html/parsoid
8772 <span>
8773 <ul>
8774 <li>a<span></span>
8775 </li>
8776 <li>b
8777 </li>
8778 </ul>
8779 </span>
8780 !! end
8781
8782 !! test
8783 Unclosed formatting tags that straddle lists are closed and reopened
8784 (php parser relies on Tidy to fix up)
8785 !! options
8786 parsoid=wt2html,wt2wt,html2html
8787 !! wikitext
8788 # <s> a
8789 # b </s>
8790 !! html/php+tidy
8791 <ol>
8792 <li><s>a</s></li>
8793 <li><s>b</s></li>
8794 </ol>
8795 !! html/parsoid
8796 <ol><li> <s> a</s></li>
8797 <li><s> b </s></li></ol>
8798 !! end
8799
8800 # See bug 68395.
8801 !!test
8802 1. List embedded in a formatting tag
8803 !! wikitext
8804 <small>
8805 * foo
8806 </small>
8807 !! html/php+tidy
8808 <ul>
8809 <li><small>foo</small></li>
8810 </ul>
8811 !! html/parsoid
8812 <small>
8813 <ul>
8814 <li> foo</li>
8815 </ul>
8816 </small>
8817 !!end
8818
8819 ## Ugly Parsoid output here
8820 ## Not sure what the right output is.
8821 !!test
8822 2. List embedded in a formatting tag
8823 !! wikitext
8824 <small>
8825 *a
8826 *b</small>
8827 !! html/php+tidy
8828 <ul>
8829 <li><small>a</small></li>
8830 <li><small>b</small></li>
8831 </ul>
8832 !! html/parsoid
8833 <small></small>
8834 <ul><small>
8835 <li>a</li>
8836 </small>
8837 <li><small>b</small></li>
8838 </ul>
8839 !!end
8840
8841 # Ugly Parsoid and PHP parser output here
8842 # Not sure if we want to make this a test!
8843 #
8844 ## !!test
8845 ## 3. Unclosed formatting tags in list elements
8846 ## !! wikitext
8847 ## *<small>a
8848 ## *<small>b
8849 ## !! html/php+tidy
8850 ## <ul>
8851 ## <li><small>a</small></li>
8852 ## <li><small><small>b</small></small></li>
8853 ## </ul>
8854 ## !! html/parsoid
8855 ## <ul>
8856 ## <li><small>a</small></li>
8857 ## <small>
8858 ## <li><small>b</small></li>
8859 ## </small></ul>
8860 ## !!end
8861
8862 # This is a bug in the PHP parser + tidy combination.
8863 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8864 # and then fostered out of the table by tidy.)
8865 # We believe the Parsoid output to be correct.
8866 !! test
8867 Table with missing opening <tr> tag
8868 !! options
8869 parsoid=wt2html,wt2wt
8870 !! wikitext
8871 <table>
8872 <td>foo</td>
8873 </tr>
8874 </table>
8875 !! html+tidy
8876 <table>
8877 <tr>
8878 <td>foo</td>
8879 </tr>
8880 </table>
8881 !! end
8882
8883 ###
8884 ### Magic Words
8885 ###
8886
8887 # Note that the current date is hard-coded as
8888 # 1970-01-01T00:02:03Z (a Thursday)
8889 # when running parser tests. The timezone is also fixed to GMT, so
8890 # local date will be identical to current date.
8891
8892 !! test
8893 Magic Word: {{CURRENTDAY}}
8894 !! wikitext
8895 {{CURRENTDAY}}
8896 !! html
8897 <p>1
8898 </p>
8899 !! end
8900
8901 !! test
8902 Magic Word: {{CURRENTDAY2}}
8903 !! wikitext
8904 {{CURRENTDAY2}}
8905 !! html
8906 <p>01
8907 </p>
8908 !! end
8909
8910 !! test
8911 Magic Word: {{CURRENTDAYNAME}}
8912 !! wikitext
8913 {{CURRENTDAYNAME}}
8914 !! html
8915 <p>Thursday
8916 </p>
8917 !! end
8918
8919 !! test
8920 Magic Word: {{CURRENTDOW}}
8921 !! wikitext
8922 {{CURRENTDOW}}
8923 !! html
8924 <p>4
8925 </p>
8926 !! end
8927
8928 !! test
8929 Magic Word: {{CURRENTMONTH}}
8930 !! wikitext
8931 {{CURRENTMONTH}}
8932 !! html
8933 <p>01
8934 </p>
8935 !! end
8936
8937 !! test
8938 Magic Word: {{CURRENTMONTH1}}
8939 !! wikitext
8940 {{CURRENTMONTH1}}
8941 !! html
8942 <p>1
8943 </p>
8944 !! end
8945
8946 !! test
8947 Magic Word: {{CURRENTMONTHABBREV}}
8948 !! wikitext
8949 {{CURRENTMONTHABBREV}}
8950 !! html
8951 <p>Jan
8952 </p>
8953 !! end
8954
8955 !! test
8956 Magic Word: {{CURRENTMONTHNAME}}
8957 !! wikitext
8958 {{CURRENTMONTHNAME}}
8959 !! html
8960 <p>January
8961 </p>
8962 !! end
8963
8964 !! test
8965 Magic Word: {{CURRENTMONTHNAMEGEN}}
8966 !! wikitext
8967 {{CURRENTMONTHNAMEGEN}}
8968 !! html
8969 <p>January
8970 </p>
8971 !! end
8972
8973 !! test
8974 Magic Word: {{CURRENTTIME}}
8975 !! wikitext
8976 {{CURRENTTIME}}
8977 !! html
8978 <p>00:02
8979 </p>
8980 !! end
8981
8982 !! test
8983 Magic Word: {{CURRENTHOUR}}
8984 !! wikitext
8985 {{CURRENTHOUR}}
8986 !! html
8987 <p>00
8988 </p>
8989 !! end
8990
8991 !! test
8992 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8993 !! wikitext
8994 {{CURRENTWEEK}}
8995 !! html
8996 <p>1
8997 </p>
8998 !! end
8999
9000 !! test
9001 Magic Word: {{CURRENTYEAR}}
9002 !! wikitext
9003 {{CURRENTYEAR}}
9004 !! html
9005 <p>1970
9006 </p>
9007 !! end
9008
9009 !! test
9010 Magic Word: {{CURRENTTIMESTAMP}}
9011 !! wikitext
9012 {{CURRENTTIMESTAMP}}
9013 !! html
9014 <p>19700101000203
9015 </p>
9016 !! end
9017
9018 !! test
9019 Magic Words LOCAL (UTC)
9020 !! wikitext
9021 * {{LOCALMONTH}}
9022 * {{LOCALMONTH1}}
9023 * {{LOCALMONTHNAME}}
9024 * {{LOCALMONTHNAMEGEN}}
9025 * {{LOCALMONTHABBREV}}
9026 * {{LOCALDAY}}
9027 * {{LOCALDAY2}}
9028 * {{LOCALDAYNAME}}
9029 * {{LOCALYEAR}}
9030 * {{LOCALTIME}}
9031 * {{LOCALHOUR}}
9032 * {{LOCALWEEK}}
9033 * {{LOCALDOW}}
9034 * {{LOCALTIMESTAMP}}
9035 !! html
9036 <ul><li> 01</li>
9037 <li> 1</li>
9038 <li> January</li>
9039 <li> January</li>
9040 <li> Jan</li>
9041 <li> 1</li>
9042 <li> 01</li>
9043 <li> Thursday</li>
9044 <li> 1970</li>
9045 <li> 00:02</li>
9046 <li> 00</li>
9047 <li> 1</li>
9048 <li> 4</li>
9049 <li> 19700101000203</li></ul>
9050
9051 !! end
9052
9053 !! test
9054 Magic Word: {{FULLPAGENAME}}
9055 !! options
9056 title=[[User:Ævar Arnfjörð Bjarmason]]
9057 !! wikitext
9058 {{FULLPAGENAME}}
9059 !! html
9060 <p>User:Ævar Arnfjörð Bjarmason
9061 </p>
9062 !! end
9063
9064 !! test
9065 Magic Word: {{FULLPAGENAMEE}}
9066 !! options
9067 title=[[User:Ævar Arnfjörð Bjarmason]]
9068 !! wikitext
9069 {{FULLPAGENAMEE}}
9070 !! html
9071 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9072 </p>
9073 !! end
9074
9075 !! test
9076 Magic Word: {{TALKSPACE}}
9077 !! options
9078 title=[[User:Ævar Arnfjörð Bjarmason]]
9079 !! wikitext
9080 {{TALKSPACE}}
9081 !! html
9082 <p>User talk
9083 </p>
9084 !! end
9085
9086 !! test
9087 Magic Word: {{TALKSPACE}}, same namespace
9088 !! options
9089 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9090 !! wikitext
9091 {{TALKSPACE}}
9092 !! html
9093 <p>User talk
9094 </p>
9095 !! end
9096
9097 !! test
9098 Magic Word: {{TALKSPACE}}, main namespace
9099 !! options
9100 title=[[Parser Test]]
9101 !! wikitext
9102 {{TALKSPACE}}
9103 !! html
9104 <p>Talk
9105 </p>
9106 !! end
9107
9108 !! test
9109 Magic Word: {{TALKSPACEE}}
9110 !! options
9111 title=[[User:Ævar Arnfjörð Bjarmason]]
9112 !! wikitext
9113 {{TALKSPACEE}}
9114 !! html
9115 <p>User_talk
9116 </p>
9117 !! end
9118
9119 !! test
9120 Magic Word: {{SUBJECTSPACE}}
9121 !! options
9122 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9123 !! wikitext
9124 {{SUBJECTSPACE}}
9125 !! html
9126 <p>User
9127 </p>
9128 !! end
9129
9130 !! test
9131 Magic Word: {{SUBJECTSPACE}}, same namespace
9132 !! options
9133 title=[[User:Ævar Arnfjörð Bjarmason]]
9134 !! wikitext
9135 {{SUBJECTSPACE}}
9136 !! html
9137 <p>User
9138 </p>
9139 !! end
9140
9141 !! test
9142 Magic Word: {{SUBJECTSPACE}}, main namespace
9143 !! options
9144 title=[[Parser Test]]
9145 !! wikitext
9146 {{SUBJECTSPACE}}
9147 !! html
9148
9149 !! end
9150
9151 !! test
9152 Magic Word: {{SUBJECTSPACEE}}
9153 !! options
9154 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9155 !! wikitext
9156 {{SUBJECTSPACEE}}
9157 !! html
9158 <p>User
9159 </p>
9160 !! end
9161
9162 !! test
9163 Magic Word: {{NAMESPACE}}
9164 !! options
9165 title=[[User:Ævar Arnfjörð Bjarmason]]
9166 !! wikitext
9167 {{NAMESPACE}}
9168 !! html
9169 <p>User
9170 </p>
9171 !! end
9172
9173 !! test
9174 Magic Word: {{NAMESPACEE}}
9175 !! options
9176 title=[[User:Ævar Arnfjörð Bjarmason]]
9177 !! wikitext
9178 {{NAMESPACEE}}
9179 !! html
9180 <p>User
9181 </p>
9182 !! end
9183
9184 !! test
9185 Magic Word: {{NAMESPACENUMBER}}
9186 !! options
9187 title=[[User:Ævar Arnfjörð Bjarmason]]
9188 !! wikitext
9189 {{NAMESPACENUMBER}}
9190 !! html
9191 <p>2
9192 </p>
9193 !! end
9194
9195 !! test
9196 Magic Word: {{SUBPAGENAME}}
9197 !! options
9198 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9199 !! wikitext
9200 {{SUBPAGENAME}}
9201 !! html
9202 <p>sub ö
9203 </p>
9204 !! end
9205
9206 !! test
9207 Magic Word: {{SUBPAGENAMEE}}
9208 !! options
9209 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9210 !! wikitext
9211 {{SUBPAGENAMEE}}
9212 !! html
9213 <p>sub_%C3%B6
9214 </p>
9215 !! end
9216
9217 !! test
9218 Magic Word: {{ROOTPAGENAME}}
9219 !! options
9220 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9221 !! wikitext
9222 {{ROOTPAGENAME}}
9223 !! html
9224 <p>Ævar Arnfjörð Bjarmason
9225 </p>
9226 !! end
9227
9228 !! test
9229 Magic Word: {{ROOTPAGENAMEE}}
9230 !! options
9231 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9232 !! wikitext
9233 {{ROOTPAGENAMEE}}
9234 !! html
9235 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9236 </p>
9237 !! end
9238
9239 !! test
9240 Magic Word: {{BASEPAGENAME}}
9241 !! options
9242 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9243 !! wikitext
9244 {{BASEPAGENAME}}
9245 !! html
9246 <p>Ævar Arnfjörð Bjarmason
9247 </p>
9248 !! end
9249
9250 !! test
9251 Magic Word: {{BASEPAGENAMEE}}
9252 !! options
9253 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9254 !! wikitext
9255 {{BASEPAGENAMEE}}
9256 !! html
9257 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9258 </p>
9259 !! end
9260
9261 !! test
9262 Magic Word: {{TALKPAGENAME}}
9263 !! options
9264 title=[[User:Ævar Arnfjörð Bjarmason]]
9265 !! wikitext
9266 {{TALKPAGENAME}}
9267 !! html
9268 <p>User talk:Ævar Arnfjörð Bjarmason
9269 </p>
9270 !! end
9271
9272 !! test
9273 Magic Word: {{TALKPAGENAMEE}}
9274 !! options
9275 title=[[User:Ævar Arnfjörð Bjarmason]]
9276 !! wikitext
9277 {{TALKPAGENAMEE}}
9278 !! html
9279 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9280 </p>
9281 !! end
9282
9283 !! test
9284 Magic Word: {{SUBJECTPAGENAME}}
9285 !! options
9286 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9287 !! wikitext
9288 {{SUBJECTPAGENAME}}
9289 !! html
9290 <p>User:Ævar Arnfjörð Bjarmason
9291 </p>
9292 !! end
9293
9294 !! test
9295 Magic Word: {{SUBJECTPAGENAMEE}}
9296 !! options
9297 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9298 !! wikitext
9299 {{SUBJECTPAGENAMEE}}
9300 !! html
9301 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9302 </p>
9303 !! end
9304
9305 !! test
9306 Magic Word: {{NUMBEROFFILES}}
9307 !! wikitext
9308 {{NUMBEROFFILES}}
9309 !! html
9310 <p>5
9311 </p>
9312 !! end
9313
9314 !! test
9315 Magic Word: {{PAGENAME}}
9316 !! options
9317 title=[[User:Ævar Arnfjörð Bjarmason]]
9318 !! wikitext
9319 {{PAGENAME}}
9320 !! html
9321 <p>Ævar Arnfjörð Bjarmason
9322 </p>
9323 !! end
9324
9325 !! test
9326 Magic Word: {{PAGENAME}} with metacharacters
9327 !! options
9328 title=[['foo & bar = baz']]
9329 !! wikitext
9330 ''{{PAGENAME}}''
9331 !! html/php
9332 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9333 </p>
9334 !! html+tidy
9335 <p><i>'foo &amp; bar = baz'</i></p>
9336 !! end
9337
9338 !! test
9339 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9340 !! options
9341 title=[[*RFC 1234 http://example.com/]]
9342 !! wikitext
9343 {{PAGENAME}}
9344 !! html/php
9345 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9346 </p>
9347 !! html+tidy
9348 <p>*RFC 1234 http://example.com/</p>
9349 !! end
9350
9351 !! test
9352 Magic Word: {{PAGENAMEE}}
9353 !! options
9354 title=[[User:Ævar Arnfjörð Bjarmason]]
9355 !! wikitext
9356 {{PAGENAMEE}}
9357 !! html
9358 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9359 </p>
9360 !! end
9361
9362 !! test
9363 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9364 !! options
9365 title=[[*RFC 1234 http://example.com/]]
9366 !! wikitext
9367 {{PAGENAMEE}}
9368 !! html/php
9369 <p>&#42;RFC_1234_http&#58;//example.com/
9370 </p>
9371 !! html+tidy
9372 <p>*RFC_1234_http://example.com/</p>
9373 !! end
9374
9375 !! test
9376 Magic Word: {{REVISIONID}}
9377 !! wikitext
9378 {{REVISIONID}}
9379 !! html
9380 <p>1337
9381 </p>
9382 !! end
9383
9384 !! test
9385 Magic Word: {{SCRIPTPATH}}
9386 !! wikitext
9387 {{SCRIPTPATH}}
9388 !! html
9389 <p>/
9390 </p>
9391 !! end
9392
9393 !! test
9394 Magic Word: {{STYLEPATH}}
9395 !! wikitext
9396 {{STYLEPATH}}
9397 !! html
9398 <p>/skins
9399 </p>
9400 !! end
9401
9402 !! test
9403 Magic Word: {{SERVER}}
9404 !! wikitext
9405 {{SERVER}}
9406 !! html
9407 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9408 </p>
9409 !! end
9410
9411 !! test
9412 Magic Word: {{SERVERNAME}}
9413 !! wikitext
9414 {{SERVERNAME}}
9415 !! html
9416 <p>example.org
9417 </p>
9418 !! end
9419
9420 !! test
9421 Magic Word: {{SITENAME}}
9422 !! wikitext
9423 {{SITENAME}}
9424 !! html
9425 <p>MediaWiki
9426 </p>
9427 !! end
9428
9429 !! test
9430 Case-sensitive magic words, when cased differently, should just be template transclusions
9431 !! wikitext
9432 {{CurrentMonth}}
9433 {{currentday}}
9434 {{cURreNTweEK}}
9435 {{currentHour}}
9436 !! html
9437 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
9438 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
9439 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
9440 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
9441 </p>
9442 !! end
9443
9444 !! test
9445 Case-insensitive magic words should still work with weird casing.
9446 !! wikitext
9447 {{sErVeRNaMe}}
9448 {{LCFirst:AOEU}}
9449 {{ucFIRST:aoeu}}
9450 {{SERver}}
9451 !! html
9452 <p>example.org
9453 aOEU
9454 Aoeu
9455 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9456 </p>
9457 !! end
9458
9459 # From plwiki:PLOS_ONE
9460 !! test
9461 Parsoid: Page property magic word with magic word contents
9462 !! wikitext
9463 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9464 !! html/parsoid
9465 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9466 !! end
9467
9468 !! test
9469 Parsoid: Template-generated DISPLAYTITLE
9470 !! wikitext
9471 {{{{echo|DISPLAYTITLE}}:Foo}}
9472 !! html/parsoid
9473 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9474 !! end
9475
9476 !! test
9477 Namespace 1 {{ns:1}}
9478 !! wikitext
9479 {{ns:1}}
9480 !! html
9481 <p>Talk
9482 </p>
9483 !! end
9484
9485 !! test
9486 Namespace 1 {{ns:01}}
9487 !! wikitext
9488 {{ns:01}}
9489 !! html
9490 <p>Talk
9491 </p>
9492 !! end
9493
9494 !! test
9495 Namespace 0 {{ns:0}} (bug 4783)
9496 !! wikitext
9497 {{ns:0}}
9498 !! html
9499
9500 !! end
9501
9502 !! test
9503 Namespace 0 {{ns:00}} (bug 4783)
9504 !! wikitext
9505 {{ns:00}}
9506 !! html
9507
9508 !! end
9509
9510 !! test
9511 Namespace -1 {{ns:-1}}
9512 !! wikitext
9513 {{ns:-1}}
9514 !! html
9515 <p>Special
9516 </p>
9517 !! end
9518
9519 !! test
9520 Namespace User {{ns:User}}
9521 !! wikitext
9522 {{ns:User}}
9523 !! html
9524 <p>User
9525 </p>
9526 !! end
9527
9528 !! test
9529 Namespace User talk {{ns:User_talk}}
9530 !! wikitext
9531 {{ns:User_talk}}
9532 !! html
9533 <p>User talk
9534 </p>
9535 !! end
9536
9537 !! test
9538 Namespace User talk {{ns:uSeR tAlK}}
9539 !! wikitext
9540 {{ns:uSeR tAlK}}
9541 !! html
9542 <p>User talk
9543 </p>
9544 !! end
9545
9546 !! test
9547 Namespace File {{ns:File}}
9548 !! wikitext
9549 {{ns:File}}
9550 !! html
9551 <p>File
9552 </p>
9553 !! end
9554
9555 !! test
9556 Namespace File {{ns:Image}}
9557 !! wikitext
9558 {{ns:Image}}
9559 !! html
9560 <p>File
9561 </p>
9562 !! end
9563
9564 !! test
9565 Namespace (lang=de) Benutzer {{ns:User}}
9566 !! options
9567 language=de
9568 !! wikitext
9569 {{ns:User}}
9570 !! html
9571 <p>Benutzer
9572 </p>
9573 !! end
9574
9575 !! test
9576 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9577 !! options
9578 language=de
9579 !! wikitext
9580 {{ns:3}}
9581 !! html
9582 <p>Benutzer Diskussion
9583 </p>
9584 !! end
9585
9586
9587 !! test
9588 Urlencode
9589 !! wikitext
9590 {{urlencode:hi world?!}}
9591 {{urlencode:hi world?!|WIKI}}
9592 {{urlencode:hi world?!|PATH}}
9593 {{urlencode:hi world?!|QUERY}}
9594 !! html
9595 <p>hi+world%3F%21
9596 hi_world%3F!
9597 hi%20world%3F%21
9598 hi+world%3F%21
9599 </p>
9600 !! end
9601
9602 !! test
9603 Magic Word: prioritize type info over data-parsoid
9604 !! options
9605 parsoid=html2wt
9606 !! html/parsoid
9607 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9608 !! wikitext
9609 __FORCETOC__
9610 !! end
9611
9612 !! test
9613 Magic Word: serialize on separate line (parsoid)
9614 !! options
9615 parsoid=wt2wt,html2wt
9616 !! wikitext
9617 foo
9618 __NOTOC__
9619 bar
9620 !! html
9621 foo<meta property="mw:PageProp/notoc"/>bar
9622 !! end
9623
9624 !! test
9625 Magic Word: rt non-english wikis
9626 !! options
9627 parsoid=wt2wt
9628 language=de
9629 !! wikitext
9630 __NOEDITSECTION__
9631 !! html
9632 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9633 !! end
9634
9635 ###
9636 ### Magic links
9637 ###
9638 !! test
9639 Magic links: internal link to RFC (bug 479)
9640 !! wikitext
9641 [[RFC 123]]
9642 !! html
9643 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
9644 </p>
9645 !! end
9646
9647 !! test
9648 Magic links: RFC (bug 479)
9649 !! wikitext
9650 RFC 822
9651 !! html
9652 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9653 </p>
9654 !! end
9655
9656 !! test
9657 Magic links: RFC (bug 65278)
9658 !! wikitext
9659 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9660 !! html
9661 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
9662 </p>
9663 !! end
9664
9665 !! test
9666 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9667 !! wikitext
9668 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9669 RFC
9670 822
9671 !! html
9672 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9673 RFC
9674 822
9675 </p>
9676 !! end
9677
9678 !! test
9679 Magic links: ISBN (bug 1937)
9680 !! wikitext
9681 ISBN 0-306-40615-2
9682 !! html
9683 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9684 </p>
9685 !! end
9686
9687 !! test
9688 Magic links: ISBN (bug 65278)
9689 !! wikitext
9690 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9691 !! html/php
9692 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9693 </p>
9694 !! html/parsoid
9695 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9696 !! end
9697
9698 !! test
9699 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9700 !! wikitext
9701 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9702 ISBN
9703 9780316098113
9704 ISBN 978
9705 0316098113
9706 !! html
9707 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9708 ISBN
9709 9780316098113
9710 ISBN 978
9711 0316098113
9712 </p>
9713 !! end
9714
9715 !! test
9716 Magic links: PMID incorrectly converts space to underscore
9717 !! wikitext
9718 PMID 1234
9719 !! html
9720 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9721 </p>
9722 !! end
9723
9724 !! test
9725 Magic links: PMID (bug 65278)
9726 !! wikitext
9727 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9728 !! html
9729 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
9730 </p>
9731 !! end
9732
9733 !! test
9734 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9735 !! wikitext
9736 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9737 PMID
9738 1234
9739 !! html
9740 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9741 PMID
9742 1234
9743 </p>
9744 !! end
9745
9746 ###
9747 ### Templates
9748 ####
9749
9750 !! test
9751 Nonexistent template
9752 !! wikitext
9753 {{thistemplatedoesnotexist}}
9754 !! html
9755 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
9756 </p>
9757 !! end
9758
9759 !! test
9760 Template with invalid target containing tags
9761 !! wikitext
9762 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9763 !! html
9764 <p>{{a<b>b</b>|foo|a=b|a = b}}
9765 </p>
9766 !! end
9767
9768 !! test
9769 Template with invalid target containing unclosed tag
9770 !! wikitext
9771 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9772 !! html
9773 <p>{{a<b>|foo|a=b|a = b}}</b>
9774 </p>
9775 !! end
9776
9777 !! test
9778 Template with invalid target containing wikilink
9779 !! wikitext
9780 {{[[Main Page]]}}
9781 !! html/php
9782 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9783 </p>
9784 !! html/parsoid
9785 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
9786 !! end
9787
9788 !! test
9789 Template with just whitespace in it, bug #68421
9790 !! wikitext
9791 {{echo|{{ }}}}
9792 !! html/parsoid
9793 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
9794 !! end
9795
9796 !! article
9797 Template:test
9798 !! text
9799 This is a test template
9800 !! endarticle
9801
9802 !! test
9803 Simple template
9804 !! wikitext
9805 {{test}}
9806 !! html
9807 <p>This is a test template
9808 </p>
9809 !! end
9810
9811 !! test
9812 Template with explicit namespace
9813 !! wikitext
9814 {{Template:test}}
9815 !! html
9816 <p>This is a test template
9817 </p>
9818 !! end
9819
9820
9821 !! article
9822 Template:paramtest
9823 !! text
9824 This is a test template with parameter {{{param}}}
9825 !! endarticle
9826
9827 !! test
9828 Template parameter
9829 !! wikitext
9830 {{paramtest|param=foo}}
9831 !! html
9832 <p>This is a test template with parameter foo
9833 </p>
9834 !! end
9835
9836 !! article
9837 Template:paramtestnum
9838 !! text
9839 [[{{{1}}}|{{{2}}}]]
9840 !! endarticle
9841
9842 !! test
9843 Template unnamed parameter
9844 !! wikitext
9845 {{paramtestnum|Main Page|the main page}}
9846 !! html
9847 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9848 </p>
9849 !! end
9850
9851 !! article
9852 Template:templatesimple
9853 !! text
9854 (test)
9855 !! endarticle
9856
9857 !! article
9858 Template:templateredirect
9859 !! text
9860 #redirect [[Template:templatesimple]]
9861 !! endarticle
9862
9863 !! article
9864 Template:templateasargtestnum
9865 !! text
9866 {{{{{1}}}}}
9867 !! endarticle
9868
9869 !! article
9870 Template:templateasargtest
9871 !! text
9872 {{template{{{templ}}}}}
9873 !! endarticle
9874
9875 !! article
9876 Template:templateasargtest2
9877 !! text
9878 {{{{{templ}}}}}
9879 !! endarticle
9880
9881 !! test
9882 Template with template name as unnamed argument
9883 !! wikitext
9884 {{templateasargtestnum|templatesimple}}
9885 !! html
9886 <p>(test)
9887 </p>
9888 !! end
9889
9890 !! test
9891 Template with template name as argument
9892 !! wikitext
9893 {{templateasargtest|templ=simple}}
9894 !! html
9895 <p>(test)
9896 </p>
9897 !! end
9898
9899 !! test
9900 Template with template name as argument (2)
9901 !! wikitext
9902 {{templateasargtest2|templ=templatesimple}}
9903 !! html
9904 <p>(test)
9905 </p>
9906 !! end
9907
9908 !! article
9909 Template:templateasargtestdefault
9910 !! text
9911 {{{{{templ|templatesimple}}}}}
9912 !! endarticle
9913
9914 !! article
9915 Template:templa
9916 !! text
9917 '''templ'''
9918 !! endarticle
9919
9920 !! test
9921 Template with default value
9922 !! wikitext
9923 {{templateasargtestdefault}}
9924 !! html
9925 <p>(test)
9926 </p>
9927 !! end
9928
9929 !! test
9930 Template with default value (value set)
9931 !! wikitext
9932 {{templateasargtestdefault|templ=templa}}
9933 !! html
9934 <p><b>templ</b>
9935 </p>
9936 !! end
9937
9938 !! test
9939 Template redirect
9940 !! wikitext
9941 {{templateredirect}}
9942 !! html/php
9943 <p>(test)
9944 </p>
9945 !! html/parsoid
9946 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
9947 !! end
9948
9949 !! test
9950 Template with argument in separate line
9951 !! wikitext
9952 {{ templateasargtest |
9953 templ = simple }}
9954 !! html
9955 <p>(test)
9956 </p>
9957 !! end
9958
9959 !! test
9960 Template with complex template as argument
9961 !! wikitext
9962 {{paramtest|
9963 param ={{ templateasargtest |
9964 templ = simple }}}}
9965 !! html
9966 <p>This is a test template with parameter (test)
9967 </p>
9968 !! end
9969
9970 !! test
9971 Template with thumb image (with link in description)
9972 !! wikitext
9973 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9974 !! html/php
9975 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
9976
9977 !! html+tidy
9978 <p>This is a test template with parameter</p>
9979 <div class="thumb tright">
9980 <div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>
9981 <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div>
9982 </div>
9983 </div>
9984 !! html/parsoid
9985 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
9986 !! end
9987
9988 !! article
9989 Template:complextemplate
9990 !! text
9991 {{{1}}} {{paramtest|
9992 param ={{{param}}}}}
9993 !! endarticle
9994
9995 !! test
9996 Template with complex arguments
9997 !! wikitext
9998 {{complextemplate|
9999 param ={{ templateasargtest |
10000 templ = simple }}|[[Template:complextemplate|link]]}}
10001 !! html
10002 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10003 </p>
10004 !! end
10005
10006 !! test
10007 BUG 553: link with two variables in a piped link
10008 !! wikitext
10009 {|
10010 |[[{{{1}}}|{{{2}}}]]
10011 |}
10012 !! html
10013 <table>
10014 <tr>
10015 <td>[[{{{1}}}|{{{2}}}]]
10016 </td></tr></table>
10017
10018 !! end
10019
10020 !! test
10021 Magic variable as template parameter
10022 !! wikitext
10023 {{paramtest|param={{SITENAME}}}}
10024 !! html
10025 <p>This is a test template with parameter MediaWiki
10026 </p>
10027 !! end
10028
10029 !! article
10030 Template:linktest
10031 !! text
10032 [[{{{param}}}|link]]
10033 !! endarticle
10034
10035 !! test
10036 Template parameter as link source
10037 !! wikitext
10038 {{linktest|param=Main Page}}
10039 !! html
10040 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10041 </p>
10042 !! end
10043
10044 !!article
10045 Template:paramtest2
10046 !! text
10047 including another template, {{paramtest|param={{{arg}}}}}
10048 !! endarticle
10049
10050 !! test
10051 Template passing argument to another template
10052 !! wikitext
10053 {{paramtest2|arg='hmm'}}
10054 !! html
10055 <p>including another template, This is a test template with parameter 'hmm'
10056 </p>
10057 !! end
10058
10059 !! article
10060 Template:Linktest2
10061 !! text
10062 Main Page
10063 !! endarticle
10064
10065 !! test
10066 Template as link source
10067 !! wikitext
10068 [[{{linktest2}}]]
10069
10070 [[{{linktest2}}|Main Page]]
10071
10072 [[{{linktest2}}]]Page
10073 !! html
10074 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10075 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10076 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10077 </p>
10078 !! end
10079
10080
10081 !! article
10082 Template:loop1
10083 !! text
10084 {{loop2}}
10085 !! endarticle
10086
10087 !! article
10088 Template:loop2
10089 !! text
10090 {{loop1}}
10091 !! endarticle
10092
10093 !! test
10094 Template infinite loop
10095 !! wikitext
10096 {{loop1}}
10097 !! html
10098 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10099 </p>
10100 !! end
10101
10102 !! test
10103 Template from main namespace
10104 !! wikitext
10105 {{:Main Page}}
10106 !! html
10107 <p>blah blah
10108 </p>
10109 !! end
10110
10111 !! article
10112 Template:table
10113 !! text
10114 {|
10115 | 1 || 2
10116 |-
10117 | 3 || 4
10118 |}
10119 !! endarticle
10120
10121 !! test
10122 BUG 529: Template with table, not included at beginning of line
10123 !! wikitext
10124 foo {{table}}
10125 !! html
10126 <p>foo
10127 </p>
10128 <table>
10129 <tr>
10130 <td> 1 </td>
10131 <td> 2
10132 </td></tr>
10133 <tr>
10134 <td> 3 </td>
10135 <td> 4
10136 </td></tr></table>
10137
10138 !! end
10139
10140 !! test
10141 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10142 !! wikitext
10143 foo
10144 {{table}}
10145 !! html
10146 <p>foo
10147 </p>
10148 <table>
10149 <tr>
10150 <td> 1 </td>
10151 <td> 2
10152 </td></tr>
10153 <tr>
10154 <td> 3 </td>
10155 <td> 4
10156 </td></tr></table>
10157
10158 !! end
10159
10160 !! test
10161 BUG 41: Template parameters shown as broken links
10162 !! wikitext
10163 {{{parameter}}}
10164 !! html
10165 <p>{{{parameter}}}
10166 </p>
10167 !! end
10168
10169 !! test
10170 Template with targets containing wikilinks
10171 !! wikitext
10172 {{[[foo]]}}
10173
10174 {{[[{{echo|foo}}]]}}
10175
10176 {{{{echo|[[foo}}]]}}
10177 !! html
10178 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10179 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10180 </p><p>{{[[foo}}]]
10181 </p>
10182 !! end
10183
10184 !! article
10185 Template:''
10186 !! text
10187 bar
10188 !! endarticle
10189
10190 !! test
10191 Templates: Double quotes as template target
10192 !! wikitext
10193 foo {{''}} baz
10194 !! html/php
10195 <p>foo bar baz
10196 </p>
10197 !! html/parsoid
10198 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10199 </p>
10200 !! end
10201
10202 !! article
10203 Template:MSGNW test
10204 !! text
10205 ''None'' of '''this''' should be
10206 * interpreted
10207 but rather passed unmodified
10208 {{test}}
10209 <gallery>
10210 File:Foobar.jpg
10211 </gallery>
10212 !! endarticle
10213
10214 # hmm, fix this or just deprecate msgnw and document its behavior?
10215 !! test
10216 msgnw keyword
10217 !! wikitext
10218 {{msgnw:MSGNW test}}
10219 !! html
10220 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10221 &#42; interpreted
10222 &#32;but rather passed unmodified
10223 &#123;&#123;test&#125;&#125;
10224 &#60;gallery&#62;
10225 File:Foobar.jpg
10226 &#60;/gallery&#62;
10227 </p>
10228 !! end
10229
10230 !! test
10231 int keyword
10232 !! wikitext
10233 {{int:youhavenewmessages|lots of money|not!}}
10234 !! html
10235 <p>You have lots of money (not!).
10236 </p>
10237 !! end
10238
10239 !! article
10240 Template:Includes
10241 !! text
10242 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10243 !! endarticle
10244
10245 !! test
10246 <includeonly> and <noinclude> being included
10247 !! wikitext
10248 {{Includes}}
10249 !! html
10250 <p>Foobar
10251 </p>
10252 !! end
10253
10254 !! article
10255 Template:Includes2
10256 !! text
10257 <onlyinclude>Foo</onlyinclude>bar
10258 !! endarticle
10259
10260 !! test
10261 <onlyinclude> being included
10262 !! wikitext
10263 {{Includes2}}
10264 !! html
10265 <p>Foo
10266 </p>
10267 !! end
10268
10269
10270 !! article
10271 Template:Includes3
10272 !! text
10273 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10274 !! endarticle
10275
10276 !! test
10277 <onlyinclude> and <includeonly> being included
10278 !! wikitext
10279 {{Includes3}}
10280 !! html
10281 <p>Foo
10282 </p>
10283 !! end
10284
10285 !! test
10286 <includeonly> and <noinclude> on a page
10287 !! wikitext
10288 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10289 !! html
10290 <p>Foozar
10291 </p>
10292 !! end
10293
10294 !! test
10295 Un-closed <noinclude>
10296 !! wikitext
10297 <noinclude>
10298 !! html
10299 !! end
10300
10301 !! test
10302 <onlyinclude> on a page
10303 !! wikitext
10304 <onlyinclude>Foo</onlyinclude>bar
10305 !! html
10306 <p>Foobar
10307 </p>
10308 !! end
10309
10310 !! test
10311 Un-closed <onlyinclude>
10312 !! wikitext
10313 <onlyinclude>
10314 !! html
10315 !! end
10316
10317 !!test
10318 Self-closed noinclude, includeonly, onlyinclude tags
10319 !! wikitext
10320 <noinclude />
10321 <includeonly />
10322 <onlyinclude />
10323 !! html
10324 <p><br />
10325 </p>
10326 !!end
10327
10328 !!test
10329 Unbalanced includeonly and noinclude tags
10330 !! wikitext
10331 {|
10332 |a</noinclude>
10333 |b</noinclude></noinclude>
10334 |c</noinclude></includeonly>
10335 |d</includeonly></includeonly>
10336 |}
10337 !! html
10338 <table>
10339 <tr>
10340 <td>a
10341 </td>
10342 <td>b
10343 </td>
10344 <td>c&lt;/includeonly&gt;
10345 </td>
10346 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10347 </td></tr></table>
10348
10349 !!end
10350
10351 !! article
10352 Template:Includeonly section
10353 !! text
10354 <includeonly>
10355 ==Includeonly section==
10356 </includeonly>
10357 ==Section T-1==
10358 !!endarticle
10359
10360 !! test
10361 Bug 6563: Edit link generation for section shown by <includeonly>
10362 !! wikitext
10363 {{includeonly section}}
10364 !! html
10365 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10366 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10367
10368 !! end
10369
10370 # Uses same input as the contents of [[Template:Includeonly section]]
10371 !! test
10372 Bug 6563: Section extraction for section shown by <includeonly>
10373 !! options
10374 section=T-2
10375 !! wikitext
10376 <includeonly>
10377 ==Includeonly section==
10378 </includeonly>
10379 ==Section T-2==
10380 !! html
10381 ==Section T-2==
10382 !! end
10383
10384 !! test
10385 Bug 6563: Edit link generation for section suppressed by <includeonly>
10386 !! wikitext
10387 <includeonly>
10388 ==Includeonly section==
10389 </includeonly>
10390 ==Section 1==
10391 !! html
10392 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10393
10394 !! end
10395
10396 !! test
10397 Bug 6563: Section extraction for section suppressed by <includeonly>
10398 !! options
10399 section=1
10400 !! wikitext
10401 <includeonly>
10402 ==Includeonly section==
10403 </includeonly>
10404 ==Section 1==
10405 !! html
10406 ==Section 1==
10407 !! end
10408
10409 !! test
10410 Un-closed <includeonly>
10411 !! wikitext
10412 <includeonly>
10413 !! html
10414 !! end
10415
10416 !! test
10417 Includes and comments at SOL
10418 !! wikitext
10419 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10420
10421 <noinclude>
10422 some
10423 </noinclude>* stuff
10424 * here
10425
10426 <includeonly>can have stuff</includeonly>=== here ===
10427
10428 !! html/php
10429 <h2><span class="mw-headline" id="hu">hu</span></h2>
10430 <p>some
10431 </p>
10432 <ul><li> stuff</li>
10433 <li> here</li></ul>
10434 <h3><span class="mw-headline" id="here">here</span></h3>
10435
10436 !! html/parsoid
10437 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
10438
10439 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10440 <p>some</p>
10441 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10442 <li> here</li></ul>
10443
10444 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
10445
10446 !! end
10447
10448 # TODO: test with DOM fragment reuse!
10449 !! test
10450 Parsoid: DOM fragment reuse
10451 !! options
10452 parsoid=wt2wt,wt2html
10453 !! wikitext
10454 a{{echo|b<table></table>c}}d
10455
10456 a{{echo|b
10457 <table></table>
10458 c}}d
10459
10460 {{echo|a
10461
10462 <table></table>
10463
10464 b}}
10465 !! html
10466 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
10467
10468 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
10469 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10470 </span><p about="#mwt2">cd</p>
10471
10472 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
10473
10474 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10475
10476 </span><p about="#mwt3">b</p>
10477 !! end
10478
10479 !! test
10480 Parsoid: Merge double tds (bug 50603)
10481 !! options
10482 parsoid
10483 !! wikitext
10484 {|
10485 |{{echo|{{!}} foo}}
10486 |}
10487 !! html
10488 <table><tbody>
10489 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
10490 </tbody></table>
10491 !! end
10492
10493 !! test
10494 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10495 !! options
10496 parsoid
10497 !! wikitext
10498 {{echo|<div>}}
10499 {|
10500 |{{echo|{{!}} foo}}
10501 |}
10502 {{echo|</div>}}
10503 !! html
10504 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
10505 <table><tbody>
10506 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10507 </tbody></table>
10508 </div>
10509 !! end
10510
10511 ###
10512 ### <includeonly> and <noinclude> in attributes
10513 ###
10514 !!test
10515 0. includeonly around the entire attribute
10516 !! wikitext
10517 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10518 !! html
10519 <p><span id="v2">bar</span>
10520 </p>
10521 !!end
10522
10523 !!test
10524 1. includeonly in html attr key
10525 !! wikitext
10526 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10527 !! html
10528 <p><span id="foo">bar</span>
10529 </p>
10530 !!end
10531
10532 !!test
10533 2. includeonly in html attr value
10534 !! wikitext
10535 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10536 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10537 !! html
10538 <p><span id="v1">bar</span>
10539 <span id="v1">bar</span>
10540 </p>
10541 !!end
10542
10543 !!test
10544 3. includeonly in part of an attr value
10545 !! wikitext
10546 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10547 !! html
10548 <p><span style="color:red;">bar</span>
10549 </p>
10550 !!end
10551
10552 !!test
10553 4. includeonly in table attributes
10554 !! wikitext
10555 {|
10556 |- <noinclude>
10557 |-
10558 |a
10559 </noinclude>
10560 |- <includeonly>
10561 |-
10562 |b
10563 </includeonly>
10564 |}
10565 !! html
10566 <table>
10567
10568
10569 <tr>
10570 <td>a
10571 </td></tr>
10572 </table>
10573
10574 !!end
10575
10576 ###
10577 ### Token Stream Patcher tests
10578 ###
10579 ### These tests won't always pass wt2wt and other modes because
10580 ### on serialization, the table will be output on a new line.
10581 ### For now, we are blacklisting them, and using this to test selser.
10582 ###
10583
10584 !!test
10585 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10586 !!options
10587 parsoid=wt2html,wt2wt
10588 !!wikitext
10589 {{echo|}}{| width = '100%'
10590 |foo
10591 |}
10592 !!html/parsoid
10593 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10594 <tbody><tr><td>foo</td></tr>
10595 </tbody></table>
10596 !!end
10597
10598 !!test
10599 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10600 !!options
10601 parsoid=wt2html,wt2wt
10602 !!wikitext
10603 <includeonly>a</includeonly>{| {{{b}}}
10604 |c
10605 |}
10606 !!html/parsoid
10607 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
10608 <tbody><tr><td>c</td></tr>
10609 </tbody></table>
10610
10611 !!end
10612
10613 ###
10614 ### Testing parsing of templates where a template arg
10615 ### has the same name as the template itself.
10616 ###
10617
10618 !! article
10619 Template:quote
10620 !! text
10621 {{{quote|{{{1}}}}}}
10622 !! endarticle
10623
10624 !!test
10625 Templates: Template Name/Arg clash: 1. Use of positional param
10626 !! wikitext
10627 {{quote|foo}}
10628 !! html
10629 <p>foo
10630 </p>
10631 !!end
10632
10633 !!test
10634 Templates: Template Name/Arg clash: 2. Use of named param
10635 !! wikitext
10636 {{quote|quote=foo}}
10637 !! html
10638 <p>foo
10639 </p>
10640 !!end
10641
10642 !!test
10643 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10644 !! wikitext
10645 {{quote|quote}}
10646 !! html
10647 <p>quote
10648 </p>
10649 !!end
10650
10651 ###
10652 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10653 ###
10654
10655 !!test
10656 Templates: 1. Simple use
10657 !! wikitext
10658 {{echo|Foo}}
10659 !! html
10660 <p>Foo
10661 </p>
10662 !!end
10663
10664 !!test
10665 Templates: 2. Inside a block tag
10666 !! wikitext
10667 <div>{{echo|Foo}}</div>
10668 <blockquote>{{echo|Foo}}</blockquote>
10669 !! html
10670 <div>Foo</div>
10671 <blockquote>Foo</blockquote>
10672
10673 !! html+tidy
10674 <div>Foo</div>
10675 <blockquote>
10676 <p>Foo</p>
10677 </blockquote>
10678 !!end
10679
10680 !!test
10681 Templates: P-wrapping: 1a. Templates on consecutive lines
10682 !! wikitext
10683 {{echo|Foo}}
10684 {{echo|bar}}
10685 !! html
10686 <p>Foo
10687 bar
10688 </p>
10689 !!end
10690
10691 !!test
10692 Templates: P-wrapping: 1b. Templates on consecutive lines
10693 !! wikitext
10694 Foo
10695
10696 {{echo|bar}}
10697 {{echo|baz}}
10698 !! html
10699 <p>Foo
10700 </p><p>bar
10701 baz
10702 </p>
10703 !!end
10704
10705 !!test
10706 Templates: P-wrapping: 1c. Templates on consecutive lines
10707 !! wikitext
10708 {{echo|Foo}}
10709 {{echo|bar}} <div>baz</div>
10710 !! html
10711 <p>Foo
10712 </p>
10713 bar <div>baz</div>
10714
10715 !! html+tidy
10716 <p>Foo</p>
10717 <p>bar</p>
10718 <div>baz</div>
10719 !! end
10720
10721 !!test
10722 Templates: P-wrapping: 1d. Template preceded by comment-only line
10723 !!options
10724 parsoid
10725 !! wikitext
10726 <!-- foo -->
10727 {{echo|Bar}}
10728 !! html
10729 <!-- foo -->
10730
10731 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10732 !!end
10733
10734 !!test
10735 Templates: Inline Text: 1. Multiple template uses
10736 !! wikitext
10737 {{echo|Foo}}bar{{echo|baz}}
10738 !! html
10739 <p>Foobarbaz
10740 </p>
10741 !!end
10742
10743 !!test
10744 Templates: Inline Text: 2. Back-to-back template uses
10745 !! wikitext
10746 {{echo|Foo}}{{echo|bar}}
10747 !! html
10748 <p>Foobar
10749 </p>
10750 !!end
10751
10752 !!test
10753 Templates: Block Tags: 1. Multiple template uses
10754 !! wikitext
10755 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10756 !! html
10757 <div>Foo</div><div>bar</div><div>baz</div>
10758
10759 !!end
10760
10761 !!test
10762 Templates: Block Tags: 2. Back-to-back template uses
10763 !! wikitext
10764 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10765 !! html
10766 <div>Foo</div><div>bar</div>
10767
10768 !!end
10769
10770 # This is an edge case relating to paragraph wrapping.
10771 !!test
10772 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10773 !! wikitext
10774 {{echo|a
10775 b</p>}}
10776 !! html/parsoid
10777 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
10778 b</p>
10779 !!end
10780
10781 !!test
10782 Templates: Links: 1. Simple example
10783 !! wikitext
10784 {{echo|[[Foo|bar]]}}
10785 !! html
10786 <p><a href="/wiki/Foo" title="Foo">bar</a>
10787 </p>
10788 !!end
10789
10790 !!test
10791 Templates: Links: 2. Generation of link href
10792 !! wikitext
10793 [[{{echo|Foo}}|bar]]
10794 !! html
10795 <p><a href="/wiki/Foo" title="Foo">bar</a>
10796 </p>
10797 !!end
10798
10799 !!test
10800 Templates: Links: 3. Generation of part of a link href
10801 !! wikitext
10802 [[Fo{{echo|o}}|bar]]
10803
10804 [[Foo{{echo|bar}}]]
10805
10806 [[Foo{{echo|bar}}baz]]
10807
10808 [[Foo{{echo|bar}}|bar]]
10809
10810 [[:Foo{{echo|bar}}]]
10811
10812 [[:Foo{{echo|bar}}|bar]]
10813 !! html
10814 <p><a href="/wiki/Foo" title="Foo">bar</a>
10815 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10816 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10817 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10818 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10819 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10820 </p>
10821 !!end
10822
10823 !!test
10824 Templates: Links: 4. Multiple templates generating link href
10825 !! wikitext
10826 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10827 !! html
10828 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10829 </p>
10830 !!end
10831
10832 !!test
10833 Templates: Links: 5. Generation of link text
10834 !! wikitext
10835 [[Foo|{{echo|bar}}]]
10836 !! html
10837 <p><a href="/wiki/Foo" title="Foo">bar</a>
10838 </p>
10839 !!end
10840
10841 !!test
10842 Templates: Links: 5. Nested templates (only outermost template should be marked)
10843 !! wikitext
10844 {{echo|[[{{echo|Foo}}|bar]]}}
10845 !! html
10846 <p><a href="/wiki/Foo" title="Foo">bar</a>
10847 </p>
10848 !!end
10849
10850 !!test
10851 Templates: HTML Tag: 1. Generation of HTML attr. key
10852 !! wikitext
10853 <div {{echo|style}}="color:red;">foo</div>
10854 !! html
10855 <div style="color:red;">foo</div>
10856
10857 !!end
10858
10859 !!test
10860 Templates: HTML Tag: 2. Generation of HTML attr. value
10861 !! wikitext
10862 <div style={{echo|'color:red;'}}>foo</div>
10863 !! html
10864 <div style="color:red;">foo</div>
10865
10866 !!end
10867
10868 !!test
10869 Templates: HTML Tag: 3. Generation of HTML attr key and value
10870 !! wikitext
10871 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10872 !! html
10873 <div style="color:red;">foo</div>
10874
10875 !!end
10876
10877 !!test
10878 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10879 !! wikitext
10880 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10881 !! html
10882 <div title="This is a long title with just one piece templated">foo</div>
10883
10884 !!end
10885
10886 !!test
10887 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10888 !! wikitext
10889 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10890 !! html
10891 <div title="This is a long title with just one piece templated">foo</div>
10892
10893 !!end
10894
10895 !!test
10896 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10897 !! wikitext
10898 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10899 !! html
10900 <div title="This is a long title with just one piece templated">foo</div>
10901
10902 !!end
10903
10904 # SSS FIXME: While it is great we added support for all this,
10905 # do we want to make this part of the spec? Maybe we want to
10906 # deprecate this kind of usage in the future?
10907 !!test
10908 Templates: HTML Tag: 7. Generation of partial attribute key string
10909 !! wikitext
10910 <div st{{echo|yle}}="color:red;">foo</div>
10911 !! html
10912 <div style="color:red;">foo</div>
10913
10914 !!end
10915
10916 !! test
10917 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10918 !! wikitext
10919 <div {{echo|1=id="v1"}}>bar</div>
10920 !! html
10921 <div id="v1">bar</div>
10922
10923 !!end
10924
10925 !! test
10926 Templates: HTML Tag: 9. Multiple template-generated attributes
10927 !! wikitext
10928 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10929 !! html
10930 <div id="v1" title="foo">bar</div>
10931
10932 !!end
10933
10934 !! test
10935 Templates: Support for templates generating attributes and content
10936 !! wikitext
10937 {| {{mixed_attr_content_template}}
10938 |-
10939 |bar
10940 |}
10941 !! html/php
10942 <table style="color:red;" title="T48811">
10943
10944 <tr>
10945 <td>foo
10946 </td></tr>
10947 <tr>
10948 <td>bar
10949 </td></tr></table>
10950
10951 !! html/parsoid
10952 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
10953 <tbody><tr>
10954 <td>foo</td></tr>
10955 <tr>
10956 <td>bar</td></tr>
10957 </tbody></table>
10958 !!end
10959
10960 !! test
10961 1. Entities and nowikis inside templated attributes should be handled correctly
10962 !! wikitext
10963 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
10964 !! html/php
10965 <div style="background:#f9f9f9;">foo</div>
10966
10967 !! html/parsoid
10968 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
10969 !! end
10970
10971 !! test
10972 2. Entities and nowikis inside templated attributes should be handled correctly
10973 !! wikitext
10974 {|
10975 |{{table_attribs_3}}
10976 |}
10977 !! html/php
10978 <table>
10979 <tr>
10980 <td style="background:#f9f9f9;">Foo
10981 </td></tr></table>
10982
10983 !! html/parsoid
10984 <table>
10985 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
10986 </tbody></table>
10987 !! end
10988
10989 !! test
10990 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
10991 !! wikitext
10992 {{tbl-start}}
10993 |{{table_attribs_3}}
10994 {{tbl-end}}
10995 !! html/php
10996 <table>
10997 <tr>
10998 <td style="background:#f9f9f9;">Foo
10999 </td></tr></table>
11000
11001 !! html/parsoid
11002 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
11003 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11004 </tbody></table>
11005 !! end
11006
11007 !!test
11008 Templates: HTML Tables: 1. Generating start of a HTML table
11009 !! wikitext
11010 {{echo|<table><tr><td>foo</td>}}</tr></table>
11011 !! html
11012 <table><tr><td>foo</td></tr></table>
11013
11014 !!end
11015
11016 !!test
11017 Templates: HTML Tables: 2a. Generating middle of a HTML table
11018 !! wikitext
11019 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11020 !! html
11021 <table><tr><td>foo</td></tr></table>
11022
11023 !!end
11024
11025 !!test
11026 Templates: HTML Tables: 2b. Generating middle of a HTML table
11027 !! wikitext
11028 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11029 !! html
11030 <table><tr><td>foo</td></tr></table>
11031
11032 !!end
11033
11034 !!test
11035 Templates: HTML Tables: 3. Generating end of a HTML table
11036 !! wikitext
11037 <table><tr>{{echo|<td>foo</td></tr></table>}}
11038 !! html
11039 <table><tr><td>foo</td></tr></table>
11040
11041 !!end
11042
11043 !!test
11044 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11045 !! wikitext
11046 {{echo|<table>}}<tr><td>foo</td></tr></table>
11047 !! html
11048 <table><tr><td>foo</td></tr></table>
11049
11050 !!end
11051
11052 !!test
11053 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11054 !! wikitext
11055 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11056 !! html
11057 <table><tr><td>foo</td></tr></table>
11058
11059 !!end
11060
11061 !!test
11062 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11063 !! wikitext
11064 <table><tr>{{echo|<td>}}foo</td></tr></table>
11065 !! html
11066 <table><tr><td>foo</td></tr></table>
11067
11068 !!end
11069
11070 !!test
11071 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11072 !! wikitext
11073 <table><tr><td>foo{{echo|</td>}}</tr></table>
11074 !! html
11075 <table><tr><td>foo</td></tr></table>
11076
11077 !!end
11078
11079 !!test
11080 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11081 !! wikitext
11082 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11083 !! html
11084 <table><tr><td>foo</td></tr></table>
11085
11086 !!end
11087
11088 !!test
11089 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11090 !! wikitext
11091 <table><tr><td>foo</td></tr>{{echo|</table>}}
11092 !! html
11093 <table><tr><td>foo</td></tr></table>
11094
11095 !!end
11096
11097 !!test
11098 Templates: HTML Tables: 5. Proper fostering of categories from inside
11099 !!options
11100 parsoid=wt2html,wt2wt
11101 !! wikitext
11102 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11103 <!--Two categories (Bug 50330)-->
11104 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11105 !! html
11106 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11107 <!--Two categories (Bug 50330)-->
11108 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
11109 !!end
11110
11111 !!test
11112 Templates: Wiki Tables: 1a. Fostering of entire template content
11113 !! wikitext
11114 {|
11115 {{echo|a}}
11116 |}
11117 !! html
11118 <table>
11119 a
11120 <tr><td></td></tr></table>
11121
11122 !! html+tidy
11123 <p>a</p>
11124 <table>
11125 <tr>
11126 <td></td>
11127 </tr>
11128 </table>
11129 !! end
11130
11131 !!test
11132 Templates: Wiki Tables: 1b. Fostering of entire template content
11133 !! wikitext
11134 {|
11135 {{echo|<div>}}
11136 foo
11137 {{echo|</div>}}
11138 |}
11139 !! html
11140 <table>
11141 <div>
11142 <p>foo
11143 </p>
11144 </div>
11145 <tr><td></td></tr></table>
11146
11147 !! html+tidy
11148 <div>
11149 <p>foo</p>
11150 </div>
11151 <table>
11152 <tr>
11153 <td></td>
11154 </tr>
11155 </table>
11156 !! end
11157
11158 !!test
11159 Templates: Wiki Tables: 2. Fostering of partial template content
11160 !! wikitext
11161 {|
11162 {{echo|a
11163 <div>b</div>}}
11164 |}
11165 !! html
11166 <table>
11167 a
11168 <div>b</div>
11169 <tr><td></td></tr></table>
11170
11171 !! html+tidy
11172 <p>a</p>
11173 <div>b</div>
11174 <table>
11175 <tr>
11176 <td></td>
11177 </tr>
11178 </table>
11179 !! end
11180
11181 !!test
11182 Templates: Wiki Tables: 3. td-content via multiple templates
11183 !! wikitext
11184 {|
11185 {{echo|{{pipe}}a}}{{echo|b}}
11186 |}
11187 !! html
11188 <table>
11189 <tr>
11190 <td>ab
11191 </td></tr></table>
11192
11193 !!end
11194
11195 !!test
11196 Templates: Wiki Tables: 4. Templated tags, no content
11197 !! wikitext
11198 {{tbl-start}}
11199 {{tbl-end}}
11200 !! html
11201 <table>
11202 <tr><td></td></tr></table>
11203
11204 !!end
11205
11206 !!test
11207 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11208 !! wikitext
11209 {{tbl-start}}
11210 |foo
11211 {{tbl-end}}
11212 !! html
11213 <table>
11214 <tr>
11215 <td>foo
11216 </td></tr></table>
11217
11218 !!end
11219
11220 !!test
11221 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11222 !! wikitext
11223 {{tbl-start}}
11224 {{!}}foo
11225 {{tbl-end}}
11226 !! html
11227 <table>
11228 <tr>
11229 <td>foo
11230 </td></tr></table>
11231
11232 !!end
11233
11234 ## This test case is very specific to Parsoid's internals
11235 ## and is hence only tested for Parsoid's code. Parsoid uses
11236 ## a <meta> marker tag for <ref> tags and they are expanded
11237 ## much later. We are verifying that this <meta> tag usage
11238 ## doesn't prevent foster parenting.
11239 !!test
11240 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11241 !!wikitext
11242 {{PartialTable}}<ref>foo</ref>
11243 |}
11244
11245 <references />
11246 !!html/parsoid
11247 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
11248 <tbody>
11249 </tbody></table>
11250
11251 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
11252 !!end
11253
11254 !! test
11255 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11256 !! wikitext
11257 {{echo|
11258 {{{!}}
11259 {{!}}-}}
11260 <onlyinclude>
11261 |foo
11262 </onlyinclude>
11263 {{!}}}
11264 !! html/parsoid
11265 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
11266 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11267 <tbody><tr>
11268
11269 <td>foo
11270 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11271 </tbody></table>
11272 !! end
11273
11274 !!test
11275 Templates: Lists: Multi-line list-items via templates
11276 !! wikitext
11277 *{{echo|a {{nonexistent|
11278 unused}}}}
11279 *{{echo|b {{nonexistent|
11280 unused}}}}
11281 !! html
11282 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
11283 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
11284
11285 !!end
11286
11287 !!test
11288 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11289 !! wikitext
11290 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11291 !! html
11292 <p><i>ab</i>c<i>d</i>e
11293 </p>
11294 !!end
11295
11296 !!test
11297 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11298 (PHP parser generates misnested html)
11299 !! wikitext
11300 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11301 !! html/parsoid
11302 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
11303 !!end
11304
11305 !!test
11306 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11307 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11308 !! options
11309 parsoid=wt2html,wt2wt
11310 !! wikitext
11311 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11312 !! html
11313 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
11314 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
11315 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
11316 !!end
11317
11318 !!test
11319 Templates: Ugly nesting: 4. Divs opened/closed across templates
11320 !! wikitext
11321 a<div>b{{echo|c</div>d}}e
11322 !! html
11323 a<div>bc</div>de
11324
11325 !! html+tidy
11326 <p>a</p>
11327 <div>bc</div>
11328 <p>de</p>
11329 !! end
11330
11331 !!test
11332 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11333 (Parsoid-centric)
11334 !! options
11335 parsoid
11336 !! wikitext
11337 {|
11338 |{{echo|foo</table>}}
11339 |bar
11340 |}
11341 !! html
11342 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
11343
11344 <tbody>
11345 <tr>
11346 <td>foo</td></tr></tbody></table><span about="#mwt1">
11347 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11348 |}</span>
11349 !!end
11350
11351 !!test
11352 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11353 (Parsoid-centric)
11354 !! options
11355 parsoid
11356 !! wikitext
11357 <table>
11358 <tr>
11359 <td>
11360 <table>
11361 <tr>
11362 <td>1. {{echo|foo </table>}}</td>
11363 <td> bar </td>
11364 <td>2. {{echo|baz </table>}}</td>
11365 </tr>
11366 <tr>
11367 <td>abc</td>
11368 </tr>
11369 </table>
11370 </td>
11371 </tr>
11372 <tr>
11373 <td>xyz</td>
11374 </tr>
11375 </table>
11376 !! html
11377 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
11378 <tbody><tr>
11379 <td>
11380 <table>
11381 <tbody><tr>
11382 <td>1. foo </td></tr></tbody></table></td>
11383 <td> bar </td>
11384 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11385 </span><span about="#mwt2">
11386 </span><span about="#mwt2">
11387 </span><span about="#mwt2">abc</span><span about="#mwt2">
11388 </span><span about="#mwt2">
11389 </span><span about="#mwt2">
11390 </span><span about="#mwt2">
11391 </span><span about="#mwt2">
11392 </span><span about="#mwt2">
11393 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11394 </span><span about="#mwt2">
11395 </span>
11396 !!end
11397
11398 !! test
11399 Templates: Ugly templates: 3. newline-only template parameter
11400 !! wikitext
11401 foo {{echo|
11402 }}
11403 !! html
11404 <p>foo
11405 </p>
11406 !! end
11407
11408 # This looks like a bug: a single newline triggers p/br for some reason.
11409 !! test
11410 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11411 !! wikitext
11412 {{echo|
11413 }}
11414 !! html
11415 <p><br />
11416 </p>
11417 !! end
11418
11419 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11420 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11421 !! test
11422 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11423 !! wikitext
11424 {{echo|<table>}}
11425 {{echo|<div>foo}}
11426 {{echo|</table>}}
11427 !! html/parsoid
11428 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
11429 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11430 </table>
11431 !! end
11432
11433 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11434 # that are "identical" and generate nesting cycles in the algorithm
11435 !! test
11436 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11437 !! wikitext
11438 {{echo|<table><tr><td><table>}}
11439 {{echo|<div>}}
11440 {{echo|</div>}}
11441 !! html/parsoid
11442 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
11443 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11444 </table></td></tr></tbody></table>
11445 !! end
11446
11447 !!test
11448 Parser Functions: 1. Simple example
11449 !! wikitext
11450 {{uc:foo}}
11451 !! html
11452 <p>FOO
11453 </p>
11454 !!end
11455
11456 !!test
11457 Parser Functions: 2. Nested use (only outermost should be marked up)
11458 !! wikitext
11459 {{uc:{{lc:FOO}}}}
11460 !! html
11461 <p>FOO
11462 </p>
11463 !!end
11464
11465 ###
11466 ### Pre-save transform tests
11467 ###
11468 !! test
11469 pre-save transform: subst:
11470 !! options
11471 PST
11472 !! wikitext
11473 {{subst:test}}
11474 !! html
11475 This is a test template
11476 !! end
11477
11478 !! test
11479 pre-save transform: normal template
11480 !! options
11481 PST
11482 !! wikitext
11483 {{test}}
11484 !! html
11485 {{test}}
11486 !! end
11487
11488 !! test
11489 pre-save transform: nonexistent template
11490 !! options
11491 PST
11492 !! wikitext
11493 {{thistemplatedoesnotexist}}
11494 !! html
11495 {{thistemplatedoesnotexist}}
11496 !! end
11497
11498
11499 !! test
11500 pre-save transform: subst magic variables
11501 !! options
11502 PST
11503 !! wikitext
11504 {{subst:SITENAME}}
11505 !! html
11506 MediaWiki
11507 !! end
11508
11509 # This is bug 89, which I fixed. -- wtm
11510 !! test
11511 pre-save transform: subst: templates with parameters
11512 !! options
11513 pst
11514 !! wikitext
11515 {{subst:paramtest|param="something else"}}
11516 !! html
11517 This is a test template with parameter "something else"
11518 !! end
11519
11520 !! article
11521 Template:nowikitest
11522 !! text
11523 <nowiki>'''not wiki'''</nowiki>
11524 !! endarticle
11525
11526 !! test
11527 pre-save transform: nowiki in subst (bug 1188)
11528 !! options
11529 pst
11530 !! wikitext
11531 {{subst:nowikitest}}
11532 !! html
11533 <nowiki>'''not wiki'''</nowiki>
11534 !! end
11535
11536
11537 !! article
11538 Template:commenttest
11539 !! text
11540 This template has <!-- a comment --> in it.
11541 !! endarticle
11542
11543 !! test
11544 pre-save transform: comment in subst (bug 1936)
11545 !! options
11546 pst
11547 !! wikitext
11548 {{subst:commenttest}}
11549 !! html
11550 This template has <!-- a comment --> in it.
11551 !! end
11552
11553 !! test
11554 pre-save transform: unclosed tag
11555 !! options
11556 pst noxml
11557 !! wikitext
11558 <nowiki>'''not wiki'''
11559 !! html
11560 <nowiki>'''not wiki'''
11561 !! end
11562
11563 !! test
11564 pre-save transform: mixed tag case
11565 !! options
11566 pst noxml
11567 !! wikitext
11568 <NOwiki>'''not wiki'''</noWIKI>
11569 !! html
11570 <NOwiki>'''not wiki'''</noWIKI>
11571 !! end
11572
11573 !! test
11574 pre-save transform: unclosed comment in <nowiki>
11575 !! options
11576 pst noxml
11577 !! wikitext
11578 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11579 !! html
11580 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11581 !!end
11582
11583 # Leading @ in this template definition works around a limitation
11584 # in parsoid's parserTests which otherwise strips the <span> from the
11585 # result (confusing it for a template wrapper)
11586 !! article
11587 Template:dangerous
11588 !!text
11589 @<span onmouseover="alert('crap')">Oh no</span>
11590 !!endarticle
11591
11592 !!test
11593 (confirming safety of fix for subst bug 1936)
11594 !! wikitext
11595 {{Template:dangerous}}
11596 !! html
11597 <p>@<span>Oh no</span>
11598 </p>
11599 !! end
11600
11601 !! test
11602 pre-save transform: comment containing gallery (bug 5024)
11603 !! options
11604 pst
11605 !! wikitext
11606 <!-- <gallery>data</gallery> -->
11607 !! html
11608 <!-- <gallery>data</gallery> -->
11609 !!end
11610
11611 !! test
11612 pre-save transform: comment containing extension
11613 !! options
11614 pst
11615 !! wikitext
11616 <!-- <tag>data</tag> -->
11617 !! html
11618 <!-- <tag>data</tag> -->
11619 !!end
11620
11621 !! test
11622 pre-save transform: comment containing nowiki
11623 !! options
11624 pst
11625 !! wikitext
11626 <!-- <nowiki>data</nowiki> -->
11627 !! html
11628 <!-- <nowiki>data</nowiki> -->
11629 !!end
11630
11631 !! test
11632 pre-save transform: <noinclude> in subst (bug 3298)
11633 !! options
11634 pst
11635 !! wikitext
11636 {{subst:Includes}}
11637 !! html
11638 Foobar
11639 !! end
11640
11641 !! test
11642 pre-save transform: <onlyinclude> in subst (bug 3298)
11643 !! options
11644 pst
11645 !! wikitext
11646 {{subst:Includes2}}
11647 !! html
11648 Foo
11649 !! end
11650
11651 !! article
11652 Template:SubstTest
11653 !!text
11654 {{<includeonly>subst:</includeonly>Includes}}
11655 !! endarticle
11656
11657 !! article
11658 Template:SafeSubstTest
11659 !! text
11660 {{<includeonly>safesubst:</includeonly>Includes}}
11661 !! endarticle
11662
11663 !! test
11664 bug 22297: safesubst: works during PST
11665 !! options
11666 pst
11667 !! wikitext
11668 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11669 !! html
11670 FoobarFoobar
11671 !! end
11672
11673 !! test
11674 bug 22297: safesubst: works during normal parse
11675 !! wikitext
11676 {{SafeSubstTest}}
11677 !! html
11678 <p>Foobar
11679 </p>
11680 !! end
11681
11682 !! test
11683 subst: does not work during normal parse
11684 !! wikitext
11685 {{SubstTest}}
11686 !! html
11687 <p>{{subst:Includes}}
11688 </p>
11689 !! end
11690
11691 !! test
11692 pre-save transform: context links ("pipe trick")
11693 !! options
11694 pst
11695 !! wikitext
11696 [[Article (context)|]]
11697 [[Bar:Article|]]
11698 [[:Bar:Article|]]
11699 [[Bar:Article (context)|]]
11700 [[:Bar:Article (context)|]]
11701 [[|Article]]
11702 [[|Article (context)]]
11703 [[Bar:X (Y) Z|]]
11704 [[:Bar:X (Y) Z|]]
11705 !! html
11706 [[Article (context)|Article]]
11707 [[Bar:Article|Article]]
11708 [[:Bar:Article|Article]]
11709 [[Bar:Article (context)|Article]]
11710 [[:Bar:Article (context)|Article]]
11711 [[Article]]
11712 [[Article (context)]]
11713 [[Bar:X (Y) Z|X (Y) Z]]
11714 [[:Bar:X (Y) Z|X (Y) Z]]
11715 !! end
11716
11717 !! test
11718 pre-save transform: context links ("pipe trick") with interwiki prefix
11719 !! options
11720 pst
11721 !! wikitext
11722 [[interwiki:Article|]]
11723 [[:interwiki:Article|]]
11724 [[interwiki:Bar:Article|]]
11725 [[:interwiki:Bar:Article|]]
11726 !! html
11727 [[interwiki:Article|Article]]
11728 [[:interwiki:Article|Article]]
11729 [[interwiki:Bar:Article|Bar:Article]]
11730 [[:interwiki:Bar:Article|Bar:Article]]
11731 !! end
11732
11733 !! test
11734 pre-save transform: context links ("pipe trick") with parens in title
11735 !! options
11736 pst title=[[Somearticle (context)]]
11737 !! wikitext
11738 [[|Article]]
11739 !! html
11740 [[Article (context)|Article]]
11741 !! end
11742
11743 !! test
11744 pre-save transform: context links ("pipe trick") with comma in title
11745 !! options
11746 pst title=[[Someplace, Somewhere]]
11747 !! wikitext
11748 [[|Otherplace]]
11749 [[Otherplace, Elsewhere|]]
11750 [[Otherplace, Elsewhere, Anywhere|]]
11751 !! html
11752 [[Otherplace, Somewhere|Otherplace]]
11753 [[Otherplace, Elsewhere|Otherplace]]
11754 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11755 !! end
11756
11757 !! test
11758 pre-save transform: context links ("pipe trick") with parens and comma
11759 !! options
11760 pst title=[[Someplace (IGNORED), Somewhere]]
11761 !! wikitext
11762 [[|Otherplace]]
11763 [[Otherplace (place), Elsewhere|]]
11764 !! html
11765 [[Otherplace, Somewhere|Otherplace]]
11766 [[Otherplace (place), Elsewhere|Otherplace]]
11767 !! end
11768
11769 !! test
11770 pre-save transform: context links ("pipe trick") with comma and parens
11771 !! options
11772 pst title=[[Who, me? (context)]]
11773 !! wikitext
11774 [[|Yes, you.]]
11775 [[Me, Myself, and I (1937 song)|]]
11776 !! html
11777 [[Yes, you. (context)|Yes, you.]]
11778 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11779 !! end
11780
11781 !! test
11782 pre-save transform: context links ("pipe trick") with namespace
11783 !! options
11784 pst title=[[Ns:Somearticle]]
11785 !! wikitext
11786 [[|Article]]
11787 !! html
11788 [[Ns:Article|Article]]
11789 !! end
11790
11791 !! test
11792 pre-save transform: context links ("pipe trick") with namespace and parens
11793 !! options
11794 pst title=[[Ns:Somearticle (context)]]
11795 !! wikitext
11796 [[|Article]]
11797 !! html
11798 [[Ns:Article (context)|Article]]
11799 !! end
11800
11801 !! test
11802 pre-save transform: context links ("pipe trick") with namespace and comma
11803 !! options
11804 pst title=[[Ns:Somearticle, Context, Whatever]]
11805 !! wikitext
11806 [[|Article]]
11807 !! html
11808 [[Ns:Article, Context, Whatever|Article]]
11809 !! end
11810
11811 !! test
11812 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11813 !! options
11814 pst title=[[Ns:Somearticle, Context (context)]]
11815 !! wikitext
11816 [[|Article]]
11817 !! html
11818 [[Ns:Article (context)|Article]]
11819 !! end
11820
11821 !! test
11822 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11823 !! options
11824 pst title=[[Ns:Somearticle (IGNORED), Context]]
11825 !! wikitext
11826 [[|Article]]
11827 !! html
11828 [[Ns:Article, Context|Article]]
11829 !! end
11830
11831 !! test
11832 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11833 !! options
11834 pst
11835 !! wikitext
11836 [[Article(context)|]]
11837 [[Bar:Article(context)|]]
11838 [[:Bar:Article(context)|]]
11839 [[|Article(context)]]
11840 [[Bar:X(Y)Z|]]
11841 [[:Bar:X(Y)Z|]]
11842 !! html
11843 [[Article(context)|Article]]
11844 [[Bar:Article(context)|Article]]
11845 [[:Bar:Article(context)|Article]]
11846 [[Article(context)]]
11847 [[Bar:X(Y)Z|X(Y)Z]]
11848 [[:Bar:X(Y)Z|X(Y)Z]]
11849 !! end
11850
11851 !! test
11852 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11853 !! options
11854 pst
11855 !! wikitext
11856 [[Article (context)|]]
11857 [[Bar:Article (context)|]]
11858 [[:Bar:Article (context)|]]
11859 [[|Article (context)]]
11860 [[Bar:X (Y) Z|]]
11861 [[:Bar:X (Y) Z|]]
11862 !! html
11863 [[Article (context)|Article]]
11864 [[Bar:Article (context)|Article]]
11865 [[:Bar:Article (context)|Article]]
11866 [[Article (context)]]
11867 [[Bar:X (Y) Z|X (Y) Z]]
11868 [[:Bar:X (Y) Z|X (Y) Z]]
11869 !! end
11870
11871 !! test
11872 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11873 !! options
11874 pst
11875 !! wikitext
11876 [[Article(context)|]]
11877 [[Bar:Article(context)|]]
11878 [[:Bar:Article(context)|]]
11879 [[|Article(context)]]
11880 [[Bar:X(Y)Z|]]
11881 [[:Bar:X(Y)Z|]]
11882 !! html
11883 [[Article(context)|Article]]
11884 [[Bar:Article(context)|Article]]
11885 [[:Bar:Article(context)|Article]]
11886 [[Article(context)]]
11887 [[Bar:X(Y)Z|X(Y)Z]]
11888 [[:Bar:X(Y)Z|X(Y)Z]]
11889 !! end
11890
11891 !! test
11892 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11893 !! options
11894 pst
11895 !! wikitext
11896 [[Article (context), context|]]
11897 [[Article (context),context|]]
11898 [[Bar:Article (context), context|]]
11899 [[Bar:Article (context),context|]]
11900 [[:Bar:Article (context), context|]]
11901 [[:Bar:Article (context),context|]]
11902 !! html
11903 [[Article (context), context|Article]]
11904 [[Article (context),context|Article]]
11905 [[Bar:Article (context), context|Article]]
11906 [[Bar:Article (context),context|Article]]
11907 [[:Bar:Article (context), context|Article]]
11908 [[:Bar:Article (context),context|Article]]
11909 !! end
11910
11911 !! test
11912 pre-save transform: trim trailing empty lines
11913 !! options
11914 pst
11915 !! wikitext
11916 Empty lines are trimmed
11917
11918
11919
11920
11921 !! html
11922 Empty lines are trimmed
11923 !! end
11924
11925 !! test
11926 pre-save transform: Signature expansion
11927 !! options
11928 pst
11929 !! wikitext
11930 * ~~~
11931 * <noinclude>~~~</noinclude>
11932 * <includeonly>~~~</includeonly>
11933 * <onlyinclude>~~~</onlyinclude>
11934 !! html
11935 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11936 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11937 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11938 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11939 !! end
11940
11941
11942 !! test
11943 pre-save transform: Signature expansion in nowiki tags (bug 93)
11944 !! options
11945 pst disabled
11946 !! wikitext
11947 Shall not expand:
11948
11949 <nowiki>~~~~</nowiki>
11950
11951 <includeonly><nowiki>~~~~</nowiki></includeonly>
11952
11953 <noinclude><nowiki>~~~~</nowiki></noinclude>
11954
11955 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11956
11957 {{subst:Foo}} shall be converted to FOO
11958
11959 As well as inside noinclude/onlyinclude
11960 <noinclude>{{subst:Foo}}</noinclude>
11961 <onlyinclude>{{subst:Foo}}</onlyinclude>
11962
11963 But not inside includeonly
11964 <includeonly>{{subst:Foo}}</includeonly>
11965 !! html
11966 Shall not expand:
11967
11968 <nowiki>~~~~</nowiki>
11969
11970 <includeonly><nowiki>~~~~</nowiki></includeonly>
11971
11972 <noinclude><nowiki>~~~~</nowiki></noinclude>
11973
11974 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11975
11976 FOO shall be converted to FOO
11977
11978 As well as inside noinclude/onlyinclude
11979 <noinclude>FOO</noinclude>
11980 <onlyinclude>FOO</onlyinclude>
11981
11982 But not inside includeonly
11983 <includeonly>{{subst:Foo}}</includeonly>
11984 !! end
11985
11986 !! test
11987 Parsoid: Recognize nowiki with trailing space in tags
11988 !! options
11989 parsoid=wt2html
11990 !! wikitext
11991 <nowiki ><div>[[foo]]</nowiki >
11992
11993 a<nowiki / >b
11994
11995 c<nowiki />d
11996
11997 e<nowiki/ >f
11998 !! html
11999 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12000 <p>ab</p>
12001 <p>cd</p>
12002 <p>ef</p>
12003 !! end
12004
12005 !! test
12006 Parsoid: Recognize nowiki with odd capitalization
12007 !! options
12008 parsoid=wt2html
12009 !! wikitext
12010 <noWikI ><div>[[foo]]</Nowiki >
12011 !! html
12012 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12013 !! end
12014
12015
12016 !! test
12017 Parsoid: Escape nowiki with trailing space in tags
12018 !! options
12019 parsoid=html2wt
12020 !! html
12021 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12022 <p>a&lt;nowiki /&gt;b</p>
12023 <p>c&lt;nowiki/ &gt;d</p>
12024 !! wikitext
12025 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12026
12027 a&lt;nowiki /&gt;b
12028
12029 c&lt;nowiki/ &gt;d
12030 !! end
12031
12032 !! test
12033 Parsoid: Escape weird noWikI capitalizations
12034 !! options
12035 parsoid=html2wt
12036 !! html
12037 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12038 !! wikitext
12039 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12040 !! end
12041
12042 ###
12043 ### Message transform tests
12044 ###
12045 !! test
12046 message transform: magic variables
12047 !! options
12048 msg
12049 !! wikitext
12050 {{SITENAME}}
12051 !! html
12052 MediaWiki
12053 !! end
12054
12055 !! test
12056 message transform: should not transform wiki markup
12057 !! options
12058 msg
12059 !! wikitext
12060 ''test''
12061 !! html
12062 ''test''
12063 !! end
12064
12065 !! test
12066 message transform: <noinclude> in transcluded template (bug 4926)
12067 !! options
12068 msg
12069 !! wikitext
12070 {{Includes}}
12071 !! html
12072 Foobar
12073 !! end
12074
12075 !! test
12076 message transform: <onlyinclude> in transcluded template (bug 4926)
12077 !! options
12078 msg
12079 !! wikitext
12080 {{Includes2}}
12081 !! html
12082 Foo
12083 !! end
12084
12085 !! test
12086 {{#special:}} page name, known
12087 !! options
12088 msg
12089 !! wikitext
12090 {{#special:Recentchanges}}
12091 !! html
12092 Special:RecentChanges
12093 !! end
12094
12095 !! test
12096 {{#special:}} page name with subpage, known
12097 !! options
12098 msg
12099 !! wikitext
12100 {{#special:Recentchanges/param}}
12101 !! html
12102 Special:RecentChanges/param
12103 !! end
12104
12105 !! test
12106 {{#special:}} page name, unknown
12107 !! options
12108 msg
12109 !! wikitext
12110 {{#special:foobar nonexistent}}
12111 !! html
12112 Special:Foobar nonexistent
12113 !! end
12114
12115 !! test
12116 {{#speciale:}} page name, known
12117 !! options
12118 msg
12119 !! wikitext
12120 {{#speciale:Recentchanges}}
12121 !! html
12122 Special:RecentChanges
12123 !! end
12124
12125 !! test
12126 {{#speciale:}} page name with subpage, known
12127 !! options
12128 msg
12129 !! wikitext
12130 {{#speciale:Recentchanges/param}}
12131 !! html
12132 Special:RecentChanges/param
12133 !! end
12134
12135 !! test
12136 {{#speciale:}} page name, unknown
12137 !! options
12138 msg
12139 !! wikitext
12140 {{#speciale:foobar nonexistent}}
12141 !! html
12142 Special:Foobar_nonexistent
12143 !! end
12144
12145 ###
12146 ### Images
12147 ###
12148 ### For Parsoid-specific tests, see
12149 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12150
12151 !! test
12152 Simple image
12153 !! options
12154 parsoid=wt2html,wt2wt,html2html
12155 !! wikitext
12156 [[Image:foobar.jpg]]
12157 !! html/php
12158 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12159 </p>
12160 !! html/parsoid
12161 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12162 !! end
12163
12164 !! test
12165 Simple image (using File: namespace, now canonical)
12166 !! wikitext
12167 [[File:Foobar.jpg]]
12168 !! html/php
12169 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12170 </p>
12171 !! html/parsoid
12172 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12173 !! end
12174
12175 !! test
12176 Right-aligned image
12177 !! wikitext
12178 [[File:Foobar.jpg|right]]
12179 !! html/php
12180 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12181
12182 !! html/parsoid
12183 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12184 !! end
12185
12186 !! test
12187 Image with caption
12188 !! wikitext
12189 [[File:Foobar.jpg|right|Caption text]]
12190 !! html/php
12191 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12192
12193 !! html/parsoid
12194 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12195 !! end
12196
12197 !! test
12198 Image with caption, bug 53312 #1
12199 !! wikitext
12200 [[File:Foobar.jpg|right|Caption page stuff]]
12201 !! html/php
12202 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12203
12204 !! html/parsoid
12205 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
12206 !! end
12207
12208 !! test
12209 Image with caption, bug 53312 #2
12210 !! wikitext
12211 [[File:Foobar.jpg|right|Caption page=]]
12212 !! html/php
12213 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12214
12215 !! html/parsoid
12216 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
12217 !! end
12218
12219 !! test
12220 Image with caption, bug 53312 #3
12221 !! wikitext
12222 [[File:Foobar.jpg|right|Caption page=stuff]]
12223 !! html/php
12224 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12225
12226 !! html/parsoid
12227 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
12228 !! end
12229
12230 !! test
12231 Allow empty links in image captions (Bug 60753)
12232 !! options
12233 thumbsize=220
12234 !! wikitext
12235 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12236 [[]]
12237 [[Link2]]
12238 ]]
12239 !! html/php
12240 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
12241
12242 !! html/parsoid
12243 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
12244 [[]]
12245 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12246 </figcaption></figure>
12247 !! end
12248
12249 !! test
12250 Titles in unlinked images (T23454)
12251 !! wikitext
12252 [[File:Foobar.jpg|link=|stuff]]
12253 !! html/php
12254 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12255 </p>
12256 !! end
12257
12258 !! test
12259 Link with empty target
12260 !! wikitext
12261 [[]]
12262 !! html
12263 <p>[[]]
12264 </p>
12265 !! end
12266
12267 !! test
12268 Image with link trail
12269 !! wikitext
12270 Linktrails should not work for images: [[File:Foobar.jpg]]s
12271 !! html/php
12272 <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
12273 </p>
12274 !! html/parsoid
12275 <p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p>
12276 !! end
12277
12278 !! test
12279 Image with empty attribute
12280 !! options
12281 parsoid=wt2html,wt2wt,html2html
12282 !! wikitext
12283 [[File:Foobar.jpg|right||Caption text]]
12284 !! html/php
12285 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12286
12287 !! html/parsoid
12288 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12289 !! end
12290
12291 !! test
12292 1. Block image with individual attributes from templates
12293 !! wikitext
12294 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12295 !! html/php
12296 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
12297
12298 !! html/parsoid
12299 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12300 !! end
12301
12302 !! test
12303 2. Block Image with individual attributes from templates
12304 !! wikitext
12305 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12306 !! html/php
12307 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
12308
12309 !! html/parsoid
12310 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12311 !! end
12312
12313 !! test
12314 3. Inline image with individual attributes from templates
12315 !! wikitext
12316 [[File:Foobar.jpg|{{echo|50px}}]]
12317 !! html/php
12318 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
12319 </p>
12320 !! html/parsoid
12321 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12322 !! end
12323
12324 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12325 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12326 !! test
12327 Image with multiple attributes from the same template
12328 !! wikitext
12329 [[File:Foobar.jpg|{{image_attribs}}]]
12330 !! html/php
12331 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12332
12333 !! html/parsoid
12334 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12335 !! end
12336
12337 !! test
12338 Image with link tails
12339 !! options
12340 thumbsize=220
12341 !! wikitext
12342 123[[File:Foobar.jpg]]456
12343 123[[File:Foobar.jpg|right]]456
12344 123[[File:Foobar.jpg|thumb]]456
12345 !! html/php
12346 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
12347 </p>
12348 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
12349 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
12350
12351 !! html/php+tidy
12352 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
12353 <p>123</p>
12354 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12355 <p>456 123</p>
12356 <div class="thumb tright">
12357 <div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
12358 <div class="thumbcaption">
12359 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12360 </div>
12361 </div>
12362 </div>
12363 <p>456</p>
12364 !! html/parsoid
12365 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p>
12366 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
12367 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
12368 !! end
12369
12370 !! test
12371 Image with multiple captions -- only last one is accepted
12372 !! wikitext
12373 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12374 !! html/php
12375 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12376
12377 !! html/parsoid
12378 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
12379 !! end
12380
12381 !! test
12382 Image with multiple widths -- use last
12383 !! wikitext
12384 [[File:Foobar.jpg|200px|300px|caption]]
12385 !! html/php
12386 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
12387 </p>
12388 !! html/parsoid
12389 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p>
12390 !! end
12391
12392 !! test
12393 Image with multiple alignments -- use first (bug 48664)
12394 !! options
12395 thumbsize=220
12396 !! wikitext
12397 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12398
12399 [[File:Foobar.jpg|middle|text-top|caption]]
12400 !! html/php
12401 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12402 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
12403 </p>
12404 !! html/parsoid
12405 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12406 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12407 !! end
12408
12409 !! test
12410 Image with width attribute at different positions
12411 !! wikitext
12412 [[File:Foobar.jpg|200px|right|Caption]]
12413 [[File:Foobar.jpg|right|200px|Caption]]
12414 [[File:Foobar.jpg|right|Caption|200px]]
12415 !! html/php
12416 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
12417 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
12418 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
12419
12420 !! html/parsoid
12421 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12422 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12423 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12424 !! end
12425
12426 # a sad bit of backward-compatibility
12427 !! test
12428 Image with size specified with pxpx (bug 13500, 51628)
12429 !! options
12430 parsoid=wt2html,wt2wt,html2html
12431 !! wikitext
12432 [[File:Foobar.jpg|20pxpx]]
12433 [[File:Foobar.jpg|200x20pxpx]]
12434 !! html/php
12435 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
12436 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
12437 </p>
12438 !! html/parsoid
12439 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
12440 !! end
12441
12442 !! test
12443 Image with link parameter, wiki target
12444 !! wikitext
12445 [[File:Foobar.jpg|link=Main Page]]
12446 !! html/php
12447 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12448 </p>
12449 !! html/parsoid
12450 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12451 !! end
12452
12453 # parsoid bug 49293 (part 1)
12454 !! test
12455 Image with link parameter, URL target
12456 !! wikitext
12457 [[File:Foobar.jpg|link=http://example.com/]]
12458 !! html/php
12459 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12460 </p>
12461 !! html/parsoid
12462 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12463 !! end
12464
12465 # parsoid bug 49293 (part 2)
12466 !! test
12467 Image with link parameter, protocol-less URL target
12468 !! wikitext
12469 [[File:Foobar.jpg|link=//example.com/]]
12470 !! html/php
12471 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12472 </p>
12473 !! html/parsoid
12474 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12475 !! end
12476
12477 !! test
12478 Image with link parameter, wgExternalLinkTarget
12479 !! wikitext
12480 [[Image:foobar.jpg|link=http://example.com/]]
12481 !! config
12482 wgExternalLinkTarget='foobar'
12483 !! html
12484 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12485 </p>
12486 !! end
12487
12488 !! test
12489 Image with link parameter, wgNoFollowLinks set to false
12490 !! wikitext
12491 [[Image:foobar.jpg|link=http://example.com/]]
12492 !! config
12493 wgNoFollowLinks=false
12494 !! html
12495 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12496 </p>
12497 !! end
12498
12499 !! test
12500 Image with link parameter, wgNoFollowDomainExceptions
12501 !! wikitext
12502 [[Image:foobar.jpg|link=http://example.com/]]
12503 !! config
12504 wgNoFollowDomainExceptions='example.com'
12505 !! html
12506 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12507 </p>
12508 !! end
12509
12510 !! test
12511 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12512 !! wikitext
12513 [[Image:foobar.jpg|link=http://example.com/|Title]]
12514 !! config
12515 wgExternalLinkTarget='foobar'
12516 !! html
12517 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12518 </p>
12519 !! end
12520
12521 !! test
12522 Image with empty link parameter
12523 !! wikitext
12524 [[File:Foobar.jpg|link=]]
12525 !! html/php
12526 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12527 </p>
12528 !! html/parsoid
12529 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p>
12530 !! end
12531
12532 !! test
12533 Image with link parameter (wiki target) and unnamed parameter
12534 !! wikitext
12535 [[File:Foobar.jpg|link=Main_Page|Title]]
12536 !! html/php
12537 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12538 </p>
12539 !! html/parsoid
12540 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12541 !! end
12542
12543 !! test
12544 Image with link parameter (URL target) and unnamed parameter
12545 !! wikitext
12546 [[File:Foobar.jpg|link=http://example.com/|Title]]
12547 !! html/php
12548 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12549 </p>
12550 !! html/parsoid
12551 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12552 !! end
12553
12554 !! test
12555 Thumbnail image with link parameter
12556 !! options
12557 thumbsize=220
12558 parsoid=wt2html,wt2wt,html2html
12559 !! wikitext
12560 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12561 !! html/php
12562 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12563
12564 !! html/parsoid
12565 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
12566 !! end
12567
12568 !! test
12569 Manually-specified thumbnail image
12570 !! options
12571 thumbsize=220
12572 !! wikitext
12573 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12574 !! html/php
12575 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12576
12577 !! html/parsoid
12578 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12579 !! end
12580
12581 !! test
12582 Manually-specified thumbnail image with explicit link to wiki page
12583 !! options
12584 thumbsize=220
12585 parsoid=wt2html,wt2wt,html2html
12586 !! wikitext
12587 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12588 !! html/php
12589 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12590
12591 !! html/parsoid
12592 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12593 !! end
12594
12595 !! test
12596 Manually-specified thumbnail image with explicit link to url
12597 !! options
12598 thumbsize=220
12599 parsoid=wt2html,wt2wt,html2html
12600 !! wikitext
12601 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12602 !! html/php
12603 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12604
12605 !! html/parsoid
12606 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12607 !! end
12608
12609 !! test
12610 Manually-specified thumbnail image with explicit no link
12611 !! options
12612 thumbsize=220
12613 parsoid=wt2html,wt2wt,html2html
12614 !! wikitext
12615 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12616 !! html/php
12617 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12618
12619 !! html/parsoid
12620 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
12621 !! end
12622
12623 !! test
12624 Manually-specified thumbnail image with explicit link and alt text
12625 !! options
12626 thumbsize=220
12627 parsoid=wt2html,wt2wt,html2html
12628 !! wikitext
12629 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12630 !! html/php
12631 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12632
12633 !! html/parsoid
12634 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12635 !! end
12636
12637 !! test
12638 Image with frame and link
12639 !! options
12640 parsoid=wt2html,wt2wt,html2html
12641 !! wikitext
12642 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12643 !! html/php
12644 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
12645
12646 !! html/parsoid
12647 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
12648 !! end
12649
12650 !! test
12651 Image with frame and link and explicit alt
12652 !! options
12653 parsoid=wt2html,wt2wt,html2html
12654 !! wikitext
12655 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12656 !! html/php
12657 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
12658
12659 !! html/parsoid
12660 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
12661 !! end
12662
12663 !! test
12664 Image with wiki markup in implicit alt
12665 !! options
12666 parsoid=wt2html,wt2wt,html2html
12667 !! wikitext
12668 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12669
12670 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12671 !! html/php
12672 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12673 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12674 </p>
12675 !! html/parsoid
12676 <p><span class="mw-default-size" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;testing '''bold''' in alt&quot;}"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12677 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12678 !! end
12679
12680 !! test
12681 Alt image option should handle most kinds of wikitext without barfing
12682 !! wikitext
12683 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12684 !! html/php
12685 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div>
12686
12687 !! html/parsoid
12688 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
12689 !! end
12690
12691 ###################
12692 # Conflicting image format options.
12693 # First option specified should 'win'.
12694 # All three cases in each test should be identical.
12695
12696 !! test
12697 Image with 'frameless' first.
12698 !! options
12699 parsoid=wt2html,wt2wt,html2html
12700 !! wikitext
12701 [[File:Foobar.jpg|frameless|caption]]
12702
12703 [[File:Foobar.jpg|frameless|frame|caption]]
12704
12705 [[File:Foobar.jpg|frameless|thumb|caption]]
12706 !! html/php
12707 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
12708 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
12709 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
12710 </p>
12711 !! html/parsoid
12712 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12713 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12714 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12715 !! end
12716
12717 !! test
12718 Image with 'frame' first.
12719 !! options
12720 parsoid=wt2html,wt2wt,html2html
12721 !! wikitext
12722 [[File:Foobar.jpg|frame|caption]]
12723 [[File:Foobar.jpg|frame|frameless|caption]]
12724 [[File:Foobar.jpg|frame|thumb|caption]]
12725 !! html/php
12726 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
12727 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
12728 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
12729
12730 !! html/parsoid
12731 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12732 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12733 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12734 !! end
12735
12736 !! test
12737 Image with 'thumb' first.
12738 !! options
12739 parsoid=wt2html,wt2wt,html2html
12740 !! wikitext
12741 [[File:Foobar.jpg|thumb|caption]]
12742 [[File:Foobar.jpg|thumb|frameless|caption]]
12743 [[File:Foobar.jpg|thumb|frame|caption]]
12744 !! html/php
12745 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12746 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12747 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12748
12749 !! html/parsoid
12750 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12751 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12752 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12753 !! end
12754
12755 ###################
12756 # Image sizing.
12757 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12758 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12759 # Foobar has actual size of 1941x220
12760 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12761 # a scalable format.
12762 # 2. Framed images always ignore size options; always render at default size.
12763 # 3. "Unspecified format" and border are the only types which can be
12764 # enlarged.
12765
12766 !! test
12767 Image: "unspecified format" and border enlarge
12768 !! options
12769 parsoid=wt2html,wt2wt,html2html
12770 !! wikitext
12771 [[File:Foobar.jpg|2000px]]
12772
12773 [[File:Foobar.jpg|border|2000px]]
12774 !! html/php
12775 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
12776 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
12777 </p>
12778 !! html/parsoid
12779 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12780 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12781 !! end
12782
12783 !! test
12784 Image: "unspecified format" and border reduce
12785 !! options
12786 parsoid=wt2html,wt2wt,html2html
12787 !! wikitext
12788 [[File:Foobar.jpg|1000px]]
12789
12790 [[File:Foobar.jpg|border|1000px]]
12791 !! html/php
12792 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
12793 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
12794 </p>
12795 !! html/parsoid
12796 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12797 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12798 !! end
12799
12800 !! test
12801 Image: thumbs reduce
12802 !! options
12803 parsoid=wt2html,wt2wt,html2html
12804 !! wikitext
12805 [[File:Foobar.jpg|thumb|50px]]
12806 !! html/php
12807 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
12808
12809 !! html/parsoid
12810 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
12811 !! end
12812
12813 !! test
12814 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12815 !! options
12816 parsoid=wt2html,wt2wt,html2html
12817 !! wikitext
12818 [[File:Foobar.jpg|thumb|2000px]]
12819
12820 [[File:Foobar.svg|thumb|2000px]]
12821 !! html/php
12822 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
12823 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
12824
12825 !! html/parsoid
12826 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12827 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
12828 !! end
12829
12830 !! test
12831 Image: frameless can reduce in size
12832 !! options
12833 parsoid=wt2html,wt2wt,html2html
12834 !! wikitext
12835 [[File:Foobar.jpg|frameless|50px]]
12836 !! html/php
12837 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
12838 </p>
12839 !! html/parsoid
12840 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12841 !! end
12842
12843 !! test
12844 Image: bitmap frameless can't be enlarged past original size, but vector can
12845 !! options
12846 parsoid=wt2html,wt2wt,html2html
12847 !! wikitext
12848 [[File:Foobar.jpg|frameless|2000px]]
12849
12850 [[File:Foobar.svg|frameless|2000px]]
12851 !! html/php
12852 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12853 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
12854 </p>
12855 !! html/parsoid
12856 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12857 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
12858 !! end
12859
12860 !! test
12861 Image: framed images are always unscaled.
12862 !! options
12863 parsoid=wt2html,wt2wt,html2html
12864 !! wikitext
12865 [[File:Foobar.jpg|frame]]
12866
12867 [[File:Foobar.jpg|frame|50px]]
12868
12869 [[File:Foobar.jpg|frame|50x50px]]
12870
12871 [[File:Foobar.jpg|frame|2000px]]
12872 !! html/php
12873 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
12874 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
12875 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
12876 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
12877
12878 !! html/parsoid
12879 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12880 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12881 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12882 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12883 !! end
12884
12885 ###################
12886
12887 !! test
12888 Link to image page- image page normally doesn't exists, hence edit link
12889 Add test with existing image page
12890 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12891 !! wikitext
12892 [[:Image:test]]
12893 !! html
12894 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
12895 </p>
12896 !! end
12897
12898 !! test
12899 bug 18784 Link to non-existent image page with caption should use caption as link text
12900 !! wikitext
12901 [[:Image:test|caption]]
12902 !! html
12903 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
12904 </p>
12905 !! end
12906
12907 !! test
12908 Frameless image caption with a free URL
12909 !! wikitext
12910 [[File:Foobar.jpg|http://example.com]]
12911 !! html/php
12912 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12913 </p>
12914 !! html/parsoid
12915 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"http://example.com"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12916 !! end
12917
12918 !! test
12919 Thumbnail image caption with a free URL
12920 !! options
12921 thumbsize=220
12922 !! wikitext
12923 [[File:Foobar.jpg|thumb|http://example.com]]
12924 !! html/php
12925 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
12926
12927 !! html/parsoid
12928 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12929 !! end
12930
12931 !! test
12932 Thumbnail image caption with a free URL and explicit alt
12933 !! options
12934 thumbsize=220
12935 parsoid=wt2html,wt2wt,html2html
12936 !! wikitext
12937 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12938 !! html/php
12939 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
12940
12941 !! html/parsoid
12942 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12943 !! end
12944
12945 !! test
12946 SVG thumbnails with no language set
12947 !! options
12948 !! wikitext
12949 [[File:Foobar.svg|thumb|caption]]
12950 !! html/php
12951 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12952
12953 !! html/parsoid
12954 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12955 !! end
12956
12957 !! test
12958 SVG thumbnails with language de
12959 !! options
12960 parsoid=wt2html,wt2wt,html2html
12961 !! wikitext
12962 [[File:Foobar.svg|thumb|caption|lang=de]]
12963 !! html/php
12964 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12965
12966 !! html/parsoid
12967 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12968 !! end
12969
12970 !! test
12971 SVG thumbnails with invalid language code
12972 !! options
12973 parsoid=wt2html,wt2wt,html2html
12974 !! wikitext
12975 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12976 !! html/php
12977 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid.language.code</div></div></div>
12978
12979 !! html/parsoid
12980 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
12981 !! end
12982
12983 !! test
12984 BUG 1887: A ISBN with a thumbnail
12985 !! wikitext
12986 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12987 !! html/php
12988 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
12989
12990 !! html/parsoid
12991 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
12992 !! end
12993
12994 !! test
12995 BUG 1887: A RFC with a thumbnail
12996 !! wikitext
12997 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12998 !! html/php
12999 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
13000
13001 !! html/parsoid
13002 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
13003 !! end
13004
13005 !! test
13006 BUG 1887: A mailto link with a thumbnail
13007 !! wikitext
13008 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13009 !! html/php
13010 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
13011
13012 !! html/parsoid
13013 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
13014 !! end
13015
13016 # Pending resolution to bug 368
13017 !! test
13018 BUG 648: Frameless image caption with a link
13019 !! wikitext
13020 [[File:Foobar.jpg|text with a [[link]] in it]]
13021 !! html/php
13022 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13023 </p>
13024 !! html/parsoid
13025 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13026 !! end
13027
13028 !! test
13029 BUG 648: Frameless image caption with a link (suffix)
13030 !! wikitext
13031 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13032 !! html/php
13033 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13034 </p>
13035 !! html/parsoid
13036 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13037 !! end
13038
13039 !! test
13040 BUG 648: Frameless image caption with an interwiki link
13041 !! wikitext
13042 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13043 !! html/php
13044 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13045 </p>
13046 !! html/parsoid
13047 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13048 !! end
13049
13050 !! test
13051 BUG 648: Frameless image caption with a piped interwiki link
13052 !! wikitext
13053 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13054 !! html/php
13055 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13056 </p>
13057 !! html/parsoid
13058 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13059 !! end
13060
13061 !! test
13062 Escape HTML special chars in image alt text
13063 !! wikitext
13064 [[File:Foobar.jpg|& < > "]]
13065 !! html/php
13066 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13067 </p>
13068 !! html/parsoid
13069 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp; &lt; > \""}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13070 !! end
13071
13072 !! test
13073 BUG 499: Alt text should have &#1234;, not &amp;1234;
13074 !! wikitext
13075 [[File:Foobar.jpg|&#9792;]]
13076 !! html/php
13077 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13078 </p>
13079 !! html/parsoid
13080 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;#9792;"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13081 !! end
13082
13083 !! test
13084 Broken image caption with link
13085 !! options
13086 parsoid=wt2html,wt2wt,html2html
13087 !! wikitext
13088 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13089 !! html/php
13090 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
13091 </p>
13092 !! html/parsoid
13093 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
13094 !! end
13095
13096 !! test
13097 Image caption containing another image
13098 !! wikitext
13099 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13100 !! html/php
13101 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
13102
13103 !! html/parsoid
13104 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure>
13105 !! end
13106
13107 !! test
13108 Image: caption containing a newline
13109 !! wikitext
13110 [[File:Foobar.jpg|This
13111 *is some text]]
13112 !! html/php
13113 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13114 </p>
13115 !! html/parsoid
13116 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13117 !!end
13118
13119 !!test
13120 Image: caption containing leading space
13121 (The leading space should not trigger nowiki escaping in wt2wt mode)
13122 !! wikitext
13123 [[File:Foobar.jpg|thumb| bar]]
13124 !! html/php
13125 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
13126
13127 !! html/parsoid
13128 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
13129 !!end
13130
13131 !! test
13132 Image: caption containing a table
13133 !! options
13134 parsoid=wt2html,wt2wt,html2html
13135 !! wikitext
13136 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13137 {|
13138 ! Foo !! Bar
13139 |-
13140 | Foo1 || Bar1
13141 |}
13142 and some more text.]]
13143 !! html/php
13144 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
13145
13146 !! html/parsoid
13147 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
13148 <table>
13149 <tbody>
13150 <tr><th>Foo </th><th>Bar</th></tr>
13151 <tr>
13152 <td>Foo1 </td>
13153 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13154 !! end
13155
13156 !! test
13157 Bug 3090: External links other than http: in image captions
13158 !! wikitext
13159 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13160 !! html/php
13161 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
13162
13163 !! html/parsoid
13164 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
13165 !! end
13166
13167 !! test
13168 Custom class
13169 !! options
13170 parsoid=wt2html,wt2wt,html2html
13171 !! wikitext
13172 [[Image:foobar.jpg|a|class=b]]
13173 !! html/php
13174 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
13175 </p>
13176 !! html/parsoid
13177 <p><span class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13178 !! end
13179
13180 !! test
13181 Localized image handling (1).
13182 !! options
13183 parsoid=wt2html,wt2wt,html2html
13184 language=es
13185 !! wikitext
13186 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13187 !! html/php
13188 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13189
13190 !! html/parsoid
13191 <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13192 !! end
13193
13194 !! test
13195 Localized image handling (2).
13196 !! options
13197 thumbsize=220
13198 parsoid=wt2html,wt2wt,html2html
13199 language=es
13200 !! wikitext
13201 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13202 !! html/php
13203 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
13204
13205 !! html/parsoid
13206 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13207 !! end
13208
13209 !! test
13210 "border", "frameless" and "class" attributes on an image.
13211 !! options
13212 thumbsize=220
13213 parsoid=wt2html,wt2wt,html2html
13214 !! wikitext
13215 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13216 !! html/php
13217 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
13218 </p>
13219 !! html/parsoid
13220 <p><span class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13221 !! end
13222
13223 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13224 !! test
13225 Invalid image attributes (bug 62500)
13226 !! options
13227 thumbsize=220
13228 parsoid=wt2html,wt2wt,html2html
13229 !! wikitext
13230 [[File:Foobar.jpg|thumb|float|left|caption]]
13231
13232 [[File:Foobar.jpg|thumb|righ|caption]]
13233
13234 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13235 !! html/php
13236 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13237 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13238 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13239
13240 !! html/parsoid
13241 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13242 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13243 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13244 !! end
13245
13246 !! article
13247 File:Barfoo.jpg
13248 !! text
13249 #REDIRECT [[File:Barfoo.jpg]]
13250 !! endarticle
13251
13252 # FIXME: Parsoid should run this test -- but we'd need to teach the
13253 # mockAPI about the redirected Barfoo.jpg image.
13254 !! test
13255 Redirected image
13256 !! wikitext
13257 [[Image:Barfoo.jpg]]
13258 !! html/php
13259 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13260 </p>
13261 !! end
13262
13263 !! test
13264 Missing image with uploads disabled
13265 !! options
13266 wgEnableUploads=0
13267 !! wikitext
13268 [[File:Foobaz.jpg]]
13269 !! html/php
13270 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13271 </p>
13272 !! html/parsoid
13273 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
13274 !! end
13275
13276 # Parsoid-specific testing for images
13277 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13278 # Currently imperfect due to a flaw in the Parsoid testrunner
13279 # Work in progress
13280 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13281 # image tests.
13282
13283 !! test
13284 Parsoid-specific image handling - simple image with size and middle alignment
13285 !! wikitext
13286 [[File:Foobar.jpg|middle|50px]]
13287 !! html/parsoid
13288 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13289 !! end
13290
13291 !! test
13292 Parsoid-specific image handling - simple image with size, middle alignment,
13293 non-standard namespace alias
13294 !! options
13295 parsoid=wt2wt,wt2html,html2html
13296 !! wikitext
13297 [[Image:Foobar.jpg|middle|50px]]
13298 !! html/parsoid
13299 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13300 !! end
13301
13302 !! test
13303 Parsoid-specific image handling - simple image with size and middle alignment
13304 (existing content)
13305 !! wikitext
13306 [[File:Foobar.jpg|50px|middle]]
13307 !! html/parsoid
13308 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13309 !! end
13310
13311 !! test
13312 Parsoid-specific image handling - simple image with size and middle alignment
13313 and non-standard namespace name
13314 !! options
13315 parsoid=wt2html,wt2wt,html2html
13316 !! wikitext
13317 [[Image:Foobar.jpg|50px|middle]]
13318 !! html/parsoid
13319 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13320 !! end
13321
13322 !! test
13323 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13324 !! wikitext
13325 [[File:Foobar.jpg|500x10px|baseline|caption]]
13326 !! html/parsoid
13327 <p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13328 !! end
13329
13330 !! test
13331 Parsoid-specific image handling - simple image with border and size spec
13332 !! wikitext
13333 [[File:Foobar.jpg|50px|border|caption]]
13334 !! html/parsoid
13335 <p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13336 !! end
13337
13338 !! test
13339 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13340 !! wikitext
13341 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13342 !! html/parsoid
13343 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
13344 !! end
13345
13346 !! test
13347 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13348 (existing content)
13349 !! wikitext
13350 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13351 !! html/parsoid
13352 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
13353 !! end
13354
13355 !! test
13356 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13357 !! wikitext
13358 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13359 !! html/parsoid
13360 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
13361 !! end
13362
13363 !! test
13364 Parsoid-specific image handling - thumbnail with specific size, halign,
13365 valign, and caption (existing content)
13366 !! wikitext
13367 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13368 !! html/parsoid
13369 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
13370 !! end
13371
13372 !! test
13373 Parsoid-specific image handling - framed image with specific size and caption
13374 (size is ignored)
13375 !! options
13376 parsoid=wt2html,wt2wt,html2html
13377 !! wikitext
13378 [[File:Foobar.jpg|frame|500x50px|caption]]
13379 !! html/parsoid
13380 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13381 !! end
13382
13383 !! test
13384 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13385 (size is ignored)
13386 !! options
13387 parsoid=wt2html,wt2wt,html2html
13388 !! wikitext
13389 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13390 !! html/parsoid
13391 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13392 !! end
13393
13394 !! test
13395 Parsoid-specific image handling - frameless image with specific size, border, and caption
13396 !! wikitext
13397 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13398 !! html/parsoid
13399 <p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13400 !! end
13401
13402 !! test
13403 Parsoid-specific image handling - simple image with a formatted caption
13404 !! wikitext
13405 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13406 !! html/parsoid
13407 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13408 !! end
13409
13410 !! test
13411 Parsoid-specific image handling - caption with a template in it
13412 !! wikitext
13413 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13414 !! html/parsoid
13415 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
13416 !! end
13417
13418 !! test
13419 Parsoid-specific image handling - caption with unbalanced tags in it
13420 !! options
13421 parsoid=wt2html,wt2wt,html2html
13422 !! wikitext
13423 foo
13424 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13425 bar
13426 !! html/parsoid
13427 <p>foo</p>
13428 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
13429 <p>bar</p>
13430 !! end
13431
13432 !! test
13433 Parsoid-specific image handling - empty caption (1)
13434 !! options
13435 parsoid=wt2html,wt2wt
13436 !! wikitext
13437 [[File:Foobar.jpg|thumb|]]
13438 !! html/parsoid
13439 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
13440 !! end
13441
13442 # empty captions don't get serialized unless we're in the "round trip" case
13443 !! test
13444 Parsoid-specific image handling - empty caption (2)
13445 !! options
13446 parsoid=html2wt
13447 !! html/parsoid
13448 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13449 <a href="./File:Foobar.jpg">
13450 <img resource="./File:Foobar.jpg"
13451 src="//example.com/images/3/3a/Foobar.jpg"
13452 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13453 height="25" width="220"/>
13454 </a>
13455 <figcaption></figcaption>
13456 </figure>
13457 !! wikitext
13458 [[File:Foobar.jpg|thumb]]
13459 !! end
13460
13461 !! test
13462 Parsoid-specific image handling - whitespace caption
13463 !! wikitext
13464 [[File:Foobar.jpg|thumb| ]]
13465 !! html/parsoid
13466 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
13467 !! end
13468
13469 !! test
13470 Parsoid-specific image handling - lang option
13471 !! wikitext
13472 foo
13473 [[File:Foobar.svg|lang=de|caption]]
13474 bar
13475 !! html/parsoid
13476 <p>foo
13477 <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span>
13478 bar</p>
13479 !! end
13480
13481
13482 ###
13483 ### Subpages
13484 ###
13485 !! article
13486 Subpage test/subpage
13487 !! text
13488 foo
13489 !! endarticle
13490
13491 !! test
13492 Subpage link
13493 !! options
13494 subpage title=[[Subpage test]]
13495 !! wikitext
13496 [[/subpage]]
13497 !! html
13498 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13499 </p>
13500 !! end
13501
13502 !! test
13503 Subpage noslash link
13504 !! options
13505 subpage title=[[Subpage test]]
13506 !! wikitext
13507 [[/subpage/]]
13508 !! html
13509 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13510 </p>
13511 !! end
13512
13513 !! article
13514 Subpage test/1/2/subpage
13515 !! text
13516 blah
13517 !! endarticle
13518
13519 !! test
13520 Relative subpage noslash link
13521 !! options
13522 parsoid=wt2wt,wt2html,html2html
13523 subpage title=[[Subpage test/1/2/3/4]]
13524 !! wikitext
13525 [[../../subpage/]]
13526
13527 [[../../subpage]]
13528 !! html/php
13529 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13530 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13531 </p>
13532 !! html/parsoid
13533 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13534 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13535 !! end
13536
13537 !! test
13538 Parsoid: dot-slash prefixed wikilinks
13539 !! wikitext
13540 [[./foo]]
13541
13542 [[././bar]]
13543
13544 [[././baz/]]
13545 !! html/php
13546 <p>[[./foo]]
13547 </p><p>[[././bar]]
13548 </p><p>[[././baz/]]
13549 </p>
13550 !! html/parsoid
13551 <p>[[./foo]]
13552 </p><p>[[././bar]]
13553 </p><p>[[././baz/]]
13554 </p>
13555 !! end
13556
13557 !! test
13558 Render invalid page names as plain text (bug 51090)
13559 !! wikitext
13560 [[./../foo|bar]]
13561 [[foo�|bar]]
13562 [[foo/.|bar]]
13563 [[foo/..|bar]]
13564 [[foo~~~bar]]
13565 [[foo>bar]]
13566 [[foo[bar]]
13567 [[.]]
13568 [[..]]
13569 [[foo././bar]]
13570
13571 [[{{echo|./../foo}}|bar]]
13572 [[{{echo|foo/.}}|bar]]
13573 [[{{echo|foo/..}}|bar]]
13574 [[{{echo|foo~~~~bar}}]]
13575 [[{{echo|foo>bar}}]]
13576 [[{{echo|foo././bar}}]]
13577 [[{{echo|foo{bar}}]]
13578 [[{{echo|foo}bar}}]]
13579 [[{{echo|foo[bar}}]]
13580 [[{{echo|foo]bar}}]]
13581 [[{{echo|foo<bar}}]]
13582 !!html/php
13583 <p>[[./../foo|bar]]
13584 [[foo�|bar]]
13585 [[foo/.|bar]]
13586 [[foo/..|bar]]
13587 [[foo~~~bar]]
13588 [[foo&gt;bar]]
13589 [[foo[bar]]
13590 [[.]]
13591 [[..]]
13592 [[foo././bar]]
13593 </p><p>[[./../foo|bar]]
13594 [[foo/.|bar]]
13595 [[foo/..|bar]]
13596 [[foo~~~~bar]]
13597 [[foo&gt;bar]]
13598 [[foo././bar]]
13599 [[foo{bar]]
13600 [[foo}bar]]
13601 [[foo[bar]]
13602 [[foo]bar]]
13603 [[foo&lt;bar]]
13604 </p>
13605 !!html/parsoid
13606 <p>[[./../foo|bar]]
13607 [[foo�|bar]]
13608 [[foo/.|bar]]
13609 [[foo/..|bar]]
13610 [[foo~~~bar]]
13611 [[foo>bar]]
13612 [[foo[bar]]
13613 [[.]]
13614 [[..]]
13615 [[foo././bar]]</p>
13616
13617 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13618 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13619 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13620 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13621 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13622 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13623 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13624 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13625 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13626 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13627 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
13628 !!end
13629
13630 !! test
13631 Disabled subpages
13632 !! wikitext
13633 [[/subpage]]
13634 !! html
13635 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13636 </p>
13637 !! end
13638
13639 !! test
13640 BUG 561: {{/Subpage}}
13641 !! options
13642 subpage title=[[Page]]
13643 !! wikitext
13644 {{/Subpage}}
13645 !! html
13646 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
13647 </p>
13648 !! end
13649
13650 ###
13651 ### Categories
13652 ###
13653 !! article
13654 Category:MediaWiki User's Guide
13655 !! text
13656 blah
13657 !! endarticle
13658
13659 !! test
13660 Link to category
13661 !! wikitext
13662 [[:Category:MediaWiki User's Guide]]
13663 !! html
13664 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13665 </p>
13666 !! end
13667
13668 !! test
13669 Simple category
13670 !! options
13671 cat
13672 !! wikitext
13673 [[Category:MediaWiki User's Guide]]
13674 !! html
13675 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13676 !! end
13677
13678 !! test
13679 PAGESINCATEGORY invalid title fatal (r33546 fix)
13680 !! wikitext
13681 {{PAGESINCATEGORY:<bogus>}}
13682 !! html
13683 <p>0
13684 </p>
13685 !! end
13686
13687 !! test
13688 Category with different sort key
13689 !! options
13690 cat
13691 !! wikitext
13692 [[Category:MediaWiki User's Guide|Foo]]
13693 !! html
13694 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13695 !! end
13696
13697 !! test
13698 Category with identical sort key
13699 !! options
13700 cat
13701 !! wikitext
13702 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13703 !! html
13704 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13705 !! end
13706
13707 !! test
13708 Category with empty sort key
13709 !! options
13710 cat
13711 pst
13712 !! wikitext
13713 [[Category:MediaWiki User's Guide|]]
13714 !! html
13715 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13716 !! end
13717
13718 !! test
13719 Category with empty sort key and parentheses
13720 !! options
13721 cat
13722 pst
13723 !! wikitext
13724 [[Category:Foo (bar)|]]
13725 !! html
13726 [[Category:Foo (bar)|Foo]]
13727 !! end
13728
13729 !! test
13730 Category with link tail
13731 !! options
13732 cat
13733 pst
13734 !! wikitext
13735 123[[Category:Foo]]456
13736 !! html
13737 123[[Category:Foo]]456
13738 !! end
13739
13740 !! test
13741 Category with template
13742 !! options
13743 cat
13744 pst
13745 !! wikitext
13746 [[Category:{{echo|Foo}}]]
13747 !! html
13748 [[Category:{{echo|Foo}}]]
13749 !! end
13750
13751 !! test
13752 Category with template in sort key
13753 !! options
13754 cat
13755 pst
13756 !! wikitext
13757 [[Category:Foo|{{echo|Bar}}]]
13758 !! html
13759 [[Category:Foo|{{echo|Bar}}]]
13760 !! end
13761
13762 !! test
13763 Category with template in sort key and title
13764 !! options
13765 cat
13766 pst
13767 !! wikitext
13768 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13769 !! html
13770 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13771 !! end
13772
13773 !! test
13774 Category / paragraph interactions
13775 !! wikitext
13776 Foo [[Category:Baz]] Bar
13777
13778 Foo [[Category:Baz]]
13779 Bar
13780
13781 Foo
13782 [[Category:Baz]]
13783 Bar
13784
13785 Foo
13786 [[Category:Baz]] Bar
13787
13788 Foo
13789 [[Category:Baz]]
13790 [[Category:Baz]]
13791 [[Category:Baz]]
13792 Bar
13793
13794 [[Category:Baz]]
13795 [[Category:Baz]]
13796 [[Category:Baz]]
13797
13798 [[Category:Baz]]
13799 {{echo|[[Category:Baz]]}}
13800 [[Category:Baz]]
13801 !! html
13802 <p>Foo Bar
13803 </p><p>Foo
13804 Bar
13805 </p><p>Foo
13806 Bar
13807 </p><p>Foo Bar
13808 </p><p>Foo
13809 Bar
13810 </p>
13811 !! end
13812
13813 ## The whitespace on the empty line is part of the test. Please do not delete
13814 !! test
13815 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13816 !! options
13817 parsoid=wt2html,wt2wt
13818 !! wikitext
13819 This
13820
13821 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
13822
13823 {{echo|[[Category:Foo]] and so should this!}}
13824 !! html
13825 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
13826 </p>
13827 !! html/parsoid
13828 <p>This
13829
13830 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
13831
13832 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
13833 !! end
13834
13835 ## Parsoid will not try to wt2wt this while preserving newlines because
13836 ## it suppresses excess newlines within list items -- and we don't want to
13837 ## introduce a special case just for categories, which is, in reality somewhat
13838 ## odd behavior -- categories are unlikely to be used in list items like this
13839 ## in top-level pages and are only likely to show up in template-generated
13840 ## list items where this RT-ing is a non-issue.
13841 ##
13842 ## The whitespace on the empty line is part of the test. Please do not delete
13843 !! test
13844 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13845 !! options
13846 parsoid=wt2html
13847 !! wikitext
13848 * This
13849
13850 [[Category:Foo]] and this should be part of the same list item
13851 * So should this
13852
13853 {{echo|[[Category:Foo]] and this should be part of the same list item}}
13854 !! html
13855 <ul><li>This and this should be part of the same list item</li>
13856 <li>So should this and this should be part of the same list item</li></ul>
13857 !! html/parsoid
13858 <ul>
13859 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
13860 <li>So should this <link rel="mw:PageProp/Category" href="Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
13861 </ul>
13862 !! end
13863
13864 ## Newlines and categories that follow the last item of a list
13865 ## are treated differently because this (list followed by categories)
13866 ## is an extremely common pattern on wikis.
13867 !! test
13868 3. Categories and newlines: newline suppression for last list item should RT properly
13869 !! wikitext
13870 * a
13871 * b
13872
13873 [[Category:Foo]]
13874
13875 [[Category:Bar]]
13876 [[Category:Baz]]
13877 !! html/parsoid
13878 <ul><li> a</li>
13879 <li> b</li></ul>
13880
13881 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13882
13883 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13884 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13885 !! end
13886
13887 !! test
13888 4. Categories and newlines: newline suppression for last list item should RT properly
13889 !! wikitext
13890 * a
13891 **** b
13892
13893 [[Category:Foo]]
13894 !! html/parsoid
13895 <ul><li> a
13896 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
13897
13898 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13899 !! end
13900
13901 ## only wt2html for this to make sure the algo only applies to the rightmost path
13902 !! test
13903 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
13904 !! options
13905 parsoid=wt2html
13906 !! wikitext
13907 * a
13908 ** b
13909 [[Category:Foo]]
13910 * c
13911 ** d
13912 [[Category:Foo]]
13913 !! html/parsoid
13914 <ul><li> a
13915 <ul><li> b
13916 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
13917 <li> c
13918 <ul><li> d</li></ul></li></ul>
13919 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13920 !! end
13921
13922 !! test
13923 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
13924 !! wikitext
13925 * a [[Category:Foo]]
13926 !! html/parsoid
13927 <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
13928 !! end
13929
13930 # This test also demonstrates because of newline+category tunneling
13931 # through the list hander, template wrapping doesn't expand to the
13932 # containing list when the list item swallows the category.
13933 !! test
13934 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
13935 !! wikitext
13936 * {{echo|a
13937 [[Category:Foo]]}}
13938 !! html/parsoid
13939 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a</span><span about="#mwt1">
13940 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
13941 !! end
13942
13943 !! test
13944 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
13945 !! wikitext
13946 * a
13947
13948 {{echo|[[Category:Foo]]
13949 [[Category:Bar]]}}
13950 [[Category:Baz]]
13951 !! html/parsoid
13952 <ul><li> a</li></ul>
13953
13954 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
13955 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13956 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13957 !! end
13958
13959 !! test
13960 Parsoid: Serialize link to category page with colon escape
13961 !! options
13962 parsoid
13963 !! wikitext
13964
13965 [[:Category:Foo]]
13966 [[:Category:Foo|Bar]]
13967 !! html
13968 <p>
13969 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13970 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13971 </p>
13972 !! end
13973
13974 # html2wt localizes the "Category" namespace.
13975 # XXX the <link> element needs an empty data-parsoid attribute, or
13976 # else the html2html test fails because spaces are inserted.
13977 !! test
13978 Link prefix/suffixes aren't applied to category links
13979 !! options
13980 parsoid=wt2html,wt2wt,html2html
13981 language=is
13982 !! wikitext
13983 x[[Category:Foo]]y
13984 !! html/php
13985 <p>xy
13986 </p>
13987 !! html/parsoid
13988 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
13989 !! end
13990
13991 !! test
13992 Parsoid: Serialize link to file page with colon escape
13993 !! options
13994 parsoid
13995 !! wikitext
13996
13997 [[:File:Foo.png]]
13998 [[:File:Foo.png|Bar]]
13999 !! html
14000 <p>
14001 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14002 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14003 </p>
14004 !! end
14005
14006 !! test
14007 Parsoid: Serialize a genuine category link without colon escape
14008 !! options
14009 parsoid
14010 !! wikitext
14011 [[Category:Foo]]
14012 [[Category:Foo|Bar]]
14013 !! html
14014 <link rel="mw:PageProp/Category" href="Category:Foo">
14015 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
14016 !! end
14017
14018 !! test
14019 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14020 !! options
14021 parsoid=html2wt
14022 !! html
14023 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14024 !! wikitext
14025 [[Category:Toxine bactérienne]]
14026 !! end
14027
14028 !! test
14029 Parsoid: Defaultsort
14030 !! wikitext
14031 {{DEFAULTSORT:Foo}}
14032 !! html/parsoid
14033 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14034 !! end
14035
14036 !! test
14037 Parsoid: Defaultsort (template-generated)
14038 !! wikitext
14039 {{{{echo|DEFAULTSORT}}:Foo}}
14040 !! html/parsoid
14041 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14042 !! end
14043
14044 ###
14045 ### Inter-language links
14046 ###
14047 !! test
14048 Interlanguage links
14049 !! options
14050 ill
14051 !! wikitext
14052 [[es:Alimento]]
14053 [[fr:Nourriture]]
14054 [[zh:食品]]
14055 !! html/php
14056 es:Alimento fr:Nourriture zh:食品
14057 !! html/parsoid
14058 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14059 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14060 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14061 !! end
14062
14063 !! test
14064 Duplicate interlanguage links (bug 24502)
14065 !! options
14066 ill
14067 !! wikitext
14068 [[es:1]]
14069 [[es:2]]
14070 [[fr:1]]
14071 [[fr:2]]
14072 !! html/php
14073 es:1 fr:1
14074 !! html/parsoid
14075 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14076 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14077 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14078 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14079 !! end
14080
14081 ###
14082 ### Sections
14083 ###
14084 !! test
14085 Basic section headings
14086 !! wikitext
14087 == Headline 1 ==
14088 Some text
14089
14090 ==Headline 2==
14091 More
14092 ===Smaller headline===
14093 Blah blah
14094 !! html
14095 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14096 <p>Some text
14097 </p>
14098 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14099 <p>More
14100 </p>
14101 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14102 <p>Blah blah
14103 </p>
14104 !! end
14105
14106 !! test
14107 Section headings with TOC
14108 !! wikitext
14109 == Headline 1 ==
14110 === Subheadline 1 ===
14111 ===== Skipping a level =====
14112 ====== Skipping a level ======
14113
14114 == Headline 2 ==
14115 Some text
14116 ===Another headline===
14117 !! html
14118 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14119 <ul>
14120 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14121 <ul>
14122 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14123 <ul>
14124 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
14125 <ul>
14126 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
14127 </ul>
14128 </li>
14129 </ul>
14130 </li>
14131 </ul>
14132 </li>
14133 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14134 <ul>
14135 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14136 </ul>
14137 </li>
14138 </ul>
14139 </div>
14140
14141 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14142 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14143 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
14144 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
14145 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14146 <p>Some text
14147 </p>
14148 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14149
14150 !! end
14151
14152 !! test
14153 TOC anchors don't collide
14154 !! wikitext
14155 __FORCETOC__
14156 == Headline 2 ==
14157 == Headline ==
14158 == Headline 2 ==
14159 == Headline ==
14160 !! html/php
14161 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14162 <ul>
14163 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14164 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14165 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14166 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14167 </ul>
14168 </div>
14169
14170 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14171 <h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14172 <h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14173 <h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14174
14175 !! end
14176
14177 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14178 !! test
14179 Handling of sections up to level 6 and beyond
14180 !! wikitext
14181 = Level 1 Heading=
14182 == Level 2 Heading==
14183 === Level 3 Heading===
14184 ==== Level 4 Heading====
14185 ===== Level 5 Heading=====
14186 ====== Level 6 Heading======
14187 ======= Level 7 Heading=======
14188 ======== Level 8 Heading========
14189 ========= Level 9 Heading=========
14190 ========== Level 10 Heading==========
14191 !! html
14192 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14193 <ul>
14194 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14195 <ul>
14196 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
14197 <ul>
14198 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
14199 <ul>
14200 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
14201 <ul>
14202 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
14203 <ul>
14204 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
14205 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
14206 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
14207 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
14208 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
14209 </ul>
14210 </li>
14211 </ul>
14212 </li>
14213 </ul>
14214 </li>
14215 </ul>
14216 </li>
14217 </ul>
14218 </li>
14219 </ul>
14220 </div>
14221
14222 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
14223 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14224 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14225 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
14226 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
14227 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
14228 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
14229 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
14230 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
14231 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
14232
14233 !! end
14234
14235 !! test
14236 TOC regression (T11764)
14237 !! wikitext
14238 == title 1 ==
14239 === title 1.1 ===
14240 ==== title 1.1.1 ====
14241 === title 1.2 ===
14242 == title 2 ==
14243 === title 2.1 ===
14244 !! html
14245 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14246 <ul>
14247 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14248 <ul>
14249 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
14250 <ul>
14251 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
14252 </ul>
14253 </li>
14254 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
14255 </ul>
14256 </li>
14257 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14258 <ul>
14259 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
14260 </ul>
14261 </li>
14262 </ul>
14263 </div>
14264
14265 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14266 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14267 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
14268 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14269 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14270 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14271
14272 !! end
14273
14274 !! test
14275 TOC for heading containing <span id="..."></span> (T96153)
14276 !! wikitext
14277 __FORCETOC__
14278 ==<span id="old-anchor"></span>New title==
14279 !! html/php
14280 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14281 <ul>
14282 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14283 </ul>
14284 </div>
14285
14286 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14287
14288 !! end
14289
14290 !! test
14291 TOC with wgMaxTocLevel=3 (bug 6204)
14292 !! options
14293 wgMaxTocLevel=3
14294 !! wikitext
14295 == title 1 ==
14296 === title 1.1 ===
14297 ==== title 1.1.1 ====
14298 === title 1.2 ===
14299 == title 2 ==
14300 === title 2.1 ===
14301 !! html
14302 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14303 <ul>
14304 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14305 <ul>
14306 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
14307 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
14308 </ul>
14309 </li>
14310 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14311 <ul>
14312 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
14313 </ul>
14314 </li>
14315 </ul>
14316 </div>
14317
14318 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14319 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14320 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
14321 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14322 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14323 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14324
14325 !! end
14326
14327 !! test
14328 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14329 !! options
14330 wgMaxTocLevel=3
14331 !! wikitext
14332 ==Section 1==
14333 ===Section 1.1===
14334 ====Section 1.1.1====
14335 ====Section 1.1.1.1====
14336 ==Section 2==
14337 !! html
14338 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14339 <ul>
14340 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14341 <ul>
14342 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
14343 </ul>
14344 </li>
14345 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14346 </ul>
14347 </div>
14348
14349 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14350 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14351 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
14352 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
14353 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14354
14355 !! end
14356
14357
14358 !! test
14359 Resolving duplicate section names
14360 !! wikitext
14361 == Foo bar ==
14362 == Foo bar ==
14363 !! html
14364 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14365 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14366
14367 !! end
14368
14369 !! test
14370 Resolving duplicate section names with differing case (bug 10721)
14371 !! wikitext
14372 == Foo bar ==
14373 == Foo Bar ==
14374 !! html
14375 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14376 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14377
14378 !! end
14379
14380 !! article
14381 Template:sections
14382 !! text
14383 ===Section 1===
14384 ==Section 2==
14385 !! endarticle
14386
14387 !! test
14388 Template with sections, __NOTOC__
14389 !! wikitext
14390 __NOTOC__
14391 ==Section 0==
14392 {{sections}}
14393 ==Section 4==
14394 !! html
14395 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14396 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14397 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14398 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14399
14400 !! end
14401
14402 !! test
14403 __NOEDITSECTION__ keyword
14404 !! wikitext
14405 __NOEDITSECTION__
14406 ==Section 1==
14407 ==Section 2==
14408 !! html
14409 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14410 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14411
14412 !! end
14413
14414 !! test
14415 Link inside a section heading
14416 !! wikitext
14417 ==Section with a [[Main Page|link]] in it==
14418 !! html
14419 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14420
14421 !! end
14422
14423 !! test
14424 TOC regression (T14077)
14425 !! wikitext
14426 __TOC__
14427 == title 1 ==
14428 === title 1.1 ===
14429 == title 2 ==
14430 !! html
14431 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14432 <ul>
14433 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14434 <ul>
14435 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
14436 </ul>
14437 </li>
14438 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14439 </ul>
14440 </div>
14441
14442 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14443 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14444 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14445
14446 !! end
14447
14448 !! test
14449 BUG 1219 URL next to image (good)
14450 !! wikitext
14451 http://example.com [[File:Foobar.jpg]]
14452 !! html/php
14453 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14454 </p>
14455 !! html/parsoid
14456 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14457 !!end
14458
14459 !! test
14460 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14461 !! wikitext
14462 ===
14463 The line above must have a trailing space!
14464 === <!--
14465 --> <!-- -->
14466 But just in case it doesn't...
14467 !! html
14468 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
14469 <p>The line above must have a trailing space!
14470 </p>
14471 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
14472 <p>But just in case it doesn't...
14473 </p>
14474 !! end
14475
14476 !! test
14477 Header with special characters (bug 25462)
14478 !! wikitext
14479 The tooltips shall not show entities to the user (ie. be double escaped)
14480
14481 == text > text ==
14482 section 1
14483
14484 == text < text ==
14485 section 2
14486
14487 == text & text ==
14488 section 3
14489
14490 == text ' text ==
14491 section 4
14492
14493 == text " text ==
14494 section 5
14495 !! html
14496 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14497 </p>
14498 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14499 <ul>
14500 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
14501 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
14502 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
14503 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14504 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14505 </ul>
14506 </div>
14507
14508 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14509 <p>section 1
14510 </p>
14511 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14512 <p>section 2
14513 </p>
14514 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14515 <p>section 3
14516 </p>
14517 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14518 <p>section 4
14519 </p>
14520 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14521 <p>section 5
14522 </p>
14523 !! end
14524
14525 !! test
14526 Header with space, plus and underscore as entity
14527 !! wikitext
14528 Id should not contain + for spaces
14529
14530 == Space between Text ==
14531 section 1
14532
14533 == Space-Entity&#32;between&#32;Text ==
14534 section 2
14535
14536 == Plus+between+Text ==
14537 section 3
14538
14539 == Plus-Entity&#43;between&#43;Text ==
14540 section 4
14541
14542 == Underscore_between_Text ==
14543 section 5
14544
14545 == Underscore-Entity&#95;between&#95;Text ==
14546 section 6
14547
14548 [[#Space between Text]]
14549 [[#Space-Entity&#32;between&#32;Text]]
14550 [[#Plus+between+Text]]
14551 [[#Plus-Entity&#43;between&#43;Text]]
14552 [[#Underscore_between_Text]]
14553 [[#Underscore-Entity&#95;between&#95;Text]]
14554 !! html
14555 <p>Id should not contain + for spaces
14556 </p>
14557 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14558 <ul>
14559 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
14560 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
14561 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
14562 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
14563 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
14564 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
14565 </ul>
14566 </div>
14567
14568 <h2><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14569 <p>section 1
14570 </p>
14571 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14572 <p>section 2
14573 </p>
14574 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14575 <p>section 3
14576 </p>
14577 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14578 <p>section 4
14579 </p>
14580 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14581 <p>section 5
14582 </p>
14583 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14584 <p>section 6
14585 </p><p><a href="#Space_between_Text">#Space between Text</a>
14586 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14587 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14588 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14589 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14590 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14591 </p>
14592 !! end
14593
14594 !! test
14595 Headers with excess '=' characters
14596 (Are similar tests necessary beyond the 1st level?)
14597 !! wikitext
14598 =foo==
14599 ==foo=
14600 =''italic'' heading==
14601 ==''italic'' heading=
14602 !! html
14603 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14604 <ul>
14605 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14606 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14607 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
14608 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
14609 </ul>
14610 </div>
14611
14612 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
14613 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
14614 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
14615 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
14616
14617 !! end
14618
14619 !! test
14620 HTML headers vs TOC (bug 23393)
14621 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14622 !! wikitext
14623 <h1>Header 1</h1>
14624 == Header 1.1 ==
14625 == Header 1.2 ==
14626
14627 <h1>Header 2
14628 </h1>
14629 == Header 2.1 ==
14630 == Header 2.2 ==
14631 __NOEDITSECTION__
14632 !! html
14633 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14634 <ul>
14635 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14636 <ul>
14637 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
14638 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
14639 </ul>
14640 </li>
14641 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14642 <ul>
14643 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
14644 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
14645 </ul>
14646 </li>
14647 </ul>
14648 </div>
14649
14650 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14651 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14652 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14653 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14654 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14655 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14656
14657 !! end
14658
14659 !! test
14660 Single-line or multiline-comments can follow headings
14661 !! options
14662 parsoid=wt2html,wt2wt
14663 !! wikitext
14664 ==foo==<!---->
14665 ==bar==<!--c1-->
14666 ==baz==<!--
14667 c2
14668 c3-->
14669 !! html
14670 <h2><span class="mw-headline" id="foo">foo</span></h2>
14671 <h2><span class="mw-headline" id="bar">bar</span></h2>
14672 <h2><span class="mw-headline" id="baz">baz</span></h2>
14673
14674 !! end
14675
14676 !! test
14677 BUG 1219 URL next to image (broken)
14678 !! wikitext
14679 http://example.com[[File:Foobar.jpg]]
14680 !! html/php
14681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14682 </p>
14683 !! html/parsoid
14684 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14685 !!end
14686
14687 !! test
14688 Bug 1186 news: in the middle of text
14689 !! wikitext
14690 http://en.wikinews.org/wiki/Wikinews:Workplace
14691 !! html
14692 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14693 </p>
14694 !!end
14695
14696
14697 !! test
14698 Namespaced link must have a title
14699 !! wikitext
14700 [[Project:]]
14701 !! html
14702 <p>[[Project:]]
14703 </p>
14704 !!end
14705
14706 !! test
14707 Namespaced link must have a title (bad fragment version)
14708 !! wikitext
14709 [[Project:#fragment]]
14710 !! html
14711 <p>[[Project:#fragment]]
14712 </p>
14713 !!end
14714
14715
14716 ###
14717 ### HTML tags and HTML attributes
14718 ###
14719
14720 !! test
14721 div with no attributes
14722 !! wikitext
14723 <div>HTML rocks</div>
14724 !! html
14725 <div>HTML rocks</div>
14726
14727 !! end
14728
14729 !! test
14730 div with double-quoted attribute
14731 !! wikitext
14732 <div id="rock">HTML rocks</div>
14733 !! html
14734 <div id="rock">HTML rocks</div>
14735
14736 !! end
14737
14738 !! test
14739 div with single-quoted attribute
14740 !! wikitext
14741 <div id='rock'>HTML rocks</div>
14742 !! html
14743 <div id="rock">HTML rocks</div>
14744
14745 !! end
14746
14747 !! test
14748 div with unquoted attribute
14749 !! wikitext
14750 <div id=rock>HTML rocks</div>
14751 !! html
14752 <div id="rock">HTML rocks</div>
14753
14754 !! end
14755
14756 !! test
14757 div with illegal double attributes
14758 !! wikitext
14759 <div id="a" id="b">HTML rocks</div>
14760 !! html
14761 <div id="b">HTML rocks</div>
14762
14763 !!end
14764
14765 # FIXME: produce empty string instead of "class" in the PHP parser, following
14766 # the HTML5 spec.
14767 !! test
14768 div with empty attribute value, space before equals
14769 !! options
14770 parsoid
14771 !! wikitext
14772 <div class =>HTML rocks</div>
14773 !! html
14774 <div class="">HTML rocks</div>
14775
14776 !! end
14777
14778 !! test
14779 div with multiple empty attribute values
14780 !! options
14781 parsoid
14782 !! wikitext
14783 <div id= title=>HTML rocks</div>
14784 !! html
14785 <div id="" title="">HTML rocks</div>
14786
14787 !! end
14788
14789 !! test
14790 table with multiple empty attribute values
14791 !! options
14792 parsoid
14793 !! wikitext
14794 {| title= id=
14795 | hi
14796 |}
14797 !! html
14798 <table title="" id="">
14799 <tbody><tr><td> hi</td></tr>
14800 </tbody></table>
14801 !! end
14802
14803 !! test
14804 div with braces in attribute value
14805 !! wikitext
14806 <div title="{}">Foo</div>
14807 !! html/php
14808 <div title="&#123;}">Foo</div>
14809
14810 !! html/parsoid
14811 <div title="{}">Foo</div>
14812 !! end
14813
14814 # This it very inconsistent in the PHP parser: it returns
14815 # class="class" if there is a space between the name and the equal sign (see
14816 # 'div with empty attribute value, space before equals'), but strips the
14817 # attribute completely if the space is missing. We hope that not much content
14818 # depends on this, so are implementing the behavior below in Parsoid for
14819 # consistencies' sake.
14820 # FIXME: fix this behavior in the PHP parser?
14821 !! test
14822 div with empty attribute value, no space before equals
14823 !! options
14824 parsoid=wt2html,html2html
14825 !! wikitext
14826 <div class=>HTML rocks</div>
14827 !! html/php
14828 <div>HTML rocks</div>
14829
14830 !! html/parsoid
14831 <div class="">HTML rocks</div>
14832 !! end
14833
14834 !! test
14835 HTML multiple attributes correction
14836 !! wikitext
14837 <p class="error" class="awesome">Awesome!</p>
14838 !! html
14839 <p class="awesome">Awesome!</p>
14840
14841 !!end
14842
14843 !! test
14844 Table multiple attributes correction
14845 !! wikitext
14846 {|
14847 !+ class="error" class="awesome"| status
14848 |}
14849 !! html
14850 <table>
14851 <tr>
14852 <th class="awesome"> status
14853 </th></tr></table>
14854
14855 !!end
14856
14857 !! test
14858 DIV IN UPPERCASE
14859 !! wikitext
14860 <DIV ID="x">HTML ROCKS</DIV>
14861 !! html
14862 <div id="x">HTML ROCKS</div>
14863
14864 !!end
14865
14866 !! test
14867 Non-ASCII pseudo-tags are rendered as text
14868 !! wikitext
14869 <khyô>
14870 !! html
14871 <p>&lt;khyô&gt;
14872 </p>
14873 !! end
14874
14875 !! test
14876 Pseudo-tag with URL 'name' renders as url link
14877 !! wikitext
14878 <http://example.com/>
14879 !! html
14880 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14881 </p>
14882 !! end
14883
14884 !! test
14885 text with amp in the middle of nowhere
14886 !! wikitext
14887 Remember AT&T?
14888 !! html
14889 <p>Remember AT&amp;T?
14890 </p>
14891 !! end
14892
14893 !! test
14894 text with character entity: eacute
14895 !! wikitext
14896 I always thought &eacute; was a cute letter.
14897 !! html
14898 <p>I always thought &#233; was a cute letter.
14899 </p>
14900 !! html+tidy
14901 <p>I always thought é was a cute letter.</p>
14902 !! end
14903
14904 !! test
14905 text with entity-escaped character entity-like string: eacute
14906 !! wikitext
14907 I always thought &amp;eacute; was a cute letter.
14908 !! html
14909 <p>I always thought &amp;eacute; was a cute letter.
14910 </p>
14911 !! end
14912
14913 !! test
14914 text with undefined character entity: xacute
14915 !! wikitext
14916 I always thought &xacute; was a cute letter.
14917 !! html
14918 <p>I always thought &amp;xacute; was a cute letter.
14919 </p>
14920 !! end
14921
14922 # TODO: generalize to PHP parser?
14923 !! test
14924 HTML5 tags
14925 !! options
14926 parsoid
14927 !! wikitext
14928 <data value="5">five</data>
14929 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14930 <mark>This highlighted text</mark>
14931 !! html
14932 <p><data value="5">five</data>
14933 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14934 <mark>This highlighted text</mark></p>
14935 !! end
14936
14937 !! test
14938 HTML tag with leading space is parsed as text
14939 !! wikitext
14940 < div>foo< /div>
14941 !! html
14942 <p>&lt; div&gt;foo&lt; /div&gt;
14943 </p>
14944 !! end
14945
14946 ###
14947 ### Nesting tests (see bug 41545, 50604, 51081)
14948 ###
14949
14950 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14951 # Note that html2wt is considerably more difficult if we use <b> in
14952 # the test case, instead of <big>
14953 !! test
14954 Ensure that HTML adoption agency algorithm is properly implemented.
14955 !! wikitext
14956 <big>X<big>Y</big>Z</big>
14957 !! html
14958 <p><big>X<big>Y</big>Z</big>
14959 </p>
14960 !! end
14961
14962 # This was bug 41545 in the PHP parser.
14963 # Note that tidy doesn't handle this correctly.
14964 !! test
14965 Nesting of <kbd>
14966 !! wikitext
14967 <kbd>X<kbd>Y</kbd>Z</kbd>
14968 !! html
14969 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14970 </p>
14971 !! end
14972
14973 # The following cases were bug 51081 in the PHP parser.
14974 # Note that there are some other nestable tags (b, i, etc) which are
14975 # not covered; see bug 51081 for discussion.
14976
14977 # Note that tidy doesn't handle this correctly.
14978 !! test
14979 Nesting of <em>
14980 !! wikitext
14981 <em>X<em>Y</em>Z</em>
14982 !! html
14983 <p><em>X<em>Y</em>Z</em>
14984 </p>
14985 !! end
14986
14987 # Note that tidy doesn't handle this correctly.
14988 !! test
14989 Nesting of <strong>
14990 !! wikitext
14991 <strong>X<strong>Y</strong>Z</strong>
14992 !! html
14993 <p><strong>X<strong>Y</strong>Z</strong>
14994 </p>
14995 !! end
14996
14997 !! test
14998 Nesting of <q>
14999 !! wikitext
15000 <q>X<q>Y</q>Z</q>
15001 !! html+tidy
15002 <p><q>X<q>Y</q>Z</q></p>
15003 !! end
15004
15005 # Note that tidy doesn't handle this correctly.
15006 !! test
15007 Nesting of <ruby>
15008 !! wikitext
15009 <ruby>X<ruby>Y</ruby>Z</ruby>
15010 !! html
15011 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15012 </p>
15013 !! end
15014
15015 # Note that tidy doesn't handle this correctly.
15016 !! test
15017 Nesting of <bdo>
15018 !! wikitext
15019 <bdo>X<bdo>Y</bdo>Z</bdo>
15020 !! html
15021 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15022 </p>
15023 !! end
15024
15025
15026 ###
15027 ### Media links
15028 ###
15029
15030 !! test
15031 Media link
15032 !! wikitext
15033 [[Media:Foobar.jpg]]
15034 !! html
15035 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15036 </p>
15037 !! end
15038
15039 !! test
15040 Media link with text
15041 !! wikitext
15042 [[Media:Foobar.jpg|A neat file to look at]]
15043 !! html
15044 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15045 </p>
15046 !! end
15047
15048 # FIXME: this is still bad HTML tag nesting
15049 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15050 !! test
15051 Media link with nasty text
15052 !! wikitext
15053 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15054 !! html
15055 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
15056
15057 !! html+tidy
15058 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15059 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15060 !! end
15061
15062 !! test
15063 Media link to nonexistent file (bug 1702)
15064 !! wikitext
15065 [[Media:No such.jpg]]
15066 !! html
15067 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15068 </p>
15069 !! end
15070
15071 !! test
15072 Image link to nonexistent file (bug 1850 - good)
15073 !! wikitext
15074 [[File:No_such.jpg]]
15075 !! html/php
15076 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
15077 </p>
15078 !! html/parsoid
15079 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
15080 !! end
15081
15082 !! test
15083 :Image link to nonexistent file (bug 1850 - bad)
15084 !! wikitext
15085 [[:Image:No such.jpg]]
15086 !! html/php
15087 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
15088 </p>
15089 !! html/parsoid
15090 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15091 !! end
15092
15093
15094
15095 !! test
15096 Character reference normalization in link text (bug 1938)
15097 !! wikitext
15098 [[Main Page|this&that]]
15099 !! html
15100 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15101 </p>
15102 !!end
15103
15104 !! article
15105 אַ
15106 !! text
15107 Test for unicode normalization
15108
15109 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15110 !! endarticle
15111
15112 !! test
15113 (bug 19451) Links should refer to the normalized form.
15114 !! wikitext
15115 [[&#xFB2E;]]
15116 [[&#x5d0;&#x5b7;]]
15117 [[&#x5d0;ַ]]
15118 [[א&#x5b7;]]
15119 [[אַ]]
15120 !! html
15121 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15122 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15123 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15124 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15125 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15126 </p>
15127 !! end
15128
15129 !! test
15130 Empty attribute crash test (bug 2067)
15131 !! wikitext
15132 <font color="">foo</font>
15133 !! html
15134 <p><font color="">foo</font>
15135 </p>
15136 !! end
15137
15138 !! test
15139 Empty attribute crash test single-quotes (bug 2067)
15140 !! wikitext
15141 <font color=''>foo</font>
15142 !! html
15143 <p><font color="">foo</font>
15144 </p>
15145 !! end
15146
15147 !! test
15148 Attribute test: equals, then nothing
15149 !! wikitext
15150 <font color=>foo</font>
15151 !! html
15152 <p><font>foo</font>
15153 </p>
15154 !! end
15155
15156 !! test
15157 Attribute test: unquoted value
15158 !! wikitext
15159 <font color=x>foo</font>
15160 !! html
15161 <p><font color="x">foo</font>
15162 </p>
15163 !! end
15164
15165 !! test
15166 Attribute test: unquoted but illegal value (hash)
15167 !! wikitext
15168 <font color=#x>foo</font>
15169 !! html
15170 <p><font color="#x">foo</font>
15171 </p>
15172 !! end
15173
15174 # Parsoid does not serialize to empty attribute syntax,
15175 # so wt2wt and html2wt cases are skipped
15176 !! test
15177 Attribute test: no value (T54330)
15178 !! options
15179 parsoid=wt2html,html2html
15180 !! wikitext
15181 <font color>foo</font>
15182 !! html/php
15183 <p><font color="">foo</font>
15184 </p>
15185 !! html/parsoid
15186 <p><font color="">foo</font></p>
15187 !! end
15188
15189 !! test
15190 Bug 2095: link with three closing brackets
15191 !! wikitext
15192 [[Main Page]]]
15193 !! html/php
15194 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15195 </p>
15196 !! html/parsoid
15197 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15198 !! end
15199
15200 !! test
15201 Bug 2095: link with pipe and three closing brackets
15202 !! wikitext
15203 [[Main Page|link]]]
15204 !! html/php
15205 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15206 </p>
15207 !! html/parsoid
15208 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15209 !! end
15210
15211 !! test
15212 Bug 2095: link with pipe and three closing brackets, version 2
15213 !! wikitext
15214 [[Main Page|[http://example.com/]]]
15215 !! html/php
15216 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15217 </p>
15218 !! html/parsoid
15219 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15220 !! end
15221
15222
15223 ###
15224 ### Safety
15225 ###
15226
15227 !! article
15228 Template:Dangerous attribute
15229 !! text
15230 " onmouseover="alert(document.cookie)
15231 !! endarticle
15232
15233 !! article
15234 Template:Dangerous style attribute
15235 !! text
15236 border-size: expression(alert(document.cookie))
15237 !! endarticle
15238
15239 !! article
15240 Template:Div style
15241 !! text
15242 <div style="float: right; {{{1}}}">Magic div</div>
15243 !! endarticle
15244
15245 !! test
15246 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15247 !! wikitext
15248 <div title="{{test}}"></div>
15249 !! html
15250 <div title="This is a test template"></div>
15251
15252 !! end
15253
15254 # Parsoid has enough context to handle this case
15255 !! test
15256 Bug 2304: HTML attribute safety (dangerous template; 2309)
15257 !! wikitext
15258 <div title="{{dangerous attribute}}"></div>
15259 !! html/php
15260 <div title=""></div>
15261
15262 !! html/parsoid
15263 <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>
15264 !! end
15265
15266 !! test
15267 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15268 !! wikitext
15269 <div style="{{dangerous style attribute}}"></div>
15270 !! html
15271 <div style="/* insecure input */"></div>
15272
15273 !! end
15274
15275 !! test
15276 Bug 2304: HTML attribute safety (safe parameter; 2309)
15277 !! wikitext
15278 {{div style|width: 200px}}
15279 !! html
15280 <div style="float: right; width: 200px">Magic div</div>
15281
15282 !! end
15283
15284 !! test
15285 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15286 !! wikitext
15287 {{div style|width: expression(alert(document.cookie))}}
15288 !! html
15289 <div style="/* insecure input */">Magic div</div>
15290
15291 !! end
15292
15293 !! test
15294 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15295 !! wikitext
15296 {{div style|"><script>alert(document.cookie)</script>}}
15297 !! html
15298 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15299
15300 !! end
15301
15302 !! test
15303 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15304 !! wikitext
15305 {{div style|" ><script>alert(document.cookie)</script>}}
15306 !! html
15307 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15308
15309 !! end
15310
15311 !! test
15312 Bug 2304: HTML attribute safety (link)
15313 !! wikitext
15314 <div title="[[Main Page]]"></div>
15315 !! html
15316 <div title="&#91;&#91;Main Page]]"></div>
15317
15318 !! end
15319
15320 !! test
15321 Bug 2304: HTML attribute safety (italics)
15322 !! wikitext
15323 <div title="''foobar''"></div>
15324 !! html
15325 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15326
15327 !! end
15328
15329 !! test
15330 Bug 2304: HTML attribute safety (bold)
15331 !! wikitext
15332 <div title="'''foobar'''"></div>
15333 !! html
15334 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15335
15336 !! end
15337
15338
15339 !! test
15340 Bug 2304: HTML attribute safety (ISBN)
15341 !! wikitext
15342 <div title="ISBN 1234567890"></div>
15343 !! html
15344 <div title="&#73;SBN 1234567890"></div>
15345
15346 !! end
15347
15348 !! test
15349 Bug 2304: HTML attribute safety (RFC)
15350 !! wikitext
15351 <div title="RFC 1234"></div>
15352 !! html
15353 <div title="&#82;FC 1234"></div>
15354
15355 !! end
15356
15357 !! test
15358 Bug 2304: HTML attribute safety (PMID)
15359 !! wikitext
15360 <div title="PMID 1234567890"></div>
15361 !! html
15362 <div title="&#80;MID 1234567890"></div>
15363
15364 !! end
15365
15366 !! test
15367 Bug 2304: HTML attribute safety (web link)
15368 !! wikitext
15369 <div title="http://example.com/"></div>
15370 !! html
15371 <div title="http&#58;//example.com/"></div>
15372
15373 !! end
15374
15375 !! test
15376 Bug 2304: HTML attribute safety (named web link)
15377 !! wikitext
15378 <div title="[http://example.com/ link]"></div>
15379 !! html
15380 <div title="&#91;http&#58;//example.com/ link]"></div>
15381
15382 !! end
15383
15384 !! test
15385 Bug 3244: HTML attribute safety (extension; safe)
15386 !! wikitext
15387 <div style="<nowiki>background:blue</nowiki>"></div>
15388 !! html
15389 <div style="background:blue"></div>
15390
15391 !! end
15392
15393 !! test
15394 Bug 3244: HTML attribute safety (extension; unsafe)
15395 !! wikitext
15396 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15397 !! html
15398 <div style="/* insecure input */"></div>
15399
15400 !! end
15401
15402 # More MSIE fun discovered by Tom Gilder
15403
15404 !! test
15405 MSIE CSS safety test: spurious slash
15406 !! wikitext
15407 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15408 !! html
15409 <div style="/* insecure input */">evil</div>
15410
15411 !! end
15412
15413 !! test
15414 MSIE CSS safety test: hex code
15415 !! wikitext
15416 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15417 !! html
15418 <div style="/* insecure input */">evil</div>
15419
15420 !! end
15421
15422 !! test
15423 MSIE CSS safety test: comment in url
15424 !! wikitext
15425 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15426 !! html
15427 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15428
15429 !! end
15430
15431 !! test
15432 MSIE CSS safety test: comment in expression
15433 !! wikitext
15434 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15435 !! html
15436 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15437
15438 !! end
15439
15440 !! test
15441 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15442 !! wikitext
15443 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15444 !! html
15445 <p style="/* invalid control char */">A</p>
15446
15447 !! end
15448
15449 !! test
15450 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15451 !! wikitext
15452 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15453 <div style="top:EXPRESSION(alert())">B</div>
15454 !! html
15455 <p style="/* insecure input */">A</p>
15456 <div style="/* insecure input */">B</div>
15457
15458 !! end
15459
15460 !! test
15461 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15462 !! wikitext
15463 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15464 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15465 !! html
15466 <div style="/* insecure input */">A</div>
15467 <p style="/* insecure input */">B</p>
15468
15469 !! end
15470
15471 !! test
15472 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15473 !! wikitext
15474 <div style="background-image:url⁽javascript:alert())">A</div>
15475 <div style="background-image:url₍javascript:alert())">B</div>
15476 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15477 !! html
15478 <div style="/* insecure input */">A</div>
15479 <div style="/* insecure input */">B</div>
15480 <p style="/* insecure input */">C</p>
15481
15482 !! end
15483
15484 !! test
15485 Opera -o-link CSS
15486 !! wikitext
15487 <div
15488 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;"
15489 style="-o-link:attr(title);-o-link-source:current">X</div>
15490 !! html
15491 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15492
15493 !! end
15494
15495 !! test
15496 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15497 !! wikitext
15498 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15499 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15500 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15501 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15502 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15503 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15504 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15505 !! html
15506 <p style="/* insecure input */">A</p>
15507 <p style="/* insecure input */">B</p>
15508 <p style="/* insecure input */">C</p>
15509 <p style="/* insecure input */">D</p>
15510 <p style="/* insecure input */">E</p>
15511 <p style="/* insecure input */">F</p>
15512 <p style="/* insecure input */">G</p>
15513
15514 !! end
15515
15516 !! test
15517 Table attribute legitimate extension
15518 !! wikitext
15519 {|
15520 !+ style="<nowiki>color:blue</nowiki>"| status
15521 |}
15522 !! html
15523 <table>
15524 <tr>
15525 <th style="color:blue"> status
15526 </th></tr></table>
15527
15528 !!end
15529
15530 !! test
15531 Table attribute safety
15532 !! wikitext
15533 {|
15534 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15535 |}
15536 !! html
15537 <table>
15538 <tr>
15539 <th style="/* insecure input */"> status
15540 </th></tr></table>
15541
15542 !! end
15543
15544 !! test
15545 CSS line continuation 1
15546 !! wikitext
15547 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15548 !! html
15549 <div style="/* insecure input */"></div>
15550
15551 !! end
15552
15553 !! test
15554 CSS line continuation 2
15555 !! wikitext
15556 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15557 !! html
15558 <div style="/* insecure input */"></div>
15559
15560 !! end
15561
15562 !! article
15563 Template:Identity
15564 !! text
15565 {{{1}}}
15566 !! endarticle
15567
15568 !! test
15569 Expansion of multi-line templates in attribute values (bug 6255)
15570 !! wikitext
15571 <div style="background: {{identity|#00FF00}}">-</div>
15572 !! html
15573 <div style="background: #00FF00">-</div>
15574
15575 !! end
15576
15577
15578 !! test
15579 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15580 !! wikitext
15581 <div style="background:
15582 #00FF00">-</div>
15583 !! html/php
15584 <div style="background: #00FF00">-</div>
15585
15586 !! html/parsoid
15587 <div style="background:
15588 #00FF00">-</div>
15589 !! end
15590
15591 !! test
15592 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15593 !! wikitext
15594 <div style="background: &#10;#00FF00">-</div>
15595 !! html
15596 <div style="background: &#10;#00FF00">-</div>
15597
15598 !! end
15599
15600 !! test
15601 evil <math>-wiki-tags without Extension:Math enabled
15602 !! wikitext
15603 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15604 !! html+tidy
15605 <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>
15606 !! end
15607
15608 ###
15609 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15610 ###
15611 !! test
15612 Parser hook: empty input
15613 !! wikitext
15614 <tag></tag>
15615 !! html
15616 <pre>
15617 ''
15618 array (
15619 )
15620 </pre>
15621
15622 !! end
15623
15624 !! test
15625 Parser hook: empty input using terminated empty elements
15626 !! wikitext
15627 <tag/>
15628 !! html
15629 <pre>
15630 NULL
15631 array (
15632 )
15633 </pre>
15634
15635 !! end
15636
15637 !! test
15638 Parser hook: empty input using terminated empty elements (space before)
15639 !! wikitext
15640 <tag />
15641 !! html
15642 <pre>
15643 NULL
15644 array (
15645 )
15646 </pre>
15647
15648 !! end
15649
15650 !! test
15651 Parser hook: basic input
15652 !! wikitext
15653 <tag>input</tag>
15654 !! html
15655 <pre>
15656 'input'
15657 array (
15658 )
15659 </pre>
15660
15661 !! end
15662
15663
15664 !! test
15665 Parser hook: case insensitive
15666 !! wikitext
15667 <TAG>input</TAG>
15668 !! html
15669 <pre>
15670 'input'
15671 array (
15672 )
15673 </pre>
15674
15675 !! end
15676
15677
15678 !! test
15679 Parser hook: case insensitive, redux
15680 !! wikitext
15681 <TaG>input</TAg>
15682 !! html
15683 <pre>
15684 'input'
15685 array (
15686 )
15687 </pre>
15688
15689 !! end
15690
15691 !! test
15692 Parser hook: nested tags
15693 !! options
15694 noxml
15695 !! wikitext
15696 <tag><tag></tag></tag>
15697 !! html
15698 <pre>
15699 '<tag>'
15700 array (
15701 )
15702 </pre>&lt;/tag&gt;
15703
15704 !! end
15705
15706 !! test
15707 Parser hook: basic arguments
15708 !! wikitext
15709 <tag width=200 height = "100" depth = '50' square></tag>
15710 !! html
15711 <pre>
15712 ''
15713 array (
15714 'width' => '200',
15715 'height' => '100',
15716 'depth' => '50',
15717 'square' => '',
15718 )
15719 </pre>
15720
15721 !! end
15722
15723 !! test
15724 Parser hook: argument containing a forward slash (bug 5344)
15725 !! wikitext
15726 <tag filename='/tmp/bla'></tag>
15727 !! html
15728 <pre>
15729 ''
15730 array (
15731 'filename' => '/tmp/bla',
15732 )
15733 </pre>
15734
15735 !! end
15736
15737 !! test
15738 Parser hook: empty input using terminated empty elements (bug 2374)
15739 !! wikitext
15740 <tag foo=bar/>text
15741 !! html
15742 <pre>
15743 NULL
15744 array (
15745 'foo' => 'bar',
15746 )
15747 </pre>text
15748
15749 !! end
15750
15751 # </tag> should be output literally since there is no matching tag that begins it
15752 !! test
15753 Parser hook: basic arguments using terminated empty elements (bug 2374)
15754 !! wikitext
15755 <tag width=200 height = "100" depth = '50' square/>
15756 other stuff
15757 </tag>
15758 !! html
15759 <pre>
15760 NULL
15761 array (
15762 'width' => '200',
15763 'height' => '100',
15764 'depth' => '50',
15765 'square' => '',
15766 )
15767 </pre>
15768 <p>other stuff
15769 &lt;/tag&gt;
15770 </p>
15771 !! end
15772
15773 ###
15774 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15775 ###
15776
15777 !! test
15778 Parser hook: static parser hook not inside a comment
15779 !! wikitext
15780 <statictag>hello, world</statictag>
15781 <statictag action=flush/>
15782 !! html
15783 <p>hello, world
15784 </p>
15785 !! end
15786
15787
15788 !! test
15789 Parser hook: static parser hook inside a comment
15790 !! wikitext
15791 <!-- <statictag>hello, world</statictag> -->
15792 <statictag action=flush/>
15793 !! html
15794 <p><br />
15795 </p>
15796 !! end
15797
15798 # Nested template calls; this case was broken by Parser.php rev 1.506,
15799 # since reverted.
15800
15801 !! article
15802 Template:One-parameter
15803 !! text
15804 (My parameter is: {{{1}}})
15805 !! endarticle
15806
15807 !! article
15808 Template:Map-one-parameter
15809 !! text
15810 {{{{{1}}}|{{{2}}}}}
15811 !! endarticle
15812
15813 !! test
15814 Nested template calls
15815 !! wikitext
15816 {{Map-one-parameter|One-parameter|param}}
15817 !! html
15818 <p>(My parameter is: param)
15819 </p>
15820 !! end
15821
15822
15823 ###
15824 ### Sanitizer
15825 ###
15826
15827 # HTML+Tidy effectively strips out the empty tags completely
15828 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15829 # which Tidy would have done for the PHP parser had there been content inside it.
15830 !! test
15831 Sanitizer: Closing of open tags
15832 !! wikitext
15833 <s></s><table></table>
15834 !! html
15835 <s></s><table></table>
15836
15837 !! html/parsoid
15838 <p><s></s></p><table></table>
15839 !! end
15840
15841 !! test
15842 Sanitizer: Closing of open but not closed tags
15843 !! wikitext
15844 <s>foo
15845 !! html
15846 <p><s>foo</s>
15847 </p>
15848 !! end
15849
15850 !! test
15851 Sanitizer: Closing of closed but not open tags
15852 !! wikitext
15853 </s>
15854 !! html
15855 <p>&lt;/s&gt;
15856 </p>
15857 !! end
15858
15859 !! test
15860 Sanitizer: Closing of closed but not open table tags
15861 !! wikitext
15862 Table not started</td></tr></table>
15863 !! html
15864 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15865 </p>
15866 !! end
15867
15868 !! test
15869 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15870 !! wikitext
15871 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15872 !! html
15873 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15874 </p>
15875 !! end
15876
15877 # In HTML5, the restrictions are that id must contain at least one character,
15878 # and must not contain any space characters.
15879 !! test
15880 Sanitizer: Validating the contents of the id attribute (bug 4515)
15881 !! options
15882 disabled
15883 !! wikitext
15884 <br id="" /><br id="a space" />
15885 !! html
15886 Something ...
15887 !! end
15888
15889 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15890 !! test
15891 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15892 !! options
15893 disabled
15894 !! wikitext
15895 <br id="foo" /><br id="foo" />
15896 !! html
15897 Something need to be done. foo-2 ?
15898 !! end
15899
15900 !! test
15901 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15902 !! wikitext
15903 <div itemscope>
15904 <meta itemprop="hello" content="world">
15905 <meta http-equiv="refresh" content="5">
15906 <meta itemprop="hello" http-equiv="refresh" content="5">
15907 <link itemprop="hello" href="{{SERVER}}">
15908 <link rel="stylesheet" href="{{SERVER}}">
15909 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15910 </div>
15911 !! html
15912 <div itemscope="">
15913 <p> <meta itemprop="hello" content="world" />
15914 &lt;meta http-equiv="refresh" content="5"&gt;
15915 <meta itemprop="hello" content="5" />
15916 </p>
15917 <link itemprop="hello" href="http&#58;//example.org" />
15918 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15919 <link itemprop="hello" href="http&#58;//example.org" />
15920 </div>
15921
15922 !! end
15923
15924 !! test
15925 Language converter: output gets cut off unexpectedly (bug 5757)
15926 !! options
15927 language=zh
15928 !! wikitext
15929 this bit is safe: }-
15930
15931 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15932
15933 then we get cut off here: }-
15934
15935 all additional text is vanished
15936 !! html
15937 <p>this bit is safe: }-
15938 </p><p>but if we add a conversion instance: xxx
15939 </p><p>then we get cut off here: }-
15940 </p><p>all additional text is vanished
15941 </p>
15942 !! end
15943
15944 !! test
15945 Self closed html pairs (bug 5487)
15946 !! options
15947 !! wikitext
15948 <center><font id="bug" />Centered text</center>
15949 <div><font id="bug2" />In div text</div>
15950 !! html
15951 <center>&lt;font id="bug" /&gt;Centered text</center>
15952 <div>&lt;font id="bug2" /&gt;In div text</div>
15953
15954 !! end
15955
15956 #
15957 #
15958 #
15959
15960 !! test
15961 Punctuation: nbsp before exclamation
15962 !! wikitext
15963 C'est grave !
15964 !! html
15965 <p>C'est grave&#160;!
15966 </p>
15967 !! end
15968
15969 !! test
15970 Punctuation: CSS !important (bug 11874)
15971 !! wikitext
15972 <div style="width:50% !important">important</div>
15973 !! html
15974 <div style="width:50% !important">important</div>
15975
15976 !!end
15977
15978 !! test
15979 Punctuation: CSS ! important (bug 11874; with space after)
15980 !! wikitext
15981 <div style="width:50% ! important">important</div>
15982 !! html
15983 <div style="width:50% ! important">important</div>
15984
15985 !!end
15986
15987 !! test
15988 HTML bullet list, closed tags (bug 5497)
15989 !! wikitext
15990 <ul>
15991 <li>One</li>
15992 <li>Two</li>
15993 </ul>
15994 !! html/php
15995 <ul>
15996 <li>One</li>
15997 <li>Two</li>
15998 </ul>
15999
16000 !! html/parsoid
16001 <ul data-parsoid='{"stx":"html"}'>
16002 <li data-parsoid='{"stx":"html"}'>One</li>
16003 <li data-parsoid='{"stx":"html"}'>Two</li>
16004 </ul>
16005
16006 !! end
16007
16008 !! test
16009 HTML bullet list, unclosed tags (bug 5497)
16010 !! wikitext
16011 <ul>
16012 <li>One
16013 <li>Two
16014 </ul>
16015 !! html/php+tidy
16016 <ul>
16017 <li>One</li>
16018 <li>Two</li>
16019 </ul>
16020 !! html/parsoid
16021 <ul data-parsoid='{"stx":"html"}'>
16022 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16023 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16024 </ul>
16025
16026 !! end
16027
16028 !! test
16029 HTML ordered list, closed tags (bug 5497)
16030 !! wikitext
16031 <ol>
16032 <li>One</li>
16033 <li>Two</li>
16034 </ol>
16035 !! html/php
16036 <ol>
16037 <li>One</li>
16038 <li>Two</li>
16039 </ol>
16040
16041 !! html/parsoid
16042 <ol data-parsoid='{"stx":"html"}'>
16043 <li data-parsoid='{"stx":"html"}'>One</li>
16044 <li data-parsoid='{"stx":"html"}'>Two</li>
16045 </ol>
16046
16047 !! end
16048
16049 !! test
16050 HTML ordered list, unclosed tags (bug 5497)
16051 !! options
16052 !! wikitext
16053 <ol>
16054 <li>One
16055 <li>Two
16056 </ol>
16057 !! html/php+tidy
16058 <ol>
16059 <li>One</li>
16060 <li>Two</li>
16061 </ol>
16062 !! html/parsoid
16063 <ol data-parsoid='{"stx":"html"}'>
16064 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16065 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16066 </ol>
16067
16068 !! end
16069
16070 !! test
16071 HTML nested bullet list, closed tags (bug 5497)
16072 !! wikitext
16073 <ul>
16074 <li>One</li>
16075 <li>Two:
16076 <ul>
16077 <li>Sub-one</li>
16078 <li>Sub-two</li>
16079 </ul>
16080 </li>
16081 </ul>
16082 !! html
16083 <ul>
16084 <li>One</li>
16085 <li>Two:
16086 <ul>
16087 <li>Sub-one</li>
16088 <li>Sub-two</li>
16089 </ul>
16090 </li>
16091 </ul>
16092
16093 !! end
16094
16095 !! test
16096 HTML nested bullet list, open tags (bug 5497)
16097 !! wikitext
16098 <ul>
16099 <li>One
16100 <li>Two:
16101 <ul>
16102 <li>Sub-one
16103 <li>Sub-two
16104 </ul>
16105 </ul>
16106 !! html/php+tidy
16107 <ul>
16108 <li>One</li>
16109 <li>Two:
16110 <ul>
16111 <li>Sub-one</li>
16112 <li>Sub-two</li>
16113 </ul>
16114 </li>
16115 </ul>
16116 !! html/parsoid
16117 <ul>
16118 <li>One
16119 </li>
16120 <li>Two:
16121 <ul>
16122 <li>Sub-one
16123 </li>
16124 <li>Sub-two
16125 </li>
16126 </ul>
16127 </li>
16128 </ul>
16129
16130 !! end
16131
16132 !! test
16133 HTML nested ordered list, closed tags (bug 5497)
16134 !! wikitext
16135 <ol>
16136 <li>One</li>
16137 <li>Two:
16138 <ol>
16139 <li>Sub-one</li>
16140 <li>Sub-two</li>
16141 </ol>
16142 </li>
16143 </ol>
16144 !! html
16145 <ol>
16146 <li>One</li>
16147 <li>Two:
16148 <ol>
16149 <li>Sub-one</li>
16150 <li>Sub-two</li>
16151 </ol>
16152 </li>
16153 </ol>
16154
16155 !! end
16156
16157 !! test
16158 HTML nested ordered list, open tags (bug 5497)
16159 !! wikitext
16160 <ol>
16161 <li>One
16162 <li>Two:
16163 <ol>
16164 <li>Sub-one
16165 <li>Sub-two
16166 </ol>
16167 </ol>
16168 !! html/php
16169 <ol>
16170 <li>One
16171 <li>Two:
16172 <ol>
16173 <li>Sub-one
16174 <li>Sub-two
16175 </ol>
16176 </ol>
16177
16178 !! html/parsoid
16179 <ol>
16180 <li>One
16181 </li>
16182 <li>Two:
16183 <ol>
16184 <li>Sub-one
16185 </li>
16186 <li>Sub-two
16187 </li>
16188 </ol>
16189 </li>
16190 </ol>
16191
16192 !! end
16193
16194 !! test
16195 HTML ordered list item with parameters oddity
16196 !! wikitext
16197 <ol><li id="fragment">One</li>
16198 </ol>
16199 !! html
16200 <ol><li id="fragment">One</li>
16201 </ol>
16202
16203 !! end
16204
16205 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16206 !!test
16207 bug 5918: autonumbering
16208 !! wikitext
16209 [http://first/] [http://second] [ftp://ftp]
16210
16211 ftp://inlineftp
16212
16213 [mailto:enclosed@mail.tld With target]
16214
16215 [mailto:enclosed@mail.tld]
16216
16217 mailto:inline@mail.tld
16218 !! html/php
16219 <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>
16220 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16221 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16222 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16223 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16224 </p>
16225 !! html/parsoid
16226 <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>
16227 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16228 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16229 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16230 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16231 !! end
16232
16233
16234 #
16235 # Security and HTML correctness
16236 # From Nick Jenkins' fuzz testing
16237 #
16238
16239 !! test
16240 Fuzz testing: Parser13
16241 !! wikitext
16242 {|
16243 | http://a|
16244 !! html
16245 <table>
16246 <tr>
16247 <td>
16248 </td>
16249 </tr>
16250 </table>
16251
16252 !! end
16253
16254 !! test
16255 Fuzz testing: Parser14
16256 !! wikitext
16257 == onmouseover= ==
16258 http://__TOC__
16259 !! html
16260 <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>
16261 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16262 <ul>
16263 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16264 </ul>
16265 </div>
16266
16267
16268 !! html+tidy
16269 <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>
16270 <p>http://</p>
16271 <div id="toc" class="toc">
16272 <div id="toctitle">
16273 <h2>Contents</h2>
16274 </div>
16275 <ul>
16276 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16277 </ul>
16278 </div>
16279 <p></p>
16280 !! end
16281
16282 !! test
16283 Fuzz testing: Parser14-table
16284 !! wikitext
16285 ==a==
16286 {| STYLE=__TOC__
16287 !! html
16288 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16289 <table style="&#95;_TOC&#95;_">
16290 <tr><td></td></tr>
16291 </table>
16292
16293 !! html+tidy
16294 <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>
16295 <table style="__TOC__">
16296 <tr>
16297 <td></td>
16298 </tr>
16299 </table>
16300 !! end
16301
16302 # Known to produce bogus xml (extra </td>)
16303 !! test
16304 Fuzz testing: Parser16
16305 !! options
16306 noxml
16307 !! wikitext
16308 {|
16309 !https://||||||
16310 !! html
16311 <table>
16312 <tr>
16313 <th>https://</th>
16314 <th></th>
16315 <th></th>
16316 <th>
16317 </td>
16318 </tr>
16319 </table>
16320
16321 !! html+tidy
16322 <table>
16323 <tr>
16324 <th>https://</th>
16325 <th></th>
16326 <th></th>
16327 <th></th>
16328 </tr>
16329 </table>
16330 !! end
16331
16332 !! test
16333 Fuzz testing: Parser21
16334 !! wikitext
16335 {|
16336 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16337 |
16338 !! html
16339 <table>
16340 <tr>
16341 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16342 </th>
16343 <td>
16344 </td>
16345 </tr>
16346 </table>
16347
16348 !! end
16349
16350 !! test
16351 Fuzz testing: Parser22
16352 !! wikitext
16353 http://===r:::https://b
16354
16355 {|
16356 !! html
16357 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16358 </p>
16359 <table>
16360 <tr><td></td></tr>
16361 </table>
16362
16363 !! end
16364
16365 # Known to produce bad XML for now
16366 !! test
16367 Fuzz testing: Parser24
16368 !! options
16369 noxml
16370 !! wikitext
16371 {|
16372 {{{|
16373 <u CLASS=
16374 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16375 <br style="onmouseover='alert(document.cookie);' " />
16376
16377 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16378 |
16379 !! html
16380 <table>
16381 {{{|
16382 <u class="&#124;">}}}} &gt;
16383 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16384
16385 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16386 <tr>
16387 <td></u>
16388 </td>
16389 </tr>
16390 </table>
16391
16392 !! end
16393
16394 # Note: the current result listed for this is not what the original one was,
16395 # but the original bug was JavaScript injection, which is fixed in any case.
16396 # It's not clear that the original result listed was any more correct than the
16397 # current one. Original result:
16398 # <p>{{{|
16399 # </p>
16400 # <li class="&#124;&#124;">
16401 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16402 !!test
16403 Fuzz testing: Parser25 (bug 6055)
16404 !! wikitext
16405 {{{
16406 |
16407 <LI CLASS=||
16408 >
16409 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16410 !! html
16411 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16412 </p>
16413 !! end
16414
16415 !!test
16416 Fuzz testing: URL adjacent extension (with space, clean)
16417 !! wikitext
16418 http://example.com <nowiki>junk</nowiki>
16419 !! html/php
16420 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16421 </p>
16422 !! html/parsoid
16423 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16424 !! end
16425
16426 !!test
16427 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16428 !! wikitext
16429 http://example.com<nowiki>junk</nowiki>
16430 !! html/php
16431 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16432 </p>
16433 !! html/parsoid
16434 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16435 !! end
16436
16437 !!test
16438 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16439 !! wikitext
16440 http://example.com<pre>junk</pre>
16441 !! html/php
16442 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16443
16444 !! html/php+tidy
16445 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16446 <pre>
16447 junk
16448 </pre>
16449 !! html/parsoid
16450 <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>
16451 !!end
16452
16453 !!test
16454 Fuzz testing: image with bogus manual thumbnail
16455 !! wikitext
16456 [[Image:foobar.jpg|thumbnail= ]]
16457 !! html/php
16458 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16459
16460 !! html/parsoid
16461 <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>
16462 !!end
16463
16464 !! test
16465 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16466 !! wikitext
16467 <pre dir="&#10;"></pre>
16468 !! html
16469 <pre dir="&#10;"></pre>
16470
16471 !! end
16472
16473 !! test
16474 Parsing optional HTML elements (Bug 6171)
16475 !! options
16476 !! wikitext
16477 <table>
16478 <tr>
16479 <td> Some tabular data</td>
16480 <td> More tabular data ...
16481 <td> And yet som tabular data</td>
16482 </tr>
16483 </table>
16484 !! html
16485 <table>
16486 <tr>
16487 <td> Some tabular data</td>
16488 <td> More tabular data ...
16489 </td><td> And yet som tabular data</td>
16490 </tr>
16491 </table>
16492
16493 !! end
16494
16495 !! test
16496 Correct handling of <td>, <tr> (Bug 6171)
16497 !! options
16498 !! wikitext
16499 <table>
16500 <tr>
16501 <td> Some tabular data</td>
16502 <td> More tabular data ...</td>
16503 <td> And yet som tabular data</td>
16504 </tr>
16505 </table>
16506 !! html
16507 <table>
16508 <tr>
16509 <td> Some tabular data</td>
16510 <td> More tabular data ...</td>
16511 <td> And yet som tabular data</td>
16512 </tr>
16513 </table>
16514
16515 !! end
16516
16517
16518 !! test
16519 Parsing crashing regression (fr:JavaScript)
16520 !! wikitext
16521 </body></x>
16522 !! html
16523 <p>&lt;/body&gt;&lt;/x&gt;
16524 </p>
16525 !! end
16526
16527 !! test
16528 Inline wiki vs wiki block nesting
16529 !! wikitext
16530 '''Bold paragraph
16531
16532 New wiki paragraph
16533 !! html
16534 <p><b>Bold paragraph</b>
16535 </p><p>New wiki paragraph
16536 </p>
16537 !! end
16538
16539 # FIXME: The current php output is documented
16540 # and desired output is the parsoid target.
16541 !! test
16542 Inline HTML vs wiki block nesting
16543 !! wikitext
16544 <b>Bold paragraph
16545
16546 New wiki paragraph
16547 !! html/php
16548 <p><b>Bold paragraph
16549 </p><p>New wiki paragraph</b>
16550 </p>
16551 !! html/parsoid
16552 <p><b>Bold paragraph</b>
16553 </p><p>New wiki paragraph
16554 </p>
16555 !! end
16556
16557 # Original result was this:
16558 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16559 # </p>
16560 # While that might be marginally more intuitive, maybe, the six-apostrophe
16561 # construct is clearly pathological and the result stated here (which is what
16562 # the parser actually does) is about as reasonable as anything.
16563 !!test
16564 Mixing markup for italics and bold
16565 !! options
16566 !! wikitext
16567 '''bold''''''bold''bolditalics'''''
16568 !! html
16569 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16570 </p>
16571 !! end
16572
16573
16574 !! article
16575 Xyzzyx
16576 !! text
16577 Article for special page transclusion test
16578 !! endarticle
16579
16580 !! test
16581 Special page transclusion
16582 !! options
16583 !! wikitext
16584 {{Special:Prefixindex/Xyzzyx}}
16585 !! html
16586 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16587
16588 !! end
16589
16590 !! test
16591 Special page transclusion twice (bug 5021)
16592 !! options
16593 !! wikitext
16594 {{Special:Prefixindex/Xyzzyx}}
16595 {{Special:Prefixindex/Xyzzyx}}
16596 !! html
16597 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16598 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16599
16600 !! end
16601
16602 !! test
16603 Transclusion of default MediaWiki message
16604 !! wikitext
16605 {{MediaWiki:Mainpage}}
16606 !! html
16607 <p>Main Page
16608 </p>
16609 !! end
16610
16611 !! test
16612 Transclusion of nonexistent MediaWiki message
16613 !! wikitext
16614 {{MediaWiki:Mainpagexxx}}
16615 !! html
16616 <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>
16617 </p>
16618 !! end
16619
16620 !! test
16621 Transclusion of MediaWiki message with underscore
16622 !! wikitext
16623 {{MediaWiki:history_short}}
16624 !! html
16625 <p>History
16626 </p>
16627 !! end
16628
16629 !! test
16630 Transclusion of MediaWiki message with space
16631 !! wikitext
16632 {{MediaWiki:history short}}
16633 !! html
16634 <p>History
16635 </p>
16636 !! end
16637
16638 !! test
16639 Invalid header with following text
16640 !! wikitext
16641 = x = y
16642 !! html
16643 <p>= x = y
16644 </p>
16645 !! end
16646
16647
16648 !! test
16649 Section extraction test (section 0)
16650 !! options
16651 section=0
16652 !! wikitext
16653 start
16654 ==a==
16655 ===aa===
16656 ====aaa====
16657 ==b==
16658 ===ba===
16659 ===bb===
16660 ====bba====
16661 ===bc===
16662 ==c==
16663 ===ca===
16664 !! html
16665 start
16666 !! end
16667
16668 !! test
16669 Section extraction test (section 1)
16670 !! options
16671 section=1
16672 !! wikitext
16673 start
16674 ==a==
16675 ===aa===
16676 ====aaa====
16677 ==b==
16678 ===ba===
16679 ===bb===
16680 ====bba====
16681 ===bc===
16682 ==c==
16683 ===ca===
16684 !! html
16685 ==a==
16686 ===aa===
16687 ====aaa====
16688 !! end
16689
16690 !! test
16691 Section extraction test (section 2)
16692 !! options
16693 section=2
16694 !! wikitext
16695 start
16696 ==a==
16697 ===aa===
16698 ====aaa====
16699 ==b==
16700 ===ba===
16701 ===bb===
16702 ====bba====
16703 ===bc===
16704 ==c==
16705 ===ca===
16706 !! html
16707 ===aa===
16708 ====aaa====
16709 !! end
16710
16711 !! test
16712 Section extraction test (section 3)
16713 !! options
16714 section=3
16715 !! wikitext
16716 start
16717 ==a==
16718 ===aa===
16719 ====aaa====
16720 ==b==
16721 ===ba===
16722 ===bb===
16723 ====bba====
16724 ===bc===
16725 ==c==
16726 ===ca===
16727 !! html
16728 ====aaa====
16729 !! end
16730
16731 !! test
16732 Section extraction test (section 4)
16733 !! options
16734 section=4
16735 !! wikitext
16736 start
16737 ==a==
16738 ===aa===
16739 ====aaa====
16740 ==b==
16741 ===ba===
16742 ===bb===
16743 ====bba====
16744 ===bc===
16745 ==c==
16746 ===ca===
16747 !! html
16748 ==b==
16749 ===ba===
16750 ===bb===
16751 ====bba====
16752 ===bc===
16753 !! end
16754
16755 !! test
16756 Section extraction test (section 5)
16757 !! options
16758 section=5
16759 !! wikitext
16760 start
16761 ==a==
16762 ===aa===
16763 ====aaa====
16764 ==b==
16765 ===ba===
16766 ===bb===
16767 ====bba====
16768 ===bc===
16769 ==c==
16770 ===ca===
16771 !! html
16772 ===ba===
16773 !! end
16774
16775 !! test
16776 Section extraction test (section 6)
16777 !! options
16778 section=6
16779 !! wikitext
16780 start
16781 ==a==
16782 ===aa===
16783 ====aaa====
16784 ==b==
16785 ===ba===
16786 ===bb===
16787 ====bba====
16788 ===bc===
16789 ==c==
16790 ===ca===
16791 !! html
16792 ===bb===
16793 ====bba====
16794 !! end
16795
16796 !! test
16797 Section extraction test (section 7)
16798 !! options
16799 section=7
16800 !! wikitext
16801 start
16802 ==a==
16803 ===aa===
16804 ====aaa====
16805 ==b==
16806 ===ba===
16807 ===bb===
16808 ====bba====
16809 ===bc===
16810 ==c==
16811 ===ca===
16812 !! html
16813 ====bba====
16814 !! end
16815
16816 !! test
16817 Section extraction test (section 8)
16818 !! options
16819 section=8
16820 !! wikitext
16821 start
16822 ==a==
16823 ===aa===
16824 ====aaa====
16825 ==b==
16826 ===ba===
16827 ===bb===
16828 ====bba====
16829 ===bc===
16830 ==c==
16831 ===ca===
16832 !! html
16833 ===bc===
16834 !! end
16835
16836 !! test
16837 Section extraction test (section 9)
16838 !! options
16839 section=9
16840 !! wikitext
16841 start
16842 ==a==
16843 ===aa===
16844 ====aaa====
16845 ==b==
16846 ===ba===
16847 ===bb===
16848 ====bba====
16849 ===bc===
16850 ==c==
16851 ===ca===
16852 !! html
16853 ==c==
16854 ===ca===
16855 !! end
16856
16857 !! test
16858 Section extraction test (section 10)
16859 !! options
16860 section=10
16861 !! wikitext
16862 start
16863 ==a==
16864 ===aa===
16865 ====aaa====
16866 ==b==
16867 ===ba===
16868 ===bb===
16869 ====bba====
16870 ===bc===
16871 ==c==
16872 ===ca===
16873 !! html
16874 ===ca===
16875 !! end
16876
16877 !! test
16878 Section extraction test (nonexistent section 11)
16879 !! options
16880 section=11
16881 !! wikitext
16882 start
16883 ==a==
16884 ===aa===
16885 ====aaa====
16886 ==b==
16887 ===ba===
16888 ===bb===
16889 ====bba====
16890 ===bc===
16891 ==c==
16892 ===ca===
16893 !! html
16894 !! end
16895
16896 !! test
16897 Section extraction test with bogus heading (section 1)
16898 !! options
16899 section=1
16900 !! wikitext
16901 ==a==
16902 ==bogus== not a legal section
16903 ==b==
16904 !! html
16905 ==a==
16906 ==bogus== not a legal section
16907 !! end
16908
16909 !! test
16910 Section extraction test with bogus heading (section 2)
16911 !! options
16912 section=2
16913 !! wikitext
16914 ==a==
16915 ==bogus== not a legal section
16916 ==b==
16917 !! html
16918 ==b==
16919 !! end
16920
16921 !! test
16922 Section extraction test with comment after heading (section 1)
16923 !! options
16924 section=1
16925 !! wikitext
16926 ==a==
16927 ==b== <!-- -->
16928 ==c==
16929 !! html
16930 ==a==
16931 !! end
16932
16933 !! test
16934 Section extraction test with comment after heading (section 2)
16935 !! options
16936 section=2
16937 !! wikitext
16938 ==a==
16939 ==b== <!-- -->
16940 ==c==
16941 !! html
16942 ==b== <!-- -->
16943 !! end
16944
16945 !! test
16946 Section extraction test with bogus <nowiki> heading (section 1)
16947 !! options
16948 section=1
16949 !! wikitext
16950 ==a==
16951 ==bogus== <nowiki>not a legal section</nowiki>
16952 ==b==
16953 !! html
16954 ==a==
16955 ==bogus== <nowiki>not a legal section</nowiki>
16956 !! end
16957
16958 !! test
16959 Section extraction test with bogus <nowiki> heading (section 2)
16960 !! options
16961 section=2
16962 !! wikitext
16963 ==a==
16964 ==bogus== <nowiki>not a legal section</nowiki>
16965 ==b==
16966 !! html
16967 ==b==
16968 !! end
16969
16970
16971 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16972 # instead of respecting commented sections
16973 !! test
16974 Section extraction prefixed by comment (section 1)
16975 !! options
16976 section=1
16977 !! wikitext
16978 <!-- -->==sec1==
16979 ==sec2==
16980 !! html
16981 ==sec2==
16982 !!end
16983
16984 !! test
16985 Section extraction prefixed by comment (section 2)
16986 !! options
16987 section=2
16988 !! wikitext
16989 <!-- -->==sec1==
16990 ==sec2==
16991 !! html
16992
16993 !!end
16994
16995
16996 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16997 # instead of respecting HTML-style headings
16998 !! test
16999 Section extraction, mixed wiki and html (section 1)
17000 !! options
17001 section=1
17002 !! wikitext
17003 <h2>unmarked</h2>
17004 unmarked
17005 ==1==
17006 one
17007 ==2==
17008 two
17009 !! html
17010 ==1==
17011 one
17012 !! end
17013
17014 !! test
17015 Section extraction, mixed wiki and html (section 2)
17016 !! options
17017 section=2
17018 !! wikitext
17019 <h2>unmarked</h2>
17020 unmarked
17021 ==1==
17022 one
17023 ==2==
17024 two
17025 !! html
17026 ==2==
17027 two
17028 !! end
17029
17030
17031 # Formerly testing for bug 3342
17032 !! test
17033 Section extraction, heading surrounded by <noinclude>
17034 !! options
17035 section=1
17036 !! wikitext
17037 <noinclude>==unmarked==</noinclude>
17038 ==marked==
17039 !! html
17040 ==marked==
17041 !!end
17042
17043 # Test behavior of bug 19910
17044 !! test
17045 Sectiion with all-equals
17046 !! options
17047 section=2
17048 !! wikitext
17049 ===
17050 The line above must have a trailing space
17051 === <!--
17052 --> <!-- -->
17053 But just in case it doesn't...
17054 !! html
17055 === <!--
17056 --> <!-- -->
17057 But just in case it doesn't...
17058 !! end
17059
17060 !! test
17061 Section replacement test (section 0)
17062 !! options
17063 replace=0,"xxx"
17064 !! wikitext
17065 start
17066 ==a==
17067 ===aa===
17068 ====aaa====
17069 ==b==
17070 ===ba===
17071 ===bb===
17072 ====bba====
17073 ===bc===
17074 ==c==
17075 ===ca===
17076 !! html
17077 xxx
17078
17079 ==a==
17080 ===aa===
17081 ====aaa====
17082 ==b==
17083 ===ba===
17084 ===bb===
17085 ====bba====
17086 ===bc===
17087 ==c==
17088 ===ca===
17089 !! end
17090
17091 !! test
17092 Section replacement test (section 1)
17093 !! options
17094 replace=1,"xxx"
17095 !! wikitext
17096 start
17097 ==a==
17098 ===aa===
17099 ====aaa====
17100 ==b==
17101 ===ba===
17102 ===bb===
17103 ====bba====
17104 ===bc===
17105 ==c==
17106 ===ca===
17107 !! html
17108 start
17109 xxx
17110
17111 ==b==
17112 ===ba===
17113 ===bb===
17114 ====bba====
17115 ===bc===
17116 ==c==
17117 ===ca===
17118 !! end
17119
17120 !! test
17121 Section replacement test (section 2)
17122 !! options
17123 replace=2,"xxx"
17124 !! wikitext
17125 start
17126 ==a==
17127 ===aa===
17128 ====aaa====
17129 ==b==
17130 ===ba===
17131 ===bb===
17132 ====bba====
17133 ===bc===
17134 ==c==
17135 ===ca===
17136 !! html
17137 start
17138 ==a==
17139 xxx
17140
17141 ==b==
17142 ===ba===
17143 ===bb===
17144 ====bba====
17145 ===bc===
17146 ==c==
17147 ===ca===
17148 !! end
17149
17150 !! test
17151 Section replacement test (section 3)
17152 !! options
17153 replace=3,"xxx"
17154 !! wikitext
17155 start
17156 ==a==
17157 ===aa===
17158 ====aaa====
17159 ==b==
17160 ===ba===
17161 ===bb===
17162 ====bba====
17163 ===bc===
17164 ==c==
17165 ===ca===
17166 !! html
17167 start
17168 ==a==
17169 ===aa===
17170 xxx
17171
17172 ==b==
17173 ===ba===
17174 ===bb===
17175 ====bba====
17176 ===bc===
17177 ==c==
17178 ===ca===
17179 !! end
17180
17181 !! test
17182 Section replacement test (section 4)
17183 !! options
17184 replace=4,"xxx"
17185 !! wikitext
17186 start
17187 ==a==
17188 ===aa===
17189 ====aaa====
17190 ==b==
17191 ===ba===
17192 ===bb===
17193 ====bba====
17194 ===bc===
17195 ==c==
17196 ===ca===
17197 !! html
17198 start
17199 ==a==
17200 ===aa===
17201 ====aaa====
17202 xxx
17203
17204 ==c==
17205 ===ca===
17206 !! end
17207
17208 !! test
17209 Section replacement test (section 5)
17210 !! options
17211 replace=5,"xxx"
17212 !! wikitext
17213 start
17214 ==a==
17215 ===aa===
17216 ====aaa====
17217 ==b==
17218 ===ba===
17219 ===bb===
17220 ====bba====
17221 ===bc===
17222 ==c==
17223 ===ca===
17224 !! html
17225 start
17226 ==a==
17227 ===aa===
17228 ====aaa====
17229 ==b==
17230 xxx
17231
17232 ===bb===
17233 ====bba====
17234 ===bc===
17235 ==c==
17236 ===ca===
17237 !! end
17238
17239 !! test
17240 Section replacement test (section 6)
17241 !! options
17242 replace=6,"xxx"
17243 !! wikitext
17244 start
17245 ==a==
17246 ===aa===
17247 ====aaa====
17248 ==b==
17249 ===ba===
17250 ===bb===
17251 ====bba====
17252 ===bc===
17253 ==c==
17254 ===ca===
17255 !! html
17256 start
17257 ==a==
17258 ===aa===
17259 ====aaa====
17260 ==b==
17261 ===ba===
17262 xxx
17263
17264 ===bc===
17265 ==c==
17266 ===ca===
17267 !! end
17268
17269 !! test
17270 Section replacement test (section 7)
17271 !! options
17272 replace=7,"xxx"
17273 !! wikitext
17274 start
17275 ==a==
17276 ===aa===
17277 ====aaa====
17278 ==b==
17279 ===ba===
17280 ===bb===
17281 ====bba====
17282 ===bc===
17283 ==c==
17284 ===ca===
17285 !! html
17286 start
17287 ==a==
17288 ===aa===
17289 ====aaa====
17290 ==b==
17291 ===ba===
17292 ===bb===
17293 xxx
17294
17295 ===bc===
17296 ==c==
17297 ===ca===
17298 !! end
17299
17300 !! test
17301 Section replacement test (section 8)
17302 !! options
17303 replace=8,"xxx"
17304 !! wikitext
17305 start
17306 ==a==
17307 ===aa===
17308 ====aaa====
17309 ==b==
17310 ===ba===
17311 ===bb===
17312 ====bba====
17313 ===bc===
17314 ==c==
17315 ===ca===
17316 !! html
17317 start
17318 ==a==
17319 ===aa===
17320 ====aaa====
17321 ==b==
17322 ===ba===
17323 ===bb===
17324 ====bba====
17325 xxx
17326
17327 ==c==
17328 ===ca===
17329 !!end
17330
17331 !! test
17332 Section replacement test (section 9)
17333 !! options
17334 replace=9,"xxx"
17335 !! wikitext
17336 start
17337 ==a==
17338 ===aa===
17339 ====aaa====
17340 ==b==
17341 ===ba===
17342 ===bb===
17343 ====bba====
17344 ===bc===
17345 ==c==
17346 ===ca===
17347 !! html
17348 start
17349 ==a==
17350 ===aa===
17351 ====aaa====
17352 ==b==
17353 ===ba===
17354 ===bb===
17355 ====bba====
17356 ===bc===
17357 xxx
17358 !! end
17359
17360 !! test
17361 Section replacement test (section 10)
17362 !! options
17363 replace=10,"xxx"
17364 !! wikitext
17365 start
17366 ==a==
17367 ===aa===
17368 ====aaa====
17369 ==b==
17370 ===ba===
17371 ===bb===
17372 ====bba====
17373 ===bc===
17374 ==c==
17375 ===ca===
17376 !! html
17377 start
17378 ==a==
17379 ===aa===
17380 ====aaa====
17381 ==b==
17382 ===ba===
17383 ===bb===
17384 ====bba====
17385 ===bc===
17386 ==c==
17387 xxx
17388 !! end
17389
17390 !! test
17391 Section replacement test with initial whitespace (bug 13728)
17392 !! options
17393 replace=2,"xxx"
17394 !! wikitext
17395 Preformatted initial line
17396 ==a==
17397 ===a===
17398 !! html
17399 Preformatted initial line
17400 ==a==
17401 xxx
17402 !! end
17403
17404
17405 !! test
17406 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17407 !! options
17408 section=1
17409 !! wikitext
17410 ==a==
17411 a
17412 !! html
17413 ==a==
17414 a
17415 !! end
17416
17417 !! test
17418 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17419 !! options
17420 section=1
17421 !! wikitext
17422 ==a==
17423 a
17424 !! html
17425 ==a==
17426 a
17427 !! end
17428
17429
17430 !! test
17431 Section extraction, <pre> around bogus header (bug 10309)
17432 !! options
17433 noxml section=2
17434 !! wikitext
17435 == Section One ==
17436 <pre>
17437 =======
17438 </pre>
17439
17440 == Section Two ==
17441 stuff
17442 !! html
17443 == Section Two ==
17444 stuff
17445 !! end
17446
17447 !! test
17448 Section replacement, <pre> around bogus header (bug 10309)
17449 !! options
17450 noxml replace=2,"xxx"
17451 !! wikitext
17452 == Section One ==
17453 <pre>
17454 =======
17455 </pre>
17456
17457 == Section Two ==
17458 stuff
17459 !! html
17460 == Section One ==
17461 <pre>
17462 =======
17463 </pre>
17464
17465 xxx
17466 !! end
17467
17468
17469
17470 !! test
17471 Handling of &#x0A; in URLs
17472 !! wikitext
17473 ** irc://&#x0A;a
17474 !! html/php
17475 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17476
17477 !! html/parsoid
17478 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17479 a">irc://
17480 a</a></li></ul></li></ul>
17481 !! end
17482
17483 !! test
17484 Handling of %0A in URLs
17485 !! wikitext
17486 ** irc://%0Aa
17487 !! html/php
17488 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17489
17490 !! html/parsoid
17491 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17492 !! end
17493
17494
17495 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17496 !! test
17497 5 quotes, code coverage +1 line
17498 !! options
17499 parsoid=wt2html
17500 !! wikitext
17501 '''''
17502 !! html/php
17503 !! html/parsoid
17504 <p><b><i></i></b></p>
17505 !! end
17506
17507 # same html as previous, but wikitext adjusted to match parsoid html2wt
17508 # note that wt2html and html2html will put the <i> before the <b>
17509 !! test
17510 5 quotes, code coverage +1 line w/ nowiki (1)
17511 !! options
17512 parsoid=wt2wt,html2wt
17513 !! wikitext
17514 '''''<nowiki/>'''''
17515 !! html/php
17516 <p><i></i>
17517 </p>
17518 !! html/parsoid
17519 <p><b><i></i></b></p>
17520 !! end
17521
17522 # same as previous, just swapping the <i> and <b>
17523 !! test
17524 5 quotes, code coverage +1 line w/ nowiki (2)
17525 !! wikitext
17526 '''''<nowiki/>'''''
17527 !! html/php
17528 <p><i></i>
17529 </p>
17530 !! html/parsoid
17531 <p><i><b></b></i></p>
17532 !! end
17533
17534 !! test
17535 Special:Search page linking.
17536 !! wikitext
17537 {{Special:search}}
17538 !! html
17539 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17540 </p>
17541 !! end
17542
17543 !! test
17544 {{!}} is a magic word
17545 !! wikitext
17546 {{!}} is a magic word there and {{!}} is still a magic word here
17547 !! html/php
17548 <p>| is a magic word there and | is still a magic word here
17549 </p>
17550 !! html/parsoid
17551 <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>
17552 !! end
17553
17554 !! test
17555 Say the magic word
17556 !! options
17557 title=[[Parser test]]
17558 !! wikitext
17559 * {{PAGENAME}}
17560 * {{PAGENAMEE}}
17561 * {{FULLPAGENAME}}
17562 * {{FULLPAGENAMEE}}
17563 * {{BASEPAGENAME}}
17564 * {{BASEPAGENAMEE}}
17565 * {{SUBPAGENAME}}
17566 * {{SUBPAGENAMEE}}
17567 * {{ROOTPAGENAME}}
17568 * {{ROOTPAGENAMEE}}
17569 * {{TALKPAGENAME}}
17570 * {{TALKPAGENAMEE}}
17571 * {{SUBJECTPAGENAME}}
17572 * {{SUBJECTPAGENAMEE}}
17573 * {{NAMESPACEE}}
17574 * {{NAMESPACE}}
17575 * {{NAMESPACENUMBER}}
17576 * {{TALKSPACE}}
17577 * {{TALKSPACEE}}
17578 * {{SUBJECTSPACE}}
17579 * {{SUBJECTSPACEE}}
17580 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17581 !! html
17582 <ul><li> Parser test</li>
17583 <li> Parser_test</li>
17584 <li> Parser test</li>
17585 <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> Talk:Parser test</li>
17593 <li> Talk:Parser_test</li>
17594 <li> Parser test</li>
17595 <li> Parser_test</li>
17596 <li> </li>
17597 <li> </li>
17598 <li> 0</li>
17599 <li> Talk</li>
17600 <li> Talk</li>
17601 <li> </li>
17602 <li> </li>
17603 <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>
17604
17605 !! end
17606 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17607
17608 !! test
17609 Gallery
17610 !! wikitext
17611 <gallery>
17612 image1.png |
17613 image2.gif|||||
17614
17615 image3|
17616 image4 |300px| centre
17617 image5.svg| http://///////
17618 [[x|xx]]]]
17619 * image6
17620 </gallery>
17621 !! html
17622 <ul class="gallery mw-gallery-traditional">
17623 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17624 <div class="thumb" style="height: 150px;">Image1.png</div>
17625 <div class="gallerytext">
17626 </div>
17627 </div></li>
17628 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17629 <div class="thumb" style="height: 150px;">Image2.gif</div>
17630 <div class="gallerytext">
17631 <p>||||
17632 </p>
17633 </div>
17634 </div></li>
17635 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17636 <div class="thumb" style="height: 150px;">Image3</div>
17637 <div class="gallerytext">
17638 </div>
17639 </div></li>
17640 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17641 <div class="thumb" style="height: 150px;">Image4</div>
17642 <div class="gallerytext">
17643 <p>300px| centre
17644 </p>
17645 </div>
17646 </div></li>
17647 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17648 <div class="thumb" style="height: 150px;">Image5.svg</div>
17649 <div class="gallerytext">
17650 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17651 </p>
17652 </div>
17653 </div></li>
17654 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17655 <div class="thumb" style="height: 150px;">* image6</div>
17656 <div class="gallerytext">
17657 </div>
17658 </div></li>
17659 </ul>
17660
17661 !! end
17662
17663 !! test
17664 Gallery (with options)
17665 !! wikitext
17666 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17667 File:Nonexistent.jpg|caption
17668 File:Nonexistent.jpg
17669 image:foobar.jpg|some '''caption''' [[Main Page]]
17670 image:foobar.jpg
17671 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17672 </gallery>
17673 !! html
17674 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17675 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17676 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17677 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17678 <div class="gallerytext">
17679 <p>caption
17680 </p>
17681 </div>
17682 </div></li>
17683 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17684 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17685 <div class="gallerytext">
17686 </div>
17687 </div></li>
17688 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17689 <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>
17690 <div class="gallerytext">
17691 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17692 </p>
17693 </div>
17694 </div></li>
17695 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17696 <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>
17697 <div class="gallerytext">
17698 </div>
17699 </div></li>
17700 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17701 <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>
17702 <div class="gallerytext">
17703 <p>Blabla|blabla.
17704 </p>
17705 </div>
17706 </div></li>
17707 </ul>
17708
17709 !! end
17710
17711 !! test
17712 Gallery with link that has fragment
17713 !! wikitext
17714 <gallery>
17715 image:foobar.jpg|link=Main_Page
17716 image:foobar.jpg|link=Main_Page#section
17717 image:foobar.jpg|link=Main Page#section|caption
17718 </gallery>
17719 !! html
17720 <ul class="gallery mw-gallery-traditional">
17721 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17722 <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>
17723 <div class="gallerytext">
17724 </div>
17725 </div></li>
17726 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17727 <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>
17728 <div class="gallerytext">
17729 </div>
17730 </div></li>
17731 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17732 <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>
17733 <div class="gallerytext">
17734 <p>caption
17735 </p>
17736 </div>
17737 </div></li>
17738 </ul>
17739
17740 !! end
17741
17742 !! test
17743 Gallery with wikitext inside caption
17744 !! wikitext
17745 <gallery>
17746 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17747 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17748 </gallery>
17749 !! html
17750 <ul class="gallery mw-gallery-traditional">
17751 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17752 <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>
17753 <div class="gallerytext">
17754 <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>
17755 </p>
17756 </div>
17757 </div></li>
17758 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17759 <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>
17760 <div class="gallerytext">
17761 <p>This is a test template
17762 </p>
17763 </div>
17764 </div></li>
17765 </ul>
17766
17767 !! end
17768
17769 !! test
17770 gallery (with showfilename option)
17771 !! wikitext
17772 <gallery showfilename>
17773 File:Nonexistent.jpg|caption
17774 File:Nonexistent.jpg
17775 image:foobar.jpg|some '''caption''' [[Main Page]]
17776 File:Foobar.jpg
17777 </gallery>
17778 !! html
17779 <ul class="gallery mw-gallery-traditional">
17780 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17781 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17782 <div class="gallerytext">
17783 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17784 caption
17785 </p>
17786 </div>
17787 </div></li>
17788 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17789 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17790 <div class="gallerytext">
17791 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17792 </p>
17793 </div>
17794 </div></li>
17795 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17796 <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>
17797 <div class="gallerytext">
17798 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17799 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17800 </p>
17801 </div>
17802 </div></li>
17803 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17804 <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>
17805 <div class="gallerytext">
17806 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17807 </p>
17808 </div>
17809 </div></li>
17810 </ul>
17811
17812 !! end
17813
17814 !! test
17815 Gallery (with namespace-less filenames)
17816 !! wikitext
17817 <gallery>
17818 File:Nonexistent.jpg
17819 Nonexistent.jpg
17820 image:foobar.jpg
17821 foobar.jpg
17822 </gallery>
17823 !! html
17824 <ul class="gallery mw-gallery-traditional">
17825 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17826 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17827 <div class="gallerytext">
17828 </div>
17829 </div></li>
17830 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17831 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17832 <div class="gallerytext">
17833 </div>
17834 </div></li>
17835 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17836 <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>
17837 <div class="gallerytext">
17838 </div>
17839 </div></li>
17840 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17841 <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>
17842 <div class="gallerytext">
17843 </div>
17844 </div></li>
17845 </ul>
17846
17847 !! end
17848
17849 !! test
17850 HTML Hex character encoding (spells the word "JavaScript")
17851 !! options
17852 parsoid=wt2html,wt2wt,html2html
17853 !! wikitext
17854 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17855 !! html/php
17856 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17857 </p>
17858 !! html/php+tidy
17859 <p>JavaScript</p>
17860 !! html/parsoid
17861 <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>
17862 !! end
17863
17864 !! test
17865 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17866 !! wikitext
17867 &#xsee;&#XSEE;
17868 !! html/php
17869 <p>&amp;#xsee;&amp;#XSEE;
17870 </p>
17871 !! html/parsoid
17872 <p>&amp;#xsee;&amp;#XSEE;</p>
17873 !! end
17874
17875 !! test
17876 HTML Hex character encoding mixed case
17877 !! options
17878 parsoid=wt2html,wt2wt,html2html
17879 !! wikitext
17880 &#xEE;&#Xee;
17881 !! html/php
17882 <p>&#xee;&#xee;
17883 </p>
17884 !! html/php+tidy
17885 <p>îî</p>
17886 !! html/parsoid
17887 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17888 !! end
17889
17890 !! test
17891 __FORCETOC__ override
17892 !! wikitext
17893 __NEWSECTIONLINK__
17894 __FORCETOC__
17895 !! html/php
17896 <p><br />
17897 </p>
17898 !! end
17899
17900 !! test
17901 ISBN code coverage
17902 !! wikitext
17903 ISBN 978-0-1234-56&#x20;789
17904 !! html
17905 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17906 </p>
17907 !! html+tidy
17908 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17909 !! html/parsoid
17910 <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>
17911 !! end
17912
17913 !! test
17914 ISBN followed by 5 spaces
17915 !! wikitext
17916 ISBN
17917 !! html
17918 <p>ISBN
17919 </p>
17920 !! end
17921
17922 !! test
17923 Double ISBN
17924 !! wikitext
17925 ISBN ISBN 1234567890
17926 !! html/php
17927 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17928 </p>
17929 !! html/parsoid
17930 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17931 !! end
17932
17933 !! test
17934 ISBN with an X
17935 !! wikitext
17936 ISBN 3-462-04561-X
17937 ISBN 080442957X
17938 ISBN 978080442957X
17939 !! html/php
17940 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17941 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17942 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17943 </p>
17944 !! html/parsoid
17945 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17946 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17947 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17948 !! end
17949
17950 !! test
17951 ISBN with empty prefix (parsoid test)
17952 !! wikitext
17953 ISBN 1234567890
17954 !! html/php
17955 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17956 </p>
17957 !! html/parsoid
17958 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17959 !! end
17960
17961 !! test
17962 Bug 22905: <abbr> followed by ISBN followed by </a>
17963 !! wikitext
17964 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17965 !! html/php
17966 <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>
17967 </p>
17968 !! html/parsoid
17969 <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>
17970 !! end
17971
17972 !! test
17973 Double RFC
17974 !! wikitext
17975 RFC RFC 1234
17976 !! html
17977 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17978 </p>
17979 !! end
17980
17981 !! test
17982 Double RFC with a wiki link
17983 !! wikitext
17984 RFC [[RFC 1234]]
17985 !! html
17986 <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>
17987 </p>
17988 !! end
17989
17990 !! test
17991 RFC code coverage
17992 !! wikitext
17993 RFC 983&#x20;987
17994 !! html
17995 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17996 </p>
17997 !! html+tidy
17998 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17999 !! end
18000
18001 !! test
18002 Centre-aligned image
18003 !! wikitext
18004 [[Image:foobar.jpg|centre]]
18005 !! html
18006 <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>
18007
18008 !!end
18009
18010 !! test
18011 None-aligned image
18012 !! wikitext
18013 [[Image:foobar.jpg|none]]
18014 !! html
18015 <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>
18016
18017 !!end
18018
18019 !! test
18020 Width + Height sized image (using px) (height is ignored)
18021 !! wikitext
18022 [[Image:foobar.jpg|640x480px]]
18023 !! html
18024 <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>
18025 </p>
18026 !!end
18027
18028 !! test
18029 Width-sized image (using px, no following whitespace)
18030 !! wikitext
18031 [[Image:foobar.jpg|640px]]
18032 !! html
18033 <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>
18034 </p>
18035 !!end
18036
18037 !! test
18038 Width-sized image (using px, with following whitespace - test regression from r39467)
18039 !! wikitext
18040 [[Image:foobar.jpg|640px ]]
18041 !! html
18042 <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>
18043 </p>
18044 !!end
18045
18046 !! test
18047 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18048 !! wikitext
18049 [[Image:foobar.jpg| 640px]]
18050 !! html
18051 <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>
18052 </p>
18053 !!end
18054
18055 !! test
18056 Image with page parameter
18057 !! options
18058 djvu
18059 !! wikitext
18060 [[File:LoremIpsum.djvu|page=2]]
18061 !! html/php
18062 <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>
18063 </p>
18064 !! html/parsoid
18065 <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>
18066 !! end
18067
18068 !! test
18069 Another italics / bold test
18070 !! wikitext
18071 ''' ''x'
18072 !! html
18073 <pre>'<i> </i>x'
18074 </pre>
18075 !!end
18076
18077 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18078 !! test
18079 dt/dd/dl test
18080 !! wikitext
18081 :;;;::
18082 !! html/php
18083 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18084
18085 !! html/parsoid
18086 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18087
18088 !!end
18089
18090
18091 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18092 !! test
18093 Images with the "|" character in the comment
18094 !! wikitext
18095 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18096 !! html/php
18097 <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>
18098
18099 !! html/parsoid
18100 <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>
18101 !! end
18102
18103 !! test
18104 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18105 !! wikitext
18106 <html><script>alert(1);</script></html>
18107 !! html
18108 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18109 </p>
18110 !! end
18111
18112 !! test
18113 HTML with raw HTML ($wgRawHtml==true)
18114 !! options
18115 wgRawHtml=1
18116 !! wikitext
18117 <html><script>alert(1);</script></html>
18118 !! html
18119 <p><script>alert(1);</script>
18120 </p>
18121 !! end
18122
18123 !! test
18124 Parents of subpages, one level up
18125 !! options
18126 subpage title=[[Subpage test/L1/L2/L3]]
18127 !! wikitext
18128 [[../|L2]]
18129 !! html
18130 <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>
18131 </p>
18132 !! end
18133
18134
18135 !! test
18136 Parents of subpages, one level up, not named
18137 !! options
18138 subpage title=[[Subpage test/L1/L2/L3]]
18139 !! wikitext
18140 [[../]]
18141 !! html
18142 <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>
18143 </p>
18144 !! end
18145
18146
18147
18148 !! test
18149 Parents of subpages, two levels up
18150 !! options
18151 subpage title=[[Subpage test/L1/L2/L3]]
18152 !! wikitext
18153 [[../../|L1]]2
18154
18155 [[../../|L1]]l
18156 !! html
18157 <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
18158 </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>
18159 </p>
18160 !! end
18161
18162 !! test
18163 Parents of subpages, two levels up, without trailing slash or name.
18164 !! options
18165 subpage title=[[Subpage test/L1/L2/L3]]
18166 !! wikitext
18167 [[../..]]
18168 !! html
18169 <p>[[../..]]
18170 </p>
18171 !! end
18172
18173 !! test
18174 Parents of subpages, two levels up, with lots of extra trailing slashes.
18175 !! options
18176 subpage title=[[Subpage test/L1/L2/L3]]
18177 !! wikitext
18178 [[../../////]]
18179 !! html
18180 <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>
18181 </p>
18182 !! end
18183
18184 !! article
18185 Subpage test/L1/L2/L3Sibling
18186 !! text
18187 Sibling article
18188 !! endarticle
18189
18190 !! test
18191 Transclusion of a sibling page (one level up)
18192 !! options
18193 subpage title=[[Subpage test/L1/L2/L3]]
18194 !! wikitext
18195 {{../L3Sibling}}
18196 !! html
18197 <p>Sibling article
18198 </p>
18199 !! end
18200
18201 !! test
18202 Transclusion of a child page
18203 !! options
18204 subpage title=[[Subpage test/L1/L2]]
18205 !! wikitext
18206 {{/L3Sibling}}
18207 !! html
18208 <p>Sibling article
18209 </p>
18210 !! end
18211
18212 !! test
18213 Non-transclusion because of too many up levels
18214 !! options
18215 subpage title=[[Subpage test/L1/L2/L3]]
18216 !! wikitext
18217 {{../../../../More than parent}}
18218 !! html
18219 <p>{{../../../../More than parent}}
18220 </p>
18221 !! end
18222
18223 !! test
18224 Definition list code coverage
18225 !! wikitext
18226 ; title : def
18227 ; title : def
18228 ;title: def
18229 !! html/php
18230 <dl><dt> title &#160;</dt>
18231 <dd> def</dd>
18232 <dt> title&#160;</dt>
18233 <dd> def</dd>
18234 <dt>title</dt>
18235 <dd> def</dd></dl>
18236
18237 !! html/parsoid
18238 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18239 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18240 <dt>title</dt><dd> def</dd></dl>
18241 !! end
18242
18243 !! test
18244 Don't fall for the self-closing div
18245 !! wikitext
18246 <div>hello world</div/>
18247 !! html
18248 <div>hello world</div>
18249
18250 !! end
18251
18252 !! test
18253 MSGNW magic word
18254 !! wikitext
18255 {{MSGNW:msg}}
18256 !! html
18257 <p>&#91;&#91;:Template:Msg&#93;&#93;
18258 </p>
18259 !! end
18260
18261 !! test
18262 RAW magic word
18263 !! wikitext
18264 {{RAW:QUERTY}}
18265 !! html
18266 <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>
18267 </p>
18268 !! end
18269
18270 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18271 !! test
18272 Always escape literal '>' in output, not just after '<'
18273 !! wikitext
18274 ><>
18275 !! html
18276 <p>&gt;&lt;&gt;
18277 </p>
18278 !! end
18279
18280 !! test
18281 Template caching
18282 !! wikitext
18283 {{Test}}
18284 {{Test}}
18285 !! html
18286 <p>This is a test template
18287 This is a test template
18288 </p>
18289 !! end
18290
18291
18292 !! article
18293 MediaWiki:Fake
18294 !! text
18295 ==header==
18296 !! endarticle
18297
18298 !! test
18299 Inclusion of !userCanEdit() content
18300 !! wikitext
18301 {{MediaWiki:Fake}}
18302 !! html
18303 <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>
18304
18305 !! end
18306
18307
18308 !! test
18309 Out-of-order TOC heading levels
18310 !! wikitext
18311 ==2==
18312 ======6======
18313 ===3===
18314 =1=
18315 =====5=====
18316 ==2==
18317 !! html
18318 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18319 <ul>
18320 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18321 <ul>
18322 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18323 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18324 </ul>
18325 </li>
18326 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18327 <ul>
18328 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18329 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18330 </ul>
18331 </li>
18332 </ul>
18333 </div>
18334
18335 <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>
18336 <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>
18337 <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>
18338 <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>
18339 <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>
18340 <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>
18341
18342 !! end
18343
18344
18345 !! test
18346 ISBN with a dummy number
18347 !! wikitext
18348 ISBN ---
18349 !! html
18350 <p>ISBN ---
18351 </p>
18352 !! end
18353
18354
18355 !! test
18356 ISBN with space-delimited number
18357 !! wikitext
18358 ISBN 92 9017 032 8
18359 !! html
18360 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18361 </p>
18362 !! end
18363
18364
18365 !! test
18366 ISBN with multiple spaces, no number
18367 !! wikitext
18368 ISBN foo
18369 !! html
18370 <p>ISBN foo
18371 </p>
18372 !! end
18373
18374
18375 !! test
18376 ISBN length
18377 !! wikitext
18378 ISBN 123456789
18379
18380 ISBN 1234567890
18381
18382 ISBN 12345678901
18383 !! html
18384 <p>ISBN 123456789
18385 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18386 </p><p>ISBN 12345678901
18387 </p>
18388 !! end
18389
18390
18391 !! test
18392 ISBN with trailing year (bug 8110)
18393 !! wikitext
18394 ISBN 1-234-56789-0 - 2006
18395
18396 ISBN 1 234 56789 0 - 2006
18397 !! html
18398 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18399 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18400 </p>
18401 !! end
18402
18403
18404 !! test
18405 anchorencode
18406 !! wikitext
18407 {{anchorencode:foo bar©#%n}}
18408 !! html
18409 <p>foo_bar.C2.A9.23.25n
18410 </p>
18411 !! end
18412
18413 !! test
18414 anchorencode trims spaces
18415 !! wikitext
18416 {{anchorencode: __pretty__please__}}
18417 !! html
18418 <p>pretty_please
18419 </p>
18420 !! end
18421
18422 !! test
18423 anchorencode deals with links
18424 !! wikitext
18425 {{anchorencode: [[hello|world]] [[hi]]}}
18426 !! html
18427 <p>world_hi
18428 </p>
18429 !! end
18430
18431 !! test
18432 anchorencode deals with templates
18433 !! wikitext
18434 {{anchorencode: {{Foo}} }}
18435 !! html
18436 <p>FOO
18437 </p>
18438 !! end
18439
18440 !! test
18441 anchorencode encodes like the TOC generator: (bug 18431)
18442 !! wikitext
18443 === _ +:.3A%3A&&amp;]] ===
18444 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18445 __NOEDITSECTION__
18446 !! html
18447 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18448 <p>.2B:.3A.253A.26.26.5D.5D
18449 </p>
18450 !! end
18451
18452 !! test
18453 Bug 6200: blockquotes and paragraph formatting
18454 !! wikitext
18455 <blockquote>
18456 foo
18457 </blockquote>
18458
18459 bar
18460
18461 baz
18462 !! html
18463 <blockquote>
18464 <p>foo
18465 </p>
18466 </blockquote>
18467 <p>bar
18468 </p>
18469 <pre>baz
18470 </pre>
18471 !! end
18472
18473 !! test
18474 Bug 8293: Use of center tag ruins paragraph formatting
18475 !! wikitext
18476 <center>
18477 foo
18478 </center>
18479
18480 bar
18481
18482 baz
18483 !! html
18484 <center>
18485 <p>foo
18486 </p>
18487 </center>
18488 <p>bar
18489 </p>
18490 <pre>baz
18491 </pre>
18492 !! end
18493
18494 !!test
18495 Parsing of overlapping (improperly nested) inline html tags
18496 !! wikitext
18497 <span><s>x</span></s>
18498 !! html/php
18499 <p><span><s>x&lt;/span&gt;</s></span>
18500 </p>
18501 !! html/parsoid
18502 <p><span><s>x</s></span>
18503 </p>
18504 !!end
18505
18506 ###
18507 ### Language variants related tests
18508 ###
18509 !! test
18510 Self-link in language variants
18511 !! options
18512 title=[[Dunav]] language=sr
18513 !! wikitext
18514 Both [[Dunav]] and [[Дунав]] are names for this river.
18515 !! html
18516 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18517 </p>
18518 !!end
18519
18520 !! article
18521 Дуна
18522 !! text
18523 content
18524 !! endarticle
18525
18526 !! test
18527 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18528 !! options
18529 title=[[Duna]] language=sr
18530 !! wikitext
18531 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18532 !! html
18533 <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.
18534 </p>
18535 !! end
18536
18537 !! test
18538 Link to a section of a variant of this title shouldn't be parsed as self-link
18539 !! options
18540 title=[[Duna]] language=sr
18541 !! wikitext
18542 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18543 !! html
18544 <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.
18545 </p>
18546 !! end
18547
18548 !! test
18549 Link to pages in language variants
18550 !! options
18551 language=sr
18552 !! wikitext
18553 Main Page can be written as [[Маин Паге]]
18554 !! html
18555 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18556 </p>
18557 !!end
18558
18559
18560 !! test
18561 Multiple links to pages in language variants
18562 !! options
18563 language=sr
18564 !! wikitext
18565 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18566 !! html
18567 <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>.
18568 </p>
18569 !!end
18570
18571
18572 !! test
18573 Simple template in language variants
18574 !! options
18575 language=sr
18576 !! wikitext
18577 {{тест}}
18578 !! html
18579 <p>This is a test template
18580 </p>
18581 !! end
18582
18583
18584 !! test
18585 Template with explicit namespace in language variants
18586 !! options
18587 language=sr
18588 !! wikitext
18589 {{Template:тест}}
18590 !! html
18591 <p>This is a test template
18592 </p>
18593 !! end
18594
18595
18596 !! test
18597 Basic test for template parameter in language variants
18598 !! options
18599 language=sr
18600 !! wikitext
18601 {{парамтест|param=foo}}
18602 !! html
18603 <p>This is a test template with parameter foo
18604 </p>
18605 !! end
18606
18607
18608 !! test
18609 Simple category in language variants
18610 !! options
18611 language=sr cat
18612 !! wikitext
18613 [[Category:МедиаWики Усер'с Гуиде]]
18614 !! html
18615 <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>
18616 !! end
18617
18618
18619 !! article
18620 Category:分类
18621 !! text
18622 blah
18623 !! endarticle
18624
18625 !! article
18626 Category:分類
18627 !! text
18628 blah
18629 !! endarticle
18630
18631 !! test
18632 Don't convert blue categorylinks to another variant (bug 33210)
18633 !! options
18634 language=zh cat
18635 !! wikitext
18636 [[A]][[Category:分类]]
18637 !! html
18638 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18639 !! end
18640
18641
18642 !! test
18643 Stripping -{}- tags (language variants)
18644 !! options
18645 language=sr
18646 !! wikitext
18647 Latin proverb: -{Ne nuntium necare}-
18648 !! html
18649 <p>Latin proverb: Ne nuntium necare
18650 </p>
18651 !! end
18652
18653
18654 !! test
18655 Prevent conversion with -{}- tags (language variants)
18656 !! options
18657 language=sr variant=sr-ec
18658 !! wikitext
18659 Latinski: -{Ne nuntium necare}-
18660 !! html
18661 <p>Латински: Ne nuntium necare
18662 </p>
18663 !! end
18664
18665
18666 !! test
18667 Prevent conversion of text with -{}- tags (language variants)
18668 !! options
18669 language=sr variant=sr-ec
18670 !! wikitext
18671 Latinski: -{Ne nuntium necare}-
18672 !! html
18673 <p>Латински: Ne nuntium necare
18674 </p>
18675 !! end
18676
18677
18678 !! test
18679 Prevent conversion of links with -{}- tags (language variants)
18680 !! options
18681 language=sr variant=sr-ec
18682 !! wikitext
18683 -{[[Main Page]]}-
18684 !! html
18685 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18686 </p>
18687 !! end
18688
18689
18690 !! test
18691 -{}- tags within headlines (within html for parserConvert())
18692 !! options
18693 language=sr variant=sr-ec
18694 !! wikitext
18695 == -{Naslov}- ==
18696 !! html
18697 <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>
18698
18699 !! end
18700
18701
18702 !! test
18703 Explicit definition of language variant alternatives
18704 !! options
18705 language=zh variant=zh-tw
18706 !! wikitext
18707 -{zh:China;zh-tw:Taiwan}-, not China
18708 !! html
18709 <p>Taiwan, not China
18710 </p>
18711 !! end
18712
18713
18714 !! test
18715 Conversion around HTML tags
18716 !! options
18717 language=sr variant=sr-ec
18718 !! wikitext
18719 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18720 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18721 !! html
18722 <p>
18723 <span title="ЛаCтин">ски</span>
18724 </p>
18725 !! end
18726
18727
18728 !! test
18729 Explicit session-wise language variant mapping (A flag and - flag)
18730 !! options
18731 language=zh variant=zh-tw
18732 !! wikitext
18733 Taiwan is not China.
18734 But -{A|zh:China;zh-tw:Taiwan}- is China,
18735 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18736 and -{China}- is China.
18737 !! html
18738 <p>Taiwan is not China.
18739 But Taiwan is Taiwan,
18740 (This should be stripped!)
18741 and China is China.
18742 </p>
18743 !! end
18744
18745 !! test
18746 Explicit session-wise language variant mapping (H flag for hide)
18747 !! options
18748 language=zh variant=zh-tw
18749 !! wikitext
18750 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18751 Taiwan is China.
18752 !! html
18753 <p>(This should be stripped!)
18754 Taiwan is Taiwan.
18755 </p>
18756 !! end
18757
18758 !! test
18759 Adding explicit conversion rule for title (T flag)
18760 !! options
18761 language=zh variant=zh-tw showtitle
18762 !! wikitext
18763 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18764 !! html
18765 Taiwan
18766 <p>Should be stripped!
18767 </p>
18768 !! end
18769
18770 !! test
18771 Testing that changing the language variant here in the tests actually works
18772 !! options
18773 language=zh variant=zh showtitle
18774 !! wikitext
18775 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18776 !! html
18777 China
18778 <p>Should be stripped!
18779 </p>
18780 !! end
18781
18782 !! test
18783 Recursive conversion of alt and title attrs shouldn't clear converter state
18784 !! options
18785 language=zh variant=zh-cn showtitle
18786 !! wikitext
18787 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18788 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18789 !! html
18790 China
18791 <p>
18792 Should be stripped<span title="Exclamation">!</span>
18793 </p>
18794 !! end
18795
18796 !! test
18797 Bug 24072: more test on conversion rule for title
18798 !! options
18799 language=zh variant=zh-tw showtitle
18800 !! wikitext
18801 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18802 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18803 !! html
18804 Taiwan
18805 <p>This should be stripped!
18806 This won't take interferes with the title rule.
18807 </p>
18808 !! end
18809
18810 !! test
18811 Partly disable title conversion if variant == main language code
18812 !! options
18813 language=zh variant=zh title=[[ZH]] showtitle
18814 !! wikitext
18815 -{T|zh-cn:CN;zh-tw:TW}-
18816 !! html
18817 ZH
18818 <p>
18819 </p>
18820 !! end
18821
18822 !! test
18823 Partly disable title conversion if variant == main language code, more
18824 !! options
18825 language=zh variant=zh title=[[ZH]] showtitle
18826 !! wikitext
18827 -{T|TW}-
18828 !! html
18829 ZH
18830 <p>
18831 </p>
18832 !! end
18833
18834 !! test
18835 Raw output of variant escape tags (R flag)
18836 !! options
18837 language=zh variant=zh-tw
18838 !! wikitext
18839 Raw: -{R|zh:China;zh-tw:Taiwan}-
18840 !! html
18841 <p>Raw: zh:China;zh-tw:Taiwan
18842 </p>
18843 !! end
18844
18845 !! test
18846 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18847 !! options
18848 language=zh variant=zh-cn
18849 !! input
18850 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18851 !! result
18852 <p>0
18853 </p>
18854 !! end
18855
18856 !! test
18857 Conversion rules from [numeric-only string] to [something else] (T48634)
18858 !! options
18859 language=zh variant=zh-cn
18860 !! input
18861 -{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
18862 !! result
18863 <p>D12345EE12345
18864 </p>
18865 !! end
18866
18867 !! test
18868 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18869 !! options
18870 language=zh variant=zh-cn
18871 !! input
18872 -{H|zh-cn:foo;zh-tw:;}-foobar
18873 !! result
18874 <p>foobar
18875 </p>
18876 !! end
18877
18878 !! test
18879 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
18880 !! options
18881 language=zh variant=zh-cn
18882 !! input
18883 -{H|=>zh-cn:foo;}-foobar
18884 !! result
18885 <p>foobar
18886 </p>
18887 !! end
18888
18889 !! test
18890 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
18891 !! options
18892 language=zh variant=zh-cn
18893 !! input
18894 -{H|}-foobar
18895 !! result
18896 <p>foobar
18897 </p>
18898 !! end
18899
18900 !! test
18901 Nested using of manual convert syntax
18902 !! options
18903 language=zh variant=zh-hk
18904 !! wikitext
18905 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18906 !! html
18907 <p>Nested: Hello Hong Kong!
18908 </p>
18909 !! end
18910
18911 !! test
18912 Proper conversion of text in external links
18913 !! options
18914 language=sr variant=sr-ec
18915 !! wikitext
18916 http://www.google.com
18917 gopher://www.google.com
18918 [http://www.google.com http://www.google.com]
18919 [gopher://www.google.com gopher://www.google.com]
18920 [https://www.google.com irc://www.google.com]
18921 [ftp://www.google.com www.google.com/ftp://dir]
18922 [//www.google.com www.google.com]
18923 !! html
18924 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18925 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18926 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18927 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18928 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18929 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18930 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18931 </p>
18932 !! end
18933
18934 !! test
18935 Do not convert roman numbers to language variants
18936 !! options
18937 language=sr variant=sr-ec
18938 !! wikitext
18939 Fridrih IV je car.
18940 !! html
18941 <p>Фридрих IV је цар.
18942 </p>
18943 !! end
18944
18945 !! test
18946 Unclosed language converter markup "-{"
18947 !! options
18948 language=sr
18949 !! wikitext
18950 -{T|hello
18951 !! html
18952 <p>-{T|hello
18953 </p>
18954 !! end
18955
18956 !! test
18957 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18958 !! options
18959 language=sr
18960 !! wikitext
18961 -{R|=&gt;}-
18962 !! html
18963 <p>=&gt;
18964 </p>
18965 !!end
18966
18967 !! test
18968 Don't break link parsing if language converter markup is in the caption.
18969 !! options
18970 language=sr variant=sr-ec
18971 !! wikitext
18972 [[Main Page|-{R|main page}-]]
18973 !! html
18974 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18975 </p>
18976 !! end
18977
18978 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18979 !! test
18980 Don't break image parsing if language converter markup is in the caption.
18981 !! options
18982 language=sr
18983 !! wikitext
18984 [[File:Foobar.jpg|-{R|caption}-]]
18985 !! html/parsoid
18986 <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>
18987 </p>
18988 !! end
18989
18990 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18991 !! test
18992 Don't break list handling if language converter markup is in the item.
18993 !! options
18994 language=zh variant=zh-cn
18995 !! wikitext
18996 ;-{zh-cn:AAA;zh-tw:BBB}-
18997 !! html/php
18998 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18999
19000 !! html/parsoid
19001 <dl><dt>AAA
19002 </dt></dl>
19003 !! end
19004
19005 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19006 !! test
19007 Don't break table handling if language converter markup is in the cell.
19008 !! options
19009 language=sr variant=sr-ec
19010 !! wikitext
19011 {|
19012 |-
19013 | -{R|B}-
19014 |}
19015 !! html/php
19016 <table>
19017
19018 <tr>
19019 <td>Б}-
19020 </td></tr></table>
19021
19022 !! html/parsoid
19023 <table>
19024
19025 <tr>
19026 <td> B
19027 </td></tr></table>
19028
19029 !! end
19030
19031 !! test
19032 Bug 529: Uncovered bullet
19033 !! wikitext
19034 * Foo {{bullet}}
19035 !! html
19036 <ul><li> Foo </li>
19037 <li> Bar</li></ul>
19038
19039 !! end
19040
19041 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19042 # Templates in Wikipedia rely on this behavior, as tidy has always been
19043 # enabled there. These tests are normally run *without* tidy, so specify the
19044 # full output here.
19045 # To test realistic parsing behavior, apply a tidy-like transformation to both
19046 # the expected output and your parser's output.
19047 !! test
19048 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19049 !! wikitext
19050 ******* Foo {{bullet}}
19051 !! html
19052 <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>
19053 <li> Bar</li></ul>
19054
19055 !! end
19056
19057 !! test
19058 Bug 529: Uncovered table already at line-start
19059 !! wikitext
19060 x
19061
19062 {{table}}
19063 y
19064 !! html
19065 <p>x
19066 </p>
19067 <table>
19068 <tr>
19069 <td> 1 </td>
19070 <td> 2
19071 </td></tr>
19072 <tr>
19073 <td> 3 </td>
19074 <td> 4
19075 </td></tr></table>
19076 <p>y
19077 </p>
19078 !! end
19079
19080 !! test
19081 Bug 529: Uncovered bullet in parser function result
19082 !! wikitext
19083 * Foo {{lc:{{bullet}} }}
19084 !! html
19085 <ul><li> Foo </li>
19086 <li> bar</li></ul>
19087
19088 !! end
19089
19090 !! test
19091 Bug 5678: Double-parsed template argument
19092 !! wikitext
19093 {{lc:{{{1}}}|hello}}
19094 !! html
19095 <p>{{{1}}}
19096 </p>
19097 !! end
19098
19099 !! test
19100 Bug 5678: Double-parsed template invocation
19101 !! wikitext
19102 {{lc:{{paramtest {{!}} param = hello }} }}
19103 !! html
19104 <p>{{paramtest | param = hello }}
19105 </p>
19106 !! end
19107
19108 !! test
19109 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19110 !! options
19111 language=cs
19112 title=[[Main Page]]
19113 !! wikitext
19114 {{PRVNÍVELKÉ:ěščř}}
19115 {{prvnívelké:ěščř}}
19116 {{PRVNÍMALÉ:ěščř}}
19117 {{prvnímalé:ěščř}}
19118 {{MALÁ:ěščř}}
19119 {{malá:ěščř}}
19120 {{VELKÁ:ěščř}}
19121 {{velká:ěščř}}
19122 !! html
19123 <p>Ěščř
19124 Ěščř
19125 ěščř
19126 ěščř
19127 ěščř
19128 ěščř
19129 ĚŠČŘ
19130 ĚŠČŘ
19131 </p>
19132 !! end
19133
19134 !! test
19135 Morwen/13: Unclosed link followed by heading
19136 !! wikitext
19137 [[link
19138 ==heading==
19139 !! html
19140 <p>[[link
19141 </p>
19142 <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>
19143
19144 !! end
19145
19146 !! test
19147 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19148 !! wikitext
19149 {{foo|
19150 =heading=
19151 !! html
19152 <p>{{foo|
19153 </p>
19154 <h1><span class="mw-headline" id="heading">heading</span></h1>
19155
19156 !! end
19157
19158 !! test
19159 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19160 !! wikitext
19161 {{foo|
19162 ==heading==
19163 !! html
19164 <p>{{foo|
19165 </p>
19166 <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>
19167
19168 !! end
19169
19170 !! test
19171 Tildes in comments
19172 !! options
19173 pst
19174 !! wikitext
19175 <!-- ~~~~ -->
19176 !! html
19177 <!-- ~~~~ -->
19178 !! end
19179
19180 !! test
19181 Paragraphs inside divs (no extra line breaks)
19182 !! wikitext
19183 <div>Line one
19184
19185 Line two</div>
19186 !! html
19187 <div>Line one
19188 Line two</div>
19189
19190 !! end
19191
19192 !! test
19193 Paragraphs inside divs (extra line break on open)
19194 !! wikitext
19195 <div>
19196 Line one
19197
19198 Line two</div>
19199 !! html
19200 <div>
19201 <p>Line one
19202 </p>
19203 Line two</div>
19204
19205 !! end
19206
19207 !! test
19208 Paragraphs inside divs (extra line break on close)
19209 !! wikitext
19210 <div>Line one
19211
19212 Line two
19213 </div>
19214 !! html
19215 <div>Line one
19216 <p>Line two
19217 </p>
19218 </div>
19219
19220 !! end
19221
19222 !! test
19223 Paragraphs inside divs (extra line break on open and close)
19224 !! wikitext
19225 <div>
19226 Line one
19227
19228 Line two
19229 </div>
19230 !! html
19231 <div>
19232 <p>Line one
19233 </p><p>Line two
19234 </p>
19235 </div>
19236
19237 !! end
19238
19239 !! test
19240 Nesting tags, paragraphs on lines which begin with <div>
19241 !! wikitext
19242 <div></div><strong>A
19243 B</strong>
19244 !! html/php+tidy
19245 <p><strong>A</strong></p>
19246 <p><strong>B</strong></p>
19247 !! html/parsoid
19248 <div></div>
19249 <p><strong>A
19250 B</strong>
19251 </p>
19252 !! end
19253
19254 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19255 !! test
19256 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19257 !! wikitext
19258 <blockquote>Line one
19259
19260 Line two</blockquote>
19261 !! html
19262 <blockquote>Line one
19263 Line two</blockquote>
19264
19265 !! html+tidy
19266 <blockquote>
19267 <p>Line one Line two</p>
19268 </blockquote>
19269 !! end
19270
19271 !! test
19272 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19273 !! wikitext
19274 <blockquote>
19275 Line one
19276
19277 Line two</blockquote>
19278 !! html
19279 <blockquote>
19280 <p>Line one
19281 </p>
19282 Line two</blockquote>
19283
19284 !! html+tidy
19285 <blockquote>
19286 <p>Line one</p>
19287 Line two</blockquote>
19288 !! end
19289
19290 !! test
19291 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19292 !! wikitext
19293 <blockquote>Line one
19294
19295 Line two
19296 </blockquote>
19297 !! html
19298 <blockquote>Line one
19299 <p>Line two
19300 </p>
19301 </blockquote>
19302
19303 !! html+tidy
19304 <blockquote>
19305 <p>Line one</p>
19306 <p>Line two</p>
19307 </blockquote>
19308 !! end
19309
19310 !! test
19311 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19312 !! wikitext
19313 <blockquote>
19314 Line one
19315
19316 Line two
19317 </blockquote>
19318 !! html
19319 <blockquote>
19320 <p>Line one
19321 </p><p>Line two
19322 </p>
19323 </blockquote>
19324
19325 !! html+tidy
19326 <blockquote>
19327 <p>Line one</p>
19328 <p>Line two</p>
19329 </blockquote>
19330 !! end
19331
19332 !! test
19333 Paragraphs inside blockquotes/divs (no extra line breaks)
19334 !! wikitext
19335 <blockquote><div>Line one
19336
19337 Line two</div></blockquote>
19338 !! html
19339 <blockquote><div>Line one
19340 Line two</div></blockquote>
19341
19342 !! end
19343
19344 !! test
19345 Paragraphs inside blockquotes/divs (extra line break on open)
19346 !! wikitext
19347 <blockquote><div>
19348 Line one
19349
19350 Line two</div></blockquote>
19351 !! html
19352 <blockquote><div>
19353 <p>Line one
19354 </p>
19355 Line two</div></blockquote>
19356
19357 !! end
19358
19359 !! test
19360 Paragraphs inside blockquotes/divs (extra line break on close)
19361 !! wikitext
19362 <blockquote><div>Line one
19363
19364 Line two
19365 </div></blockquote>
19366 !! html
19367 <blockquote><div>Line one
19368 <p>Line two
19369 </p>
19370 </div></blockquote>
19371
19372 !! end
19373
19374 !! test
19375 Paragraphs inside blockquotes/divs (extra line break on open and close)
19376 !! wikitext
19377 <blockquote><div>
19378 Line one
19379
19380 Line two
19381 </div></blockquote>
19382 !! html
19383 <blockquote><div>
19384 <p>Line one
19385 </p><p>Line two
19386 </p>
19387 </div></blockquote>
19388
19389 !! end
19390
19391 !! test
19392 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19393 !! options
19394 wgLinkHolderBatchSize=0
19395 !! wikitext
19396 [[meatball:1]]
19397 [[meatball:2]]
19398 [[meatball:3]]
19399 !! html
19400 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19401 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19402 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19403 </p>
19404 !! end
19405
19406 !! test
19407 Free external link invading image caption
19408 !! wikitext
19409 [[Image:Foobar.jpg|thumb|http://x|hello]]
19410 !! html
19411 <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>
19412
19413 !! end
19414
19415 !! test
19416 Bug 15196: localised external link numbers
19417 !! options
19418 language=fa
19419 !! wikitext
19420 [http://en.wikipedia.org/]
19421 !! html/php
19422 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19423 </p>
19424 !! html/parsoid
19425 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19426 !! end
19427
19428 !! test
19429 Multibyte character in padleft
19430 !! wikitext
19431 {{padleft:-Hello|7|Æ}}
19432 !! html
19433 <p>Æ-Hello
19434 </p>
19435 !! end
19436
19437 !! test
19438 Multibyte character in padright
19439 !! wikitext
19440 {{padright:Hello-|7|Æ}}
19441 !! html
19442 <p>Hello-Æ
19443 </p>
19444 !! end
19445
19446 !!test
19447 formatdate parser function
19448 !! wikitext
19449 {{#formatdate:2009-03-24}}
19450 !! html
19451 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19452 </p>
19453 !! end
19454
19455 !!test
19456 formatdate parser function, with default format
19457 !! wikitext
19458 {{#formatdate:2009-03-24|mdy}}
19459 !! html
19460 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19461 </p>
19462 !! end
19463
19464 !! test
19465 Spacing of numbers in formatted dates
19466 !! wikitext
19467 {{#formatdate:January 15}}
19468 !! html
19469 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19470 </p>
19471 !! end
19472
19473 !! test
19474 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
19475 !! options
19476 language=nl title=[[MediaWiki:Common.css]]
19477 !! wikitext
19478 {{#formatdate:2009-03-24|dmy}}
19479 !! html
19480 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19481 </p>
19482 !! end
19483
19484 #
19485 #
19486 #
19487
19488 #
19489 # Edit comments
19490 #
19491
19492 !! test
19493 Edit comment with link
19494 !! options
19495 comment
19496 !! wikitext
19497 I like the [[Main Page]] a lot
19498 !! html
19499 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19500 !!end
19501
19502 !! test
19503 Edit comment with link and link text
19504 !! options
19505 comment
19506 !! wikitext
19507 I like the [[Main Page|best pages]] a lot
19508 !! html
19509 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19510 !!end
19511
19512 !! test
19513 Edit comment with link and link text with suffix
19514 !! options
19515 comment
19516 !! wikitext
19517 I like the [[Main Page|best page]]s a lot
19518 !! html
19519 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19520 !!end
19521
19522 !! test
19523 Edit comment with section link (non-local, eg in history list)
19524 !! options
19525 comment title=[[Main Page]]
19526 !! wikitext
19527 /* External links */ removed bogus entries
19528 !! html
19529 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19530 !!end
19531
19532 !! test
19533 Edit comment with section link and text before it (non-local, eg in history list)
19534 !! options
19535 comment title=[[Main Page]]
19536 !! wikitext
19537 pre-comment text /* External links */ removed bogus entries
19538 !! html
19539 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>
19540 !!end
19541
19542 !! test
19543 Edit comment with section link (local, eg in diff view)
19544 !! options
19545 comment local title=[[Main Page]]
19546 !! wikitext
19547 /* External links */ removed bogus entries
19548 !! html
19549 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19550 !!end
19551
19552 !! test
19553 Edit comment with subpage link (bug 14080)
19554 !! options
19555 comment
19556 subpage
19557 title=[[Subpage test]]
19558 !! wikitext
19559 Poked at a [[/subpage]] here...
19560 !! html
19561 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19562 !!end
19563
19564 !! test
19565 Edit comment with subpage link and link text (bug 14080)
19566 !! options
19567 comment
19568 subpage
19569 title=[[Subpage test]]
19570 !! wikitext
19571 Poked at a [[/subpage|neat little page]] here...
19572 !! html
19573 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19574 !!end
19575
19576 !! test
19577 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19578 !! options
19579 comment
19580 title=[[Subpage test]]
19581 !! wikitext
19582 Poked at a [[/subpage]] here...
19583 !! html
19584 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...
19585 !!end
19586
19587 !! test
19588 Edit comment with bare anchor link (local, as on diff)
19589 !! options
19590 comment
19591 local
19592 title=[[Main Page]]
19593 !! wikitext
19594 [[#section]]
19595 !! html
19596 <a href="#section">#section</a>
19597 !! end
19598
19599 !! test
19600 Edit comment with bare anchor link (non-local, as on history)
19601 !! options
19602 comment
19603 title=[[Main Page]]
19604 !! wikitext
19605 [[#section]]
19606 !! html
19607 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19608 !! end
19609
19610 !! test
19611 Anchor starting with underscore
19612 !! wikitext
19613 [[#_ref|One]]
19614 !! html
19615 <p><a href="#_ref">One</a>
19616 </p>
19617 !! end
19618
19619 !! test
19620 Id starting with underscore
19621 !! wikitext
19622 <div id="_ref"></div>
19623 !! html
19624 <div id="_ref"></div>
19625
19626 !! end
19627
19628 !! test
19629 Space normalisation on autocomment (bug 22784)
19630 !! options
19631 comment
19632 title=[[Main Page]]
19633 !! wikitext
19634 /* __hello__world__ */
19635 !! html
19636 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19637 !! end
19638
19639 !! test
19640 percent-encoding and + signs in comments (Bug 26410)
19641 !! options
19642 comment
19643 !! wikitext
19644 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19645 !! html/php
19646 <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>
19647 !! end
19648
19649 # Parsoid doesn't support this yet: see bug 73581
19650 # but it *should* omit the 'src' attribute if the image is bad.
19651 # PHP side of tests was disabled in
19652 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19653 # because of issues in the PHP parserTests infrastructure
19654 # (but the output below is indeed what the PHP side emits)
19655 !! test
19656 Bad images - basic functionality
19657 !! wikitext
19658 [[File:Bad.jpg]]
19659 !! DISABLED/html/php
19660 !! html/parsoid
19661 <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>
19662 !! end
19663
19664 !! test
19665 Bad images - bug 16039: text after bad image disappears
19666 !! wikitext
19667 Foo bar
19668 [[File:Bad.jpg]]
19669 Bar foo
19670 !! DISABLED/html/php
19671 <p>Foo bar
19672 </p><p>Bar foo
19673 </p>
19674 !! html/parsoid
19675 <p>Foo bar
19676 <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>
19677 Bar foo</p>
19678 !! end
19679
19680 !! test
19681 Verify that displaytitle works (bug #22501) no displaytitle
19682 !! options
19683 showtitle
19684 !! config
19685 wgAllowDisplayTitle=true
19686 wgRestrictDisplayTitle=false
19687 !! wikitext
19688 this is not the the title
19689 !! html
19690 Parser test
19691 <p>this is not the the title
19692 </p>
19693 !! end
19694
19695 !! test
19696 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19697 !! options
19698 showtitle
19699 title=[[Screen]]
19700 !! config
19701 wgAllowDisplayTitle=true
19702 wgRestrictDisplayTitle=false
19703 !! wikitext
19704 this is not the the title
19705 {{DISPLAYTITLE:whatever}}
19706 !! html
19707 whatever
19708 <p>this is not the the title
19709 </p>
19710 !! end
19711
19712 !! test
19713 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19714 !! options
19715 showtitle
19716 title=[[Screen]]
19717 !! config
19718 wgAllowDisplayTitle=true
19719 wgRestrictDisplayTitle=true
19720 !! wikitext
19721 this is not the the title
19722 {{DISPLAYTITLE:whatever}}
19723 !! html
19724 Screen
19725 <p>this is not the the title
19726 </p>
19727 !! end
19728
19729 !! test
19730 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19731 !! options
19732 showtitle
19733 title=[[Screen]]
19734 !! config
19735 wgAllowDisplayTitle=true
19736 wgRestrictDisplayTitle=true
19737 !! wikitext
19738 this is not the the title
19739 {{DISPLAYTITLE:screen}}
19740 !! html
19741 screen
19742 <p>this is not the the title
19743 </p>
19744 !! end
19745
19746 !! test
19747 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19748 !! options
19749 showtitle
19750 title=[[Screen]]
19751 !! config
19752 wgAllowDisplayTitle=false
19753 !! wikitext
19754 this is not the the title
19755 {{DISPLAYTITLE:screen}}
19756 !! html
19757 Screen
19758 <p>this is not the the title
19759 <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>
19760 </p>
19761 !! end
19762
19763 !! test
19764 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19765 !! options
19766 showtitle
19767 title=[[Screen]]
19768 !! config
19769 wgAllowDisplayTitle=false
19770 !! wikitext
19771 this is not the the title
19772 !! html
19773 Screen
19774 <p>this is not the the title
19775 </p>
19776 !! end
19777
19778 !! test
19779 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19780 !! options
19781 showtitle
19782 title=[[Screen]]
19783 !! config
19784 wgAllowDisplayTitle=true
19785 wgRestrictDisplayTitle=true
19786 !! wikitext
19787 this is not the the title
19788 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19789 !! html
19790 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19791 <p>this is not the the title
19792 </p>
19793 !! end
19794
19795 !! test
19796 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19797 !! options
19798 showtitle
19799 title=[[Screen]]
19800 !! config
19801 wgAllowDisplayTitle=true
19802 wgRestrictDisplayTitle=true
19803 !! wikitext
19804 this is not the the title
19805 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19806 !! html
19807 <span style="color: red;">s</span>creen
19808 <p>this is not the the title
19809 </p>
19810 !! end
19811
19812 !! test
19813 Page status indicators: Empty name is invalid
19814 !! options
19815 showindicators
19816 !! wikitext
19817 <indicator name=" "></indicator>
19818 <indicator></indicator>
19819 !! html
19820 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19821 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19822 </p>
19823 !! end
19824
19825 !! test
19826 Page status indicators: Weird syntaxes that are okay
19827 !! options
19828 showindicators
19829 !! wikitext
19830 <indicator name="empty" />
19831 <indicator name="name"></indicator>
19832 !! html
19833 empty=
19834 name=
19835 <p><br />
19836 </p>
19837 !! end
19838
19839 !! test
19840 Page status indicators: Torture test
19841 !! options
19842 showindicators
19843 !! wikitext
19844 <indicator name="01">hello world</indicator>
19845 <indicator name="02">[[Main Page]]</indicator>
19846 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19847 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19848 <indicator name="05">* foo
19849 * bar</indicator>
19850 <indicator name="06"><nowiki>foo</nowiki></indicator>
19851 <indicator name="07"> Preformatted</indicator>
19852 <indicator name="08"><div>Broken tag</indicator>
19853 <indicator name="09">{| class=wikitable
19854 | cell
19855 |}</indicator>
19856 <indicator name="10">Two
19857
19858 paragraphs</indicator>
19859 !! html
19860 01=hello world
19861 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19862 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" />
19863 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>
19864 05=<ul><li> foo</li>
19865 <li> bar</li></ul>
19866
19867 06=foo
19868 07=<pre>Preformatted
19869 </pre>
19870 08=<div>Broken tag</div>
19871
19872 09=<table class="wikitable">
19873 <tr>
19874 <td> cell
19875 </td></tr></table>
19876
19877 10=<p>Two
19878 </p><p>paragraphs
19879 </p>
19880 <p><br />
19881 </p><p><br />
19882 </p><p><br />
19883 </p><p><br />
19884 </p><p><br />
19885 </p>
19886 !! end
19887
19888 !! test
19889 preload: check <noinclude> and <includeonly>
19890 !! options
19891 preload
19892 !! wikitext
19893 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19894 !! html
19895 Hello kind world.
19896 !! end
19897
19898 !! test
19899 preload: check <onlyinclude>
19900 !! options
19901 preload
19902 !! wikitext
19903 Goodbye <onlyinclude>Hello world</onlyinclude>
19904 !! html
19905 Hello world
19906 !! end
19907
19908 !! test
19909 preload: can pass tags through if we want to
19910 !! options
19911 preload
19912 !! wikitext
19913 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19914 !! html
19915 <includeonly>Hello world</includeonly>
19916 !! end
19917
19918 !! test
19919 preload: check that it doesn't try to do tricks
19920 !! options
19921 preload
19922 !! wikitext
19923 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19924 !! html
19925 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19926 !! end
19927
19928 !! test
19929 Play a bit with r67090 and bug 3158
19930 !! wikitext
19931 <div style="width:50% !important">&nbsp;</div>
19932 <div style="width:50%&nbsp;!important">&nbsp;</div>
19933 <div style="width:50%&#160;!important">&nbsp;</div>
19934 <div style="border : solid;">&nbsp;</div>
19935 !! html/php
19936 <div style="width:50% !important">&#160;</div>
19937 <div style="width:50% !important">&#160;</div>
19938 <div style="width:50% !important">&#160;</div>
19939 <div style="border&#160;: solid;">&#160;</div>
19940
19941 !! html/parsoid
19942 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19943 <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>
19944 <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>
19945 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19946
19947 !! end
19948
19949 !! test
19950 HTML5 data attributes
19951 !! wikitext
19952 <span data-foo="bar">Baz</span>
19953 <p data-abc-def_hij="">Quuz</p>
19954 !! html
19955 <p><span data-foo="bar">Baz</span>
19956 </p>
19957 <p data-abc-def_hij="">Quuz</p>
19958
19959 !! end
19960
19961 !! test
19962 percent-encoding and + signs in internal links (Bug 26410)
19963 !! wikitext
19964 [[User:+%]] [[Page+title%]]
19965 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19966 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19967 [[%33%45]] [[%33%45+]]
19968 !! html/php
19969 <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>
19970 <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>
19971 <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>
19972 <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>
19973 </p>
19974 !! html/parsoid
19975 <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>
19976 <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>
19977 <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>
19978 <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>
19979 !! end
19980
19981 !! test
19982 Special characters in embedded file links (bug 27679)
19983 !! wikitext
19984 [[File:Contains & ampersand.jpg]]
19985 [[File:Does not exist.jpg|Title with & ampersand]]
19986 !! html/php
19987 <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>
19988 <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>
19989 </p>
19990 !! html/parsoid
19991 <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>
19992 <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>
19993 !! end
19994
19995 !! test
19996 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19997 !! wikitext
19998 Text&apos;s been normalized?
19999 !! html
20000 <p>Text&#39;s been normalized?
20001 </p>
20002 !! end
20003
20004 !! test
20005 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20006 !! wikitext
20007 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20008 !! html
20009 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20010 </p>
20011 !! end
20012
20013 !! test
20014 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20015 !! wikitext
20016 [http://www.example.org/ ideograms]
20017 !! html
20018 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20019 </p>
20020 !! end
20021
20022 !! test
20023 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20024 !! wikitext
20025 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20026 !! html
20027 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20028 </p>
20029 !! end
20030
20031 !! article
20032 Mediawiki:loop1
20033 !! text
20034 {{Identical|A}}
20035 !! endarticle
20036
20037 !! article
20038 Mediawiki:loop2
20039 !! text
20040 {{Identical|B}}
20041 !! endarticle
20042
20043 !! article
20044 Template:Identical
20045 !! text
20046 {{int:loop1}}
20047 {{int:loop2}}
20048 !! endarticle
20049
20050 !! test
20051 Bug 31098 Template which includes system messages which includes the template
20052 !! wikitext
20053 {{Identical}}
20054 !! html
20055 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20056 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20057 </p>
20058 !! end
20059
20060 !! test
20061 Bug31490 Turkish: ucfirst 'blah'
20062 !! options
20063 language=tr
20064 !! wikitext
20065 {{ucfirst:blah}}
20066 !! html
20067 <p>Blah
20068 </p>
20069 !! end
20070
20071 !! test
20072 Bug31490 Turkish: ucfirst 'ix'
20073 !! options
20074 language=tr
20075 !! wikitext
20076 {{ucfirst:ix}}
20077 !! html
20078 <p>İx
20079 </p>
20080 !! end
20081
20082 !! test
20083 Bug31490 Turkish: lcfirst 'BLAH'
20084 !! options
20085 language=tr
20086 !! wikitext
20087 {{lcfirst:BLAH}}
20088 !! html
20089 <p>bLAH
20090 </p>
20091 !! end
20092
20093 !! test
20094 Bug31490 Turkish: ucfırst (with a dotless i)
20095 !! options
20096 language=tr
20097 !! wikitext
20098 {{ucfırst:blah}}
20099 !! html
20100 <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>
20101 </p>
20102 !! end
20103
20104 !! test
20105 Bug31490 ucfırst (with a dotless i) with English language
20106 !! options
20107 language=en
20108 !! wikitext
20109 {{ucfırst:blah}}
20110 !! html
20111 <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>
20112 </p>
20113 !! end
20114
20115 !! test
20116 Bug 26375: TOC with italics
20117 !! options
20118 title=[[Main Page]]
20119 !! wikitext
20120 __TOC__
20121 == ''Lost'' episodes ==
20122 !! html
20123 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20124 <ul>
20125 <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>
20126 </ul>
20127 </div>
20128
20129 <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>
20130
20131 !! end
20132
20133 !! test
20134 Bug 26375: TOC with bold
20135 !! options
20136 title=[[Main Page]]
20137 !! wikitext
20138 __TOC__
20139 == '''should be bold''' then normal text ==
20140 !! html
20141 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20142 <ul>
20143 <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>
20144 </ul>
20145 </div>
20146
20147 <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>
20148
20149 !! end
20150
20151 !! test
20152 Bug 33845: Headings become cursive in TOC when they contain an image
20153 !! options
20154 title=[[Main Page]]
20155 !! wikitext
20156 __TOC__
20157 == Image [[Image:foobar.jpg]] ==
20158 !! html
20159 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20160 <ul>
20161 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20162 </ul>
20163 </div>
20164
20165 <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>
20166
20167 !! end
20168
20169 !! test
20170 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20171 !! options
20172 title=[[Main Page]]
20173 !! wikitext
20174 __TOC__
20175 == <blockquote>Quote</blockquote> ==
20176 !! html
20177 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20178 <ul>
20179 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20180 </ul>
20181 </div>
20182
20183 <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>
20184
20185 !! html+tidy
20186 <p></p>
20187 <div id="toc" class="toc">
20188 <div id="toctitle">
20189 <h2>Contents</h2>
20190 </div>
20191 <ul>
20192 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20193 </ul>
20194 </div>
20195 <p></p>
20196 <h2><span class="mw-headline" id="Quote"></span></h2>
20197 <blockquote>
20198 <p><span class="mw-headline" id="Quote">Quote</span></p>
20199 </blockquote>
20200 <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>
20201 !! end
20202
20203 !! test
20204 Unclosed tags in TOC
20205 !! options
20206 title=[[Main Page]]
20207 !! wikitext
20208 __TOC__
20209 == Proof: 2 < 3 ==
20210 <small>Hanc marginis exiguitas non caperet.</small>
20211 QED
20212 !! html
20213 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20214 <ul>
20215 <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>
20216 </ul>
20217 </div>
20218
20219 <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>
20220 <p><small>Hanc marginis exiguitas non caperet.</small>
20221 QED
20222 </p>
20223 !! end
20224
20225 !! test
20226 Multiple tags in TOC
20227 !! wikitext
20228 __TOC__
20229 == <i>Foo</i> <b>Bar</b> ==
20230
20231 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20232 !! html
20233 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20234 <ul>
20235 <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>
20236 <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>
20237 </ul>
20238 </div>
20239
20240 <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>
20241 <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>
20242
20243 !! html+tidy
20244 <p></p>
20245 <div id="toc" class="toc">
20246 <div id="toctitle">
20247 <h2>Contents</h2>
20248 </div>
20249 <ul>
20250 <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>
20251 <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>
20252 </ul>
20253 </div>
20254 <p></p>
20255 <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>
20256 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20257 <blockquote>
20258 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20259 </blockquote>
20260 <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>
20261 !! end
20262
20263 !! test
20264 Tags with parameters in TOC
20265 !! wikitext
20266 __TOC__
20267 == <sup class="in-h2">Hello</sup> ==
20268
20269 == <sup class="a > b">Evilbye</sup> ==
20270 !! html
20271 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20272 <ul>
20273 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20274 <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>
20275 </ul>
20276 </div>
20277
20278 <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>
20279 <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>
20280
20281 !! end
20282
20283 !! test
20284 span tags with directionality in TOC
20285 !! wikitext
20286 __TOC__
20287 == <span dir="ltr">C++</span> ==
20288
20289 == <span dir="rtl">זבנג!</span> ==
20290
20291 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20292
20293 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20294
20295 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20296 !! html
20297 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20298 <ul>
20299 <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>
20300 <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>
20301 <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>
20302 <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>
20303 <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>
20304 </ul>
20305 </div>
20306
20307 <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>
20308 <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>
20309 <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>
20310 <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>
20311 <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>
20312
20313 !! end
20314
20315 !! test
20316 Bug 72884: bdi element in ToC
20317 !! wikitext
20318 __TOC__
20319 == <bdi>test</bdi> ==
20320 !! html
20321 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20322 <ul>
20323 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20324 </ul>
20325 </div>
20326
20327 <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>
20328
20329 !! end
20330
20331 # Note that the html output does not have the <p></p>, but the
20332 # html+tidy output *does*. This is because the empty <p></p> is
20333 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20334 !! test
20335 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20336 !! wikitext
20337 __TOC__
20338 == x ==
20339 !! html
20340 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20341 <ul>
20342 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20343 </ul>
20344 </div>
20345
20346 <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>
20347
20348 !! html+tidy
20349 <p></p>
20350 <div id="toc" class="toc">
20351 <div id="toctitle">
20352 <h2>Contents</h2>
20353 </div>
20354 <ul>
20355 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20356 </ul>
20357 </div>
20358 <p></p>
20359 <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>
20360 !! end
20361
20362 !! article
20363 MediaWiki:Bug32057
20364 !! text
20365 == {{int:headline_sample}} ==
20366 !! endarticle
20367
20368 !! test
20369 Bug 32057: Title needed when expanding <h> nodes.
20370 !! options
20371 title=[[Main Page]]
20372 !! wikitext
20373 {{int:Bug32057}}
20374 !! html
20375 <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>
20376
20377 !! end
20378
20379 !! test
20380 Strip marker in urlencode
20381 !! wikitext
20382 {{urlencode:x<nowiki/>y}}
20383 {{urlencode:x<nowiki/>y|wiki}}
20384 {{urlencode:x<nowiki/>y|path}}
20385 {{urlencode:x<pre id="one">two</pre>y}}
20386 !! html
20387 <p>xy
20388 xy
20389 xy
20390 xy
20391 </p>
20392 !! end
20393
20394 !! test
20395 Strip marker in lc
20396 !! wikitext
20397 {{lc:x<nowiki/>y}}
20398 !! html
20399 <p>xy
20400 </p>
20401 !! end
20402
20403 !! test
20404 Strip marker in uc
20405 !! wikitext
20406 {{uc:x<nowiki/>y}}
20407 !! html
20408 <p>XY
20409 </p>
20410 !! end
20411
20412 !! test
20413 Strip marker in formatNum
20414 !! wikitext
20415 {{formatnum:1<nowiki/>2}}
20416 {{formatnum:1<nowiki/>2|R}}
20417 !! html
20418 <p>12
20419 12
20420 </p>
20421 !! end
20422
20423 !! test
20424 Check noCommafy in formatNum
20425 !! options
20426 language=be-tarask
20427 !! wikitext
20428 {{formatnum:123456.78}}
20429 {{formatnum:123456.78|NOSEP}}
20430 !! html
20431 <p>123 456,78
20432 123456.78
20433 </p>
20434 !! end
20435
20436 !! test
20437 Wrong option for formatNum (bug 56199)
20438 !! wikitext
20439 {{formatnum:1,234.56|Random}}
20440 {{formatnum:1,234.56|EVERYTHING}}
20441 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20442 !! html
20443 <p>1,234.56
20444 1,234.56
20445 1,234.56
20446 </p>
20447 !! end
20448
20449 !! test
20450 Strip marker in grammar
20451 !! options
20452 language=fi
20453 !! wikitext
20454 {{grammar:elative|foo<nowiki/>bar}}
20455 !! html
20456 <p>foobarista
20457 </p>
20458 !! end
20459
20460 !! test
20461 Strip marker in padleft
20462 !! wikitext
20463 {{padleft:|2|x<nowiki/>y}}
20464 !! html
20465 <p>xy
20466 </p>
20467 !! end
20468
20469 !! test
20470 Strip marker in padright
20471 !! wikitext
20472 {{padright:|2|x<nowiki/>y}}
20473 !! html
20474 <p>xy
20475 </p>
20476 !! end
20477
20478 !! test
20479 Strip marker in anchorencode
20480 !! wikitext
20481 {{anchorencode:x<nowiki/>y}}
20482 !! html
20483 <p>xy
20484 </p>
20485 !! end
20486
20487 !! test
20488 nowiki inside link inside heading (bug 18295)
20489 !! wikitext
20490 ==[[foo|x<nowiki>y</nowiki>z]]==
20491 !! html
20492 <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>
20493
20494 !! end
20495
20496 !! test
20497 new support for bdi element (bug 31817)
20498 !! wikitext
20499 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20500 !! html
20501 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20502
20503 !!end
20504
20505 !! test
20506 Ignore pipe between table row attributes
20507 !! wikitext
20508 {|
20509 | quux
20510 |- id=foo | style='color: red'
20511 | bar
20512 |}
20513 !! html
20514 <table>
20515 <tr>
20516 <td> quux
20517 </td></tr>
20518 <tr id="foo" style="color: red">
20519 <td> bar
20520 </td></tr></table>
20521
20522 !! end
20523
20524 !!test
20525 Gallery override link with WikiLink (bug 34852)
20526 !! wikitext
20527 <gallery>
20528 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20529 </gallery>
20530 !! html
20531 <ul class="gallery mw-gallery-traditional">
20532 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20533 <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>
20534 <div class="gallerytext">
20535 <p>caption
20536 </p>
20537 </div>
20538 </div></li>
20539 </ul>
20540
20541 !! end
20542
20543 !!test
20544 Gallery override link with absolute external link (bug 34852)
20545 !! wikitext
20546 <gallery>
20547 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20548 </gallery>
20549 !! html
20550 <ul class="gallery mw-gallery-traditional">
20551 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20552 <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>
20553 <div class="gallerytext">
20554 <p>caption
20555 </p>
20556 </div>
20557 </div></li>
20558 </ul>
20559
20560 !! end
20561
20562 !!test
20563 Gallery override link with malicious javascript (bug 34852)
20564 !! wikitext
20565 <gallery>
20566 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20567 </gallery>
20568 !! html
20569 <ul class="gallery mw-gallery-traditional">
20570 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20571 <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>
20572 <div class="gallerytext">
20573 <p>caption
20574 </p>
20575 </div>
20576 </div></li>
20577 </ul>
20578
20579 !! end
20580
20581 !!test
20582 Gallery with invalid title as link (bug 43964)
20583 !! wikitext
20584 <gallery>
20585 File:foobar.jpg|link=<
20586 </gallery>
20587 !! html
20588 <ul class="gallery mw-gallery-traditional">
20589 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20590 <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>
20591 <div class="gallerytext">
20592 </div>
20593 </div></li>
20594 </ul>
20595
20596 !! end
20597
20598 !!test
20599 Language parser function
20600 !! wikitext
20601 {{#language:ar}}
20602 !! html
20603 <p>العربية
20604 </p>
20605 !! end
20606
20607 !!test
20608 Padleft and padright as substr
20609 !! wikitext
20610 {{padleft:|3|abcde}}
20611 {{padright:|3|abcde}}
20612 !! html
20613 <p>abc
20614 abc
20615 </p>
20616 !! end
20617
20618 !!test
20619 Special parser function
20620 !! wikitext
20621 {{#special:RandomPage}}
20622 {{#special:BaDtItLe}}
20623 {{#special:Foobar}}
20624 !! html
20625 <p>Special:Random
20626 Special:Badtitle
20627 Special:Foobar
20628 </p>
20629 !! end
20630
20631 !!test
20632 Bug 34939 - Case insensitive link parsing ([HttP://])
20633 !! wikitext
20634 [HttP://MediaWiki.Org/]
20635 !! html/php
20636 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20637 </p>
20638 !! html/parsoid
20639 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20640 !! end
20641
20642 !!test
20643 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20644 !! wikitext
20645 [HttP://MediaWiki.Org/ MediaWiki]
20646 !! html
20647 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20648 </p>
20649 !! end
20650
20651 !!test
20652 Bug 34939 - Case insensitive link parsing (HttP://)
20653 !! wikitext
20654 HttP://MediaWiki.Org/
20655 !! html/php
20656 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20657 </p>
20658 !! html/parsoid
20659 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20660 !! end
20661
20662 !!test
20663 Disable TOC
20664 !! options
20665 notoc
20666 !! wikitext
20667 Lead
20668 == Section 1 ==
20669 == Section 2 ==
20670 == Section 3 ==
20671 == Section 4 ==
20672 == Section 5 ==
20673 !! html
20674 <p>Lead
20675 </p>
20676
20677 <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>
20678 <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>
20679 <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>
20680 <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>
20681 <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>
20682
20683 !! end
20684
20685
20686 ###
20687 ### Parsoid-specific tests
20688 ### Parsoid-PHP parser incompatibilities
20689 ###
20690 !!test
20691 1. SOL-sensitive wikitext tokens as template-args
20692 !!options
20693 parsoid=wt2html,wt2wt
20694 !! wikitext
20695 {{echo|*a}}
20696 {{echo|#a}}
20697 {{echo|:a}}
20698 !! html
20699 <span about="#mwt1" typeof="mw:Transclusion">
20700 </span><ul about="#mwt1"><li>a</li>
20701 </ul>
20702 <span about="#mwt2" typeof="mw:Transclusion">
20703 </span><ol about="#mwt2"><li>a</li>
20704 </ol>
20705 <span about="#mwt3" typeof="mw:Transclusion">
20706 </span><dl about="#mwt3"><dd>a</dd>
20707 </dl>
20708 !!end
20709
20710 #### -----------------------------------------------------------------
20711 #### Parsoid-specific functionality tests
20712 #### -----------------------------------------------------------------
20713
20714 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20715 # We know wt2wt will fail, but we expect selser to pass.
20716 # Due to the nature of our testing, wt2wt and selser tests will enter the
20717 # blacklist and we'll catch selser regressions based on changes to the
20718 # blacklist entries for selser tests.
20719 !! test
20720 1. Bad treebuilder fixup of formatting elt is cleaned up
20721 !! options
20722 parsoid=wt2html,wt2wt
20723 !! wikitext
20724 {|
20725 |
20726 <small>
20727 [[Image:Foobar.jpg|right|Test]]
20728 </small>
20729 |}
20730 !! html/parsoid
20731 <table>
20732 <tbody><tr><td>
20733 <small>
20734 <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>
20735 </small>
20736 </td></tr>
20737 </tbody></table>
20738 !! end
20739
20740 !! test
20741 2. Bad treebuilder fixup of formatting elt is cleaned up
20742 !! options
20743 parsoid=wt2html,wt2wt
20744 !! wikitext
20745 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20746
20747 <small>[[Image:Foobar.jpg|right|300px]]</small>
20748 !! html/parsoid
20749
20750 <p><b>foo</b></p>
20751 <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>
20752 <p><b>bar</b></p>
20753 <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>
20754 !! end
20755
20756 #### ----------------------------------------------------------------
20757 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20758 #### tags. Parsoid's output for these tags differs from that of the
20759 #### PHP parser.
20760 #### ----------------------------------------------------------------
20761
20762 !!test
20763 Ref: 1. ref-location should be replaced with an index span
20764 !!options
20765 parsoid
20766 !! wikitext
20767 A <ref>foo</ref>
20768 B <ref name="x">foo</ref>
20769 C <ref name="y" />
20770 <references />
20771 !! html
20772 <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>
20773 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>
20774 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>
20775 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20776 <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>
20777 <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>
20778 <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>
20779 </ol>
20780 !!end
20781
20782 !!test
20783 Ref: 2. ref-tags with identical names should all get the same index
20784 !!options
20785 parsoid
20786 !! wikitext
20787 A <ref name="x">foo</ref>
20788 B <ref name="x" />
20789 <references />
20790 !! html
20791 <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>
20792 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>
20793 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20794 <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>
20795 </ol>
20796 !!end
20797
20798 !!test
20799 Ref: 3. spaces in ref-names should be ignored
20800 !!options
20801 parsoid
20802 !! wikitext
20803 A <ref name="x">foo</ref>
20804 B <ref name=" x " />
20805 C <ref name= x />
20806 <references />
20807 !! html
20808 <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>
20809 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>
20810 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>
20811 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20812 <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>
20813 </ol>
20814 !!end
20815
20816 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20817 !!test
20818 Ref: 4. 'constructor' should be accepted as a valid ref-name
20819 !!options
20820 parsoid
20821 !! wikitext
20822 A <ref name="constructor">foo</ref>
20823 <references />
20824 !! html
20825 <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>
20826 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20827 <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>
20828 </ol>
20829 !!end
20830
20831 !!test
20832 Ref: 5. body should accept generic wikitext
20833 !!options
20834 parsoid
20835 !! wikitext
20836 A <ref>
20837 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20838 </ref>
20839
20840 <references />
20841 !! html
20842 <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>
20843
20844 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20845 <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>
20846 </span></li>
20847 </ol>
20848 !!end
20849
20850 !!test
20851 Ref: 6. indent-pres should not be output in ref-body
20852 !!options
20853 parsoid
20854 !! wikitext
20855 A <ref>
20856 foo
20857 bar
20858 baz
20859 </ref>
20860
20861 <references />
20862 !! html
20863 <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>
20864
20865 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20866 <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
20867 bar
20868 baz
20869 </span></li>
20870 </ol>
20871 !!end
20872
20873 !!test
20874 Ref: 7. No p-wrapping in ref-body
20875 !!options
20876 parsoid
20877 !! wikitext
20878 A <ref>
20879 foo
20880
20881 bar
20882
20883
20884 baz
20885
20886
20887
20888 booz
20889 </ref>
20890
20891 <references />
20892 !! html
20893 <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>
20894
20895 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20896 <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
20897
20898 bar
20899
20900
20901 baz
20902
20903
20904
20905 booz
20906 </span></li>
20907 </ol>
20908 !!end
20909
20910 !!test
20911 Ref: 8. transclusion wikitext has lower precedence
20912 !!options
20913 parsoid
20914 !! wikitext
20915 A <ref> foo {{echo|</ref> B C}}
20916
20917 <references />
20918 !! html
20919 <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>
20920 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20921 <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>
20922 </ol>
20923 !!end
20924
20925 !!test
20926 Ref: 9. unclosed comments should not leak out of ref-body
20927 !!options
20928 parsoid
20929 !! wikitext
20930 A <ref> foo <!--</ref> B C
20931 <references />
20932 !! html
20933 <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>
20934 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20935 <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>
20936 </ol>
20937 !!end
20938
20939 !!test
20940 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20941 !!options
20942 parsoid
20943 !! wikitext
20944 A <ref> <b> foo </ref> B C
20945
20946 <references />
20947 !! html
20948 <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>
20949
20950
20951 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20952 <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>
20953 </ol>
20954 !!end
20955
20956 !!test
20957 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20958 !!options
20959 parsoid
20960 !! wikitext
20961 A <ref>foo</ref> B
20962 C <ref>bar</ref> D
20963 <references />
20964 !! html
20965 <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
20966 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>
20967 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20968 <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>
20969 <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>
20970 </ol>
20971 !!end
20972
20973 !!test
20974 Ref: 12. ref-tags act as trailing newline migration barrier
20975 !! wikitext
20976 <!--the newline at the end of this line moves out of the p tag-->a
20977
20978 b<!--the newline at the end of this line stays inside the p tag--> <ref />
20979 <ref />
20980
20981 c
20982 <references />
20983 !! html/parsoid
20984 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
20985
20986
20987 <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>
20988 <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>
20989
20990 <p>c</p>
20991 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20992 <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>
20993 <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>
20994 !!end
20995
20996 !!test
20997 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20998 !!options
20999 parsoid
21000 !! wikitext
21001 <ref>foo</ref> A
21002 <ref>bar
21003 </ref> B
21004 <references />
21005 !! html
21006 <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
21007 <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>
21008 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21009 <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>
21010 <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
21011 </span></li>
21012 </ol>
21013 !!end
21014
21015 !!test
21016 Ref: 14. A nested ref-tag should be emitted as plain text
21017 !!options
21018 parsoid
21019 !! wikitext
21020 <ref>foo <ref>bar</ref> baz</ref>
21021
21022 <references />
21023 !! html
21024 <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>
21025 </p>
21026 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21027 <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>
21028 </ol>
21029 !!end
21030
21031 !!test
21032 Ref: 15. ref-tags with identical names should get identical indexes
21033 !!options
21034 parsoid
21035 !! wikitext
21036 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21037 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21038
21039 <references />
21040 !! html
21041 <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>
21042 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>
21043
21044 <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>
21045 </ol>
21046 !!end
21047
21048 ## We don't bother wt2wt-ing non-standard whitespace
21049 !!test
21050 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21051 !!options
21052 parsoid=wt2html
21053 !! wikitext
21054 A <ref >foo</ref >
21055
21056 <references />
21057 !! html
21058 <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>
21059 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21060 <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>
21061 !!end
21062
21063 !!test
21064 Ref: 17. Generate valid HTML5 id/about attributes
21065 !!options
21066 parsoid
21067 !!wikitext
21068 <ref name="a b">foo</ref>
21069
21070 <references />
21071 !!html
21072 <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>
21073 </p>
21074
21075 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21076 <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>
21077 </ol>
21078 !!end
21079
21080 !!test
21081 Ref: 18. T58916: Extension attributes should be parsed as plain text
21082 !!options
21083 parsoid
21084 !!wikitext
21085 <ref name="{{echo|a}}">foo</ref>
21086
21087 <references />
21088 !!html
21089 <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>
21090 </p>
21091
21092 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21093 <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>
21094 </ol>
21095 !!end
21096
21097 !!test
21098 Ref: 19. ref-tags with identical name encodings should get identical indexes
21099 !!options
21100 parsoid
21101 !! wikitext
21102 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21103
21104 <references />
21105 !! html
21106 <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>
21107 </p>
21108 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21109 <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>
21110 </ol>
21111 !!end
21112
21113 !!test
21114 Ref: 20. ref-tags with identical names but different content should keep it
21115 !!options
21116 parsoid
21117 !! wikitext
21118 A <ref name="foo">Foo one</ref>
21119 B <ref name="foo">Foo two</ref>
21120 C <ref name="foo" />
21121
21122 <references />
21123 !! html
21124 <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>
21125 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>
21126 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>
21127
21128 <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>
21129 </ol>
21130 !!end
21131
21132 !!test
21133 References: 1. references tag without any refs should be handled properly
21134 !! wikitext
21135 <references />
21136 !! html/parsoid
21137 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21138 !!end
21139
21140 !!test
21141 References: 2. references tag with group only outputs references from that group
21142 !! wikitext
21143 A <ref group="a">foo</ref>
21144 B <ref group="b">bar</ref>
21145 C <ref>baz</ref>
21146
21147 <references group="a" />
21148 <references />
21149 <references group="b" />
21150 !! html/parsoid
21151 <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>
21152 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>
21153 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>
21154
21155 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21156 <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>
21157 </ol>
21158 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21159 <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>
21160 </ol>
21161 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21162 <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>
21163 </ol>
21164 !!end
21165
21166 !!test
21167 References: 3. ref list should be cleared after processing references
21168 !! wikitext
21169 A <ref>foo</ref>
21170
21171 <references />
21172
21173 B <ref>bar</ref>
21174
21175 <references />
21176 !! html/parsoid
21177 <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>
21178
21179 <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>
21180 </ol>
21181
21182 <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>
21183
21184 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21185 <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>
21186 </ol>
21187 !!end
21188
21189 !!test
21190 References: 4. only referenced group should be cleared after processing references
21191 !! wikitext
21192 A <ref group="a">afoo</ref>
21193 B <ref>bfoo</ref>
21194
21195 <references group="a" />
21196
21197 C <ref>cfoo</ref>
21198
21199 <references />
21200 !! html/parsoid
21201 <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>
21202 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>
21203
21204 <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>
21205 </ol>
21206
21207 <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>
21208
21209 <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>
21210 </ol>
21211 !!end
21212
21213 !!test
21214 References: 5. ref tags in references should be processed while ignoring all other content
21215 !! wikitext
21216 A <ref name="a" />
21217 B <ref name="b">bar</ref>
21218
21219 <references>
21220 <ref name="a">foo</ref>
21221 This should just get lost.
21222 </references>
21223 !! html/parsoid
21224 <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>
21225 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>
21226
21227
21228 <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>
21229 </ol>
21230 !!end
21231
21232 !!test
21233 References: 6. <references /> from a transclusion
21234 !! wikitext
21235 <ref>Foo</ref> {{echo|<references />}}
21236 !! html/parsoid
21237 <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>
21238 </ol>
21239 !!end
21240
21241 !! test
21242 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21243 !! wikitext
21244 A <ref>foo bar for a</ref>
21245 B <ref group="X" name="b" />
21246
21247 <references />
21248
21249 <references group="X">
21250 <ref name="b">foo</ref>
21251 </references>
21252 !! html/parsoid
21253 <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>
21254 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>
21255 </p>
21256
21257 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21258 <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>
21259 </ol>
21260
21261 <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"}}'>
21262 <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>
21263 </ol>
21264 !! end
21265
21266 !! test
21267 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21268 !! wikitext
21269 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21270 <references />
21271 !! html/parsoid
21272 <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>
21273 <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>
21274 </ol>
21275 !!end
21276
21277 # This test only works in wt2html now as the <references /> are always generated
21278 # unless selser is active. Once T72722 is fixed, we should add a changes test
21279 # here to ensure that unrelated changes don't add the new <references /> in
21280 # wt2wt.
21281 !! test
21282 References: 9. Generate missing references list at the end
21283 !! wikitext
21284 A <ref>foo</ref>
21285 B <ref group="inexistent">bar</ref>
21286 !! html/parsoid
21287 <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>
21288 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21289 <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>
21290 </ol>
21291 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21292 <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>
21293 </ol>
21294 !! end
21295
21296 !! test
21297 References: 10. New <references/> shouldn't be added for unrelated edits.
21298 !! options
21299 parsoid={
21300 "modes": ["selser"],
21301 "changes": [["#x", "remove"]],
21302 "selser": "noauto"
21303 }
21304 !! wikitext
21305 Unrelated text<span id="x"> that's going to disappear</span>.
21306 A <ref>foo</ref>
21307 !! wikitext/edited
21308 Unrelated text.
21309 A <ref>foo</ref>
21310 !!end
21311
21312 !! test
21313 Entities in ref name
21314 !! wikitext
21315 <ref name="test &amp; me">hi</ref>
21316 <references />
21317 !! html/parsoid
21318 <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>
21319 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21320 <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>
21321 </ol>
21322 !! end
21323
21324 # This test is wt2html only because we're permitting the serializer to produce
21325 # dirty diffs, normalizing the unclosed references to the self-closed version.
21326 !! test
21327 Generate references for unclosed references tag
21328 !! options
21329 parsoid=wt2html
21330 !! wikitext
21331 a<ref>foo</ref>
21332
21333 <references>
21334 !! html/parsoid
21335 <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>
21336 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21337 <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>
21338 !! end
21339
21340 !! test
21341 New reference serializes on its own line
21342 !! options
21343 parsoid=wt2wt,html2wt
21344 !! wikitext
21345 foo
21346 <references />
21347 !! html/parsoid
21348 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21349 !! end
21350
21351 #### ----------------------------------------------------------------
21352 #### Parsoid-only testing of Parsoid's impl of LST
21353 #### Not implemented yet, see
21354 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21355 #### ----------------------------------------------------------------
21356
21357 !!test
21358 LST Sections: 1. Simple section start and end
21359 !! wikitext
21360 <section begin="2011-05-16" />
21361 <section end="2014-04-10 (MW 1.23wmf22)" />
21362 !! html/parsoid
21363 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21364 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21365 !! end
21366
21367 #--------- Test stripping of empty nodes in template content ----------
21368 !!test
21369 Empty LI and TR nodes should be stripped from template content
21370 !!wikitext
21371 {{EmptyLITest}}
21372 {{EmptyTRTest}}
21373 !!html/parsoid
21374 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21375 <li>a</li>
21376 <li>b</li>
21377 </ul>
21378 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21379 <tbody>
21380 <tr>
21381 <td>foo</td>
21382 </tr>
21383 <tr>
21384 <td>bar</td>
21385 </tr>
21386 </tbody>
21387 </table>
21388 !!end
21389
21390 !!test
21391 Empty LI and TR nodes should not be stripped from top-level content
21392 !!wikitext
21393 * a
21394 *
21395 * b
21396 {|
21397 |-
21398 |-
21399 |foo
21400 |}
21401 !!html/parsoid
21402 <ul>
21403 <li> a</li>
21404 <li></li>
21405 <li> b</li>
21406 </ul>
21407 <table>
21408 <tbody>
21409 <tr></tr>
21410 <tr>
21411 <td>foo</td>
21412 </tr>
21413 </tbody>
21414 </table>
21415 !!end
21416
21417 !!test
21418 Empty TR nodes should not be stripped if they have any attributes set
21419 !!wikitext
21420 {{EmptyTRWithHTMLAttrTest}}
21421 !!html/parsoid
21422 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21423 <tr align="center"></tr>
21424 <tr><td>foo</td></tr>
21425 <tr align="center"></tr>
21426 <tr><td>bar</td></tr>
21427 </table>
21428 !!end
21429
21430 #### ----------------------------------------------------------------
21431 #### The following section of tests are primarily to test
21432 #### wikitext escaping capabilities of Parsoid. Given that
21433 #### escaping can be done any number of ways, the wikitext (input)
21434 #### is always adjusted to reflect how Parsoid adds nowiki
21435 #### escape tags.
21436 ####
21437 #### We are marking several tests as parsoid-only since the
21438 #### HTML in the result section is different from what the
21439 #### PHP parser generates for it.
21440 #### ----------------------------------------------------------------
21441
21442
21443 #### --------------- Headings ---------------
21444 #### 0. Unnested
21445 #### 1. Nested inside html <h1>=foo=</h1>
21446 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21447 #### 3. Nested inside html with wikitext split by html tags
21448 #### 4. No escape needed
21449 #### 5. Empty headings <h1></h1>
21450 #### 6. Heading chars in SOL context
21451 #### ----------------------------------------
21452 !! test
21453 Headings: 0. Unnested
21454 !! options
21455 parsoid
21456 !! wikitext
21457 <nowiki>=foo=</nowiki>
21458
21459 <nowiki> =foo= </nowiki>
21460 <!--cmt-->
21461 <nowiki>=foo=</nowiki>
21462
21463 =foo''a''<nowiki>=</nowiki>
21464 !! html
21465 <p><span typeof="mw:Nowiki">=foo=</span></p>
21466
21467 <p><span typeof="mw:Nowiki"> =foo= </span>
21468 <!--cmt-->
21469 <span typeof="mw:Nowiki">=foo=</span></p>
21470
21471 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21472 !!end
21473
21474 # New headings and existing headings are handled differently
21475 !! test
21476 Headings: 1. Nested inside html
21477 !! options
21478 parsoid=html2wt
21479 !! html
21480 <h1>=foo=</h1>
21481 <h2>=foo=</h2>
21482 <h3>=foo=</h3>
21483
21484 <h1 data-parsoid=''>=foo=</h1>
21485 <h2 data-parsoid=''>=foo=</h2>
21486 <h3 data-parsoid=''>=foo=</h3>
21487 <h4 data-parsoid=''>=foo=</h4>
21488 <h5 data-parsoid=''>=foo=</h5>
21489 <h6 data-parsoid=''>=foo=</h6>
21490 !! wikitext
21491 = =foo= =
21492
21493 == =foo= ==
21494
21495 === =foo= ===
21496
21497 =<nowiki>=foo=</nowiki>=
21498 ==<nowiki>=foo=</nowiki>==
21499 ===<nowiki>=foo=</nowiki>===
21500 ====<nowiki>=foo=</nowiki>====
21501 =====<nowiki>=foo=</nowiki>=====
21502 ======<nowiki>=foo=</nowiki>======
21503
21504 !!end
21505
21506 !! test
21507 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21508 !! options
21509 parsoid=html2wt
21510 !! html
21511 <h1>foo</h1>*bar
21512 <h1>foo</h1>=bar
21513 <h1>foo</h1>=bar=
21514 !! wikitext
21515 = foo =
21516 <nowiki>*</nowiki>bar
21517
21518 = foo =
21519 =bar
21520
21521 = foo =
21522 <nowiki>=bar=</nowiki>
21523 !!end
21524
21525 !! test
21526 Headings: 3. Nested inside html with wikitext split by html tags
21527 !! options
21528 parsoid=html2wt,wt2wt
21529 !! wikitext
21530 = ='''bold'''<nowiki>foo=</nowiki> =
21531 !! html/parsoid
21532 <h1>=<b>bold</b>foo=</h1>
21533 !!end
21534
21535 !! test
21536 Headings: 4a. No escaping needed (testing just h1 and h2)
21537 !! wikitext
21538 = =foo =
21539
21540 = foo= =
21541
21542 = =foo= =
21543
21544 = =foo= bar =
21545
21546 == =foo ==
21547
21548 == foo= ==
21549
21550 = = =
21551
21552 = ''=''foo= =
21553 !! html/parsoid
21554 <h1>=foo</h1>
21555 <h1>foo=</h1>
21556 <h1> =foo= </h1>
21557 <h1>=foo= bar</h1>
21558 <h2>=foo</h2>
21559 <h2>foo=</h2>
21560 <h1>=</h1>
21561 <h1><i>=</i>foo=</h1>
21562 !!end
21563
21564 !! test
21565 Headings: 4b. No escaping needed (inside p-tags)
21566 !! options
21567 parsoid=html2wt
21568 !! html
21569 <p>===
21570 =foo= x
21571 =foo= <s></s>
21572 </p>
21573 !! wikitext
21574 ===
21575 =foo= x
21576 =foo= <s></s>
21577 !!end
21578
21579 !! test
21580 Headings: 5. Empty headings
21581 !! wikitext
21582 =<nowiki/>=
21583
21584 ==<nowiki/>==
21585
21586 ===<nowiki/>===
21587
21588 ====<nowiki/>====
21589
21590 =====<nowiki/>=====
21591
21592 ======<nowiki/>======
21593 !! html/parsoid
21594 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21595
21596 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21597
21598 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21599
21600 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21601
21602 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21603
21604 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21605 !!end
21606
21607 !! test
21608 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21609 !! options
21610 parsoid
21611 !! wikitext
21612 <nowiki>=a=</nowiki>
21613
21614 <nowiki>=a=</nowiki>
21615
21616 <nowiki>=a=</nowiki>
21617
21618 <nowiki>=a=</nowiki>
21619 !! html
21620 <p>=a=</p>
21621 <p>=a= </p>
21622 <p>=a= </p>
21623 <p>=a= </p>
21624 !!end
21625
21626 !! test
21627 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21628 !! options
21629 parsoid
21630 !! wikitext
21631 <nowiki>=a=
21632 b</nowiki>
21633
21634 <nowiki>=a=
21635 b</nowiki>
21636
21637 <nowiki>=a=
21638 b</nowiki>
21639
21640 <nowiki>=a=
21641 b</nowiki>
21642 !! html
21643 <p>=a=
21644 b</p>
21645 <p>=a=
21646 b</p>
21647 <p>=a=
21648 b</p>
21649 <p>=a=
21650 b</p>
21651 </p>
21652 !!end
21653
21654 !! test
21655 Headings: 6c. Heading chars in SOL context (leading newline break)
21656 !! options
21657 parsoid
21658 !! wikitext
21659 a
21660 <nowiki>=b=</nowiki>
21661 !! html
21662 <p>a
21663 =b=</p>
21664 !!end
21665
21666 !! test
21667 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21668 !! options
21669 parsoid
21670 !! wikitext
21671 <!--c0--><nowiki>=a=</nowiki>
21672
21673 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21674 !! html
21675 <p><!--c0-->=a=</p>
21676 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21677 !!end
21678
21679 !! test
21680 Headings: 6d. Heading chars in SOL context (No escaping needed)
21681 !! options
21682 parsoid=html2wt
21683 !! html
21684 =a=<div>b</div>
21685 !! wikitext
21686 =a=<div>b</div>
21687 !!end
21688
21689 !! test
21690 Headings: 7. Insert a newline between new content and headings
21691 !! options
21692 parsoid=html2wt
21693 !! html
21694 <h2>NEW</h2>
21695 <p>new</p>
21696 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21697 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21698 !! wikitext
21699 == NEW ==
21700 new
21701
21702 ==A==
21703 a
21704
21705 !! end
21706
21707 #### --------------- Lists ---------------
21708 #### 0. Outside nests (*foo, etc.)
21709 #### 1. Nested inside html <ul><li>*foo</li></ul>
21710 #### 2. Inside definition lists
21711 #### 3. Only bullets at start should be escaped
21712 #### 4. No escapes needed
21713 #### 5. No unnecessary escapes
21714 #### 6. Escape bullets in SOL position
21715 #### 7. Escape bullets in a multi-line context
21716 #### ----------------------------------------
21717
21718 !! test
21719 Lists: 0. Outside nests
21720 !! wikitext
21721 <nowiki>*</nowiki>foo
21722
21723 <nowiki>#</nowiki>foo
21724
21725 <nowiki>;Foo:</nowiki>bar
21726 !! html
21727 <p>*foo
21728 </p><p>#foo
21729 </p><p>;Foo:bar
21730 </p>
21731 !!end
21732
21733 !! test
21734 Lists: 1. Nested inside html
21735 !! wikitext
21736 *<nowiki>*foo</nowiki>
21737
21738 *<nowiki>#foo</nowiki>
21739
21740 *<nowiki>:foo</nowiki>
21741
21742 *<nowiki>;foo</nowiki>
21743
21744 #<nowiki>*foo</nowiki>
21745
21746 #<nowiki>#foo</nowiki>
21747
21748 #<nowiki>:foo</nowiki>
21749
21750 #<nowiki>;foo</nowiki>
21751 !! html
21752 <ul><li>*foo</li></ul>
21753 <ul><li>#foo</li></ul>
21754 <ul><li>:foo</li></ul>
21755 <ul><li>;foo</li></ul>
21756 <ol><li>*foo</li></ol>
21757 <ol><li>#foo</li></ol>
21758 <ol><li>:foo</li></ol>
21759 <ol><li>;foo</li></ol>
21760
21761 !!end
21762
21763 !! test
21764 Lists: 2. Inside definition lists
21765 !! wikitext
21766 ;<nowiki>;foo</nowiki>
21767
21768 ;<nowiki>:foo</nowiki>
21769
21770 ;<nowiki>:foo</nowiki>
21771 :bar
21772
21773 :<nowiki>:foo</nowiki>
21774 !! html
21775 <dl><dt>;foo</dt></dl>
21776 <dl><dt>:foo</dt></dl>
21777 <dl><dt>:foo</dt>
21778 <dd>bar</dd></dl>
21779 <dl><dd>:foo</dd></dl>
21780
21781 !!end
21782
21783 !! test
21784 Lists: 3. Only bullets at start of text should be escaped
21785 !! wikitext
21786 *<nowiki>*foo*bar</nowiki>
21787
21788 *<nowiki>*foo</nowiki>''it''*bar
21789 !! html
21790 <ul><li>*foo*bar</li></ul>
21791 <ul><li>*foo<i>it</i>*bar</li></ul>
21792
21793 !!end
21794
21795 !! test
21796 Lists: 4. No escapes needed
21797 !! options
21798 parsoid
21799 !! wikitext
21800 *foo*bar
21801
21802 *''foo''*bar
21803
21804 *[[Foo]]: bar
21805
21806 *[[Foo]]*bar
21807 !! html
21808 <ul>
21809 <li>foo*bar
21810 </li>
21811 </ul>
21812 <ul>
21813 <li><i>foo</i>*bar
21814 </li>
21815 </ul>
21816 <ul>
21817 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21818 </li>
21819 </ul>
21820 <ul>
21821 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21822 </li>
21823 </ul>
21824 !!end
21825
21826 !! test
21827 Lists: 5. No unnecessary escapes
21828 !! wikitext
21829 * bar <span><nowiki>[[foo]]</nowiki></span>
21830
21831 * =bar <span><nowiki>[[foo]]</nowiki></span>
21832
21833 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21834
21835 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21836
21837 * =bar <span>foo]]</span>=
21838
21839 * <s></s>: a
21840
21841 * ''* foo''
21842 !! html
21843 <ul><li> bar <span>[[foo]]</span></li></ul>
21844 <ul><li> =bar <span>[[foo]]</span></li></ul>
21845 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21846 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21847 <ul><li> =bar <span>foo]]</span>=</li></ul>
21848 <ul><li> <s></s>: a</li></ul>
21849 <ul><li> <i>* foo</i></li></ul>
21850
21851 !!end
21852
21853 !! test
21854 Lists: 6. Escape bullets in SOL position
21855 !! options
21856 parsoid=html2wt
21857 !! html
21858 <p><!--cmt-->*foo</p>
21859 !! wikitext
21860 <!--cmt--><nowiki>*</nowiki>foo
21861 !!end
21862
21863 !! test
21864 Lists: 7. Escape bullets in a multi-line context
21865 !! wikitext
21866 a
21867 <nowiki>*</nowiki>b
21868 !! html
21869 <p>a
21870 *b
21871 </p>
21872 !!end
21873
21874 !! test
21875 Lists: 8. Escape colons only if not present in tags
21876 !! options
21877 parsoid=html2wt
21878 !! html
21879 <dl><dt>a:b<i>c:d</i></dt></dl>
21880 !! wikitext
21881 ; <nowiki>a:b</nowiki>''c:d''
21882 !! end
21883
21884 #### --------------- HRs ---------------
21885 #### 1. Single line
21886 #### -----------------------------------
21887
21888 !! test
21889 HRs: 1. Single line
21890 !! wikitext
21891 ----<nowiki>----</nowiki>
21892 ----=foo=
21893 ----*foo
21894 !! html+tidy
21895 <hr />
21896 <p>----</p>
21897 <hr />
21898 <p>=foo=</p>
21899 <hr />
21900 <p>*foo</p>
21901 !! end
21902
21903 #### --------------- Tables ---------------
21904 #### 1a. Simple example
21905 #### 1b. No escaping needed (!foo)
21906 #### 1c. No escaping needed (|foo)
21907 #### 1d. No escaping needed (|}foo)
21908 ####
21909 #### 2a. Nested in td (<td>foo|bar</td>)
21910 #### 2b. Nested in td (<td>foo||bar</td>)
21911 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21912 ####
21913 #### 3a. Nested in th (<th>foo!bar</th>)
21914 #### 3b. Nested in th (<th>foo!!bar</th>)
21915 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21916 ####
21917 #### 4a. Escape -
21918 #### 4b. Escape +
21919 #### 4c. No escaping needed
21920 #### --------------------------------------
21921
21922 !! test
21923 Tables: 1a. Simple example
21924 !! wikitext
21925 <nowiki>{|
21926 |}</nowiki>
21927 !! html
21928 <p>{|
21929 |}
21930 </p>
21931 !! end
21932
21933 !! test
21934 Tables: 1b. No escaping needed
21935 !! wikitext
21936 !foo
21937 !! html
21938 <p>!foo
21939 </p>
21940 !! end
21941
21942 !! test
21943 Tables: 1c. No escaping needed
21944 !! wikitext
21945 |foo
21946 !! html
21947 <p>|foo
21948 </p>
21949 !! end
21950
21951 !! test
21952 Tables: 1d. No escaping needed
21953 !! wikitext
21954 |}foo
21955 !! html
21956 <p>|}foo
21957 </p>
21958 !! end
21959
21960 !! test
21961 Tables: 2a. Nested in td
21962 !! options
21963 parsoid=html2wt
21964 !! html/parsoid
21965 <table><tbody><tr>
21966 <td>foo|bar</td></tr>
21967 <tr><td>x<div>a|b</div></td>
21968 </tbody></table>
21969 !! wikitext
21970 {|
21971 |<nowiki>foo|bar</nowiki>
21972 |-
21973 |x<div><nowiki>a|b</nowiki></div>
21974 |}
21975 !! html/php+tidy
21976 <table>
21977 <tr>
21978 <td>foo|bar</td>
21979 </tr>
21980 <tr>
21981 <td>x
21982 <div>a|b</div>
21983 </td>
21984 </tr>
21985 </table>
21986 !! end
21987
21988 !! test
21989 Tables: 2b. Nested in td
21990 !! options
21991 parsoid=html2wt
21992 !! html/parsoid
21993 <table><tbody><tr>
21994 <td>foo||bar</td>
21995 <td>a<i>b||c</i></td>
21996 <td>a<i><div>b||c</div></i></td>
21997 </tr></tbody></table>
21998 !! wikitext
21999 {|
22000 |<nowiki>foo||bar</nowiki>
22001 |a''<nowiki>b||c</nowiki>''
22002 |a''<div><nowiki>b||c</nowiki></div>''
22003 |}
22004 !! html/php
22005 <table>
22006 <tr>
22007 <td>foo||bar
22008 </td>
22009 <td>a<i>b||c</i>
22010 </td>
22011 <td>a<i><div>b||c</div></i>
22012 </td></tr></table>
22013
22014 !! end
22015
22016 !! test
22017 Tables: 2c. Nested in td -- no escaping needed
22018 !! wikitext
22019 {|
22020
22021 |foo!!bar
22022 |}
22023 !! html/*
22024 <table>
22025
22026 <tr>
22027 <td>foo!!bar
22028 </td></tr></table>
22029
22030 !! end
22031
22032 !! test
22033 Tables: 3a. Nested in th
22034 !! wikitext
22035 {|
22036
22037 !foo!bar
22038 |}
22039 !! html/*
22040 <table>
22041
22042 <tr>
22043 <th>foo!bar
22044 </th></tr></table>
22045
22046 !! end
22047
22048 !! test
22049 Tables: 3b. Nested in th
22050 !! options
22051 parsoid=html2wt
22052 !! html/parsoid
22053 <table><tbody>
22054 <tr><th>foo!!bar</th>
22055 <th><i>foo|bar</i></th>
22056 <th><i>foo!!bar</i></th>
22057 <th><i><span>foo!!bar</span></i></th>
22058 </tr></tbody></table>
22059 !! wikitext
22060 {|
22061 !<nowiki>foo!!bar</nowiki>
22062 !''<nowiki>foo|bar</nowiki>''
22063 !''<nowiki>foo!!bar</nowiki>''
22064 !''<span><nowiki>foo!!bar</nowiki></span>''
22065 |}
22066 !! html/php
22067 <table>
22068 <tr>
22069 <th>foo!!bar
22070 </th>
22071 <th><i>foo|bar</i>
22072 </th>
22073 <th><i>foo!!bar</i>
22074 </th>
22075 <th><i><span>foo!!bar</span></i>
22076 </th></tr></table>
22077
22078 !! end
22079
22080 !! test
22081 Tables: 3c. Nested in th
22082 !! options
22083 parsoid=html2wt
22084 !! html/parsoid
22085 <table><tbody>
22086 <tr><th>foo||bar</th>
22087 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22088 </tr></tbody></table>
22089 !! wikitext
22090 {|
22091 !<nowiki>foo||bar</nowiki>
22092 !<nowiki>foo||bar</nowiki>
22093 |}
22094 !! html/php
22095 <table>
22096 <tr>
22097 <th>foo||bar
22098 </th>
22099 <th>foo||bar
22100 </th></tr></table>
22101
22102 !! end
22103
22104 !! test
22105 Tables: 4a. Escape -
22106 !! options
22107 parsoid=html2wt
22108 !! html/*
22109 <table>
22110
22111 <tr>
22112 <th>-bar
22113 </th></tr>
22114 <tr>
22115 <td>-bar
22116 </td></tr></table>
22117
22118 !! wikitext
22119 {|
22120
22121 !-bar
22122
22123 |-
22124 |<nowiki>-bar</nowiki>
22125 |}
22126 !! end
22127
22128 !! test
22129 Tables: 4b. Escape +
22130 !! options
22131 parsoid=html2wt
22132 !! html/*
22133 <table>
22134
22135 <tr>
22136 <th>+bar
22137 </th></tr>
22138 <tr>
22139 <td>+bar
22140 </td></tr></table>
22141
22142 !! wikitext
22143 {|
22144
22145 !+bar
22146
22147 |-
22148 |<nowiki>+bar</nowiki>
22149 |}
22150 !! end
22151
22152 !! test
22153 Tables: 4c. No escaping needed
22154 !! wikitext
22155 {|
22156 |foo-bar
22157 |foo+bar
22158 |-
22159 |''foo''-bar
22160 |''foo''+bar
22161 |-
22162 |foo
22163 bar|baz
22164 +bar
22165 -bar
22166 |-
22167 |x
22168 <div>a|b</div>
22169 |}
22170 !! html/php
22171 <table>
22172 <tr>
22173 <td>foo-bar
22174 </td>
22175 <td>foo+bar
22176 </td></tr>
22177 <tr>
22178 <td><i>foo</i>-bar
22179 </td>
22180 <td><i>foo</i>+bar
22181 </td></tr>
22182 <tr>
22183 <td>foo
22184 <p>bar|baz
22185 +bar
22186 -bar
22187 </p>
22188 </td></tr>
22189 <tr>
22190 <td>x
22191 <div>a|b</div>
22192 </td></tr></table>
22193
22194 !! html/parsoid
22195 <table><tbody>
22196 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22197 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22198 <tr><td>foo
22199 <p>bar|baz
22200 +bar
22201 -bar</p></td></tr>
22202 <tr><td>x
22203 <div>a|b</div></td>
22204 </tbody></table>
22205 !! end
22206
22207 !! test
22208 Tables: 4d. No escaping needed
22209 !! wikitext
22210 {|
22211 |[[Foo]]-bar
22212 ||+1
22213 ||-2
22214 |}
22215 !! html/php
22216 <table>
22217 <tr>
22218 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22219 </td>
22220 <td>+1
22221 </td>
22222 <td>-2
22223 </td></tr></table>
22224
22225 !! html/parsoid
22226 <table>
22227 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22228 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22229 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22230 </tbody></table>
22231 !! end
22232
22233 !! test
22234 Tables: Digest broken attributes on table and tr tag
22235 !! options
22236 parsoid=wt2html
22237 !! wikitext
22238 {| || |} ++
22239 |- || || ++ --
22240 |- > [
22241 |}
22242 !! html
22243 <table>
22244 <tbody>
22245 <tr></tr>
22246 <tr></tr>
22247 </tbody></table>
22248 !! end
22249
22250 !! test
22251 T97430: Don't emit empty nowiki pairs around marker meta tags
22252 !! options
22253 parsoid=html2wt
22254 !! html
22255 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22256 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22257 !! wikitext
22258 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22259 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22260 !! end
22261
22262 !! test
22263 Unclosed xmlish element in table line shouldn't eat end delimiters
22264 !! wikitext
22265 {|
22266 | <foo
22267 | bar>
22268 |}
22269 !! html/php
22270 <table>
22271 <tr>
22272 <td> &lt;foo
22273 </td>
22274 <td> bar&gt;
22275 </td></tr></table>
22276
22277 !! html/parsoid
22278 <table>
22279 <tbody><tr><td> &lt;foo</td>
22280 <td> bar></td></tr>
22281 </tbody></table>
22282 !! end
22283
22284 #### --------------- Links ----------------
22285 #### 1. Quote marks in link text
22286 #### 2. Wikilinks: Escapes needed
22287 #### 3. Wikilinks: No escapes needed
22288 #### 4. Extlinks: Escapes needed
22289 #### 5. Extlinks: No escapes needed
22290 #### --------------------------------------
22291 !! test
22292 Links 1. WikiLinks: No escapes needed
22293 !! wikitext
22294 [[Foo|Foo''boo'']]
22295 [[Foo|[Foobar]]]
22296 [[Foo|x [Foobar] x]]
22297 !! html/php
22298 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22299 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22300 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22301 </p>
22302 !! html/parsoid
22303 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22304 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22305 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22306 !! end
22307
22308 !! test
22309 Links 2. WikiLinks: Escapes needed
22310 !! options
22311 parsoid=html2wt
22312 !! html/parsoid
22313 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22314 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22315 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22316 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22317 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22318 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22319 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22320 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22321 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22322 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22323 !! wikitext
22324 [[Foo|<nowiki>Foobar]</nowiki>]]
22325 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22326 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22327 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22328 [[Foo|<nowiki>|Bar</nowiki>]]
22329 [[Foo|<nowiki>]]bar</nowiki>]]
22330 [[Foo|<nowiki>[[bar</nowiki>]]
22331 [[Foo|<nowiki>x [[ y</nowiki>]]
22332 [[Foo|<nowiki>x ]] y</nowiki>]]
22333 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22334 !! html/php
22335 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22336 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22337 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22338 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22339 <a href="/wiki/Foo" title="Foo">|Bar</a>
22340 <a href="/wiki/Foo" title="Foo">]]bar</a>
22341 <a href="/wiki/Foo" title="Foo">[[bar</a>
22342 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22343 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22344 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22345 </p>
22346 !! end
22347
22348 !! test
22349 Links 3. WikiLinks: No escapes needed
22350 !! wikitext
22351 [[Foo|[Foobar]]
22352 [[Foo|foo|bar]]
22353 !! html/php
22354 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22355 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22356 </p>
22357 !! html/parsoid
22358 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22359 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22360 !! end
22361
22362 !! test
22363 Links 4. ExtLinks: Escapes needed
22364 !! options
22365 parsoid=html2wt
22366 !! html/parsoid
22367 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22368 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22369 <p>[http://google.com]</p>
22370 <p>[http://google.com google]</p>
22371 !! wikitext
22372 [http://google.com <nowiki>[google]</nowiki>]
22373 [http://google.com <nowiki>google]</nowiki>]
22374
22375 <nowiki>[http://google.com]</nowiki>
22376
22377 <nowiki>[http://google.com google]</nowiki>
22378
22379 !! html/php
22380 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22381 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22382 </p><p>[http://google.com]
22383 </p><p>[http://google.com google]
22384 </p>
22385 !! end
22386
22387 !! test
22388 Links 5. ExtLinks: No escapes needed
22389 !! wikitext
22390 [http://google.com [google]
22391 !! html/php
22392 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22393 </p>
22394 !! html/parsoid
22395 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22396 !! end
22397
22398 !! test
22399 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22400 !! html/parsoid
22401 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22402 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22403 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22404 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22405 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22406 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22407 <a rel="mw:ExtLink" href="http://example.com" 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(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22414 </p>
22415 !! wikitext
22416 x<nowiki/>http://example.com<nowiki/>y
22417 http://example.com<nowiki/>?x
22418 http://example.com<nowiki/>&x
22419 http://example.com<nowiki/>'x
22420 http://example.com<nowiki/>,x
22421 http://example.com<nowiki/>.x
22422 http://example.com<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(x<nowiki/>)
22429 !! end
22430
22431 !! test
22432 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22433 !! html/parsoid
22434 <p>x
22435 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22436 y
22437 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22438 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22439 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
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>, foo
22442 </p>
22443 !! wikitext
22444 x
22445 http://example.com
22446 y
22447 "http://example.com"
22448 (http://example.com)
22449 (http://example.com) foo
22450 http://example.com,
22451 http://example.com, foo
22452 !! html/php
22453 <p>x
22454 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22455 y
22456 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22457 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22458 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
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>, foo
22461 </p>
22462 !! end
22463
22464 !! test
22465 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22466 !! html/parsoid
22467 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22468 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22469 !! wikitext
22470 http://example.com.,;:!?\
22471 -http://example.com:
22472 !! html/php
22473 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22474 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22475 </p>
22476 !! end
22477
22478 !! test
22479 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22480 !! html/parsoid
22481 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22482 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22483 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22484 !! wikitext
22485 RFC 123<nowiki/>4
22486 RFC 123<nowiki/>y
22487 X<nowiki/>RFC 123<nowiki/>y
22488 !! end
22489
22490 !! test
22491 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22492 !! html/parsoid
22493 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22494 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22495 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22496 </p>
22497 !! wikitext
22498 RFC 123?foo
22499 RFC 123&foo
22500 -RFC 123-
22501 !! html/php
22502 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22503 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22504 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22505 </p>
22506 !! end
22507
22508 !! test
22509 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22510 !! html/parsoid
22511 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22512 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22513 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22514 !! wikitext
22515 PMID 123<nowiki/>4
22516 PMID 123<nowiki/>y
22517 X<nowiki/>PMID 123<nowiki/>y
22518 !! end
22519
22520 !! test
22521 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22522 !! html/parsoid
22523 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22524 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22525 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22526 </p>
22527 !! wikitext
22528 PMID 123?foo
22529 PMID 123&foo
22530 -PMID 123-
22531 !! html/php
22532 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22533 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22534 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22535 </p>
22536 !! end
22537
22538 !! test
22539 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22540 !! html/parsoid
22541 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22542 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22543 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22544 </p>
22545 !! wikitext
22546 ISBN 1234567890<nowiki/>1
22547 ISBN 1234567890<nowiki/>x
22548 a<nowiki/>ISBN 1234567890<nowiki/>b
22549 !! end
22550
22551 !! test
22552 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22553 !! html/parsoid
22554 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22555 !! wikitext
22556 -ISBN 1234567890's
22557 !! html/php
22558 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22559 </p>
22560 !! end
22561
22562 !! test
22563 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22564 !! options
22565 parsoid=html2wt
22566 !! html/*
22567 <p>this is not a link: http://example.com
22568 </p>
22569 !! wikitext
22570 this is not a link: <nowiki>http://example.com</nowiki>
22571 !! end
22572
22573 !! test
22574 Links 15. Link trails can't become link prefixes.
22575 !! options
22576 language=is
22577 !! wikitext
22578 [[Söfnuður]]-[[00]]
22579 !! html/php
22580 <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>
22581 </p>
22582 !! html/parsoid
22583 <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>
22584 !! end
22585
22586 #### --------------- Quotes ---------------
22587 #### 1. Quotes inside <b> and <i>
22588 #### 2. Link fragments separated by <i> and <b> tags
22589 #### 3. Link fragments inside <i> and <b>
22590 #### 4. No escaping needed
22591 #### --------------------------------------
22592 !! test
22593 1a. Quotes inside <b> and <i>
22594 !! options
22595 parsoid=html2wt,wt2wt
22596 !! wikitext
22597 ''<nowiki/>'foo'''
22598 ''<nowiki>''foo''</nowiki>''
22599 ''<nowiki>'''foo'''</nowiki>''
22600 ''foo''<nowiki/>'s
22601 '''<nowiki/>'foo''''
22602 '''<nowiki>''foo''</nowiki>'''
22603 '''<nowiki>'''foo'''</nowiki>'''
22604 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22605 '''foo'''<nowiki/>'s
22606 '''foo''
22607 ''foo''<nowiki/>'
22608 ''foo'''<nowiki/>'
22609 '''foo''<nowiki/>'
22610 ''''foo'''
22611 '''foo'''<nowiki/>'
22612 ''''foo'''<nowiki/>'
22613 ''fools'<span> errand</span>''
22614 ''<span>fool</span>'s errand''
22615 '<nowiki/>''foo'' bar '''baz''
22616 a|!*#-:;+-~[]{}b'''x''
22617 !! html/*
22618 <p><i>'foo'</i>
22619 <i>''foo''</i>
22620 <i>'''foo'''</i>
22621 <i>foo</i>'s
22622 <b>'foo'</b>
22623 <b>''foo''</b>
22624 <b>'''foo'''</b>
22625 <b>foo'<i>bar'</i>baz</b>
22626 <b>foo</b>'s
22627 '<i>foo</i>
22628 <i>foo</i>'
22629 <i>foo'</i>'
22630 '<i>foo</i>'
22631 '<b>foo</b>
22632 <b>foo</b>'
22633 '<b>foo</b>'
22634 <i>fools'<span> errand</span></i>
22635 <i><span>fool</span>'s errand</i>
22636 '<i>foo</i> bar '<i>baz</i>
22637 a|!*#-:;+-~[]{}b'<i>x</i>
22638 </p>
22639 !! end
22640
22641 !! test
22642 1b. Quotes inside <b> and <i> with other tags on same line
22643 !! options
22644 parsoid=html2wt,wt2wt
22645 !! wikitext
22646 '''a'' foo ''[[bar]]''
22647 ''a''' foo ''[[bar]]''
22648 ''a''' foo '''{{echo|[[bar]]}}'''
22649 [[foo]] x'''[[bar]]''
22650 '''foo'' <ref>test</ref>
22651 '''foo'' <div title="name">test</div>
22652 '''foo'' and <br> bar
22653 <references />
22654 !! html
22655 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22656 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22657 <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>
22658 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22659 '<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>
22660 '<i>foo</i> <div title="name">test</div>
22661 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22662 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22663 <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>
22664 </ol>
22665 !! end
22666
22667 !! test
22668 2. Link fragments separated by <i> and <b> tags
22669 !! wikitext
22670 [[''foo''<nowiki>hello]]</nowiki>
22671
22672 [['''foo'''<nowiki>hello]]</nowiki>
22673 !! html
22674 <p>[[<i>foo</i>hello]]
22675 </p><p>[[<b>foo</b>hello]]
22676 </p>
22677 !! end
22678
22679 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22680 # this is one of the shortcomings of this format
22681 !! test
22682 3. Link fragments inside <i> and <b>
22683 !! wikitext
22684 ''[[foo''<nowiki>]]</nowiki>
22685
22686 '''[[foo'''<nowiki>]]</nowiki>
22687 !! html
22688 <p><i>[[foo</i>]]
22689 </p><p><b>[[foo</b>]]
22690 </p>
22691 !! end
22692
22693 !! test
22694 4. No escaping needed
22695 !! wikitext
22696 '<span>''bar''</span>'
22697 '<span>'''bar'''</span>'
22698 'a:b'foo
22699 !! html
22700 <p>'<span><i>bar</i></span>'
22701 '<span><b>bar</b></span>'
22702 'a:b'foo
22703 </p>
22704 !! end
22705
22706 #### ----------- Paragraphs ---------------
22707 #### 1. No unnecessary escapes
22708 #### --------------------------------------
22709
22710 !! test
22711 1. No unnecessary escapes
22712 !! wikitext
22713 bar <span><nowiki>[[foo]]</nowiki></span>
22714
22715 =bar <span><nowiki>[[foo]]</nowiki></span>
22716
22717 [[bar <span><nowiki>[[foo]]</nowiki></span>
22718
22719 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22720
22721 =bar <span>foo]]</span><nowiki>=</nowiki>
22722 !! html
22723 <p>bar <span>[[foo]]</span>
22724 </p><p>=bar <span>[[foo]]</span>
22725 </p><p>[[bar <span>[[foo]]</span>
22726 </p><p>]]bar <span>[[foo]]</span>
22727 </p><p>=bar <span>foo]]</span>=
22728 </p>
22729 !!end
22730
22731 #### ----------------------- PRE --------------------------
22732 #### 1. Leading whitespace in SOL context should be escaped
22733 #### ------------------------------------------------------
22734 !! test
22735 1. Leading whitespace in SOL context should be escaped
22736 !! options
22737 parsoid
22738 !! wikitext
22739 <nowiki> </nowiki>a
22740
22741 <nowiki> </nowiki> a
22742
22743 <nowiki> </nowiki>a(tab)
22744
22745 <nowiki> </nowiki> a
22746 <!--cmt-->
22747 <nowiki> </nowiki> a
22748
22749 a
22750 <nowiki> </nowiki>b
22751
22752 a
22753 <nowiki> </nowiki>b
22754
22755 a
22756 <nowiki> </nowiki> b
22757 !! html
22758 <p> a</p>
22759 <p> a</p>
22760 <p> a(tab)</p>
22761 <p> a</p>
22762 <p><!--cmt--> a</p>
22763 <p>a
22764 b</p>
22765 <p>a
22766 b</p>
22767 <p>a
22768 b</p>
22769 !! end
22770
22771 !! test
22772 2. Leading whitespace in non-indent-pre contexts should not be escaped
22773 !! options
22774 parsoid
22775 !! wikitext
22776 foo <ref>''a''
22777 b</ref>
22778 <references />
22779 !! html
22780 <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>
22781 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22782 <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>
22783 b</span></li>
22784 </ol>
22785 !! end
22786
22787 !! test
22788 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22789 !! options
22790 parsoid
22791 !! wikitext
22792 <blockquote>
22793 a
22794 <span>b</span>
22795 c
22796 </blockquote>
22797 !! html
22798 <blockquote>
22799 <p>
22800 a
22801 <span>b</span>
22802 c</p>
22803 </blockquote>
22804 !! end
22805
22806 !! test
22807 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22808 !! options
22809 parsoid
22810 !! wikitext
22811 [[File:Foobar.jpg|thumb|caption]]
22812 !! html/parsoid
22813 <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>
22814 !! end
22815
22816 !! test
22817 5. Nowiki escaping should account for indent-pres
22818 !! options
22819 parsoid=html2wt
22820 !! html
22821 <pre>==foo==</pre>
22822 !! wikitext
22823 ==foo==
22824 !! end
22825
22826 !!test
22827 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
22828 !! options
22829 parsoid
22830 !! wikitext
22831 * foo
22832 * bar
22833 !! html
22834 <pre>
22835 * foo
22836 * bar
22837 </pre>
22838 !! end
22839
22840 #### --------------- Behavior Switches --------------------
22841
22842 !! test
22843 1. Valid behavior switches should be escaped
22844 !! options
22845 parsoid=html2wt
22846 !! html
22847 __TOC__
22848 <i>__TOC__</i>
22849 !! wikitext
22850 <nowiki>__TOC__</nowiki>
22851 ''<nowiki>__TOC__</nowiki>''
22852 !! end
22853
22854 !! test
22855 2. Invalid behavior switches should not be escaped
22856 !! options
22857 parsoid=html2wt
22858 !! html
22859 __TOO__
22860 __|__
22861 !! wikitext
22862 __TOO__
22863 __|__
22864 !! end
22865
22866 # We use indent-pre as an indirect way to test for sol-transparent behavior.
22867 !! test
22868 Behavior switches should be SOL-transparent
22869 !! wikitext
22870 __TOC__
22871
22872 <!-- this one's bogus -->
22873 __TOO__
22874
22875 __TOC__ foo
22876
22877 __TOC__ bar
22878 !! html/parsoid
22879 <meta property="mw:PageProp/toc" />
22880
22881 <!-- this one's bogus -->
22882 <pre>__TOO__</pre>
22883
22884 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
22885
22886 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
22887 !! end
22888
22889 #### --------------- HTML tags ---------------
22890 #### 1. a tags
22891 #### 2. other tags
22892 #### 3. multi-line html tag
22893 #### 4. extension tags
22894 #### -----------------------------------------
22895 !! test
22896 1. a tags
22897 !! options
22898 parsoid
22899 !! wikitext
22900 <a href="http://google.com">google</a>
22901 !! html
22902 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22903 !! end
22904
22905 !! test
22906 2. other tags
22907 !! wikitext
22908 * <nowiki><div>foo</div></nowiki>
22909 * <nowiki><div style="color:red">foo</div></nowiki>
22910 * <nowiki><td></nowiki>
22911 !! html
22912 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22913 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22914 <li> &lt;td&gt;</li></ul>
22915
22916 !! end
22917
22918 !! test
22919 3. multi-line html tag
22920 !! wikitext
22921 <nowiki><div
22922 >foo</div
22923 ></nowiki>
22924 !! html
22925 <p>&lt;div
22926 &gt;foo&lt;/div
22927 &gt;
22928 </p>
22929 !! end
22930
22931 !! test
22932 4. extension tags
22933 !! wikitext
22934 <nowiki><ref>foo</ref></nowiki>
22935
22936 <nowiki><ref>bar</nowiki>
22937
22938 baz<nowiki></ref></nowiki>
22939 !! html
22940 <p>&lt;ref&gt;foo&lt;/ref&gt;
22941 </p><p>&lt;ref&gt;bar
22942 </p><p>baz&lt;/ref&gt;
22943 </p>
22944 !! end
22945
22946 #### --------------- Others ---------------
22947 !! test
22948 Escaping nowikis
22949 !! wikitext
22950 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22951 !! html
22952 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22953 </p>
22954 !! end
22955
22956 ## The quote-char in the input is necessary for triggering the bug
22957 !! test
22958 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22959 !! options
22960 parsoid=wt2wt,html2wt
22961 !! wikitext
22962 foo's bar :
22963 !! html
22964 <p>foo's bar :</p>
22965 !! end
22966
22967 !! test
22968
22969 Tag-like HTML structures are passed through as text
22970 !! wikitext
22971 <x y>
22972
22973 <x.y>
22974
22975 <x-y>
22976
22977 1>2
22978
22979 x<y
22980
22981 a>b
22982
22983 1<d e>f
22984 !! html
22985 <p>&lt;x y&gt;
22986 </p><p>&lt;x.y&gt;
22987 </p><p>&lt;x-y&gt;
22988 </p><p>1&gt;2
22989 </p><p>x&lt;y
22990 </p><p>a&gt;b
22991 </p><p>1&lt;d e&gt;f
22992 </p>
22993 !! end
22994
22995 !! test
22996 HTML tag with necessary entities in attributes
22997 !! wikitext
22998 <span title="&amp;amp;">foo</span>
22999 !! html
23000 <p><span title="&amp;amp;">foo</span>
23001 </p>
23002 !! end
23003
23004 !! test
23005 HTML tag with 'unnecessary' entity encoding in attributes
23006 !! wikitext
23007 <span title="&amp;">foo</span>
23008 !! html
23009 <p><span title="&amp;">foo</span>
23010 </p>
23011 !! end
23012
23013 !! test
23014 HTML tag with broken attribute value quoting
23015 !! wikitext
23016 <span title="Hello world>Foo</span>
23017 !! html/php
23018 <p><span>Foo</span>
23019 </p>
23020 !! html/parsoid
23021 <p><span title="Hello world">Foo</span>
23022 </p>
23023 !! end
23024
23025 !! test
23026 Parsoid-only: HTML tag with broken attribute value quoting
23027 !! options
23028 parsoid
23029 !! wikitext
23030 <span title="Hello world>Foo</span>
23031 !! html
23032 <p><span title="Hello world">Foo</span>
23033 </p>
23034 !! end
23035
23036 !! test
23037 Table with broken attribute value quoting
23038 !! wikitext
23039 {|
23040 | title="Hello world|Foo
23041 |}
23042 !! html/php
23043 <table>
23044 <tr>
23045 <td>Foo
23046 </td></tr></table>
23047
23048 !! html/parsoid
23049 <table>
23050 <tr>
23051 <td title="Hello world">Foo
23052 </td></tr></table>
23053
23054 !! end
23055
23056 !! test
23057 Table with broken attribute value quoting on consecutive lines
23058 !! wikitext
23059 {|
23060 | title="Hello world|Foo
23061 | style="color:red|Bar
23062 |}
23063 !! html/php
23064 <table>
23065 <tr>
23066 <td>Foo
23067 </td>
23068 <td>Bar
23069 </td></tr></table>
23070
23071 !! html/parsoid
23072 <table><tbody>
23073 <tr>
23074 <td title="Hello world">Foo
23075 </td><td style="color: red">Bar
23076 </td></tr></tbody></table>
23077
23078 !! end
23079
23080 !! test
23081 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23082 !! options
23083 parsoid
23084 !! wikitext
23085 {{}}
23086 !! html
23087 {{}}
23088 !! end
23089
23090 !! test
23091 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23092 !! options
23093 parsoid
23094 !! wikitext
23095 }}{{
23096 !! html
23097 }}{{
23098 !! end
23099
23100 !!test
23101 Accept empty td cell attribute
23102 !! wikitext
23103 {|
23104 | align="center" | foo || |
23105 |}
23106 !! html
23107 <table>
23108 <tr>
23109 <td align="center"> foo </td>
23110 <td>
23111 </td></tr></table>
23112
23113 !!end
23114
23115 !!test
23116 Non-empty attributes in th-cells
23117 !! wikitext
23118 {|
23119 ! Foo !! style="color: red" | Bar
23120 |}
23121 !! html
23122 <table>
23123 <tr>
23124 <th> Foo </th>
23125 <th style="color: red"> Bar
23126 </th></tr></table>
23127
23128 !!end
23129
23130 !!test
23131 Accept empty attributes in th-cells
23132 !! wikitext
23133 {|
23134 !| foo !!| bar
23135 |}
23136 !! html
23137 <table>
23138 <tr>
23139 <th> foo </th>
23140 <th> bar
23141 </th></tr></table>
23142
23143 !!end
23144
23145 !!test
23146 Empty table rows go away
23147 !! wikitext
23148 {|
23149 | Hello
23150 | there
23151 |- class="foo"
23152 |-
23153 |}
23154 !! html
23155 <table>
23156 <tr>
23157 <td> Hello
23158 </td>
23159 <td> there
23160 </td></tr>
23161
23162 </table>
23163
23164 !! end
23165
23166 ###
23167 ### Parsoid-centric tests for testing RTing of inter-element separators
23168 ### Edge cases not tested by existing parser tests and specific to
23169 ### Parsoid-specific serialization strategies.
23170 ###
23171
23172 !!test
23173 RT-ed inter-element separators should be valid separators
23174 !! wikitext
23175 {|
23176 |- [[foo]]
23177 |}
23178 !! html
23179 <table>
23180
23181 </table>
23182
23183 !!end
23184
23185 # Parsoid-only since PHP parser relies on Tidy for correct output
23186 !!test
23187 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23188 !!options
23189 parsoid
23190 !! wikitext
23191 {|
23192 |<small>foo
23193 bar
23194 |}
23195
23196 {|
23197 |<small>foo<small>
23198 |}
23199 !! html
23200 <table>
23201 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23202 <p>bar</p></small></td></tr>
23203 </tbody></table>
23204
23205 <table>
23206 <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>
23207 </tbody></table>
23208 !!end
23209
23210 # Note that the "style" attribute is really a template parameter here.
23211 # The = would have to be {{=}} if you wanted the literal.
23212 !!test
23213 Empty TD followed by TD with tpl-generated attribute
23214 !! wikitext
23215 {|
23216 |-
23217 |
23218 |{{echo|style='color:red'}}|foo
23219 |}
23220 !! html
23221 <table>
23222
23223 <tr>
23224 <td>
23225 </td>
23226 <td>foo
23227 </td></tr></table>
23228
23229 !!end
23230
23231 !!test
23232 Indented table with an empty td
23233 !! wikitext
23234 {|
23235 |-
23236 |
23237 |foo
23238 |}
23239 !! html
23240 <table>
23241
23242 <tr>
23243 <td>
23244 </td>
23245 <td>foo
23246 </td></tr></table>
23247
23248 !!end
23249
23250 ## We have some newline diffs RT-ing this edge case
23251 ## and it is not important enough -- we seem to be emitting
23252 ## at most 2 newlines after a </tr> and this is unrelated to
23253 ## the issue from T85627 that this is testing.
23254 !!test
23255 Indented table with blank lines in between (T85627)
23256 !! options
23257 parsoid=wt2html
23258 !! wikitext
23259 {|
23260 |foo
23261
23262
23263 |}
23264 !! html
23265 <table>
23266
23267 <tr>
23268 <td>foo
23269 </td></tr></table>
23270
23271 !!end
23272
23273 !!test
23274 Indented block & table
23275 !! wikitext
23276 <div>foo</div>
23277 {|
23278 |foo
23279 |}
23280 !! html/php
23281 <div>foo</div>
23282 <table>
23283 <tr>
23284 <td>foo
23285 </td></tr></table>
23286
23287 !! html/parsoid
23288 <div data-parsoid='{"stx":"html"}'>foo</div>
23289 <table><tbody>
23290 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23291 </tbody></table>
23292 !!end
23293
23294 !! test
23295 Indent and comment before table row
23296 !! wikitext
23297 {|
23298 <!--hi-->|-
23299 | there
23300 |}
23301 !! html/php
23302 <table>
23303
23304 <tr>
23305 <td> there
23306 </td></tr></table>
23307
23308 !! html/parsoid
23309 <table>
23310 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23311 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23312 </tbody></table>
23313 !! end
23314
23315 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23316 !!test
23317 Empty TR followed by a template-generated TR
23318 !!options
23319 parsoid
23320 !! wikitext
23321 {|
23322 |-
23323 {{echo|<tr><td>foo</td></tr>}}
23324 |}
23325 !! html
23326 <table>
23327 <tbody>
23328 <tr></tr>
23329 <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}}]}'>
23330 <td>foo</td></tr>
23331 </tbody></table>
23332 !!end
23333
23334 ## PHP and parsoid output differ for this, and since this is primarily
23335 ## for testing Parsoid's serializer, marking this Parsoid only
23336 !!test
23337 Empty TR followed by mixed-ws-comment line should RT correctly
23338 !!options
23339 parsoid
23340 !! wikitext
23341 {|
23342 |-
23343 <!--c-->
23344 |-
23345 <!--c--> <!--d-->
23346 |}
23347 !! html
23348 <table>
23349 <tbody>
23350 <tr></tr>
23351 <!--c-->
23352 <tr>
23353 <!--c--> </tr><!--d-->
23354 </tbody></table>
23355
23356 !!end
23357
23358 !!test
23359 Multi-line image caption generated by templates with/without trailing newlines
23360 !! wikitext
23361 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23362 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23363 !! html/parsoid
23364 <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>
23365 <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>
23366 !!end
23367
23368 !! test
23369 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23370 !! options
23371 parsoid=html2wt
23372 !! html/parsoid
23373 <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>
23374
23375 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23376 !! wikitext
23377 <includeonly>foo</includeonly>
23378 new para
23379
23380 [[Category:Foo]]
23381
23382 = new heading =
23383 !! end
23384
23385 ## PHP emits broken html for this, and since this is primarily
23386 ## a Parsoid serializer test, marking this Parsoid only
23387 !!test
23388 Improperly nested inline or quotes tags with whitespace in between
23389 !! wikitext
23390 <span> <s>x</span> </s>
23391 ''' ''x''' ''
23392 !! html/parsoid
23393 <p><span> <s>x</s></span><s> </s>
23394 <b> <i>x</i></b><i> </i>
23395 </p>
23396 !!end
23397
23398 !!test
23399 Encapsulate protected attributes from wt
23400 !! wikitext
23401 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23402 !! html/parsoid
23403 <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>
23404 </body>
23405 !!end
23406
23407 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23408 ## Having nested or stray pre tags results in the attempt to add duplicates,
23409 ## causing an assertion fail. This test tries to prevent that situation.
23410 !!test
23411 Ensure ParagraphWrapper can deal with stray closing pre tags
23412 !!options
23413 parsoid=wt2html
23414 !! wikitext
23415 plain text</pre>
23416 !! html/parsoid
23417 plain text
23418 !!end
23419
23420 !!test
23421 1. Ensure fostered text content is wrapped in element nodes
23422 !!options
23423 parsoid=wt2html
23424 !! wikitext
23425 <table>hi</table><table>ho</table>
23426 !! html/parsoid
23427 <p>hi</p>
23428 <table></table>
23429 <p>ho</p>
23430 <table></table>
23431 !!end
23432
23433 !!test
23434 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23435 !!options
23436 parsoid=wt2html,wt2wt
23437 !! wikitext
23438 <table>
23439 <tr> || ||
23440 <td> a
23441 </table>
23442 !! html/parsoid
23443 <p> || ||
23444 </p><table>
23445 <tbody><tr><td> a</td></tr>
23446 </tbody></table>
23447 !!end
23448
23449 !!test
23450 Encapsulation properly handles null DSR information from foster box
23451 !!options
23452 parsoid=wt2html,wt2wt
23453 !! wikitext
23454 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23455 !! html/parsoid
23456 <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>
23457 !!end
23458
23459 !!test
23460 1. Encapsulate foster-parented transclusion content
23461 !!options
23462 parsoid=wt2wt,wt2html
23463 !! wikitext
23464 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23465 !! html/parsoid
23466 <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>
23467 <tbody>
23468 <tr>
23469 <td>bar</td>
23470 </tr>
23471 </tbody>
23472 </table>
23473 !!end
23474
23475 !!test
23476 2. Encapsulate foster-parented transclusion content
23477 !!options
23478 parsoid=wt2wt,wt2html
23479 !! wikitext
23480 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23481 !! html/parsoid
23482 <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>
23483 <table>
23484 <tbody>
23485 <tr>
23486 <td>bar</td>
23487 </tr>
23488 </tbody>
23489 </table>
23490 !!end
23491
23492 !!test
23493 3. Encapsulate foster-parented transclusion content
23494 !!options
23495 parsoid=wt2wt,wt2html
23496 !! wikitext
23497 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23498 !! html/parsoid
23499 <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;]}">
23500 <p>foo</p>
23501 </div>
23502 <table>
23503 <tbody>
23504 <tr>
23505 <td>bar</td>
23506 </tr>
23507 </tbody>
23508 </table>
23509 !!end
23510
23511 !!test
23512 4. Encapsulate foster-parented transclusion content
23513 !!options
23514 parsoid=wt2wt,wt2html
23515 !! wikitext
23516 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23517 !! html/parsoid
23518 <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;]}">
23519 <p>foo</p>
23520 </div>
23521 <table>
23522 <tbody>
23523 <tr>
23524 <td>bar</td>
23525 </tr>
23526 </tbody>
23527 </table>
23528 !!end
23529
23530 !!test
23531 5. Encapsulate foster-parented transclusion content
23532 !!options
23533 parsoid=wt2wt,wt2html
23534 !! wikitext
23535 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23536 !! html/parsoid
23537 <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>
23538 <table>
23539 <tbody>
23540 <tr>
23541 <td>
23542 <div>
23543 <p>foo</p>
23544 </div>
23545 </td>
23546 </tr>
23547 </tbody>
23548 </table>
23549 !!end
23550
23551 !!test
23552 6. Encapsulate foster-parented transclusion content
23553 !!options
23554 parsoid=wt2wt,wt2html
23555 !! wikitext
23556 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23557 !! html/parsoid
23558 <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>
23559 <table>
23560 <tbody>
23561 <tr>
23562 <td>
23563 <div>
23564 <p>foo</p>
23565 </div>
23566 </td>
23567 </tr>
23568 </tbody>
23569 </table>
23570 <p>ok</p>
23571 !!end
23572
23573 !!test
23574 7. Encapsulate foster-parented transclusion content
23575 !!options
23576 parsoid=wt2wt,wt2html
23577 !! wikitext
23578 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23579 !! html/parsoid
23580 <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>
23581 <table>
23582 <tbody>
23583 <tr>
23584 <td>bar</td>
23585 </tr>
23586 </tbody>
23587 </table>
23588 !!end
23589
23590 # Note that the wt is broken on purpose: the = should be {{=}} if you
23591 # don't want it to be a template parameter key.
23592 !!test
23593 8. Encapsulate foster-parented transclusion content
23594 !!options
23595 parsoid=wt2wt,wt2html
23596 !! wikitext
23597 {{echo|a
23598 }}{|{{echo|style='color:red'}}
23599 |-
23600 |b
23601 |}
23602 !! html/parsoid
23603 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23604 <span> </span>
23605 <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>
23606 <table>
23607 <tbody>
23608 <tr>
23609 <td>b</td>
23610 </tr>
23611 </tbody>
23612 </table>
23613 !!end
23614
23615 !!test
23616 9. Encapsulate foster-parented transclusion content
23617 !!options
23618 parsoid=wt2wt,wt2html
23619 !! wikitext
23620 <table>{{echo|hi</table>hello}}
23621 !! html/parsoid
23622 <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>
23623 !!end
23624
23625 !!test
23626 Table in fosterable position
23627 !!options
23628 parsoid=wt2html,wt2wt
23629 !! wikitext
23630 {{OpenTable}}
23631 <div>
23632 {|
23633 |}
23634 </div>
23635 |}
23636 !! html/parsoid
23637 <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">
23638 </span>
23639 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23640
23641 <table>
23642 </table>
23643 !!end
23644
23645 # Parsoid only for bug 64747
23646 !! test
23647 Properly encapsulate empty-content transclusions in fosterable positions
23648 !! wikitext
23649 <table>
23650 {{#if:|
23651 <td>foo</td>
23652 }}
23653 </table>
23654 !! html/parsoid
23655 <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":["","","",""]}]]}'>
23656
23657 </table>
23658 !! end
23659
23660 !!test
23661 Support <object> element with .data attribute
23662 !!options
23663 parsoid=html2wt
23664 !! html/parsoid
23665 <object data="test.swf"></object>
23666 !! wikitext
23667 <object data="test.swf"></object>
23668 !!end
23669
23670 !! test
23671 Don't block XML namespace declaration
23672 !! wikitext
23673 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23674 !! html/php
23675 <p><span>MediaWiki</span>
23676 </p>
23677 !! html/parsoid
23678 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23679 !! end
23680
23681 # -----------------------------------------------------------------
23682 # The following section of tests are primarily to spec requirements
23683 # around serialization of new/edited content.
23684 #
23685 # All these tests are marked Parsoid html2wt and html2html only
23686 # ----------------------------------------------------------------
23687
23688 # 'mi' is a localinterwiki prefix as well as a language
23689 !! test
23690 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23691 !! options
23692 parsoid=html2wt
23693 !! html
23694 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23695 !! wikitext
23696 [[Foo]]
23697 !! end
23698
23699 # See T93839
23700 !! test
23701 New wikilinks should be serialized properly
23702 !! options
23703 parsoid=html2wt
23704 !! html
23705 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23706 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23707 !! wikitext
23708 [[Foo]]
23709 [[Foo]]
23710 !! end
23711
23712 !! test
23713 New wiki links (href variations)
23714 !! options
23715 parsoid=html2wt
23716 !! html
23717 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23718 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23719 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23720 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23721 !! wikitext
23722 [[Foo_bar]]
23723 [[Foo_bar]]
23724 [[Foo_bar]]
23725 [[Toxine bactérienne]]
23726 !! end
23727
23728 !! test
23729 New wiki links (content string variations)
23730 !! options
23731 parsoid=html2wt
23732 !! html
23733 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23734 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23735 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23736 !! wikitext
23737 [[Foo_bar]]
23738 [[Foo bar]]
23739 [[Foo_bar|./Foo_bar]]
23740 !! end
23741
23742 !! test
23743 New category links (href variations)
23744 !! options
23745 parsoid=html2wt
23746 !! html
23747 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23748 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23749 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23750 !! wikitext
23751 [[Category:Toxine bactérienne]]
23752 [[Category:Toxine bactérienne]]
23753 [[Category:Toxine bactérienne]]
23754 !! end
23755
23756 !! test
23757 New sol transparent links don't need indent-pre nowiki protection
23758 !! options
23759 parsoid=html2wt
23760 language=de
23761 !! html
23762 <link rel="mw:PageProp/redirect" href="./Main_Page">
23763 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23764 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23765 !! wikitext
23766 #WEITERLEITUNG [[Main Page]]
23767 <!-- this is good --> [[Category:Good]]
23768 <!-- this is great --> [[Kategorie:Great]]
23769 !! end
23770
23771 !! test
23772 New interlanguage links (href variations)
23773 !! options
23774 parsoid=html2wt
23775 !! html
23776 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23777 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23778 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23779 !! wikitext
23780 [[es:Toxine bactérienne]]
23781 [[es:Toxine_bactérienne]]
23782 [[es:Toxine_bactérienne]]
23783 !! end
23784
23785 !! test
23786 Image: Modifying size of an image (1)
23787 !! options
23788 parsoid={
23789 "modes": ["wt2wt"],
23790 "changes": [
23791 ["img[height]", "attr", "height", "22"],
23792 ["img[width]", "attr", "width", "200"]
23793 ]
23794 }
23795 !! wikitext
23796 [[Image:Foobar.jpg|230x230px]]
23797 !! wikitext/edited
23798 [[Image:Foobar.jpg|200x200px]]
23799 !!end
23800
23801 !! test
23802 Image: Modifying size of an image (2)
23803 !! options
23804 parsoid={
23805 "modes": ["wt2wt"],
23806 "changes": [
23807 ["img[height]", "attr", "height", "100"],
23808 ["img[width]", "attr", "width", "500"]
23809 ]
23810 }
23811 !! wikitext
23812 [[Image:Foobar.jpg|230x230px]]
23813 !! wikitext/edited
23814 [[Image:Foobar.jpg|500x500px]]
23815 !!end
23816
23817 # Change in size is ignored so long as class='mw-default-size'
23818 !! test
23819 Image: Modifying size of an image (3)
23820 !! options
23821 parsoid={
23822 "modes": ["wt2wt"],
23823 "changes": [
23824 ["figure[class]", "removeClass", "mw-default-size"],
23825 ["figure img", "attr", "height", "19"],
23826 ["figure img", "attr", "width", "170"]
23827 ]
23828 }
23829 !! wikitext
23830 [[Image:Foobar.jpg|thumb]]
23831 !! wikitext/edited
23832 [[Image:Foobar.jpg|thumb|170x170px]]
23833 !!end
23834
23835 !! test
23836 Image: Modifying alignment of an image (bug 48665)
23837 !! options
23838 parsoid={
23839 "modes": ["wt2wt"],
23840 "changes": [
23841 ["figure[class]", "removeClass", "mw-halign-right"],
23842 ["figure[class]", "addClass", "mw-halign-left"]
23843 ]
23844 }
23845 !! wikitext
23846 [[Image:Foobar.jpg|thumb|caption|right]]
23847 !! wikitext/edited
23848 [[Image:Foobar.jpg|thumb|caption|left]]
23849 !! end
23850
23851 !! test
23852 Image: Modifying mw-default-size of an frameless image (bug 62805)
23853 !! options
23854 parsoid={
23855 "modes": ["wt2wt"],
23856 "changes": [
23857 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23858 ]
23859 }
23860 !! wikitext
23861 [[Image:Foobar.jpg|frameless|right]]
23862 !! wikitext/edited
23863 [[Image:Foobar.jpg|frameless|right|220x220px]]
23864 !! end
23865
23866 !! test
23867 Image: Modifying valign of an image (bug 49221)
23868 !! options
23869 parsoid={
23870 "modes": ["wt2wt"],
23871 "changes": [
23872 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23873 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23874 ]
23875 }
23876 !! wikitext
23877 [[File:Foobar.jpg|20px|middle]]
23878 !! wikitext/edited
23879 [[File:Foobar.jpg|20px|text-top]]
23880 !! end
23881
23882 !! test
23883 Image: Modifying alt attribute of an image (bug 56400)
23884 !! options
23885 parsoid={
23886 "modes": ["wt2wt"],
23887 "changes": [
23888 ["img[alt]", "attr", "alt", "some alternate edited text"]
23889 ]
23890 }
23891 !! wikitext
23892 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23893 !! wikitext/edited
23894 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23895 !!end
23896
23897 !! test
23898 Image: Modifying caption of an image
23899 !! options
23900 parsoid={
23901 "modes": ["wt2wt"],
23902 "changes": [
23903 ["figcaption", "text", "new caption"]
23904 ]
23905 }
23906 !! wikitext
23907 [[Image:Foobar.jpg|thumb|original caption]]
23908 !! wikitext/edited
23909 [[Image:Foobar.jpg|thumb|new caption]]
23910 !!end
23911
23912 !! test
23913 Image: empty alt attribute (bug 48924)
23914 !! options
23915 parsoid
23916 !! wikitext
23917 [[File:Foobar.jpg|thumb|alt=|bar]]
23918 !! html
23919 <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>
23920 !! end
23921
23922 #!! test
23923 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23924 #!! options
23925 #parsoid=html2wt
23926 #language=ar
23927 #!! html
23928 #<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>
23929 #!! wikitext
23930 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23931 #!! end
23932
23933 !! test
23934 Image: Block level image should have \n before and after
23935 !! wikitext
23936 123
23937 [[File:Foobar.jpg|right|thumb|150x150px]]
23938 456
23939 !! html/parsoid
23940 <p>123</p>
23941 <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>
23942 <p>456</p>
23943 !!end
23944
23945 !! test
23946 Image: New block level image should have \n before and after (existing content)
23947 !! wikitext
23948 123
23949 [[File:Foobar.jpg|right|thumb|150x150px]]
23950 456
23951 !! html/parsoid
23952 <p>123</p>
23953 <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>
23954 <p>456</p>
23955 !!end
23956
23957 !! test
23958 Image: upright option (parsoid)
23959 !! wikitext
23960 [[File:Foobar.jpg|thumb|upright|caption]]
23961 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23962 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23963 !! html/parsoid
23964 <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>
23965 <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>
23966 <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>
23967 !!end
23968
23969 !! test
23970 Image: upright option is ignored on inline and frame images (parsoid)
23971 !! wikitext
23972 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23973 !! html/parsoid
23974 <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>
23975 !!end
23976
23977 !! test
23978 Image: from basic HTML (1)
23979 !! options
23980 parsoid=html2wt
23981 !! html/parsoid
23982 <span typeof="mw:Image">
23983 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23984 </span>
23985 !! wikitext
23986 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23987 !! end
23988
23989 !! test
23990 Image: from basic HTML (2)
23991 !! options
23992 parsoid=html2wt
23993 !! html/parsoid
23994 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23995 !! wikitext
23996 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23997 !! end
23998
23999 !! test
24000 Image: from basic HTML (3)
24001 !! options
24002 parsoid=html2wt
24003 !! html/parsoid
24004 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24005 !! wikitext
24006 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24007 !! end
24008
24009 !! test
24010 Image: from basic HTML (4)
24011 !! options
24012 parsoid=html2wt
24013 !! html/parsoid
24014 <img src="./File:Foobar.jpg">
24015 !! wikitext
24016 [[File:Foobar.jpg|link=]]
24017 !! end
24018
24019 !! test
24020 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24021 !! options
24022 parsoid=html2wt
24023 !! html
24024 <ul>
24025 <li><p>foo</p></li>
24026 </ul>
24027 !! wikitext
24028 * foo
24029 !! end
24030
24031 !! test
24032 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24033 !! options
24034 parsoid=html2wt
24035 !! html
24036 <ul> <li>foo</li></ul>
24037 !! wikitext
24038 * foo
24039 !! end
24040
24041 !! test
24042 Don't strip leading whitespace when handling indent-pre suppressing tags
24043 !! options
24044 parsoid=html2wt
24045 !! html
24046 <table>
24047 <tr><td> indented row</td></tr>
24048 </table>
24049 <blockquote><p>
24050 <b>This is very bold of you!</b>
24051 </p>
24052 <table><tr><td>
24053 indented cell (no pre-wrapping!)
24054 </td></tr></table>
24055 </blockquote>
24056 <p>foo</p>
24057 <div>bar</div>
24058 !! wikitext
24059 {|
24060 | indented row
24061 |}
24062 <blockquote>
24063 '''This is very bold of you!'''
24064
24065 {|
24066 |
24067 indented cell (no pre-wrapping!)
24068 |}
24069 </blockquote>
24070 foo
24071 <div>bar</div>
24072 !! end
24073
24074 !! test
24075 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24076 !! options
24077 parsoid=html2wt
24078 !! wikitext
24079 foo
24080 <nowiki> </nowiki><span>bar</span>
24081
24082 <span>foo2
24083 <nowiki> </nowiki></span>bar2
24084
24085 <div>foo</div>
24086 <nowiki> </nowiki><span>bar</span>
24087
24088 <div>
24089 <nowiki> </nowiki><span>foo</span>
24090 </div>
24091 !! html
24092 <p>foo</p>
24093 <span>bar</span>
24094
24095 <span>foo2
24096 </span>bar2
24097
24098 <div>foo</div>
24099 <span>bar</span>
24100
24101 <div>
24102 <span>foo</span>
24103 </div>
24104 !! end
24105
24106 !! test
24107 Lists: Dont insert newlines in a serialized list item.
24108 !! options
24109 parsoid=html2wt
24110 !! html
24111 <ul><li>a<br>b</li><li>c</li></ul>
24112 !! wikitext
24113 * a<br>b
24114 * c
24115 !! end
24116
24117 !! test
24118 Headings: Force sol-transparent links and behavior switches to serialize before/after
24119 !! options
24120 parsoid=html2wt
24121 !! html
24122 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24123 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24124
24125 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24126 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24127
24128 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24129
24130 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24131 !! wikitext
24132 == hello there ==
24133 [[Category:A1]]
24134 [[Category:A2]]
24135
24136 == hi pal ==
24137
24138 <!--foo--> [[Category:A3]]
24139
24140 == how goes it ==
24141
24142 == it goes well ==
24143 [[Category:A4]] <!--bar-->
24144
24145 ==howdy [[Category:A5]] ==
24146
24147 __TOC__
24148
24149 == ok ==
24150 !! end
24151
24152 !! test
24153 Headings: Don't hoist metas that come from templates
24154 !! options
24155 parsoid=html2wt
24156 !! html
24157 <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>
24158 !! wikitext
24159 == {{echo|foo [[Category:Foo]]}} ==
24160 !! end
24161
24162 !! test
24163 Headings: Category in ref isn't hoisted
24164 !! options
24165 parsoid=html2wt
24166 !! html
24167 <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>
24168
24169 <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>
24170 !! wikitext
24171 == foo <ref>bar
24172 [[Category:Baz]] </ref> ==
24173
24174 <references />
24175 !! end
24176
24177 !! test
24178 Parsoid: Serialize positional parameters with = in them as named parameter
24179 !! options
24180 parsoid=html2wt
24181 !! html
24182 <p about="#mwt1" typeof="mw:Transclusion"
24183 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24184
24185 <p about="#mwt1" typeof="mw:Transclusion"
24186 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24187
24188 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24189 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24190 <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>
24191 !! wikitext
24192 {{echo|1 = f=oo}}
24193
24194 {{echo|1 = f=oo|2 = bar}}
24195
24196 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24197 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24198 {{echo|<nowiki>f=oo</nowiki>|bar}}
24199 !! end
24200
24201 !! test
24202 Parsoid: Serialize positional parameters with = in extlink as named parameter
24203 !! options
24204 parsoid=html2wt
24205 !! html
24206 <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>
24207 !! wikitext
24208 {{echo|1 = http://stuff?is=ok}}
24209 !! end
24210
24211 !! test
24212 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24213 !! options
24214 parsoid=html2wt
24215 !! html
24216 <div>a<p>b</p></div>
24217 <div>a
24218 <p>b</p></div>
24219 <div>
24220 a
24221 <p>b</p></div>
24222 !! wikitext
24223 <div>a
24224 b
24225 </div>
24226 <div>a
24227 b
24228 </div>
24229 <div>
24230 a
24231
24232 b
24233 </div>
24234 !! end
24235
24236 !! test
24237 Substrings resembling wikitext in hrefs should not get nowiki escapes
24238 !! options
24239 parsoid=html2wt
24240 !! html
24241 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24242 !! wikitext
24243 [[Foo''bar''baz]]
24244 !! end
24245
24246 !! test
24247 Enforce single-line context in the serializer
24248 !! options
24249 parsoid=html2wt
24250 !! html
24251 <h2>testing
24252 123</h2>
24253
24254 <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">
24255 </span><span about="#mwt1">you</span> </h2>
24256
24257 <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>
24258
24259 <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
24260 there</span></li></ol>
24261
24262 <ul><li>asd
24263 sdf</li></ul>
24264
24265 <ul><li>foo
24266 bar
24267 baz</li>
24268 <li>foo <b>bar</b>
24269 baz</li></ul>
24270 !! wikitext
24271 == testing 123 ==
24272
24273 == hi {{bogus|there
24274 you}} ==
24275
24276 == foo <ref>hello
24277 there</ref> ==
24278
24279 <references />
24280
24281 * asd sdf
24282
24283 * foo bar baz
24284 * foo '''bar''' baz
24285 !! end
24286
24287 !! test
24288 Serialize new placeholder space without spans
24289 !! options
24290 parsoid=html2wt
24291 !! html
24292 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24293
24294 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24295
24296 <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>
24297 !! wikitext
24298 foo : bar
24299
24300 foo : bar
24301
24302 <ref>foo : bar</ref>ok
24303 !! end
24304
24305
24306 #-----------------------
24307 # Tag minimization tests
24308 #-----------------------
24309
24310 !! test
24311 1. I/B quote minimization: wikitext-only tags should be combined
24312 !! options
24313 parsoid=html2wt
24314 !! html
24315 <p><i>A</i><i>B</i></p>
24316 <p><b>A</b><b>B</b></p>
24317 <p><i>A</i><b><i>B</i></b></p>
24318 <p><b>A</b><i><b>B</b></i></p>
24319 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24320 <p><i><b>A</b></i><i><b>B</b></i></p>
24321 <p><i><b>A</b></i><b><i>B</i></b></p>
24322 <p><b><i>A</i></b><i><b>B</b></i></p>
24323 !! wikitext
24324 ''AB''
24325
24326 '''AB'''
24327
24328 ''A'''B'''''
24329
24330 '''A''B'''''
24331
24332 '''A''BC''D'''
24333
24334 '''''AB'''''
24335
24336 '''''AB'''''
24337
24338 '''''AB'''''
24339 !! end
24340
24341 !! test
24342 2. I/B quote minimization: wikitext and html tags should not be combined
24343 !! options
24344 parsoid=html2wt
24345 !! html
24346 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24347 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24348 !! wikitext
24349 ''A''<i>B</i>
24350
24351 ''A''<nowiki/>'''<i>B</i>'''
24352 !! end
24353
24354 !! test
24355 3. I/B quote minimization: templated content stops minimization
24356 !! options
24357 parsoid=html2wt
24358 !! html
24359 <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>
24360 <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>
24361 !! wikitext
24362 ''A''{{echo|''B''}}
24363
24364 ''A''{{echo|'''''B'''''}}
24365 !! end
24366
24367 !! test
24368 4. I/B quote minimization: new content should be mimimized with adjacent old content
24369 !! options
24370 parsoid=html2wt
24371 !! html
24372 <p><i>A</i><i>B</i></p>
24373 <p><b>A</b><b>B</b></p>
24374 <p><i>A</i><b><i>B</i></b></p>
24375 !! wikitext
24376 ''AB''
24377
24378 '''AB'''
24379
24380 ''A'''B'''''
24381 !! end
24382
24383 !! test
24384 5a. Merge adjacent quote nodes if they've been edited
24385 !! options
24386 parsoid={
24387 "modes": ["wt2wt", "selser"],
24388 "changes": [
24389 ["p", "contents", "remove", ":contains('b')"]
24390 ]
24391 }
24392 !! wikitext
24393 ''a''b''c''
24394 !! wikitext/edited
24395 ''ac''
24396 !! end
24397
24398 !! test
24399 5b. Merge adjacent quote nodes if they've been edited
24400 !! options
24401 parsoid={
24402 "modes": ["wt2wt", "selser"],
24403 "changes": [
24404 ["#x", "remove"]
24405 ]
24406 }
24407 !! wikitext
24408 ''a''<span id="x">b</span>''c''
24409 !! wikitext/edited
24410 ''ac''
24411 !! end
24412
24413 !! test
24414 1. Merge adjacent link nodes as long as at least one element is new
24415 !! options
24416 parsoid={
24417 "modes": ["html2wt"],
24418 "scrubWikitext": true
24419 }
24420 !! html
24421 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24422 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24423 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24424 !! wikitext
24425 [[Football]]
24426 [[Football]]
24427 [[Football|Foot]][[Football|ball]]
24428 !! end
24429
24430 !! test
24431 2. Merge adjacent link nodes and enable additional normalizations
24432 !! options
24433 parsoid={
24434 "modes": ["html2wt"],
24435 "scrubWikitext": true
24436 }
24437 !! html
24438 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24439 !! wikitext
24440 [[Football|''Football'']]
24441 !! end
24442
24443 !! test
24444 3. Don't merge adjacent link nodes if scrubWikitext is false
24445 !! options
24446 parsoid={
24447 "modes": ["html2wt"],
24448 "scrubWikitext": false
24449 }
24450 !! html
24451 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24452 !! wikitext
24453 [[Football|Foot]][[Football|ball]]
24454 !! end
24455
24456 #------------------------------
24457 # End of tag minimization tests
24458 #------------------------------
24459
24460 !!test
24461 Bug 54262: New entities
24462 !! options
24463 parsoid=html2wt
24464 !! wikitext
24465 &nbsp;
24466 !! html
24467 <span typeof="mw:Entity">&nbsp;</span>
24468 !! end
24469
24470 ## Note that there is no wikitext output for 'unknownproperty' ##
24471 ## Unknown magic words are silently dropped ##
24472
24473 !! test
24474 Magic words
24475 !! options
24476 parsoid=html2wt
24477 !! html/parsoid
24478 <meta property='mw:PageProp/toc' />
24479 <meta property='mw:PageProp/notoc' />
24480 <meta property='mw:PageProp/forcetoc' />
24481 <meta property='mw:PageProp/index' />
24482 <meta property='mw:PageProp/noindex' />
24483 <meta property='mw:PageProp/nogallery' />
24484 <meta property='mw:PageProp/noeditsection' />
24485 <meta property='mw:PageProp/notitleconvert' />
24486 <meta property='mw:PageProp/nocontentconvert' />
24487 <meta property='mw:PageProp/unknownproperty' />
24488 !! wikitext
24489 __TOC__
24490 __NOTOC__
24491 __FORCETOC__
24492 __INDEX__
24493 __NOINDEX__
24494 __NOGALLERY__
24495 __NOEDITSECTION__
24496 __NOTITLECONVERT__
24497 __NOCONTENTCONVERT__
24498 !! end
24499
24500 !! test
24501 Consecutive <pre>s should not get merged
24502 !! options
24503 parsoid=html2wt,html2html
24504 !! html
24505 <pre>a</pre><pre>b</pre>
24506
24507 <pre>c
24508 </pre><pre>
24509 d</pre>
24510
24511 <pre>e
24512
24513 </pre><pre>
24514
24515 f</pre>
24516 !! wikitext
24517 a
24518
24519 b
24520
24521 c
24522
24523 d
24524
24525 e
24526
24527
24528
24529 f
24530 !! end
24531
24532 !! test
24533 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24534 !! options
24535 parsoid=html2wt
24536 !! html
24537 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24538 !! wikitext
24539 [[Special:BookSources/1234567890|ISBN 1234567895]]
24540 !! end
24541
24542 !! test
24543 Edited RFC links not serializable as RFC links should serialize as extlinks
24544 !! options
24545 parsoid=html2wt
24546 !! html
24547 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24548 !! wikitext
24549 [//tools.ietf.org/html/rfc123 New RFC]
24550 !! end
24551
24552 !! test
24553 Edited PMID links not serializable as PMID links should serialize as extlinks
24554 !! options
24555 parsoid=html2wt
24556 !! html
24557 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24558 !! wikitext
24559 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24560 !! end
24561
24562 !! test
24563 WTS of autolinks with trailing/surrounding context
24564 !! options
24565 parsoid=html2wt
24566 !! html/parsoid
24567 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24568 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24569 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24570 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24571 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24572 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24573 !! wikitext
24574 http://cscott.net<nowiki/>'''foo'''
24575
24576 http://cscott.net<b>foo</b>
24577
24578 '''http://cscott.net<nowiki/>'''
24579
24580 '''http://cscott.net '''
24581
24582 '''http://cscott.net<nowiki/>x'''
24583
24584 http://cscott.net<nowiki/>x
24585 !! end
24586
24587 !! test
24588 WTS of autolinks with nowikis (round-trip)
24589 !! wikitext
24590 x<nowiki/>http://cscott.net<nowiki/>x
24591 !! html/parsoid
24592 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24593 !! end
24594
24595 # this is the "easy" test because it leaves in place all the
24596 # data-parsoid information indicating this is an autolink
24597 !! test
24598 WTS of autolinks with escapes (editing)
24599 !! options
24600 parsoid={
24601 "modes": ["wt2wt"],
24602 "changes": [
24603 [ "meta", "remove" ]
24604 ]
24605 }
24606 !! wikitext
24607 x<nowiki/>http://cscott.net<nowiki/>x
24608 !! wikitext/edited
24609 x<nowiki/>http://cscott.net<nowiki/>x
24610 !! end
24611
24612 !! test
24613 Edited Redirect link should emit a non-piped wikitext link
24614 !! options
24615 parsoid=html2wt
24616 !! html
24617 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
24618 !! wikitext
24619 #REDIRECT [[Bar]]
24620 !! end
24621
24622 !! test
24623 T75121: Infer extension name from typeOf if data-mw is not present
24624 !! options
24625 parsoid=html2wt
24626 !! html
24627 <div typeOf="mw:Extension/foo"></div>
24628 !! wikitext
24629 <foo />
24630 !! end
24631
24632 # Note that the <p> wrapping isn't present in PHP parser output
24633 # The important thing for this test is that P-wrapping doesn't
24634 # interfere with the <nowiki> protection for leading - in <td>
24635 # (which isn't necessary for <th>).
24636 !! test
24637 T88318: p-wrapped dash in table.
24638 !! options
24639 parsoid=html2wt,wt2wt
24640 !! html/parsoid
24641 <table><tbody>
24642 <tr><th><p>-</p></th><th><p>- </p></th></tr>
24643 <tr><td><p>-</p></td><td><p>- </p></td></tr>
24644 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
24645 </tbody></table>
24646 !! wikitext
24647 {|
24648 !-
24649 !-
24650 |-
24651 |<nowiki>-</nowiki>
24652 |<nowiki>- </nowiki>
24653 |-
24654 |<small>-</small>
24655 |<br>
24656 -
24657 |<br>
24658 -
24659 |}
24660 !! html/php+tidy
24661 <table>
24662 <tr>
24663 <th>-</th>
24664 <th>-</th>
24665 </tr>
24666 <tr>
24667 <td>-</td>
24668 <td>-</td>
24669 </tr>
24670 <tr>
24671 <td><small>-</small></td>
24672 <td><br />
24673 <p>-</p>
24674 </td>
24675 <td><br />
24676 <p>-</p>
24677 </td>
24678 </tr>
24679 </table>
24680 !! end
24681
24682 !! test
24683 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
24684 !! options
24685 parsoid=html2wt
24686 !! html
24687 <table id='mwAb'>
24688 <td id='mwAc'>foo</td>
24689 <td id='serialize-this'>bar</td>
24690 </table>
24691 !! wikitext
24692 {|
24693 |foo
24694 | id="serialize-this" |bar
24695 |}
24696 !! end
24697
24698 !! test
24699 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24700 !! options
24701 parsoid=html2wt
24702 !! html
24703 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24704 !! wikitext
24705 <div id="hello">ok</div>
24706 !! end
24707
24708 !! test
24709 WTS change modes
24710 !! options
24711 parsoid={
24712 "modes": ["wt2wt"],
24713 "changes": [
24714 [ "#xyz", "before", "<b>before</b> stuff " ],
24715 [ "#xyz", "after", " stuff <i>after</i>" ],
24716 [ "#xyz", "html", "x <b>y</b> z" ]
24717 ]
24718 }
24719 !! wikitext
24720 <span id="xyz">hello</span>
24721 !! wikitext/edited
24722 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24723 !! end
24724
24725 !! test
24726 Never serialize a-tag as html, regardless of what data-parsoid has to say
24727 !! options
24728 parsoid=html2wt
24729 !! html
24730 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24731 !! wikitext
24732 [[Foo]]
24733 !! end
24734
24735 ## SSS FIXME: This is broken output nevertheless.
24736 ## What might be a reasonable non-broken output for this?
24737 ## This is an edge case unlikely to be seen in production
24738 ## that I am not wasting more time on this right now.
24739 !! test
24740 Never serialize a-tag as html, no matter what attributes it has
24741 !! options
24742 parsoid=html2wt
24743 !! html
24744 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
24745 !! wikitext
24746 [http://boo.org http://boohoo.org]
24747 !! end
24748
24749 # --------------------------------------------
24750 # Tests spec'ing wikitext serialization norms |
24751 # --------------------------------------------
24752
24753 !! test
24754 Lists: Add space after bullets
24755 !! options
24756 parsoid=html2wt
24757 !! html
24758 <ul>
24759 <li>foo</li>
24760 <li> bar</li>
24761 <li><span> baz</span></li>
24762 </ul>
24763 !! wikitext
24764 * foo
24765 * bar
24766 * <span> baz</span>
24767 !! end
24768
24769 !! test
24770 Headings: Add space before/after == (T53744)
24771 !! options
24772 parsoid=html2wt
24773 !! html
24774 <h2>foo</h2>
24775 <h2> bar</h2>
24776 <h2>baz </h2>
24777 <h2><span> baz</span></h2>
24778
24779 <!-- Even after hoisted content -->
24780 <h2> <link href="Category:A2" rel="mw:PageProp/Category" />ok</h2>
24781 !! wikitext
24782 == foo ==
24783
24784 == bar ==
24785
24786 == baz ==
24787
24788 == <span> baz</span> ==
24789
24790 <!-- Even after hoisted content -->
24791 [[Category:A2]]
24792
24793 == ok ==
24794 !! end
24795
24796 !! test
24797 1. Headings: suppress newly created empty headings
24798 !! options
24799 parsoid={
24800 "modes": ["html2wt"],
24801 "scrubWikitext": true
24802 }
24803 !! html
24804 <h2></h2>
24805 !! wikitext
24806 !! end
24807
24808 !! test
24809 2. Headings: don't suppress empty headings if scrubWikitext is false
24810 !! options
24811 parsoid=html2wt
24812 !! html
24813 <h2></h2>
24814 !! wikitext
24815 ==<nowiki/>==
24816 !! end
24817
24818 !! test
24819 3. Headings: don't suppress empty headings for existing headings even if scrubWikitext is true
24820 !! options
24821 parsoid={
24822 "modes": ["html2wt"],
24823 "scrubWikitext": true
24824 }
24825 !! html
24826 <h2 data-parsoid='{}'></h2>
24827 !! wikitext
24828 ==<nowiki/>==
24829 !! end
24830
24831 !! test
24832 1. WT Quote Tags: suppress newly created empty style tags
24833 !! options
24834 parsoid={
24835 "modes": ["html2wt"],
24836 "scrubWikitext": true
24837 }
24838 !! html
24839 <i></i><b></b>
24840 !! wikitext
24841 !! end
24842
24843 !! test
24844 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
24845 !! options
24846 parsoid=html2wt
24847 !! html
24848 <i></i><b></b>
24849 !! wikitext
24850 ''<nowiki/>'''''<nowiki/>'''
24851 !! end
24852
24853 !! test
24854 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
24855 !! options
24856 parsoid={
24857 "modes": ["html2wt"],
24858 "scrubWikitext": true
24859 }
24860 !! html
24861 <p> hi</p>
24862 !! wikitext
24863 hi
24864 !! end
24865
24866 !! test
24867 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
24868 !! options
24869 parsoid=html2wt
24870 !! html
24871 <p> hi</p>
24872 !! wikitext
24873 <nowiki> </nowiki>hi
24874 !! end
24875
24876 # ---------------------------------------------------
24877 # End of tests spec'ing wikitext serialization norms |
24878 # ---------------------------------------------------
24879
24880 # -----------------------------------------------------------------
24881 # End of section for Parsoid-only html2wt tests for serialization
24882 # of new content
24883 # -----------------------------------------------------------------
24884
24885 # -----------------------------------------------------------------
24886 # The following section of tests are primarily to spec behavior of
24887 # the selective serializer. All these tests have manual selser
24888 # changes. The automated selser changes for all tests handle the
24889 # wide variation of changes, but these tests here capture specs
24890 # deterministically.
24891 # ----------------------------------------------------------------
24892
24893 ## T90517
24894 !! test
24895 Selser: New comments should not be lost
24896 !! options
24897 parsoid={
24898 "modes": ["selser"],
24899 "changes": [
24900 [ "#a", "after", "<!--c1-->" ],
24901 [ "#b", "before", "<!--c2-->" ]
24902 ]
24903 }
24904 !! wikitext
24905 <span id="a">a</span>
24906
24907 <span id="b">b</span>
24908 !! wikitext/edited
24909 <span id="a">a</span><!--c1-->
24910
24911 <!--c2--><span id="b">b</span>
24912 !! end
24913
24914 ## T89383
24915 !! test
24916 Selser: Check for validity of DSR before using it
24917 !! options
24918 parsoid={
24919 "modes": ["selser"],
24920 "changes": [
24921 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
24922 ]
24923 }
24924 !! wikitext
24925 <span id="a">a</span>
24926 !! wikitext/edited
24927 {{DISPLAYTITLE:foo}}
24928 <span id="a">a</span>
24929 !! end
24930
24931 !! test
24932 1. DOMDiff: Changes to <ref> content should be looked up using id
24933 !! options
24934 parsoid={
24935 "modes": ["selser"],
24936 "changes": [
24937 ["#X", "after", "bar"],
24938 ["#Y", "after", "baz"]
24939 ]
24940 }
24941 !! wikitext
24942 X <ref><span id="X">foo</span></ref>
24943 Y <ref name="a" />
24944 <references>
24945 <ref name="a"><span id="Y">foo</span></ref>
24946 </references>
24947 !! wikitext/edited
24948 X <ref><span id="X">foo</span>bar</ref>
24949 Y <ref name="a" />
24950 <references>
24951 <ref name="a"><span id="Y">foo</span>baz</ref>
24952 </references>
24953 !! end
24954
24955 !! test
24956 2. DOMDiff: Changes to <ref> content should be looked up using id
24957 !! options
24958 parsoid={
24959 "modes": ["selser"],
24960 "changes": [
24961 ["#Z", "after", "bar"]
24962 ]
24963 }
24964 !! wikitext
24965 A <ref>foo bar for a</ref>
24966 B <ref group="X" name="b" />
24967
24968 <references />
24969
24970 <references group="X">
24971 <ref name="b"><span id="Z">foo</span></ref>
24972 </references>
24973 !! wikitext/edited
24974 A <ref>foo bar for a</ref>
24975 B <ref group="X" name="b" />
24976
24977 <references />
24978
24979 <references group="X">
24980 <ref name="b"><span id="Z">foo</span>bar</ref>
24981 </references>
24982 !! end