Merge "Hygiene: Use strtr() instead of str_replace() for character swapping"
[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 # Bug 52473
3681 !! test
3682 Definition Lists: Hacky use to indent tables (WS-insensitive)
3683 !! options
3684 parsoid
3685 !! wikitext
3686 : {|
3687 |a
3688 |}
3689 !! html
3690 <dl>
3691 <dd> <table><tr><td>a</td></tr></table> </dd>
3692 </dl>
3693 !! end
3694 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3695 ## as an empty dt item. It also ignores all but the last ";" when followed
3696 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3697 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3698 ## ";"s.
3699 ##
3700 ## Ex: ";;t2 ::d2" is transformed into:
3701 ##
3702 ## <dl>
3703 ## <dt>t2 </dt>
3704 ## <dd>
3705 ## <dl>
3706 ## <dt></dt>
3707 ## <dd>d2</dd>
3708 ## </dl>
3709 ## </dd>
3710 ## </dl>
3711 ##
3712 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3713 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3714 ##
3715 ## <dl>
3716 ## <dt>
3717 ## <dl>
3718 ## <dt>t2 </dt>
3719 ## <dd>:d2</dd>
3720 ## </dl>
3721 ## </dt>
3722 ## </dl>
3723 ##
3724 ## All Parsoid only definition list tests have this difference.
3725 ##
3726 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3727 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3728
3729 !! test
3730 Table / list interaction: indented table with lists in table contents
3731 !! wikitext
3732 :{|
3733 |-
3734 | a
3735 * b
3736 |-
3737 | c
3738 * d
3739 |}
3740 !! html
3741 <dl><dd><table>
3742
3743 <tr>
3744 <td> a
3745 <ul><li> b</li></ul>
3746 </td></tr>
3747 <tr>
3748 <td> c
3749 <ul><li> d</li></ul>
3750 </td></tr></table></dd></dl>
3751
3752 !! end
3753
3754 !!test
3755 Table / list interaction: lists nested in tables nested in indented lists
3756 !! wikitext
3757 :{|
3758 |
3759 :a
3760 :b
3761 |
3762 *c
3763 *d
3764 |}
3765
3766 *e
3767 *f
3768 !! html
3769 <dl><dd><table>
3770 <tr>
3771 <td>
3772 <dl><dd>a</dd>
3773 <dd>b</dd></dl>
3774 </td>
3775 <td>
3776 <ul><li>c</li>
3777 <li>d</li></ul>
3778 </td></tr></table></dd></dl>
3779 <ul><li>e</li>
3780 <li>f</li></ul>
3781
3782 !!end
3783
3784 !! test
3785 Definition Lists: Nesting: Multi-level (Parsoid only)
3786 !! options
3787 parsoid
3788 !! wikitext
3789 ;t1 :d1
3790 ;;t2 ::d2
3791 ;;;t3 :::d3
3792 !! html
3793 <dl>
3794 <dt>t1 </dt>
3795 <dd>d1</dd>
3796 <dt>
3797 <dl>
3798 <dt>t2 </dt>
3799 <dd>:d2</dd>
3800 <dt>
3801 <dl>
3802 <dt>t3 </dt>
3803 <dd>::d3</dd>
3804 </dl>
3805 </dt>
3806 </dl>
3807 </dt>
3808 </dl>
3809
3810
3811 !! end
3812
3813
3814 !! test
3815 Definition Lists: Nesting: Test 2 (Parsoid only)
3816 !! options
3817 parsoid
3818 !! wikitext
3819 ;t1
3820 ::d2
3821 !! html
3822 <dl>
3823 <dt>t1</dt>
3824 <dd>
3825 <dl>
3826 <dd>d2</dd>
3827 </dl>
3828 </dd>
3829 </dl>
3830
3831 !! end
3832
3833
3834 !! test
3835 Definition Lists: Nesting: Test 3 (Parsoid only)
3836 !! options
3837 parsoid
3838 !! wikitext
3839 :;t1
3840 ::::d2
3841 !! html
3842 <dl>
3843 <dd>
3844 <dl>
3845 <dt>t1</dt>
3846 <dd>
3847 <dl>
3848 <dd>
3849 <dl>
3850 <dd>d2</dd>
3851 </dl>
3852 </dd>
3853 </dl>
3854 </dd>
3855 </dl>
3856 </dd>
3857 </dl>
3858
3859 !! end
3860
3861
3862 !! test
3863 Definition Lists: Nesting: Test 4
3864 !! wikitext
3865 ::;t3
3866 :::d3
3867 !! html
3868 <dl><dd><dl><dd><dl><dt>t3</dt>
3869 <dd>d3</dd></dl></dd></dl></dd></dl>
3870
3871 !! end
3872
3873
3874 ## The Parsoid team believes the following three test exposes a
3875 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3876 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3877 ## It also exposes a "misfeature" in tidy, which doesn't like
3878 ## <dl> tags with a single <dt> child; it converts the <dt> into
3879 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3880 !! test
3881 Definition Lists: Mixed Lists: Test 1
3882 !! wikitext
3883 :;* foo
3884 ::* bar
3885 :; baz
3886 !! html/php
3887 <dl><dd><dl><dt><ul><li> foo</li>
3888 <li> bar</li></ul></dt></dl>
3889 <dl><dt> baz</dt></dl></dd></dl>
3890
3891 !! html/php+tidy
3892 <dl>
3893 <dd>
3894 <dl>
3895 <dd>
3896 <ul>
3897 <li>foo</li>
3898 <li>bar</li>
3899 </ul>
3900 </dd>
3901 </dl>
3902 <dl>
3903 <dt>baz</dt>
3904 </dl>
3905 </dd>
3906 </dl>
3907 !! html/parsoid
3908 <dl>
3909 <dd><dl>
3910 <dt><ul>
3911 <li> foo
3912 </li>
3913 </ul></dt>
3914 <dd><ul>
3915 <li> bar
3916 </li>
3917 </ul></dd>
3918 <dt> baz</dt>
3919 </dl></dd>
3920 </dl>
3921 !! end
3922
3923 !! test
3924 Definition Lists: Mixed Lists: Test 2
3925 !! wikitext
3926 *: d1
3927 *: d2
3928 !! html
3929 <ul><li><dl><dd> d1</dd>
3930 <dd> d2</dd></dl></li></ul>
3931
3932 !! end
3933
3934
3935 !! test
3936 Definition Lists: Mixed Lists: Test 3
3937 !! wikitext
3938 *::: d1
3939 *::: d2
3940 !! html
3941 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3942 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3943
3944 !! end
3945
3946
3947 !! test
3948 Definition Lists: Mixed Lists: Test 4
3949 !! wikitext
3950 *;d1 :d2
3951 *;d3 :d4
3952 !! html
3953 <ul><li><dl><dt>d1&#160;</dt>
3954 <dd>d2</dd>
3955 <dt>d3&#160;</dt>
3956 <dd>d4</dd></dl></li></ul>
3957
3958 !! end
3959
3960
3961 !! test
3962 Definition Lists: Mixed Lists: Test 5
3963 !! wikitext
3964 *:d1
3965 *:: d2
3966 !! html
3967 <ul><li><dl><dd>d1
3968 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3969
3970 !! end
3971
3972
3973 !! test
3974 Definition Lists: Mixed Lists: Test 6
3975 !! wikitext
3976 #*:d1
3977 #*::: d3
3978 !! html
3979 <ol><li><ul><li><dl><dd>d1
3980 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3981
3982 !! end
3983
3984
3985 !! test
3986 Definition Lists: Mixed Lists: Test 7
3987 !! wikitext
3988 :* d1
3989 :* d2
3990 !! html
3991 <dl><dd><ul><li> d1</li>
3992 <li> d2</li></ul></dd></dl>
3993
3994 !! end
3995
3996
3997 !! test
3998 Definition Lists: Mixed Lists: Test 8
3999 !! wikitext
4000 :* d1
4001 ::* d2
4002 !! html
4003 <dl><dd><ul><li> d1</li></ul>
4004 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4005
4006 !! end
4007
4008
4009 !! test
4010 Definition Lists: Mixed Lists: Test 9
4011 !! wikitext
4012 *;foo :bar
4013 !! html
4014 <ul><li><dl><dt>foo&#160;</dt>
4015 <dd>bar</dd></dl></li></ul>
4016
4017 !! end
4018
4019
4020 !! test
4021 Definition Lists: Mixed Lists: Test 10
4022 !! wikitext
4023 *#;foo :bar
4024 !! html
4025 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4026 <dd>bar</dd></dl></li></ol></li></ul>
4027
4028 !! end
4029
4030 # The Parsoid team disagrees with the PHP parser's seemingly-random
4031 # rules regarding dd/dt on the next two tests. Parsoid is more
4032 # consistent, and recognizes the shared nesting and keeps the
4033 # still-open tags around until the nesting is complete.
4034 # (And tidy again converts <dt> to <dd> before 'bar'.)
4035
4036 !! test
4037 Definition Lists: Mixed Lists: Test 11
4038 !! wikitext
4039 *#*#;*;;foo :bar
4040 *#*#;boo :baz
4041 !! html/php
4042 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4043 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4044 <dl><dt>boo&#160;</dt>
4045 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4046
4047 !! html/php+tidy
4048 <ul>
4049 <li>
4050 <ol>
4051 <li>
4052 <ul>
4053 <li>
4054 <ol>
4055 <li>
4056 <dl>
4057 <dt>foo&#160;</dt>
4058 <dd>
4059 <ul>
4060 <li>
4061 <dl>
4062 <dd>
4063 <dl>
4064 <dt>bar</dt>
4065 </dl>
4066 </dd>
4067 </dl>
4068 </li>
4069 </ul>
4070 </dd>
4071 </dl>
4072 <dl>
4073 <dt>boo&#160;</dt>
4074 <dd>baz</dd>
4075 </dl>
4076 </li>
4077 </ol>
4078 </li>
4079 </ul>
4080 </li>
4081 </ol>
4082 </li>
4083 </ul>
4084 !! html/parsoid
4085 <ul>
4086 <li>
4087 <ol>
4088 <li>
4089 <ul>
4090 <li>
4091 <ol>
4092 <li>
4093 <dl>
4094 <dt>
4095 <ul>
4096 <li>
4097 <dl>
4098 <dt>
4099 <dl>
4100 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4101 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4102 </dl></dt>
4103 </dl></li>
4104 </ul></dt>
4105 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4106 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4107 </dl></li>
4108 </ol></li>
4109 </ul></li>
4110 </ol></li>
4111 </ul>
4112 !! end
4113
4114
4115 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4116 # From whitelist:
4117 # * The test is wrong, there are two colons where there should be :;
4118 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4119 !! test
4120 Definition Lists: Weird Ones: Test 1
4121 !! wikitext
4122 *#;*::;; foo : bar (who uses this?)
4123 !! html/php
4124 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4125 <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>
4126
4127 !! html/php+tidy
4128 <ul>
4129 <li>
4130 <ol>
4131 <li>
4132 <dl>
4133 <dt>foo&#160;</dt>
4134 <dd>
4135 <ul>
4136 <li>
4137 <dl>
4138 <dd>
4139 <dl>
4140 <dd>
4141 <dl>
4142 <dd>
4143 <dl>
4144 <dt>bar (who uses this?)</dt>
4145 </dl>
4146 </dd>
4147 </dl>
4148 </dd>
4149 </dl>
4150 </dd>
4151 </dl>
4152 </li>
4153 </ul>
4154 </dd>
4155 </dl>
4156 </li>
4157 </ol>
4158 </li>
4159 </ul>
4160 !! html/parsoid
4161 <ul>
4162 <li>
4163 <ol>
4164 <li>
4165 <dl>
4166 <dt>
4167 <ul>
4168 <li>
4169 <dl>
4170 <dd>
4171 <dl>
4172 <dd>
4173 <dl>
4174 <dt>
4175 <dl>
4176 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4177 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4178 </dl></dt>
4179 </dl></dd>
4180 </dl></dd>
4181 </dl></li>
4182 </ul></dt>
4183 </dl></li>
4184 </ol></li>
4185 </ul>
4186 !! end
4187
4188 !! test
4189 Definition Lists: colons occurring in tags
4190 !! wikitext
4191 ;a:b
4192 ;'''a:b'''
4193 ;<i>a:b</i>
4194 ;<span>a:b</span>
4195 ;<div>a:b</div>
4196 ;<div>a
4197 :b</div>
4198 ;{{echo|a:b}}
4199 ;{{echo|''a:b''}}
4200 ;;;''a:b''
4201 !! html+tidy
4202 <dl>
4203 <dt>a</dt>
4204 <dd>b</dd>
4205 <dt><b>a:b</b></dt>
4206 <dt><i>a:b</i></dt>
4207 <dt><span>a:b</span></dt>
4208 <dd>
4209 <div>a:b</div>
4210 </dd>
4211 <dd>
4212 <div>a
4213 <dl>
4214 <dd>b</dd>
4215 </dl>
4216 </div>
4217 </dd>
4218 <dt>a</dt>
4219 <dd>b</dd>
4220 <dt><i>a:b</i></dt>
4221 </dl>
4222 <dl>
4223 <dd>
4224 <dl>
4225 <dd>
4226 <dl>
4227 <dt><i>a:b</i></dt>
4228 </dl>
4229 </dd>
4230 </dl>
4231 </dd>
4232 </dl>
4233 !! end
4234
4235 !! test
4236 Definition Lists: colons and tables 1
4237 !! wikitext
4238 :{|
4239 | x
4240 |}
4241 :{|
4242 | y
4243 |}
4244 !! html
4245 <dl><dd><table>
4246 <tr>
4247 <td> x
4248 </td></tr></table></dd></dl>
4249 <dl><dd><table>
4250 <tr>
4251 <td> y
4252 </td></tr></table></dd></dl>
4253
4254 !! end
4255
4256 # Parsoid's output (as documented below) differs from php's in this case.
4257 # This is probably a bug. If we fixup parsoid to match php's output, the
4258 # above test should pass and the below test case can be removed. It is
4259 # unclear which output is more desirable.
4260
4261 !! test
4262 Definition Lists: colons and tables 2
4263 !! wikitext
4264 :{|
4265 | x
4266 |}
4267 :{|
4268 | y
4269 |}
4270 !! html/parsoid
4271 <dl><dd><table>
4272 <tr>
4273 <td> x
4274 </td></tr></table></dd>
4275 <dd><table>
4276 <tr>
4277 <td> y
4278 </td></tr></table></dd></dl>
4279 !! end
4280
4281 !! test
4282 Definition Lists: template interaction
4283 !! wikitext
4284 ::{{definition_list}}
4285
4286 :one
4287 ::{{definition_list}}
4288 :::two
4289 :::three
4290 ::four
4291 !! html/parsoid
4292 <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">
4293 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4294
4295 <dl><dd data-parsoid='{}'>one
4296 <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">
4297 </span><dd about="#mwt2">two
4298 <dl><dd>two</dd>
4299 <dd>three</dd></dl></dd>
4300 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4301 !! end
4302
4303
4304 ###
4305 ### External links
4306 ###
4307 !! test
4308 External links: non-bracketed
4309 !! wikitext
4310 Non-bracketed: http://example.com
4311 !! html
4312 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4313 </p>
4314 !! end
4315
4316 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4317 !! test
4318 External links: numbered
4319 !! wikitext
4320 Numbered: [http://example.com]
4321 Numbered: [http://example.net]
4322 Numbered: [http://example.com]
4323 !! html/php
4324 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4325 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4326 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4327 </p>
4328 !! html/parsoid
4329 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4330 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4331 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4332 !!end
4333
4334 !! test
4335 External links: specified text
4336 !! wikitext
4337 Specified text: [http://example.com link]
4338 !! html
4339 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4340 </p>
4341 !!end
4342
4343 !! test
4344 External links: trail
4345 !! wikitext
4346 Linktrails should not work for external links: [http://example.com link]s
4347 !! html
4348 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4349 </p>
4350 !! end
4351
4352 !! test
4353 External links: dollar sign in URL
4354 !! wikitext
4355 http://example.com/1$2345
4356 !! html
4357 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4358 </p>
4359 !! end
4360
4361 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4362 !! test
4363 External links: dollar sign in URL (autonumber)
4364 !! wikitext
4365 [http://example.com/1$2345]
4366 !! html/php
4367 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4368 </p>
4369 !! html/parsoid
4370 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4371 !!end
4372
4373 !! test
4374 External links: open square bracket forbidden in URL (bug 4377)
4375 !! options
4376 parsoid=wt2html,wt2wt,html2html
4377 !! wikitext
4378 http://example.com/1[2345
4379 !! html/php
4380 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4381 </p>
4382 !! html/parsoid
4383 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4384 !! end
4385
4386 !! test
4387 External links: open square bracket forbidden in URL (named) (bug 4377)
4388 !! options
4389 parsoid=wt2html,html2html
4390 !! wikitext
4391 [http://example.com/1[2345]
4392 !! html/php
4393 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4394 </p>
4395 !! html/parsoid
4396 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4397 !!end
4398
4399 # parsoid adds a space before the link name
4400 !! test
4401 External links: open square bracket forbidden in URL (named) (bug 4377)
4402 Parsoid variant.
4403 !! wikitext
4404 [http://example.com/1 [2345]
4405 !! html
4406 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4407 </p>
4408 !!end
4409
4410 !! test
4411 External links: nowiki in URL link text (bug 6230)
4412 !! wikitext
4413 [http://example.com/ <nowiki>''example site''</nowiki>]
4414 !! html
4415 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4416 </p>
4417 !! end
4418
4419 !! test
4420 External links: newline forbidden in text (bug 6230 regression check)
4421 !! wikitext
4422 [http://example.com/ first
4423 second]
4424 !! html
4425 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4426 second]
4427 </p>
4428 !!end
4429
4430 !! test
4431 External links: Pipe char between url and text
4432 !! wikitext
4433 [http://example.com | link]
4434 !! html
4435 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4436 </p>
4437 !!end
4438
4439 !! test
4440 External links: protocol-relative URL in brackets
4441 !! wikitext
4442 [//example.com/ Test]
4443 !! html
4444 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4445 </p>
4446 !! end
4447
4448 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4449 !! test
4450 External links: protocol-relative URL in brackets without text
4451 !! wikitext
4452 [//example.com]
4453 !! html/php
4454 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4455 </p>
4456 !! html/parsoid
4457 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4458 !! end
4459
4460 !! test
4461 External links: protocol-relative URL in free text is left alone
4462 !! wikitext
4463 //example.com/Foo
4464 !! html
4465 <p>//example.com/Foo
4466 </p>
4467 !!end
4468
4469 !! test
4470 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4471 !! wikitext
4472 foo//example.com/Foo
4473 !! html
4474 <p>foo//example.com/Foo
4475 </p>
4476 !! end
4477
4478 !! test
4479 External links: with no contents
4480 !! wikitext
4481 [http://en.wikipedia.org/wiki/Foo]
4482
4483 [[wikipedia:Foo|Bar]]
4484
4485 [[wikipedia:Foo|<span>Bar</span>]]
4486 !! html/php
4487 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4488 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4489 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4490 </p>
4491 !! html/parsoid
4492 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4493 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4494 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4495 !! end
4496
4497 !! test
4498 External links: Free with trailing punctuation
4499 !! wikitext
4500 http://example.com,
4501 http://example.com;
4502 http://example.com\
4503 http://example.com.
4504 http://example.com:
4505 http://example.com!
4506 http://example.com?
4507 http://example.com)
4508 http://example.com/url_with_(brackets)
4509 (http://example.com/url_without_brackets)
4510 http://example.com/url_with_entity&nbsp;
4511 http://example.com/url_with_entity&#xA0;
4512 http://example.com/url_with_entity&#160;
4513 http://example.com/url_with_entity&lt;
4514 http://example.com/url_with_entity&#x3C;
4515 http://example.com/url_with_entity&#60;
4516 !! html/php
4517 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4518 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4519 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4520 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4521 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4522 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4523 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4526 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4527 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4528 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4529 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4530 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4531 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4532 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4533 </p>
4534 !! html/parsoid
4535 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4536 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4537 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4538 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4539 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4540 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4541 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4544 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4545 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4546 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4547 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4548 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4549 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4550 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4551 !! end
4552
4553 !! test
4554 External links: No preceding word characters allowed (bug 65278)
4555 !! wikitext
4556 NOPEhttp://example.com
4557 N0http://example.com
4558 ok:http://example.com
4559 ok-http://example.com
4560 !! html
4561 <p>NOPEhttp://example.com
4562 N0http://example.com
4563 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4564 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4565 </p>
4566 !! end
4567
4568 !! test
4569 External image
4570 !! wikitext
4571 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4572 !! html
4573 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4574 </p>
4575 !! end
4576
4577 !! test
4578 External image from https
4579 !! wikitext
4580 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4581 !! html
4582 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4583 </p>
4584 !! end
4585
4586 !! test
4587 External image (when not allowed)
4588 !! options
4589 wgAllowExternalImages=0
4590 !! wikitext
4591 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4592 !! html
4593 <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>
4594 </p>
4595 !! end
4596
4597 !! test
4598 Link to non-http image, no img tag
4599 !! wikitext
4600 Link to non-http image, no img tag: ftp://example.com/test.jpg
4601 !! html
4602 <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>
4603 </p>
4604 !! end
4605
4606 !! test
4607 External links: terminating separator
4608 !! wikitext
4609 Terminating separator: http://example.com/thing,
4610 !! html
4611 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4612 </p>
4613 !! end
4614
4615 !! test
4616 External links: intervening separator
4617 !! wikitext
4618 Intervening separator: http://example.com/1,2,3
4619 !! html
4620 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4621 </p>
4622 !! end
4623
4624 !! test
4625 External links: old bug with URL in query
4626 !! wikitext
4627 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4628 !! html
4629 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4630 </p>
4631 !! end
4632
4633 !! test
4634 External links: old URL-in-URL bug, mixed protocols
4635 !! wikitext
4636 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4637 !! html
4638 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4639 </p>
4640 !!end
4641
4642 !! test
4643 External links: URL in text
4644 !! wikitext
4645 URL in text: [http://example.com http://example.com]
4646 !! html
4647 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4648 </p>
4649 !! end
4650
4651 !! test
4652 External links: Clickable images
4653 !! wikitext
4654 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4655 !! html/php
4656 <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>
4657 </p>
4658 !! html/parsoid
4659 <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>
4660 !! end
4661
4662 !! test
4663 External links: raw ampersand
4664 !! wikitext
4665 Old &amp; use: http://x&y
4666 !! html
4667 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4668 </p>
4669 !! end
4670
4671 !! test
4672 External links: encoded ampersand
4673 !! wikitext
4674 Old &amp; use: http://x&amp;y
4675 !! html/php
4676 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4677 </p>
4678 !! html/parsoid
4679 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4680 !! end
4681
4682 !! test
4683 External links: encoded equals (bug 6102)
4684 !! wikitext
4685 http://example.com/?foo&#61;bar
4686 !! html/php
4687 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4688 </p>
4689 !! html/parsoid
4690 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4691 !! end
4692
4693 ##
4694 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4695 ## does it number them. As discussed in bug 53505, we can identify
4696 ## autonumbered links via CSS.
4697 ##
4698
4699 !! test
4700 External links: [raw ampersand]
4701 !! wikitext
4702 Old &amp; use: [http://x&y]
4703 !! html/php
4704 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4705 </p>
4706 !! html/parsoid
4707 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4708 !! end
4709
4710 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4711 # mode will return the [raw ampersand] wikitext
4712 !! test
4713 External links: [encoded ampersand]
4714 !! options
4715 parsoid=wt2html,wt2wt,html2html
4716 !! wikitext
4717 Old &amp; use: [http://x&amp;y]
4718 !! html/php
4719 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4720 </p>
4721 !! html/parsoid
4722 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4723 !! end
4724
4725 !! test
4726 External links: [raw equals]
4727 !! wikitext
4728 [http://example.com/?foo=bar]
4729 !! html/php
4730 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4734 !! end
4735
4736 # note that parsoid html is identical to [raw equals] case; so html2wt
4737 # mode will return the [raw equals] wikitext
4738 !! test
4739 External links: [encoded equals] (bug 6102)
4740 !! options
4741 parsoid=wt2html,wt2wt,html2html
4742 !! wikitext
4743 [http://example.com/?foo&#61;bar]
4744 !! html/php
4745 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4746 </p>
4747 !! html/parsoid
4748 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4749 !! end
4750
4751 # xxx parsoid strips the IDN character, so the round-trip tests will
4752 # obviously fail and are disabled. --cscott
4753 !! test
4754 External links: [IDN ignored character reference in hostname; strip it right off]
4755 !! options
4756 parsoid=wt2html,wt2wt,html2html
4757 !! wikitext
4758 [http://e&zwnj;xample.com/]
4759 !! html/php
4760 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4761 </p>
4762 !! html/parsoid
4763 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4764 !! end
4765
4766 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4767 # Where an external link could easily circumvent the sanitization of the text of
4768 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4769 # test demands a higher standard. That's a bit strange.
4770 #
4771 # Example:
4772 #
4773 # http://e‌xample.com -> [http://example.com|http://example.com]
4774 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4775 #
4776 # The first example is sanitized, but the second is not. Any security benefits
4777 # from this production are trivial to circumvent. Either remove this test and
4778 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4779 # the test accordingly.
4780 #
4781 # All our love,
4782 # The Parsoid team.
4783 # xxx parsoid strips the IDN character, so the round-trip tests will
4784 # obviously fail and are disabled. --cscott
4785 !! test
4786 External links: IDN ignored character reference in hostname; strip it right off
4787 !! options
4788 parsoid=wt2html,html2html
4789 !! wikitext
4790 http://e&zwnj;xample.com/
4791 !! html/php
4792 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4793 </p>
4794 !! html/parsoid
4795 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4796 !! end
4797
4798 !! test
4799 External links: www.jpeg.org (bug 554)
4800 !! wikitext
4801 http://www.jpeg.org
4802 !! html
4803 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4804 </p>
4805 !! end
4806
4807 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4808 !! test
4809 External links: URL within URL (original bug 2)
4810 !! wikitext
4811 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4812 !! html/php
4813 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4814 </p>
4815 !! html/parsoid
4816 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4817 !! end
4818
4819 !! test
4820 BUG 361: URL inside bracketed URL
4821 !! wikitext
4822 [http://www.example.com/foo http://www.example.com/bar]
4823 !! html
4824 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4825 </p>
4826 !! end
4827
4828 !! test
4829 BUG 361: URL within URL, not bracketed
4830 !! wikitext
4831 http://www.example.com/foo?=http://www.example.com/bar
4832 !! html
4833 <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>
4834 </p>
4835 !! end
4836
4837 !! test
4838 BUG 289: ">"-token in URL-tail
4839 !! wikitext
4840 http://www.example.com/<hello>
4841 !! html
4842 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4843 </p>
4844 !!end
4845
4846 !! test
4847 BUG 289: literal ">"-token in URL-tail
4848 !! wikitext
4849 http://www.example.com/<b>html</b>
4850 !! html/php
4851 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4852 </p>
4853 !! html/parsoid
4854 <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>
4855 !! end
4856
4857 !! test
4858 BUG 289: ">"-token in bracketed URL
4859 !! wikitext
4860 [http://www.example.com/<hello> stuff]
4861 !! html
4862 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4863 </p>
4864 !!end
4865
4866 !! test
4867 BUG 289: literal ">"-token in bracketed URL
4868 !! wikitext
4869 [http://www.example.com/<b>html</b> stuff]
4870 !! html
4871 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4872 </p>
4873 !!end
4874
4875 !! test
4876 BUG 289: literal double quote at end of URL
4877 !! wikitext
4878 http://www.example.com/"hello"
4879 !! html
4880 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4881 </p>
4882 !!end
4883
4884 !! test
4885 BUG 289: literal double quote in bracketed URL
4886 !! wikitext
4887 [http://www.example.com/"hello" stuff]
4888 !! html
4889 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4890 </p>
4891 !!end
4892
4893 !! test
4894 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4895 !! wikitext
4896 [http://www.example.com test]
4897 !! html
4898 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4899 </p>
4900 !! end
4901
4902 !! test
4903 External links: link text with spaces
4904 !! wikitext
4905 [http://www.example.com a b c]
4906 [http://www.example.com ''a'' ''b'']
4907 !! html
4908 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4909 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4910 </p>
4911 !! end
4912
4913 !! test
4914 External links: wiki links within external link (Bug 3695)
4915 !! wikitext
4916 [http://example.com [[wikilink]] embedded in ext link]
4917 !! html/php
4918 <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>
4919 </p>
4920 !! html/parsoid
4921 <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>
4922 !! end
4923
4924 !! test
4925 BUG 787: Links with one slash after the url protocol are invalid
4926 !! wikitext
4927 http:/example.com
4928
4929 [http:/example.com title]
4930 !! html
4931 <p>http:/example.com
4932 </p><p>[http:/example.com title]
4933 </p>
4934 !! end
4935
4936 !! test
4937 Bracketed external links with template-generated invalid target
4938 !! wikitext
4939 [{{echo|http:/example.com}} title]
4940 !! html
4941 <p>[http:/example.com title]
4942 </p>
4943 !! end
4944
4945 !! test
4946 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4947 !! wikitext
4948 ''[http://example.com text'']
4949 [http://example.com '''text]'''
4950 ''Something [http://example.com in italic'']
4951 ''Something [http://example.com mixed''''', even bold]'''
4952 '''''Now [http://example.com both''''']
4953 !! html
4954 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4955 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4956 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4957 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4958 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4959 </p>
4960 !! end
4961
4962
4963 !! test
4964 Bug 4781: %26 in URL
4965 !! wikitext
4966 http://www.example.com/?title=AT%26T
4967 !! html/php
4968 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4969 </p>
4970 !! html/parsoid
4971 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4972 !! end
4973
4974 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4975 # % is actually legal in HTML5. Any change in output would need testing though.
4976 !! test
4977 Bug 4781, 5267: %25 in URL
4978 !! wikitext
4979 http://www.example.com/?title=100%25_Bran
4980 !! html/php
4981 <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>
4982 </p>
4983 !! html/parsoid
4984 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4985 !! end
4986
4987 !! test
4988 Bug 4781, 5267: %28, %29 in URL
4989 !! wikitext
4990 http://www.example.com/?title=Ben-Hur_%281959_film%29
4991 !! html/php
4992 <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>
4993 </p>
4994 !! html/parsoid
4995 <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>
4996 !! end
4997
4998
4999 !! test
5000 Bug 4781: %26 in autonumber URL
5001 !! wikitext
5002 [http://www.example.com/?title=AT%26T]
5003 !! html/php
5004 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5005 </p>
5006 !! html/parsoid
5007 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5008 !! end
5009
5010 !! test
5011 Bug 4781, 5267: %26 in autonumber URL
5012 !! wikitext
5013 [http://www.example.com/?title=100%25_Bran]
5014 !! html/php
5015 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5016 </p>
5017 !! html/parsoid
5018 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5019 !! end
5020
5021 !! test
5022 Bug 4781, 5267: %28, %29 in autonumber URL
5023 !! wikitext
5024 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5025 !! html/php
5026 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5027 </p>
5028 !! html/parsoid
5029 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5030 !! end
5031
5032
5033 !! test
5034 Bug 4781: %26 in bracketed URL
5035 !! wikitext
5036 [http://www.example.com/?title=AT%26T link]
5037 !! html/php
5038 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5039 </p>
5040 !! html/parsoid
5041 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5042 !! end
5043
5044 !! test
5045 Bug 4781, 5267: %25 in bracketed URL
5046 !! wikitext
5047 [http://www.example.com/?title=100%25_Bran link]
5048 !! html
5049 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5050 </p>
5051 !! end
5052
5053 !! test
5054 Bug 4781, 5267: %28, %29 in bracketed URL
5055 !! wikitext
5056 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5057 !! html/php
5058 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5059 </p>
5060 !! html/parsoid
5061 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5062 !! end
5063
5064 !! test
5065 External link containing a period in the anchor. (bug 63947)
5066 !! wikitext
5067 [//foo.org/bar#baz. bang]
5068
5069 [//foo.org/bar. bang]
5070 !! html/php
5071 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5072 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5073 </p>
5074 !! html/parsoid
5075 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5076 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5077 !! end
5078
5079 !! test
5080 External link containing a single quote. (bug 63947)
5081 !! wikitext
5082 [//foo.org/bar'baz]
5083
5084 [//foo.org/bar'baz bang]
5085 !! html/php
5086 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5087 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5088 </p>
5089 !! html/parsoid
5090 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5091 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5092 !! end
5093
5094
5095 !! test
5096 External link containing a period in the anchor. (bug 63947)
5097 !! wikitext
5098 [//foo.org/bar#baz. bang]
5099
5100 [//foo.org/bar. bang]
5101 !! html/php
5102 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5103 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5104 </p>
5105 !! html/parsoid
5106 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5107 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5108 !! end
5109
5110 !! test
5111 External link containing a single quote. (bug 63947)
5112 !! wikitext
5113 [//foo.org/bar'baz]
5114
5115 [//foo.org/bar'baz bang]
5116 !! html/php
5117 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5118 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5119 </p>
5120 !! html/parsoid
5121 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5122 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5123 !! end
5124
5125
5126 !! test
5127 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5128 !! wikitext
5129 Some [http://example.com/ pretty ''italics'' and stuff]!
5130 !! html
5131 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5132 </p>
5133 !! end
5134
5135 !! test
5136 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5137 !! wikitext
5138 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5139 !! html
5140 <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>
5141 </p>
5142 !! end
5143
5144 !! test
5145 External link containing double-single-quotes with no space separating the url from text in italics
5146 !! wikitext
5147 [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]].]
5148 !! html/php
5149 <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>
5150 </p>
5151 !! html/php+tidy
5152 <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>
5153 !! html/parsoid
5154 <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>
5155 !! end
5156
5157 !! test
5158 External link with comments in link text
5159 !! wikitext
5160 [http://www.google.com Google <!-- comment -->]
5161 !! html
5162 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5163 </p>
5164 !! end
5165
5166 !! test
5167 URL-encoding in URL functions (single parameter)
5168 !! wikitext
5169 {{localurl:Some page|amp=&}}
5170 !! html
5171 <p>/index.php?title=Some_page&amp;amp=&amp;
5172 </p>
5173 !! end
5174
5175 !! test
5176 URL-encoding in URL functions (multiple parameters)
5177 !! wikitext
5178 {{localurl:Some page|q=?&amp=&}}
5179 !! html
5180 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5181 </p>
5182 !! end
5183
5184 !! test
5185 Brackets in urls
5186 !! wikitext
5187 http://example.com/index.php?foozoid%5B%5D=bar
5188
5189 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5190 !! html/php
5191 <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>
5192 </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>
5193 </p>
5194 !! html/parsoid
5195 <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>
5196
5197 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5198 !! end
5199
5200 !! test
5201 IPv6 urls (bug 21261)
5202 !! options
5203 disabled
5204 !! wikitext
5205 http://[2404:130:0:1000::187:2]/index.php
5206 !! html
5207 <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>
5208 </p>
5209 !! end
5210
5211 !! test
5212 Non-extlinks in brackets
5213 !! wikitext
5214 [foo]
5215 [foo bar]
5216 [foo ''bar'']
5217 [fool's] errand
5218 [fool's errand]
5219 [{{echo|foo}}]
5220 [{{echo|foo}} bar]
5221 [{{echo|foo}} ''bar'']
5222 [{{echo|foo}}l's] errand
5223 [{{echo|foo}}l's errand]
5224 [url={{echo|foo}}]
5225 [url=http://example.com]
5226 !! html
5227 <p>[foo]
5228 [foo bar]
5229 [foo <i>bar</i>]
5230 [fool's] errand
5231 [fool's errand]
5232 [foo]
5233 [foo bar]
5234 [foo <i>bar</i>]
5235 [fool's] errand
5236 [fool's errand]
5237 [url=foo]
5238 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5239 </p>
5240 !! end
5241
5242 !! test
5243 Percent encoding in external links
5244 !! wikitext
5245 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5246 !! html/php
5247 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5248 </p>
5249 !! html/parsoid
5250 <p><a rel="mw:ExtLink"
5251 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5252 !! end
5253
5254 !! test
5255 Use url link syntax for links where the content is equal the link target
5256 !! wikitext
5257 http://example.com
5258 !! html/php
5259 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5260 </p>
5261 !! html/parsoid
5262 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5263 !! end
5264
5265 !! test
5266 Parenthesis in external links, especially URL links
5267 !! wikitext
5268 http://example.com)
5269
5270 http://example.com/test)
5271
5272 http://example.com/(test)
5273
5274 http://example.com/((test)
5275
5276 (http://example.com/(test))
5277
5278 (http://example.com/(test)))))
5279
5280 http://example.com/a)b
5281
5282 [http://example.com) foo]
5283 !! html/php
5284 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5285 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5286 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5287 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5288 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5289 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5290 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5291 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5292 </p>
5293 !! html/parsoid
5294 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5295 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5296 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5297 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5298 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5299 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5300 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5301 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5302 !! end
5303
5304 !! test
5305 Parenthesis in external links, w/ transclusion or comment
5306 !! wikitext
5307 (http://example.com/{{echo|hi}})
5308
5309 (http://example.com<!-- hi -->)
5310 !! html/php
5311 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5312 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5313 </p>
5314 !! html/parsoid
5315 <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>
5316
5317 <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>
5318 !! end
5319
5320 !! test
5321 Serialize <a> tags with invalid link targets as plain text
5322 !! options
5323 parsoid=html2wt
5324 !! html
5325 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5326 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5327 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5328 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5329 !! wikitext
5330 text
5331 <nowiki>*</nowiki>text
5332 <nowiki>[[foo]]</nowiki>
5333 <nowiki>*a [[foo]]</nowiki>
5334 !! end
5335
5336 !! test
5337 mw:ExtLink -vs- mw:WikiLink (T94723)
5338 !! options
5339 parsoid=html2wt
5340 !! html/parsoid
5341 <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>
5342 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5343 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5344 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5345 <p>
5346 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5347 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5348 </p>
5349 !! wikitext
5350 [[Foo|Bar]]
5351 [[Foo|Bar]]
5352 [[wikipedia:Foo|Bar]]
5353 [[wikipedia:Foo|Bar]]
5354
5355 [[wikipedia:European_Robin|European Robin]]
5356 [[wikipedia:European_Robin|European Robin]]
5357 !! end
5358
5359 !! test
5360 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5361 !! options
5362 parsoid=wt2wt
5363 !! wikitext
5364 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5365 !! html/parsoid
5366 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5367 !! end
5368
5369
5370 ###
5371 ### Quotes
5372 ###
5373
5374 !! test
5375 Quotes
5376 !! wikitext
5377 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5378
5379 Normal text. '''''Bold italic text.''''' Normal text.
5380 !! html
5381 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5382 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5383 </p>
5384 !! end
5385
5386
5387 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5388 # parser strips. The wikitext contains just the first half of the bold
5389 # quote pair.
5390 !! test
5391 Unclosed and unmatched quotes
5392 !! wikitext
5393 '''''Bold italic text '''with bold deactivated''' in between.'''''
5394
5395 '''''Bold italic text ''with italic deactivated'' in between.'''''
5396
5397 '''Bold text..
5398
5399 ..spanning two paragraphs (should not work).'''
5400
5401 '''Bold tag left open
5402
5403 ''Italic tag left open
5404
5405 Normal text.
5406
5407 <!-- Unmatching number of opening, closing tags: -->
5408 '''This year''''s election ''should'' beat '''last year''''s.
5409
5410 ''Tom'''s car is bigger than ''Susan'''s.
5411
5412 Plain ''italic'''s plain
5413 !! html/php
5414 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5415 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5416 </p><p><b>Bold text..</b>
5417 </p><p>..spanning two paragraphs (should not work).
5418 </p><p><b>Bold tag left open</b>
5419 </p><p><i>Italic tag left open</i>
5420 </p><p>Normal text.
5421 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5422 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5423 </p><p>Plain <i>italic'</i>s plain
5424 </p>
5425 !! html/parsoid
5426 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5427 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5428 </p><p><b>Bold text..</b>
5429 </p><p>..spanning two paragraphs (should not work).<b></b>
5430 </p><p><b>Bold tag left open</b>
5431 </p><p><i>Italic tag left open</i>
5432 </p><p>Normal text.
5433 </p>
5434 <!-- Unmatching number of opening, closing tags: -->
5435 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5436 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5437 </p><p>Plain <i>italic'</i>s plain
5438 </p>
5439 !! end
5440
5441 ###
5442 ### Tables
5443 ###
5444 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5445 ###
5446
5447 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5448 # is the bare minimum required by the spec, see:
5449 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5450 # Parsoid team replies: empty table tags are legal in HTML5
5451 !! test
5452 A table with no data.
5453 !! options
5454 parsoid=wt2html
5455 !! wikitext
5456 {||}
5457 !! html/php
5458
5459 !! html/parsoid
5460 <table></table>
5461
5462 !! end
5463
5464 !! test
5465 A table with stray table end tags on start tag line (wt2html)
5466 !! options
5467 parsoid=wt2html
5468 !! wikitext
5469 {|style="color: red;"|}
5470
5471 {|style="color: red;" |}
5472 |foo
5473 |}
5474
5475 {|style="color: red;"|} id="foo"
5476 |foo
5477 |}
5478
5479 {|style="color: red;" |} id="foo"
5480 |foo
5481 |}
5482 !! html
5483 <table style="color: red;"></table>
5484
5485 <table style="color: red;">
5486 <tbody><tr>
5487 <td>foo</td>
5488 </tr></tbody>
5489 </table>
5490
5491 <table style="color: red;" id="foo">
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 !! end
5504
5505 !! test
5506 A table with no data (take 2)
5507 !! wikitext
5508 {|
5509 |}
5510 !! html/parsoid
5511 <table></table>
5512 !! end
5513
5514 # A table with nothing but a caption is invalid XHTML, we might want to render
5515 # this as <p>caption</p>
5516 # Parsoid team replies: table with only a caption is legal in HTML5
5517 !! test
5518 A table with nothing but a caption
5519 !! wikitext
5520 {|
5521 |+ caption
5522 |}
5523 !! html/php
5524 <table>
5525 <caption> caption
5526 </caption><tr><td></td></tr></table>
5527
5528 !! html/parsoid
5529 <table><caption> caption</caption></table>
5530 !! end
5531
5532 !! test
5533 A table with caption with default-spaced attributes and a table row
5534 !! wikitext
5535 {|
5536 |+ style="color: red;" | caption1
5537 |-
5538 | foo
5539 |}
5540 !! html
5541 <table>
5542 <caption style="color: red;"> caption1
5543 </caption>
5544 <tr>
5545 <td> foo
5546 </td></tr></table>
5547
5548 !! end
5549
5550 !! test
5551 A table with captions with non-default spaced attributes and a table row
5552 !! wikitext
5553 {|
5554 |+style="color: red;"|caption2
5555 |+ style="color: red;"| caption3
5556 |-
5557 | foo
5558 |}
5559 !! html
5560 <table>
5561 <caption style="color: red;">caption2
5562 </caption>
5563 <caption style="color: red;"> caption3
5564 </caption>
5565 <tr>
5566 <td> foo
5567 </td></tr></table>
5568
5569 !! end
5570
5571 !! test
5572 Table td-cell syntax variations
5573 !! wikitext
5574 {|
5575 | foo bar foo | baz
5576 | foo bar foo || baz
5577 | style='color:red;' | baz
5578 | style='color:red;' || baz
5579 |}
5580 !! html
5581 <table>
5582 <tr>
5583 <td> baz
5584 </td>
5585 <td> foo bar foo </td>
5586 <td> baz
5587 </td>
5588 <td style="color:red;"> baz
5589 </td>
5590 <td> style='color:red;' </td>
5591 <td> baz
5592 </td></tr></table>
5593
5594 !! end
5595
5596 !! test
5597 Simple table
5598 !! wikitext
5599 {|
5600 | 1 || 2
5601 |-
5602 | 3 || 4
5603 |}
5604 !! html
5605 <table>
5606 <tr>
5607 <td> 1 </td>
5608 <td> 2
5609 </td></tr>
5610 <tr>
5611 <td> 3 </td>
5612 <td> 4
5613 </td></tr></table>
5614
5615 !! end
5616
5617 !! test
5618 Simple table but with multiple dashes for row wikitext
5619 !! wikitext
5620 {|
5621 | foo
5622 |-----
5623 | bar
5624 |}
5625 !! html
5626 <table>
5627 <tr>
5628 <td> foo
5629 </td></tr>
5630 <tr>
5631 <td> bar
5632 </td></tr></table>
5633
5634 !! end
5635
5636 !! test
5637 Multiplication table
5638 !! wikitext
5639 {| border="1" cellpadding="2"
5640 |+Multiplication table
5641 |-
5642 ! &times; !! 1 !! 2 !! 3
5643 |-
5644 ! 1
5645 | 1 || 2 || 3
5646 |-
5647 ! 2
5648 | 2 || 4 || 6
5649 |-
5650 ! 3
5651 | 3 || 6 || 9
5652 |-
5653 ! 4
5654 | 4 || 8 || 12
5655 |-
5656 ! 5
5657 | 5 || 10 || 15
5658 |}
5659 !! html
5660 <table border="1" cellpadding="2">
5661 <caption>Multiplication table
5662 </caption>
5663 <tr>
5664 <th> &#215; </th>
5665 <th> 1 </th>
5666 <th> 2 </th>
5667 <th> 3
5668 </th></tr>
5669 <tr>
5670 <th> 1
5671 </th>
5672 <td> 1 </td>
5673 <td> 2 </td>
5674 <td> 3
5675 </td></tr>
5676 <tr>
5677 <th> 2
5678 </th>
5679 <td> 2 </td>
5680 <td> 4 </td>
5681 <td> 6
5682 </td></tr>
5683 <tr>
5684 <th> 3
5685 </th>
5686 <td> 3 </td>
5687 <td> 6 </td>
5688 <td> 9
5689 </td></tr>
5690 <tr>
5691 <th> 4
5692 </th>
5693 <td> 4 </td>
5694 <td> 8 </td>
5695 <td> 12
5696 </td></tr>
5697 <tr>
5698 <th> 5
5699 </th>
5700 <td> 5 </td>
5701 <td> 10 </td>
5702 <td> 15
5703 </td></tr></table>
5704
5705 !! end
5706
5707 !! test
5708 Accept "||" in table headings
5709 !! wikitext
5710 {|
5711 !h1 || h2
5712 |}
5713 !! html
5714 <table>
5715 <tr>
5716 <th>h1 </th>
5717 <th> h2
5718 </th></tr></table>
5719
5720 !! end
5721
5722 !! test
5723 Accept "!!" in table data
5724 !! wikitext
5725 {|
5726 | Foo!! ||
5727 |}
5728 !! html
5729 <table>
5730 <tr>
5731 <td> Foo!! </td>
5732 <td>
5733 </td></tr></table>
5734
5735 !! html/parsoid
5736 <table>
5737 <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>
5738 </tbody></table>
5739 !! end
5740
5741 !! test
5742 Accept "||" in indented table headings
5743 !! wikitext
5744 :{|
5745 !h1 || h2
5746 |}
5747 !! html
5748 <dl><dd><table>
5749 <tr>
5750 <th>h1 </th>
5751 <th> h2
5752 </th></tr></table></dd></dl>
5753
5754 !! end
5755
5756 !! test
5757 Accept "!!" in templates
5758 !! wikitext
5759 {|
5760 !a {{echo|b!!c}}
5761 |}
5762 !! html/php
5763 <table>
5764 <tr>
5765 <th>a b</th>
5766 <th>c
5767 </th></tr></table>
5768
5769 !! html/parsoid
5770 <table>
5771 <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>
5772 !! end
5773
5774 !! test
5775 Accept "!!" in table headings after newline
5776 !! wikitext
5777 {|
5778 !a
5779 b!!c
5780 |}
5781 !! html/php
5782 <table>
5783 <tr>
5784 <th>a
5785 <p>b!!c
5786 </p>
5787 </th></tr></table>
5788
5789 !! html/parsoid
5790 <table>
5791 <tbody><tr><th>a
5792 <p>b!!c</p></th></tr>
5793 </tbody></table>
5794 !! end
5795
5796 !! test
5797 Accept "!!" in table data of mixed wikitext / html syntax
5798 !! wikitext
5799 {|
5800 !a
5801 <tr><td>b!!c</td></tr>
5802 |}
5803 !! html+tidy
5804 <table>
5805 <tr>
5806 <th>a</th>
5807 </tr>
5808 <tr>
5809 <td>b!!c</td>
5810 </tr>
5811 </table>
5812 !! html/parsoid
5813 <table>
5814 <tbody><tr><th>a</th></tr>
5815 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
5816 </tbody></table>
5817 !! end
5818
5819 !! test
5820 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5821 !! wikitext
5822 {|
5823 !| h1
5824 || a
5825 |}
5826 !! html
5827 <table>
5828 <tr>
5829 <th> h1
5830 </th>
5831 <td> a
5832 </td></tr></table>
5833
5834 !! end
5835
5836 !!test
5837 Accept "| !" at start of line in tables (ignore !-attribute)
5838 !! wikitext
5839 {|
5840 |-
5841 | !style="color:red" | bar
5842 |}
5843 !! html
5844 <table>
5845
5846 <tr>
5847 <td> bar
5848 </td></tr></table>
5849
5850 !!end
5851
5852 !!test
5853 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 +/-
5854 !! wikitext
5855 {|
5856 |-
5857 |style='color:red;'|+1
5858 |style='color:blue;'|-1
5859 |-
5860 | 1 || 2 || 3
5861 | 1 ||+2 ||-3
5862 |-
5863 | +1
5864 | -1
5865 |}
5866 !! html
5867 <table>
5868
5869 <tr>
5870 <td style="color:red;">+1
5871 </td>
5872 <td style="color:blue;">-1
5873 </td></tr>
5874 <tr>
5875 <td> 1 </td>
5876 <td> 2 </td>
5877 <td> 3
5878 </td>
5879 <td> 1 </td>
5880 <td>+2 </td>
5881 <td>-3
5882 </td></tr>
5883 <tr>
5884 <td> +1
5885 </td>
5886 <td> -1
5887 </td></tr></table>
5888
5889 !!end
5890
5891 !! test
5892 Table rowspan
5893 !! wikitext
5894 {| border=1
5895 | Cell 1, row 1
5896 |rowspan=2| Cell 2, row 1 (and 2)
5897 | Cell 3, row 1
5898 |-
5899 | Cell 1, row 2
5900 | Cell 3, row 2
5901 |}
5902 !! html
5903 <table border="1">
5904 <tr>
5905 <td> Cell 1, row 1
5906 </td>
5907 <td rowspan="2"> Cell 2, row 1 (and 2)
5908 </td>
5909 <td> Cell 3, row 1
5910 </td></tr>
5911 <tr>
5912 <td> Cell 1, row 2
5913 </td>
5914 <td> Cell 3, row 2
5915 </td></tr></table>
5916
5917 !! end
5918
5919 !! test
5920 Nested table
5921 !! wikitext
5922 {| border=1
5923 | &alpha;
5924 |
5925 {| bgcolor=#ABCDEF border=2
5926 |nested
5927 |-
5928 |table
5929 |}
5930 |the original table again
5931 |}
5932 !! html
5933 <table border="1">
5934 <tr>
5935 <td> &#945;
5936 </td>
5937 <td>
5938 <table bgcolor="#ABCDEF" border="2">
5939 <tr>
5940 <td>nested
5941 </td></tr>
5942 <tr>
5943 <td>table
5944 </td></tr></table>
5945 </td>
5946 <td>the original table again
5947 </td></tr></table>
5948
5949 !! end
5950
5951 !! test
5952 Invalid attributes in table cell (bug 1830)
5953 !! wikitext
5954 {|
5955 |Cell:|broken
5956 |}
5957 !! html
5958 <table>
5959 <tr>
5960 <td>broken
5961 </td></tr></table>
5962
5963 !! end
5964
5965 !! test
5966 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
5967 !! wikitext
5968 {|
5969 | title="foo" |bar
5970 | title="foo<nowiki>|</nowiki>" |bar
5971 | title="foo<nowiki>|</nowiki>" bar
5972 |}
5973 !! html
5974 <table>
5975 <tr>
5976 <td title="foo">bar
5977 </td>
5978 <td title="foo&#124;">bar
5979 </td>
5980 <td> title="foo|" bar
5981 </td></tr></table>
5982
5983 !! end
5984
5985 # The "|}" to close the table is missing from the input, so parsoid's
5986 # *2wt modes will fail.
5987 !! test
5988 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5989 !! options
5990 parsoid=wt2html,html2html
5991 !! wikitext
5992 {|
5993 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5994 !! html/php
5995 <table>
5996 <tr>
5997 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5998 <td>]" onmouseover="alert(document.cookie)"&gt;test
5999 </td>
6000 </tr>
6001 </table>
6002
6003 !! html/parsoid
6004 <table><tbody>
6005 <tr>
6006 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6007 !! end
6008
6009 # FIXME: The php output is broken.
6010 !! test
6011 ! and || in td attributes should not be parsed as <th>/<td>
6012 !! wikitext
6013 {|
6014 | style="color: red !important;" data-contrived="put this here ||" | foo
6015 |}
6016 !! html/php
6017 <table>
6018 <tr>
6019 <td> style="color: red !important;" data-contrived="put this here </td>
6020 <td> foo
6021 </td></tr></table>
6022
6023 !! html/parsoid
6024 <table>
6025 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6026 </tbody></table>
6027 !! end
6028
6029 !! test
6030 Indented table markup mixed with indented pre content (proposed in bug 6200)
6031 !! wikitext
6032 <table>
6033 <tr>
6034 <td>
6035 Text that should be rendered preformatted
6036 </td>
6037 </tr>
6038 </table>
6039 !! html
6040 <table>
6041 <tr>
6042 <td>
6043 <pre>Text that should be rendered preformatted
6044 </pre>
6045 </td>
6046 </tr>
6047 </table>
6048
6049 !! end
6050
6051 !! test
6052 1. Template-generated table cell attributes and cell content
6053 !! wikitext
6054 {|
6055 |{{table_attribs}}
6056 | {{table_attribs}}
6057 || {{table_attribs_5}}
6058 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6059 |align=center {{table_attribs}}
6060 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6061 |}
6062 !! html
6063 <table>
6064 <tr>
6065 <td style="color:red;">Foo
6066 </td>
6067 <td style="color:red;">Foo
6068 </td>
6069 <td> style="color:red;"</td>
6070 <td>Bar
6071 </td>
6072 <td style="color:red;">Foo
6073 </td>
6074 <td align="center" style="color:red;">Foo
6075 </td>
6076 <td align="center" style="color:red;">Foo
6077 </td></tr></table>
6078
6079 !! end
6080
6081 !! test
6082 2. Template-generated table cell attributes and cell content
6083 !! wikitext
6084 {|
6085 |{{table_attribs_2}}
6086 |}
6087 !! html/php
6088 <table>
6089 <tr>
6090 <td style="color:red;">Foo
6091 </td>
6092 <td>Bar</td>
6093 <td>Baz
6094 </td></tr></table>
6095
6096 !! html/parsoid
6097 <table>
6098 <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>
6099 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6100 </tbody></table>
6101 !! end
6102
6103 !! test
6104 3. Template-generated table cell attributes and cell content
6105 !! wikitext
6106 {|
6107 !align=center {{table_header_cells}}
6108 |-
6109 |align=center {{table_cells}}
6110 |}
6111 !! html/php
6112 <table>
6113 <tr>
6114 <th align="center" style="color:red;">Foo</th>
6115 <th style="color:red;"><i>Bar</i></th>
6116 <th style="color:brown;"><i>Foo</i> and Baz
6117 </th></tr>
6118 <tr>
6119 <td align="center" style="color:red;">Foo</td>
6120 <td style="color:red;"><i>Bar</i></td>
6121 <td style="color:brown;"><i>Foo</i> and Baz
6122 </td></tr></table>
6123
6124 !! html/parsoid
6125 <table>
6126 <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>
6127 <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>
6128 </tbody></table>
6129 !! end
6130
6131 !! test
6132 4. Template-generated table cell attributes and cell content inside a templated table
6133 !! wikitext
6134 {{tbl-start}}
6135 !align=center {{table_header_cells}}
6136 |-
6137 |align=center {{table_cells}}
6138 {{tbl-end}}
6139 !! html/php
6140 <table>
6141 <tr>
6142 <th align="center" style="color:red;">Foo</th>
6143 <th style="color:red;"><i>Bar</i></th>
6144 <th style="color:brown;"><i>Foo</i> and Baz
6145 </th></tr>
6146 <tr>
6147 <td align="center" style="color:red;">Foo</td>
6148 <td style="color:red;"><i>Bar</i></td>
6149 <td style="color:brown;"><i>Foo</i> and Baz
6150 </td></tr></table>
6151
6152 !! html/parsoid
6153 <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}}]}'>
6154 <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>
6155 <tr>
6156 <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>
6157 </tbody></table>
6158 !! end
6159
6160 !! test
6161 Table with row followed by newlines and table heading
6162 !! wikitext
6163 {|
6164 |-
6165
6166 ! foo
6167 |}
6168 !! html
6169 <table>
6170
6171
6172 <tr>
6173 <th> foo
6174 </th></tr></table>
6175
6176 !! end
6177
6178 !! test
6179 Table with empty line following the start tag
6180 !! wikitext
6181 {|
6182
6183 |-
6184 | foo
6185 |}
6186 !! html
6187 <table>
6188
6189
6190 <tr>
6191 <td> foo
6192 </td></tr></table>
6193
6194 !! end
6195
6196 # FIXME: Preserve the attribute properly (with an empty string as value) in
6197 # the PHP parser. Parsoid implements the behavior below.
6198 !! test
6199 Table attributes with empty value
6200 !! wikitext
6201 {|
6202 | style=| hello
6203 |}
6204 !! html/parsoid
6205 <table>
6206 <tbody>
6207 <tr>
6208 <td style=""> hello
6209 </td></tr></tbody></table>
6210
6211 !! end
6212
6213 !! test
6214 Wikitext table with a lot of comments
6215 !! wikitext
6216 {|
6217 <!-- c0 -->
6218 | foo
6219 <!-- c1 -->
6220 |-<!-- c2 -->
6221 <!-- c3 -->
6222 |<!-- c4 -->
6223 <!-- c5 -->
6224 |}
6225 !! html
6226 <table>
6227 <tr>
6228 <td> foo
6229 </td></tr>
6230 <tr>
6231 <td>
6232 </td></tr></table>
6233
6234 !! end
6235
6236 !! test
6237 Wikitext table comments represented in parsoid dom
6238 !! wikitext
6239 {|<!--c1--><!--c2-->
6240 |-<!--c3-->
6241 | x
6242 |}
6243 !! html/php+tidy
6244 <table>
6245 <tr>
6246 <td>x</td>
6247 </tr>
6248 </table>
6249 !! html/parsoid
6250 <table><!--c1--><!--c2-->
6251 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6252 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6253 </tbody></table>
6254 !! end
6255
6256 !! test
6257 Wikitext table with double-line table cell
6258 !! wikitext
6259 {|
6260 |a
6261 b
6262 |}
6263 !! html
6264 <table>
6265 <tr>
6266 <td>a
6267 <p>b
6268 </p>
6269 </td></tr></table>
6270
6271 !! end
6272
6273 !! test
6274 Table cell with a single comment
6275 !! wikitext
6276 {|
6277 | <!-- c1 -->
6278 | a
6279 |}
6280 !! html
6281 <table>
6282 <tr>
6283 <td>
6284 </td>
6285 <td> a
6286 </td></tr></table>
6287
6288 !! end
6289
6290 !! test
6291 Table-cell after a comment-only-empty-line
6292 !! wikitext
6293 {|
6294 |a
6295 <!--c1-->
6296 <!--c2-->| b
6297 |}
6298 !! html
6299 <table>
6300 <tr>
6301 <td>a
6302 </td>
6303 <td> b
6304 </td></tr></table>
6305
6306 !! html/parsoid
6307 <table>
6308 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6309 <!--c1-->
6310 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6311 </tbody></table>
6312
6313 !! end
6314
6315 !! test
6316 Build table with {{!}}
6317 !! wikitext
6318 {{{!}} class="wikitable"
6319 ! header
6320 ! second header
6321 {{!}}- style="color:red;"
6322 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6323 {{!}}}
6324 !! html
6325 <table class="wikitable">
6326 <tr>
6327 <th> header
6328 </th>
6329 <th> second header
6330 </th></tr>
6331 <tr style="color:red;">
6332 <td> data </td>
6333 <td style="color:red;"> second data
6334 </td></tr></table>
6335
6336 !! end
6337
6338 !! test
6339 Build table with pipe as data
6340 !! wikitext
6341 {| class="wikitable"
6342 ! header
6343 ! second header
6344 |- style="color:red;"
6345 | data || style="color:red;" | second data
6346 |-
6347 | style="color:red;" | data with | || style="color:red;" | second data with |
6348 |-
6349 || data with | ||| second data with |
6350 |}
6351 !! html
6352 <table class="wikitable">
6353 <tr>
6354 <th> header
6355 </th>
6356 <th> second header
6357 </th></tr>
6358 <tr style="color:red;">
6359 <td> data </td>
6360 <td style="color:red;"> second data
6361 </td></tr>
6362 <tr>
6363 <td style="color:red;"> data with | </td>
6364 <td style="color:red;"> second data with |
6365 </td></tr>
6366 <tr>
6367 <td> data with | </td>
6368 <td> second data with |
6369 </td></tr></table>
6370
6371 !! end
6372
6373 !! test
6374 Build table with wikilink
6375 !! wikitext
6376 {| class="wikitable"
6377 ! header || second header
6378 |- style="color:red;"
6379 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6380 |-
6381 | data || second data [[Main Page|link|text with pipe]]
6382 |}
6383 !! html
6384 <table class="wikitable">
6385 <tr>
6386 <th> header </th>
6387 <th> second header
6388 </th></tr>
6389 <tr style="color:red;">
6390 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6391 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6392 </td></tr>
6393 <tr>
6394 <td> data </td>
6395 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6396 </td></tr></table>
6397
6398 !! end
6399
6400 # The expected HTML structure in this test is debatable. The PHP parser does
6401 # not parse this kind of table at all. The main focus for Parsoid is on
6402 # round-tripping, so this output is ok for now. TODO: revisit!
6403 !! test
6404 Wikitext table with html-syntax row
6405 !! wikitext
6406 {|
6407 |-
6408 <td>foo</td>
6409 |}
6410 !! html/parsoid
6411 <table>
6412 <tbody>
6413 <tr>
6414 <td>foo</td></tr></tbody></table>
6415 !! end
6416
6417 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6418 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6419 ## PHP parser, which tidy then compounds by fostering the content
6420 ## entirely out of the table. Parsoid recognizes the table context
6421 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6422 ## depends on PHP's treatment of broken table markup!
6423 !! test
6424 Implicit <td> after a |-
6425 !! options
6426 parsoid=wt2html,html2html
6427 !! wikitext
6428 {|
6429 |-
6430 a
6431 |}
6432 !! html/php
6433 <table>
6434
6435 a
6436 </table>
6437
6438 !! html/php+tidy
6439 <p>a</p>
6440 !! html/parsoid
6441 <table>
6442 <tr><td>a</td></tr>
6443 </table>
6444 !! end
6445
6446 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6447 !! test
6448 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6449 !! options
6450 parsoid=wt2html,html2html
6451 !! wikitext
6452 {|
6453 |-
6454 |
6455 a
6456 |-
6457 b
6458 |}
6459 !! html/php
6460 <table>
6461
6462 <tr>
6463 <td>
6464 <pre>a
6465 </pre>
6466 </td></tr>
6467 b
6468 </table>
6469
6470 !! html/php+tidy
6471 <p>b</p>
6472 <table>
6473 <tr>
6474 <td>
6475 <pre>
6476 a
6477 </pre></td>
6478 </tr>
6479 </table>
6480 !! html/parsoid
6481 <table>
6482 <tbody>
6483 <tr><td><pre>a</pre></td></tr>
6484 <tr><td> b</td></tr>
6485 </tbody>
6486 </table>
6487 !! end
6488
6489 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6490 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6491 !! test
6492 Lists should be recognized in an implicit <td> context
6493 !! options
6494 parsoid=wt2html,html2html
6495 !! wikitext
6496 {|
6497 |-
6498 *a
6499 |}
6500 !! html/php
6501 <table>
6502
6503 <ul><li>a</li></ul>
6504 </table>
6505
6506 !! html/php+tidy
6507 <ul>
6508 <li>a</li>
6509 </ul>
6510 !! html/parsoid
6511 <table>
6512 <tr>
6513 <td><ul>
6514 <li>a</li>
6515 </ul></td>
6516 </tr>
6517 </table>
6518 !! end
6519
6520 !! test
6521 Table cells not properly parsed in an implicit-td context
6522 !! wikitext
6523 {|
6524 |-
6525 {{table_attribs_4}} || a || b
6526 |}
6527 !! html/php+tidy
6528 <table>
6529 <tr>
6530 <td style="background-color:#DC241f;" width="10px"></td>
6531 <td>a</td>
6532 <td>b</td>
6533 </tr>
6534 </table>
6535 !! html/parsoid
6536 <table>
6537 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6538 <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>
6539 </tbody></table>
6540 !! end
6541
6542 !! test
6543 Parsoid: Round-trip tables directly followed by content (bug 51219)
6544 !! options
6545 parsoid=wt2html,wt2wt
6546 !! wikitext
6547 {|
6548 |foo
6549 |} bar
6550
6551 {|
6552 |baz
6553 |}<b>quux</b>
6554 !! html+tidy
6555 <table>
6556 <tr>
6557 <td>foo</td>
6558 </tr>
6559 </table>
6560 <p>bar</p>
6561 <table>
6562 <tr>
6563 <td>baz</td>
6564 </tr>
6565 </table>
6566 <p><b>quux</b></p>
6567 !! end
6568
6569 !! test
6570 Parsoid: Default to a newline after tables in new content (bug 51219)
6571 !! options
6572 parsoid=html2wt
6573 !! html
6574 <table><tbody>
6575 <tr><td>foo</td></tr></tbody></table> bar
6576 <table><tbody>
6577 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6578 !! wikitext
6579 {|
6580 |foo
6581 |}
6582 <nowiki> </nowiki>bar
6583 {|
6584 |baz
6585 |}
6586 '''quux'''
6587 !! end
6588
6589 !! test
6590 Parsoid: newline inducing block nodes don't suppress <nowiki>
6591 !! options
6592 parsoid=html2wt
6593 !! html
6594 a<h1>foo</h1>
6595 !! wikitext
6596 <nowiki> </nowiki>a
6597
6598 = foo =
6599 !! end
6600
6601 !! test
6602 Parsoid: Row-syntax table headings followed by comment & table cells
6603 !! options
6604 parsoid=wt2html,wt2wt
6605 !! wikitext
6606 {|
6607 ! foo || bar
6608 <!-- foo --> || baz || quux
6609 |}
6610 !! html/php
6611 <table>
6612 <tr>
6613 <th> foo </th>
6614 <th> bar
6615 </th>
6616 <td> baz </td>
6617 <td> quux
6618 </td></tr></table>
6619
6620 !! html/parsoid
6621 <table>
6622 <tbody><tr><th> foo </th><th> bar
6623 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6624 </tbody></table>
6625 !! end
6626
6627
6628 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6629 # preserves it.
6630 !!test
6631 Parsoid: Recover better from broken table attributes
6632 !!options
6633 parsoid=wt2html
6634 !!wikitext
6635 {| class="foo
6636 | class="bar" |
6637 foo
6638 |}
6639 !!html/php+tidy
6640 <table>
6641 <tr>
6642 <td class="bar">
6643 <p>foo</p>
6644 </td>
6645 </tr>
6646 </table>
6647 !!html/parsoid
6648 <table class="foo">
6649 <tr>
6650 <td class="bar">
6651 <p>foo</p></td></tr>
6652 </tbody></table>
6653 !!end
6654
6655 !! test
6656 Strip unsupported table tags
6657 !! options
6658 parsoid=html2wt
6659 !! html
6660 <table>
6661 <thead>
6662 <tr>
6663 <th>Month</th>
6664 <th>Savings</th>
6665 </tr>
6666 </thead>
6667 <tbody>
6668 <tr>
6669 <td>January</td>
6670 <td>$100</td>
6671 </tr>
6672 <tr>
6673 <td>February</td>
6674 <td>$80</td>
6675 </tr>
6676 </tbody>
6677 <tfoot>
6678 <tr>
6679 <td>Sum</td>
6680 <td>$180</td>
6681 </tr>
6682 </tfoot>
6683 </table>
6684 !! wikitext
6685 {|
6686
6687 !Month
6688 !Savings
6689
6690 |January
6691 |$100
6692
6693 |-
6694 |February
6695 |$80
6696
6697 |Sum
6698 |$180
6699
6700 |}
6701 !! end
6702
6703 !!test
6704 Testing serialization after deletion of table cells
6705 !!options
6706 parsoid={
6707 "modes": ["wt2wt", "selser"],
6708 "changes": [
6709 ["#x", "remove"]
6710 ]
6711 }
6712 !!wikitext
6713 {|
6714 !h1 !!h2 !!h3
6715 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6716 |}
6717 !! wikitext/edited
6718 {|
6719 !h1 !!h2 !!h3
6720 |c2 |||c3
6721 |}
6722 !!end
6723
6724 ###
6725 ### Internal links
6726 ###
6727 !! test
6728 Plain link, capitalized
6729 !! wikitext
6730 [[Main Page]]
6731 !! html
6732 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6733 </p>
6734 !! end
6735
6736 !! test
6737 Plain link, uncapitalized
6738 !! wikitext
6739 [[main Page]]
6740 !! html
6741 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6742 </p>
6743 !! end
6744
6745 !! test
6746 Piped link
6747 !! wikitext
6748 [[Main Page|The Main Page]]
6749 !! html
6750 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6751 </p>
6752 !! end
6753
6754 !! test
6755 Piped link with comment in link text
6756 !! wikitext
6757 [[Main Page|The Main<!--front--> Page]]
6758 !! html
6759 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6760 </p>
6761 !! end
6762
6763 !! test
6764 Piped link with multiple pipe characters in link text
6765 !! wikitext
6766 [[Main Page||The|Main|Page|]]
6767 !! html/php
6768 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6769 </p>
6770 !! html/parsoid
6771 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6772 !! end
6773
6774 !! test
6775 Broken link
6776 !! wikitext
6777 [[Zigzagzogzagzig]]
6778 !! html
6779 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6780 </p>
6781 !! end
6782
6783 !! test
6784 Broken link with fragment
6785 !! wikitext
6786 [[Zigzagzogzagzig#zug]]
6787 !! html
6788 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6789 </p>
6790 !! end
6791
6792 !! test
6793 Special page link with fragment
6794 !! wikitext
6795 [[Special:Version#anchor]]
6796 !! html
6797 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6798 </p>
6799 !! end
6800
6801 !! test
6802 Nonexistent special page link with fragment
6803 !! wikitext
6804 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6805 !! html
6806 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6807 </p>
6808 !! end
6809
6810 !! test
6811 Link with prefix
6812 !! wikitext
6813 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6814 !! html
6815 <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>
6816 </p>
6817 !! end
6818
6819 !! test
6820 Link with suffix
6821 !! wikitext
6822 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6823 !! html
6824 <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>!!!
6825 </p>
6826 !! end
6827
6828 !! article
6829 prefixed article
6830 !! text
6831 Some text
6832 !! endarticle
6833
6834 !! test
6835 Bug 43661: Piped links with identical prefixes
6836 !! wikitext
6837 [[prefixed article|prefixed articles with spaces]]
6838
6839 [[prefixed article|prefixed articlesaoeu]]
6840
6841 [[Main Page|Main Page test]]
6842 !! html
6843 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6844 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6845 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6846 </p>
6847 !! end
6848
6849
6850 !! test
6851 Link with HTML entity in suffix / tail
6852 !! wikitext
6853 [[Main Page]]&quot;, [[Main Page]]&#97;
6854 !! html/php
6855 <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;
6856 </p>
6857 !! html/parsoid
6858 <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>
6859 !! end
6860
6861 !! test
6862 Link with 3 brackets
6863 !! wikitext
6864 [[[Main Page]]]
6865 !! html
6866 <p>[[[Main Page]]]
6867 </p>
6868 !! end
6869
6870 !! test
6871 Link with 4 brackets
6872 !! wikitext
6873 [[[[Main Page]]]]
6874 !! html
6875 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6876 </p>
6877 !! end
6878
6879 !! test
6880 Piped link with 3 brackets
6881 !! wikitext
6882 [[[main page|the main page]]]
6883 !! html
6884 <p>[[[main page|the main page]]]
6885 </p>
6886 !! end
6887
6888 !! test
6889 Piped link with extlink-like text
6890 !! wikitext
6891 [[Main Page|[bar]]]
6892 [[Main Page|This is a [bar]]]
6893 !! html/php
6894 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6895 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6896 </p>
6897 !! html/parsoid
6898 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6899 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6900 !! end
6901
6902 !! test
6903 Link with multiple pipes
6904 !! wikitext
6905 [[Main Page|The|Main|Page]]
6906 !! html
6907 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6908 </p>
6909 !! end
6910
6911 # Note that parsoid does not munge anchor text; all non-space
6912 # characters are valid in HTML5 ids.
6913 !! test
6914 Anchor containing a #. (bug 63430)
6915 !! wikitext
6916 [[Main Page#And#Link]]
6917 !! html/php
6918 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6919 </p>
6920 !! html/parsoid
6921 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6922 !! end
6923
6924 !! test
6925 Link to namespaces
6926 !! wikitext
6927 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6928 !! html
6929 <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>
6930 </p>
6931 !! end
6932
6933 !! test
6934 Link with space in namespace
6935 !! wikitext
6936 [[User talk:Foo bar]]
6937 !! html
6938 <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>
6939 </p>
6940 !! end
6941
6942 !! article
6943 MemoryAlpha:AlphaTest
6944 !! text
6945 This is an article in the MemoryAlpha namespace
6946 (which shadows the memoryalpha interwiki link).
6947 !! endarticle
6948
6949 !! test
6950 Namespace takes precedence over interwiki link (bug 51680)
6951 !! wikitext
6952 [[MemoryAlpha:AlphaTest]]
6953 !! html
6954 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6955 </p>
6956 !! end
6957
6958 # The previous test doesn't work correctly in html2*, due to not recognizing the
6959 # link as an internal one. This one checks for the correct behavior.
6960 !! test
6961 Link to namespace preferred over interwiki with correct rel attribute
6962 !! options
6963 parsoid=html2wt,html2html
6964 !! html
6965 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6966 !! wikitext
6967 [[MemoryAlpha:AlphaTest]]
6968 !! end
6969
6970 !! test
6971 Piped link to namespace
6972 !! wikitext
6973 [[Meta:Disclaimers|The disclaimers]]
6974 !! html
6975 <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>
6976 </p>
6977 !! end
6978
6979 !! test
6980 Link containing }
6981 !! wikitext
6982 [[Usually caused by a typo (oops}]]
6983 !! html
6984 <p>[[Usually caused by a typo (oops}]]
6985 </p>
6986 !! end
6987
6988 !! article
6989 7% Solution
6990 !! text
6991 Just a test of an article title containing a percent.
6992 !! endarticle
6993
6994 !! test
6995 Link containing % (not as a hex sequence)
6996 !! wikitext
6997 [[7% Solution]]
6998 !! html/php
6999 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7000 </p>
7001 !! html/parsoid
7002 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7003 !! end
7004
7005 # note that the parsoid HTML is identical to the previous test output,
7006 # so the previous test ensures that the html2wt mode will generate the
7007 # "not as a hex sequence" wikitext.
7008 !! test
7009 Link containing % as a single hex sequence interpreted to char
7010 !! options
7011 parsoid=wt2wt,wt2html,html2html
7012 !! wikitext
7013 [[7%25 Solution]]
7014 !! html/php
7015 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7016 </p>
7017 !! html/parsoid
7018 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7019 !!end
7020
7021 !! test
7022 Link containing % as a double hex sequence interpreted to hex sequence
7023 !! wikitext
7024 [[7%2525 Solution]]
7025 !! html
7026 <p>[[7%2525 Solution]]
7027 </p>
7028 !!end
7029
7030 # note that parsoid does not munge anchor text; all non-space
7031 # characters are valid in HTML5 anchors.
7032 !! test
7033 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7034 Example for such a section: == < ==
7035 !! wikitext
7036 [[%23%3c]][[%23%3e]]
7037 !! html/php
7038 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7039 </p>
7040 !! html/parsoid
7041 <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>
7042 !! end
7043
7044 !! test
7045 Link containing "<#" and ">#" as a hex sequences
7046 !! wikitext
7047 [[%3c%23]][[%3e%23]]
7048 !! html
7049 <p>[[%3c%23]][[%3e%23]]
7050 </p>
7051 !! end
7052
7053 !! test
7054 Link containing an equals sign
7055 !! wikitext
7056 [[Special:BookSources/isbn=4-00-026157-6]]
7057 !! html/php
7058 <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>
7059 </p>
7060 !! html/parsoid
7061 <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>
7062 !! end
7063
7064 !! article
7065 Foo~bar
7066 !! text
7067 Just a test of an article title containing a tilde.
7068 !! endarticle
7069
7070 # note that links containing signatures, like [[Foo~~~~]], are
7071 # massaged by the pre-save transform (PST) and so the tildes are never
7072 # seen by the parser.
7073 !! test
7074 Link containing a tilde
7075 !! wikitext
7076 [[Foo~bar]]
7077 !! html/php
7078 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7079 </p>
7080 !! html/parsoid
7081 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7082 !! end
7083
7084 !! test
7085 Link containing double-single-quotes '' (bug 4598)
7086 !! wikitext
7087 [[Lista d''e paise d''o munno]]
7088 !! html/php
7089 <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>
7090 </p>
7091 !! html/parsoid
7092 <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>
7093 !! end
7094
7095 !! test
7096 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7097 !! wikitext
7098 Some [[Link|pretty ''italics'' and stuff]]!
7099 !! html/php
7100 <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>!
7101 </p>
7102 !! html/parsoid
7103 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7104 !! end
7105
7106 !! test
7107 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7108 !! wikitext
7109 ''Some [[Link|pretty ''italics'' and stuff]]!''
7110 !! html
7111 <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>
7112 </p>
7113 !! end
7114
7115 !! test
7116 Link with double quotes in title part (literal) and alternate part (interpreted)
7117 !! wikitext
7118 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7119
7120 [[''Pentecoste'']]
7121
7122 [[''Pentecoste''|Pentecoste]]
7123
7124 [[''Pentecoste''|''Pentecoste'']]
7125 !! html/php
7126 <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>
7127 </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>
7128 </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>
7129 </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>
7130 </p>
7131 !! html/parsoid
7132 <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>
7133 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7134 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7135 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7136 !! end
7137
7138 !! test
7139 Broken image links with HTML captions (bug 39700)
7140 !! wikitext
7141 [[File:Nonexistent|<script></script>]]
7142 [[File:Nonexistent|100x100px|<script></script>]]
7143 [[File:Nonexistent|&lt;]]
7144 [[File:Nonexistent|a<i>b</i>c]]
7145 !! html/php
7146 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7147 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7148 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7149 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7150 </p>
7151 !! html/parsoid
7152 <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>
7153 <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>
7154 <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>
7155 <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>
7156 !! end
7157
7158 !! test
7159 Plain link to URL
7160 !! wikitext
7161 [[http://www.example.com]]
7162 !! html/php
7163 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7164 </p>
7165 !! html/parsoid
7166 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7167 !! end
7168
7169 !! test
7170 Plain link to URL with link text
7171 !! wikitext
7172 [[http://www.example.com Link text]]
7173 !! html
7174 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7175 </p>
7176 !! end
7177
7178 !! test
7179 Plain link to protocol-relative URL
7180 !! wikitext
7181 [[//www.example.com]]
7182 !! html/php
7183 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7184 </p>
7185 !! html/parsoid
7186 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7187 !! end
7188
7189 !! test
7190 Plain link to protocol-relative URL with link text
7191 !! wikitext
7192 [[//www.example.com Link text]]
7193 !! html
7194 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7195 </p>
7196 !! end
7197
7198 !! test
7199 Plain link to page with question mark in title
7200 !! wikitext
7201 [[A?b]]
7202
7203 [[A?b|Baz]]
7204 !! html
7205 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7206 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7207 </p>
7208 !! end
7209
7210
7211 # I'm fairly sure the expected result here is wrong.
7212 # We want these to be URL links, not pseudo-pages with URLs for titles....
7213 # However the current output is also pretty screwy.
7214 #
7215 # ----
7216 # I'm changing it to match the current output--it arguably makes more
7217 # sense in the light of the test above. Old expected result was:
7218 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7219 #</p>
7220 # But I think this test is bordering on "garbage in, garbage out" anyway.
7221 # -- wtm
7222 !! test
7223 Piped link to URL
7224 !! wikitext
7225 Piped link to URL: [[http://www.example.com|an example URL]]
7226 !! html/php
7227 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7228 </p>
7229 !! html/parsoid
7230 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7231 !! end
7232
7233 !! test
7234 BUG 2: [[page|http://url/]] should link to page, not http://url/
7235 !! wikitext
7236 [[Main Page|http://url/]]
7237 !! html/php
7238 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7239 </p>
7240 !! html/parsoid
7241 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7242 !! end
7243
7244 # Parsoid does not mark self-links, by design.
7245 !! test
7246 BUG 337: Escaped self-links should be bold
7247 !! options
7248 title=[[Bug462]]
7249 !! wikitext
7250 [[Bu&#103;462]] [[Bug462]]
7251 !! html/php
7252 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7253 </p>
7254 !! html/php+tidy
7255 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7256 !! html/parsoid
7257 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7258 !! end
7259
7260 !! test
7261 Self-link to section should not be bold
7262 !! options
7263 title=[[Main Page]]
7264 !! wikitext
7265 [[Main Page#section]]
7266 !! html
7267 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7268 </p>
7269 !! end
7270
7271 !! article
7272 00
7273 !! text
7274 This is 00.
7275 !! endarticle
7276
7277 !!test
7278 Self-link to numeric title
7279 !!options
7280 title=[[0]]
7281 !! wikitext
7282 [[0]]
7283 !! html
7284 <p><strong class="selflink">0</strong>
7285 </p>
7286 !!end
7287
7288 !!test
7289 Link to numeric-equivalent title
7290 !!options
7291 title=[[0]]
7292 !! wikitext
7293 [[00]]
7294 !! html
7295 <p><a href="/wiki/00" title="00">00</a>
7296 </p>
7297 !!end
7298
7299 !! test
7300 <nowiki> inside a link
7301 !! wikitext
7302 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7303 !! html
7304 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7305 </p>
7306 !! end
7307
7308 !! test
7309 Non-breaking spaces in title
7310 !! wikitext
7311 [[&nbsp; Main &nbsp; Page &nbsp;]]
7312 !! html
7313 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7314 </p>
7315 !!end
7316
7317 !! test
7318 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7319 !! options
7320 language=ca
7321 !! wikitext
7322 '''[[Main Page]]'''
7323 !! html
7324 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7325 </p>
7326 !! end
7327
7328 !! test
7329 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7330 !! options
7331 language=ca
7332 !! wikitext
7333 ''[[Main Page]]''
7334 !! html
7335 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7336 </p>
7337 !! end
7338
7339 !! test
7340 Internal link with en linktrail: no apostrophes (bug 27473)
7341 !! options
7342 language=en
7343 !! wikitext
7344 [[Something]]'nice
7345 !! html
7346 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7347 </p>
7348 !! end
7349
7350 !! test
7351 Internal link with ca linktrail with apostrophes (bug 27473)
7352 !! options
7353 language=ca
7354 !! wikitext
7355 [[Something]]'nice
7356 !! html
7357 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7358 </p>
7359 !! end
7360
7361 !! test
7362 Internal link with kaa linktrail with apostrophes (bug 27473)
7363 !! options
7364 language=kaa
7365 !! wikitext
7366 [[Something]]'nice
7367 !! html
7368 <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>
7369 </p>
7370 !! end
7371
7372 !! test
7373 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7374 !! wikitext
7375 [[User:Foo/Test/63636:Bar|Test]]
7376 !! html/php
7377 <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>
7378 </p>
7379 !! html/parsoid
7380 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7381 !! end
7382
7383 !! test
7384 Purely hash wikilink
7385 !! options
7386 title=[[User:test/123]]
7387 !! wikitext
7388 [[#a|b]]
7389 !! html/php
7390 <p><a href="#a">b</a>
7391 </p>
7392 !! html/parsoid
7393 <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>
7394 !! end
7395
7396 !! test
7397 1. Interaction of linktrail and template encapsulation
7398 !! options
7399 parsoid
7400 !! wikitext
7401 {{echo|[[Foo]]}}l
7402 !! html
7403 <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>
7404 !! end
7405
7406 !! test
7407 2. Interaction of linktrail and template encapsulation
7408 !! options
7409 parsoid
7410 !! wikitext
7411 {{echo|Some [[Fool]]}}s
7412 !! html
7413 <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>
7414 !! end
7415
7416 !! test
7417 3. Interaction of linktrail and template encapsulation
7418 !! options
7419 parsoid
7420 !! wikitext
7421 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7422 !! html
7423 <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>
7424 !! end
7425
7426 !! article
7427 Söfnuður
7428 !! text
7429 Test.
7430 !! endarticle
7431
7432 !! test
7433 Internal link with is link prefix
7434 !! options
7435 language=is
7436 !! wikitext
7437 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7438 !! html
7439 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7440 </p>
7441 !! end
7442
7443 !! article
7444 Mótmælendatrú
7445 !! text
7446 Test.
7447 !! endarticle
7448
7449 !! test
7450 Internal link with is link trail and link prefix
7451 !! options
7452 language=is
7453 !! wikitext
7454 [[mótmælendatrú|xxx]]ar
7455 [[mótmælendatrú]]ar
7456 mótmælenda[[söfnuður]]
7457 mótmælenda[[söfnuður|söfnuðir]]
7458 mótmælenda[[söfnuður|söfnuðir]]xxx
7459 !! html
7460 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7461 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7462 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7463 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7464 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7465 </p>
7466 !! end
7467
7468 !! test
7469 Parsoid link trail escaping
7470 !! options
7471 parsoid=html2wt,html2html
7472 !! html
7473 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7474 !! wikitext
7475 [[apple]]<nowiki/>s
7476 !! end
7477
7478 !! test
7479 Parsoid link prefix escaping
7480 !! options
7481 language=is
7482 parsoid=html2wt,html2html
7483 !! html
7484 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7485 !! wikitext
7486 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7487 !! end
7488
7489 !! test
7490 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7491 !! wikitext
7492 [[Foo| bar]]
7493
7494 [[Foo| ''bar'']]
7495
7496 [http://wp.org foo]
7497
7498 [http://wp.org ''foo'']
7499 !! html
7500 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7501 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7502 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7503 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7504 </p>
7505 !! end
7506
7507 !! test
7508 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7509 !! options
7510 parsoid
7511 !! wikitext
7512 [[Foo|{{echo|a}} b {{echo|c}}]]
7513 !! html
7514 <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>
7515 !! end
7516
7517 !! test
7518 Link with angle bracket after anchor
7519 !! wikitext
7520 [[Foo#<bar>]]
7521 !! html/php
7522 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7523 </p>
7524 !! html/parsoid
7525 <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>
7526 !! end
7527
7528 ###
7529 ### Interwiki links (see maintenance/interwiki.sql)
7530 ###
7531
7532 !! test
7533 Inline interwiki link
7534 !! options
7535 parsoid=wt2html,wt2wt,html2html
7536 !! wikitext
7537 [[MeatBall:SoftSecurity]]
7538 !! html/php
7539 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7540 </p>
7541 !! html/parsoid
7542 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7543 !! end
7544
7545 !! test
7546 Inline interwiki link with empty title (bug 2372)
7547 !! options
7548 parsoid=wt2html,wt2wt,html2html
7549 !! wikitext
7550 [[MeatBall:]]
7551 !! html/php
7552 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7553 </p>
7554 !! html/parsoid
7555 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7556 !! end
7557
7558 !! test
7559 Interwiki link encoding conversion (bug 1636)
7560 !! wikitext
7561 *[[Wikipedia:ro:Olteni&#0355;a]]
7562 *[[Wikipedia:ro:Olteni&#355;a]]
7563 !! html
7564 <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>
7565 <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>
7566
7567 !! html+tidy
7568 <ul>
7569 <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>
7570 <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>
7571 </ul>
7572 !! end
7573
7574 !! test
7575 Interwiki link with fragment (bug 2130)
7576 !! wikitext
7577 [[MeatBall:SoftSecurity#foo]]
7578 !! html
7579 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7580 </p>
7581 !! end
7582
7583 # Ideally the wikipedia: prefix here should be proto-relative too
7584 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7585 # define the 'en' prefix, and originally the test used 'wikipedia',
7586 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7587 # article.
7588 !! test
7589 Different interwiki prefixes mapping to the same URL
7590 !! wikitext
7591 [[:en:Foo]]
7592
7593 [[:en:Foo|Foo]]
7594
7595 [[wikipedia:Foo]]
7596
7597 [[:wikipedia:Foo|Foo]]
7598
7599 [[wikipedia:en:Foo]]
7600
7601 [[:wikipedia:en:Foo]]
7602
7603 [[ wikiPEdia :Foo]]
7604 !! html/parsoid
7605 <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>
7606
7607 <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>
7608
7609 <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>
7610
7611 <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>
7612
7613 <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>
7614
7615 <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>
7616
7617 <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>
7618 !! end
7619
7620 !! test
7621 Interwiki links that cannot be represented in wiki syntax
7622 !! wikitext
7623 [[meatball:ok]]
7624 [[meatball:ok#foo|ok with fragment]]
7625 [[meatball:ok_as_well?|ok ending with ? mark]]
7626 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7627 [http://de.wikipedia.org/wiki/#foo is just fragment]
7628
7629 !! html/php
7630 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7631 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7632 <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>
7633 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7634 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7635 </p>
7636 !! html/parsoid
7637 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7638 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7639 <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>
7640 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7641 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7642 !! end
7643
7644 !! test
7645 Interwiki links: trail
7646 !! wikitext
7647 [[wikipedia:Foo|Ba]]r
7648 !! html/php
7649 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7650 </p>
7651 !! html/parsoid
7652 <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>
7653 !! end
7654
7655 !! test
7656 Local interwiki link
7657 !! options
7658 parsoid=wt2html,wt2wt,html2html
7659 !! wikitext
7660 [[local:Template:Foo]]
7661 !! html/php
7662 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7663 </p>
7664 !! html/parsoid
7665 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7666 !! end
7667
7668 # Parsoid does not mark self-links, by design.
7669 !! test
7670 Local interwiki link: self-link to current page
7671 !! options
7672 title=[[Main Page]]
7673 parsoid=wt2html,wt2wt,html2html
7674 !! wikitext
7675 [[local:Main Page]]
7676 !! html/php
7677 <p><strong class="selflink">local:Main Page</strong>
7678 </p>
7679 !! html/parsoid
7680 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7681 !! end
7682
7683 !! test
7684 Local interwiki link: prefix only (bug 64167)
7685 !! options
7686 parsoid=wt2html,wt2wt,html2html
7687 !! wikitext
7688 [[local:]]
7689 !! html/php
7690 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7691 </p>
7692 !! html/parsoid
7693 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7694 !! end
7695
7696 !! test
7697 Local interwiki link: with additional interwiki prefix (bug 61357)
7698 !! options
7699 parsoid=wt2html,wt2wt,html2html
7700 !! wikitext
7701 [[local:meatball:Hello]]
7702 !! html/php
7703 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7704 </p>
7705 !! html/parsoid
7706 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7707 !! end
7708
7709 !! test
7710 Multiple local interwiki link prefixes
7711 !! wikitext
7712 [[local:local:local:local:mi:local:Foo]]
7713 !! options
7714 parsoid=wt2html,wt2wt,html2html
7715 !! html/php
7716 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7717 </p>
7718 !! html/parsoid
7719 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7720 !! end
7721
7722 ###
7723 ### Interlanguage links
7724 ### Language links (so that searching for '### language' matches..)
7725 ###
7726
7727 !! test
7728 Interlanguage link
7729 !! options
7730 parsoid=wt2html,wt2wt,html2html
7731 !! wikitext
7732 Blah blah blah
7733 [[zh:Chinese]]
7734 !! html/php
7735 <p>Blah blah blah
7736 </p>
7737 !! html/parsoid
7738 <p>Blah blah blah</p>
7739 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7740 !! end
7741
7742 !! test
7743 Interlanguage link with spacing
7744 !! options
7745 parsoid=wt2html,wt2wt,html2html
7746 !! wikitext
7747 Blah blah blah
7748 [[ zh : Chinese ]]
7749 !! html/php
7750 <p>Blah blah blah
7751 </p>
7752 !! html/parsoid
7753 <p>Blah blah blah</p>
7754 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7755 !! end
7756
7757 !! test
7758 Double interlanguage link
7759 !! options
7760 parsoid=wt2html,wt2wt,html2html
7761 !! wikitext
7762 Blah blah blah
7763 [[es:Spanish]]
7764 [[zh:Chinese]]
7765 !! html/php
7766 <p>Blah blah blah
7767 </p>
7768 !! html/parsoid
7769 <p>Blah blah blah</p>
7770 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7771 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7772 !! end
7773
7774 !! test
7775 Interlanguage link variations
7776 !! options
7777 parsoid=wt2html,wt2wt,html2html
7778 !! wikitext
7779 Blah blah blah
7780 [[ es :Spanish]]
7781 [[ ZH :Chinese]]
7782 [[es:Foo_bar]]
7783 !! html/php
7784 <p>Blah blah blah
7785 </p>
7786 !! html/parsoid
7787 <p>Blah blah blah</p>
7788 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7789 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7790 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7791 !! end
7792
7793 !! test
7794 Space and question mark encoding in interlanguage links (T95473)
7795 !! options
7796 parsoid=wt2html,wt2wt,html2html
7797 !! wikitext
7798 Blah blah blah
7799 [[es:Foo bar?]]
7800 !! html/php
7801 <p>Blah blah blah
7802 </p>
7803 !! html/parsoid
7804 <p>Blah blah blah</p>
7805 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
7806 !! end
7807
7808 !! test
7809 Interlanguage link, with prefix links
7810 !! options
7811 language=ln
7812 !! wikitext
7813 Blah blah blah
7814 [[zh:Chinese]]
7815 !! html/php
7816 <p>Blah blah blah
7817 </p>
7818 !! html/parsoid
7819 <p>Blah blah blah</p>
7820 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7821 !! end
7822
7823 !! test
7824 Double interlanguage link, with prefix links (bug 8897)
7825 !! options
7826 language=ln
7827 !! wikitext
7828 Blah blah blah
7829 [[es:Spanish]]
7830 [[zh:Chinese]]
7831 !! html/php
7832 <p>Blah blah blah
7833 </p>
7834 !! html/parsoid
7835 <p>Blah blah blah</p>
7836 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7837 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7838 !! end
7839
7840 !! test
7841 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7842 !! wikitext
7843 Blah blah blah
7844 [[mul:Article]]
7845 !! html/php
7846 <p>Blah blah blah
7847 </p>
7848 !! html/parsoid
7849 <p>Blah blah blah</p>
7850 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7851 !! end
7852
7853 !! test
7854 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7855 !! options
7856 language=ln
7857 !! wikitext
7858 [[WW&nbsp;II]]
7859 !! html
7860 <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>
7861 </p>
7862 !! end
7863
7864 !! test
7865 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7866 !! options
7867 parsoid=html2wt
7868 !! html
7869 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7870 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7871 !! wikitext
7872 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7873
7874 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7875 !! end
7876
7877 !! test
7878 Parsoid: handle constructor well
7879 !! wikitext
7880 [[constructor]]
7881
7882 [[constructor:foo]]
7883 !! html/php
7884 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7885 </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>
7886 </p>
7887 !! html/parsoid
7888 <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>
7889
7890 <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>
7891 !! end
7892
7893 !! article
7894 ko:
7895 !! text
7896 Test.
7897 !! endarticle
7898
7899 # Note that `ko` isn't a known interlanguage prefix
7900 !! test
7901 Parsoid: recognize interlanguage links without a target page
7902 !! options
7903 ill
7904 !! wikitext
7905 [[es:]]
7906
7907 [[ko:]]
7908 !! html/php
7909 es:
7910 !! html/parsoid
7911 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7912
7913 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7914 !! end
7915
7916 # Note that `ko` isn't a known interwiki prefix
7917 !! test
7918 Parsoid: recognize interwiki links without a target page
7919 !! options
7920 parsoid=wt2html,wt2wt,html2html
7921 !! wikitext
7922 [[:es:]]
7923
7924 [[:ko:]]
7925 !! html/php
7926 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7927 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7928 </p>
7929 !! html/parsoid
7930 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7931 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7932 !! end
7933
7934 !! test
7935 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7936 !! wikitext
7937 [[mi:Foo]]
7938 !! html/php
7939 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7940 </p>
7941 !! html/parsoid
7942 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7943 !! end
7944
7945 !! test
7946 Interlanguage link with preceding local interwiki link (bug 68085)
7947 !! options
7948 parsoid=wt2html,wt2wt,html2html
7949 !! wikitext
7950 Blah blah blah
7951 [[local:es:Spanish]]
7952 !! html/php
7953 <p>Blah blah blah
7954 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7955 </p>
7956 !! html/parsoid
7957 <p>Blah blah blah
7958 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7959 !! end
7960
7961 !! test
7962 Looks like an interlanguage link, but is actually a local interwiki
7963 !! options
7964 parsoid=wt2html,wt2wt,html2html
7965 !! wikitext
7966 Blah blah blah
7967 [[mi:Template:Foo]]
7968 !! html/php
7969 <p>Blah blah blah
7970 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7971 </p>
7972 !! html/parsoid
7973 <p>Blah blah blah
7974 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7975 !! end
7976
7977 ###
7978 ### Redirects, Parsoid-only
7979 ###
7980
7981 !! test
7982 1. Simple redirect to page
7983 !! wikitext
7984 #REDIRECT [[Main Page]]
7985 !! html/parsoid
7986 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
7987 !! end
7988
7989 !! test
7990 2. Other redirect variants
7991 !! wikitext
7992 #REDIRECT [[Main_Page]]
7993 !! html/parsoid
7994 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
7995 !! end
7996
7997 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
7998 # This tests the Parsoid bail-out code.
7999 !! test
8000 3. Other redirect variants
8001 !! wikitext
8002 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8003 !! html/parsoid
8004 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8005 !! end
8006
8007 !! test
8008 4. Redirect to a templated destination
8009 !! wikitext
8010 #REDIRECT [[{{echo|Foo}}bar]]
8011 !! html/parsoid
8012 <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"}]]}'/>
8013 !! end
8014
8015 !! test
8016 Empty redirect
8017 !! options
8018 parsoid=wt2html,wt2wt
8019 !! wikitext
8020 #REDIRECT [[]]
8021 !! html/parsoid
8022 <ol>
8023 <li>REDIRECT [[]]</li></ol>
8024 !! end
8025
8026 !! test
8027 Optional colon in #REDIRECT
8028 !! options
8029 # the colon is archaic syntax. we support it for wt2html, but we
8030 # don't care that it roundtrips back to the modern syntax.
8031 parsoid=wt2html,html2html
8032 !! wikitext
8033 #REDIRECT:[[Main Page]]
8034 !! html/parsoid
8035 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8036 !! end
8037
8038 !! test
8039 Whitespace in #REDIRECT with optional colon
8040 !! options
8041 # the colon and gratuitous whitespace is archaic syntax. we support
8042 # it for wt2html, but we don't care that it roundtrips back to the
8043 # modern syntax (without extra whitespace)
8044 parsoid=wt2html,html2html
8045 !! wikitext
8046
8047 #REDIRECT
8048 :
8049 [[Main Page]]
8050 !! html/parsoid
8051 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8052 !! end
8053
8054 !! test
8055 Piped link in #REDIRECT
8056 !! options
8057 # content after piped link is ignored. we support this syntax,
8058 # but don't care that the piped link is lost when we roundtrip this.
8059 parsoid=wt2html
8060 !! wikitext
8061 #REDIRECT [[Main Page|bar]]
8062 !! html/parsoid
8063 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8064 !! end
8065
8066 !! test
8067 Redirect to category (T104502)
8068 !! options
8069 parsoid=wt2html,wt2wt
8070 !! wikitext
8071 #REDIRECT [[Category:Foo]]
8072 !! html/parsoid
8073 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8074 !! end
8075
8076 !! test
8077 Redirect to category with URL encoding (T104502)
8078 !! options
8079 parsoid=wt2html
8080 !! wikitext
8081 #REDIRECT [[Category%3AFoo]]
8082 !! html/parsoid
8083 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8084 !! end
8085
8086 !! test
8087 Redirect to category page
8088 !! wikitext
8089 #REDIRECT [[:Category:Foo]]
8090 !! html/parsoid
8091 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8092 !! end
8093
8094 !! test
8095 Redirect to image page (1)
8096 !! wikitext
8097 #REDIRECT [[File:Wiki.png]]
8098 !! html/parsoid
8099 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8100 !! end
8101
8102 !! test
8103 Redirect to image page (2)
8104 !! wikitext
8105 #REDIRECT [[Image:Wiki.png]]
8106 !! html/parsoid
8107 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8108 !! end
8109
8110 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8111 # Next test confirms this.
8112 !! test
8113 Redirect to language (1) (T104918)
8114 !! options
8115 parsoid=wt2html,wt2wt,html2html
8116 !! wikitext
8117 #REDIRECT [[en:File:Wiki.png]]
8118 !! html/parsoid
8119 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8120 !! end
8121
8122 !! test
8123 Redirect to language (2) (T104918)
8124 !! wikitext
8125 #REDIRECT [[:en:File:Wiki.png]]
8126 !! html/parsoid
8127 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8128 !! end
8129
8130 !! test
8131 Redirect to interwiki (T104918)
8132 !! wikitext
8133 #REDIRECT [[meatball:File:Wiki.png]]
8134 !! html/parsoid
8135 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8136 !! end
8137
8138 !! test
8139 Non-English #REDIRECT
8140 !! options
8141 language=is
8142 !! wikitext
8143 #TILVÍSUN [[Main Page]]
8144 !! html/parsoid
8145 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8146 !! end
8147
8148 !! test
8149 Redirect syntax under text isn't considered a redirect
8150 !! wikitext
8151 some text
8152 #redirect [[Main Page]]
8153 !! html/parsoid
8154 <p>some text</p>
8155 <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>
8156 !! end
8157
8158 # FIXME: Should hoist the redirect to the top of the page and ensure there
8159 # is only one.
8160 !! test
8161 New redirect
8162 !! options
8163 parsoid=html2wt
8164 !! html/parsoid
8165 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8166 !! wikitext
8167 Foo
8168 #REDIRECT [[Foo]]
8169 !! end
8170
8171 ##
8172 ## XHTML tidiness
8173 ###
8174
8175 !! test
8176 <br> to <br />
8177 !! wikitext
8178 1<br>2<br />3
8179 !! html
8180 <p>1<br />2<br />3
8181 </p>
8182 !! end
8183
8184 !! test
8185 Broken br tag sanitization
8186 !! wikitext
8187 </br>
8188 !! html/php
8189 <p>&lt;/br&gt;
8190 </p>
8191 !! end
8192
8193 # TODO: Fix html2html mode (bug 51055)!
8194 !! test
8195 Parsoid: Broken br tag recognition
8196 !! options
8197 parsoid=wt2html
8198 !! wikitext
8199 </br>
8200
8201 <br/ >
8202 !! html+tidy
8203 <p><br /></p>
8204 <p><br /></p>
8205 !! end
8206
8207 !! test
8208 Incorrecly removing closing slashes from correctly formed XHTML
8209 !! wikitext
8210 <br style="clear:both;" />
8211 !! html
8212 <p><br style="clear:both;" />
8213 </p>
8214 !! end
8215
8216 !! test
8217 Failing to transform badly formed HTML into correct XHTML
8218 !! wikitext
8219 <br style="clear: left;">
8220 <br style="clear: right;">
8221 <br style="clear: both;">
8222 !! html
8223 <p><br style="clear: left;" />
8224 <br style="clear: right;" />
8225 <br style="clear: both;" />
8226 </p>
8227 !!end
8228
8229 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8230 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8231 !! test
8232 Handling html with a div self-closing tag
8233 !! wikitext
8234 <div title />
8235 <div title/>
8236 <div title/ >
8237 <div title=bar />
8238 <div title=bar/>
8239 <div title=bar/ >
8240 !! html/php
8241 <p>&lt;div title /&gt;
8242 &lt;div title/&gt;
8243 </p>
8244 <div>
8245 <p>&lt;div title=bar /&gt;
8246 &lt;div title=bar/&gt;
8247 </p>
8248 <div title="bar/"></div>
8249 </div>
8250
8251 !! html/parsoid
8252 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8253 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8254 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8255 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8256 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8257 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8258 !! end
8259
8260 !! test
8261 Handling html with a br self-closing tag
8262 !! wikitext
8263 <br title />
8264 <br title/>
8265 <br title/ >
8266 <br title=bar />
8267 <br title=bar/>
8268 <br title=bar/ >
8269 !! html/php
8270 <p><br title="title" />
8271 <br title="title" />
8272 <br />
8273 <br title="bar" />
8274 <br title="bar" />
8275 <br title="bar/" />
8276 </p>
8277 !! html/parsoid
8278 <p><br title="" />
8279 <br title="" />
8280 <br title="" />
8281 <br title="bar" />
8282 <br title="bar" />
8283 <br title="bar/" />
8284 </p>
8285 !! end
8286
8287 !! test
8288 Horizontal ruler (should it add that extra space?)
8289 !! wikitext
8290 <hr>
8291 <hr >
8292 foo <hr
8293 > bar
8294 !! html+tidy
8295 <hr />
8296 <hr />
8297 <p>foo</p>
8298 <hr />
8299 <p>bar</p>
8300 !! end
8301
8302 !! test
8303 Horizontal ruler -- 4+ dashes render hr
8304 !! wikitext
8305 ----
8306 !! html
8307 <hr />
8308
8309 !! end
8310
8311 !! test
8312 Horizontal ruler -- eats additional dashes on the same line
8313 !! wikitext
8314 ---------
8315 !! html
8316 <hr />
8317
8318 !! end
8319
8320 !! test
8321 Horizontal ruler -- does not collapse dashes on consecutive lines
8322 !! wikitext
8323 ----
8324 ----
8325 !! html
8326 <hr />
8327 <hr />
8328
8329 !! end
8330
8331 !! test
8332 Horizontal ruler -- <4 dashes render as plain text
8333 !! wikitext
8334 ---
8335 !! html
8336 <p>---
8337 </p>
8338 !! end
8339
8340 !! test
8341 Horizontal ruler -- Supports content following dashes on same line
8342 !! wikitext
8343 ---- Foo
8344 !! html
8345 <hr /> Foo
8346
8347 !! html+tidy
8348 <hr />
8349 <p>Foo</p>
8350 !! end
8351
8352 ###
8353 ### Block-level elements
8354 ###
8355 !! test
8356 Common list
8357 !! wikitext
8358 *Common list
8359 * item 2
8360 *item 3
8361 !! html
8362 <ul><li>Common list</li>
8363 <li> item 2</li>
8364 <li>item 3</li></ul>
8365
8366 !! end
8367
8368 !! test
8369 Numbered list
8370 !! wikitext
8371 #Numbered list
8372 #item 2
8373 # item 3
8374 !! html
8375 <ol><li>Numbered list</li>
8376 <li>item 2</li>
8377 <li> item 3</li></ol>
8378
8379 !! end
8380
8381 !! test
8382 Mixed list
8383 !! wikitext
8384 *Mixed list
8385 *# with numbers
8386 ** and bullets
8387 *# and numbers
8388 *bullets again
8389 **bullet level 2
8390 ***bullet level 3
8391 ***#Number on level 4
8392 **bullet level 2
8393 **#Number on level 3
8394 **#Number on level 3
8395 *#number level 2
8396 *Level 1
8397 *** Level 3
8398 #** Level 3, but ordered
8399 !! html
8400 <ul><li>Mixed list
8401 <ol><li> with numbers</li></ol>
8402 <ul><li> and bullets</li></ul>
8403 <ol><li> and numbers</li></ol></li>
8404 <li>bullets again
8405 <ul><li>bullet level 2
8406 <ul><li>bullet level 3
8407 <ol><li>Number on level 4</li></ol></li></ul></li>
8408 <li>bullet level 2
8409 <ol><li>Number on level 3</li>
8410 <li>Number on level 3</li></ol></li></ul>
8411 <ol><li>number level 2</li></ol></li>
8412 <li>Level 1
8413 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8414 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8415
8416 !! end
8417
8418 !! test
8419 Nested lists 1
8420 !! wikitext
8421 *foo
8422 **bar
8423 !! html
8424 <ul><li>foo
8425 <ul><li>bar</li></ul></li></ul>
8426
8427 !! end
8428
8429 !! test
8430 Nested lists 2
8431 !! wikitext
8432 **foo
8433 *bar
8434 !! html
8435 <ul><li><ul><li>foo</li></ul></li>
8436 <li>bar</li></ul>
8437
8438 !! end
8439
8440 !! test
8441 Nested lists 3 (first element empty)
8442 !! wikitext
8443 *
8444 **bar
8445 !! html
8446 <ul><li>
8447 <ul><li>bar</li></ul></li></ul>
8448
8449 !! end
8450
8451 !! test
8452 Nested lists 4 (first element empty)
8453 !! wikitext
8454 **
8455 *bar
8456 !! html
8457 <ul><li><ul><li></li></ul></li>
8458 <li>bar</li></ul>
8459
8460 !! end
8461
8462 !! test
8463 Nested lists 5 (both elements empty)
8464 !! wikitext
8465 **
8466 *
8467 !! html
8468 <ul><li><ul><li></li></ul></li>
8469 <li></li></ul>
8470
8471 !! end
8472
8473 !! test
8474 Nested lists 6 (both elements empty)
8475 !! wikitext
8476 *
8477 **
8478 !! html
8479 <ul><li>
8480 <ul><li></li></ul></li></ul>
8481
8482 !! end
8483
8484 !! test
8485 Nested lists 7 (skip initial nesting levels)
8486 !! wikitext
8487 *** foo
8488 !! html
8489 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8490
8491 !! end
8492
8493 !! test
8494 Nested lists 8 (multiple nesting transitions)
8495 !! wikitext
8496 * foo
8497 *** bar
8498 ** baz
8499 * boo
8500 !! html
8501 <ul><li> foo
8502 <ul><li><ul><li> bar</li></ul></li>
8503 <li> baz</li></ul></li>
8504 <li> boo</li></ul>
8505
8506 !! end
8507
8508 !! test
8509 Nested lists 9 (extension interaction)
8510 !! options
8511 parsoid
8512 !! wikitext
8513 *<references />
8514 !! html/parsoid
8515 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8516 !! end
8517
8518 !! test
8519 1. Lists with start-of-line-transparent tokens before bullets: Comments
8520 !! wikitext
8521 *foo
8522 *<!--cmt-->bar
8523 <!--cmt-->*baz
8524 !! html
8525 <ul><li>foo</li>
8526 <li>bar</li>
8527 <li>baz</li></ul>
8528
8529 !! end
8530
8531 !! test
8532 2. Lists with start-of-line-transparent tokens before bullets: Template close
8533 !! wikitext
8534 *foo {{echo|bar
8535 }}*baz
8536 !! html
8537 <ul><li>foo bar</li>
8538 <li>baz</li></ul>
8539
8540 !! end
8541
8542 !! test
8543 List items are not parsed correctly following a <pre> block (bug 785)
8544 !! wikitext
8545 * <pre>foo</pre>
8546 * <pre>bar</pre>
8547 * zar
8548 !! html/php
8549 <ul><li> <pre>foo</pre></li>
8550 <li> <pre>bar</pre></li>
8551 <li> zar</li></ul>
8552
8553 !! html/parsoid
8554 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8555 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8556 <li> zar</li></ul>
8557 !! end
8558
8559 !! test
8560 List items from template
8561 !! wikitext
8562
8563 {{inner list}}
8564 * item 2
8565
8566 * item 0
8567 {{inner list}}
8568 * item 2
8569
8570 * item 0
8571 * notSOL{{inner list}}
8572 * item 2
8573 !! html
8574 <ul><li> item 1</li>
8575 <li> item 2</li></ul>
8576 <ul><li> item 0</li>
8577 <li> item 1</li>
8578 <li> item 2</li></ul>
8579 <ul><li> item 0</li>
8580 <li> notSOL</li>
8581 <li> item 1</li>
8582 <li> item 2</li></ul>
8583
8584 !! end
8585
8586 !! test
8587 List interrupted by empty line or heading
8588 !! wikitext
8589 * foo
8590
8591 ** bar
8592 == A heading ==
8593 * Another list item
8594 !! html
8595 <ul><li> foo</li></ul>
8596 <ul><li><ul><li> bar</li></ul></li></ul>
8597 <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>
8598 <ul><li> Another list item</li></ul>
8599
8600 !!end
8601
8602 !!test
8603 Multiple list tags generated by templates
8604 !! wikitext
8605 {{echo|<li>}}a
8606 {{echo|<li>}}b
8607 {{echo|<li>}}c
8608 !! html
8609 <li>a
8610 <li>b
8611 <li>c</li>
8612 </li>
8613 </li>
8614
8615 !! html+tidy
8616 <ul>
8617 <li>a</li>
8618 <li>b</li>
8619 <li>c</li>
8620 </ul>
8621 !!end
8622
8623 !!test
8624 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8625 !! wikitext
8626 *a
8627 <!--This line will NOT split the list-->
8628 *b
8629 <!--This line will NOT split the list either-->
8630 *c
8631 <!--foo--> <!----> <!--This line NOT split the list either-->
8632 *d
8633 !! html
8634 <ul><li>a</li>
8635 <li>b</li>
8636 <li>c</li>
8637 <li>d</li></ul>
8638
8639 !!end
8640
8641 !!test
8642 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8643 !! wikitext
8644 *a
8645 <!--This line will NOT split the list-->
8646 *b
8647 <!--This line will NOT split the list either-->
8648 *c
8649 <!--foo--> <!----> <!--This line NOT split the list
8650 either-->
8651 *d
8652 !! html
8653 <ul><li>a</li>
8654 <li>b</li>
8655 <li>c</li>
8656 <li>d</li></ul>
8657
8658 !!end
8659
8660 !!test
8661 Test the li-hack
8662 (The PHP parser relies on Tidy for the hack)
8663 !!options
8664 parsoid=wt2html,wt2wt
8665 !! wikitext
8666 * foo
8667 * <li>li-hack
8668 * {{echo|<li>templated li-hack}}
8669 * <!--foo--> <li> unsupported li-hack with preceding comments
8670
8671 <ul>
8672 <li><li>not a li-hack
8673 </li>
8674 </ul>
8675 !! html+tidy
8676 <ul>
8677 <li>foo</li>
8678 <li>li-hack</li>
8679 <li>templated li-hack</li>
8680 <li>unsupported li-hack with preceding comments</li>
8681 </ul>
8682 <ul>
8683 <li>not a li-hack</li>
8684 </ul>
8685 !!end
8686
8687 !! test
8688 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8689 !! options
8690 parsoid
8691 !! wikitext
8692 # foo
8693 ## bar
8694 * foo
8695 ** bar
8696 : foo
8697 :: bar
8698 !! html
8699 <ol>
8700 <li> foo<ol>
8701 <li> bar</li>
8702 </ol></li>
8703 </ol><ul>
8704 <li> foo<ul>
8705 <li> bar</li>
8706 </ul></li>
8707 </ul><dl>
8708 <dd> foo<dl>
8709 <dd> bar</dd>
8710 </dl></dd>
8711 </dl>
8712 !! end
8713
8714 !! test
8715 Parsoid: Test of whitespace serialization with Templated bullets
8716 !! options
8717 parsoid
8718 !! wikitext
8719 * {{bullet}}
8720 !! html
8721 <ul>
8722 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8723 </ul>
8724 !! end
8725
8726 # ------------------------------------------------------------------------
8727 # The next set of tests are about Parsoid's ability to handle badly nested
8728 # tags (parse, minimize scope of fixup, and roundtrip back)
8729 # ------------------------------------------------------------------------
8730
8731 !! test
8732 Unbalanced closing block tags break a list
8733 (php parser relies on Tidy to fix up)
8734 !! wikitext
8735 <div>
8736 *a</div><div>
8737 *b</div>
8738 !! html+tidy
8739 <div>
8740 <ul>
8741 <li>a</li>
8742 </ul>
8743 </div>
8744 <div>
8745 <ul>
8746 <li>b</li>
8747 </ul>
8748 </div>
8749 !! end
8750
8751 # Parsoid fails this test, but it might be tricky to support properly.
8752 # See bug 68395.
8753 !! test
8754 Unbalanced closing non-block tags don't break a list
8755 (php parser relies on Tidy to fix up)
8756 !! wikitext
8757 <span>
8758 *a</span><span>
8759 *b</span>
8760 !! html/php+tidy
8761 <ul>
8762 <li><span>a</span></li>
8763 <li><span>b</span></li>
8764 </ul>
8765 !! html/parsoid
8766 <span>
8767 <ul>
8768 <li>a<span></span>
8769 </li>
8770 <li>b
8771 </li>
8772 </ul>
8773 </span>
8774 !! end
8775
8776 !! test
8777 Unclosed formatting tags that straddle lists are closed and reopened
8778 (php parser relies on Tidy to fix up)
8779 !! options
8780 parsoid=wt2html,wt2wt,html2html
8781 !! wikitext
8782 # <s> a
8783 # b </s>
8784 !! html/php+tidy
8785 <ol>
8786 <li><s>a</s></li>
8787 <li><s>b</s></li>
8788 </ol>
8789 !! html/parsoid
8790 <ol><li> <s> a</s></li>
8791 <li><s> b </s></li></ol>
8792 !! end
8793
8794 # See bug 68395.
8795 !!test
8796 1. List embedded in a formatting tag
8797 !! wikitext
8798 <small>
8799 * foo
8800 </small>
8801 !! html/php+tidy
8802 <ul>
8803 <li><small>foo</small></li>
8804 </ul>
8805 !! html/parsoid
8806 <small>
8807 <ul>
8808 <li> foo</li>
8809 </ul>
8810 </small>
8811 !!end
8812
8813 ## Ugly Parsoid output here
8814 ## Not sure what the right output is.
8815 !!test
8816 2. List embedded in a formatting tag
8817 !! wikitext
8818 <small>
8819 *a
8820 *b</small>
8821 !! html/php+tidy
8822 <ul>
8823 <li><small>a</small></li>
8824 <li><small>b</small></li>
8825 </ul>
8826 !! html/parsoid
8827 <small></small>
8828 <ul><small>
8829 <li>a</li>
8830 </small>
8831 <li><small>b</small></li>
8832 </ul>
8833 !!end
8834
8835 # Ugly Parsoid and PHP parser output here
8836 # Not sure if we want to make this a test!
8837 #
8838 ## !!test
8839 ## 3. Unclosed formatting tags in list elements
8840 ## !! wikitext
8841 ## *<small>a
8842 ## *<small>b
8843 ## !! html/php+tidy
8844 ## <ul>
8845 ## <li><small>a</small></li>
8846 ## <li><small><small>b</small></small></li>
8847 ## </ul>
8848 ## !! html/parsoid
8849 ## <ul>
8850 ## <li><small>a</small></li>
8851 ## <small>
8852 ## <li><small>b</small></li>
8853 ## </small></ul>
8854 ## !!end
8855
8856 # This is a bug in the PHP parser + tidy combination.
8857 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8858 # and then fostered out of the table by tidy.)
8859 # We believe the Parsoid output to be correct.
8860 !! test
8861 Table with missing opening <tr> tag
8862 !! options
8863 parsoid=wt2html,wt2wt
8864 !! wikitext
8865 <table>
8866 <td>foo</td>
8867 </tr>
8868 </table>
8869 !! html+tidy
8870 <table>
8871 <tr>
8872 <td>foo</td>
8873 </tr>
8874 </table>
8875 !! end
8876
8877 ###
8878 ### Magic Words
8879 ###
8880
8881 # Note that the current date is hard-coded as
8882 # 1970-01-01T00:02:03Z (a Thursday)
8883 # when running parser tests. The timezone is also fixed to GMT, so
8884 # local date will be identical to current date.
8885
8886 !! test
8887 Magic Word: {{CURRENTDAY}}
8888 !! wikitext
8889 {{CURRENTDAY}}
8890 !! html
8891 <p>1
8892 </p>
8893 !! end
8894
8895 !! test
8896 Magic Word: {{CURRENTDAY2}}
8897 !! wikitext
8898 {{CURRENTDAY2}}
8899 !! html
8900 <p>01
8901 </p>
8902 !! end
8903
8904 !! test
8905 Magic Word: {{CURRENTDAYNAME}}
8906 !! wikitext
8907 {{CURRENTDAYNAME}}
8908 !! html
8909 <p>Thursday
8910 </p>
8911 !! end
8912
8913 !! test
8914 Magic Word: {{CURRENTDOW}}
8915 !! wikitext
8916 {{CURRENTDOW}}
8917 !! html
8918 <p>4
8919 </p>
8920 !! end
8921
8922 !! test
8923 Magic Word: {{CURRENTMONTH}}
8924 !! wikitext
8925 {{CURRENTMONTH}}
8926 !! html
8927 <p>01
8928 </p>
8929 !! end
8930
8931 !! test
8932 Magic Word: {{CURRENTMONTH1}}
8933 !! wikitext
8934 {{CURRENTMONTH1}}
8935 !! html
8936 <p>1
8937 </p>
8938 !! end
8939
8940 !! test
8941 Magic Word: {{CURRENTMONTHABBREV}}
8942 !! wikitext
8943 {{CURRENTMONTHABBREV}}
8944 !! html
8945 <p>Jan
8946 </p>
8947 !! end
8948
8949 !! test
8950 Magic Word: {{CURRENTMONTHNAME}}
8951 !! wikitext
8952 {{CURRENTMONTHNAME}}
8953 !! html
8954 <p>January
8955 </p>
8956 !! end
8957
8958 !! test
8959 Magic Word: {{CURRENTMONTHNAMEGEN}}
8960 !! wikitext
8961 {{CURRENTMONTHNAMEGEN}}
8962 !! html
8963 <p>January
8964 </p>
8965 !! end
8966
8967 !! test
8968 Magic Word: {{CURRENTTIME}}
8969 !! wikitext
8970 {{CURRENTTIME}}
8971 !! html
8972 <p>00:02
8973 </p>
8974 !! end
8975
8976 !! test
8977 Magic Word: {{CURRENTHOUR}}
8978 !! wikitext
8979 {{CURRENTHOUR}}
8980 !! html
8981 <p>00
8982 </p>
8983 !! end
8984
8985 !! test
8986 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8987 !! wikitext
8988 {{CURRENTWEEK}}
8989 !! html
8990 <p>1
8991 </p>
8992 !! end
8993
8994 !! test
8995 Magic Word: {{CURRENTYEAR}}
8996 !! wikitext
8997 {{CURRENTYEAR}}
8998 !! html
8999 <p>1970
9000 </p>
9001 !! end
9002
9003 !! test
9004 Magic Word: {{CURRENTTIMESTAMP}}
9005 !! wikitext
9006 {{CURRENTTIMESTAMP}}
9007 !! html
9008 <p>19700101000203
9009 </p>
9010 !! end
9011
9012 !! test
9013 Magic Words LOCAL (UTC)
9014 !! wikitext
9015 * {{LOCALMONTH}}
9016 * {{LOCALMONTH1}}
9017 * {{LOCALMONTHNAME}}
9018 * {{LOCALMONTHNAMEGEN}}
9019 * {{LOCALMONTHABBREV}}
9020 * {{LOCALDAY}}
9021 * {{LOCALDAY2}}
9022 * {{LOCALDAYNAME}}
9023 * {{LOCALYEAR}}
9024 * {{LOCALTIME}}
9025 * {{LOCALHOUR}}
9026 * {{LOCALWEEK}}
9027 * {{LOCALDOW}}
9028 * {{LOCALTIMESTAMP}}
9029 !! html
9030 <ul><li> 01</li>
9031 <li> 1</li>
9032 <li> January</li>
9033 <li> January</li>
9034 <li> Jan</li>
9035 <li> 1</li>
9036 <li> 01</li>
9037 <li> Thursday</li>
9038 <li> 1970</li>
9039 <li> 00:02</li>
9040 <li> 00</li>
9041 <li> 1</li>
9042 <li> 4</li>
9043 <li> 19700101000203</li></ul>
9044
9045 !! end
9046
9047 !! test
9048 Magic Word: {{FULLPAGENAME}}
9049 !! options
9050 title=[[User:Ævar Arnfjörð Bjarmason]]
9051 !! wikitext
9052 {{FULLPAGENAME}}
9053 !! html
9054 <p>User:Ævar Arnfjörð Bjarmason
9055 </p>
9056 !! end
9057
9058 !! test
9059 Magic Word: {{FULLPAGENAMEE}}
9060 !! options
9061 title=[[User:Ævar Arnfjörð Bjarmason]]
9062 !! wikitext
9063 {{FULLPAGENAMEE}}
9064 !! html
9065 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9066 </p>
9067 !! end
9068
9069 !! test
9070 Magic Word: {{TALKSPACE}}
9071 !! options
9072 title=[[User:Ævar Arnfjörð Bjarmason]]
9073 !! wikitext
9074 {{TALKSPACE}}
9075 !! html
9076 <p>User talk
9077 </p>
9078 !! end
9079
9080 !! test
9081 Magic Word: {{TALKSPACE}}, same namespace
9082 !! options
9083 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9084 !! wikitext
9085 {{TALKSPACE}}
9086 !! html
9087 <p>User talk
9088 </p>
9089 !! end
9090
9091 !! test
9092 Magic Word: {{TALKSPACE}}, main namespace
9093 !! options
9094 title=[[Parser Test]]
9095 !! wikitext
9096 {{TALKSPACE}}
9097 !! html
9098 <p>Talk
9099 </p>
9100 !! end
9101
9102 !! test
9103 Magic Word: {{TALKSPACEE}}
9104 !! options
9105 title=[[User:Ævar Arnfjörð Bjarmason]]
9106 !! wikitext
9107 {{TALKSPACEE}}
9108 !! html
9109 <p>User_talk
9110 </p>
9111 !! end
9112
9113 !! test
9114 Magic Word: {{SUBJECTSPACE}}
9115 !! options
9116 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9117 !! wikitext
9118 {{SUBJECTSPACE}}
9119 !! html
9120 <p>User
9121 </p>
9122 !! end
9123
9124 !! test
9125 Magic Word: {{SUBJECTSPACE}}, same namespace
9126 !! options
9127 title=[[User:Ævar Arnfjörð Bjarmason]]
9128 !! wikitext
9129 {{SUBJECTSPACE}}
9130 !! html
9131 <p>User
9132 </p>
9133 !! end
9134
9135 !! test
9136 Magic Word: {{SUBJECTSPACE}}, main namespace
9137 !! options
9138 title=[[Parser Test]]
9139 !! wikitext
9140 {{SUBJECTSPACE}}
9141 !! html
9142
9143 !! end
9144
9145 !! test
9146 Magic Word: {{SUBJECTSPACEE}}
9147 !! options
9148 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9149 !! wikitext
9150 {{SUBJECTSPACEE}}
9151 !! html
9152 <p>User
9153 </p>
9154 !! end
9155
9156 !! test
9157 Magic Word: {{NAMESPACE}}
9158 !! options
9159 title=[[User:Ævar Arnfjörð Bjarmason]]
9160 !! wikitext
9161 {{NAMESPACE}}
9162 !! html
9163 <p>User
9164 </p>
9165 !! end
9166
9167 !! test
9168 Magic Word: {{NAMESPACEE}}
9169 !! options
9170 title=[[User:Ævar Arnfjörð Bjarmason]]
9171 !! wikitext
9172 {{NAMESPACEE}}
9173 !! html
9174 <p>User
9175 </p>
9176 !! end
9177
9178 !! test
9179 Magic Word: {{NAMESPACENUMBER}}
9180 !! options
9181 title=[[User:Ævar Arnfjörð Bjarmason]]
9182 !! wikitext
9183 {{NAMESPACENUMBER}}
9184 !! html
9185 <p>2
9186 </p>
9187 !! end
9188
9189 !! test
9190 Magic Word: {{SUBPAGENAME}}
9191 !! options
9192 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9193 !! wikitext
9194 {{SUBPAGENAME}}
9195 !! html
9196 <p>sub ö
9197 </p>
9198 !! end
9199
9200 !! test
9201 Magic Word: {{SUBPAGENAMEE}}
9202 !! options
9203 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9204 !! wikitext
9205 {{SUBPAGENAMEE}}
9206 !! html
9207 <p>sub_%C3%B6
9208 </p>
9209 !! end
9210
9211 !! test
9212 Magic Word: {{ROOTPAGENAME}}
9213 !! options
9214 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9215 !! wikitext
9216 {{ROOTPAGENAME}}
9217 !! html
9218 <p>Ævar Arnfjörð Bjarmason
9219 </p>
9220 !! end
9221
9222 !! test
9223 Magic Word: {{ROOTPAGENAMEE}}
9224 !! options
9225 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9226 !! wikitext
9227 {{ROOTPAGENAMEE}}
9228 !! html
9229 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9230 </p>
9231 !! end
9232
9233 !! test
9234 Magic Word: {{BASEPAGENAME}}
9235 !! options
9236 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9237 !! wikitext
9238 {{BASEPAGENAME}}
9239 !! html
9240 <p>Ævar Arnfjörð Bjarmason
9241 </p>
9242 !! end
9243
9244 !! test
9245 Magic Word: {{BASEPAGENAMEE}}
9246 !! options
9247 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9248 !! wikitext
9249 {{BASEPAGENAMEE}}
9250 !! html
9251 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9252 </p>
9253 !! end
9254
9255 !! test
9256 Magic Word: {{TALKPAGENAME}}
9257 !! options
9258 title=[[User:Ævar Arnfjörð Bjarmason]]
9259 !! wikitext
9260 {{TALKPAGENAME}}
9261 !! html
9262 <p>User talk:Ævar Arnfjörð Bjarmason
9263 </p>
9264 !! end
9265
9266 !! test
9267 Magic Word: {{TALKPAGENAMEE}}
9268 !! options
9269 title=[[User:Ævar Arnfjörð Bjarmason]]
9270 !! wikitext
9271 {{TALKPAGENAMEE}}
9272 !! html
9273 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9274 </p>
9275 !! end
9276
9277 !! test
9278 Magic Word: {{SUBJECTPAGENAME}}
9279 !! options
9280 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9281 !! wikitext
9282 {{SUBJECTPAGENAME}}
9283 !! html
9284 <p>User:Ævar Arnfjörð Bjarmason
9285 </p>
9286 !! end
9287
9288 !! test
9289 Magic Word: {{SUBJECTPAGENAMEE}}
9290 !! options
9291 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9292 !! wikitext
9293 {{SUBJECTPAGENAMEE}}
9294 !! html
9295 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9296 </p>
9297 !! end
9298
9299 !! test
9300 Magic Word: {{NUMBEROFFILES}}
9301 !! wikitext
9302 {{NUMBEROFFILES}}
9303 !! html
9304 <p>5
9305 </p>
9306 !! end
9307
9308 !! test
9309 Magic Word: {{PAGENAME}}
9310 !! options
9311 title=[[User:Ævar Arnfjörð Bjarmason]]
9312 !! wikitext
9313 {{PAGENAME}}
9314 !! html
9315 <p>Ævar Arnfjörð Bjarmason
9316 </p>
9317 !! end
9318
9319 !! test
9320 Magic Word: {{PAGENAME}} with metacharacters
9321 !! options
9322 title=[['foo & bar = baz']]
9323 !! wikitext
9324 ''{{PAGENAME}}''
9325 !! html/php
9326 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9327 </p>
9328 !! html+tidy
9329 <p><i>'foo &amp; bar = baz'</i></p>
9330 !! end
9331
9332 !! test
9333 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9334 !! options
9335 title=[[*RFC 1234 http://example.com/]]
9336 !! wikitext
9337 {{PAGENAME}}
9338 !! html/php
9339 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9340 </p>
9341 !! html+tidy
9342 <p>*RFC 1234 http://example.com/</p>
9343 !! end
9344
9345 !! test
9346 Magic Word: {{PAGENAMEE}}
9347 !! options
9348 title=[[User:Ævar Arnfjörð Bjarmason]]
9349 !! wikitext
9350 {{PAGENAMEE}}
9351 !! html
9352 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9353 </p>
9354 !! end
9355
9356 !! test
9357 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9358 !! options
9359 title=[[*RFC 1234 http://example.com/]]
9360 !! wikitext
9361 {{PAGENAMEE}}
9362 !! html/php
9363 <p>&#42;RFC_1234_http&#58;//example.com/
9364 </p>
9365 !! html+tidy
9366 <p>*RFC_1234_http://example.com/</p>
9367 !! end
9368
9369 !! test
9370 Magic Word: {{REVISIONID}}
9371 !! wikitext
9372 {{REVISIONID}}
9373 !! html
9374 <p>1337
9375 </p>
9376 !! end
9377
9378 !! test
9379 Magic Word: {{SCRIPTPATH}}
9380 !! wikitext
9381 {{SCRIPTPATH}}
9382 !! html
9383 <p>/
9384 </p>
9385 !! end
9386
9387 !! test
9388 Magic Word: {{STYLEPATH}}
9389 !! wikitext
9390 {{STYLEPATH}}
9391 !! html
9392 <p>/skins
9393 </p>
9394 !! end
9395
9396 !! test
9397 Magic Word: {{SERVER}}
9398 !! wikitext
9399 {{SERVER}}
9400 !! html
9401 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9402 </p>
9403 !! end
9404
9405 !! test
9406 Magic Word: {{SERVERNAME}}
9407 !! wikitext
9408 {{SERVERNAME}}
9409 !! html
9410 <p>example.org
9411 </p>
9412 !! end
9413
9414 !! test
9415 Magic Word: {{SITENAME}}
9416 !! wikitext
9417 {{SITENAME}}
9418 !! html
9419 <p>MediaWiki
9420 </p>
9421 !! end
9422
9423 !! test
9424 Case-sensitive magic words, when cased differently, should just be template transclusions
9425 !! wikitext
9426 {{CurrentMonth}}
9427 {{currentday}}
9428 {{cURreNTweEK}}
9429 {{currentHour}}
9430 !! html
9431 <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>
9432 <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>
9433 <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>
9434 <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>
9435 </p>
9436 !! end
9437
9438 !! test
9439 Case-insensitive magic words should still work with weird casing.
9440 !! wikitext
9441 {{sErVeRNaMe}}
9442 {{LCFirst:AOEU}}
9443 {{ucFIRST:aoeu}}
9444 {{SERver}}
9445 !! html
9446 <p>example.org
9447 aOEU
9448 Aoeu
9449 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9450 </p>
9451 !! end
9452
9453 # From plwiki:PLOS_ONE
9454 !! test
9455 Parsoid: Page property magic word with magic word contents
9456 !! wikitext
9457 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9458 !! html/parsoid
9459 <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>"}]]}'/>
9460 !! end
9461
9462 !! test
9463 Parsoid: Template-generated DISPLAYTITLE
9464 !! wikitext
9465 {{{{echo|DISPLAYTITLE}}:Foo}}
9466 !! html/parsoid
9467 <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}}]}'/>
9468 !! end
9469
9470 !! test
9471 Namespace 1 {{ns:1}}
9472 !! wikitext
9473 {{ns:1}}
9474 !! html
9475 <p>Talk
9476 </p>
9477 !! end
9478
9479 !! test
9480 Namespace 1 {{ns:01}}
9481 !! wikitext
9482 {{ns:01}}
9483 !! html
9484 <p>Talk
9485 </p>
9486 !! end
9487
9488 !! test
9489 Namespace 0 {{ns:0}} (bug 4783)
9490 !! wikitext
9491 {{ns:0}}
9492 !! html
9493
9494 !! end
9495
9496 !! test
9497 Namespace 0 {{ns:00}} (bug 4783)
9498 !! wikitext
9499 {{ns:00}}
9500 !! html
9501
9502 !! end
9503
9504 !! test
9505 Namespace -1 {{ns:-1}}
9506 !! wikitext
9507 {{ns:-1}}
9508 !! html
9509 <p>Special
9510 </p>
9511 !! end
9512
9513 !! test
9514 Namespace User {{ns:User}}
9515 !! wikitext
9516 {{ns:User}}
9517 !! html
9518 <p>User
9519 </p>
9520 !! end
9521
9522 !! test
9523 Namespace User talk {{ns:User_talk}}
9524 !! wikitext
9525 {{ns:User_talk}}
9526 !! html
9527 <p>User talk
9528 </p>
9529 !! end
9530
9531 !! test
9532 Namespace User talk {{ns:uSeR tAlK}}
9533 !! wikitext
9534 {{ns:uSeR tAlK}}
9535 !! html
9536 <p>User talk
9537 </p>
9538 !! end
9539
9540 !! test
9541 Namespace File {{ns:File}}
9542 !! wikitext
9543 {{ns:File}}
9544 !! html
9545 <p>File
9546 </p>
9547 !! end
9548
9549 !! test
9550 Namespace File {{ns:Image}}
9551 !! wikitext
9552 {{ns:Image}}
9553 !! html
9554 <p>File
9555 </p>
9556 !! end
9557
9558 !! test
9559 Namespace (lang=de) Benutzer {{ns:User}}
9560 !! options
9561 language=de
9562 !! wikitext
9563 {{ns:User}}
9564 !! html
9565 <p>Benutzer
9566 </p>
9567 !! end
9568
9569 !! test
9570 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9571 !! options
9572 language=de
9573 !! wikitext
9574 {{ns:3}}
9575 !! html
9576 <p>Benutzer Diskussion
9577 </p>
9578 !! end
9579
9580
9581 !! test
9582 Urlencode
9583 !! wikitext
9584 {{urlencode:hi world?!}}
9585 {{urlencode:hi world?!|WIKI}}
9586 {{urlencode:hi world?!|PATH}}
9587 {{urlencode:hi world?!|QUERY}}
9588 !! html
9589 <p>hi+world%3F%21
9590 hi_world%3F!
9591 hi%20world%3F%21
9592 hi+world%3F%21
9593 </p>
9594 !! end
9595
9596 !! test
9597 Magic Word: prioritize type info over data-parsoid
9598 !! options
9599 parsoid=html2wt
9600 !! html/parsoid
9601 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9602 !! wikitext
9603 __FORCETOC__
9604 !! end
9605
9606 !! test
9607 Magic Word: serialize on separate line (parsoid)
9608 !! options
9609 parsoid=wt2wt,html2wt
9610 !! wikitext
9611 foo
9612 __NOTOC__
9613 bar
9614 !! html
9615 foo<meta property="mw:PageProp/notoc"/>bar
9616 !! end
9617
9618 !! test
9619 Magic Word: rt non-english wikis
9620 !! options
9621 parsoid=wt2wt
9622 language=de
9623 !! wikitext
9624 __NOEDITSECTION__
9625 !! html
9626 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9627 !! end
9628
9629 ###
9630 ### Magic links
9631 ###
9632 !! test
9633 Magic links: internal link to RFC (bug 479)
9634 !! wikitext
9635 [[RFC 123]]
9636 !! html
9637 <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>
9638 </p>
9639 !! end
9640
9641 !! test
9642 Magic links: RFC (bug 479)
9643 !! wikitext
9644 RFC 822
9645 !! html
9646 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9647 </p>
9648 !! end
9649
9650 !! test
9651 Magic links: RFC (bug 65278)
9652 !! wikitext
9653 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9654 !! html
9655 <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.
9656 </p>
9657 !! end
9658
9659 !! test
9660 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9661 !! wikitext
9662 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9663 RFC
9664 822
9665 !! html
9666 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9667 RFC
9668 822
9669 </p>
9670 !! end
9671
9672 !! test
9673 Magic links: ISBN (bug 1937)
9674 !! wikitext
9675 ISBN 0-306-40615-2
9676 !! html
9677 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9678 </p>
9679 !! end
9680
9681 !! test
9682 Magic links: ISBN (bug 65278)
9683 !! wikitext
9684 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9685 !! html/php
9686 <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.
9687 </p>
9688 !! html/parsoid
9689 <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>
9690 !! end
9691
9692 !! test
9693 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9694 !! wikitext
9695 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9696 ISBN
9697 9780316098113
9698 ISBN 978
9699 0316098113
9700 !! html
9701 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9702 ISBN
9703 9780316098113
9704 ISBN 978
9705 0316098113
9706 </p>
9707 !! end
9708
9709 !! test
9710 Magic links: PMID incorrectly converts space to underscore
9711 !! wikitext
9712 PMID 1234
9713 !! html
9714 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9715 </p>
9716 !! end
9717
9718 !! test
9719 Magic links: PMID (bug 65278)
9720 !! wikitext
9721 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9722 !! html
9723 <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.
9724 </p>
9725 !! end
9726
9727 !! test
9728 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9729 !! wikitext
9730 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9731 PMID
9732 1234
9733 !! html
9734 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9735 PMID
9736 1234
9737 </p>
9738 !! end
9739
9740 ###
9741 ### Templates
9742 ####
9743
9744 !! test
9745 Nonexistent template
9746 !! wikitext
9747 {{thistemplatedoesnotexist}}
9748 !! html
9749 <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>
9750 </p>
9751 !! end
9752
9753 !! test
9754 Template with invalid target containing tags
9755 !! wikitext
9756 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9757 !! html
9758 <p>{{a<b>b</b>|foo|a=b|a = b}}
9759 </p>
9760 !! end
9761
9762 !! test
9763 Template with invalid target containing unclosed tag
9764 !! wikitext
9765 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9766 !! html
9767 <p>{{a<b>|foo|a=b|a = b}}</b>
9768 </p>
9769 !! end
9770
9771 !! test
9772 Template with invalid target containing wikilink
9773 !! wikitext
9774 {{[[Main Page]]}}
9775 !! html/php
9776 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9777 </p>
9778 !! html/parsoid
9779 <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>
9780 !! end
9781
9782 !! test
9783 Template with just whitespace in it, bug #68421
9784 !! wikitext
9785 {{echo|{{ }}}}
9786 !! html/parsoid
9787 <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>
9788 !! end
9789
9790 !! article
9791 Template:test
9792 !! text
9793 This is a test template
9794 !! endarticle
9795
9796 !! test
9797 Simple template
9798 !! wikitext
9799 {{test}}
9800 !! html
9801 <p>This is a test template
9802 </p>
9803 !! end
9804
9805 !! test
9806 Template with explicit namespace
9807 !! wikitext
9808 {{Template:test}}
9809 !! html
9810 <p>This is a test template
9811 </p>
9812 !! end
9813
9814
9815 !! article
9816 Template:paramtest
9817 !! text
9818 This is a test template with parameter {{{param}}}
9819 !! endarticle
9820
9821 !! test
9822 Template parameter
9823 !! wikitext
9824 {{paramtest|param=foo}}
9825 !! html
9826 <p>This is a test template with parameter foo
9827 </p>
9828 !! end
9829
9830 !! article
9831 Template:paramtestnum
9832 !! text
9833 [[{{{1}}}|{{{2}}}]]
9834 !! endarticle
9835
9836 !! test
9837 Template unnamed parameter
9838 !! wikitext
9839 {{paramtestnum|Main Page|the main page}}
9840 !! html
9841 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9842 </p>
9843 !! end
9844
9845 !! article
9846 Template:templatesimple
9847 !! text
9848 (test)
9849 !! endarticle
9850
9851 !! article
9852 Template:templateredirect
9853 !! text
9854 #redirect [[Template:templatesimple]]
9855 !! endarticle
9856
9857 !! article
9858 Template:templateasargtestnum
9859 !! text
9860 {{{{{1}}}}}
9861 !! endarticle
9862
9863 !! article
9864 Template:templateasargtest
9865 !! text
9866 {{template{{{templ}}}}}
9867 !! endarticle
9868
9869 !! article
9870 Template:templateasargtest2
9871 !! text
9872 {{{{{templ}}}}}
9873 !! endarticle
9874
9875 !! test
9876 Template with template name as unnamed argument
9877 !! wikitext
9878 {{templateasargtestnum|templatesimple}}
9879 !! html
9880 <p>(test)
9881 </p>
9882 !! end
9883
9884 !! test
9885 Template with template name as argument
9886 !! wikitext
9887 {{templateasargtest|templ=simple}}
9888 !! html
9889 <p>(test)
9890 </p>
9891 !! end
9892
9893 !! test
9894 Template with template name as argument (2)
9895 !! wikitext
9896 {{templateasargtest2|templ=templatesimple}}
9897 !! html
9898 <p>(test)
9899 </p>
9900 !! end
9901
9902 !! article
9903 Template:templateasargtestdefault
9904 !! text
9905 {{{{{templ|templatesimple}}}}}
9906 !! endarticle
9907
9908 !! article
9909 Template:templa
9910 !! text
9911 '''templ'''
9912 !! endarticle
9913
9914 !! test
9915 Template with default value
9916 !! wikitext
9917 {{templateasargtestdefault}}
9918 !! html
9919 <p>(test)
9920 </p>
9921 !! end
9922
9923 !! test
9924 Template with default value (value set)
9925 !! wikitext
9926 {{templateasargtestdefault|templ=templa}}
9927 !! html
9928 <p><b>templ</b>
9929 </p>
9930 !! end
9931
9932 !! test
9933 Template redirect
9934 !! wikitext
9935 {{templateredirect}}
9936 !! html/php
9937 <p>(test)
9938 </p>
9939 !! html/parsoid
9940 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
9941 !! end
9942
9943 !! test
9944 Template with argument in separate line
9945 !! wikitext
9946 {{ templateasargtest |
9947 templ = simple }}
9948 !! html
9949 <p>(test)
9950 </p>
9951 !! end
9952
9953 !! test
9954 Template with complex template as argument
9955 !! wikitext
9956 {{paramtest|
9957 param ={{ templateasargtest |
9958 templ = simple }}}}
9959 !! html
9960 <p>This is a test template with parameter (test)
9961 </p>
9962 !! end
9963
9964 !! test
9965 Template with thumb image (with link in description)
9966 !! wikitext
9967 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9968 !! html/php
9969 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>
9970
9971 !! html+tidy
9972 <p>This is a test template with parameter</p>
9973 <div class="thumb tright">
9974 <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>
9975 <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>
9976 </div>
9977 </div>
9978 !! html/parsoid
9979 <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>
9980 !! end
9981
9982 !! article
9983 Template:complextemplate
9984 !! text
9985 {{{1}}} {{paramtest|
9986 param ={{{param}}}}}
9987 !! endarticle
9988
9989 !! test
9990 Template with complex arguments
9991 !! wikitext
9992 {{complextemplate|
9993 param ={{ templateasargtest |
9994 templ = simple }}|[[Template:complextemplate|link]]}}
9995 !! html
9996 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9997 </p>
9998 !! end
9999
10000 !! test
10001 BUG 553: link with two variables in a piped link
10002 !! wikitext
10003 {|
10004 |[[{{{1}}}|{{{2}}}]]
10005 |}
10006 !! html
10007 <table>
10008 <tr>
10009 <td>[[{{{1}}}|{{{2}}}]]
10010 </td></tr></table>
10011
10012 !! end
10013
10014 !! test
10015 Magic variable as template parameter
10016 !! wikitext
10017 {{paramtest|param={{SITENAME}}}}
10018 !! html
10019 <p>This is a test template with parameter MediaWiki
10020 </p>
10021 !! end
10022
10023 !! article
10024 Template:linktest
10025 !! text
10026 [[{{{param}}}|link]]
10027 !! endarticle
10028
10029 !! test
10030 Template parameter as link source
10031 !! wikitext
10032 {{linktest|param=Main Page}}
10033 !! html
10034 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10035 </p>
10036 !! end
10037
10038 !!article
10039 Template:paramtest2
10040 !! text
10041 including another template, {{paramtest|param={{{arg}}}}}
10042 !! endarticle
10043
10044 !! test
10045 Template passing argument to another template
10046 !! wikitext
10047 {{paramtest2|arg='hmm'}}
10048 !! html
10049 <p>including another template, This is a test template with parameter 'hmm'
10050 </p>
10051 !! end
10052
10053 !! article
10054 Template:Linktest2
10055 !! text
10056 Main Page
10057 !! endarticle
10058
10059 !! test
10060 Template as link source
10061 !! wikitext
10062 [[{{linktest2}}]]
10063
10064 [[{{linktest2}}|Main Page]]
10065
10066 [[{{linktest2}}]]Page
10067 !! html
10068 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10069 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10070 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10071 </p>
10072 !! end
10073
10074
10075 !! article
10076 Template:loop1
10077 !! text
10078 {{loop2}}
10079 !! endarticle
10080
10081 !! article
10082 Template:loop2
10083 !! text
10084 {{loop1}}
10085 !! endarticle
10086
10087 !! test
10088 Template infinite loop
10089 !! wikitext
10090 {{loop1}}
10091 !! html
10092 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10093 </p>
10094 !! end
10095
10096 !! test
10097 Template from main namespace
10098 !! wikitext
10099 {{:Main Page}}
10100 !! html
10101 <p>blah blah
10102 </p>
10103 !! end
10104
10105 !! article
10106 Template:table
10107 !! text
10108 {|
10109 | 1 || 2
10110 |-
10111 | 3 || 4
10112 |}
10113 !! endarticle
10114
10115 !! test
10116 BUG 529: Template with table, not included at beginning of line
10117 !! wikitext
10118 foo {{table}}
10119 !! html
10120 <p>foo
10121 </p>
10122 <table>
10123 <tr>
10124 <td> 1 </td>
10125 <td> 2
10126 </td></tr>
10127 <tr>
10128 <td> 3 </td>
10129 <td> 4
10130 </td></tr></table>
10131
10132 !! end
10133
10134 !! test
10135 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10136 !! wikitext
10137 foo
10138 {{table}}
10139 !! html
10140 <p>foo
10141 </p>
10142 <table>
10143 <tr>
10144 <td> 1 </td>
10145 <td> 2
10146 </td></tr>
10147 <tr>
10148 <td> 3 </td>
10149 <td> 4
10150 </td></tr></table>
10151
10152 !! end
10153
10154 !! test
10155 BUG 41: Template parameters shown as broken links
10156 !! wikitext
10157 {{{parameter}}}
10158 !! html
10159 <p>{{{parameter}}}
10160 </p>
10161 !! end
10162
10163 !! test
10164 Template with targets containing wikilinks
10165 !! wikitext
10166 {{[[foo]]}}
10167
10168 {{[[{{echo|foo}}]]}}
10169
10170 {{{{echo|[[foo}}]]}}
10171 !! html
10172 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10173 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10174 </p><p>{{[[foo}}]]
10175 </p>
10176 !! end
10177
10178 !! article
10179 Template:''
10180 !! text
10181 bar
10182 !! endarticle
10183
10184 !! test
10185 Templates: Double quotes as template target
10186 !! wikitext
10187 foo {{''}} baz
10188 !! html/php
10189 <p>foo bar baz
10190 </p>
10191 !! html/parsoid
10192 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10193 </p>
10194 !! end
10195
10196 !! article
10197 Template:MSGNW test
10198 !! text
10199 ''None'' of '''this''' should be
10200 * interpreted
10201 but rather passed unmodified
10202 {{test}}
10203 <gallery>
10204 File:Foobar.jpg
10205 </gallery>
10206 !! endarticle
10207
10208 # hmm, fix this or just deprecate msgnw and document its behavior?
10209 !! test
10210 msgnw keyword
10211 !! wikitext
10212 {{msgnw:MSGNW test}}
10213 !! html
10214 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10215 &#42; interpreted
10216 &#32;but rather passed unmodified
10217 &#123;&#123;test&#125;&#125;
10218 &#60;gallery&#62;
10219 File:Foobar.jpg
10220 &#60;/gallery&#62;
10221 </p>
10222 !! end
10223
10224 !! test
10225 int keyword
10226 !! wikitext
10227 {{int:youhavenewmessages|lots of money|not!}}
10228 !! html
10229 <p>You have lots of money (not!).
10230 </p>
10231 !! end
10232
10233 !! article
10234 Template:Includes
10235 !! text
10236 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10237 !! endarticle
10238
10239 !! test
10240 <includeonly> and <noinclude> being included
10241 !! wikitext
10242 {{Includes}}
10243 !! html
10244 <p>Foobar
10245 </p>
10246 !! end
10247
10248 !! article
10249 Template:Includes2
10250 !! text
10251 <onlyinclude>Foo</onlyinclude>bar
10252 !! endarticle
10253
10254 !! test
10255 <onlyinclude> being included
10256 !! wikitext
10257 {{Includes2}}
10258 !! html
10259 <p>Foo
10260 </p>
10261 !! end
10262
10263
10264 !! article
10265 Template:Includes3
10266 !! text
10267 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10268 !! endarticle
10269
10270 !! test
10271 <onlyinclude> and <includeonly> being included
10272 !! wikitext
10273 {{Includes3}}
10274 !! html
10275 <p>Foo
10276 </p>
10277 !! end
10278
10279 !! test
10280 <includeonly> and <noinclude> on a page
10281 !! wikitext
10282 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10283 !! html
10284 <p>Foozar
10285 </p>
10286 !! end
10287
10288 !! test
10289 Un-closed <noinclude>
10290 !! wikitext
10291 <noinclude>
10292 !! html
10293 !! end
10294
10295 !! test
10296 <onlyinclude> on a page
10297 !! wikitext
10298 <onlyinclude>Foo</onlyinclude>bar
10299 !! html
10300 <p>Foobar
10301 </p>
10302 !! end
10303
10304 !! test
10305 Un-closed <onlyinclude>
10306 !! wikitext
10307 <onlyinclude>
10308 !! html
10309 !! end
10310
10311 !!test
10312 Self-closed noinclude, includeonly, onlyinclude tags
10313 !! wikitext
10314 <noinclude />
10315 <includeonly />
10316 <onlyinclude />
10317 !! html
10318 <p><br />
10319 </p>
10320 !!end
10321
10322 !!test
10323 Unbalanced includeonly and noinclude tags
10324 !! wikitext
10325 {|
10326 |a</noinclude>
10327 |b</noinclude></noinclude>
10328 |c</noinclude></includeonly>
10329 |d</includeonly></includeonly>
10330 |}
10331 !! html
10332 <table>
10333 <tr>
10334 <td>a
10335 </td>
10336 <td>b
10337 </td>
10338 <td>c&lt;/includeonly&gt;
10339 </td>
10340 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10341 </td></tr></table>
10342
10343 !!end
10344
10345 !! article
10346 Template:Includeonly section
10347 !! text
10348 <includeonly>
10349 ==Includeonly section==
10350 </includeonly>
10351 ==Section T-1==
10352 !!endarticle
10353
10354 !! test
10355 Bug 6563: Edit link generation for section shown by <includeonly>
10356 !! wikitext
10357 {{includeonly section}}
10358 !! html
10359 <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>
10360 <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>
10361
10362 !! end
10363
10364 # Uses same input as the contents of [[Template:Includeonly section]]
10365 !! test
10366 Bug 6563: Section extraction for section shown by <includeonly>
10367 !! options
10368 section=T-2
10369 !! wikitext
10370 <includeonly>
10371 ==Includeonly section==
10372 </includeonly>
10373 ==Section T-2==
10374 !! html
10375 ==Section T-2==
10376 !! end
10377
10378 !! test
10379 Bug 6563: Edit link generation for section suppressed by <includeonly>
10380 !! wikitext
10381 <includeonly>
10382 ==Includeonly section==
10383 </includeonly>
10384 ==Section 1==
10385 !! html
10386 <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>
10387
10388 !! end
10389
10390 !! test
10391 Bug 6563: Section extraction for section suppressed by <includeonly>
10392 !! options
10393 section=1
10394 !! wikitext
10395 <includeonly>
10396 ==Includeonly section==
10397 </includeonly>
10398 ==Section 1==
10399 !! html
10400 ==Section 1==
10401 !! end
10402
10403 !! test
10404 Un-closed <includeonly>
10405 !! wikitext
10406 <includeonly>
10407 !! html
10408 !! end
10409
10410 !! test
10411 Includes and comments at SOL
10412 !! wikitext
10413 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10414
10415 <noinclude>
10416 some
10417 </noinclude>* stuff
10418 * here
10419
10420 <includeonly>can have stuff</includeonly>=== here ===
10421
10422 !! html/php
10423 <h2><span class="mw-headline" id="hu">hu</span></h2>
10424 <p>some
10425 </p>
10426 <ul><li> stuff</li>
10427 <li> here</li></ul>
10428 <h3><span class="mw-headline" id="here">here</span></h3>
10429
10430 !! html/parsoid
10431 <!-- 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>
10432
10433 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10434 <p>some</p>
10435 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10436 <li> here</li></ul>
10437
10438 <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>
10439
10440 !! end
10441
10442 # TODO: test with DOM fragment reuse!
10443 !! test
10444 Parsoid: DOM fragment reuse
10445 !! options
10446 parsoid=wt2wt,wt2html
10447 !! wikitext
10448 a{{echo|b<table></table>c}}d
10449
10450 a{{echo|b
10451 <table></table>
10452 c}}d
10453
10454 {{echo|a
10455
10456 <table></table>
10457
10458 b}}
10459 !! html
10460 <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>
10461
10462 <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">
10463 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10464 </span><p about="#mwt2">cd</p>
10465
10466 <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">
10467
10468 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10469
10470 </span><p about="#mwt3">b</p>
10471 !! end
10472
10473 !! test
10474 Parsoid: Merge double tds (bug 50603)
10475 !! options
10476 parsoid
10477 !! wikitext
10478 {|
10479 |{{echo|{{!}} foo}}
10480 |}
10481 !! html
10482 <table><tbody>
10483 <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>
10484 </tbody></table>
10485 !! end
10486
10487 !! test
10488 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10489 !! options
10490 parsoid
10491 !! wikitext
10492 {{echo|<div>}}
10493 {|
10494 |{{echo|{{!}} foo}}
10495 |}
10496 {{echo|</div>}}
10497 !! html
10498 <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}}]}'>
10499 <table><tbody>
10500 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10501 </tbody></table>
10502 </div>
10503 !! end
10504
10505 ###
10506 ### <includeonly> and <noinclude> in attributes
10507 ###
10508 !!test
10509 0. includeonly around the entire attribute
10510 !! wikitext
10511 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10512 !! html
10513 <p><span id="v2">bar</span>
10514 </p>
10515 !!end
10516
10517 !!test
10518 1. includeonly in html attr key
10519 !! wikitext
10520 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10521 !! html
10522 <p><span id="foo">bar</span>
10523 </p>
10524 !!end
10525
10526 !!test
10527 2. includeonly in html attr value
10528 !! wikitext
10529 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10530 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10531 !! html
10532 <p><span id="v1">bar</span>
10533 <span id="v1">bar</span>
10534 </p>
10535 !!end
10536
10537 !!test
10538 3. includeonly in part of an attr value
10539 !! wikitext
10540 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10541 !! html
10542 <p><span style="color:red;">bar</span>
10543 </p>
10544 !!end
10545
10546 !!test
10547 4. includeonly in table attributes
10548 !! wikitext
10549 {|
10550 |- <noinclude>
10551 |-
10552 |a
10553 </noinclude>
10554 |- <includeonly>
10555 |-
10556 |b
10557 </includeonly>
10558 |}
10559 !! html
10560 <table>
10561
10562
10563 <tr>
10564 <td>a
10565 </td></tr>
10566 </table>
10567
10568 !!end
10569
10570 ###
10571 ### Token Stream Patcher tests
10572 ###
10573 ### These tests won't always pass wt2wt and other modes because
10574 ### on serialization, the table will be output on a new line.
10575 ### For now, we are blacklisting them, and using this to test selser.
10576 ###
10577
10578 !!test
10579 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10580 !!options
10581 parsoid=wt2html,wt2wt
10582 !!wikitext
10583 {{echo|}}{| width = '100%'
10584 |foo
10585 |}
10586 !!html/parsoid
10587 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10588 <tbody><tr><td>foo</td></tr>
10589 </tbody></table>
10590 !!end
10591
10592 !!test
10593 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10594 !!options
10595 parsoid=wt2html,wt2wt
10596 !!wikitext
10597 <includeonly>a</includeonly>{| {{{b}}}
10598 |c
10599 |}
10600 !!html/parsoid
10601 <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}}}":""}}'>
10602 <tbody><tr><td>c</td></tr>
10603 </tbody></table>
10604
10605 !!end
10606
10607 ###
10608 ### Testing parsing of templates where a template arg
10609 ### has the same name as the template itself.
10610 ###
10611
10612 !! article
10613 Template:quote
10614 !! text
10615 {{{quote|{{{1}}}}}}
10616 !! endarticle
10617
10618 !!test
10619 Templates: Template Name/Arg clash: 1. Use of positional param
10620 !! wikitext
10621 {{quote|foo}}
10622 !! html
10623 <p>foo
10624 </p>
10625 !!end
10626
10627 !!test
10628 Templates: Template Name/Arg clash: 2. Use of named param
10629 !! wikitext
10630 {{quote|quote=foo}}
10631 !! html
10632 <p>foo
10633 </p>
10634 !!end
10635
10636 !!test
10637 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10638 !! wikitext
10639 {{quote|quote}}
10640 !! html
10641 <p>quote
10642 </p>
10643 !!end
10644
10645 ###
10646 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10647 ###
10648
10649 !!test
10650 Templates: 1. Simple use
10651 !! wikitext
10652 {{echo|Foo}}
10653 !! html
10654 <p>Foo
10655 </p>
10656 !!end
10657
10658 !!test
10659 Templates: 2. Inside a block tag
10660 !! wikitext
10661 <div>{{echo|Foo}}</div>
10662 <blockquote>{{echo|Foo}}</blockquote>
10663 !! html
10664 <div>Foo</div>
10665 <blockquote>Foo</blockquote>
10666
10667 !! html+tidy
10668 <div>Foo</div>
10669 <blockquote>
10670 <p>Foo</p>
10671 </blockquote>
10672 !!end
10673
10674 !!test
10675 Templates: P-wrapping: 1a. Templates on consecutive lines
10676 !! wikitext
10677 {{echo|Foo}}
10678 {{echo|bar}}
10679 !! html
10680 <p>Foo
10681 bar
10682 </p>
10683 !!end
10684
10685 !!test
10686 Templates: P-wrapping: 1b. Templates on consecutive lines
10687 !! wikitext
10688 Foo
10689
10690 {{echo|bar}}
10691 {{echo|baz}}
10692 !! html
10693 <p>Foo
10694 </p><p>bar
10695 baz
10696 </p>
10697 !!end
10698
10699 !!test
10700 Templates: P-wrapping: 1c. Templates on consecutive lines
10701 !! wikitext
10702 {{echo|Foo}}
10703 {{echo|bar}} <div>baz</div>
10704 !! html
10705 <p>Foo
10706 </p>
10707 bar <div>baz</div>
10708
10709 !! html+tidy
10710 <p>Foo</p>
10711 <p>bar</p>
10712 <div>baz</div>
10713 !! end
10714
10715 !!test
10716 Templates: P-wrapping: 1d. Template preceded by comment-only line
10717 !!options
10718 parsoid
10719 !! wikitext
10720 <!-- foo -->
10721 {{echo|Bar}}
10722 !! html
10723 <!-- foo -->
10724
10725 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10726 !!end
10727
10728 !!test
10729 Templates: Inline Text: 1. Multiple template uses
10730 !! wikitext
10731 {{echo|Foo}}bar{{echo|baz}}
10732 !! html
10733 <p>Foobarbaz
10734 </p>
10735 !!end
10736
10737 !!test
10738 Templates: Inline Text: 2. Back-to-back template uses
10739 !! wikitext
10740 {{echo|Foo}}{{echo|bar}}
10741 !! html
10742 <p>Foobar
10743 </p>
10744 !!end
10745
10746 !!test
10747 Templates: Block Tags: 1. Multiple template uses
10748 !! wikitext
10749 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10750 !! html
10751 <div>Foo</div><div>bar</div><div>baz</div>
10752
10753 !!end
10754
10755 !!test
10756 Templates: Block Tags: 2. Back-to-back template uses
10757 !! wikitext
10758 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10759 !! html
10760 <div>Foo</div><div>bar</div>
10761
10762 !!end
10763
10764 # This is an edge case relating to paragraph wrapping.
10765 !!test
10766 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10767 !! wikitext
10768 {{echo|a
10769 b</p>}}
10770 !! html/parsoid
10771 <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
10772 b</p>
10773 !!end
10774
10775 !!test
10776 Templates: Links: 1. Simple example
10777 !! wikitext
10778 {{echo|[[Foo|bar]]}}
10779 !! html
10780 <p><a href="/wiki/Foo" title="Foo">bar</a>
10781 </p>
10782 !!end
10783
10784 !!test
10785 Templates: Links: 2. Generation of link href
10786 !! wikitext
10787 [[{{echo|Foo}}|bar]]
10788 !! html
10789 <p><a href="/wiki/Foo" title="Foo">bar</a>
10790 </p>
10791 !!end
10792
10793 !!test
10794 Templates: Links: 3. Generation of part of a link href
10795 !! wikitext
10796 [[Fo{{echo|o}}|bar]]
10797
10798 [[Foo{{echo|bar}}]]
10799
10800 [[Foo{{echo|bar}}baz]]
10801
10802 [[Foo{{echo|bar}}|bar]]
10803
10804 [[:Foo{{echo|bar}}]]
10805
10806 [[:Foo{{echo|bar}}|bar]]
10807 !! html
10808 <p><a href="/wiki/Foo" title="Foo">bar</a>
10809 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10810 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10811 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10812 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10813 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10814 </p>
10815 !!end
10816
10817 !!test
10818 Templates: Links: 4. Multiple templates generating link href
10819 !! wikitext
10820 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10821 !! html
10822 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10823 </p>
10824 !!end
10825
10826 !!test
10827 Templates: Links: 5. Generation of link text
10828 !! wikitext
10829 [[Foo|{{echo|bar}}]]
10830 !! html
10831 <p><a href="/wiki/Foo" title="Foo">bar</a>
10832 </p>
10833 !!end
10834
10835 !!test
10836 Templates: Links: 5. Nested templates (only outermost template should be marked)
10837 !! wikitext
10838 {{echo|[[{{echo|Foo}}|bar]]}}
10839 !! html
10840 <p><a href="/wiki/Foo" title="Foo">bar</a>
10841 </p>
10842 !!end
10843
10844 !!test
10845 Templates: HTML Tag: 1. Generation of HTML attr. key
10846 !! wikitext
10847 <div {{echo|style}}="color:red;">foo</div>
10848 !! html
10849 <div style="color:red;">foo</div>
10850
10851 !!end
10852
10853 !!test
10854 Templates: HTML Tag: 2. Generation of HTML attr. value
10855 !! wikitext
10856 <div style={{echo|'color:red;'}}>foo</div>
10857 !! html
10858 <div style="color:red;">foo</div>
10859
10860 !!end
10861
10862 !!test
10863 Templates: HTML Tag: 3. Generation of HTML attr key and value
10864 !! wikitext
10865 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10866 !! html
10867 <div style="color:red;">foo</div>
10868
10869 !!end
10870
10871 !!test
10872 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10873 !! wikitext
10874 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10875 !! html
10876 <div title="This is a long title with just one piece templated">foo</div>
10877
10878 !!end
10879
10880 !!test
10881 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10882 !! wikitext
10883 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10884 !! html
10885 <div title="This is a long title with just one piece templated">foo</div>
10886
10887 !!end
10888
10889 !!test
10890 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10891 !! wikitext
10892 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10893 !! html
10894 <div title="This is a long title with just one piece templated">foo</div>
10895
10896 !!end
10897
10898 # SSS FIXME: While it is great we added support for all this,
10899 # do we want to make this part of the spec? Maybe we want to
10900 # deprecate this kind of usage in the future?
10901 !!test
10902 Templates: HTML Tag: 7. Generation of partial attribute key string
10903 !! wikitext
10904 <div st{{echo|yle}}="color:red;">foo</div>
10905 !! html
10906 <div style="color:red;">foo</div>
10907
10908 !!end
10909
10910 !! test
10911 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10912 !! wikitext
10913 <div {{echo|1=id="v1"}}>bar</div>
10914 !! html
10915 <div id="v1">bar</div>
10916
10917 !!end
10918
10919 !! test
10920 Templates: HTML Tag: 9. Multiple template-generated attributes
10921 !! wikitext
10922 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10923 !! html
10924 <div id="v1" title="foo">bar</div>
10925
10926 !!end
10927
10928 !! test
10929 Templates: Support for templates generating attributes and content
10930 !! wikitext
10931 {| {{mixed_attr_content_template}}
10932 |-
10933 |bar
10934 |}
10935 !! html/php
10936 <table style="color:red;" title="T48811">
10937
10938 <tr>
10939 <td>foo
10940 </td></tr>
10941 <tr>
10942 <td>bar
10943 </td></tr></table>
10944
10945 !! html/parsoid
10946 <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|}"]}'>
10947 <tbody><tr>
10948 <td>foo</td></tr>
10949 <tr>
10950 <td>bar</td></tr>
10951 </tbody></table>
10952 !!end
10953
10954 !! test
10955 1. Entities and nowikis inside templated attributes should be handled correctly
10956 !! wikitext
10957 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
10958 !! html/php
10959 <div style="background:#f9f9f9;">foo</div>
10960
10961 !! html/parsoid
10962 <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>
10963 !! end
10964
10965 !! test
10966 2. Entities and nowikis inside templated attributes should be handled correctly
10967 !! wikitext
10968 {|
10969 |{{table_attribs_3}}
10970 |}
10971 !! html/php
10972 <table>
10973 <tr>
10974 <td style="background:#f9f9f9;">Foo
10975 </td></tr></table>
10976
10977 !! html/parsoid
10978 <table>
10979 <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>
10980 </tbody></table>
10981 !! end
10982
10983 !! test
10984 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
10985 !! wikitext
10986 {{tbl-start}}
10987 |{{table_attribs_3}}
10988 {{tbl-end}}
10989 !! html/php
10990 <table>
10991 <tr>
10992 <td style="background:#f9f9f9;">Foo
10993 </td></tr></table>
10994
10995 !! html/parsoid
10996 <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}}]}'>
10997 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
10998 </tbody></table>
10999 !! end
11000
11001 !!test
11002 Templates: HTML Tables: 1. Generating start of a HTML table
11003 !! wikitext
11004 {{echo|<table><tr><td>foo</td>}}</tr></table>
11005 !! html
11006 <table><tr><td>foo</td></tr></table>
11007
11008 !!end
11009
11010 !!test
11011 Templates: HTML Tables: 2a. Generating middle of a HTML table
11012 !! wikitext
11013 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11014 !! html
11015 <table><tr><td>foo</td></tr></table>
11016
11017 !!end
11018
11019 !!test
11020 Templates: HTML Tables: 2b. Generating middle of a HTML table
11021 !! wikitext
11022 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11023 !! html
11024 <table><tr><td>foo</td></tr></table>
11025
11026 !!end
11027
11028 !!test
11029 Templates: HTML Tables: 3. Generating end of a HTML table
11030 !! wikitext
11031 <table><tr>{{echo|<td>foo</td></tr></table>}}
11032 !! html
11033 <table><tr><td>foo</td></tr></table>
11034
11035 !!end
11036
11037 !!test
11038 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11039 !! wikitext
11040 {{echo|<table>}}<tr><td>foo</td></tr></table>
11041 !! html
11042 <table><tr><td>foo</td></tr></table>
11043
11044 !!end
11045
11046 !!test
11047 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11048 !! wikitext
11049 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11050 !! html
11051 <table><tr><td>foo</td></tr></table>
11052
11053 !!end
11054
11055 !!test
11056 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11057 !! wikitext
11058 <table><tr>{{echo|<td>}}foo</td></tr></table>
11059 !! html
11060 <table><tr><td>foo</td></tr></table>
11061
11062 !!end
11063
11064 !!test
11065 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11066 !! wikitext
11067 <table><tr><td>foo{{echo|</td>}}</tr></table>
11068 !! html
11069 <table><tr><td>foo</td></tr></table>
11070
11071 !!end
11072
11073 !!test
11074 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11075 !! wikitext
11076 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11077 !! html
11078 <table><tr><td>foo</td></tr></table>
11079
11080 !!end
11081
11082 !!test
11083 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11084 !! wikitext
11085 <table><tr><td>foo</td></tr>{{echo|</table>}}
11086 !! html
11087 <table><tr><td>foo</td></tr></table>
11088
11089 !!end
11090
11091 !!test
11092 Templates: HTML Tables: 5. Proper fostering of categories from inside
11093 !!options
11094 parsoid=wt2html,wt2wt
11095 !! wikitext
11096 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11097 <!--Two categories (Bug 50330)-->
11098 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11099 !! html
11100 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11101 <!--Two categories (Bug 50330)-->
11102 <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>
11103 !!end
11104
11105 !!test
11106 Templates: Wiki Tables: 1a. Fostering of entire template content
11107 !! wikitext
11108 {|
11109 {{echo|a}}
11110 |}
11111 !! html
11112 <table>
11113 a
11114 <tr><td></td></tr></table>
11115
11116 !! html+tidy
11117 <p>a</p>
11118 <table>
11119 <tr>
11120 <td></td>
11121 </tr>
11122 </table>
11123 !! end
11124
11125 !!test
11126 Templates: Wiki Tables: 1b. Fostering of entire template content
11127 !! wikitext
11128 {|
11129 {{echo|<div>}}
11130 foo
11131 {{echo|</div>}}
11132 |}
11133 !! html
11134 <table>
11135 <div>
11136 <p>foo
11137 </p>
11138 </div>
11139 <tr><td></td></tr></table>
11140
11141 !! html+tidy
11142 <div>
11143 <p>foo</p>
11144 </div>
11145 <table>
11146 <tr>
11147 <td></td>
11148 </tr>
11149 </table>
11150 !! end
11151
11152 !!test
11153 Templates: Wiki Tables: 2. Fostering of partial template content
11154 !! wikitext
11155 {|
11156 {{echo|a
11157 <div>b</div>}}
11158 |}
11159 !! html
11160 <table>
11161 a
11162 <div>b</div>
11163 <tr><td></td></tr></table>
11164
11165 !! html+tidy
11166 <p>a</p>
11167 <div>b</div>
11168 <table>
11169 <tr>
11170 <td></td>
11171 </tr>
11172 </table>
11173 !! end
11174
11175 !!test
11176 Templates: Wiki Tables: 3. td-content via multiple templates
11177 !! wikitext
11178 {|
11179 {{echo|{{pipe}}a}}{{echo|b}}
11180 |}
11181 !! html
11182 <table>
11183 <tr>
11184 <td>ab
11185 </td></tr></table>
11186
11187 !!end
11188
11189 !!test
11190 Templates: Wiki Tables: 4. Templated tags, no content
11191 !! wikitext
11192 {{tbl-start}}
11193 {{tbl-end}}
11194 !! html
11195 <table>
11196 <tr><td></td></tr></table>
11197
11198 !!end
11199
11200 !!test
11201 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11202 !! wikitext
11203 {{tbl-start}}
11204 |foo
11205 {{tbl-end}}
11206 !! html
11207 <table>
11208 <tr>
11209 <td>foo
11210 </td></tr></table>
11211
11212 !!end
11213
11214 !!test
11215 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11216 !! wikitext
11217 {{tbl-start}}
11218 {{!}}foo
11219 {{tbl-end}}
11220 !! html
11221 <table>
11222 <tr>
11223 <td>foo
11224 </td></tr></table>
11225
11226 !!end
11227
11228 ## This test case is very specific to Parsoid's internals
11229 ## and is hence only tested for Parsoid's code. Parsoid uses
11230 ## a <meta> marker tag for <ref> tags and they are expanded
11231 ## much later. We are verifying that this <meta> tag usage
11232 ## doesn't prevent foster parenting.
11233 !!test
11234 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11235 !!wikitext
11236 {{PartialTable}}<ref>foo</ref>
11237 |}
11238
11239 <references />
11240 !!html/parsoid
11241 <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">
11242 <tbody>
11243 </tbody></table>
11244
11245 <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>
11246 !!end
11247
11248 !! test
11249 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11250 !! wikitext
11251 {{echo|
11252 {{{!}}
11253 {{!}}-}}
11254 <onlyinclude>
11255 |foo
11256 </onlyinclude>
11257 {{!}}}
11258 !! html/parsoid
11259 <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{{!}}}"]}'>
11260 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11261 <tbody><tr>
11262
11263 <td>foo
11264 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11265 </tbody></table>
11266 !! end
11267
11268 !!test
11269 Templates: Lists: Multi-line list-items via templates
11270 !! wikitext
11271 *{{echo|a {{nonexistent|
11272 unused}}}}
11273 *{{echo|b {{nonexistent|
11274 unused}}}}
11275 !! html
11276 <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>
11277 <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>
11278
11279 !!end
11280
11281 !!test
11282 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11283 !! wikitext
11284 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11285 !! html
11286 <p><i>ab</i>c<i>d</i>e
11287 </p>
11288 !!end
11289
11290 !!test
11291 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11292 (PHP parser generates misnested html)
11293 !! wikitext
11294 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11295 !! html/parsoid
11296 <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>
11297 !!end
11298
11299 !!test
11300 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11301 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11302 !! options
11303 parsoid=wt2html,wt2wt
11304 !! wikitext
11305 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11306 !! html
11307 <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>
11308 <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>
11309 <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>
11310 !!end
11311
11312 !!test
11313 Templates: Ugly nesting: 4. Divs opened/closed across templates
11314 !! wikitext
11315 a<div>b{{echo|c</div>d}}e
11316 !! html
11317 a<div>bc</div>de
11318
11319 !! html+tidy
11320 <p>a</p>
11321 <div>bc</div>
11322 <p>de</p>
11323 !! end
11324
11325 !!test
11326 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11327 (Parsoid-centric)
11328 !! options
11329 parsoid
11330 !! wikitext
11331 {|
11332 |{{echo|foo</table>}}
11333 |bar
11334 |}
11335 !! html
11336 <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|}"]}'>
11337
11338 <tbody>
11339 <tr>
11340 <td>foo</td></tr></tbody></table><span about="#mwt1">
11341 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11342 |}</span>
11343 !!end
11344
11345 !!test
11346 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11347 (Parsoid-centric)
11348 !! options
11349 parsoid
11350 !! wikitext
11351 <table>
11352 <tr>
11353 <td>
11354 <table>
11355 <tr>
11356 <td>1. {{echo|foo </table>}}</td>
11357 <td> bar </td>
11358 <td>2. {{echo|baz </table>}}</td>
11359 </tr>
11360 <tr>
11361 <td>abc</td>
11362 </tr>
11363 </table>
11364 </td>
11365 </tr>
11366 <tr>
11367 <td>xyz</td>
11368 </tr>
11369 </table>
11370 !! html
11371 <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>"]}'>
11372 <tbody><tr>
11373 <td>
11374 <table>
11375 <tbody><tr>
11376 <td>1. foo </td></tr></tbody></table></td>
11377 <td> bar </td>
11378 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11379 </span><span about="#mwt2">
11380 </span><span about="#mwt2">
11381 </span><span about="#mwt2">abc</span><span about="#mwt2">
11382 </span><span about="#mwt2">
11383 </span><span about="#mwt2">
11384 </span><span about="#mwt2">
11385 </span><span about="#mwt2">
11386 </span><span about="#mwt2">
11387 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11388 </span><span about="#mwt2">
11389 </span>
11390 !!end
11391
11392 !! test
11393 Templates: Ugly templates: 3. newline-only template parameter
11394 !! wikitext
11395 foo {{echo|
11396 }}
11397 !! html
11398 <p>foo
11399 </p>
11400 !! end
11401
11402 # This looks like a bug: a single newline triggers p/br for some reason.
11403 !! test
11404 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11405 !! wikitext
11406 {{echo|
11407 }}
11408 !! html
11409 <p><br />
11410 </p>
11411 !! end
11412
11413 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11414 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11415 !! test
11416 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11417 !! wikitext
11418 {{echo|<table>}}
11419 {{echo|<div>foo}}
11420 {{echo|</table>}}
11421 !! html/parsoid
11422 <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
11423 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11424 </table>
11425 !! end
11426
11427 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11428 # that are "identical" and generate nesting cycles in the algorithm
11429 !! test
11430 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11431 !! wikitext
11432 {{echo|<table><tr><td><table>}}
11433 {{echo|<div>}}
11434 {{echo|</div>}}
11435 !! html/parsoid
11436 <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"}'>
11437 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11438 </table></td></tr></tbody></table>
11439 !! end
11440
11441 !!test
11442 Parser Functions: 1. Simple example
11443 !! wikitext
11444 {{uc:foo}}
11445 !! html
11446 <p>FOO
11447 </p>
11448 !!end
11449
11450 !!test
11451 Parser Functions: 2. Nested use (only outermost should be marked up)
11452 !! wikitext
11453 {{uc:{{lc:FOO}}}}
11454 !! html
11455 <p>FOO
11456 </p>
11457 !!end
11458
11459 ###
11460 ### Pre-save transform tests
11461 ###
11462 !! test
11463 pre-save transform: subst:
11464 !! options
11465 PST
11466 !! wikitext
11467 {{subst:test}}
11468 !! html
11469 This is a test template
11470 !! end
11471
11472 !! test
11473 pre-save transform: normal template
11474 !! options
11475 PST
11476 !! wikitext
11477 {{test}}
11478 !! html
11479 {{test}}
11480 !! end
11481
11482 !! test
11483 pre-save transform: nonexistent template
11484 !! options
11485 PST
11486 !! wikitext
11487 {{thistemplatedoesnotexist}}
11488 !! html
11489 {{thistemplatedoesnotexist}}
11490 !! end
11491
11492
11493 !! test
11494 pre-save transform: subst magic variables
11495 !! options
11496 PST
11497 !! wikitext
11498 {{subst:SITENAME}}
11499 !! html
11500 MediaWiki
11501 !! end
11502
11503 # This is bug 89, which I fixed. -- wtm
11504 !! test
11505 pre-save transform: subst: templates with parameters
11506 !! options
11507 pst
11508 !! wikitext
11509 {{subst:paramtest|param="something else"}}
11510 !! html
11511 This is a test template with parameter "something else"
11512 !! end
11513
11514 !! article
11515 Template:nowikitest
11516 !! text
11517 <nowiki>'''not wiki'''</nowiki>
11518 !! endarticle
11519
11520 !! test
11521 pre-save transform: nowiki in subst (bug 1188)
11522 !! options
11523 pst
11524 !! wikitext
11525 {{subst:nowikitest}}
11526 !! html
11527 <nowiki>'''not wiki'''</nowiki>
11528 !! end
11529
11530
11531 !! article
11532 Template:commenttest
11533 !! text
11534 This template has <!-- a comment --> in it.
11535 !! endarticle
11536
11537 !! test
11538 pre-save transform: comment in subst (bug 1936)
11539 !! options
11540 pst
11541 !! wikitext
11542 {{subst:commenttest}}
11543 !! html
11544 This template has <!-- a comment --> in it.
11545 !! end
11546
11547 !! test
11548 pre-save transform: unclosed tag
11549 !! options
11550 pst noxml
11551 !! wikitext
11552 <nowiki>'''not wiki'''
11553 !! html
11554 <nowiki>'''not wiki'''
11555 !! end
11556
11557 !! test
11558 pre-save transform: mixed tag case
11559 !! options
11560 pst noxml
11561 !! wikitext
11562 <NOwiki>'''not wiki'''</noWIKI>
11563 !! html
11564 <NOwiki>'''not wiki'''</noWIKI>
11565 !! end
11566
11567 !! test
11568 pre-save transform: unclosed comment in <nowiki>
11569 !! options
11570 pst noxml
11571 !! wikitext
11572 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11573 !! html
11574 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11575 !!end
11576
11577 # Leading @ in this template definition works around a limitation
11578 # in parsoid's parserTests which otherwise strips the <span> from the
11579 # result (confusing it for a template wrapper)
11580 !! article
11581 Template:dangerous
11582 !!text
11583 @<span onmouseover="alert('crap')">Oh no</span>
11584 !!endarticle
11585
11586 !!test
11587 (confirming safety of fix for subst bug 1936)
11588 !! wikitext
11589 {{Template:dangerous}}
11590 !! html
11591 <p>@<span>Oh no</span>
11592 </p>
11593 !! end
11594
11595 !! test
11596 pre-save transform: comment containing gallery (bug 5024)
11597 !! options
11598 pst
11599 !! wikitext
11600 <!-- <gallery>data</gallery> -->
11601 !! html
11602 <!-- <gallery>data</gallery> -->
11603 !!end
11604
11605 !! test
11606 pre-save transform: comment containing extension
11607 !! options
11608 pst
11609 !! wikitext
11610 <!-- <tag>data</tag> -->
11611 !! html
11612 <!-- <tag>data</tag> -->
11613 !!end
11614
11615 !! test
11616 pre-save transform: comment containing nowiki
11617 !! options
11618 pst
11619 !! wikitext
11620 <!-- <nowiki>data</nowiki> -->
11621 !! html
11622 <!-- <nowiki>data</nowiki> -->
11623 !!end
11624
11625 !! test
11626 pre-save transform: <noinclude> in subst (bug 3298)
11627 !! options
11628 pst
11629 !! wikitext
11630 {{subst:Includes}}
11631 !! html
11632 Foobar
11633 !! end
11634
11635 !! test
11636 pre-save transform: <onlyinclude> in subst (bug 3298)
11637 !! options
11638 pst
11639 !! wikitext
11640 {{subst:Includes2}}
11641 !! html
11642 Foo
11643 !! end
11644
11645 !! article
11646 Template:SubstTest
11647 !!text
11648 {{<includeonly>subst:</includeonly>Includes}}
11649 !! endarticle
11650
11651 !! article
11652 Template:SafeSubstTest
11653 !! text
11654 {{<includeonly>safesubst:</includeonly>Includes}}
11655 !! endarticle
11656
11657 !! test
11658 bug 22297: safesubst: works during PST
11659 !! options
11660 pst
11661 !! wikitext
11662 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11663 !! html
11664 FoobarFoobar
11665 !! end
11666
11667 !! test
11668 bug 22297: safesubst: works during normal parse
11669 !! wikitext
11670 {{SafeSubstTest}}
11671 !! html
11672 <p>Foobar
11673 </p>
11674 !! end
11675
11676 !! test
11677 subst: does not work during normal parse
11678 !! wikitext
11679 {{SubstTest}}
11680 !! html
11681 <p>{{subst:Includes}}
11682 </p>
11683 !! end
11684
11685 !! test
11686 pre-save transform: context links ("pipe trick")
11687 !! options
11688 pst
11689 !! wikitext
11690 [[Article (context)|]]
11691 [[Bar:Article|]]
11692 [[:Bar:Article|]]
11693 [[Bar:Article (context)|]]
11694 [[:Bar:Article (context)|]]
11695 [[|Article]]
11696 [[|Article (context)]]
11697 [[Bar:X (Y) Z|]]
11698 [[:Bar:X (Y) Z|]]
11699 !! html
11700 [[Article (context)|Article]]
11701 [[Bar:Article|Article]]
11702 [[:Bar:Article|Article]]
11703 [[Bar:Article (context)|Article]]
11704 [[:Bar:Article (context)|Article]]
11705 [[Article]]
11706 [[Article (context)]]
11707 [[Bar:X (Y) Z|X (Y) Z]]
11708 [[:Bar:X (Y) Z|X (Y) Z]]
11709 !! end
11710
11711 !! test
11712 pre-save transform: context links ("pipe trick") with interwiki prefix
11713 !! options
11714 pst
11715 !! wikitext
11716 [[interwiki:Article|]]
11717 [[:interwiki:Article|]]
11718 [[interwiki:Bar:Article|]]
11719 [[:interwiki:Bar:Article|]]
11720 !! html
11721 [[interwiki:Article|Article]]
11722 [[:interwiki:Article|Article]]
11723 [[interwiki:Bar:Article|Bar:Article]]
11724 [[:interwiki:Bar:Article|Bar:Article]]
11725 !! end
11726
11727 !! test
11728 pre-save transform: context links ("pipe trick") with parens in title
11729 !! options
11730 pst title=[[Somearticle (context)]]
11731 !! wikitext
11732 [[|Article]]
11733 !! html
11734 [[Article (context)|Article]]
11735 !! end
11736
11737 !! test
11738 pre-save transform: context links ("pipe trick") with comma in title
11739 !! options
11740 pst title=[[Someplace, Somewhere]]
11741 !! wikitext
11742 [[|Otherplace]]
11743 [[Otherplace, Elsewhere|]]
11744 [[Otherplace, Elsewhere, Anywhere|]]
11745 !! html
11746 [[Otherplace, Somewhere|Otherplace]]
11747 [[Otherplace, Elsewhere|Otherplace]]
11748 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11749 !! end
11750
11751 !! test
11752 pre-save transform: context links ("pipe trick") with parens and comma
11753 !! options
11754 pst title=[[Someplace (IGNORED), Somewhere]]
11755 !! wikitext
11756 [[|Otherplace]]
11757 [[Otherplace (place), Elsewhere|]]
11758 !! html
11759 [[Otherplace, Somewhere|Otherplace]]
11760 [[Otherplace (place), Elsewhere|Otherplace]]
11761 !! end
11762
11763 !! test
11764 pre-save transform: context links ("pipe trick") with comma and parens
11765 !! options
11766 pst title=[[Who, me? (context)]]
11767 !! wikitext
11768 [[|Yes, you.]]
11769 [[Me, Myself, and I (1937 song)|]]
11770 !! html
11771 [[Yes, you. (context)|Yes, you.]]
11772 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11773 !! end
11774
11775 !! test
11776 pre-save transform: context links ("pipe trick") with namespace
11777 !! options
11778 pst title=[[Ns:Somearticle]]
11779 !! wikitext
11780 [[|Article]]
11781 !! html
11782 [[Ns:Article|Article]]
11783 !! end
11784
11785 !! test
11786 pre-save transform: context links ("pipe trick") with namespace and parens
11787 !! options
11788 pst title=[[Ns:Somearticle (context)]]
11789 !! wikitext
11790 [[|Article]]
11791 !! html
11792 [[Ns:Article (context)|Article]]
11793 !! end
11794
11795 !! test
11796 pre-save transform: context links ("pipe trick") with namespace and comma
11797 !! options
11798 pst title=[[Ns:Somearticle, Context, Whatever]]
11799 !! wikitext
11800 [[|Article]]
11801 !! html
11802 [[Ns:Article, Context, Whatever|Article]]
11803 !! end
11804
11805 !! test
11806 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11807 !! options
11808 pst title=[[Ns:Somearticle, Context (context)]]
11809 !! wikitext
11810 [[|Article]]
11811 !! html
11812 [[Ns:Article (context)|Article]]
11813 !! end
11814
11815 !! test
11816 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11817 !! options
11818 pst title=[[Ns:Somearticle (IGNORED), Context]]
11819 !! wikitext
11820 [[|Article]]
11821 !! html
11822 [[Ns:Article, Context|Article]]
11823 !! end
11824
11825 !! test
11826 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11827 !! options
11828 pst
11829 !! wikitext
11830 [[Article(context)|]]
11831 [[Bar:Article(context)|]]
11832 [[:Bar:Article(context)|]]
11833 [[|Article(context)]]
11834 [[Bar:X(Y)Z|]]
11835 [[:Bar:X(Y)Z|]]
11836 !! html
11837 [[Article(context)|Article]]
11838 [[Bar:Article(context)|Article]]
11839 [[:Bar:Article(context)|Article]]
11840 [[Article(context)]]
11841 [[Bar:X(Y)Z|X(Y)Z]]
11842 [[:Bar:X(Y)Z|X(Y)Z]]
11843 !! end
11844
11845 !! test
11846 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11847 !! options
11848 pst
11849 !! wikitext
11850 [[Article (context)|]]
11851 [[Bar:Article (context)|]]
11852 [[:Bar:Article (context)|]]
11853 [[|Article (context)]]
11854 [[Bar:X (Y) Z|]]
11855 [[:Bar:X (Y) Z|]]
11856 !! html
11857 [[Article (context)|Article]]
11858 [[Bar:Article (context)|Article]]
11859 [[:Bar:Article (context)|Article]]
11860 [[Article (context)]]
11861 [[Bar:X (Y) Z|X (Y) Z]]
11862 [[:Bar:X (Y) Z|X (Y) Z]]
11863 !! end
11864
11865 !! test
11866 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11867 !! options
11868 pst
11869 !! wikitext
11870 [[Article(context)|]]
11871 [[Bar:Article(context)|]]
11872 [[:Bar:Article(context)|]]
11873 [[|Article(context)]]
11874 [[Bar:X(Y)Z|]]
11875 [[:Bar:X(Y)Z|]]
11876 !! html
11877 [[Article(context)|Article]]
11878 [[Bar:Article(context)|Article]]
11879 [[:Bar:Article(context)|Article]]
11880 [[Article(context)]]
11881 [[Bar:X(Y)Z|X(Y)Z]]
11882 [[:Bar:X(Y)Z|X(Y)Z]]
11883 !! end
11884
11885 !! test
11886 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11887 !! options
11888 pst
11889 !! wikitext
11890 [[Article (context), context|]]
11891 [[Article (context),context|]]
11892 [[Bar:Article (context), context|]]
11893 [[Bar:Article (context),context|]]
11894 [[:Bar:Article (context), context|]]
11895 [[:Bar:Article (context),context|]]
11896 !! html
11897 [[Article (context), context|Article]]
11898 [[Article (context),context|Article]]
11899 [[Bar:Article (context), context|Article]]
11900 [[Bar:Article (context),context|Article]]
11901 [[:Bar:Article (context), context|Article]]
11902 [[:Bar:Article (context),context|Article]]
11903 !! end
11904
11905 !! test
11906 pre-save transform: trim trailing empty lines
11907 !! options
11908 pst
11909 !! wikitext
11910 Empty lines are trimmed
11911
11912
11913
11914
11915 !! html
11916 Empty lines are trimmed
11917 !! end
11918
11919 !! test
11920 pre-save transform: Signature expansion
11921 !! options
11922 pst
11923 !! wikitext
11924 * ~~~
11925 * <noinclude>~~~</noinclude>
11926 * <includeonly>~~~</includeonly>
11927 * <onlyinclude>~~~</onlyinclude>
11928 !! html
11929 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11930 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11931 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11932 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11933 !! end
11934
11935
11936 !! test
11937 pre-save transform: Signature expansion in nowiki tags (bug 93)
11938 !! options
11939 pst disabled
11940 !! wikitext
11941 Shall not expand:
11942
11943 <nowiki>~~~~</nowiki>
11944
11945 <includeonly><nowiki>~~~~</nowiki></includeonly>
11946
11947 <noinclude><nowiki>~~~~</nowiki></noinclude>
11948
11949 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11950
11951 {{subst:Foo}} shall be converted to FOO
11952
11953 As well as inside noinclude/onlyinclude
11954 <noinclude>{{subst:Foo}}</noinclude>
11955 <onlyinclude>{{subst:Foo}}</onlyinclude>
11956
11957 But not inside includeonly
11958 <includeonly>{{subst:Foo}}</includeonly>
11959 !! html
11960 Shall not expand:
11961
11962 <nowiki>~~~~</nowiki>
11963
11964 <includeonly><nowiki>~~~~</nowiki></includeonly>
11965
11966 <noinclude><nowiki>~~~~</nowiki></noinclude>
11967
11968 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11969
11970 FOO shall be converted to FOO
11971
11972 As well as inside noinclude/onlyinclude
11973 <noinclude>FOO</noinclude>
11974 <onlyinclude>FOO</onlyinclude>
11975
11976 But not inside includeonly
11977 <includeonly>{{subst:Foo}}</includeonly>
11978 !! end
11979
11980 !! test
11981 Parsoid: Recognize nowiki with trailing space in tags
11982 !! options
11983 parsoid=wt2html
11984 !! wikitext
11985 <nowiki ><div>[[foo]]</nowiki >
11986
11987 a<nowiki / >b
11988
11989 c<nowiki />d
11990
11991 e<nowiki/ >f
11992 !! html
11993 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11994 <p>ab</p>
11995 <p>cd</p>
11996 <p>ef</p>
11997 !! end
11998
11999 !! test
12000 Parsoid: Recognize nowiki with odd capitalization
12001 !! options
12002 parsoid=wt2html
12003 !! wikitext
12004 <noWikI ><div>[[foo]]</Nowiki >
12005 !! html
12006 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12007 !! end
12008
12009
12010 !! test
12011 Parsoid: Escape nowiki with trailing space in tags
12012 !! options
12013 parsoid=html2wt
12014 !! html
12015 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12016 <p>a&lt;nowiki /&gt;b</p>
12017 <p>c&lt;nowiki/ &gt;d</p>
12018 !! wikitext
12019 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12020
12021 a&lt;nowiki /&gt;b
12022
12023 c&lt;nowiki/ &gt;d
12024 !! end
12025
12026 !! test
12027 Parsoid: Escape weird noWikI capitalizations
12028 !! options
12029 parsoid=html2wt
12030 !! html
12031 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12032 !! wikitext
12033 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12034 !! end
12035
12036 ###
12037 ### Message transform tests
12038 ###
12039 !! test
12040 message transform: magic variables
12041 !! options
12042 msg
12043 !! wikitext
12044 {{SITENAME}}
12045 !! html
12046 MediaWiki
12047 !! end
12048
12049 !! test
12050 message transform: should not transform wiki markup
12051 !! options
12052 msg
12053 !! wikitext
12054 ''test''
12055 !! html
12056 ''test''
12057 !! end
12058
12059 !! test
12060 message transform: <noinclude> in transcluded template (bug 4926)
12061 !! options
12062 msg
12063 !! wikitext
12064 {{Includes}}
12065 !! html
12066 Foobar
12067 !! end
12068
12069 !! test
12070 message transform: <onlyinclude> in transcluded template (bug 4926)
12071 !! options
12072 msg
12073 !! wikitext
12074 {{Includes2}}
12075 !! html
12076 Foo
12077 !! end
12078
12079 !! test
12080 {{#special:}} page name, known
12081 !! options
12082 msg
12083 !! wikitext
12084 {{#special:Recentchanges}}
12085 !! html
12086 Special:RecentChanges
12087 !! end
12088
12089 !! test
12090 {{#special:}} page name with subpage, known
12091 !! options
12092 msg
12093 !! wikitext
12094 {{#special:Recentchanges/param}}
12095 !! html
12096 Special:RecentChanges/param
12097 !! end
12098
12099 !! test
12100 {{#special:}} page name, unknown
12101 !! options
12102 msg
12103 !! wikitext
12104 {{#special:foobar nonexistent}}
12105 !! html
12106 Special:Foobar nonexistent
12107 !! end
12108
12109 !! test
12110 {{#speciale:}} page name, known
12111 !! options
12112 msg
12113 !! wikitext
12114 {{#speciale:Recentchanges}}
12115 !! html
12116 Special:RecentChanges
12117 !! end
12118
12119 !! test
12120 {{#speciale:}} page name with subpage, known
12121 !! options
12122 msg
12123 !! wikitext
12124 {{#speciale:Recentchanges/param}}
12125 !! html
12126 Special:RecentChanges/param
12127 !! end
12128
12129 !! test
12130 {{#speciale:}} page name, unknown
12131 !! options
12132 msg
12133 !! wikitext
12134 {{#speciale:foobar nonexistent}}
12135 !! html
12136 Special:Foobar_nonexistent
12137 !! end
12138
12139 ###
12140 ### Images
12141 ###
12142 ### For Parsoid-specific tests, see
12143 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12144
12145 !! test
12146 Simple image
12147 !! options
12148 parsoid=wt2html,wt2wt,html2html
12149 !! wikitext
12150 [[Image:foobar.jpg]]
12151 !! html/php
12152 <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>
12153 </p>
12154 !! html/parsoid
12155 <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>
12156 !! end
12157
12158 !! test
12159 Simple image (using File: namespace, now canonical)
12160 !! wikitext
12161 [[File:Foobar.jpg]]
12162 !! html/php
12163 <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>
12164 </p>
12165 !! html/parsoid
12166 <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>
12167 !! end
12168
12169 !! test
12170 Right-aligned image
12171 !! wikitext
12172 [[File:Foobar.jpg|right]]
12173 !! html/php
12174 <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>
12175
12176 !! html/parsoid
12177 <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>
12178 !! end
12179
12180 !! test
12181 Image with caption
12182 !! wikitext
12183 [[File:Foobar.jpg|right|Caption text]]
12184 !! html/php
12185 <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>
12186
12187 !! html/parsoid
12188 <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>
12189 !! end
12190
12191 !! test
12192 Image with caption, bug 53312 #1
12193 !! wikitext
12194 [[File:Foobar.jpg|right|Caption page stuff]]
12195 !! html/php
12196 <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>
12197
12198 !! html/parsoid
12199 <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>
12200 !! end
12201
12202 !! test
12203 Image with caption, bug 53312 #2
12204 !! wikitext
12205 [[File:Foobar.jpg|right|Caption page=]]
12206 !! html/php
12207 <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>
12208
12209 !! html/parsoid
12210 <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>
12211 !! end
12212
12213 !! test
12214 Image with caption, bug 53312 #3
12215 !! wikitext
12216 [[File:Foobar.jpg|right|Caption page=stuff]]
12217 !! html/php
12218 <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>
12219
12220 !! html/parsoid
12221 <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>
12222 !! end
12223
12224 !! test
12225 Allow empty links in image captions (Bug 60753)
12226 !! options
12227 thumbsize=220
12228 !! wikitext
12229 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12230 [[]]
12231 [[Link2]]
12232 ]]
12233 !! html/php
12234 <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>
12235
12236 !! html/parsoid
12237 <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>
12238 [[]]
12239 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12240 </figcaption></figure>
12241 !! end
12242
12243 !! test
12244 Titles in unlinked images (T23454)
12245 !! wikitext
12246 [[File:Foobar.jpg|link=|stuff]]
12247 !! html/php
12248 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12249 </p>
12250 !! end
12251
12252 !! test
12253 Link with empty target
12254 !! wikitext
12255 [[]]
12256 !! html
12257 <p>[[]]
12258 </p>
12259 !! end
12260
12261 !! test
12262 Image with link trail
12263 !! wikitext
12264 Linktrails should not work for images: [[File:Foobar.jpg]]s
12265 !! html/php
12266 <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
12267 </p>
12268 !! html/parsoid
12269 <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>
12270 !! end
12271
12272 !! test
12273 Image with empty attribute
12274 !! options
12275 parsoid=wt2html,wt2wt,html2html
12276 !! wikitext
12277 [[File:Foobar.jpg|right||Caption text]]
12278 !! html/php
12279 <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>
12280
12281 !! html/parsoid
12282 <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>
12283 !! end
12284
12285 !! test
12286 1. Block image with individual attributes from templates
12287 !! wikitext
12288 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12289 !! html/php
12290 <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>
12291
12292 !! html/parsoid
12293 <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>
12294 !! end
12295
12296 !! test
12297 2. Block Image with individual attributes from templates
12298 !! wikitext
12299 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12300 !! html/php
12301 <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>
12302
12303 !! html/parsoid
12304 <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>
12305 !! end
12306
12307 !! test
12308 3. Inline image with individual attributes from templates
12309 !! wikitext
12310 [[File:Foobar.jpg|{{echo|50px}}]]
12311 !! html/php
12312 <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>
12313 </p>
12314 !! html/parsoid
12315 <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>
12316 !! end
12317
12318 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12319 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12320 !! test
12321 Image with multiple attributes from the same template
12322 !! wikitext
12323 [[File:Foobar.jpg|{{image_attribs}}]]
12324 !! html/php
12325 <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>
12326
12327 !! html/parsoid
12328 <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>
12329 !! end
12330
12331 !! test
12332 Image with link tails
12333 !! options
12334 thumbsize=220
12335 !! wikitext
12336 123[[File:Foobar.jpg]]456
12337 123[[File:Foobar.jpg|right]]456
12338 123[[File:Foobar.jpg|thumb]]456
12339 !! html/php
12340 <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
12341 </p>
12342 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
12343 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
12344
12345 !! html/php+tidy
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</p>
12347 <p>123</p>
12348 <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>
12349 <p>456 123</p>
12350 <div class="thumb tright">
12351 <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>
12352 <div class="thumbcaption">
12353 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12354 </div>
12355 </div>
12356 </div>
12357 <p>456</p>
12358 !! html/parsoid
12359 <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>
12360 <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>
12361 <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>
12362 !! end
12363
12364 !! test
12365 Image with multiple captions -- only last one is accepted
12366 !! wikitext
12367 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12368 !! html/php
12369 <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>
12370
12371 !! html/parsoid
12372 <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>
12373 !! end
12374
12375 !! test
12376 Image with multiple widths -- use last
12377 !! wikitext
12378 [[File:Foobar.jpg|200px|300px|caption]]
12379 !! html/php
12380 <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>
12381 </p>
12382 !! html/parsoid
12383 <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>
12384 !! end
12385
12386 !! test
12387 Image with multiple alignments -- use first (bug 48664)
12388 !! options
12389 thumbsize=220
12390 !! wikitext
12391 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12392
12393 [[File:Foobar.jpg|middle|text-top|caption]]
12394 !! html/php
12395 <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>
12396 <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>
12397 </p>
12398 !! html/parsoid
12399 <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>
12400 <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>
12401 !! end
12402
12403 !! test
12404 Image with width attribute at different positions
12405 !! wikitext
12406 [[File:Foobar.jpg|200px|right|Caption]]
12407 [[File:Foobar.jpg|right|200px|Caption]]
12408 [[File:Foobar.jpg|right|Caption|200px]]
12409 !! html/php
12410 <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>
12411 <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>
12412 <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>
12413
12414 !! html/parsoid
12415 <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>
12416 <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>
12417 <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>
12418 !! end
12419
12420 # a sad bit of backward-compatibility
12421 !! test
12422 Image with size specified with pxpx (bug 13500, 51628)
12423 !! options
12424 parsoid=wt2html,wt2wt,html2html
12425 !! wikitext
12426 [[File:Foobar.jpg|20pxpx]]
12427 [[File:Foobar.jpg|200x20pxpx]]
12428 !! html/php
12429 <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>
12430 <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>
12431 </p>
12432 !! html/parsoid
12433 <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>
12434 !! end
12435
12436 !! test
12437 Image with link parameter, wiki target
12438 !! wikitext
12439 [[File:Foobar.jpg|link=Main Page]]
12440 !! html/php
12441 <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>
12442 </p>
12443 !! html/parsoid
12444 <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>
12445 !! end
12446
12447 # parsoid bug 49293 (part 1)
12448 !! test
12449 Image with link parameter, URL target
12450 !! wikitext
12451 [[File:Foobar.jpg|link=http://example.com/]]
12452 !! html/php
12453 <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>
12454 </p>
12455 !! html/parsoid
12456 <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>
12457 !! end
12458
12459 # parsoid bug 49293 (part 2)
12460 !! test
12461 Image with link parameter, protocol-less URL target
12462 !! wikitext
12463 [[File:Foobar.jpg|link=//example.com/]]
12464 !! html/php
12465 <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>
12466 </p>
12467 !! html/parsoid
12468 <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>
12469 !! end
12470
12471 !! test
12472 Image with link parameter, wgExternalLinkTarget
12473 !! wikitext
12474 [[Image:foobar.jpg|link=http://example.com/]]
12475 !! config
12476 wgExternalLinkTarget='foobar'
12477 !! html
12478 <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>
12479 </p>
12480 !! end
12481
12482 !! test
12483 Image with link parameter, wgNoFollowLinks set to false
12484 !! wikitext
12485 [[Image:foobar.jpg|link=http://example.com/]]
12486 !! config
12487 wgNoFollowLinks=false
12488 !! html
12489 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12490 </p>
12491 !! end
12492
12493 !! test
12494 Image with link parameter, wgNoFollowDomainExceptions
12495 !! wikitext
12496 [[Image:foobar.jpg|link=http://example.com/]]
12497 !! config
12498 wgNoFollowDomainExceptions='example.com'
12499 !! html
12500 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12501 </p>
12502 !! end
12503
12504 !! test
12505 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12506 !! wikitext
12507 [[Image:foobar.jpg|link=http://example.com/|Title]]
12508 !! config
12509 wgExternalLinkTarget='foobar'
12510 !! html
12511 <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>
12512 </p>
12513 !! end
12514
12515 !! test
12516 Image with empty link parameter
12517 !! wikitext
12518 [[File:Foobar.jpg|link=]]
12519 !! html/php
12520 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12521 </p>
12522 !! html/parsoid
12523 <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>
12524 !! end
12525
12526 !! test
12527 Image with link parameter (wiki target) and unnamed parameter
12528 !! wikitext
12529 [[File:Foobar.jpg|link=Main_Page|Title]]
12530 !! html/php
12531 <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>
12532 </p>
12533 !! html/parsoid
12534 <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>
12535 !! end
12536
12537 !! test
12538 Image with link parameter (URL target) and unnamed parameter
12539 !! wikitext
12540 [[File:Foobar.jpg|link=http://example.com/|Title]]
12541 !! html/php
12542 <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>
12543 </p>
12544 !! html/parsoid
12545 <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>
12546 !! end
12547
12548 !! test
12549 Thumbnail image with link parameter
12550 !! options
12551 thumbsize=220
12552 parsoid=wt2html,wt2wt,html2html
12553 !! wikitext
12554 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12555 !! html/php
12556 <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>
12557
12558 !! html/parsoid
12559 <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>
12560 !! end
12561
12562 !! test
12563 Manually-specified thumbnail image
12564 !! options
12565 thumbsize=220
12566 !! wikitext
12567 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12568 !! html/php
12569 <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>
12570
12571 !! html/parsoid
12572 <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>
12573 !! end
12574
12575 !! test
12576 Manually-specified thumbnail image with explicit link to wiki page
12577 !! options
12578 thumbsize=220
12579 parsoid=wt2html,wt2wt,html2html
12580 !! wikitext
12581 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12582 !! html/php
12583 <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>
12584
12585 !! html/parsoid
12586 <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>
12587 !! end
12588
12589 !! test
12590 Manually-specified thumbnail image with explicit link to url
12591 !! options
12592 thumbsize=220
12593 parsoid=wt2html,wt2wt,html2html
12594 !! wikitext
12595 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12596 !! html/php
12597 <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>
12598
12599 !! html/parsoid
12600 <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>
12601 !! end
12602
12603 !! test
12604 Manually-specified thumbnail image with explicit no link
12605 !! options
12606 thumbsize=220
12607 parsoid=wt2html,wt2wt,html2html
12608 !! wikitext
12609 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12610 !! html/php
12611 <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>
12612
12613 !! html/parsoid
12614 <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>
12615 !! end
12616
12617 !! test
12618 Manually-specified thumbnail image with explicit link and alt text
12619 !! options
12620 thumbsize=220
12621 parsoid=wt2html,wt2wt,html2html
12622 !! wikitext
12623 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12624 !! html/php
12625 <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>
12626
12627 !! html/parsoid
12628 <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>
12629 !! end
12630
12631 !! test
12632 Image with frame and link
12633 !! options
12634 parsoid=wt2html,wt2wt,html2html
12635 !! wikitext
12636 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12637 !! html/php
12638 <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>
12639
12640 !! html/parsoid
12641 <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>
12642 !! end
12643
12644 !! test
12645 Image with frame and link and explicit alt
12646 !! options
12647 parsoid=wt2html,wt2wt,html2html
12648 !! wikitext
12649 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12650 !! html/php
12651 <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>
12652
12653 !! html/parsoid
12654 <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>
12655 !! end
12656
12657 !! test
12658 Image with wiki markup in implicit alt
12659 !! options
12660 parsoid=wt2html,wt2wt,html2html
12661 !! wikitext
12662 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12663
12664 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12665 !! html/php
12666 <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>
12667 </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>
12668 </p>
12669 !! html/parsoid
12670 <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>
12671 <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>
12672 !! end
12673
12674 !! test
12675 Alt image option should handle most kinds of wikitext without barfing
12676 !! wikitext
12677 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12678 !! html/php
12679 <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>
12680
12681 !! html/parsoid
12682 <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>
12683 !! end
12684
12685 ###################
12686 # Conflicting image format options.
12687 # First option specified should 'win'.
12688 # All three cases in each test should be identical.
12689
12690 !! test
12691 Image with 'frameless' first.
12692 !! options
12693 parsoid=wt2html,wt2wt,html2html
12694 !! wikitext
12695 [[File:Foobar.jpg|frameless|caption]]
12696
12697 [[File:Foobar.jpg|frameless|frame|caption]]
12698
12699 [[File:Foobar.jpg|frameless|thumb|caption]]
12700 !! html/php
12701 <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>
12702 </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>
12703 </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>
12704 </p>
12705 !! html/parsoid
12706 <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>
12707 <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>
12708 <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>
12709 !! end
12710
12711 !! test
12712 Image with 'frame' first.
12713 !! options
12714 parsoid=wt2html,wt2wt,html2html
12715 !! wikitext
12716 [[File:Foobar.jpg|frame|caption]]
12717 [[File:Foobar.jpg|frame|frameless|caption]]
12718 [[File:Foobar.jpg|frame|thumb|caption]]
12719 !! html/php
12720 <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>
12721 <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>
12722 <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>
12723
12724 !! html/parsoid
12725 <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>
12726 <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>
12727 <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>
12728 !! end
12729
12730 !! test
12731 Image with 'thumb' first.
12732 !! options
12733 parsoid=wt2html,wt2wt,html2html
12734 !! wikitext
12735 [[File:Foobar.jpg|thumb|caption]]
12736 [[File:Foobar.jpg|thumb|frameless|caption]]
12737 [[File:Foobar.jpg|thumb|frame|caption]]
12738 !! html/php
12739 <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>
12740 <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>
12741 <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>
12742
12743 !! html/parsoid
12744 <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>
12745 <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>
12746 <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>
12747 !! end
12748
12749 ###################
12750 # Image sizing.
12751 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12752 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12753 # Foobar has actual size of 1941x220
12754 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12755 # a scalable format.
12756 # 2. Framed images always ignore size options; always render at default size.
12757 # 3. "Unspecified format" and border are the only types which can be
12758 # enlarged.
12759
12760 !! test
12761 Image: "unspecified format" and border enlarge
12762 !! options
12763 parsoid=wt2html,wt2wt,html2html
12764 !! wikitext
12765 [[File:Foobar.jpg|2000px]]
12766
12767 [[File:Foobar.jpg|border|2000px]]
12768 !! html/php
12769 <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>
12770 </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>
12771 </p>
12772 !! html/parsoid
12773 <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>
12774 <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>
12775 !! end
12776
12777 !! test
12778 Image: "unspecified format" and border reduce
12779 !! options
12780 parsoid=wt2html,wt2wt,html2html
12781 !! wikitext
12782 [[File:Foobar.jpg|1000px]]
12783
12784 [[File:Foobar.jpg|border|1000px]]
12785 !! html/php
12786 <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>
12787 </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>
12788 </p>
12789 !! html/parsoid
12790 <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>
12791 <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>
12792 !! end
12793
12794 !! test
12795 Image: thumbs reduce
12796 !! options
12797 parsoid=wt2html,wt2wt,html2html
12798 !! wikitext
12799 [[File:Foobar.jpg|thumb|50px]]
12800 !! html/php
12801 <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>
12802
12803 !! html/parsoid
12804 <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>
12805 !! end
12806
12807 !! test
12808 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12809 !! options
12810 parsoid=wt2html,wt2wt,html2html
12811 !! wikitext
12812 [[File:Foobar.jpg|thumb|2000px]]
12813
12814 [[File:Foobar.svg|thumb|2000px]]
12815 !! html/php
12816 <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>
12817 <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>
12818
12819 !! html/parsoid
12820 <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>
12821 <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>
12822 !! end
12823
12824 !! test
12825 Image: frameless can reduce in size
12826 !! options
12827 parsoid=wt2html,wt2wt,html2html
12828 !! wikitext
12829 [[File:Foobar.jpg|frameless|50px]]
12830 !! html/php
12831 <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>
12832 </p>
12833 !! html/parsoid
12834 <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>
12835 !! end
12836
12837 !! test
12838 Image: bitmap frameless can't be enlarged past original size, but vector can
12839 !! options
12840 parsoid=wt2html,wt2wt,html2html
12841 !! wikitext
12842 [[File:Foobar.jpg|frameless|2000px]]
12843
12844 [[File:Foobar.svg|frameless|2000px]]
12845 !! html/php
12846 <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>
12847 </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>
12848 </p>
12849 !! html/parsoid
12850 <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>
12851 <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>
12852 !! end
12853
12854 !! test
12855 Image: framed images are always unscaled.
12856 !! options
12857 parsoid=wt2html,wt2wt,html2html
12858 !! wikitext
12859 [[File:Foobar.jpg|frame]]
12860
12861 [[File:Foobar.jpg|frame|50px]]
12862
12863 [[File:Foobar.jpg|frame|50x50px]]
12864
12865 [[File:Foobar.jpg|frame|2000px]]
12866 !! html/php
12867 <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>
12868 <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>
12869 <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>
12870 <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>
12871
12872 !! html/parsoid
12873 <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>
12874 <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>
12875 <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>
12876 <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>
12877 !! end
12878
12879 ###################
12880
12881 !! test
12882 Link to image page- image page normally doesn't exists, hence edit link
12883 Add test with existing image page
12884 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12885 !! wikitext
12886 [[:Image:test]]
12887 !! html
12888 <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>
12889 </p>
12890 !! end
12891
12892 !! test
12893 bug 18784 Link to non-existent image page with caption should use caption as link text
12894 !! wikitext
12895 [[:Image:test|caption]]
12896 !! html
12897 <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>
12898 </p>
12899 !! end
12900
12901 !! test
12902 Frameless image caption with a free URL
12903 !! wikitext
12904 [[File:Foobar.jpg|http://example.com]]
12905 !! html/php
12906 <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>
12907 </p>
12908 !! html/parsoid
12909 <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>
12910 !! end
12911
12912 !! test
12913 Thumbnail image caption with a free URL
12914 !! options
12915 thumbsize=220
12916 !! wikitext
12917 [[File:Foobar.jpg|thumb|http://example.com]]
12918 !! html/php
12919 <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>
12920
12921 !! html/parsoid
12922 <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>
12923 !! end
12924
12925 !! test
12926 Thumbnail image caption with a free URL and explicit alt
12927 !! options
12928 thumbsize=220
12929 parsoid=wt2html,wt2wt,html2html
12930 !! wikitext
12931 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12932 !! html/php
12933 <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>
12934
12935 !! html/parsoid
12936 <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>
12937 !! end
12938
12939 !! test
12940 SVG thumbnails with no language set
12941 !! options
12942 !! wikitext
12943 [[File:Foobar.svg|thumb|caption]]
12944 !! html/php
12945 <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>
12946
12947 !! html/parsoid
12948 <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>
12949 !! end
12950
12951 !! test
12952 SVG thumbnails with language de
12953 !! options
12954 parsoid=wt2html,wt2wt,html2html
12955 !! wikitext
12956 [[File:Foobar.svg|thumb|caption|lang=de]]
12957 !! html/php
12958 <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>
12959
12960 !! html/parsoid
12961 <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>
12962 !! end
12963
12964 !! test
12965 SVG thumbnails with invalid language code
12966 !! options
12967 parsoid=wt2html,wt2wt,html2html
12968 !! wikitext
12969 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12970 !! html/php
12971 <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>
12972
12973 !! html/parsoid
12974 <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>
12975 !! end
12976
12977 !! test
12978 BUG 1887: A ISBN with a thumbnail
12979 !! wikitext
12980 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12981 !! html/php
12982 <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>
12983
12984 !! html/parsoid
12985 <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>
12986 !! end
12987
12988 !! test
12989 BUG 1887: A RFC with a thumbnail
12990 !! wikitext
12991 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12992 !! html/php
12993 <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>
12994
12995 !! html/parsoid
12996 <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>
12997 !! end
12998
12999 !! test
13000 BUG 1887: A mailto link with a thumbnail
13001 !! wikitext
13002 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13003 !! html/php
13004 <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>
13005
13006 !! html/parsoid
13007 <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>
13008 !! end
13009
13010 # Pending resolution to bug 368
13011 !! test
13012 BUG 648: Frameless image caption with a link
13013 !! wikitext
13014 [[File:Foobar.jpg|text with a [[link]] in it]]
13015 !! html/php
13016 <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>
13017 </p>
13018 !! html/parsoid
13019 <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>
13020 !! end
13021
13022 !! test
13023 BUG 648: Frameless image caption with a link (suffix)
13024 !! wikitext
13025 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13026 !! html/php
13027 <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>
13028 </p>
13029 !! html/parsoid
13030 <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>
13031 !! end
13032
13033 !! test
13034 BUG 648: Frameless image caption with an interwiki link
13035 !! wikitext
13036 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13037 !! html/php
13038 <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>
13039 </p>
13040 !! html/parsoid
13041 <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>
13042 !! end
13043
13044 !! test
13045 BUG 648: Frameless image caption with a piped interwiki link
13046 !! wikitext
13047 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13048 !! html/php
13049 <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>
13050 </p>
13051 !! html/parsoid
13052 <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>
13053 !! end
13054
13055 !! test
13056 Escape HTML special chars in image alt text
13057 !! wikitext
13058 [[File:Foobar.jpg|& < > "]]
13059 !! html/php
13060 <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>
13061 </p>
13062 !! html/parsoid
13063 <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>
13064 !! end
13065
13066 !! test
13067 BUG 499: Alt text should have &#1234;, not &amp;1234;
13068 !! wikitext
13069 [[File:Foobar.jpg|&#9792;]]
13070 !! html/php
13071 <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>
13072 </p>
13073 !! html/parsoid
13074 <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>
13075 !! end
13076
13077 !! test
13078 Broken image caption with link
13079 !! options
13080 parsoid=wt2html,wt2wt,html2html
13081 !! wikitext
13082 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13083 !! html/php
13084 <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.
13085 </p>
13086 !! html/parsoid
13087 <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>
13088 !! end
13089
13090 !! test
13091 Image caption containing another image
13092 !! wikitext
13093 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13094 !! html/php
13095 <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>
13096
13097 !! html/parsoid
13098 <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>
13099 !! end
13100
13101 !! test
13102 Image: caption containing a newline
13103 !! wikitext
13104 [[File:Foobar.jpg|This
13105 *is some text]]
13106 !! html/php
13107 <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>
13108 </p>
13109 !! html/parsoid
13110 <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>
13111 !!end
13112
13113 !!test
13114 Image: caption containing leading space
13115 (The leading space should not trigger nowiki escaping in wt2wt mode)
13116 !! wikitext
13117 [[File:Foobar.jpg|thumb| bar]]
13118 !! html/php
13119 <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>
13120
13121 !! html/parsoid
13122 <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>
13123 !!end
13124
13125 !! test
13126 Image: caption containing a table
13127 !! options
13128 parsoid=wt2html,wt2wt,html2html
13129 !! wikitext
13130 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13131 {|
13132 ! Foo !! Bar
13133 |-
13134 | Foo1 || Bar1
13135 |}
13136 and some more text.]]
13137 !! html/php
13138 <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>
13139
13140 !! html/parsoid
13141 <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
13142 <table>
13143 <tbody>
13144 <tr><th>Foo </th><th>Bar</th></tr>
13145 <tr>
13146 <td>Foo1 </td>
13147 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13148 !! end
13149
13150 !! test
13151 Bug 3090: External links other than http: in image captions
13152 !! wikitext
13153 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13154 !! html/php
13155 <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>
13156
13157 !! html/parsoid
13158 <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>
13159 !! end
13160
13161 !! test
13162 Custom class
13163 !! options
13164 parsoid=wt2html,wt2wt,html2html
13165 !! wikitext
13166 [[Image:foobar.jpg|a|class=b]]
13167 !! html/php
13168 <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>
13169 </p>
13170 !! html/parsoid
13171 <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>
13172 !! end
13173
13174 !! test
13175 Localized image handling (1).
13176 !! options
13177 parsoid=wt2html,wt2wt,html2html
13178 language=es
13179 !! wikitext
13180 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13181 !! html/php
13182 <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>
13183
13184 !! html/parsoid
13185 <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>
13186 !! end
13187
13188 !! test
13189 Localized image handling (2).
13190 !! options
13191 thumbsize=220
13192 parsoid=wt2html,wt2wt,html2html
13193 language=es
13194 !! wikitext
13195 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13196 !! html/php
13197 <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>
13198
13199 !! html/parsoid
13200 <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>
13201 !! end
13202
13203 !! test
13204 "border", "frameless" and "class" attributes on an image.
13205 !! options
13206 thumbsize=220
13207 parsoid=wt2html,wt2wt,html2html
13208 !! wikitext
13209 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13210 !! html/php
13211 <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>
13212 </p>
13213 !! html/parsoid
13214 <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>
13215 !! end
13216
13217 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13218 !! test
13219 Invalid image attributes (bug 62500)
13220 !! options
13221 thumbsize=220
13222 parsoid=wt2html,wt2wt,html2html
13223 !! wikitext
13224 [[File:Foobar.jpg|thumb|float|left|caption]]
13225
13226 [[File:Foobar.jpg|thumb|righ|caption]]
13227
13228 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13229 !! html/php
13230 <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>
13231 <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>
13232 <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>
13233
13234 !! html/parsoid
13235 <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>
13236 <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>
13237 <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>
13238 !! end
13239
13240 !! article
13241 File:Barfoo.jpg
13242 !! text
13243 #REDIRECT [[File:Barfoo.jpg]]
13244 !! endarticle
13245
13246 # FIXME: Parsoid should run this test -- but we'd need to teach the
13247 # mockAPI about the redirected Barfoo.jpg image.
13248 !! test
13249 Redirected image
13250 !! wikitext
13251 [[Image:Barfoo.jpg]]
13252 !! html/php
13253 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13254 </p>
13255 !! end
13256
13257 !! test
13258 Missing image with uploads disabled
13259 !! options
13260 wgEnableUploads=0
13261 !! wikitext
13262 [[File:Foobaz.jpg]]
13263 !! html/php
13264 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13265 </p>
13266 !! html/parsoid
13267 <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>
13268 !! end
13269
13270 # Parsoid-specific testing for images
13271 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13272 # Currently imperfect due to a flaw in the Parsoid testrunner
13273 # Work in progress
13274 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13275 # image tests.
13276
13277 !! test
13278 Parsoid-specific image handling - simple image with size and middle alignment
13279 !! wikitext
13280 [[File:Foobar.jpg|middle|50px]]
13281 !! html/parsoid
13282 <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>
13283 !! end
13284
13285 !! test
13286 Parsoid-specific image handling - simple image with size, middle alignment,
13287 non-standard namespace alias
13288 !! options
13289 parsoid=wt2wt,wt2html,html2html
13290 !! wikitext
13291 [[Image:Foobar.jpg|middle|50px]]
13292 !! html/parsoid
13293 <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>
13294 !! end
13295
13296 !! test
13297 Parsoid-specific image handling - simple image with size and middle alignment
13298 (existing content)
13299 !! wikitext
13300 [[File:Foobar.jpg|50px|middle]]
13301 !! html/parsoid
13302 <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>
13303 !! end
13304
13305 !! test
13306 Parsoid-specific image handling - simple image with size and middle alignment
13307 and non-standard namespace name
13308 !! options
13309 parsoid=wt2html,wt2wt,html2html
13310 !! wikitext
13311 [[Image:Foobar.jpg|50px|middle]]
13312 !! html/parsoid
13313 <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>
13314 !! end
13315
13316 !! test
13317 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13318 !! wikitext
13319 [[File:Foobar.jpg|500x10px|baseline|caption]]
13320 !! html/parsoid
13321 <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>
13322 !! end
13323
13324 !! test
13325 Parsoid-specific image handling - simple image with border and size spec
13326 !! wikitext
13327 [[File:Foobar.jpg|50px|border|caption]]
13328 !! html/parsoid
13329 <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>
13330 !! end
13331
13332 !! test
13333 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13334 !! wikitext
13335 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13336 !! html/parsoid
13337 <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>
13338 !! end
13339
13340 !! test
13341 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13342 (existing content)
13343 !! wikitext
13344 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13345 !! html/parsoid
13346 <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>
13347 !! end
13348
13349 !! test
13350 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13351 !! wikitext
13352 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13353 !! html/parsoid
13354 <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>
13355 !! end
13356
13357 !! test
13358 Parsoid-specific image handling - thumbnail with specific size, halign,
13359 valign, and caption (existing content)
13360 !! wikitext
13361 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13362 !! html/parsoid
13363 <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>
13364 !! end
13365
13366 !! test
13367 Parsoid-specific image handling - framed image with specific size and caption
13368 (size is ignored)
13369 !! options
13370 parsoid=wt2html,wt2wt,html2html
13371 !! wikitext
13372 [[File:Foobar.jpg|frame|500x50px|caption]]
13373 !! html/parsoid
13374 <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>
13375 !! end
13376
13377 !! test
13378 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13379 (size is ignored)
13380 !! options
13381 parsoid=wt2html,wt2wt,html2html
13382 !! wikitext
13383 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13384 !! html/parsoid
13385 <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>
13386 !! end
13387
13388 !! test
13389 Parsoid-specific image handling - frameless image with specific size, border, and caption
13390 !! wikitext
13391 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13392 !! html/parsoid
13393 <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>
13394 !! end
13395
13396 !! test
13397 Parsoid-specific image handling - simple image with a formatted caption
13398 !! wikitext
13399 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13400 !! html/parsoid
13401 <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>
13402 !! end
13403
13404 !! test
13405 Parsoid-specific image handling - caption with a template in it
13406 !! wikitext
13407 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13408 !! html/parsoid
13409 <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>
13410 !! end
13411
13412 !! test
13413 Parsoid-specific image handling - caption with unbalanced tags in it
13414 !! options
13415 parsoid=wt2html,wt2wt,html2html
13416 !! wikitext
13417 foo
13418 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13419 bar
13420 !! html/parsoid
13421 <p>foo</p>
13422 <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>
13423 <p>bar</p>
13424 !! end
13425
13426 !! test
13427 Parsoid-specific image handling - empty caption (1)
13428 !! options
13429 parsoid=wt2html,wt2wt
13430 !! wikitext
13431 [[File:Foobar.jpg|thumb|]]
13432 !! html/parsoid
13433 <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>
13434 !! end
13435
13436 # empty captions don't get serialized unless we're in the "round trip" case
13437 !! test
13438 Parsoid-specific image handling - empty caption (2)
13439 !! options
13440 parsoid=html2wt
13441 !! html/parsoid
13442 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13443 <a href="./File:Foobar.jpg">
13444 <img resource="./File:Foobar.jpg"
13445 src="//example.com/images/3/3a/Foobar.jpg"
13446 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13447 height="25" width="220"/>
13448 </a>
13449 <figcaption></figcaption>
13450 </figure>
13451 !! wikitext
13452 [[File:Foobar.jpg|thumb]]
13453 !! end
13454
13455 !! test
13456 Parsoid-specific image handling - whitespace caption
13457 !! wikitext
13458 [[File:Foobar.jpg|thumb| ]]
13459 !! html/parsoid
13460 <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>
13461 !! end
13462
13463 !! test
13464 Parsoid-specific image handling - lang option
13465 !! wikitext
13466 foo
13467 [[File:Foobar.svg|lang=de|caption]]
13468 bar
13469 !! html/parsoid
13470 <p>foo
13471 <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>
13472 bar</p>
13473 !! end
13474
13475
13476 ###
13477 ### Subpages
13478 ###
13479 !! article
13480 Subpage test/subpage
13481 !! text
13482 foo
13483 !! endarticle
13484
13485 !! test
13486 Subpage link
13487 !! options
13488 subpage title=[[Subpage test]]
13489 !! wikitext
13490 [[/subpage]]
13491 !! html
13492 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13493 </p>
13494 !! end
13495
13496 !! test
13497 Subpage noslash link
13498 !! options
13499 subpage title=[[Subpage test]]
13500 !! wikitext
13501 [[/subpage/]]
13502 !! html
13503 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13504 </p>
13505 !! end
13506
13507 !! article
13508 Subpage test/1/2/subpage
13509 !! text
13510 blah
13511 !! endarticle
13512
13513 !! test
13514 Relative subpage noslash link
13515 !! options
13516 parsoid=wt2wt,wt2html,html2html
13517 subpage title=[[Subpage test/1/2/3/4]]
13518 !! wikitext
13519 [[../../subpage/]]
13520
13521 [[../../subpage]]
13522 !! html/php
13523 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13524 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13525 </p>
13526 !! html/parsoid
13527 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13528 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13529 !! end
13530
13531 !! test
13532 Parsoid: dot-slash prefixed wikilinks
13533 !! wikitext
13534 [[./foo]]
13535
13536 [[././bar]]
13537
13538 [[././baz/]]
13539 !! html/php
13540 <p>[[./foo]]
13541 </p><p>[[././bar]]
13542 </p><p>[[././baz/]]
13543 </p>
13544 !! html/parsoid
13545 <p>[[./foo]]
13546 </p><p>[[././bar]]
13547 </p><p>[[././baz/]]
13548 </p>
13549 !! end
13550
13551 !! test
13552 Render invalid page names as plain text (bug 51090)
13553 !! wikitext
13554 [[./../foo|bar]]
13555 [[foo�|bar]]
13556 [[foo/.|bar]]
13557 [[foo/..|bar]]
13558 [[foo~~~bar]]
13559 [[foo>bar]]
13560 [[foo[bar]]
13561 [[.]]
13562 [[..]]
13563 [[foo././bar]]
13564
13565 [[{{echo|./../foo}}|bar]]
13566 [[{{echo|foo/.}}|bar]]
13567 [[{{echo|foo/..}}|bar]]
13568 [[{{echo|foo~~~~bar}}]]
13569 [[{{echo|foo>bar}}]]
13570 [[{{echo|foo././bar}}]]
13571 [[{{echo|foo{bar}}]]
13572 [[{{echo|foo}bar}}]]
13573 [[{{echo|foo[bar}}]]
13574 [[{{echo|foo]bar}}]]
13575 [[{{echo|foo<bar}}]]
13576 !!html/php
13577 <p>[[./../foo|bar]]
13578 [[foo�|bar]]
13579 [[foo/.|bar]]
13580 [[foo/..|bar]]
13581 [[foo~~~bar]]
13582 [[foo&gt;bar]]
13583 [[foo[bar]]
13584 [[.]]
13585 [[..]]
13586 [[foo././bar]]
13587 </p><p>[[./../foo|bar]]
13588 [[foo/.|bar]]
13589 [[foo/..|bar]]
13590 [[foo~~~~bar]]
13591 [[foo&gt;bar]]
13592 [[foo././bar]]
13593 [[foo{bar]]
13594 [[foo}bar]]
13595 [[foo[bar]]
13596 [[foo]bar]]
13597 [[foo&lt;bar]]
13598 </p>
13599 !!html/parsoid
13600 <p>[[./../foo|bar]]
13601 [[foo�|bar]]
13602 [[foo/.|bar]]
13603 [[foo/..|bar]]
13604 [[foo~~~bar]]
13605 [[foo>bar]]
13606 [[foo[bar]]
13607 [[.]]
13608 [[..]]
13609 [[foo././bar]]</p>
13610
13611 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13612 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13613 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13614 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13615 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13616 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13617 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13618 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13619 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
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&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
13622 !!end
13623
13624 !! test
13625 Disabled subpages
13626 !! wikitext
13627 [[/subpage]]
13628 !! html
13629 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13630 </p>
13631 !! end
13632
13633 !! test
13634 BUG 561: {{/Subpage}}
13635 !! options
13636 subpage title=[[Page]]
13637 !! wikitext
13638 {{/Subpage}}
13639 !! html
13640 <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>
13641 </p>
13642 !! end
13643
13644 ###
13645 ### Categories
13646 ###
13647 !! article
13648 Category:MediaWiki User's Guide
13649 !! text
13650 blah
13651 !! endarticle
13652
13653 !! test
13654 Link to category
13655 !! wikitext
13656 [[:Category:MediaWiki User's Guide]]
13657 !! html
13658 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13659 </p>
13660 !! end
13661
13662 !! test
13663 Simple category
13664 !! options
13665 cat
13666 !! wikitext
13667 [[Category:MediaWiki User's Guide]]
13668 !! html
13669 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13670 !! end
13671
13672 !! test
13673 PAGESINCATEGORY invalid title fatal (r33546 fix)
13674 !! wikitext
13675 {{PAGESINCATEGORY:<bogus>}}
13676 !! html
13677 <p>0
13678 </p>
13679 !! end
13680
13681 !! test
13682 Category with different sort key
13683 !! options
13684 cat
13685 !! wikitext
13686 [[Category:MediaWiki User's Guide|Foo]]
13687 !! html
13688 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13689 !! end
13690
13691 !! test
13692 Category with identical sort key
13693 !! options
13694 cat
13695 !! wikitext
13696 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13697 !! html
13698 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13699 !! end
13700
13701 !! test
13702 Category with empty sort key
13703 !! options
13704 cat
13705 pst
13706 !! wikitext
13707 [[Category:MediaWiki User's Guide|]]
13708 !! html
13709 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13710 !! end
13711
13712 !! test
13713 Category with empty sort key and parentheses
13714 !! options
13715 cat
13716 pst
13717 !! wikitext
13718 [[Category:Foo (bar)|]]
13719 !! html
13720 [[Category:Foo (bar)|Foo]]
13721 !! end
13722
13723 !! test
13724 Category with link tail
13725 !! options
13726 cat
13727 pst
13728 !! wikitext
13729 123[[Category:Foo]]456
13730 !! html
13731 123[[Category:Foo]]456
13732 !! end
13733
13734 !! test
13735 Category with template
13736 !! options
13737 cat
13738 pst
13739 !! wikitext
13740 [[Category:{{echo|Foo}}]]
13741 !! html
13742 [[Category:{{echo|Foo}}]]
13743 !! end
13744
13745 !! test
13746 Category with template in sort key
13747 !! options
13748 cat
13749 pst
13750 !! wikitext
13751 [[Category:Foo|{{echo|Bar}}]]
13752 !! html
13753 [[Category:Foo|{{echo|Bar}}]]
13754 !! end
13755
13756 !! test
13757 Category with template in sort key and title
13758 !! options
13759 cat
13760 pst
13761 !! wikitext
13762 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13763 !! html
13764 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13765 !! end
13766
13767 !! test
13768 Category / paragraph interactions
13769 !! wikitext
13770 Foo [[Category:Baz]] Bar
13771
13772 Foo [[Category:Baz]]
13773 Bar
13774
13775 Foo
13776 [[Category:Baz]]
13777 Bar
13778
13779 Foo
13780 [[Category:Baz]] Bar
13781
13782 Foo
13783 [[Category:Baz]]
13784 [[Category:Baz]]
13785 [[Category:Baz]]
13786 Bar
13787
13788 [[Category:Baz]]
13789 [[Category:Baz]]
13790 [[Category:Baz]]
13791
13792 [[Category:Baz]]
13793 {{echo|[[Category:Baz]]}}
13794 [[Category:Baz]]
13795 !! html
13796 <p>Foo Bar
13797 </p><p>Foo
13798 Bar
13799 </p><p>Foo
13800 Bar
13801 </p><p>Foo Bar
13802 </p><p>Foo
13803 Bar
13804 </p>
13805 !! end
13806
13807 ## The whitespace on the empty line is part of the test. Please do not delete
13808 !! test
13809 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13810 !! options
13811 parsoid=wt2html,wt2wt
13812 !! wikitext
13813 This
13814
13815 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
13816
13817 {{echo|[[Category:Foo]] and so should this!}}
13818 !! html
13819 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
13820 </p>
13821 !! html/parsoid
13822 <p>This
13823
13824 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
13825
13826 <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>
13827 !! end
13828
13829 ## Parsoid will not try to wt2wt this while preserving newlines because
13830 ## it suppresses excess newlines within list items -- and we don't want to
13831 ## introduce a special case just for categories, which is, in reality somewhat
13832 ## odd behavior -- categories are unlikely to be used in list items like this
13833 ## in top-level pages and are only likely to show up in template-generated
13834 ## list items where this RT-ing is a non-issue.
13835 ##
13836 ## The whitespace on the empty line is part of the test. Please do not delete
13837 !! test
13838 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13839 !! options
13840 parsoid=wt2html
13841 !! wikitext
13842 * This
13843
13844 [[Category:Foo]] and this should be part of the same list item
13845 * So should this
13846
13847 {{echo|[[Category:Foo]] and this should be part of the same list item}}
13848 !! html
13849 <ul><li>This and this should be part of the same list item</li>
13850 <li>So should this and this should be part of the same list item</li></ul>
13851 !! html/parsoid
13852 <ul>
13853 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
13854 <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>
13855 </ul>
13856 !! end
13857
13858 ## Newlines and categories that follow the last item of a list
13859 ## are treated differently because this (list followed by categories)
13860 ## is an extremely common pattern on wikis.
13861 !! test
13862 3. Categories and newlines: newline suppression for last list item should RT properly
13863 !! wikitext
13864 * a
13865 * b
13866
13867 [[Category:Foo]]
13868
13869 [[Category:Bar]]
13870 [[Category:Baz]]
13871 !! html/parsoid
13872 <ul><li> a</li>
13873 <li> b</li></ul>
13874
13875 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13876
13877 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13878 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13879 !! end
13880
13881 !! test
13882 4. Categories and newlines: newline suppression for last list item should RT properly
13883 !! wikitext
13884 * a
13885 **** b
13886
13887 [[Category:Foo]]
13888 !! html/parsoid
13889 <ul><li> a
13890 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
13891
13892 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13893 !! end
13894
13895 ## only wt2html for this to make sure the algo only applies to the rightmost path
13896 !! test
13897 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
13898 !! options
13899 parsoid=wt2html
13900 !! wikitext
13901 * a
13902 ** b
13903 [[Category:Foo]]
13904 * c
13905 ** d
13906 [[Category:Foo]]
13907 !! html/parsoid
13908 <ul><li> a
13909 <ul><li> b
13910 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
13911 <li> c
13912 <ul><li> d</li></ul></li></ul>
13913 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13914 !! end
13915
13916 !! test
13917 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
13918 !! wikitext
13919 * a [[Category:Foo]]
13920 !! html/parsoid
13921 <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>
13922 !! end
13923
13924 # This test also demonstrates because of newline+category tunneling
13925 # through the list hander, template wrapping doesn't expand to the
13926 # containing list when the list item swallows the category.
13927 !! test
13928 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
13929 !! wikitext
13930 * {{echo|a
13931 [[Category:Foo]]}}
13932 !! html/parsoid
13933 <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">
13934 </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>
13935 !! end
13936
13937 !! test
13938 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
13939 !! wikitext
13940 * a
13941
13942 {{echo|[[Category:Foo]]
13943 [[Category:Bar]]}}
13944 [[Category:Baz]]
13945 !! html/parsoid
13946 <ul><li> a</li></ul>
13947
13948 <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">
13949 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13950 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13951 !! end
13952
13953 !! test
13954 Parsoid: Serialize link to category page with colon escape
13955 !! options
13956 parsoid
13957 !! wikitext
13958
13959 [[:Category:Foo]]
13960 [[:Category:Foo|Bar]]
13961 !! html
13962 <p>
13963 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13964 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13965 </p>
13966 !! end
13967
13968 # html2wt localizes the "Category" namespace.
13969 # XXX the <link> element needs an empty data-parsoid attribute, or
13970 # else the html2html test fails because spaces are inserted.
13971 !! test
13972 Link prefix/suffixes aren't applied to category links
13973 !! options
13974 parsoid=wt2html,wt2wt,html2html
13975 language=is
13976 !! wikitext
13977 x[[Category:Foo]]y
13978 !! html/php
13979 <p>xy
13980 </p>
13981 !! html/parsoid
13982 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
13983 !! end
13984
13985 !! test
13986 Parsoid: Serialize link to file page with colon escape
13987 !! options
13988 parsoid
13989 !! wikitext
13990
13991 [[:File:Foo.png]]
13992 [[:File:Foo.png|Bar]]
13993 !! html
13994 <p>
13995 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13996 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
13997 </p>
13998 !! end
13999
14000 !! test
14001 Parsoid: Serialize a genuine category link without colon escape
14002 !! options
14003 parsoid
14004 !! wikitext
14005 [[Category:Foo]]
14006 [[Category:Foo|Bar]]
14007 !! html
14008 <link rel="mw:PageProp/Category" href="Category:Foo">
14009 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
14010 !! end
14011
14012 !! test
14013 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14014 !! options
14015 parsoid=html2wt
14016 !! html
14017 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14018 !! wikitext
14019 [[Category:Toxine bactérienne]]
14020 !! end
14021
14022 !! test
14023 Parsoid: Defaultsort
14024 !! wikitext
14025 {{DEFAULTSORT:Foo}}
14026 !! html/parsoid
14027 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14028 !! end
14029
14030 !! test
14031 Parsoid: Defaultsort (template-generated)
14032 !! wikitext
14033 {{{{echo|DEFAULTSORT}}:Foo}}
14034 !! html/parsoid
14035 <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}}]}'/>
14036 !! end
14037
14038 ###
14039 ### Inter-language links
14040 ###
14041 !! test
14042 Interlanguage links
14043 !! options
14044 ill
14045 !! wikitext
14046 [[es:Alimento]]
14047 [[fr:Nourriture]]
14048 [[zh:食品]]
14049 !! html/php
14050 es:Alimento fr:Nourriture zh:食品
14051 !! html/parsoid
14052 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14053 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14054 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14055 !! end
14056
14057 !! test
14058 Duplicate interlanguage links (bug 24502)
14059 !! options
14060 ill
14061 !! wikitext
14062 [[es:1]]
14063 [[es:2]]
14064 [[fr:1]]
14065 [[fr:2]]
14066 !! html/php
14067 es:1 fr:1
14068 !! html/parsoid
14069 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14070 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14071 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14072 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14073 !! end
14074
14075 ###
14076 ### Sections
14077 ###
14078 !! test
14079 Basic section headings
14080 !! wikitext
14081 == Headline 1 ==
14082 Some text
14083
14084 ==Headline 2==
14085 More
14086 ===Smaller headline===
14087 Blah blah
14088 !! html
14089 <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>
14090 <p>Some text
14091 </p>
14092 <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>
14093 <p>More
14094 </p>
14095 <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>
14096 <p>Blah blah
14097 </p>
14098 !! end
14099
14100 !! test
14101 Section headings with TOC
14102 !! wikitext
14103 == Headline 1 ==
14104 === Subheadline 1 ===
14105 ===== Skipping a level =====
14106 ====== Skipping a level ======
14107
14108 == Headline 2 ==
14109 Some text
14110 ===Another headline===
14111 !! html
14112 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14113 <ul>
14114 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14115 <ul>
14116 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14117 <ul>
14118 <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>
14119 <ul>
14120 <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>
14121 </ul>
14122 </li>
14123 </ul>
14124 </li>
14125 </ul>
14126 </li>
14127 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14128 <ul>
14129 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14130 </ul>
14131 </li>
14132 </ul>
14133 </div>
14134
14135 <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>
14136 <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>
14137 <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>
14138 <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>
14139 <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>
14140 <p>Some text
14141 </p>
14142 <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>
14143
14144 !! end
14145
14146 !! test
14147 TOC anchors don't collide
14148 !! wikitext
14149 __FORCETOC__
14150 == Headline 2 ==
14151 == Headline ==
14152 == Headline 2 ==
14153 == Headline ==
14154 !! html/php
14155 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14156 <ul>
14157 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14158 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14159 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14160 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14161 </ul>
14162 </div>
14163
14164 <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>
14165 <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>
14166 <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>
14167 <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>
14168
14169 !! end
14170
14171 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14172 !! test
14173 Handling of sections up to level 6 and beyond
14174 !! wikitext
14175 = Level 1 Heading=
14176 == Level 2 Heading==
14177 === Level 3 Heading===
14178 ==== Level 4 Heading====
14179 ===== Level 5 Heading=====
14180 ====== Level 6 Heading======
14181 ======= Level 7 Heading=======
14182 ======== Level 8 Heading========
14183 ========= Level 9 Heading=========
14184 ========== Level 10 Heading==========
14185 !! html
14186 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14187 <ul>
14188 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14189 <ul>
14190 <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>
14191 <ul>
14192 <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>
14193 <ul>
14194 <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>
14195 <ul>
14196 <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>
14197 <ul>
14198 <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>
14199 <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>
14200 <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>
14201 <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>
14202 <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>
14203 </ul>
14204 </li>
14205 </ul>
14206 </li>
14207 </ul>
14208 </li>
14209 </ul>
14210 </li>
14211 </ul>
14212 </li>
14213 </ul>
14214 </div>
14215
14216 <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>
14217 <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>
14218 <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>
14219 <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>
14220 <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>
14221 <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>
14222 <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>
14223 <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>
14224 <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>
14225 <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>
14226
14227 !! end
14228
14229 !! test
14230 TOC regression (T11764)
14231 !! wikitext
14232 == title 1 ==
14233 === title 1.1 ===
14234 ==== title 1.1.1 ====
14235 === title 1.2 ===
14236 == title 2 ==
14237 === title 2.1 ===
14238 !! html
14239 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14240 <ul>
14241 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14242 <ul>
14243 <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>
14244 <ul>
14245 <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>
14246 </ul>
14247 </li>
14248 <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>
14249 </ul>
14250 </li>
14251 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14252 <ul>
14253 <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>
14254 </ul>
14255 </li>
14256 </ul>
14257 </div>
14258
14259 <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>
14260 <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>
14261 <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>
14262 <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>
14263 <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>
14264 <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>
14265
14266 !! end
14267
14268 !! test
14269 TOC for heading containing <span id="..."></span> (T96153)
14270 !! wikitext
14271 __FORCETOC__
14272 ==<span id="old-anchor"></span>New title==
14273 !! html/php
14274 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14275 <ul>
14276 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14277 </ul>
14278 </div>
14279
14280 <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>
14281
14282 !! end
14283
14284 !! test
14285 TOC with wgMaxTocLevel=3 (bug 6204)
14286 !! options
14287 wgMaxTocLevel=3
14288 !! wikitext
14289 == title 1 ==
14290 === title 1.1 ===
14291 ==== title 1.1.1 ====
14292 === title 1.2 ===
14293 == title 2 ==
14294 === title 2.1 ===
14295 !! html
14296 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14297 <ul>
14298 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14299 <ul>
14300 <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>
14301 <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>
14302 </ul>
14303 </li>
14304 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14305 <ul>
14306 <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>
14307 </ul>
14308 </li>
14309 </ul>
14310 </div>
14311
14312 <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>
14313 <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>
14314 <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>
14315 <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>
14316 <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>
14317 <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>
14318
14319 !! end
14320
14321 !! test
14322 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14323 !! options
14324 wgMaxTocLevel=3
14325 !! wikitext
14326 ==Section 1==
14327 ===Section 1.1===
14328 ====Section 1.1.1====
14329 ====Section 1.1.1.1====
14330 ==Section 2==
14331 !! html
14332 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14333 <ul>
14334 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14335 <ul>
14336 <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>
14337 </ul>
14338 </li>
14339 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14340 </ul>
14341 </div>
14342
14343 <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>
14344 <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>
14345 <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>
14346 <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>
14347 <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>
14348
14349 !! end
14350
14351
14352 !! test
14353 Resolving duplicate section names
14354 !! wikitext
14355 == Foo bar ==
14356 == Foo bar ==
14357 !! html
14358 <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>
14359 <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>
14360
14361 !! end
14362
14363 !! test
14364 Resolving duplicate section names with differing case (bug 10721)
14365 !! wikitext
14366 == Foo bar ==
14367 == Foo Bar ==
14368 !! html
14369 <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>
14370 <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>
14371
14372 !! end
14373
14374 !! article
14375 Template:sections
14376 !! text
14377 ===Section 1===
14378 ==Section 2==
14379 !! endarticle
14380
14381 !! test
14382 Template with sections, __NOTOC__
14383 !! wikitext
14384 __NOTOC__
14385 ==Section 0==
14386 {{sections}}
14387 ==Section 4==
14388 !! html
14389 <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>
14390 <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>
14391 <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>
14392 <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>
14393
14394 !! end
14395
14396 !! test
14397 __NOEDITSECTION__ keyword
14398 !! wikitext
14399 __NOEDITSECTION__
14400 ==Section 1==
14401 ==Section 2==
14402 !! html
14403 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14404 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14405
14406 !! end
14407
14408 !! test
14409 Link inside a section heading
14410 !! wikitext
14411 ==Section with a [[Main Page|link]] in it==
14412 !! html
14413 <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>
14414
14415 !! end
14416
14417 !! test
14418 TOC regression (T14077)
14419 !! wikitext
14420 __TOC__
14421 == title 1 ==
14422 === title 1.1 ===
14423 == title 2 ==
14424 !! html
14425 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14426 <ul>
14427 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14428 <ul>
14429 <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>
14430 </ul>
14431 </li>
14432 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14433 </ul>
14434 </div>
14435
14436 <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>
14437 <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>
14438 <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>
14439
14440 !! end
14441
14442 !! test
14443 BUG 1219 URL next to image (good)
14444 !! wikitext
14445 http://example.com [[File:Foobar.jpg]]
14446 !! html/php
14447 <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>
14448 </p>
14449 !! html/parsoid
14450 <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>
14451 !!end
14452
14453 !! test
14454 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14455 !! wikitext
14456 ===
14457 The line above must have a trailing space!
14458 === <!--
14459 --> <!-- -->
14460 But just in case it doesn't...
14461 !! html
14462 <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>
14463 <p>The line above must have a trailing space!
14464 </p>
14465 <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>
14466 <p>But just in case it doesn't...
14467 </p>
14468 !! end
14469
14470 !! test
14471 Header with special characters (bug 25462)
14472 !! wikitext
14473 The tooltips shall not show entities to the user (ie. be double escaped)
14474
14475 == text > text ==
14476 section 1
14477
14478 == text < text ==
14479 section 2
14480
14481 == text & text ==
14482 section 3
14483
14484 == text ' text ==
14485 section 4
14486
14487 == text " text ==
14488 section 5
14489 !! html
14490 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14491 </p>
14492 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14493 <ul>
14494 <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>
14495 <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>
14496 <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>
14497 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14498 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14499 </ul>
14500 </div>
14501
14502 <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>
14503 <p>section 1
14504 </p>
14505 <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>
14506 <p>section 2
14507 </p>
14508 <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>
14509 <p>section 3
14510 </p>
14511 <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>
14512 <p>section 4
14513 </p>
14514 <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>
14515 <p>section 5
14516 </p>
14517 !! end
14518
14519 !! test
14520 Header with space, plus and underscore as entity
14521 !! wikitext
14522 Id should not contain + for spaces
14523
14524 == Space between Text ==
14525 section 1
14526
14527 == Space-Entity&#32;between&#32;Text ==
14528 section 2
14529
14530 == Plus+between+Text ==
14531 section 3
14532
14533 == Plus-Entity&#43;between&#43;Text ==
14534 section 4
14535
14536 == Underscore_between_Text ==
14537 section 5
14538
14539 == Underscore-Entity&#95;between&#95;Text ==
14540 section 6
14541
14542 [[#Space between Text]]
14543 [[#Space-Entity&#32;between&#32;Text]]
14544 [[#Plus+between+Text]]
14545 [[#Plus-Entity&#43;between&#43;Text]]
14546 [[#Underscore_between_Text]]
14547 [[#Underscore-Entity&#95;between&#95;Text]]
14548 !! html
14549 <p>Id should not contain + for spaces
14550 </p>
14551 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14552 <ul>
14553 <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>
14554 <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>
14555 <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>
14556 <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>
14557 <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>
14558 <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>
14559 </ul>
14560 </div>
14561
14562 <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>
14563 <p>section 1
14564 </p>
14565 <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>
14566 <p>section 2
14567 </p>
14568 <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>
14569 <p>section 3
14570 </p>
14571 <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>
14572 <p>section 4
14573 </p>
14574 <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>
14575 <p>section 5
14576 </p>
14577 <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>
14578 <p>section 6
14579 </p><p><a href="#Space_between_Text">#Space between Text</a>
14580 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14581 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14582 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14583 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14584 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14585 </p>
14586 !! end
14587
14588 !! test
14589 Headers with excess '=' characters
14590 (Are similar tests necessary beyond the 1st level?)
14591 !! wikitext
14592 =foo==
14593 ==foo=
14594 =''italic'' heading==
14595 ==''italic'' heading=
14596 !! html
14597 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14598 <ul>
14599 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14600 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14601 <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>
14602 <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>
14603 </ul>
14604 </div>
14605
14606 <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>
14607 <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>
14608 <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>
14609 <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>
14610
14611 !! end
14612
14613 !! test
14614 HTML headers vs TOC (bug 23393)
14615 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14616 !! wikitext
14617 <h1>Header 1</h1>
14618 == Header 1.1 ==
14619 == Header 1.2 ==
14620
14621 <h1>Header 2
14622 </h1>
14623 == Header 2.1 ==
14624 == Header 2.2 ==
14625 __NOEDITSECTION__
14626 !! html
14627 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14628 <ul>
14629 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14630 <ul>
14631 <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>
14632 <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>
14633 </ul>
14634 </li>
14635 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14636 <ul>
14637 <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>
14638 <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>
14639 </ul>
14640 </li>
14641 </ul>
14642 </div>
14643
14644 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14645 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14646 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14647 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14648 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14649 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14650
14651 !! end
14652
14653 !! test
14654 Single-line or multiline-comments can follow headings
14655 !! options
14656 parsoid=wt2html,wt2wt
14657 !! wikitext
14658 ==foo==<!---->
14659 ==bar==<!--c1-->
14660 ==baz==<!--
14661 c2
14662 c3-->
14663 !! html
14664 <h2><span class="mw-headline" id="foo">foo</span></h2>
14665 <h2><span class="mw-headline" id="bar">bar</span></h2>
14666 <h2><span class="mw-headline" id="baz">baz</span></h2>
14667
14668 !! end
14669
14670 !! test
14671 BUG 1219 URL next to image (broken)
14672 !! wikitext
14673 http://example.com[[File:Foobar.jpg]]
14674 !! html/php
14675 <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>
14676 </p>
14677 !! html/parsoid
14678 <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>
14679 !!end
14680
14681 !! test
14682 Bug 1186 news: in the middle of text
14683 !! wikitext
14684 http://en.wikinews.org/wiki/Wikinews:Workplace
14685 !! html
14686 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14687 </p>
14688 !!end
14689
14690
14691 !! test
14692 Namespaced link must have a title
14693 !! wikitext
14694 [[Project:]]
14695 !! html
14696 <p>[[Project:]]
14697 </p>
14698 !!end
14699
14700 !! test
14701 Namespaced link must have a title (bad fragment version)
14702 !! wikitext
14703 [[Project:#fragment]]
14704 !! html
14705 <p>[[Project:#fragment]]
14706 </p>
14707 !!end
14708
14709
14710 ###
14711 ### HTML tags and HTML attributes
14712 ###
14713
14714 !! test
14715 div with no attributes
14716 !! wikitext
14717 <div>HTML rocks</div>
14718 !! html
14719 <div>HTML rocks</div>
14720
14721 !! end
14722
14723 !! test
14724 div with double-quoted attribute
14725 !! wikitext
14726 <div id="rock">HTML rocks</div>
14727 !! html
14728 <div id="rock">HTML rocks</div>
14729
14730 !! end
14731
14732 !! test
14733 div with single-quoted attribute
14734 !! wikitext
14735 <div id='rock'>HTML rocks</div>
14736 !! html
14737 <div id="rock">HTML rocks</div>
14738
14739 !! end
14740
14741 !! test
14742 div with unquoted attribute
14743 !! wikitext
14744 <div id=rock>HTML rocks</div>
14745 !! html
14746 <div id="rock">HTML rocks</div>
14747
14748 !! end
14749
14750 !! test
14751 div with illegal double attributes
14752 !! wikitext
14753 <div id="a" id="b">HTML rocks</div>
14754 !! html
14755 <div id="b">HTML rocks</div>
14756
14757 !!end
14758
14759 # FIXME: produce empty string instead of "class" in the PHP parser, following
14760 # the HTML5 spec.
14761 !! test
14762 div with empty attribute value, space before equals
14763 !! options
14764 parsoid
14765 !! wikitext
14766 <div class =>HTML rocks</div>
14767 !! html
14768 <div class="">HTML rocks</div>
14769
14770 !! end
14771
14772 !! test
14773 div with multiple empty attribute values
14774 !! options
14775 parsoid
14776 !! wikitext
14777 <div id= title=>HTML rocks</div>
14778 !! html
14779 <div id="" title="">HTML rocks</div>
14780
14781 !! end
14782
14783 !! test
14784 table with multiple empty attribute values
14785 !! options
14786 parsoid
14787 !! wikitext
14788 {| title= id=
14789 | hi
14790 |}
14791 !! html
14792 <table title="" id="">
14793 <tbody><tr><td> hi</td></tr>
14794 </tbody></table>
14795 !! end
14796
14797 !! test
14798 div with braces in attribute value
14799 !! wikitext
14800 <div title="{}">Foo</div>
14801 !! html/php
14802 <div title="&#123;}">Foo</div>
14803
14804 !! html/parsoid
14805 <div title="{}">Foo</div>
14806 !! end
14807
14808 # This it very inconsistent in the PHP parser: it returns
14809 # class="class" if there is a space between the name and the equal sign (see
14810 # 'div with empty attribute value, space before equals'), but strips the
14811 # attribute completely if the space is missing. We hope that not much content
14812 # depends on this, so are implementing the behavior below in Parsoid for
14813 # consistencies' sake.
14814 # FIXME: fix this behavior in the PHP parser?
14815 !! test
14816 div with empty attribute value, no space before equals
14817 !! options
14818 parsoid=wt2html,html2html
14819 !! wikitext
14820 <div class=>HTML rocks</div>
14821 !! html/php
14822 <div>HTML rocks</div>
14823
14824 !! html/parsoid
14825 <div class="">HTML rocks</div>
14826 !! end
14827
14828 !! test
14829 HTML multiple attributes correction
14830 !! wikitext
14831 <p class="error" class="awesome">Awesome!</p>
14832 !! html
14833 <p class="awesome">Awesome!</p>
14834
14835 !!end
14836
14837 !! test
14838 Table multiple attributes correction
14839 !! wikitext
14840 {|
14841 !+ class="error" class="awesome"| status
14842 |}
14843 !! html
14844 <table>
14845 <tr>
14846 <th class="awesome"> status
14847 </th></tr></table>
14848
14849 !!end
14850
14851 !! test
14852 DIV IN UPPERCASE
14853 !! wikitext
14854 <DIV ID="x">HTML ROCKS</DIV>
14855 !! html
14856 <div id="x">HTML ROCKS</div>
14857
14858 !!end
14859
14860 !! test
14861 Non-ASCII pseudo-tags are rendered as text
14862 !! wikitext
14863 <khyô>
14864 !! html
14865 <p>&lt;khyô&gt;
14866 </p>
14867 !! end
14868
14869 !! test
14870 Pseudo-tag with URL 'name' renders as url link
14871 !! wikitext
14872 <http://example.com/>
14873 !! html
14874 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14875 </p>
14876 !! end
14877
14878 !! test
14879 text with amp in the middle of nowhere
14880 !! wikitext
14881 Remember AT&T?
14882 !! html
14883 <p>Remember AT&amp;T?
14884 </p>
14885 !! end
14886
14887 !! test
14888 text with character entity: eacute
14889 !! wikitext
14890 I always thought &eacute; was a cute letter.
14891 !! html
14892 <p>I always thought &#233; was a cute letter.
14893 </p>
14894 !! html+tidy
14895 <p>I always thought é was a cute letter.</p>
14896 !! end
14897
14898 !! test
14899 text with entity-escaped character entity-like string: eacute
14900 !! wikitext
14901 I always thought &amp;eacute; was a cute letter.
14902 !! html
14903 <p>I always thought &amp;eacute; was a cute letter.
14904 </p>
14905 !! end
14906
14907 !! test
14908 text with undefined character entity: xacute
14909 !! wikitext
14910 I always thought &xacute; was a cute letter.
14911 !! html
14912 <p>I always thought &amp;xacute; was a cute letter.
14913 </p>
14914 !! end
14915
14916 # TODO: generalize to PHP parser?
14917 !! test
14918 HTML5 tags
14919 !! options
14920 parsoid
14921 !! wikitext
14922 <data value="5">five</data>
14923 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14924 <mark>This highlighted text</mark>
14925 !! html
14926 <p><data value="5">five</data>
14927 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14928 <mark>This highlighted text</mark></p>
14929 !! end
14930
14931 !! test
14932 HTML tag with leading space is parsed as text
14933 !! wikitext
14934 < div>foo< /div>
14935 !! html
14936 <p>&lt; div&gt;foo&lt; /div&gt;
14937 </p>
14938 !! end
14939
14940 ###
14941 ### Nesting tests (see bug 41545, 50604, 51081)
14942 ###
14943
14944 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14945 # Note that html2wt is considerably more difficult if we use <b> in
14946 # the test case, instead of <big>
14947 !! test
14948 Ensure that HTML adoption agency algorithm is properly implemented.
14949 !! wikitext
14950 <big>X<big>Y</big>Z</big>
14951 !! html
14952 <p><big>X<big>Y</big>Z</big>
14953 </p>
14954 !! end
14955
14956 # This was bug 41545 in the PHP parser.
14957 # Note that tidy doesn't handle this correctly.
14958 !! test
14959 Nesting of <kbd>
14960 !! wikitext
14961 <kbd>X<kbd>Y</kbd>Z</kbd>
14962 !! html
14963 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14964 </p>
14965 !! end
14966
14967 # The following cases were bug 51081 in the PHP parser.
14968 # Note that there are some other nestable tags (b, i, etc) which are
14969 # not covered; see bug 51081 for discussion.
14970
14971 # Note that tidy doesn't handle this correctly.
14972 !! test
14973 Nesting of <em>
14974 !! wikitext
14975 <em>X<em>Y</em>Z</em>
14976 !! html
14977 <p><em>X<em>Y</em>Z</em>
14978 </p>
14979 !! end
14980
14981 # Note that tidy doesn't handle this correctly.
14982 !! test
14983 Nesting of <strong>
14984 !! wikitext
14985 <strong>X<strong>Y</strong>Z</strong>
14986 !! html
14987 <p><strong>X<strong>Y</strong>Z</strong>
14988 </p>
14989 !! end
14990
14991 !! test
14992 Nesting of <q>
14993 !! wikitext
14994 <q>X<q>Y</q>Z</q>
14995 !! html+tidy
14996 <p><q>X<q>Y</q>Z</q></p>
14997 !! end
14998
14999 # Note that tidy doesn't handle this correctly.
15000 !! test
15001 Nesting of <ruby>
15002 !! wikitext
15003 <ruby>X<ruby>Y</ruby>Z</ruby>
15004 !! html
15005 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15006 </p>
15007 !! end
15008
15009 # Note that tidy doesn't handle this correctly.
15010 !! test
15011 Nesting of <bdo>
15012 !! wikitext
15013 <bdo>X<bdo>Y</bdo>Z</bdo>
15014 !! html
15015 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15016 </p>
15017 !! end
15018
15019
15020 ###
15021 ### Media links
15022 ###
15023
15024 !! test
15025 Media link
15026 !! wikitext
15027 [[Media:Foobar.jpg]]
15028 !! html
15029 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15030 </p>
15031 !! end
15032
15033 !! test
15034 Media link with text
15035 !! wikitext
15036 [[Media:Foobar.jpg|A neat file to look at]]
15037 !! html
15038 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15039 </p>
15040 !! end
15041
15042 # FIXME: this is still bad HTML tag nesting
15043 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15044 !! test
15045 Media link with nasty text
15046 !! wikitext
15047 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15048 !! html
15049 <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>
15050
15051 !! html+tidy
15052 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15053 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15054 !! end
15055
15056 !! test
15057 Media link to nonexistent file (bug 1702)
15058 !! wikitext
15059 [[Media:No such.jpg]]
15060 !! html
15061 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15062 </p>
15063 !! end
15064
15065 !! test
15066 Image link to nonexistent file (bug 1850 - good)
15067 !! wikitext
15068 [[File:No_such.jpg]]
15069 !! html/php
15070 <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>
15071 </p>
15072 !! html/parsoid
15073 <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>
15074 !! end
15075
15076 !! test
15077 :Image link to nonexistent file (bug 1850 - bad)
15078 !! wikitext
15079 [[:Image:No such.jpg]]
15080 !! html/php
15081 <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>
15082 </p>
15083 !! html/parsoid
15084 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15085 !! end
15086
15087
15088
15089 !! test
15090 Character reference normalization in link text (bug 1938)
15091 !! wikitext
15092 [[Main Page|this&that]]
15093 !! html
15094 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15095 </p>
15096 !!end
15097
15098 !! article
15099 אַ
15100 !! text
15101 Test for unicode normalization
15102
15103 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15104 !! endarticle
15105
15106 !! test
15107 (bug 19451) Links should refer to the normalized form.
15108 !! wikitext
15109 [[&#xFB2E;]]
15110 [[&#x5d0;&#x5b7;]]
15111 [[&#x5d0;ַ]]
15112 [[א&#x5b7;]]
15113 [[אַ]]
15114 !! html
15115 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15116 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15117 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15118 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15119 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15120 </p>
15121 !! end
15122
15123 !! test
15124 Empty attribute crash test (bug 2067)
15125 !! wikitext
15126 <font color="">foo</font>
15127 !! html
15128 <p><font color="">foo</font>
15129 </p>
15130 !! end
15131
15132 !! test
15133 Empty attribute crash test single-quotes (bug 2067)
15134 !! wikitext
15135 <font color=''>foo</font>
15136 !! html
15137 <p><font color="">foo</font>
15138 </p>
15139 !! end
15140
15141 !! test
15142 Attribute test: equals, then nothing
15143 !! wikitext
15144 <font color=>foo</font>
15145 !! html
15146 <p><font>foo</font>
15147 </p>
15148 !! end
15149
15150 !! test
15151 Attribute test: unquoted value
15152 !! wikitext
15153 <font color=x>foo</font>
15154 !! html
15155 <p><font color="x">foo</font>
15156 </p>
15157 !! end
15158
15159 !! test
15160 Attribute test: unquoted but illegal value (hash)
15161 !! wikitext
15162 <font color=#x>foo</font>
15163 !! html
15164 <p><font color="#x">foo</font>
15165 </p>
15166 !! end
15167
15168 !! test
15169 Attribute test: no value
15170 !! wikitext
15171 <font color>foo</font>
15172 !! html
15173 <p><font color="color">foo</font>
15174 </p>
15175 !! end
15176
15177 !! test
15178 Bug 2095: link with three closing brackets
15179 !! wikitext
15180 [[Main Page]]]
15181 !! html/php
15182 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15183 </p>
15184 !! html/parsoid
15185 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15186 !! end
15187
15188 !! test
15189 Bug 2095: link with pipe and three closing brackets
15190 !! wikitext
15191 [[Main Page|link]]]
15192 !! html/php
15193 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15194 </p>
15195 !! html/parsoid
15196 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15197 !! end
15198
15199 !! test
15200 Bug 2095: link with pipe and three closing brackets, version 2
15201 !! wikitext
15202 [[Main Page|[http://example.com/]]]
15203 !! html/php
15204 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15205 </p>
15206 !! html/parsoid
15207 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15208 !! end
15209
15210
15211 ###
15212 ### Safety
15213 ###
15214
15215 !! article
15216 Template:Dangerous attribute
15217 !! text
15218 " onmouseover="alert(document.cookie)
15219 !! endarticle
15220
15221 !! article
15222 Template:Dangerous style attribute
15223 !! text
15224 border-size: expression(alert(document.cookie))
15225 !! endarticle
15226
15227 !! article
15228 Template:Div style
15229 !! text
15230 <div style="float: right; {{{1}}}">Magic div</div>
15231 !! endarticle
15232
15233 !! test
15234 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15235 !! wikitext
15236 <div title="{{test}}"></div>
15237 !! html
15238 <div title="This is a test template"></div>
15239
15240 !! end
15241
15242 # Parsoid has enough context to handle this case
15243 !! test
15244 Bug 2304: HTML attribute safety (dangerous template; 2309)
15245 !! wikitext
15246 <div title="{{dangerous attribute}}"></div>
15247 !! html/php
15248 <div title=""></div>
15249
15250 !! html/parsoid
15251 <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>
15252 !! end
15253
15254 !! test
15255 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15256 !! wikitext
15257 <div style="{{dangerous style attribute}}"></div>
15258 !! html
15259 <div style="/* insecure input */"></div>
15260
15261 !! end
15262
15263 !! test
15264 Bug 2304: HTML attribute safety (safe parameter; 2309)
15265 !! wikitext
15266 {{div style|width: 200px}}
15267 !! html
15268 <div style="float: right; width: 200px">Magic div</div>
15269
15270 !! end
15271
15272 !! test
15273 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15274 !! wikitext
15275 {{div style|width: expression(alert(document.cookie))}}
15276 !! html
15277 <div style="/* insecure input */">Magic div</div>
15278
15279 !! end
15280
15281 !! test
15282 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15283 !! wikitext
15284 {{div style|"><script>alert(document.cookie)</script>}}
15285 !! html
15286 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15287
15288 !! end
15289
15290 !! test
15291 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15292 !! wikitext
15293 {{div style|" ><script>alert(document.cookie)</script>}}
15294 !! html
15295 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15296
15297 !! end
15298
15299 !! test
15300 Bug 2304: HTML attribute safety (link)
15301 !! wikitext
15302 <div title="[[Main Page]]"></div>
15303 !! html
15304 <div title="&#91;&#91;Main Page]]"></div>
15305
15306 !! end
15307
15308 !! test
15309 Bug 2304: HTML attribute safety (italics)
15310 !! wikitext
15311 <div title="''foobar''"></div>
15312 !! html
15313 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15314
15315 !! end
15316
15317 !! test
15318 Bug 2304: HTML attribute safety (bold)
15319 !! wikitext
15320 <div title="'''foobar'''"></div>
15321 !! html
15322 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15323
15324 !! end
15325
15326
15327 !! test
15328 Bug 2304: HTML attribute safety (ISBN)
15329 !! wikitext
15330 <div title="ISBN 1234567890"></div>
15331 !! html
15332 <div title="&#73;SBN 1234567890"></div>
15333
15334 !! end
15335
15336 !! test
15337 Bug 2304: HTML attribute safety (RFC)
15338 !! wikitext
15339 <div title="RFC 1234"></div>
15340 !! html
15341 <div title="&#82;FC 1234"></div>
15342
15343 !! end
15344
15345 !! test
15346 Bug 2304: HTML attribute safety (PMID)
15347 !! wikitext
15348 <div title="PMID 1234567890"></div>
15349 !! html
15350 <div title="&#80;MID 1234567890"></div>
15351
15352 !! end
15353
15354 !! test
15355 Bug 2304: HTML attribute safety (web link)
15356 !! wikitext
15357 <div title="http://example.com/"></div>
15358 !! html
15359 <div title="http&#58;//example.com/"></div>
15360
15361 !! end
15362
15363 !! test
15364 Bug 2304: HTML attribute safety (named web link)
15365 !! wikitext
15366 <div title="[http://example.com/ link]"></div>
15367 !! html
15368 <div title="&#91;http&#58;//example.com/ link]"></div>
15369
15370 !! end
15371
15372 !! test
15373 Bug 3244: HTML attribute safety (extension; safe)
15374 !! wikitext
15375 <div style="<nowiki>background:blue</nowiki>"></div>
15376 !! html
15377 <div style="background:blue"></div>
15378
15379 !! end
15380
15381 !! test
15382 Bug 3244: HTML attribute safety (extension; unsafe)
15383 !! wikitext
15384 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15385 !! html
15386 <div style="/* insecure input */"></div>
15387
15388 !! end
15389
15390 # More MSIE fun discovered by Tom Gilder
15391
15392 !! test
15393 MSIE CSS safety test: spurious slash
15394 !! wikitext
15395 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15396 !! html
15397 <div style="/* insecure input */">evil</div>
15398
15399 !! end
15400
15401 !! test
15402 MSIE CSS safety test: hex code
15403 !! wikitext
15404 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15405 !! html
15406 <div style="/* insecure input */">evil</div>
15407
15408 !! end
15409
15410 !! test
15411 MSIE CSS safety test: comment in url
15412 !! wikitext
15413 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15414 !! html
15415 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15416
15417 !! end
15418
15419 !! test
15420 MSIE CSS safety test: comment in expression
15421 !! wikitext
15422 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15423 !! html
15424 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15425
15426 !! end
15427
15428 !! test
15429 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15430 !! wikitext
15431 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15432 !! html
15433 <p style="/* invalid control char */">A</p>
15434
15435 !! end
15436
15437 !! test
15438 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15439 !! wikitext
15440 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15441 <div style="top:EXPRESSION(alert())">B</div>
15442 !! html
15443 <p style="/* insecure input */">A</p>
15444 <div style="/* insecure input */">B</div>
15445
15446 !! end
15447
15448 !! test
15449 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15450 !! wikitext
15451 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15452 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15453 !! html
15454 <div style="/* insecure input */">A</div>
15455 <p style="/* insecure input */">B</p>
15456
15457 !! end
15458
15459 !! test
15460 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15461 !! wikitext
15462 <div style="background-image:url⁽javascript:alert())">A</div>
15463 <div style="background-image:url₍javascript:alert())">B</div>
15464 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15465 !! html
15466 <div style="/* insecure input */">A</div>
15467 <div style="/* insecure input */">B</div>
15468 <p style="/* insecure input */">C</p>
15469
15470 !! end
15471
15472 !! test
15473 Opera -o-link CSS
15474 !! wikitext
15475 <div
15476 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;"
15477 style="-o-link:attr(title);-o-link-source:current">X</div>
15478 !! html
15479 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15480
15481 !! end
15482
15483 !! test
15484 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15485 !! wikitext
15486 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15487 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15488 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15489 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15490 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15491 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15492 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15493 !! html
15494 <p style="/* insecure input */">A</p>
15495 <p style="/* insecure input */">B</p>
15496 <p style="/* insecure input */">C</p>
15497 <p style="/* insecure input */">D</p>
15498 <p style="/* insecure input */">E</p>
15499 <p style="/* insecure input */">F</p>
15500 <p style="/* insecure input */">G</p>
15501
15502 !! end
15503
15504 !! test
15505 Table attribute legitimate extension
15506 !! wikitext
15507 {|
15508 !+ style="<nowiki>color:blue</nowiki>"| status
15509 |}
15510 !! html
15511 <table>
15512 <tr>
15513 <th style="color:blue"> status
15514 </th></tr></table>
15515
15516 !!end
15517
15518 !! test
15519 Table attribute safety
15520 !! wikitext
15521 {|
15522 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15523 |}
15524 !! html
15525 <table>
15526 <tr>
15527 <th style="/* insecure input */"> status
15528 </th></tr></table>
15529
15530 !! end
15531
15532 !! test
15533 CSS line continuation 1
15534 !! wikitext
15535 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15536 !! html
15537 <div style="/* insecure input */"></div>
15538
15539 !! end
15540
15541 !! test
15542 CSS line continuation 2
15543 !! wikitext
15544 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15545 !! html
15546 <div style="/* insecure input */"></div>
15547
15548 !! end
15549
15550 !! article
15551 Template:Identity
15552 !! text
15553 {{{1}}}
15554 !! endarticle
15555
15556 !! test
15557 Expansion of multi-line templates in attribute values (bug 6255)
15558 !! wikitext
15559 <div style="background: {{identity|#00FF00}}">-</div>
15560 !! html
15561 <div style="background: #00FF00">-</div>
15562
15563 !! end
15564
15565
15566 !! test
15567 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15568 !! wikitext
15569 <div style="background:
15570 #00FF00">-</div>
15571 !! html/php
15572 <div style="background: #00FF00">-</div>
15573
15574 !! html/parsoid
15575 <div style="background:
15576 #00FF00">-</div>
15577 !! end
15578
15579 !! test
15580 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15581 !! wikitext
15582 <div style="background: &#10;#00FF00">-</div>
15583 !! html
15584 <div style="background: &#10;#00FF00">-</div>
15585
15586 !! end
15587
15588 !! test
15589 evil <math>-wiki-tags without Extension:Math enabled
15590 !! wikitext
15591 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15592 !! html+tidy
15593 <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>
15594 !! end
15595
15596 ###
15597 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15598 ###
15599 !! test
15600 Parser hook: empty input
15601 !! wikitext
15602 <tag></tag>
15603 !! html
15604 <pre>
15605 ''
15606 array (
15607 )
15608 </pre>
15609
15610 !! end
15611
15612 !! test
15613 Parser hook: empty input using terminated empty elements
15614 !! wikitext
15615 <tag/>
15616 !! html
15617 <pre>
15618 NULL
15619 array (
15620 )
15621 </pre>
15622
15623 !! end
15624
15625 !! test
15626 Parser hook: empty input using terminated empty elements (space before)
15627 !! wikitext
15628 <tag />
15629 !! html
15630 <pre>
15631 NULL
15632 array (
15633 )
15634 </pre>
15635
15636 !! end
15637
15638 !! test
15639 Parser hook: basic input
15640 !! wikitext
15641 <tag>input</tag>
15642 !! html
15643 <pre>
15644 'input'
15645 array (
15646 )
15647 </pre>
15648
15649 !! end
15650
15651
15652 !! test
15653 Parser hook: case insensitive
15654 !! wikitext
15655 <TAG>input</TAG>
15656 !! html
15657 <pre>
15658 'input'
15659 array (
15660 )
15661 </pre>
15662
15663 !! end
15664
15665
15666 !! test
15667 Parser hook: case insensitive, redux
15668 !! wikitext
15669 <TaG>input</TAg>
15670 !! html
15671 <pre>
15672 'input'
15673 array (
15674 )
15675 </pre>
15676
15677 !! end
15678
15679 !! test
15680 Parser hook: nested tags
15681 !! options
15682 noxml
15683 !! wikitext
15684 <tag><tag></tag></tag>
15685 !! html
15686 <pre>
15687 '<tag>'
15688 array (
15689 )
15690 </pre>&lt;/tag&gt;
15691
15692 !! end
15693
15694 !! test
15695 Parser hook: basic arguments
15696 !! wikitext
15697 <tag width=200 height = "100" depth = '50' square></tag>
15698 !! html
15699 <pre>
15700 ''
15701 array (
15702 'width' => '200',
15703 'height' => '100',
15704 'depth' => '50',
15705 'square' => 'square',
15706 )
15707 </pre>
15708
15709 !! end
15710
15711 !! test
15712 Parser hook: argument containing a forward slash (bug 5344)
15713 !! wikitext
15714 <tag filename='/tmp/bla'></tag>
15715 !! html
15716 <pre>
15717 ''
15718 array (
15719 'filename' => '/tmp/bla',
15720 )
15721 </pre>
15722
15723 !! end
15724
15725 !! test
15726 Parser hook: empty input using terminated empty elements (bug 2374)
15727 !! wikitext
15728 <tag foo=bar/>text
15729 !! html
15730 <pre>
15731 NULL
15732 array (
15733 'foo' => 'bar',
15734 )
15735 </pre>text
15736
15737 !! end
15738
15739 # </tag> should be output literally since there is no matching tag that begins it
15740 !! test
15741 Parser hook: basic arguments using terminated empty elements (bug 2374)
15742 !! wikitext
15743 <tag width=200 height = "100" depth = '50' square/>
15744 other stuff
15745 </tag>
15746 !! html
15747 <pre>
15748 NULL
15749 array (
15750 'width' => '200',
15751 'height' => '100',
15752 'depth' => '50',
15753 'square' => 'square',
15754 )
15755 </pre>
15756 <p>other stuff
15757 &lt;/tag&gt;
15758 </p>
15759 !! end
15760
15761 ###
15762 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15763 ###
15764
15765 !! test
15766 Parser hook: static parser hook not inside a comment
15767 !! wikitext
15768 <statictag>hello, world</statictag>
15769 <statictag action=flush/>
15770 !! html
15771 <p>hello, world
15772 </p>
15773 !! end
15774
15775
15776 !! test
15777 Parser hook: static parser hook inside a comment
15778 !! wikitext
15779 <!-- <statictag>hello, world</statictag> -->
15780 <statictag action=flush/>
15781 !! html
15782 <p><br />
15783 </p>
15784 !! end
15785
15786 # Nested template calls; this case was broken by Parser.php rev 1.506,
15787 # since reverted.
15788
15789 !! article
15790 Template:One-parameter
15791 !! text
15792 (My parameter is: {{{1}}})
15793 !! endarticle
15794
15795 !! article
15796 Template:Map-one-parameter
15797 !! text
15798 {{{{{1}}}|{{{2}}}}}
15799 !! endarticle
15800
15801 !! test
15802 Nested template calls
15803 !! wikitext
15804 {{Map-one-parameter|One-parameter|param}}
15805 !! html
15806 <p>(My parameter is: param)
15807 </p>
15808 !! end
15809
15810
15811 ###
15812 ### Sanitizer
15813 ###
15814
15815 # HTML+Tidy effectively strips out the empty tags completely
15816 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15817 # which Tidy would have done for the PHP parser had there been content inside it.
15818 !! test
15819 Sanitizer: Closing of open tags
15820 !! wikitext
15821 <s></s><table></table>
15822 !! html
15823 <s></s><table></table>
15824
15825 !! html/parsoid
15826 <p><s></s></p><table></table>
15827 !! end
15828
15829 !! test
15830 Sanitizer: Closing of open but not closed tags
15831 !! wikitext
15832 <s>foo
15833 !! html
15834 <p><s>foo</s>
15835 </p>
15836 !! end
15837
15838 !! test
15839 Sanitizer: Closing of closed but not open tags
15840 !! wikitext
15841 </s>
15842 !! html
15843 <p>&lt;/s&gt;
15844 </p>
15845 !! end
15846
15847 !! test
15848 Sanitizer: Closing of closed but not open table tags
15849 !! wikitext
15850 Table not started</td></tr></table>
15851 !! html
15852 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15853 </p>
15854 !! end
15855
15856 !! test
15857 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15858 !! wikitext
15859 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15860 !! html
15861 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15862 </p>
15863 !! end
15864
15865 # In HTML5, the restrictions are that id must contain at least one character,
15866 # and must not contain any space characters.
15867 !! test
15868 Sanitizer: Validating the contents of the id attribute (bug 4515)
15869 !! options
15870 disabled
15871 !! wikitext
15872 <br id="" /><br id="a space" />
15873 !! html
15874 Something ...
15875 !! end
15876
15877 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15878 !! test
15879 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15880 !! options
15881 disabled
15882 !! wikitext
15883 <br id="foo" /><br id="foo" />
15884 !! html
15885 Something need to be done. foo-2 ?
15886 !! end
15887
15888 !! test
15889 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15890 !! wikitext
15891 <div itemscope>
15892 <meta itemprop="hello" content="world">
15893 <meta http-equiv="refresh" content="5">
15894 <meta itemprop="hello" http-equiv="refresh" content="5">
15895 <link itemprop="hello" href="{{SERVER}}">
15896 <link rel="stylesheet" href="{{SERVER}}">
15897 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15898 </div>
15899 !! html
15900 <div itemscope="itemscope">
15901 <p> <meta itemprop="hello" content="world" />
15902 &lt;meta http-equiv="refresh" content="5"&gt;
15903 <meta itemprop="hello" content="5" />
15904 </p>
15905 <link itemprop="hello" href="http&#58;//example.org" />
15906 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15907 <link itemprop="hello" href="http&#58;//example.org" />
15908 </div>
15909
15910 !! end
15911
15912 !! test
15913 Language converter: output gets cut off unexpectedly (bug 5757)
15914 !! options
15915 language=zh
15916 !! wikitext
15917 this bit is safe: }-
15918
15919 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15920
15921 then we get cut off here: }-
15922
15923 all additional text is vanished
15924 !! html
15925 <p>this bit is safe: }-
15926 </p><p>but if we add a conversion instance: xxx
15927 </p><p>then we get cut off here: }-
15928 </p><p>all additional text is vanished
15929 </p>
15930 !! end
15931
15932 !! test
15933 Self closed html pairs (bug 5487)
15934 !! options
15935 !! wikitext
15936 <center><font id="bug" />Centered text</center>
15937 <div><font id="bug2" />In div text</div>
15938 !! html
15939 <center>&lt;font id="bug" /&gt;Centered text</center>
15940 <div>&lt;font id="bug2" /&gt;In div text</div>
15941
15942 !! end
15943
15944 #
15945 #
15946 #
15947
15948 !! test
15949 Punctuation: nbsp before exclamation
15950 !! wikitext
15951 C'est grave !
15952 !! html
15953 <p>C'est grave&#160;!
15954 </p>
15955 !! end
15956
15957 !! test
15958 Punctuation: CSS !important (bug 11874)
15959 !! wikitext
15960 <div style="width:50% !important">important</div>
15961 !! html
15962 <div style="width:50% !important">important</div>
15963
15964 !!end
15965
15966 !! test
15967 Punctuation: CSS ! important (bug 11874; with space after)
15968 !! wikitext
15969 <div style="width:50% ! important">important</div>
15970 !! html
15971 <div style="width:50% ! important">important</div>
15972
15973 !!end
15974
15975 !! test
15976 HTML bullet list, closed tags (bug 5497)
15977 !! wikitext
15978 <ul>
15979 <li>One</li>
15980 <li>Two</li>
15981 </ul>
15982 !! html/php
15983 <ul>
15984 <li>One</li>
15985 <li>Two</li>
15986 </ul>
15987
15988 !! html/parsoid
15989 <ul data-parsoid='{"stx":"html"}'>
15990 <li data-parsoid='{"stx":"html"}'>One</li>
15991 <li data-parsoid='{"stx":"html"}'>Two</li>
15992 </ul>
15993
15994 !! end
15995
15996 !! test
15997 HTML bullet list, unclosed tags (bug 5497)
15998 !! wikitext
15999 <ul>
16000 <li>One
16001 <li>Two
16002 </ul>
16003 !! html/php+tidy
16004 <ul>
16005 <li>One</li>
16006 <li>Two</li>
16007 </ul>
16008 !! html/parsoid
16009 <ul data-parsoid='{"stx":"html"}'>
16010 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16011 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16012 </ul>
16013
16014 !! end
16015
16016 !! test
16017 HTML ordered list, closed tags (bug 5497)
16018 !! wikitext
16019 <ol>
16020 <li>One</li>
16021 <li>Two</li>
16022 </ol>
16023 !! html/php
16024 <ol>
16025 <li>One</li>
16026 <li>Two</li>
16027 </ol>
16028
16029 !! html/parsoid
16030 <ol data-parsoid='{"stx":"html"}'>
16031 <li data-parsoid='{"stx":"html"}'>One</li>
16032 <li data-parsoid='{"stx":"html"}'>Two</li>
16033 </ol>
16034
16035 !! end
16036
16037 !! test
16038 HTML ordered list, unclosed tags (bug 5497)
16039 !! options
16040 !! wikitext
16041 <ol>
16042 <li>One
16043 <li>Two
16044 </ol>
16045 !! html/php+tidy
16046 <ol>
16047 <li>One</li>
16048 <li>Two</li>
16049 </ol>
16050 !! html/parsoid
16051 <ol data-parsoid='{"stx":"html"}'>
16052 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16053 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16054 </ol>
16055
16056 !! end
16057
16058 !! test
16059 HTML nested bullet list, closed tags (bug 5497)
16060 !! wikitext
16061 <ul>
16062 <li>One</li>
16063 <li>Two:
16064 <ul>
16065 <li>Sub-one</li>
16066 <li>Sub-two</li>
16067 </ul>
16068 </li>
16069 </ul>
16070 !! html
16071 <ul>
16072 <li>One</li>
16073 <li>Two:
16074 <ul>
16075 <li>Sub-one</li>
16076 <li>Sub-two</li>
16077 </ul>
16078 </li>
16079 </ul>
16080
16081 !! end
16082
16083 !! test
16084 HTML nested bullet list, open tags (bug 5497)
16085 !! wikitext
16086 <ul>
16087 <li>One
16088 <li>Two:
16089 <ul>
16090 <li>Sub-one
16091 <li>Sub-two
16092 </ul>
16093 </ul>
16094 !! html/php+tidy
16095 <ul>
16096 <li>One</li>
16097 <li>Two:
16098 <ul>
16099 <li>Sub-one</li>
16100 <li>Sub-two</li>
16101 </ul>
16102 </li>
16103 </ul>
16104 !! html/parsoid
16105 <ul>
16106 <li>One
16107 </li>
16108 <li>Two:
16109 <ul>
16110 <li>Sub-one
16111 </li>
16112 <li>Sub-two
16113 </li>
16114 </ul>
16115 </li>
16116 </ul>
16117
16118 !! end
16119
16120 !! test
16121 HTML nested ordered list, closed tags (bug 5497)
16122 !! wikitext
16123 <ol>
16124 <li>One</li>
16125 <li>Two:
16126 <ol>
16127 <li>Sub-one</li>
16128 <li>Sub-two</li>
16129 </ol>
16130 </li>
16131 </ol>
16132 !! html
16133 <ol>
16134 <li>One</li>
16135 <li>Two:
16136 <ol>
16137 <li>Sub-one</li>
16138 <li>Sub-two</li>
16139 </ol>
16140 </li>
16141 </ol>
16142
16143 !! end
16144
16145 !! test
16146 HTML nested ordered list, open tags (bug 5497)
16147 !! wikitext
16148 <ol>
16149 <li>One
16150 <li>Two:
16151 <ol>
16152 <li>Sub-one
16153 <li>Sub-two
16154 </ol>
16155 </ol>
16156 !! html/php
16157 <ol>
16158 <li>One
16159 <li>Two:
16160 <ol>
16161 <li>Sub-one
16162 <li>Sub-two
16163 </ol>
16164 </ol>
16165
16166 !! html/parsoid
16167 <ol>
16168 <li>One
16169 </li>
16170 <li>Two:
16171 <ol>
16172 <li>Sub-one
16173 </li>
16174 <li>Sub-two
16175 </li>
16176 </ol>
16177 </li>
16178 </ol>
16179
16180 !! end
16181
16182 !! test
16183 HTML ordered list item with parameters oddity
16184 !! wikitext
16185 <ol><li id="fragment">One</li>
16186 </ol>
16187 !! html
16188 <ol><li id="fragment">One</li>
16189 </ol>
16190
16191 !! end
16192
16193 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16194 !!test
16195 bug 5918: autonumbering
16196 !! wikitext
16197 [http://first/] [http://second] [ftp://ftp]
16198
16199 ftp://inlineftp
16200
16201 [mailto:enclosed@mail.tld With target]
16202
16203 [mailto:enclosed@mail.tld]
16204
16205 mailto:inline@mail.tld
16206 !! html/php
16207 <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>
16208 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16209 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16210 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16211 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16212 </p>
16213 !! html/parsoid
16214 <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>
16215 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16216 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16217 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16218 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16219 !! end
16220
16221
16222 #
16223 # Security and HTML correctness
16224 # From Nick Jenkins' fuzz testing
16225 #
16226
16227 !! test
16228 Fuzz testing: Parser13
16229 !! wikitext
16230 {|
16231 | http://a|
16232 !! html
16233 <table>
16234 <tr>
16235 <td>
16236 </td>
16237 </tr>
16238 </table>
16239
16240 !! end
16241
16242 !! test
16243 Fuzz testing: Parser14
16244 !! wikitext
16245 == onmouseover= ==
16246 http://__TOC__
16247 !! html
16248 <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>
16249 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16250 <ul>
16251 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16252 </ul>
16253 </div>
16254
16255
16256 !! html+tidy
16257 <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>
16258 <p>http://</p>
16259 <div id="toc" class="toc">
16260 <div id="toctitle">
16261 <h2>Contents</h2>
16262 </div>
16263 <ul>
16264 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16265 </ul>
16266 </div>
16267 <p></p>
16268 !! end
16269
16270 !! test
16271 Fuzz testing: Parser14-table
16272 !! wikitext
16273 ==a==
16274 {| STYLE=__TOC__
16275 !! html
16276 <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>
16277 <table style="&#95;_TOC&#95;_">
16278 <tr><td></td></tr>
16279 </table>
16280
16281 !! html+tidy
16282 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16283 <table style="__TOC__">
16284 <tr>
16285 <td></td>
16286 </tr>
16287 </table>
16288 !! end
16289
16290 # Known to produce bogus xml (extra </td>)
16291 !! test
16292 Fuzz testing: Parser16
16293 !! options
16294 noxml
16295 !! wikitext
16296 {|
16297 !https://||||||
16298 !! html
16299 <table>
16300 <tr>
16301 <th>https://</th>
16302 <th></th>
16303 <th></th>
16304 <th>
16305 </td>
16306 </tr>
16307 </table>
16308
16309 !! html+tidy
16310 <table>
16311 <tr>
16312 <th>https://</th>
16313 <th></th>
16314 <th></th>
16315 <th></th>
16316 </tr>
16317 </table>
16318 !! end
16319
16320 !! test
16321 Fuzz testing: Parser21
16322 !! wikitext
16323 {|
16324 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16325 |
16326 !! html
16327 <table>
16328 <tr>
16329 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16330 </th>
16331 <td>
16332 </td>
16333 </tr>
16334 </table>
16335
16336 !! end
16337
16338 !! test
16339 Fuzz testing: Parser22
16340 !! wikitext
16341 http://===r:::https://b
16342
16343 {|
16344 !! html
16345 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16346 </p>
16347 <table>
16348 <tr><td></td></tr>
16349 </table>
16350
16351 !! end
16352
16353 # Known to produce bad XML for now
16354 !! test
16355 Fuzz testing: Parser24
16356 !! options
16357 noxml
16358 !! wikitext
16359 {|
16360 {{{|
16361 <u CLASS=
16362 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16363 <br style="onmouseover='alert(document.cookie);' " />
16364
16365 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16366 |
16367 !! html
16368 <table>
16369 {{{|
16370 <u class="&#124;">}}}} &gt;
16371 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16372
16373 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16374 <tr>
16375 <td></u>
16376 </td>
16377 </tr>
16378 </table>
16379
16380 !! end
16381
16382 # Note: the current result listed for this is not what the original one was,
16383 # but the original bug was JavaScript injection, which is fixed in any case.
16384 # It's not clear that the original result listed was any more correct than the
16385 # current one. Original result:
16386 # <p>{{{|
16387 # </p>
16388 # <li class="&#124;&#124;">
16389 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16390 !!test
16391 Fuzz testing: Parser25 (bug 6055)
16392 !! wikitext
16393 {{{
16394 |
16395 <LI CLASS=||
16396 >
16397 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16398 !! html
16399 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16400 </p>
16401 !! end
16402
16403 !!test
16404 Fuzz testing: URL adjacent extension (with space, clean)
16405 !! wikitext
16406 http://example.com <nowiki>junk</nowiki>
16407 !! html/php
16408 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16409 </p>
16410 !! html/parsoid
16411 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16412 !! end
16413
16414 !!test
16415 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16416 !! wikitext
16417 http://example.com<nowiki>junk</nowiki>
16418 !! html/php
16419 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16420 </p>
16421 !! html/parsoid
16422 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16423 !! end
16424
16425 !!test
16426 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16427 !! wikitext
16428 http://example.com<pre>junk</pre>
16429 !! html/php
16430 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16431
16432 !! html/php+tidy
16433 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16434 <pre>
16435 junk
16436 </pre>
16437 !! html/parsoid
16438 <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>
16439 !!end
16440
16441 !!test
16442 Fuzz testing: image with bogus manual thumbnail
16443 !! wikitext
16444 [[Image:foobar.jpg|thumbnail= ]]
16445 !! html/php
16446 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16447
16448 !! html/parsoid
16449 <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>
16450 !!end
16451
16452 !! test
16453 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16454 !! wikitext
16455 <pre dir="&#10;"></pre>
16456 !! html
16457 <pre dir="&#10;"></pre>
16458
16459 !! end
16460
16461 !! test
16462 Parsing optional HTML elements (Bug 6171)
16463 !! options
16464 !! wikitext
16465 <table>
16466 <tr>
16467 <td> Some tabular data</td>
16468 <td> More tabular data ...
16469 <td> And yet som tabular data</td>
16470 </tr>
16471 </table>
16472 !! html
16473 <table>
16474 <tr>
16475 <td> Some tabular data</td>
16476 <td> More tabular data ...
16477 </td><td> And yet som tabular data</td>
16478 </tr>
16479 </table>
16480
16481 !! end
16482
16483 !! test
16484 Correct handling of <td>, <tr> (Bug 6171)
16485 !! options
16486 !! wikitext
16487 <table>
16488 <tr>
16489 <td> Some tabular data</td>
16490 <td> More tabular data ...</td>
16491 <td> And yet som tabular data</td>
16492 </tr>
16493 </table>
16494 !! html
16495 <table>
16496 <tr>
16497 <td> Some tabular data</td>
16498 <td> More tabular data ...</td>
16499 <td> And yet som tabular data</td>
16500 </tr>
16501 </table>
16502
16503 !! end
16504
16505
16506 !! test
16507 Parsing crashing regression (fr:JavaScript)
16508 !! wikitext
16509 </body></x>
16510 !! html
16511 <p>&lt;/body&gt;&lt;/x&gt;
16512 </p>
16513 !! end
16514
16515 !! test
16516 Inline wiki vs wiki block nesting
16517 !! wikitext
16518 '''Bold paragraph
16519
16520 New wiki paragraph
16521 !! html
16522 <p><b>Bold paragraph</b>
16523 </p><p>New wiki paragraph
16524 </p>
16525 !! end
16526
16527 # FIXME: The current php output is documented
16528 # and desired output is the parsoid target.
16529 !! test
16530 Inline HTML vs wiki block nesting
16531 !! wikitext
16532 <b>Bold paragraph
16533
16534 New wiki paragraph
16535 !! html/php
16536 <p><b>Bold paragraph
16537 </p><p>New wiki paragraph</b>
16538 </p>
16539 !! html/parsoid
16540 <p><b>Bold paragraph</b>
16541 </p><p>New wiki paragraph
16542 </p>
16543 !! end
16544
16545 # Original result was this:
16546 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16547 # </p>
16548 # While that might be marginally more intuitive, maybe, the six-apostrophe
16549 # construct is clearly pathological and the result stated here (which is what
16550 # the parser actually does) is about as reasonable as anything.
16551 !!test
16552 Mixing markup for italics and bold
16553 !! options
16554 !! wikitext
16555 '''bold''''''bold''bolditalics'''''
16556 !! html
16557 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16558 </p>
16559 !! end
16560
16561
16562 !! article
16563 Xyzzyx
16564 !! text
16565 Article for special page transclusion test
16566 !! endarticle
16567
16568 !! test
16569 Special page transclusion
16570 !! options
16571 !! wikitext
16572 {{Special:Prefixindex/Xyzzyx}}
16573 !! html
16574 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16575
16576 !! end
16577
16578 !! test
16579 Special page transclusion twice (bug 5021)
16580 !! options
16581 !! wikitext
16582 {{Special:Prefixindex/Xyzzyx}}
16583 {{Special:Prefixindex/Xyzzyx}}
16584 !! html
16585 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
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 Transclusion of default MediaWiki message
16592 !! wikitext
16593 {{MediaWiki:Mainpage}}
16594 !! html
16595 <p>Main Page
16596 </p>
16597 !! end
16598
16599 !! test
16600 Transclusion of nonexistent MediaWiki message
16601 !! wikitext
16602 {{MediaWiki:Mainpagexxx}}
16603 !! html
16604 <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>
16605 </p>
16606 !! end
16607
16608 !! test
16609 Transclusion of MediaWiki message with underscore
16610 !! wikitext
16611 {{MediaWiki:history_short}}
16612 !! html
16613 <p>History
16614 </p>
16615 !! end
16616
16617 !! test
16618 Transclusion of MediaWiki message with space
16619 !! wikitext
16620 {{MediaWiki:history short}}
16621 !! html
16622 <p>History
16623 </p>
16624 !! end
16625
16626 !! test
16627 Invalid header with following text
16628 !! wikitext
16629 = x = y
16630 !! html
16631 <p>= x = y
16632 </p>
16633 !! end
16634
16635
16636 !! test
16637 Section extraction test (section 0)
16638 !! options
16639 section=0
16640 !! wikitext
16641 start
16642 ==a==
16643 ===aa===
16644 ====aaa====
16645 ==b==
16646 ===ba===
16647 ===bb===
16648 ====bba====
16649 ===bc===
16650 ==c==
16651 ===ca===
16652 !! html
16653 start
16654 !! end
16655
16656 !! test
16657 Section extraction test (section 1)
16658 !! options
16659 section=1
16660 !! wikitext
16661 start
16662 ==a==
16663 ===aa===
16664 ====aaa====
16665 ==b==
16666 ===ba===
16667 ===bb===
16668 ====bba====
16669 ===bc===
16670 ==c==
16671 ===ca===
16672 !! html
16673 ==a==
16674 ===aa===
16675 ====aaa====
16676 !! end
16677
16678 !! test
16679 Section extraction test (section 2)
16680 !! options
16681 section=2
16682 !! wikitext
16683 start
16684 ==a==
16685 ===aa===
16686 ====aaa====
16687 ==b==
16688 ===ba===
16689 ===bb===
16690 ====bba====
16691 ===bc===
16692 ==c==
16693 ===ca===
16694 !! html
16695 ===aa===
16696 ====aaa====
16697 !! end
16698
16699 !! test
16700 Section extraction test (section 3)
16701 !! options
16702 section=3
16703 !! wikitext
16704 start
16705 ==a==
16706 ===aa===
16707 ====aaa====
16708 ==b==
16709 ===ba===
16710 ===bb===
16711 ====bba====
16712 ===bc===
16713 ==c==
16714 ===ca===
16715 !! html
16716 ====aaa====
16717 !! end
16718
16719 !! test
16720 Section extraction test (section 4)
16721 !! options
16722 section=4
16723 !! wikitext
16724 start
16725 ==a==
16726 ===aa===
16727 ====aaa====
16728 ==b==
16729 ===ba===
16730 ===bb===
16731 ====bba====
16732 ===bc===
16733 ==c==
16734 ===ca===
16735 !! html
16736 ==b==
16737 ===ba===
16738 ===bb===
16739 ====bba====
16740 ===bc===
16741 !! end
16742
16743 !! test
16744 Section extraction test (section 5)
16745 !! options
16746 section=5
16747 !! wikitext
16748 start
16749 ==a==
16750 ===aa===
16751 ====aaa====
16752 ==b==
16753 ===ba===
16754 ===bb===
16755 ====bba====
16756 ===bc===
16757 ==c==
16758 ===ca===
16759 !! html
16760 ===ba===
16761 !! end
16762
16763 !! test
16764 Section extraction test (section 6)
16765 !! options
16766 section=6
16767 !! wikitext
16768 start
16769 ==a==
16770 ===aa===
16771 ====aaa====
16772 ==b==
16773 ===ba===
16774 ===bb===
16775 ====bba====
16776 ===bc===
16777 ==c==
16778 ===ca===
16779 !! html
16780 ===bb===
16781 ====bba====
16782 !! end
16783
16784 !! test
16785 Section extraction test (section 7)
16786 !! options
16787 section=7
16788 !! wikitext
16789 start
16790 ==a==
16791 ===aa===
16792 ====aaa====
16793 ==b==
16794 ===ba===
16795 ===bb===
16796 ====bba====
16797 ===bc===
16798 ==c==
16799 ===ca===
16800 !! html
16801 ====bba====
16802 !! end
16803
16804 !! test
16805 Section extraction test (section 8)
16806 !! options
16807 section=8
16808 !! wikitext
16809 start
16810 ==a==
16811 ===aa===
16812 ====aaa====
16813 ==b==
16814 ===ba===
16815 ===bb===
16816 ====bba====
16817 ===bc===
16818 ==c==
16819 ===ca===
16820 !! html
16821 ===bc===
16822 !! end
16823
16824 !! test
16825 Section extraction test (section 9)
16826 !! options
16827 section=9
16828 !! wikitext
16829 start
16830 ==a==
16831 ===aa===
16832 ====aaa====
16833 ==b==
16834 ===ba===
16835 ===bb===
16836 ====bba====
16837 ===bc===
16838 ==c==
16839 ===ca===
16840 !! html
16841 ==c==
16842 ===ca===
16843 !! end
16844
16845 !! test
16846 Section extraction test (section 10)
16847 !! options
16848 section=10
16849 !! wikitext
16850 start
16851 ==a==
16852 ===aa===
16853 ====aaa====
16854 ==b==
16855 ===ba===
16856 ===bb===
16857 ====bba====
16858 ===bc===
16859 ==c==
16860 ===ca===
16861 !! html
16862 ===ca===
16863 !! end
16864
16865 !! test
16866 Section extraction test (nonexistent section 11)
16867 !! options
16868 section=11
16869 !! wikitext
16870 start
16871 ==a==
16872 ===aa===
16873 ====aaa====
16874 ==b==
16875 ===ba===
16876 ===bb===
16877 ====bba====
16878 ===bc===
16879 ==c==
16880 ===ca===
16881 !! html
16882 !! end
16883
16884 !! test
16885 Section extraction test with bogus heading (section 1)
16886 !! options
16887 section=1
16888 !! wikitext
16889 ==a==
16890 ==bogus== not a legal section
16891 ==b==
16892 !! html
16893 ==a==
16894 ==bogus== not a legal section
16895 !! end
16896
16897 !! test
16898 Section extraction test with bogus heading (section 2)
16899 !! options
16900 section=2
16901 !! wikitext
16902 ==a==
16903 ==bogus== not a legal section
16904 ==b==
16905 !! html
16906 ==b==
16907 !! end
16908
16909 !! test
16910 Section extraction test with comment after heading (section 1)
16911 !! options
16912 section=1
16913 !! wikitext
16914 ==a==
16915 ==b== <!-- -->
16916 ==c==
16917 !! html
16918 ==a==
16919 !! end
16920
16921 !! test
16922 Section extraction test with comment after heading (section 2)
16923 !! options
16924 section=2
16925 !! wikitext
16926 ==a==
16927 ==b== <!-- -->
16928 ==c==
16929 !! html
16930 ==b== <!-- -->
16931 !! end
16932
16933 !! test
16934 Section extraction test with bogus <nowiki> heading (section 1)
16935 !! options
16936 section=1
16937 !! wikitext
16938 ==a==
16939 ==bogus== <nowiki>not a legal section</nowiki>
16940 ==b==
16941 !! html
16942 ==a==
16943 ==bogus== <nowiki>not a legal section</nowiki>
16944 !! end
16945
16946 !! test
16947 Section extraction test with bogus <nowiki> heading (section 2)
16948 !! options
16949 section=2
16950 !! wikitext
16951 ==a==
16952 ==bogus== <nowiki>not a legal section</nowiki>
16953 ==b==
16954 !! html
16955 ==b==
16956 !! end
16957
16958
16959 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16960 # instead of respecting commented sections
16961 !! test
16962 Section extraction prefixed by comment (section 1)
16963 !! options
16964 section=1
16965 !! wikitext
16966 <!-- -->==sec1==
16967 ==sec2==
16968 !! html
16969 ==sec2==
16970 !!end
16971
16972 !! test
16973 Section extraction prefixed by comment (section 2)
16974 !! options
16975 section=2
16976 !! wikitext
16977 <!-- -->==sec1==
16978 ==sec2==
16979 !! html
16980
16981 !!end
16982
16983
16984 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16985 # instead of respecting HTML-style headings
16986 !! test
16987 Section extraction, mixed wiki and html (section 1)
16988 !! options
16989 section=1
16990 !! wikitext
16991 <h2>unmarked</h2>
16992 unmarked
16993 ==1==
16994 one
16995 ==2==
16996 two
16997 !! html
16998 ==1==
16999 one
17000 !! end
17001
17002 !! test
17003 Section extraction, mixed wiki and html (section 2)
17004 !! options
17005 section=2
17006 !! wikitext
17007 <h2>unmarked</h2>
17008 unmarked
17009 ==1==
17010 one
17011 ==2==
17012 two
17013 !! html
17014 ==2==
17015 two
17016 !! end
17017
17018
17019 # Formerly testing for bug 3342
17020 !! test
17021 Section extraction, heading surrounded by <noinclude>
17022 !! options
17023 section=1
17024 !! wikitext
17025 <noinclude>==unmarked==</noinclude>
17026 ==marked==
17027 !! html
17028 ==marked==
17029 !!end
17030
17031 # Test behavior of bug 19910
17032 !! test
17033 Sectiion with all-equals
17034 !! options
17035 section=2
17036 !! wikitext
17037 ===
17038 The line above must have a trailing space
17039 === <!--
17040 --> <!-- -->
17041 But just in case it doesn't...
17042 !! html
17043 === <!--
17044 --> <!-- -->
17045 But just in case it doesn't...
17046 !! end
17047
17048 !! test
17049 Section replacement test (section 0)
17050 !! options
17051 replace=0,"xxx"
17052 !! wikitext
17053 start
17054 ==a==
17055 ===aa===
17056 ====aaa====
17057 ==b==
17058 ===ba===
17059 ===bb===
17060 ====bba====
17061 ===bc===
17062 ==c==
17063 ===ca===
17064 !! html
17065 xxx
17066
17067 ==a==
17068 ===aa===
17069 ====aaa====
17070 ==b==
17071 ===ba===
17072 ===bb===
17073 ====bba====
17074 ===bc===
17075 ==c==
17076 ===ca===
17077 !! end
17078
17079 !! test
17080 Section replacement test (section 1)
17081 !! options
17082 replace=1,"xxx"
17083 !! wikitext
17084 start
17085 ==a==
17086 ===aa===
17087 ====aaa====
17088 ==b==
17089 ===ba===
17090 ===bb===
17091 ====bba====
17092 ===bc===
17093 ==c==
17094 ===ca===
17095 !! html
17096 start
17097 xxx
17098
17099 ==b==
17100 ===ba===
17101 ===bb===
17102 ====bba====
17103 ===bc===
17104 ==c==
17105 ===ca===
17106 !! end
17107
17108 !! test
17109 Section replacement test (section 2)
17110 !! options
17111 replace=2,"xxx"
17112 !! wikitext
17113 start
17114 ==a==
17115 ===aa===
17116 ====aaa====
17117 ==b==
17118 ===ba===
17119 ===bb===
17120 ====bba====
17121 ===bc===
17122 ==c==
17123 ===ca===
17124 !! html
17125 start
17126 ==a==
17127 xxx
17128
17129 ==b==
17130 ===ba===
17131 ===bb===
17132 ====bba====
17133 ===bc===
17134 ==c==
17135 ===ca===
17136 !! end
17137
17138 !! test
17139 Section replacement test (section 3)
17140 !! options
17141 replace=3,"xxx"
17142 !! wikitext
17143 start
17144 ==a==
17145 ===aa===
17146 ====aaa====
17147 ==b==
17148 ===ba===
17149 ===bb===
17150 ====bba====
17151 ===bc===
17152 ==c==
17153 ===ca===
17154 !! html
17155 start
17156 ==a==
17157 ===aa===
17158 xxx
17159
17160 ==b==
17161 ===ba===
17162 ===bb===
17163 ====bba====
17164 ===bc===
17165 ==c==
17166 ===ca===
17167 !! end
17168
17169 !! test
17170 Section replacement test (section 4)
17171 !! options
17172 replace=4,"xxx"
17173 !! wikitext
17174 start
17175 ==a==
17176 ===aa===
17177 ====aaa====
17178 ==b==
17179 ===ba===
17180 ===bb===
17181 ====bba====
17182 ===bc===
17183 ==c==
17184 ===ca===
17185 !! html
17186 start
17187 ==a==
17188 ===aa===
17189 ====aaa====
17190 xxx
17191
17192 ==c==
17193 ===ca===
17194 !! end
17195
17196 !! test
17197 Section replacement test (section 5)
17198 !! options
17199 replace=5,"xxx"
17200 !! wikitext
17201 start
17202 ==a==
17203 ===aa===
17204 ====aaa====
17205 ==b==
17206 ===ba===
17207 ===bb===
17208 ====bba====
17209 ===bc===
17210 ==c==
17211 ===ca===
17212 !! html
17213 start
17214 ==a==
17215 ===aa===
17216 ====aaa====
17217 ==b==
17218 xxx
17219
17220 ===bb===
17221 ====bba====
17222 ===bc===
17223 ==c==
17224 ===ca===
17225 !! end
17226
17227 !! test
17228 Section replacement test (section 6)
17229 !! options
17230 replace=6,"xxx"
17231 !! wikitext
17232 start
17233 ==a==
17234 ===aa===
17235 ====aaa====
17236 ==b==
17237 ===ba===
17238 ===bb===
17239 ====bba====
17240 ===bc===
17241 ==c==
17242 ===ca===
17243 !! html
17244 start
17245 ==a==
17246 ===aa===
17247 ====aaa====
17248 ==b==
17249 ===ba===
17250 xxx
17251
17252 ===bc===
17253 ==c==
17254 ===ca===
17255 !! end
17256
17257 !! test
17258 Section replacement test (section 7)
17259 !! options
17260 replace=7,"xxx"
17261 !! wikitext
17262 start
17263 ==a==
17264 ===aa===
17265 ====aaa====
17266 ==b==
17267 ===ba===
17268 ===bb===
17269 ====bba====
17270 ===bc===
17271 ==c==
17272 ===ca===
17273 !! html
17274 start
17275 ==a==
17276 ===aa===
17277 ====aaa====
17278 ==b==
17279 ===ba===
17280 ===bb===
17281 xxx
17282
17283 ===bc===
17284 ==c==
17285 ===ca===
17286 !! end
17287
17288 !! test
17289 Section replacement test (section 8)
17290 !! options
17291 replace=8,"xxx"
17292 !! wikitext
17293 start
17294 ==a==
17295 ===aa===
17296 ====aaa====
17297 ==b==
17298 ===ba===
17299 ===bb===
17300 ====bba====
17301 ===bc===
17302 ==c==
17303 ===ca===
17304 !! html
17305 start
17306 ==a==
17307 ===aa===
17308 ====aaa====
17309 ==b==
17310 ===ba===
17311 ===bb===
17312 ====bba====
17313 xxx
17314
17315 ==c==
17316 ===ca===
17317 !!end
17318
17319 !! test
17320 Section replacement test (section 9)
17321 !! options
17322 replace=9,"xxx"
17323 !! wikitext
17324 start
17325 ==a==
17326 ===aa===
17327 ====aaa====
17328 ==b==
17329 ===ba===
17330 ===bb===
17331 ====bba====
17332 ===bc===
17333 ==c==
17334 ===ca===
17335 !! html
17336 start
17337 ==a==
17338 ===aa===
17339 ====aaa====
17340 ==b==
17341 ===ba===
17342 ===bb===
17343 ====bba====
17344 ===bc===
17345 xxx
17346 !! end
17347
17348 !! test
17349 Section replacement test (section 10)
17350 !! options
17351 replace=10,"xxx"
17352 !! wikitext
17353 start
17354 ==a==
17355 ===aa===
17356 ====aaa====
17357 ==b==
17358 ===ba===
17359 ===bb===
17360 ====bba====
17361 ===bc===
17362 ==c==
17363 ===ca===
17364 !! html
17365 start
17366 ==a==
17367 ===aa===
17368 ====aaa====
17369 ==b==
17370 ===ba===
17371 ===bb===
17372 ====bba====
17373 ===bc===
17374 ==c==
17375 xxx
17376 !! end
17377
17378 !! test
17379 Section replacement test with initial whitespace (bug 13728)
17380 !! options
17381 replace=2,"xxx"
17382 !! wikitext
17383 Preformatted initial line
17384 ==a==
17385 ===a===
17386 !! html
17387 Preformatted initial line
17388 ==a==
17389 xxx
17390 !! end
17391
17392
17393 !! test
17394 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17395 !! options
17396 section=1
17397 !! wikitext
17398 ==a==
17399 a
17400 !! html
17401 ==a==
17402 a
17403 !! end
17404
17405 !! test
17406 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17407 !! options
17408 section=1
17409 !! wikitext
17410 ==a==
17411 a
17412 !! html
17413 ==a==
17414 a
17415 !! end
17416
17417
17418 !! test
17419 Section extraction, <pre> around bogus header (bug 10309)
17420 !! options
17421 noxml section=2
17422 !! wikitext
17423 == Section One ==
17424 <pre>
17425 =======
17426 </pre>
17427
17428 == Section Two ==
17429 stuff
17430 !! html
17431 == Section Two ==
17432 stuff
17433 !! end
17434
17435 !! test
17436 Section replacement, <pre> around bogus header (bug 10309)
17437 !! options
17438 noxml replace=2,"xxx"
17439 !! wikitext
17440 == Section One ==
17441 <pre>
17442 =======
17443 </pre>
17444
17445 == Section Two ==
17446 stuff
17447 !! html
17448 == Section One ==
17449 <pre>
17450 =======
17451 </pre>
17452
17453 xxx
17454 !! end
17455
17456
17457
17458 !! test
17459 Handling of &#x0A; in URLs
17460 !! wikitext
17461 ** irc://&#x0A;a
17462 !! html/php
17463 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17464
17465 !! html/parsoid
17466 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17467 a">irc://
17468 a</a></li></ul></li></ul>
17469 !! end
17470
17471 !! test
17472 Handling of %0A in URLs
17473 !! wikitext
17474 ** irc://%0Aa
17475 !! html/php
17476 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17477
17478 !! html/parsoid
17479 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17480 !! end
17481
17482
17483 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17484 !! test
17485 5 quotes, code coverage +1 line
17486 !! options
17487 parsoid=wt2html
17488 !! wikitext
17489 '''''
17490 !! html/php
17491 !! html/parsoid
17492 <p><b><i></i></b></p>
17493 !! end
17494
17495 # same html as previous, but wikitext adjusted to match parsoid html2wt
17496 # note that wt2html and html2html will put the <i> before the <b>
17497 !! test
17498 5 quotes, code coverage +1 line w/ nowiki (1)
17499 !! options
17500 parsoid=wt2wt,html2wt
17501 !! wikitext
17502 '''''<nowiki/>'''''
17503 !! html/php
17504 <p><i></i>
17505 </p>
17506 !! html/parsoid
17507 <p><b><i></i></b></p>
17508 !! end
17509
17510 # same as previous, just swapping the <i> and <b>
17511 !! test
17512 5 quotes, code coverage +1 line w/ nowiki (2)
17513 !! wikitext
17514 '''''<nowiki/>'''''
17515 !! html/php
17516 <p><i></i>
17517 </p>
17518 !! html/parsoid
17519 <p><i><b></b></i></p>
17520 !! end
17521
17522 !! test
17523 Special:Search page linking.
17524 !! wikitext
17525 {{Special:search}}
17526 !! html
17527 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17528 </p>
17529 !! end
17530
17531 !! test
17532 {{!}} is a magic word
17533 !! wikitext
17534 {{!}} is a magic word there and {{!}} is still a magic word here
17535 !! html/php
17536 <p>| is a magic word there and | is still a magic word here
17537 </p>
17538 !! html/parsoid
17539 <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>
17540 !! end
17541
17542 !! test
17543 Say the magic word
17544 !! options
17545 title=[[Parser test]]
17546 !! wikitext
17547 * {{PAGENAME}}
17548 * {{PAGENAMEE}}
17549 * {{FULLPAGENAME}}
17550 * {{FULLPAGENAMEE}}
17551 * {{BASEPAGENAME}}
17552 * {{BASEPAGENAMEE}}
17553 * {{SUBPAGENAME}}
17554 * {{SUBPAGENAMEE}}
17555 * {{ROOTPAGENAME}}
17556 * {{ROOTPAGENAMEE}}
17557 * {{TALKPAGENAME}}
17558 * {{TALKPAGENAMEE}}
17559 * {{SUBJECTPAGENAME}}
17560 * {{SUBJECTPAGENAMEE}}
17561 * {{NAMESPACEE}}
17562 * {{NAMESPACE}}
17563 * {{NAMESPACENUMBER}}
17564 * {{TALKSPACE}}
17565 * {{TALKSPACEE}}
17566 * {{SUBJECTSPACE}}
17567 * {{SUBJECTSPACEE}}
17568 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17569 !! html
17570 <ul><li> Parser test</li>
17571 <li> Parser_test</li>
17572 <li> Parser test</li>
17573 <li> Parser_test</li>
17574 <li> Parser test</li>
17575 <li> Parser_test</li>
17576 <li> Parser test</li>
17577 <li> Parser_test</li>
17578 <li> Parser test</li>
17579 <li> Parser_test</li>
17580 <li> Talk:Parser test</li>
17581 <li> Talk:Parser_test</li>
17582 <li> Parser test</li>
17583 <li> Parser_test</li>
17584 <li> </li>
17585 <li> </li>
17586 <li> 0</li>
17587 <li> Talk</li>
17588 <li> Talk</li>
17589 <li> </li>
17590 <li> </li>
17591 <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>
17592
17593 !! end
17594 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17595
17596 !! test
17597 Gallery
17598 !! wikitext
17599 <gallery>
17600 image1.png |
17601 image2.gif|||||
17602
17603 image3|
17604 image4 |300px| centre
17605 image5.svg| http://///////
17606 [[x|xx]]]]
17607 * image6
17608 </gallery>
17609 !! html
17610 <ul class="gallery mw-gallery-traditional">
17611 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17612 <div class="thumb" style="height: 150px;">Image1.png</div>
17613 <div class="gallerytext">
17614 </div>
17615 </div></li>
17616 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17617 <div class="thumb" style="height: 150px;">Image2.gif</div>
17618 <div class="gallerytext">
17619 <p>||||
17620 </p>
17621 </div>
17622 </div></li>
17623 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17624 <div class="thumb" style="height: 150px;">Image3</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;">Image4</div>
17630 <div class="gallerytext">
17631 <p>300px| centre
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;">Image5.svg</div>
17637 <div class="gallerytext">
17638 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17639 </p>
17640 </div>
17641 </div></li>
17642 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17643 <div class="thumb" style="height: 150px;">* image6</div>
17644 <div class="gallerytext">
17645 </div>
17646 </div></li>
17647 </ul>
17648
17649 !! end
17650
17651 !! test
17652 Gallery (with options)
17653 !! wikitext
17654 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17655 File:Nonexistent.jpg|caption
17656 File:Nonexistent.jpg
17657 image:foobar.jpg|some '''caption''' [[Main Page]]
17658 image:foobar.jpg
17659 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17660 </gallery>
17661 !! html
17662 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17663 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17664 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17665 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17666 <div class="gallerytext">
17667 <p>caption
17668 </p>
17669 </div>
17670 </div></li>
17671 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17672 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17673 <div class="gallerytext">
17674 </div>
17675 </div></li>
17676 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17677 <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>
17678 <div class="gallerytext">
17679 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17680 </p>
17681 </div>
17682 </div></li>
17683 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17684 <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>
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="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>
17690 <div class="gallerytext">
17691 <p>Blabla|blabla.
17692 </p>
17693 </div>
17694 </div></li>
17695 </ul>
17696
17697 !! end
17698
17699 !! test
17700 Gallery with link that has fragment
17701 !! wikitext
17702 <gallery>
17703 image:foobar.jpg|link=Main_Page
17704 image:foobar.jpg|link=Main_Page#section
17705 image:foobar.jpg|link=Main Page#section|caption
17706 </gallery>
17707 !! html
17708 <ul class="gallery mw-gallery-traditional">
17709 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17710 <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>
17711 <div class="gallerytext">
17712 </div>
17713 </div></li>
17714 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17715 <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>
17716 <div class="gallerytext">
17717 </div>
17718 </div></li>
17719 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17720 <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>
17721 <div class="gallerytext">
17722 <p>caption
17723 </p>
17724 </div>
17725 </div></li>
17726 </ul>
17727
17728 !! end
17729
17730 !! test
17731 Gallery with wikitext inside caption
17732 !! wikitext
17733 <gallery>
17734 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17735 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17736 </gallery>
17737 !! html
17738 <ul class="gallery mw-gallery-traditional">
17739 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17740 <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>
17741 <div class="gallerytext">
17742 <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>
17743 </p>
17744 </div>
17745 </div></li>
17746 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17747 <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>
17748 <div class="gallerytext">
17749 <p>This is a test template
17750 </p>
17751 </div>
17752 </div></li>
17753 </ul>
17754
17755 !! end
17756
17757 !! test
17758 gallery (with showfilename option)
17759 !! wikitext
17760 <gallery showfilename>
17761 File:Nonexistent.jpg|caption
17762 File:Nonexistent.jpg
17763 image:foobar.jpg|some '''caption''' [[Main Page]]
17764 File:Foobar.jpg
17765 </gallery>
17766 !! html
17767 <ul class="gallery mw-gallery-traditional">
17768 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17769 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17770 <div class="gallerytext">
17771 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17772 caption
17773 </p>
17774 </div>
17775 </div></li>
17776 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17777 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17778 <div class="gallerytext">
17779 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17780 </p>
17781 </div>
17782 </div></li>
17783 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17784 <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>
17785 <div class="gallerytext">
17786 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17787 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17788 </p>
17789 </div>
17790 </div></li>
17791 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17792 <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>
17793 <div class="gallerytext">
17794 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17795 </p>
17796 </div>
17797 </div></li>
17798 </ul>
17799
17800 !! end
17801
17802 !! test
17803 Gallery (with namespace-less filenames)
17804 !! wikitext
17805 <gallery>
17806 File:Nonexistent.jpg
17807 Nonexistent.jpg
17808 image:foobar.jpg
17809 foobar.jpg
17810 </gallery>
17811 !! html
17812 <ul class="gallery mw-gallery-traditional">
17813 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17814 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17815 <div class="gallerytext">
17816 </div>
17817 </div></li>
17818 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17819 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17820 <div class="gallerytext">
17821 </div>
17822 </div></li>
17823 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17824 <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>
17825 <div class="gallerytext">
17826 </div>
17827 </div></li>
17828 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17829 <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>
17830 <div class="gallerytext">
17831 </div>
17832 </div></li>
17833 </ul>
17834
17835 !! end
17836
17837 !! test
17838 HTML Hex character encoding (spells the word "JavaScript")
17839 !! options
17840 parsoid=wt2html,wt2wt,html2html
17841 !! wikitext
17842 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17843 !! html/php
17844 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17845 </p>
17846 !! html/php+tidy
17847 <p>JavaScript</p>
17848 !! html/parsoid
17849 <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>
17850 !! end
17851
17852 !! test
17853 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17854 !! wikitext
17855 &#xsee;&#XSEE;
17856 !! html/php
17857 <p>&amp;#xsee;&amp;#XSEE;
17858 </p>
17859 !! html/parsoid
17860 <p>&amp;#xsee;&amp;#XSEE;</p>
17861 !! end
17862
17863 !! test
17864 HTML Hex character encoding mixed case
17865 !! options
17866 parsoid=wt2html,wt2wt,html2html
17867 !! wikitext
17868 &#xEE;&#Xee;
17869 !! html/php
17870 <p>&#xee;&#xee;
17871 </p>
17872 !! html/php+tidy
17873 <p>îî</p>
17874 !! html/parsoid
17875 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17876 !! end
17877
17878 !! test
17879 __FORCETOC__ override
17880 !! wikitext
17881 __NEWSECTIONLINK__
17882 __FORCETOC__
17883 !! html/php
17884 <p><br />
17885 </p>
17886 !! end
17887
17888 !! test
17889 ISBN code coverage
17890 !! wikitext
17891 ISBN 978-0-1234-56&#x20;789
17892 !! html
17893 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17894 </p>
17895 !! html+tidy
17896 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17897 !! html/parsoid
17898 <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>
17899 !! end
17900
17901 !! test
17902 ISBN followed by 5 spaces
17903 !! wikitext
17904 ISBN
17905 !! html
17906 <p>ISBN
17907 </p>
17908 !! end
17909
17910 !! test
17911 Double ISBN
17912 !! wikitext
17913 ISBN ISBN 1234567890
17914 !! html/php
17915 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17916 </p>
17917 !! html/parsoid
17918 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17919 !! end
17920
17921 !! test
17922 ISBN with an X
17923 !! wikitext
17924 ISBN 3-462-04561-X
17925 ISBN 080442957X
17926 ISBN 978080442957X
17927 !! html/php
17928 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17929 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17930 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17931 </p>
17932 !! html/parsoid
17933 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17934 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17935 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17936 !! end
17937
17938 !! test
17939 ISBN with empty prefix (parsoid test)
17940 !! wikitext
17941 ISBN 1234567890
17942 !! html/php
17943 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17944 </p>
17945 !! html/parsoid
17946 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17947 !! end
17948
17949 !! test
17950 Bug 22905: <abbr> followed by ISBN followed by </a>
17951 !! wikitext
17952 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17953 !! html/php
17954 <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>
17955 </p>
17956 !! html/parsoid
17957 <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>
17958 !! end
17959
17960 !! test
17961 Double RFC
17962 !! wikitext
17963 RFC RFC 1234
17964 !! html
17965 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17966 </p>
17967 !! end
17968
17969 !! test
17970 Double RFC with a wiki link
17971 !! wikitext
17972 RFC [[RFC 1234]]
17973 !! html
17974 <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>
17975 </p>
17976 !! end
17977
17978 !! test
17979 RFC code coverage
17980 !! wikitext
17981 RFC 983&#x20;987
17982 !! html
17983 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17984 </p>
17985 !! html+tidy
17986 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17987 !! end
17988
17989 !! test
17990 Centre-aligned image
17991 !! wikitext
17992 [[Image:foobar.jpg|centre]]
17993 !! html
17994 <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>
17995
17996 !!end
17997
17998 !! test
17999 None-aligned image
18000 !! wikitext
18001 [[Image:foobar.jpg|none]]
18002 !! html
18003 <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>
18004
18005 !!end
18006
18007 !! test
18008 Width + Height sized image (using px) (height is ignored)
18009 !! wikitext
18010 [[Image:foobar.jpg|640x480px]]
18011 !! html
18012 <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>
18013 </p>
18014 !!end
18015
18016 !! test
18017 Width-sized image (using px, no following whitespace)
18018 !! wikitext
18019 [[Image:foobar.jpg|640px]]
18020 !! html
18021 <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>
18022 </p>
18023 !!end
18024
18025 !! test
18026 Width-sized image (using px, with following whitespace - test regression from r39467)
18027 !! wikitext
18028 [[Image:foobar.jpg|640px ]]
18029 !! html
18030 <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>
18031 </p>
18032 !!end
18033
18034 !! test
18035 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18036 !! wikitext
18037 [[Image:foobar.jpg| 640px]]
18038 !! html
18039 <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>
18040 </p>
18041 !!end
18042
18043 !! test
18044 Image with page parameter
18045 !! options
18046 djvu
18047 !! wikitext
18048 [[File:LoremIpsum.djvu|page=2]]
18049 !! html/php
18050 <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>
18051 </p>
18052 !! html/parsoid
18053 <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>
18054 !! end
18055
18056 !! test
18057 Another italics / bold test
18058 !! wikitext
18059 ''' ''x'
18060 !! html
18061 <pre>'<i> </i>x'
18062 </pre>
18063 !!end
18064
18065 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18066 !! test
18067 dt/dd/dl test
18068 !! wikitext
18069 :;;;::
18070 !! html/php
18071 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18072
18073 !! html/parsoid
18074 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18075
18076 !!end
18077
18078
18079 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18080 !! test
18081 Images with the "|" character in the comment
18082 !! wikitext
18083 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18084 !! html/php
18085 <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>
18086
18087 !! html/parsoid
18088 <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>
18089 !! end
18090
18091 !! test
18092 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18093 !! wikitext
18094 <html><script>alert(1);</script></html>
18095 !! html
18096 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18097 </p>
18098 !! end
18099
18100 !! test
18101 HTML with raw HTML ($wgRawHtml==true)
18102 !! options
18103 wgRawHtml=1
18104 !! wikitext
18105 <html><script>alert(1);</script></html>
18106 !! html
18107 <p><script>alert(1);</script>
18108 </p>
18109 !! end
18110
18111 !! test
18112 Parents of subpages, one level up
18113 !! options
18114 subpage title=[[Subpage test/L1/L2/L3]]
18115 !! wikitext
18116 [[../|L2]]
18117 !! html
18118 <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>
18119 </p>
18120 !! end
18121
18122
18123 !! test
18124 Parents of subpages, one level up, not named
18125 !! options
18126 subpage title=[[Subpage test/L1/L2/L3]]
18127 !! wikitext
18128 [[../]]
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)">Subpage test/L1/L2</a>
18131 </p>
18132 !! end
18133
18134
18135
18136 !! test
18137 Parents of subpages, two levels up
18138 !! options
18139 subpage title=[[Subpage test/L1/L2/L3]]
18140 !! wikitext
18141 [[../../|L1]]2
18142
18143 [[../../|L1]]l
18144 !! html
18145 <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
18146 </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>
18147 </p>
18148 !! end
18149
18150 !! test
18151 Parents of subpages, two levels up, without trailing slash or name.
18152 !! options
18153 subpage title=[[Subpage test/L1/L2/L3]]
18154 !! wikitext
18155 [[../..]]
18156 !! html
18157 <p>[[../..]]
18158 </p>
18159 !! end
18160
18161 !! test
18162 Parents of subpages, two levels up, with lots of extra trailing slashes.
18163 !! options
18164 subpage title=[[Subpage test/L1/L2/L3]]
18165 !! wikitext
18166 [[../../////]]
18167 !! html
18168 <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>
18169 </p>
18170 !! end
18171
18172 !! article
18173 Subpage test/L1/L2/L3Sibling
18174 !! text
18175 Sibling article
18176 !! endarticle
18177
18178 !! test
18179 Transclusion of a sibling page (one level up)
18180 !! options
18181 subpage title=[[Subpage test/L1/L2/L3]]
18182 !! wikitext
18183 {{../L3Sibling}}
18184 !! html
18185 <p>Sibling article
18186 </p>
18187 !! end
18188
18189 !! test
18190 Transclusion of a child page
18191 !! options
18192 subpage title=[[Subpage test/L1/L2]]
18193 !! wikitext
18194 {{/L3Sibling}}
18195 !! html
18196 <p>Sibling article
18197 </p>
18198 !! end
18199
18200 !! test
18201 Non-transclusion because of too many up levels
18202 !! options
18203 subpage title=[[Subpage test/L1/L2/L3]]
18204 !! wikitext
18205 {{../../../../More than parent}}
18206 !! html
18207 <p>{{../../../../More than parent}}
18208 </p>
18209 !! end
18210
18211 !! test
18212 Definition list code coverage
18213 !! wikitext
18214 ; title : def
18215 ; title : def
18216 ;title: def
18217 !! html/php
18218 <dl><dt> title &#160;</dt>
18219 <dd> def</dd>
18220 <dt> title&#160;</dt>
18221 <dd> def</dd>
18222 <dt>title</dt>
18223 <dd> def</dd></dl>
18224
18225 !! html/parsoid
18226 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18227 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18228 <dt>title</dt><dd> def</dd></dl>
18229 !! end
18230
18231 !! test
18232 Don't fall for the self-closing div
18233 !! wikitext
18234 <div>hello world</div/>
18235 !! html
18236 <div>hello world</div>
18237
18238 !! end
18239
18240 !! test
18241 MSGNW magic word
18242 !! wikitext
18243 {{MSGNW:msg}}
18244 !! html
18245 <p>&#91;&#91;:Template:Msg&#93;&#93;
18246 </p>
18247 !! end
18248
18249 !! test
18250 RAW magic word
18251 !! wikitext
18252 {{RAW:QUERTY}}
18253 !! html
18254 <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>
18255 </p>
18256 !! end
18257
18258 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18259 !! test
18260 Always escape literal '>' in output, not just after '<'
18261 !! wikitext
18262 ><>
18263 !! html
18264 <p>&gt;&lt;&gt;
18265 </p>
18266 !! end
18267
18268 !! test
18269 Template caching
18270 !! wikitext
18271 {{Test}}
18272 {{Test}}
18273 !! html
18274 <p>This is a test template
18275 This is a test template
18276 </p>
18277 !! end
18278
18279
18280 !! article
18281 MediaWiki:Fake
18282 !! text
18283 ==header==
18284 !! endarticle
18285
18286 !! test
18287 Inclusion of !userCanEdit() content
18288 !! wikitext
18289 {{MediaWiki:Fake}}
18290 !! html
18291 <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>
18292
18293 !! end
18294
18295
18296 !! test
18297 Out-of-order TOC heading levels
18298 !! wikitext
18299 ==2==
18300 ======6======
18301 ===3===
18302 =1=
18303 =====5=====
18304 ==2==
18305 !! html
18306 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18307 <ul>
18308 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18309 <ul>
18310 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18311 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18312 </ul>
18313 </li>
18314 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18315 <ul>
18316 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18317 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18318 </ul>
18319 </li>
18320 </ul>
18321 </div>
18322
18323 <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>
18324 <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>
18325 <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>
18326 <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>
18327 <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>
18328 <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>
18329
18330 !! end
18331
18332
18333 !! test
18334 ISBN with a dummy number
18335 !! wikitext
18336 ISBN ---
18337 !! html
18338 <p>ISBN ---
18339 </p>
18340 !! end
18341
18342
18343 !! test
18344 ISBN with space-delimited number
18345 !! wikitext
18346 ISBN 92 9017 032 8
18347 !! html
18348 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18349 </p>
18350 !! end
18351
18352
18353 !! test
18354 ISBN with multiple spaces, no number
18355 !! wikitext
18356 ISBN foo
18357 !! html
18358 <p>ISBN foo
18359 </p>
18360 !! end
18361
18362
18363 !! test
18364 ISBN length
18365 !! wikitext
18366 ISBN 123456789
18367
18368 ISBN 1234567890
18369
18370 ISBN 12345678901
18371 !! html
18372 <p>ISBN 123456789
18373 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18374 </p><p>ISBN 12345678901
18375 </p>
18376 !! end
18377
18378
18379 !! test
18380 ISBN with trailing year (bug 8110)
18381 !! wikitext
18382 ISBN 1-234-56789-0 - 2006
18383
18384 ISBN 1 234 56789 0 - 2006
18385 !! html
18386 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18387 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18388 </p>
18389 !! end
18390
18391
18392 !! test
18393 anchorencode
18394 !! wikitext
18395 {{anchorencode:foo bar©#%n}}
18396 !! html
18397 <p>foo_bar.C2.A9.23.25n
18398 </p>
18399 !! end
18400
18401 !! test
18402 anchorencode trims spaces
18403 !! wikitext
18404 {{anchorencode: __pretty__please__}}
18405 !! html
18406 <p>pretty_please
18407 </p>
18408 !! end
18409
18410 !! test
18411 anchorencode deals with links
18412 !! wikitext
18413 {{anchorencode: [[hello|world]] [[hi]]}}
18414 !! html
18415 <p>world_hi
18416 </p>
18417 !! end
18418
18419 !! test
18420 anchorencode deals with templates
18421 !! wikitext
18422 {{anchorencode: {{Foo}} }}
18423 !! html
18424 <p>FOO
18425 </p>
18426 !! end
18427
18428 !! test
18429 anchorencode encodes like the TOC generator: (bug 18431)
18430 !! wikitext
18431 === _ +:.3A%3A&&amp;]] ===
18432 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18433 __NOEDITSECTION__
18434 !! html
18435 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18436 <p>.2B:.3A.253A.26.26.5D.5D
18437 </p>
18438 !! end
18439
18440 !! test
18441 Bug 6200: blockquotes and paragraph formatting
18442 !! wikitext
18443 <blockquote>
18444 foo
18445 </blockquote>
18446
18447 bar
18448
18449 baz
18450 !! html
18451 <blockquote>
18452 <p>foo
18453 </p>
18454 </blockquote>
18455 <p>bar
18456 </p>
18457 <pre>baz
18458 </pre>
18459 !! end
18460
18461 !! test
18462 Bug 8293: Use of center tag ruins paragraph formatting
18463 !! wikitext
18464 <center>
18465 foo
18466 </center>
18467
18468 bar
18469
18470 baz
18471 !! html
18472 <center>
18473 <p>foo
18474 </p>
18475 </center>
18476 <p>bar
18477 </p>
18478 <pre>baz
18479 </pre>
18480 !! end
18481
18482 !!test
18483 Parsing of overlapping (improperly nested) inline html tags
18484 !! wikitext
18485 <span><s>x</span></s>
18486 !! html/php
18487 <p><span><s>x&lt;/span&gt;</s></span>
18488 </p>
18489 !! html/parsoid
18490 <p><span><s>x</s></span>
18491 </p>
18492 !!end
18493
18494 ###
18495 ### Language variants related tests
18496 ###
18497 !! test
18498 Self-link in language variants
18499 !! options
18500 title=[[Dunav]] language=sr
18501 !! wikitext
18502 Both [[Dunav]] and [[Дунав]] are names for this river.
18503 !! html
18504 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18505 </p>
18506 !!end
18507
18508 !! article
18509 Дуна
18510 !! text
18511 content
18512 !! endarticle
18513
18514 !! test
18515 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18516 !! options
18517 title=[[Duna]] language=sr
18518 !! wikitext
18519 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18520 !! html
18521 <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.
18522 </p>
18523 !! end
18524
18525 !! test
18526 Link to a section of a variant of this title shouldn't be parsed as self-link
18527 !! options
18528 title=[[Duna]] language=sr
18529 !! wikitext
18530 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18531 !! html
18532 <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.
18533 </p>
18534 !! end
18535
18536 !! test
18537 Link to pages in language variants
18538 !! options
18539 language=sr
18540 !! wikitext
18541 Main Page can be written as [[Маин Паге]]
18542 !! html
18543 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18544 </p>
18545 !!end
18546
18547
18548 !! test
18549 Multiple links to pages in language variants
18550 !! options
18551 language=sr
18552 !! wikitext
18553 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18554 !! html
18555 <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>.
18556 </p>
18557 !!end
18558
18559
18560 !! test
18561 Simple template in language variants
18562 !! options
18563 language=sr
18564 !! wikitext
18565 {{тест}}
18566 !! html
18567 <p>This is a test template
18568 </p>
18569 !! end
18570
18571
18572 !! test
18573 Template with explicit namespace in language variants
18574 !! options
18575 language=sr
18576 !! wikitext
18577 {{Template:тест}}
18578 !! html
18579 <p>This is a test template
18580 </p>
18581 !! end
18582
18583
18584 !! test
18585 Basic test for template parameter in language variants
18586 !! options
18587 language=sr
18588 !! wikitext
18589 {{парамтест|param=foo}}
18590 !! html
18591 <p>This is a test template with parameter foo
18592 </p>
18593 !! end
18594
18595
18596 !! test
18597 Simple category in language variants
18598 !! options
18599 language=sr cat
18600 !! wikitext
18601 [[Category:МедиаWики Усер'с Гуиде]]
18602 !! html
18603 <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>
18604 !! end
18605
18606
18607 !! article
18608 Category:分类
18609 !! text
18610 blah
18611 !! endarticle
18612
18613 !! article
18614 Category:分類
18615 !! text
18616 blah
18617 !! endarticle
18618
18619 !! test
18620 Don't convert blue categorylinks to another variant (bug 33210)
18621 !! options
18622 language=zh cat
18623 !! wikitext
18624 [[A]][[Category:分类]]
18625 !! html
18626 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18627 !! end
18628
18629
18630 !! test
18631 Stripping -{}- tags (language variants)
18632 !! options
18633 language=sr
18634 !! wikitext
18635 Latin proverb: -{Ne nuntium necare}-
18636 !! html
18637 <p>Latin proverb: Ne nuntium necare
18638 </p>
18639 !! end
18640
18641
18642 !! test
18643 Prevent conversion with -{}- tags (language variants)
18644 !! options
18645 language=sr variant=sr-ec
18646 !! wikitext
18647 Latinski: -{Ne nuntium necare}-
18648 !! html
18649 <p>Латински: Ne nuntium necare
18650 </p>
18651 !! end
18652
18653
18654 !! test
18655 Prevent conversion of text 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 links with -{}- tags (language variants)
18668 !! options
18669 language=sr variant=sr-ec
18670 !! wikitext
18671 -{[[Main Page]]}-
18672 !! html
18673 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18674 </p>
18675 !! end
18676
18677
18678 !! test
18679 -{}- tags within headlines (within html for parserConvert())
18680 !! options
18681 language=sr variant=sr-ec
18682 !! wikitext
18683 == -{Naslov}- ==
18684 !! html
18685 <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>
18686
18687 !! end
18688
18689
18690 !! test
18691 Explicit definition of language variant alternatives
18692 !! options
18693 language=zh variant=zh-tw
18694 !! wikitext
18695 -{zh:China;zh-tw:Taiwan}-, not China
18696 !! html
18697 <p>Taiwan, not China
18698 </p>
18699 !! end
18700
18701
18702 !! test
18703 Conversion around HTML tags
18704 !! options
18705 language=sr variant=sr-ec
18706 !! wikitext
18707 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18708 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18709 !! html
18710 <p>
18711 <span title="ЛаCтин">ски</span>
18712 </p>
18713 !! end
18714
18715
18716 !! test
18717 Explicit session-wise language variant mapping (A flag and - flag)
18718 !! options
18719 language=zh variant=zh-tw
18720 !! wikitext
18721 Taiwan is not China.
18722 But -{A|zh:China;zh-tw:Taiwan}- is China,
18723 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18724 and -{China}- is China.
18725 !! html
18726 <p>Taiwan is not China.
18727 But Taiwan is Taiwan,
18728 (This should be stripped!)
18729 and China is China.
18730 </p>
18731 !! end
18732
18733 !! test
18734 Explicit session-wise language variant mapping (H flag for hide)
18735 !! options
18736 language=zh variant=zh-tw
18737 !! wikitext
18738 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18739 Taiwan is China.
18740 !! html
18741 <p>(This should be stripped!)
18742 Taiwan is Taiwan.
18743 </p>
18744 !! end
18745
18746 !! test
18747 Adding explicit conversion rule for title (T flag)
18748 !! options
18749 language=zh variant=zh-tw showtitle
18750 !! wikitext
18751 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18752 !! html
18753 Taiwan
18754 <p>Should be stripped!
18755 </p>
18756 !! end
18757
18758 !! test
18759 Testing that changing the language variant here in the tests actually works
18760 !! options
18761 language=zh variant=zh showtitle
18762 !! wikitext
18763 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18764 !! html
18765 China
18766 <p>Should be stripped!
18767 </p>
18768 !! end
18769
18770 !! test
18771 Recursive conversion of alt and title attrs shouldn't clear converter state
18772 !! options
18773 language=zh variant=zh-cn showtitle
18774 !! wikitext
18775 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18776 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18777 !! html
18778 China
18779 <p>
18780 Should be stripped<span title="Exclamation">!</span>
18781 </p>
18782 !! end
18783
18784 !! test
18785 Bug 24072: more test on conversion rule for title
18786 !! options
18787 language=zh variant=zh-tw showtitle
18788 !! wikitext
18789 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18790 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18791 !! html
18792 Taiwan
18793 <p>This should be stripped!
18794 This won't take interferes with the title rule.
18795 </p>
18796 !! end
18797
18798 !! test
18799 Partly disable title conversion if variant == main language code
18800 !! options
18801 language=zh variant=zh title=[[ZH]] showtitle
18802 !! wikitext
18803 -{T|zh-cn:CN;zh-tw:TW}-
18804 !! html
18805 ZH
18806 <p>
18807 </p>
18808 !! end
18809
18810 !! test
18811 Partly disable title conversion if variant == main language code, more
18812 !! options
18813 language=zh variant=zh title=[[ZH]] showtitle
18814 !! wikitext
18815 -{T|TW}-
18816 !! html
18817 ZH
18818 <p>
18819 </p>
18820 !! end
18821
18822 !! test
18823 Raw output of variant escape tags (R flag)
18824 !! options
18825 language=zh variant=zh-tw
18826 !! wikitext
18827 Raw: -{R|zh:China;zh-tw:Taiwan}-
18828 !! html
18829 <p>Raw: zh:China;zh-tw:Taiwan
18830 </p>
18831 !! end
18832
18833 !! test
18834 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18835 !! options
18836 language=zh variant=zh-cn
18837 !! input
18838 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18839 !! result
18840 <p>0
18841 </p>
18842 !! end
18843
18844 !! test
18845 Conversion rules from [numeric-only string] to [something else] (T48634)
18846 !! options
18847 language=zh variant=zh-cn
18848 !! input
18849 -{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
18850 !! result
18851 <p>D12345EE12345
18852 </p>
18853 !! end
18854
18855 !! test
18856 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18857 !! options
18858 language=zh variant=zh-cn
18859 !! input
18860 -{H|zh-cn:foo;zh-tw:;}-foobar
18861 !! result
18862 <p>foobar
18863 </p>
18864 !! end
18865
18866 !! test
18867 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
18868 !! options
18869 language=zh variant=zh-cn
18870 !! input
18871 -{H|=>zh-cn:foo;}-foobar
18872 !! result
18873 <p>foobar
18874 </p>
18875 !! end
18876
18877 !! test
18878 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
18879 !! options
18880 language=zh variant=zh-cn
18881 !! input
18882 -{H|}-foobar
18883 !! result
18884 <p>foobar
18885 </p>
18886 !! end
18887
18888 !! test
18889 Nested using of manual convert syntax
18890 !! options
18891 language=zh variant=zh-hk
18892 !! wikitext
18893 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18894 !! html
18895 <p>Nested: Hello Hong Kong!
18896 </p>
18897 !! end
18898
18899 !! test
18900 Proper conversion of text in external links
18901 !! options
18902 language=sr variant=sr-ec
18903 !! wikitext
18904 http://www.google.com
18905 gopher://www.google.com
18906 [http://www.google.com http://www.google.com]
18907 [gopher://www.google.com gopher://www.google.com]
18908 [https://www.google.com irc://www.google.com]
18909 [ftp://www.google.com www.google.com/ftp://dir]
18910 [//www.google.com www.google.com]
18911 !! html
18912 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18913 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18914 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18915 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18916 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18917 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18918 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18919 </p>
18920 !! end
18921
18922 !! test
18923 Do not convert roman numbers to language variants
18924 !! options
18925 language=sr variant=sr-ec
18926 !! wikitext
18927 Fridrih IV je car.
18928 !! html
18929 <p>Фридрих IV је цар.
18930 </p>
18931 !! end
18932
18933 !! test
18934 Unclosed language converter markup "-{"
18935 !! options
18936 language=sr
18937 !! wikitext
18938 -{T|hello
18939 !! html
18940 <p>-{T|hello
18941 </p>
18942 !! end
18943
18944 !! test
18945 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18946 !! options
18947 language=sr
18948 !! wikitext
18949 -{R|=&gt;}-
18950 !! html
18951 <p>=&gt;
18952 </p>
18953 !!end
18954
18955 !! test
18956 Don't break link parsing if language converter markup is in the caption.
18957 !! options
18958 language=sr variant=sr-ec
18959 !! wikitext
18960 [[Main Page|-{R|main page}-]]
18961 !! html
18962 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18963 </p>
18964 !! end
18965
18966 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18967 !! test
18968 Don't break image parsing if language converter markup is in the caption.
18969 !! options
18970 language=sr
18971 !! wikitext
18972 [[File:Foobar.jpg|-{R|caption}-]]
18973 !! html/parsoid
18974 <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>
18975 </p>
18976 !! end
18977
18978 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18979 !! test
18980 Don't break list handling if language converter markup is in the item.
18981 !! options
18982 language=zh variant=zh-cn
18983 !! wikitext
18984 ;-{zh-cn:AAA;zh-tw:BBB}-
18985 !! html/php
18986 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18987
18988 !! html/parsoid
18989 <dl><dt>AAA
18990 </dt></dl>
18991 !! end
18992
18993 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18994 !! test
18995 Don't break table handling if language converter markup is in the cell.
18996 !! options
18997 language=sr variant=sr-ec
18998 !! wikitext
18999 {|
19000 |-
19001 | -{R|B}-
19002 |}
19003 !! html/php
19004 <table>
19005
19006 <tr>
19007 <td>Б}-
19008 </td></tr></table>
19009
19010 !! html/parsoid
19011 <table>
19012
19013 <tr>
19014 <td> B
19015 </td></tr></table>
19016
19017 !! end
19018
19019 !! test
19020 Bug 529: Uncovered bullet
19021 !! wikitext
19022 * Foo {{bullet}}
19023 !! html
19024 <ul><li> Foo </li>
19025 <li> Bar</li></ul>
19026
19027 !! end
19028
19029 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19030 # Templates in Wikipedia rely on this behavior, as tidy has always been
19031 # enabled there. These tests are normally run *without* tidy, so specify the
19032 # full output here.
19033 # To test realistic parsing behavior, apply a tidy-like transformation to both
19034 # the expected output and your parser's output.
19035 !! test
19036 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19037 !! wikitext
19038 ******* Foo {{bullet}}
19039 !! html
19040 <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>
19041 <li> Bar</li></ul>
19042
19043 !! end
19044
19045 !! test
19046 Bug 529: Uncovered table already at line-start
19047 !! wikitext
19048 x
19049
19050 {{table}}
19051 y
19052 !! html
19053 <p>x
19054 </p>
19055 <table>
19056 <tr>
19057 <td> 1 </td>
19058 <td> 2
19059 </td></tr>
19060 <tr>
19061 <td> 3 </td>
19062 <td> 4
19063 </td></tr></table>
19064 <p>y
19065 </p>
19066 !! end
19067
19068 !! test
19069 Bug 529: Uncovered bullet in parser function result
19070 !! wikitext
19071 * Foo {{lc:{{bullet}} }}
19072 !! html
19073 <ul><li> Foo </li>
19074 <li> bar</li></ul>
19075
19076 !! end
19077
19078 !! test
19079 Bug 5678: Double-parsed template argument
19080 !! wikitext
19081 {{lc:{{{1}}}|hello}}
19082 !! html
19083 <p>{{{1}}}
19084 </p>
19085 !! end
19086
19087 !! test
19088 Bug 5678: Double-parsed template invocation
19089 !! wikitext
19090 {{lc:{{paramtest {{!}} param = hello }} }}
19091 !! html
19092 <p>{{paramtest | param = hello }}
19093 </p>
19094 !! end
19095
19096 !! test
19097 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19098 !! options
19099 language=cs
19100 title=[[Main Page]]
19101 !! wikitext
19102 {{PRVNÍVELKÉ:ěščř}}
19103 {{prvnívelké:ěščř}}
19104 {{PRVNÍMALÉ:ěščř}}
19105 {{prvnímalé:ěščř}}
19106 {{MALÁ:ěščř}}
19107 {{malá:ěščř}}
19108 {{VELKÁ:ěščř}}
19109 {{velká:ěščř}}
19110 !! html
19111 <p>Ěščř
19112 Ěščř
19113 ěščř
19114 ěščř
19115 ěščř
19116 ěščř
19117 ĚŠČŘ
19118 ĚŠČŘ
19119 </p>
19120 !! end
19121
19122 !! test
19123 Morwen/13: Unclosed link followed by heading
19124 !! wikitext
19125 [[link
19126 ==heading==
19127 !! html
19128 <p>[[link
19129 </p>
19130 <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>
19131
19132 !! end
19133
19134 !! test
19135 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19136 !! wikitext
19137 {{foo|
19138 =heading=
19139 !! html
19140 <p>{{foo|
19141 </p>
19142 <h1><span class="mw-headline" id="heading">heading</span></h1>
19143
19144 !! end
19145
19146 !! test
19147 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19148 !! wikitext
19149 {{foo|
19150 ==heading==
19151 !! html
19152 <p>{{foo|
19153 </p>
19154 <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>
19155
19156 !! end
19157
19158 !! test
19159 Tildes in comments
19160 !! options
19161 pst
19162 !! wikitext
19163 <!-- ~~~~ -->
19164 !! html
19165 <!-- ~~~~ -->
19166 !! end
19167
19168 !! test
19169 Paragraphs inside divs (no extra line breaks)
19170 !! wikitext
19171 <div>Line one
19172
19173 Line two</div>
19174 !! html
19175 <div>Line one
19176 Line two</div>
19177
19178 !! end
19179
19180 !! test
19181 Paragraphs inside divs (extra line break on open)
19182 !! wikitext
19183 <div>
19184 Line one
19185
19186 Line two</div>
19187 !! html
19188 <div>
19189 <p>Line one
19190 </p>
19191 Line two</div>
19192
19193 !! end
19194
19195 !! test
19196 Paragraphs inside divs (extra line break on close)
19197 !! wikitext
19198 <div>Line one
19199
19200 Line two
19201 </div>
19202 !! html
19203 <div>Line one
19204 <p>Line two
19205 </p>
19206 </div>
19207
19208 !! end
19209
19210 !! test
19211 Paragraphs inside divs (extra line break on open and close)
19212 !! wikitext
19213 <div>
19214 Line one
19215
19216 Line two
19217 </div>
19218 !! html
19219 <div>
19220 <p>Line one
19221 </p><p>Line two
19222 </p>
19223 </div>
19224
19225 !! end
19226
19227 !! test
19228 Nesting tags, paragraphs on lines which begin with <div>
19229 !! wikitext
19230 <div></div><strong>A
19231 B</strong>
19232 !! html/php+tidy
19233 <p><strong>A</strong></p>
19234 <p><strong>B</strong></p>
19235 !! html/parsoid
19236 <div></div>
19237 <p><strong>A
19238 B</strong>
19239 </p>
19240 !! end
19241
19242 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19243 !! test
19244 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19245 !! wikitext
19246 <blockquote>Line one
19247
19248 Line two</blockquote>
19249 !! html
19250 <blockquote>Line one
19251 Line two</blockquote>
19252
19253 !! html+tidy
19254 <blockquote>
19255 <p>Line one Line two</p>
19256 </blockquote>
19257 !! end
19258
19259 !! test
19260 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19261 !! wikitext
19262 <blockquote>
19263 Line one
19264
19265 Line two</blockquote>
19266 !! html
19267 <blockquote>
19268 <p>Line one
19269 </p>
19270 Line two</blockquote>
19271
19272 !! html+tidy
19273 <blockquote>
19274 <p>Line one</p>
19275 Line two</blockquote>
19276 !! end
19277
19278 !! test
19279 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19280 !! wikitext
19281 <blockquote>Line one
19282
19283 Line two
19284 </blockquote>
19285 !! html
19286 <blockquote>Line one
19287 <p>Line two
19288 </p>
19289 </blockquote>
19290
19291 !! html+tidy
19292 <blockquote>
19293 <p>Line one</p>
19294 <p>Line two</p>
19295 </blockquote>
19296 !! end
19297
19298 !! test
19299 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19300 !! wikitext
19301 <blockquote>
19302 Line one
19303
19304 Line two
19305 </blockquote>
19306 !! html
19307 <blockquote>
19308 <p>Line one
19309 </p><p>Line two
19310 </p>
19311 </blockquote>
19312
19313 !! html+tidy
19314 <blockquote>
19315 <p>Line one</p>
19316 <p>Line two</p>
19317 </blockquote>
19318 !! end
19319
19320 !! test
19321 Paragraphs inside blockquotes/divs (no extra line breaks)
19322 !! wikitext
19323 <blockquote><div>Line one
19324
19325 Line two</div></blockquote>
19326 !! html
19327 <blockquote><div>Line one
19328 Line two</div></blockquote>
19329
19330 !! end
19331
19332 !! test
19333 Paragraphs inside blockquotes/divs (extra line break on open)
19334 !! wikitext
19335 <blockquote><div>
19336 Line one
19337
19338 Line two</div></blockquote>
19339 !! html
19340 <blockquote><div>
19341 <p>Line one
19342 </p>
19343 Line two</div></blockquote>
19344
19345 !! end
19346
19347 !! test
19348 Paragraphs inside blockquotes/divs (extra line break on close)
19349 !! wikitext
19350 <blockquote><div>Line one
19351
19352 Line two
19353 </div></blockquote>
19354 !! html
19355 <blockquote><div>Line one
19356 <p>Line two
19357 </p>
19358 </div></blockquote>
19359
19360 !! end
19361
19362 !! test
19363 Paragraphs inside blockquotes/divs (extra line break on open and close)
19364 !! wikitext
19365 <blockquote><div>
19366 Line one
19367
19368 Line two
19369 </div></blockquote>
19370 !! html
19371 <blockquote><div>
19372 <p>Line one
19373 </p><p>Line two
19374 </p>
19375 </div></blockquote>
19376
19377 !! end
19378
19379 !! test
19380 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19381 !! options
19382 wgLinkHolderBatchSize=0
19383 !! wikitext
19384 [[meatball:1]]
19385 [[meatball:2]]
19386 [[meatball:3]]
19387 !! html
19388 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19389 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19390 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19391 </p>
19392 !! end
19393
19394 !! test
19395 Free external link invading image caption
19396 !! wikitext
19397 [[Image:Foobar.jpg|thumb|http://x|hello]]
19398 !! html
19399 <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>
19400
19401 !! end
19402
19403 !! test
19404 Bug 15196: localised external link numbers
19405 !! options
19406 language=fa
19407 !! wikitext
19408 [http://en.wikipedia.org/]
19409 !! html/php
19410 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19411 </p>
19412 !! html/parsoid
19413 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19414 !! end
19415
19416 !! test
19417 Multibyte character in padleft
19418 !! wikitext
19419 {{padleft:-Hello|7|Æ}}
19420 !! html
19421 <p>Æ-Hello
19422 </p>
19423 !! end
19424
19425 !! test
19426 Multibyte character in padright
19427 !! wikitext
19428 {{padright:Hello-|7|Æ}}
19429 !! html
19430 <p>Hello-Æ
19431 </p>
19432 !! end
19433
19434 !!test
19435 formatdate parser function
19436 !! wikitext
19437 {{#formatdate:2009-03-24}}
19438 !! html
19439 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19440 </p>
19441 !! end
19442
19443 !!test
19444 formatdate parser function, with default format
19445 !! wikitext
19446 {{#formatdate:2009-03-24|mdy}}
19447 !! html
19448 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19449 </p>
19450 !! end
19451
19452 !! test
19453 Spacing of numbers in formatted dates
19454 !! wikitext
19455 {{#formatdate:January 15}}
19456 !! html
19457 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19458 </p>
19459 !! end
19460
19461 !! test
19462 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
19463 !! options
19464 language=nl title=[[MediaWiki:Common.css]]
19465 !! wikitext
19466 {{#formatdate:2009-03-24|dmy}}
19467 !! html
19468 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19469 </p>
19470 !! end
19471
19472 #
19473 #
19474 #
19475
19476 #
19477 # Edit comments
19478 #
19479
19480 !! test
19481 Edit comment with link
19482 !! options
19483 comment
19484 !! wikitext
19485 I like the [[Main Page]] a lot
19486 !! html
19487 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19488 !!end
19489
19490 !! test
19491 Edit comment with link and link text
19492 !! options
19493 comment
19494 !! wikitext
19495 I like the [[Main Page|best pages]] a lot
19496 !! html
19497 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19498 !!end
19499
19500 !! test
19501 Edit comment with link and link text with suffix
19502 !! options
19503 comment
19504 !! wikitext
19505 I like the [[Main Page|best page]]s a lot
19506 !! html
19507 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19508 !!end
19509
19510 !! test
19511 Edit comment with section link (non-local, eg in history list)
19512 !! options
19513 comment title=[[Main Page]]
19514 !! wikitext
19515 /* External links */ removed bogus entries
19516 !! html
19517 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19518 !!end
19519
19520 !! test
19521 Edit comment with section link and text before it (non-local, eg in history list)
19522 !! options
19523 comment title=[[Main Page]]
19524 !! wikitext
19525 pre-comment text /* External links */ removed bogus entries
19526 !! html
19527 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>
19528 !!end
19529
19530 !! test
19531 Edit comment with section link (local, eg in diff view)
19532 !! options
19533 comment local title=[[Main Page]]
19534 !! wikitext
19535 /* External links */ removed bogus entries
19536 !! html
19537 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19538 !!end
19539
19540 !! test
19541 Edit comment with subpage link (bug 14080)
19542 !! options
19543 comment
19544 subpage
19545 title=[[Subpage test]]
19546 !! wikitext
19547 Poked at a [[/subpage]] here...
19548 !! html
19549 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19550 !!end
19551
19552 !! test
19553 Edit comment with subpage link and link text (bug 14080)
19554 !! options
19555 comment
19556 subpage
19557 title=[[Subpage test]]
19558 !! wikitext
19559 Poked at a [[/subpage|neat little page]] here...
19560 !! html
19561 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19562 !!end
19563
19564 !! test
19565 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19566 !! options
19567 comment
19568 title=[[Subpage test]]
19569 !! wikitext
19570 Poked at a [[/subpage]] here...
19571 !! html
19572 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...
19573 !!end
19574
19575 !! test
19576 Edit comment with bare anchor link (local, as on diff)
19577 !! options
19578 comment
19579 local
19580 title=[[Main Page]]
19581 !! wikitext
19582 [[#section]]
19583 !! html
19584 <a href="#section">#section</a>
19585 !! end
19586
19587 !! test
19588 Edit comment with bare anchor link (non-local, as on history)
19589 !! options
19590 comment
19591 title=[[Main Page]]
19592 !! wikitext
19593 [[#section]]
19594 !! html
19595 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19596 !! end
19597
19598 !! test
19599 Anchor starting with underscore
19600 !! wikitext
19601 [[#_ref|One]]
19602 !! html
19603 <p><a href="#_ref">One</a>
19604 </p>
19605 !! end
19606
19607 !! test
19608 Id starting with underscore
19609 !! wikitext
19610 <div id="_ref"></div>
19611 !! html
19612 <div id="_ref"></div>
19613
19614 !! end
19615
19616 !! test
19617 Space normalisation on autocomment (bug 22784)
19618 !! options
19619 comment
19620 title=[[Main Page]]
19621 !! wikitext
19622 /* __hello__world__ */
19623 !! html
19624 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19625 !! end
19626
19627 !! test
19628 percent-encoding and + signs in comments (Bug 26410)
19629 !! options
19630 comment
19631 !! wikitext
19632 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19633 !! html/php
19634 <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>
19635 !! end
19636
19637 # Parsoid doesn't support this yet: see bug 73581
19638 # but it *should* omit the 'src' attribute if the image is bad.
19639 # PHP side of tests was disabled in
19640 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19641 # because of issues in the PHP parserTests infrastructure
19642 # (but the output below is indeed what the PHP side emits)
19643 !! test
19644 Bad images - basic functionality
19645 !! wikitext
19646 [[File:Bad.jpg]]
19647 !! DISABLED/html/php
19648 !! html/parsoid
19649 <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>
19650 !! end
19651
19652 !! test
19653 Bad images - bug 16039: text after bad image disappears
19654 !! wikitext
19655 Foo bar
19656 [[File:Bad.jpg]]
19657 Bar foo
19658 !! DISABLED/html/php
19659 <p>Foo bar
19660 </p><p>Bar foo
19661 </p>
19662 !! html/parsoid
19663 <p>Foo bar
19664 <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>
19665 Bar foo</p>
19666 !! end
19667
19668 !! test
19669 Verify that displaytitle works (bug #22501) no displaytitle
19670 !! options
19671 showtitle
19672 !! config
19673 wgAllowDisplayTitle=true
19674 wgRestrictDisplayTitle=false
19675 !! wikitext
19676 this is not the the title
19677 !! html
19678 Parser test
19679 <p>this is not the the title
19680 </p>
19681 !! end
19682
19683 !! test
19684 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19685 !! options
19686 showtitle
19687 title=[[Screen]]
19688 !! config
19689 wgAllowDisplayTitle=true
19690 wgRestrictDisplayTitle=false
19691 !! wikitext
19692 this is not the the title
19693 {{DISPLAYTITLE:whatever}}
19694 !! html
19695 whatever
19696 <p>this is not the the title
19697 </p>
19698 !! end
19699
19700 !! test
19701 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19702 !! options
19703 showtitle
19704 title=[[Screen]]
19705 !! config
19706 wgAllowDisplayTitle=true
19707 wgRestrictDisplayTitle=true
19708 !! wikitext
19709 this is not the the title
19710 {{DISPLAYTITLE:whatever}}
19711 !! html
19712 Screen
19713 <p>this is not the the title
19714 </p>
19715 !! end
19716
19717 !! test
19718 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19719 !! options
19720 showtitle
19721 title=[[Screen]]
19722 !! config
19723 wgAllowDisplayTitle=true
19724 wgRestrictDisplayTitle=true
19725 !! wikitext
19726 this is not the the title
19727 {{DISPLAYTITLE:screen}}
19728 !! html
19729 screen
19730 <p>this is not the the title
19731 </p>
19732 !! end
19733
19734 !! test
19735 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19736 !! options
19737 showtitle
19738 title=[[Screen]]
19739 !! config
19740 wgAllowDisplayTitle=false
19741 !! wikitext
19742 this is not the the title
19743 {{DISPLAYTITLE:screen}}
19744 !! html
19745 Screen
19746 <p>this is not the the title
19747 <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>
19748 </p>
19749 !! end
19750
19751 !! test
19752 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19753 !! options
19754 showtitle
19755 title=[[Screen]]
19756 !! config
19757 wgAllowDisplayTitle=false
19758 !! wikitext
19759 this is not the the title
19760 !! html
19761 Screen
19762 <p>this is not the the title
19763 </p>
19764 !! end
19765
19766 !! test
19767 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19768 !! options
19769 showtitle
19770 title=[[Screen]]
19771 !! config
19772 wgAllowDisplayTitle=true
19773 wgRestrictDisplayTitle=true
19774 !! wikitext
19775 this is not the the title
19776 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19777 !! html
19778 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19779 <p>this is not the the title
19780 </p>
19781 !! end
19782
19783 !! test
19784 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19785 !! options
19786 showtitle
19787 title=[[Screen]]
19788 !! config
19789 wgAllowDisplayTitle=true
19790 wgRestrictDisplayTitle=true
19791 !! wikitext
19792 this is not the the title
19793 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19794 !! html
19795 <span style="color: red;">s</span>creen
19796 <p>this is not the the title
19797 </p>
19798 !! end
19799
19800 !! test
19801 Page status indicators: Empty name is invalid
19802 !! options
19803 showindicators
19804 !! wikitext
19805 <indicator name=" "></indicator>
19806 <indicator></indicator>
19807 !! html
19808 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19809 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19810 </p>
19811 !! end
19812
19813 !! test
19814 Page status indicators: Weird syntaxes that are okay
19815 !! options
19816 showindicators
19817 !! wikitext
19818 <indicator name="empty" />
19819 <indicator name></indicator>
19820 !! html
19821 empty=
19822 name=
19823 <p><br />
19824 </p>
19825 !! end
19826
19827 !! test
19828 Page status indicators: Torture test
19829 !! options
19830 showindicators
19831 !! wikitext
19832 <indicator name="01">hello world</indicator>
19833 <indicator name="02">[[Main Page]]</indicator>
19834 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19835 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19836 <indicator name="05">* foo
19837 * bar</indicator>
19838 <indicator name="06"><nowiki>foo</nowiki></indicator>
19839 <indicator name="07"> Preformatted</indicator>
19840 <indicator name="08"><div>Broken tag</indicator>
19841 <indicator name="09">{| class=wikitable
19842 | cell
19843 |}</indicator>
19844 <indicator name="10">Two
19845
19846 paragraphs</indicator>
19847 !! html
19848 01=hello world
19849 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19850 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" />
19851 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>
19852 05=<ul><li> foo</li>
19853 <li> bar</li></ul>
19854
19855 06=foo
19856 07=<pre>Preformatted
19857 </pre>
19858 08=<div>Broken tag</div>
19859
19860 09=<table class="wikitable">
19861 <tr>
19862 <td> cell
19863 </td></tr></table>
19864
19865 10=<p>Two
19866 </p><p>paragraphs
19867 </p>
19868 <p><br />
19869 </p><p><br />
19870 </p><p><br />
19871 </p><p><br />
19872 </p><p><br />
19873 </p>
19874 !! end
19875
19876 !! test
19877 preload: check <noinclude> and <includeonly>
19878 !! options
19879 preload
19880 !! wikitext
19881 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19882 !! html
19883 Hello kind world.
19884 !! end
19885
19886 !! test
19887 preload: check <onlyinclude>
19888 !! options
19889 preload
19890 !! wikitext
19891 Goodbye <onlyinclude>Hello world</onlyinclude>
19892 !! html
19893 Hello world
19894 !! end
19895
19896 !! test
19897 preload: can pass tags through if we want to
19898 !! options
19899 preload
19900 !! wikitext
19901 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19902 !! html
19903 <includeonly>Hello world</includeonly>
19904 !! end
19905
19906 !! test
19907 preload: check that it doesn't try to do tricks
19908 !! options
19909 preload
19910 !! wikitext
19911 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19912 !! html
19913 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19914 !! end
19915
19916 !! test
19917 Play a bit with r67090 and bug 3158
19918 !! wikitext
19919 <div style="width:50% !important">&nbsp;</div>
19920 <div style="width:50%&nbsp;!important">&nbsp;</div>
19921 <div style="width:50%&#160;!important">&nbsp;</div>
19922 <div style="border : solid;">&nbsp;</div>
19923 !! html/php
19924 <div style="width:50% !important">&#160;</div>
19925 <div style="width:50% !important">&#160;</div>
19926 <div style="width:50% !important">&#160;</div>
19927 <div style="border&#160;: solid;">&#160;</div>
19928
19929 !! html/parsoid
19930 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19931 <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>
19932 <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>
19933 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19934
19935 !! end
19936
19937 !! test
19938 HTML5 data attributes
19939 !! wikitext
19940 <span data-foo="bar">Baz</span>
19941 <p data-abc-def_hij="">Quuz</p>
19942 !! html
19943 <p><span data-foo="bar">Baz</span>
19944 </p>
19945 <p data-abc-def_hij="">Quuz</p>
19946
19947 !! end
19948
19949 !! test
19950 percent-encoding and + signs in internal links (Bug 26410)
19951 !! wikitext
19952 [[User:+%]] [[Page+title%]]
19953 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19954 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19955 [[%33%45]] [[%33%45+]]
19956 !! html/php
19957 <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>
19958 <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>
19959 <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>
19960 <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>
19961 </p>
19962 !! html/parsoid
19963 <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>
19964 <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>
19965 <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>
19966 <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>
19967 !! end
19968
19969 !! test
19970 Special characters in embedded file links (bug 27679)
19971 !! wikitext
19972 [[File:Contains & ampersand.jpg]]
19973 [[File:Does not exist.jpg|Title with & ampersand]]
19974 !! html/php
19975 <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>
19976 <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>
19977 </p>
19978 !! html/parsoid
19979 <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>
19980 <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>
19981 !! end
19982
19983 !! test
19984 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19985 !! wikitext
19986 Text&apos;s been normalized?
19987 !! html
19988 <p>Text&#39;s been normalized?
19989 </p>
19990 !! end
19991
19992 !! test
19993 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19994 !! wikitext
19995 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19996 !! html
19997 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19998 </p>
19999 !! end
20000
20001 !! test
20002 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20003 !! wikitext
20004 [http://www.example.org/ ideograms]
20005 !! html
20006 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20007 </p>
20008 !! end
20009
20010 !! test
20011 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20012 !! wikitext
20013 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20014 !! html
20015 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20016 </p>
20017 !! end
20018
20019 !! article
20020 Mediawiki:loop1
20021 !! text
20022 {{Identical|A}}
20023 !! endarticle
20024
20025 !! article
20026 Mediawiki:loop2
20027 !! text
20028 {{Identical|B}}
20029 !! endarticle
20030
20031 !! article
20032 Template:Identical
20033 !! text
20034 {{int:loop1}}
20035 {{int:loop2}}
20036 !! endarticle
20037
20038 !! test
20039 Bug 31098 Template which includes system messages which includes the template
20040 !! wikitext
20041 {{Identical}}
20042 !! html
20043 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20044 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20045 </p>
20046 !! end
20047
20048 !! test
20049 Bug31490 Turkish: ucfirst 'blah'
20050 !! options
20051 language=tr
20052 !! wikitext
20053 {{ucfirst:blah}}
20054 !! html
20055 <p>Blah
20056 </p>
20057 !! end
20058
20059 !! test
20060 Bug31490 Turkish: ucfirst 'ix'
20061 !! options
20062 language=tr
20063 !! wikitext
20064 {{ucfirst:ix}}
20065 !! html
20066 <p>İx
20067 </p>
20068 !! end
20069
20070 !! test
20071 Bug31490 Turkish: lcfirst 'BLAH'
20072 !! options
20073 language=tr
20074 !! wikitext
20075 {{lcfirst:BLAH}}
20076 !! html
20077 <p>bLAH
20078 </p>
20079 !! end
20080
20081 !! test
20082 Bug31490 Turkish: ucfırst (with a dotless i)
20083 !! options
20084 language=tr
20085 !! wikitext
20086 {{ucfırst:blah}}
20087 !! html
20088 <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>
20089 </p>
20090 !! end
20091
20092 !! test
20093 Bug31490 ucfırst (with a dotless i) with English language
20094 !! options
20095 language=en
20096 !! wikitext
20097 {{ucfırst:blah}}
20098 !! html
20099 <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>
20100 </p>
20101 !! end
20102
20103 !! test
20104 Bug 26375: TOC with italics
20105 !! options
20106 title=[[Main Page]]
20107 !! wikitext
20108 __TOC__
20109 == ''Lost'' episodes ==
20110 !! html
20111 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20112 <ul>
20113 <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>
20114 </ul>
20115 </div>
20116
20117 <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>
20118
20119 !! end
20120
20121 !! test
20122 Bug 26375: TOC with bold
20123 !! options
20124 title=[[Main Page]]
20125 !! wikitext
20126 __TOC__
20127 == '''should be bold''' then normal text ==
20128 !! html
20129 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20130 <ul>
20131 <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>
20132 </ul>
20133 </div>
20134
20135 <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>
20136
20137 !! end
20138
20139 !! test
20140 Bug 33845: Headings become cursive in TOC when they contain an image
20141 !! options
20142 title=[[Main Page]]
20143 !! wikitext
20144 __TOC__
20145 == Image [[Image:foobar.jpg]] ==
20146 !! html
20147 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20148 <ul>
20149 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20150 </ul>
20151 </div>
20152
20153 <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>
20154
20155 !! end
20156
20157 !! test
20158 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20159 !! options
20160 title=[[Main Page]]
20161 !! wikitext
20162 __TOC__
20163 == <blockquote>Quote</blockquote> ==
20164 !! html
20165 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20166 <ul>
20167 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20168 </ul>
20169 </div>
20170
20171 <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>
20172
20173 !! html+tidy
20174 <p></p>
20175 <div id="toc" class="toc">
20176 <div id="toctitle">
20177 <h2>Contents</h2>
20178 </div>
20179 <ul>
20180 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20181 </ul>
20182 </div>
20183 <p></p>
20184 <h2><span class="mw-headline" id="Quote"></span></h2>
20185 <blockquote>
20186 <p><span class="mw-headline" id="Quote">Quote</span></p>
20187 </blockquote>
20188 <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>
20189 !! end
20190
20191 !! test
20192 Unclosed tags in TOC
20193 !! options
20194 title=[[Main Page]]
20195 !! wikitext
20196 __TOC__
20197 == Proof: 2 < 3 ==
20198 <small>Hanc marginis exiguitas non caperet.</small>
20199 QED
20200 !! html
20201 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20202 <ul>
20203 <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>
20204 </ul>
20205 </div>
20206
20207 <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>
20208 <p><small>Hanc marginis exiguitas non caperet.</small>
20209 QED
20210 </p>
20211 !! end
20212
20213 !! test
20214 Multiple tags in TOC
20215 !! wikitext
20216 __TOC__
20217 == <i>Foo</i> <b>Bar</b> ==
20218
20219 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20220 !! html
20221 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20222 <ul>
20223 <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>
20224 <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>
20225 </ul>
20226 </div>
20227
20228 <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>
20229 <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>
20230
20231 !! html+tidy
20232 <p></p>
20233 <div id="toc" class="toc">
20234 <div id="toctitle">
20235 <h2>Contents</h2>
20236 </div>
20237 <ul>
20238 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
20239 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
20240 </ul>
20241 </div>
20242 <p></p>
20243 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20244 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20245 <blockquote>
20246 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20247 </blockquote>
20248 <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>
20249 !! end
20250
20251 !! test
20252 Tags with parameters in TOC
20253 !! wikitext
20254 __TOC__
20255 == <sup class="in-h2">Hello</sup> ==
20256
20257 == <sup class="a > b">Evilbye</sup> ==
20258 !! html
20259 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20260 <ul>
20261 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20262 <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>
20263 </ul>
20264 </div>
20265
20266 <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>
20267 <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>
20268
20269 !! end
20270
20271 !! test
20272 span tags with directionality in TOC
20273 !! wikitext
20274 __TOC__
20275 == <span dir="ltr">C++</span> ==
20276
20277 == <span dir="rtl">זבנג!</span> ==
20278
20279 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20280
20281 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20282
20283 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20284 !! html
20285 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20286 <ul>
20287 <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>
20288 <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>
20289 <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>
20290 <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>
20291 <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>
20292 </ul>
20293 </div>
20294
20295 <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>
20296 <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>
20297 <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>
20298 <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>
20299 <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>
20300
20301 !! end
20302
20303 !! test
20304 Bug 72884: bdi element in ToC
20305 !! wikitext
20306 __TOC__
20307 == <bdi>test</bdi> ==
20308 !! html
20309 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20310 <ul>
20311 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20312 </ul>
20313 </div>
20314
20315 <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>
20316
20317 !! end
20318
20319 # Note that the html output does not have the <p></p>, but the
20320 # html+tidy output *does*. This is because the empty <p></p> is
20321 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20322 !! test
20323 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20324 !! wikitext
20325 __TOC__
20326 == x ==
20327 !! html
20328 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20329 <ul>
20330 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20331 </ul>
20332 </div>
20333
20334 <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>
20335
20336 !! html+tidy
20337 <p></p>
20338 <div id="toc" class="toc">
20339 <div id="toctitle">
20340 <h2>Contents</h2>
20341 </div>
20342 <ul>
20343 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20344 </ul>
20345 </div>
20346 <p></p>
20347 <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>
20348 !! end
20349
20350 !! article
20351 MediaWiki:Bug32057
20352 !! text
20353 == {{int:headline_sample}} ==
20354 !! endarticle
20355
20356 !! test
20357 Bug 32057: Title needed when expanding <h> nodes.
20358 !! options
20359 title=[[Main Page]]
20360 !! wikitext
20361 {{int:Bug32057}}
20362 !! html
20363 <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>
20364
20365 !! end
20366
20367 !! test
20368 Strip marker in urlencode
20369 !! wikitext
20370 {{urlencode:x<nowiki/>y}}
20371 {{urlencode:x<nowiki/>y|wiki}}
20372 {{urlencode:x<nowiki/>y|path}}
20373 {{urlencode:x<pre id="one">two</pre>y}}
20374 !! html
20375 <p>xy
20376 xy
20377 xy
20378 xy
20379 </p>
20380 !! end
20381
20382 !! test
20383 Strip marker in lc
20384 !! wikitext
20385 {{lc:x<nowiki/>y}}
20386 !! html
20387 <p>xy
20388 </p>
20389 !! end
20390
20391 !! test
20392 Strip marker in uc
20393 !! wikitext
20394 {{uc:x<nowiki/>y}}
20395 !! html
20396 <p>XY
20397 </p>
20398 !! end
20399
20400 !! test
20401 Strip marker in formatNum
20402 !! wikitext
20403 {{formatnum:1<nowiki/>2}}
20404 {{formatnum:1<nowiki/>2|R}}
20405 !! html
20406 <p>12
20407 12
20408 </p>
20409 !! end
20410
20411 !! test
20412 Check noCommafy in formatNum
20413 !! options
20414 language=be-tarask
20415 !! wikitext
20416 {{formatnum:123456.78}}
20417 {{formatnum:123456.78|NOSEP}}
20418 !! html
20419 <p>123 456,78
20420 123456.78
20421 </p>
20422 !! end
20423
20424 !! test
20425 Wrong option for formatNum (bug 56199)
20426 !! wikitext
20427 {{formatnum:1,234.56|Random}}
20428 {{formatnum:1,234.56|EVERYTHING}}
20429 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20430 !! html
20431 <p>1,234.56
20432 1,234.56
20433 1,234.56
20434 </p>
20435 !! end
20436
20437 !! test
20438 Strip marker in grammar
20439 !! options
20440 language=fi
20441 !! wikitext
20442 {{grammar:elative|foo<nowiki/>bar}}
20443 !! html
20444 <p>foobarista
20445 </p>
20446 !! end
20447
20448 !! test
20449 Strip marker in padleft
20450 !! wikitext
20451 {{padleft:|2|x<nowiki/>y}}
20452 !! html
20453 <p>xy
20454 </p>
20455 !! end
20456
20457 !! test
20458 Strip marker in padright
20459 !! wikitext
20460 {{padright:|2|x<nowiki/>y}}
20461 !! html
20462 <p>xy
20463 </p>
20464 !! end
20465
20466 !! test
20467 Strip marker in anchorencode
20468 !! wikitext
20469 {{anchorencode:x<nowiki/>y}}
20470 !! html
20471 <p>xy
20472 </p>
20473 !! end
20474
20475 !! test
20476 nowiki inside link inside heading (bug 18295)
20477 !! wikitext
20478 ==[[foo|x<nowiki>y</nowiki>z]]==
20479 !! html
20480 <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>
20481
20482 !! end
20483
20484 !! test
20485 new support for bdi element (bug 31817)
20486 !! wikitext
20487 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20488 !! html
20489 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20490
20491 !!end
20492
20493 !! test
20494 Ignore pipe between table row attributes
20495 !! wikitext
20496 {|
20497 | quux
20498 |- id=foo | style='color: red'
20499 | bar
20500 |}
20501 !! html
20502 <table>
20503 <tr>
20504 <td> quux
20505 </td></tr>
20506 <tr id="foo" style="color: red">
20507 <td> bar
20508 </td></tr></table>
20509
20510 !! end
20511
20512 !!test
20513 Gallery override link with WikiLink (bug 34852)
20514 !! wikitext
20515 <gallery>
20516 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20517 </gallery>
20518 !! html
20519 <ul class="gallery mw-gallery-traditional">
20520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20521 <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>
20522 <div class="gallerytext">
20523 <p>caption
20524 </p>
20525 </div>
20526 </div></li>
20527 </ul>
20528
20529 !! end
20530
20531 !!test
20532 Gallery override link with absolute external link (bug 34852)
20533 !! wikitext
20534 <gallery>
20535 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20536 </gallery>
20537 !! html
20538 <ul class="gallery mw-gallery-traditional">
20539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20540 <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>
20541 <div class="gallerytext">
20542 <p>caption
20543 </p>
20544 </div>
20545 </div></li>
20546 </ul>
20547
20548 !! end
20549
20550 !!test
20551 Gallery override link with malicious javascript (bug 34852)
20552 !! wikitext
20553 <gallery>
20554 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20555 </gallery>
20556 !! html
20557 <ul class="gallery mw-gallery-traditional">
20558 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20559 <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>
20560 <div class="gallerytext">
20561 <p>caption
20562 </p>
20563 </div>
20564 </div></li>
20565 </ul>
20566
20567 !! end
20568
20569 !!test
20570 Gallery with invalid title as link (bug 43964)
20571 !! wikitext
20572 <gallery>
20573 File:foobar.jpg|link=<
20574 </gallery>
20575 !! html
20576 <ul class="gallery mw-gallery-traditional">
20577 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20578 <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>
20579 <div class="gallerytext">
20580 </div>
20581 </div></li>
20582 </ul>
20583
20584 !! end
20585
20586 !!test
20587 Language parser function
20588 !! wikitext
20589 {{#language:ar}}
20590 !! html
20591 <p>العربية
20592 </p>
20593 !! end
20594
20595 !!test
20596 Padleft and padright as substr
20597 !! wikitext
20598 {{padleft:|3|abcde}}
20599 {{padright:|3|abcde}}
20600 !! html
20601 <p>abc
20602 abc
20603 </p>
20604 !! end
20605
20606 !!test
20607 Special parser function
20608 !! wikitext
20609 {{#special:RandomPage}}
20610 {{#special:BaDtItLe}}
20611 {{#special:Foobar}}
20612 !! html
20613 <p>Special:Random
20614 Special:Badtitle
20615 Special:Foobar
20616 </p>
20617 !! end
20618
20619 !!test
20620 Bug 34939 - Case insensitive link parsing ([HttP://])
20621 !! wikitext
20622 [HttP://MediaWiki.Org/]
20623 !! html/php
20624 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20625 </p>
20626 !! html/parsoid
20627 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20628 !! end
20629
20630 !!test
20631 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20632 !! wikitext
20633 [HttP://MediaWiki.Org/ MediaWiki]
20634 !! html
20635 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20636 </p>
20637 !! end
20638
20639 !!test
20640 Bug 34939 - Case insensitive link parsing (HttP://)
20641 !! wikitext
20642 HttP://MediaWiki.Org/
20643 !! html/php
20644 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20645 </p>
20646 !! html/parsoid
20647 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20648 !! end
20649
20650 !!test
20651 Disable TOC
20652 !! options
20653 notoc
20654 !! wikitext
20655 Lead
20656 == Section 1 ==
20657 == Section 2 ==
20658 == Section 3 ==
20659 == Section 4 ==
20660 == Section 5 ==
20661 !! html
20662 <p>Lead
20663 </p>
20664
20665 <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>
20666 <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>
20667 <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>
20668 <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>
20669 <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>
20670
20671 !! end
20672
20673
20674 ###
20675 ### Parsoid-specific tests
20676 ### Parsoid-PHP parser incompatibilities
20677 ###
20678 !!test
20679 1. SOL-sensitive wikitext tokens as template-args
20680 !!options
20681 parsoid=wt2html,wt2wt
20682 !! wikitext
20683 {{echo|*a}}
20684 {{echo|#a}}
20685 {{echo|:a}}
20686 !! html
20687 <span about="#mwt1" typeof="mw:Transclusion">
20688 </span><ul about="#mwt1"><li>a</li>
20689 </ul>
20690 <span about="#mwt2" typeof="mw:Transclusion">
20691 </span><ol about="#mwt2"><li>a</li>
20692 </ol>
20693 <span about="#mwt3" typeof="mw:Transclusion">
20694 </span><dl about="#mwt3"><dd>a</dd>
20695 </dl>
20696 !!end
20697
20698 #### -----------------------------------------------------------------
20699 #### Parsoid-specific functionality tests
20700 #### -----------------------------------------------------------------
20701
20702 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20703 # We know wt2wt will fail, but we expect selser to pass.
20704 # Due to the nature of our testing, wt2wt and selser tests will enter the
20705 # blacklist and we'll catch selser regressions based on changes to the
20706 # blacklist entries for selser tests.
20707 !! test
20708 1. Bad treebuilder fixup of formatting elt is cleaned up
20709 !! options
20710 parsoid=wt2html,wt2wt
20711 !! wikitext
20712 {|
20713 |
20714 <small>
20715 [[Image:Foobar.jpg|right|Test]]
20716 </small>
20717 |}
20718 !! html/parsoid
20719 <table>
20720 <tbody><tr><td>
20721 <small>
20722 <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>
20723 </small>
20724 </td></tr>
20725 </tbody></table>
20726 !! end
20727
20728 !! test
20729 2. Bad treebuilder fixup of formatting elt is cleaned up
20730 !! options
20731 parsoid=wt2html,wt2wt
20732 !! wikitext
20733 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20734
20735 <small>[[Image:Foobar.jpg|right|300px]]</small>
20736 !! html/parsoid
20737
20738 <p><b>foo</b></p>
20739 <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>
20740 <p><b>bar</b></p>
20741 <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>
20742 !! end
20743
20744 #### ----------------------------------------------------------------
20745 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20746 #### tags. Parsoid's output for these tags differs from that of the
20747 #### PHP parser.
20748 #### ----------------------------------------------------------------
20749
20750 !!test
20751 Ref: 1. ref-location should be replaced with an index span
20752 !!options
20753 parsoid
20754 !! wikitext
20755 A <ref>foo</ref>
20756 B <ref name="x">foo</ref>
20757 C <ref name="y" />
20758 <references />
20759 !! html
20760 <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>
20761 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>
20762 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>
20763 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20764 <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>
20765 <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>
20766 <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>
20767 </ol>
20768 !!end
20769
20770 !!test
20771 Ref: 2. ref-tags with identical names should all get the same index
20772 !!options
20773 parsoid
20774 !! wikitext
20775 A <ref name="x">foo</ref>
20776 B <ref name="x" />
20777 <references />
20778 !! html
20779 <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>
20780 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>
20781 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20782 <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>
20783 </ol>
20784 !!end
20785
20786 !!test
20787 Ref: 3. spaces in ref-names should be ignored
20788 !!options
20789 parsoid
20790 !! wikitext
20791 A <ref name="x">foo</ref>
20792 B <ref name=" x " />
20793 C <ref name= x />
20794 <references />
20795 !! html
20796 <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>
20797 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>
20798 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>
20799 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20800 <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>
20801 </ol>
20802 !!end
20803
20804 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20805 !!test
20806 Ref: 4. 'constructor' should be accepted as a valid ref-name
20807 !!options
20808 parsoid
20809 !! wikitext
20810 A <ref name="constructor">foo</ref>
20811 <references />
20812 !! html
20813 <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>
20814 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20815 <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>
20816 </ol>
20817 !!end
20818
20819 !!test
20820 Ref: 5. body should accept generic wikitext
20821 !!options
20822 parsoid
20823 !! wikitext
20824 A <ref>
20825 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20826 </ref>
20827
20828 <references />
20829 !! html
20830 <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>
20831
20832 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20833 <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>
20834 </span></li>
20835 </ol>
20836 !!end
20837
20838 !!test
20839 Ref: 6. indent-pres should not be output in ref-body
20840 !!options
20841 parsoid
20842 !! wikitext
20843 A <ref>
20844 foo
20845 bar
20846 baz
20847 </ref>
20848
20849 <references />
20850 !! html
20851 <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>
20852
20853 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20854 <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
20855 bar
20856 baz
20857 </span></li>
20858 </ol>
20859 !!end
20860
20861 !!test
20862 Ref: 7. No p-wrapping in ref-body
20863 !!options
20864 parsoid
20865 !! wikitext
20866 A <ref>
20867 foo
20868
20869 bar
20870
20871
20872 baz
20873
20874
20875
20876 booz
20877 </ref>
20878
20879 <references />
20880 !! html
20881 <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>
20882
20883 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20884 <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
20885
20886 bar
20887
20888
20889 baz
20890
20891
20892
20893 booz
20894 </span></li>
20895 </ol>
20896 !!end
20897
20898 !!test
20899 Ref: 8. transclusion wikitext has lower precedence
20900 !!options
20901 parsoid
20902 !! wikitext
20903 A <ref> foo {{echo|</ref> B C}}
20904
20905 <references />
20906 !! html
20907 <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>
20908 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20909 <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>
20910 </ol>
20911 !!end
20912
20913 !!test
20914 Ref: 9. unclosed comments should not leak out of ref-body
20915 !!options
20916 parsoid
20917 !! wikitext
20918 A <ref> foo <!--</ref> B C
20919 <references />
20920 !! html
20921 <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>
20922 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20923 <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>
20924 </ol>
20925 !!end
20926
20927 !!test
20928 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20929 !!options
20930 parsoid
20931 !! wikitext
20932 A <ref> <b> foo </ref> B C
20933
20934 <references />
20935 !! html
20936 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
20937
20938
20939 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20940 <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>
20941 </ol>
20942 !!end
20943
20944 !!test
20945 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20946 !!options
20947 parsoid
20948 !! wikitext
20949 A <ref>foo</ref> B
20950 C <ref>bar</ref> D
20951 <references />
20952 !! html
20953 <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
20954 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>
20955 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20956 <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>
20957 <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>
20958 </ol>
20959 !!end
20960
20961 !!test
20962 Ref: 12. ref-tags act as trailing newline migration barrier
20963 !! wikitext
20964 <!--the newline at the end of this line moves out of the p tag-->a
20965
20966 b<!--the newline at the end of this line stays inside the p tag--> <ref />
20967 <ref />
20968
20969 c
20970 <references />
20971 !! html/parsoid
20972 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
20973
20974
20975 <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>
20976 <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>
20977
20978 <p>c</p>
20979 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20980 <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>
20981 <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>
20982 !!end
20983
20984 !!test
20985 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20986 !!options
20987 parsoid
20988 !! wikitext
20989 <ref>foo</ref> A
20990 <ref>bar
20991 </ref> B
20992 <references />
20993 !! html
20994 <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
20995 <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>
20996 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20997 <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>
20998 <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
20999 </span></li>
21000 </ol>
21001 !!end
21002
21003 !!test
21004 Ref: 14. A nested ref-tag should be emitted as plain text
21005 !!options
21006 parsoid
21007 !! wikitext
21008 <ref>foo <ref>bar</ref> baz</ref>
21009
21010 <references />
21011 !! html
21012 <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>
21013 </p>
21014 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21015 <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>
21016 </ol>
21017 !!end
21018
21019 !!test
21020 Ref: 15. ref-tags with identical names should get identical indexes
21021 !!options
21022 parsoid
21023 !! wikitext
21024 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21025 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21026
21027 <references />
21028 !! html
21029 <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>
21030 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>
21031
21032 <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>
21033 </ol>
21034 !!end
21035
21036 ## We don't bother wt2wt-ing non-standard whitespace
21037 !!test
21038 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21039 !!options
21040 parsoid=wt2html
21041 !! wikitext
21042 A <ref >foo</ref >
21043
21044 <references />
21045 !! html
21046 <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>
21047 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21048 <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>
21049 !!end
21050
21051 !!test
21052 Ref: 17. Generate valid HTML5 id/about attributes
21053 !!options
21054 parsoid
21055 !!wikitext
21056 <ref name="a b">foo</ref>
21057
21058 <references />
21059 !!html
21060 <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>
21061 </p>
21062
21063 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21064 <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>
21065 </ol>
21066 !!end
21067
21068 !!test
21069 Ref: 18. T58916: Extension attributes should be parsed as plain text
21070 !!options
21071 parsoid
21072 !!wikitext
21073 <ref name="{{echo|a}}">foo</ref>
21074
21075 <references />
21076 !!html
21077 <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>
21078 </p>
21079
21080 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21081 <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>
21082 </ol>
21083 !!end
21084
21085 !!test
21086 Ref: 19. ref-tags with identical name encodings should get identical indexes
21087 !!options
21088 parsoid
21089 !! wikitext
21090 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21091
21092 <references />
21093 !! html
21094 <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>
21095 </p>
21096 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21097 <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>
21098 </ol>
21099 !!end
21100
21101 !!test
21102 Ref: 20. ref-tags with identical names but different content should keep it
21103 !!options
21104 parsoid
21105 !! wikitext
21106 A <ref name="foo">Foo one</ref>
21107 B <ref name="foo">Foo two</ref>
21108 C <ref name="foo" />
21109
21110 <references />
21111 !! html
21112 <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>
21113 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>
21114 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>
21115
21116 <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>
21117 </ol>
21118 !!end
21119
21120 !!test
21121 References: 1. references tag without any refs should be handled properly
21122 !! wikitext
21123 <references />
21124 !! html/parsoid
21125 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21126 !!end
21127
21128 !!test
21129 References: 2. references tag with group only outputs references from that group
21130 !! wikitext
21131 A <ref group="a">foo</ref>
21132 B <ref group="b">bar</ref>
21133 C <ref>baz</ref>
21134
21135 <references group="a" />
21136 <references />
21137 <references group="b" />
21138 !! html/parsoid
21139 <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>
21140 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>
21141 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>
21142
21143 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21144 <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>
21145 </ol>
21146 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21147 <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>
21148 </ol>
21149 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21150 <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>
21151 </ol>
21152 !!end
21153
21154 !!test
21155 References: 3. ref list should be cleared after processing references
21156 !! wikitext
21157 A <ref>foo</ref>
21158
21159 <references />
21160
21161 B <ref>bar</ref>
21162
21163 <references />
21164 !! html/parsoid
21165 <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>
21166
21167 <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>
21168 </ol>
21169
21170 <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>
21171
21172 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21173 <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>
21174 </ol>
21175 !!end
21176
21177 !!test
21178 References: 4. only referenced group should be cleared after processing references
21179 !! wikitext
21180 A <ref group="a">afoo</ref>
21181 B <ref>bfoo</ref>
21182
21183 <references group="a" />
21184
21185 C <ref>cfoo</ref>
21186
21187 <references />
21188 !! html/parsoid
21189 <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>
21190 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>
21191
21192 <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>
21193 </ol>
21194
21195 <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>
21196
21197 <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>
21198 </ol>
21199 !!end
21200
21201 !!test
21202 References: 5. ref tags in references should be processed while ignoring all other content
21203 !! wikitext
21204 A <ref name="a" />
21205 B <ref name="b">bar</ref>
21206
21207 <references>
21208 <ref name="a">foo</ref>
21209 This should just get lost.
21210 </references>
21211 !! html/parsoid
21212 <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>
21213 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>
21214
21215
21216 <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>
21217 </ol>
21218 !!end
21219
21220 !!test
21221 References: 6. <references /> from a transclusion
21222 !! wikitext
21223 <ref>Foo</ref> {{echo|<references />}}
21224 !! html/parsoid
21225 <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>
21226 </ol>
21227 !!end
21228
21229 !! test
21230 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21231 !! wikitext
21232 A <ref>foo bar for a</ref>
21233 B <ref group="X" name="b" />
21234
21235 <references />
21236
21237 <references group="X">
21238 <ref name="b">foo</ref>
21239 </references>
21240 !! html/parsoid
21241 <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>
21242 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>
21243 </p>
21244
21245 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21246 <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>
21247 </ol>
21248
21249 <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"}}'>
21250 <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>
21251 </ol>
21252 !! end
21253
21254 !! test
21255 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21256 !! wikitext
21257 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21258 <references />
21259 !! html/parsoid
21260 <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>
21261 <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>
21262 </ol>
21263 !!end
21264
21265 # This test only works in wt2html now as the <references /> are always generated
21266 # unless selser is active. Once T72722 is fixed, we should add a changes test
21267 # here to ensure that unrelated changes don't add the new <references /> in
21268 # wt2wt.
21269 !! test
21270 References: 9. Generate missing references list at the end
21271 !! wikitext
21272 A <ref>foo</ref>
21273 B <ref group="inexistent">bar</ref>
21274 !! html/parsoid
21275 <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>
21276 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21277 <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>
21278 </ol>
21279 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21280 <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>
21281 </ol>
21282 !! end
21283
21284 !! test
21285 References: 10. New <references/> shouldn't be added for unrelated edits.
21286 !! options
21287 parsoid={
21288 "modes": ["selser"],
21289 "changes": [["#x", "remove"]],
21290 "selser": "noauto"
21291 }
21292 !! wikitext
21293 Unrelated text<span id="x"> that's going to disappear</span>.
21294 A <ref>foo</ref>
21295 !! wikitext/edited
21296 Unrelated text.
21297 A <ref>foo</ref>
21298 !!end
21299
21300 !! test
21301 Entities in ref name
21302 !! wikitext
21303 <ref name="test &amp; me">hi</ref>
21304 <references />
21305 !! html/parsoid
21306 <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>
21307 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21308 <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>
21309 </ol>
21310 !! end
21311
21312 # This test is wt2html only because we're permitting the serializer to produce
21313 # dirty diffs, normalizing the unclosed references to the self-closed version.
21314 !! test
21315 Generate references for unclosed references tag
21316 !! options
21317 parsoid=wt2html
21318 !! wikitext
21319 a<ref>foo</ref>
21320
21321 <references>
21322 !! html/parsoid
21323 <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>
21324 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21325 <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>
21326 !! end
21327
21328 !! test
21329 New reference serializes on its own line
21330 !! options
21331 parsoid=wt2wt,html2wt
21332 !! wikitext
21333 foo
21334 <references />
21335 !! html/parsoid
21336 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21337 !! end
21338
21339 #### ----------------------------------------------------------------
21340 #### Parsoid-only testing of Parsoid's impl of LST
21341 #### Not implemented yet, see
21342 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21343 #### ----------------------------------------------------------------
21344
21345 !!test
21346 LST Sections: 1. Simple section start and end
21347 !! wikitext
21348 <section begin="2011-05-16" />
21349 <section end="2014-04-10 (MW 1.23wmf22)" />
21350 !! html/parsoid
21351 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21352 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21353 !! end
21354
21355 #--------- Test stripping of empty nodes in template content ----------
21356 !!test
21357 Empty LI and TR nodes should be stripped from template content
21358 !!wikitext
21359 {{EmptyLITest}}
21360 {{EmptyTRTest}}
21361 !!html/parsoid
21362 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21363 <li>a</li>
21364 <li>b</li>
21365 </ul>
21366 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21367 <tbody>
21368 <tr>
21369 <td>foo</td>
21370 </tr>
21371 <tr>
21372 <td>bar</td>
21373 </tr>
21374 </tbody>
21375 </table>
21376 !!end
21377
21378 !!test
21379 Empty LI and TR nodes should not be stripped from top-level content
21380 !!wikitext
21381 * a
21382 *
21383 * b
21384 {|
21385 |-
21386 |-
21387 |foo
21388 |}
21389 !!html/parsoid
21390 <ul>
21391 <li> a</li>
21392 <li></li>
21393 <li> b</li>
21394 </ul>
21395 <table>
21396 <tbody>
21397 <tr></tr>
21398 <tr>
21399 <td>foo</td>
21400 </tr>
21401 </tbody>
21402 </table>
21403 !!end
21404
21405 !!test
21406 Empty TR nodes should not be stripped if they have any attributes set
21407 !!wikitext
21408 {{EmptyTRWithHTMLAttrTest}}
21409 !!html/parsoid
21410 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21411 <tr align="center"></tr>
21412 <tr><td>foo</td></tr>
21413 <tr align="center"></tr>
21414 <tr><td>bar</td></tr>
21415 </table>
21416 !!end
21417
21418 #### ----------------------------------------------------------------
21419 #### The following section of tests are primarily to test
21420 #### wikitext escaping capabilities of Parsoid. Given that
21421 #### escaping can be done any number of ways, the wikitext (input)
21422 #### is always adjusted to reflect how Parsoid adds nowiki
21423 #### escape tags.
21424 ####
21425 #### We are marking several tests as parsoid-only since the
21426 #### HTML in the result section is different from what the
21427 #### PHP parser generates for it.
21428 #### ----------------------------------------------------------------
21429
21430
21431 #### --------------- Headings ---------------
21432 #### 0. Unnested
21433 #### 1. Nested inside html <h1>=foo=</h1>
21434 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21435 #### 3. Nested inside html with wikitext split by html tags
21436 #### 4. No escape needed
21437 #### 5. Empty headings <h1></h1>
21438 #### 6. Heading chars in SOL context
21439 #### ----------------------------------------
21440 !! test
21441 Headings: 0. Unnested
21442 !! options
21443 parsoid
21444 !! wikitext
21445 <nowiki>=foo=</nowiki>
21446
21447 <nowiki> =foo= </nowiki>
21448 <!--cmt-->
21449 <nowiki>=foo=</nowiki>
21450
21451 =foo''a''<nowiki>=</nowiki>
21452 !! html
21453 <p><span typeof="mw:Nowiki">=foo=</span></p>
21454
21455 <p><span typeof="mw:Nowiki"> =foo= </span>
21456 <!--cmt-->
21457 <span typeof="mw:Nowiki">=foo=</span></p>
21458
21459 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21460 !!end
21461
21462 # New headings and existing headings are handled differently
21463 !! test
21464 Headings: 1. Nested inside html
21465 !! options
21466 parsoid=html2wt
21467 !! html
21468 <h1>=foo=</h1>
21469 <h2>=foo=</h2>
21470 <h3>=foo=</h3>
21471
21472 <h1 data-parsoid=''>=foo=</h1>
21473 <h2 data-parsoid=''>=foo=</h2>
21474 <h3 data-parsoid=''>=foo=</h3>
21475 <h4 data-parsoid=''>=foo=</h4>
21476 <h5 data-parsoid=''>=foo=</h5>
21477 <h6 data-parsoid=''>=foo=</h6>
21478 !! wikitext
21479 = =foo= =
21480
21481 == =foo= ==
21482
21483 === =foo= ===
21484
21485 =<nowiki>=foo=</nowiki>=
21486 ==<nowiki>=foo=</nowiki>==
21487 ===<nowiki>=foo=</nowiki>===
21488 ====<nowiki>=foo=</nowiki>====
21489 =====<nowiki>=foo=</nowiki>=====
21490 ======<nowiki>=foo=</nowiki>======
21491
21492 !!end
21493
21494 !! test
21495 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21496 !! options
21497 parsoid=html2wt
21498 !! html
21499 <h1>foo</h1>*bar
21500 <h1>foo</h1>=bar
21501 <h1>foo</h1>=bar=
21502 !! wikitext
21503 = foo =
21504 <nowiki>*</nowiki>bar
21505
21506 = foo =
21507 =bar
21508
21509 = foo =
21510 <nowiki>=bar=</nowiki>
21511 !!end
21512
21513 !! test
21514 Headings: 3. Nested inside html with wikitext split by html tags
21515 !! options
21516 parsoid=html2wt,wt2wt
21517 !! wikitext
21518 = ='''bold'''<nowiki>foo=</nowiki> =
21519 !! html/parsoid
21520 <h1>=<b>bold</b>foo=</h1>
21521 !!end
21522
21523 !! test
21524 Headings: 4a. No escaping needed (testing just h1 and h2)
21525 !! wikitext
21526 = =foo =
21527
21528 = foo= =
21529
21530 = =foo= =
21531
21532 = =foo= bar =
21533
21534 == =foo ==
21535
21536 == foo= ==
21537
21538 = = =
21539
21540 = ''=''foo= =
21541 !! html/parsoid
21542 <h1>=foo</h1>
21543 <h1>foo=</h1>
21544 <h1> =foo= </h1>
21545 <h1>=foo= bar</h1>
21546 <h2>=foo</h2>
21547 <h2>foo=</h2>
21548 <h1>=</h1>
21549 <h1><i>=</i>foo=</h1>
21550 !!end
21551
21552 !! test
21553 Headings: 4b. No escaping needed (inside p-tags)
21554 !! options
21555 parsoid=html2wt
21556 !! html
21557 <p>===
21558 =foo= x
21559 =foo= <s></s>
21560 </p>
21561 !! wikitext
21562 ===
21563 =foo= x
21564 =foo= <s></s>
21565 !!end
21566
21567 !! test
21568 Headings: 5. Empty headings
21569 !! wikitext
21570 =<nowiki/>=
21571
21572 ==<nowiki/>==
21573
21574 ===<nowiki/>===
21575
21576 ====<nowiki/>====
21577
21578 =====<nowiki/>=====
21579
21580 ======<nowiki/>======
21581 !! html/parsoid
21582 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21583
21584 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21585
21586 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21587
21588 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21589
21590 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21591
21592 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21593 !!end
21594
21595 !! test
21596 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21597 !! options
21598 parsoid
21599 !! wikitext
21600 <nowiki>=a=</nowiki>
21601
21602 <nowiki>=a=</nowiki>
21603
21604 <nowiki>=a=</nowiki>
21605
21606 <nowiki>=a=</nowiki>
21607 !! html
21608 <p>=a=</p>
21609 <p>=a= </p>
21610 <p>=a= </p>
21611 <p>=a= </p>
21612 !!end
21613
21614 !! test
21615 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21616 !! options
21617 parsoid
21618 !! wikitext
21619 <nowiki>=a=
21620 b</nowiki>
21621
21622 <nowiki>=a=
21623 b</nowiki>
21624
21625 <nowiki>=a=
21626 b</nowiki>
21627
21628 <nowiki>=a=
21629 b</nowiki>
21630 !! html
21631 <p>=a=
21632 b</p>
21633 <p>=a=
21634 b</p>
21635 <p>=a=
21636 b</p>
21637 <p>=a=
21638 b</p>
21639 </p>
21640 !!end
21641
21642 !! test
21643 Headings: 6c. Heading chars in SOL context (leading newline break)
21644 !! options
21645 parsoid
21646 !! wikitext
21647 a
21648 <nowiki>=b=</nowiki>
21649 !! html
21650 <p>a
21651 =b=</p>
21652 !!end
21653
21654 !! test
21655 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21656 !! options
21657 parsoid
21658 !! wikitext
21659 <!--c0--><nowiki>=a=</nowiki>
21660
21661 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21662 !! html
21663 <p><!--c0-->=a=</p>
21664 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21665 !!end
21666
21667 !! test
21668 Headings: 6d. Heading chars in SOL context (No escaping needed)
21669 !! options
21670 parsoid=html2wt
21671 !! html
21672 =a=<div>b</div>
21673 !! wikitext
21674 =a=<div>b</div>
21675 !!end
21676
21677 !! test
21678 Headings: 7. Insert a newline between new content and headings
21679 !! options
21680 parsoid=html2wt
21681 !! html
21682 <h2>NEW</h2>
21683 <p>new</p>
21684 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21685 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21686 !! wikitext
21687 == NEW ==
21688 new
21689
21690 ==A==
21691 a
21692
21693 !! end
21694
21695 #### --------------- Lists ---------------
21696 #### 0. Outside nests (*foo, etc.)
21697 #### 1. Nested inside html <ul><li>*foo</li></ul>
21698 #### 2. Inside definition lists
21699 #### 3. Only bullets at start should be escaped
21700 #### 4. No escapes needed
21701 #### 5. No unnecessary escapes
21702 #### 6. Escape bullets in SOL position
21703 #### 7. Escape bullets in a multi-line context
21704 #### ----------------------------------------
21705
21706 !! test
21707 Lists: 0. Outside nests
21708 !! wikitext
21709 <nowiki>*</nowiki>foo
21710
21711 <nowiki>#</nowiki>foo
21712
21713 <nowiki>;Foo:</nowiki>bar
21714 !! html
21715 <p>*foo
21716 </p><p>#foo
21717 </p><p>;Foo:bar
21718 </p>
21719 !!end
21720
21721 !! test
21722 Lists: 1. Nested inside html
21723 !! wikitext
21724 *<nowiki>*foo</nowiki>
21725
21726 *<nowiki>#foo</nowiki>
21727
21728 *<nowiki>:foo</nowiki>
21729
21730 *<nowiki>;foo</nowiki>
21731
21732 #<nowiki>*foo</nowiki>
21733
21734 #<nowiki>#foo</nowiki>
21735
21736 #<nowiki>:foo</nowiki>
21737
21738 #<nowiki>;foo</nowiki>
21739 !! html
21740 <ul><li>*foo</li></ul>
21741 <ul><li>#foo</li></ul>
21742 <ul><li>:foo</li></ul>
21743 <ul><li>;foo</li></ul>
21744 <ol><li>*foo</li></ol>
21745 <ol><li>#foo</li></ol>
21746 <ol><li>:foo</li></ol>
21747 <ol><li>;foo</li></ol>
21748
21749 !!end
21750
21751 !! test
21752 Lists: 2. Inside definition lists
21753 !! wikitext
21754 ;<nowiki>;foo</nowiki>
21755
21756 ;<nowiki>:foo</nowiki>
21757
21758 ;<nowiki>:foo</nowiki>
21759 :bar
21760
21761 :<nowiki>:foo</nowiki>
21762 !! html
21763 <dl><dt>;foo</dt></dl>
21764 <dl><dt>:foo</dt></dl>
21765 <dl><dt>:foo</dt>
21766 <dd>bar</dd></dl>
21767 <dl><dd>:foo</dd></dl>
21768
21769 !!end
21770
21771 !! test
21772 Lists: 3. Only bullets at start of text should be escaped
21773 !! wikitext
21774 *<nowiki>*foo*bar</nowiki>
21775
21776 *<nowiki>*foo</nowiki>''it''*bar
21777 !! html
21778 <ul><li>*foo*bar</li></ul>
21779 <ul><li>*foo<i>it</i>*bar</li></ul>
21780
21781 !!end
21782
21783 !! test
21784 Lists: 4. No escapes needed
21785 !! options
21786 parsoid
21787 !! wikitext
21788 *foo*bar
21789
21790 *''foo''*bar
21791
21792 *[[Foo]]: bar
21793
21794 *[[Foo]]*bar
21795 !! html
21796 <ul>
21797 <li>foo*bar
21798 </li>
21799 </ul>
21800 <ul>
21801 <li><i>foo</i>*bar
21802 </li>
21803 </ul>
21804 <ul>
21805 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21806 </li>
21807 </ul>
21808 <ul>
21809 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21810 </li>
21811 </ul>
21812 !!end
21813
21814 !! test
21815 Lists: 5. No unnecessary escapes
21816 !! wikitext
21817 * bar <span><nowiki>[[foo]]</nowiki></span>
21818
21819 * =bar <span><nowiki>[[foo]]</nowiki></span>
21820
21821 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21822
21823 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21824
21825 * =bar <span>foo]]</span>=
21826
21827 * <s></s>: a
21828
21829 * ''* foo''
21830 !! html
21831 <ul><li> bar <span>[[foo]]</span></li></ul>
21832 <ul><li> =bar <span>[[foo]]</span></li></ul>
21833 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21834 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21835 <ul><li> =bar <span>foo]]</span>=</li></ul>
21836 <ul><li> <s></s>: a</li></ul>
21837 <ul><li> <i>* foo</i></li></ul>
21838
21839 !!end
21840
21841 !! test
21842 Lists: 6. Escape bullets in SOL position
21843 !! options
21844 parsoid=html2wt
21845 !! html
21846 <p><!--cmt-->*foo</p>
21847 !! wikitext
21848 <!--cmt--><nowiki>*</nowiki>foo
21849 !!end
21850
21851 !! test
21852 Lists: 7. Escape bullets in a multi-line context
21853 !! wikitext
21854 a
21855 <nowiki>*</nowiki>b
21856 !! html
21857 <p>a
21858 *b
21859 </p>
21860 !!end
21861
21862 !! test
21863 Lists: 8. Escape colons only if not present in tags
21864 !! options
21865 parsoid=html2wt
21866 !! html
21867 <dl><dt>a:b<i>c:d</i></dt></dl>
21868 !! wikitext
21869 ; <nowiki>a:b</nowiki>''c:d''
21870 !! end
21871
21872 #### --------------- HRs ---------------
21873 #### 1. Single line
21874 #### -----------------------------------
21875
21876 !! test
21877 HRs: 1. Single line
21878 !! wikitext
21879 ----<nowiki>----</nowiki>
21880 ----=foo=
21881 ----*foo
21882 !! html+tidy
21883 <hr />
21884 <p>----</p>
21885 <hr />
21886 <p>=foo=</p>
21887 <hr />
21888 <p>*foo</p>
21889 !! end
21890
21891 #### --------------- Tables ---------------
21892 #### 1a. Simple example
21893 #### 1b. No escaping needed (!foo)
21894 #### 1c. No escaping needed (|foo)
21895 #### 1d. No escaping needed (|}foo)
21896 ####
21897 #### 2a. Nested in td (<td>foo|bar</td>)
21898 #### 2b. Nested in td (<td>foo||bar</td>)
21899 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21900 ####
21901 #### 3a. Nested in th (<th>foo!bar</th>)
21902 #### 3b. Nested in th (<th>foo!!bar</th>)
21903 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21904 ####
21905 #### 4a. Escape -
21906 #### 4b. Escape +
21907 #### 4c. No escaping needed
21908 #### --------------------------------------
21909
21910 !! test
21911 Tables: 1a. Simple example
21912 !! wikitext
21913 <nowiki>{|
21914 |}</nowiki>
21915 !! html
21916 <p>{|
21917 |}
21918 </p>
21919 !! end
21920
21921 !! test
21922 Tables: 1b. No escaping needed
21923 !! wikitext
21924 !foo
21925 !! html
21926 <p>!foo
21927 </p>
21928 !! end
21929
21930 !! test
21931 Tables: 1c. No escaping needed
21932 !! wikitext
21933 |foo
21934 !! html
21935 <p>|foo
21936 </p>
21937 !! end
21938
21939 !! test
21940 Tables: 1d. No escaping needed
21941 !! wikitext
21942 |}foo
21943 !! html
21944 <p>|}foo
21945 </p>
21946 !! end
21947
21948 !! test
21949 Tables: 2a. Nested in td
21950 !! options
21951 parsoid=html2wt
21952 !! html/parsoid
21953 <table><tbody><tr>
21954 <td>foo|bar</td></tr>
21955 <tr><td>x<div>a|b</div></td>
21956 </tbody></table>
21957 !! wikitext
21958 {|
21959 |<nowiki>foo|bar</nowiki>
21960 |-
21961 |x<div><nowiki>a|b</nowiki></div>
21962 |}
21963 !! html/php+tidy
21964 <table>
21965 <tr>
21966 <td>foo|bar</td>
21967 </tr>
21968 <tr>
21969 <td>x
21970 <div>a|b</div>
21971 </td>
21972 </tr>
21973 </table>
21974 !! end
21975
21976 !! test
21977 Tables: 2b. Nested in td
21978 !! options
21979 parsoid=html2wt
21980 !! html/parsoid
21981 <table><tbody><tr>
21982 <td>foo||bar</td>
21983 <td>a<i>b||c</i></td>
21984 <td>a<i><div>b||c</div></i></td>
21985 </tr></tbody></table>
21986 !! wikitext
21987 {|
21988 |<nowiki>foo||bar</nowiki>
21989 |a''<nowiki>b||c</nowiki>''
21990 |a''<div><nowiki>b||c</nowiki></div>''
21991 |}
21992 !! html/php
21993 <table>
21994 <tr>
21995 <td>foo||bar
21996 </td>
21997 <td>a<i>b||c</i>
21998 </td>
21999 <td>a<i><div>b||c</div></i>
22000 </td></tr></table>
22001
22002 !! end
22003
22004 !! test
22005 Tables: 2c. Nested in td -- no escaping needed
22006 !! wikitext
22007 {|
22008
22009 |foo!!bar
22010 |}
22011 !! html/*
22012 <table>
22013
22014 <tr>
22015 <td>foo!!bar
22016 </td></tr></table>
22017
22018 !! end
22019
22020 !! test
22021 Tables: 3a. Nested in th
22022 !! wikitext
22023 {|
22024
22025 !foo!bar
22026 |}
22027 !! html/*
22028 <table>
22029
22030 <tr>
22031 <th>foo!bar
22032 </th></tr></table>
22033
22034 !! end
22035
22036 !! test
22037 Tables: 3b. Nested in th
22038 !! options
22039 parsoid=html2wt
22040 !! html/parsoid
22041 <table><tbody>
22042 <tr><th>foo!!bar</th>
22043 <th><i>foo|bar</i></th>
22044 <th><i>foo!!bar</i></th>
22045 <th><i><span>foo!!bar</span></i></th>
22046 </tr></tbody></table>
22047 !! wikitext
22048 {|
22049 !<nowiki>foo!!bar</nowiki>
22050 !''<nowiki>foo|bar</nowiki>''
22051 !''<nowiki>foo!!bar</nowiki>''
22052 !''<span><nowiki>foo!!bar</nowiki></span>''
22053 |}
22054 !! html/php
22055 <table>
22056 <tr>
22057 <th>foo!!bar
22058 </th>
22059 <th><i>foo|bar</i>
22060 </th>
22061 <th><i>foo!!bar</i>
22062 </th>
22063 <th><i><span>foo!!bar</span></i>
22064 </th></tr></table>
22065
22066 !! end
22067
22068 !! test
22069 Tables: 3c. Nested in th
22070 !! options
22071 parsoid=html2wt
22072 !! html/parsoid
22073 <table><tbody>
22074 <tr><th>foo||bar</th>
22075 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22076 </tr></tbody></table>
22077 !! wikitext
22078 {|
22079 !<nowiki>foo||bar</nowiki>
22080 !<nowiki>foo||bar</nowiki>
22081 |}
22082 !! html/php
22083 <table>
22084 <tr>
22085 <th>foo||bar
22086 </th>
22087 <th>foo||bar
22088 </th></tr></table>
22089
22090 !! end
22091
22092 !! test
22093 Tables: 4a. Escape -
22094 !! options
22095 parsoid=html2wt
22096 !! html/*
22097 <table>
22098
22099 <tr>
22100 <th>-bar
22101 </th></tr>
22102 <tr>
22103 <td>-bar
22104 </td></tr></table>
22105
22106 !! wikitext
22107 {|
22108
22109 !-bar
22110
22111 |-
22112 |<nowiki>-bar</nowiki>
22113 |}
22114 !! end
22115
22116 !! test
22117 Tables: 4b. Escape +
22118 !! options
22119 parsoid=html2wt
22120 !! html/*
22121 <table>
22122
22123 <tr>
22124 <th>+bar
22125 </th></tr>
22126 <tr>
22127 <td>+bar
22128 </td></tr></table>
22129
22130 !! wikitext
22131 {|
22132
22133 !+bar
22134
22135 |-
22136 |<nowiki>+bar</nowiki>
22137 |}
22138 !! end
22139
22140 !! test
22141 Tables: 4c. No escaping needed
22142 !! wikitext
22143 {|
22144 |foo-bar
22145 |foo+bar
22146 |-
22147 |''foo''-bar
22148 |''foo''+bar
22149 |-
22150 |foo
22151 bar|baz
22152 +bar
22153 -bar
22154 |-
22155 |x
22156 <div>a|b</div>
22157 |}
22158 !! html/php
22159 <table>
22160 <tr>
22161 <td>foo-bar
22162 </td>
22163 <td>foo+bar
22164 </td></tr>
22165 <tr>
22166 <td><i>foo</i>-bar
22167 </td>
22168 <td><i>foo</i>+bar
22169 </td></tr>
22170 <tr>
22171 <td>foo
22172 <p>bar|baz
22173 +bar
22174 -bar
22175 </p>
22176 </td></tr>
22177 <tr>
22178 <td>x
22179 <div>a|b</div>
22180 </td></tr></table>
22181
22182 !! html/parsoid
22183 <table><tbody>
22184 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22185 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22186 <tr><td>foo
22187 <p>bar|baz
22188 +bar
22189 -bar</p></td></tr>
22190 <tr><td>x
22191 <div>a|b</div></td>
22192 </tbody></table>
22193 !! end
22194
22195 !! test
22196 Tables: 4d. No escaping needed
22197 !! wikitext
22198 {|
22199 |[[Foo]]-bar
22200 ||+1
22201 ||-2
22202 |}
22203 !! html/php
22204 <table>
22205 <tr>
22206 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22207 </td>
22208 <td>+1
22209 </td>
22210 <td>-2
22211 </td></tr></table>
22212
22213 !! html/parsoid
22214 <table>
22215 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22216 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22217 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22218 </tbody></table>
22219 !! end
22220
22221 !! test
22222 Tables: Digest broken attributes on table and tr tag
22223 !! options
22224 parsoid=wt2html
22225 !! wikitext
22226 {| || |} ++
22227 |- || || ++ --
22228 |- > [
22229 |}
22230 !! html
22231 <table>
22232 <tbody>
22233 <tr></tr>
22234 <tr></tr>
22235 </tbody></table>
22236 !! end
22237
22238 !! test
22239 T97430: Don't emit empty nowiki pairs around marker meta tags
22240 !! options
22241 parsoid=html2wt
22242 !! html
22243 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22244 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22245 !! wikitext
22246 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22247 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22248 !! end
22249
22250 !! test
22251 Unclosed xmlish element in table line shouldn't eat end delimiters
22252 !! wikitext
22253 {|
22254 | <foo
22255 | bar>
22256 |}
22257 !! html/php
22258 <table>
22259 <tr>
22260 <td> &lt;foo
22261 </td>
22262 <td> bar&gt;
22263 </td></tr></table>
22264
22265 !! html/parsoid
22266 <table>
22267 <tbody><tr><td> &lt;foo</td>
22268 <td> bar></td></tr>
22269 </tbody></table>
22270 !! end
22271
22272 #### --------------- Links ----------------
22273 #### 1. Quote marks in link text
22274 #### 2. Wikilinks: Escapes needed
22275 #### 3. Wikilinks: No escapes needed
22276 #### 4. Extlinks: Escapes needed
22277 #### 5. Extlinks: No escapes needed
22278 #### --------------------------------------
22279 !! test
22280 Links 1. WikiLinks: No escapes needed
22281 !! wikitext
22282 [[Foo|Foo''boo'']]
22283 [[Foo|[Foobar]]]
22284 [[Foo|x [Foobar] x]]
22285 !! html/php
22286 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22287 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22288 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22289 </p>
22290 !! html/parsoid
22291 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22292 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22293 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22294 !! end
22295
22296 !! test
22297 Links 2. WikiLinks: Escapes needed
22298 !! options
22299 parsoid=html2wt
22300 !! html/parsoid
22301 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22302 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22303 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22304 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22305 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22306 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22307 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22308 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22309 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22310 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22311 !! wikitext
22312 [[Foo|<nowiki>Foobar]</nowiki>]]
22313 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22314 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22315 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22316 [[Foo|<nowiki>|Bar</nowiki>]]
22317 [[Foo|<nowiki>]]bar</nowiki>]]
22318 [[Foo|<nowiki>[[bar</nowiki>]]
22319 [[Foo|<nowiki>x [[ y</nowiki>]]
22320 [[Foo|<nowiki>x ]] y</nowiki>]]
22321 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22322 !! html/php
22323 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22324 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22325 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22326 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22327 <a href="/wiki/Foo" title="Foo">|Bar</a>
22328 <a href="/wiki/Foo" title="Foo">]]bar</a>
22329 <a href="/wiki/Foo" title="Foo">[[bar</a>
22330 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22331 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22332 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22333 </p>
22334 !! end
22335
22336 !! test
22337 Links 3. WikiLinks: No escapes needed
22338 !! wikitext
22339 [[Foo|[Foobar]]
22340 [[Foo|foo|bar]]
22341 !! html/php
22342 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22343 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22344 </p>
22345 !! html/parsoid
22346 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22347 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22348 !! end
22349
22350 !! test
22351 Links 4. ExtLinks: Escapes needed
22352 !! options
22353 parsoid=html2wt
22354 !! html/parsoid
22355 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22356 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22357 <p>[http://google.com]</p>
22358 <p>[http://google.com google]</p>
22359 !! wikitext
22360 [http://google.com <nowiki>[google]</nowiki>]
22361 [http://google.com <nowiki>google]</nowiki>]
22362
22363 <nowiki>[http://google.com]</nowiki>
22364
22365 <nowiki>[http://google.com google]</nowiki>
22366
22367 !! html/php
22368 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22369 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22370 </p><p>[http://google.com]
22371 </p><p>[http://google.com google]
22372 </p>
22373 !! end
22374
22375 !! test
22376 Links 5. ExtLinks: No escapes needed
22377 !! wikitext
22378 [http://google.com [google]
22379 !! html/php
22380 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22381 </p>
22382 !! html/parsoid
22383 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22384 !! end
22385
22386 !! test
22387 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22388 !! html/parsoid
22389 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22390 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22391 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22392 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22393 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22394 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22395 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22396 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22397 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22398 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22399 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22400 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22401 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22402 </p>
22403 !! wikitext
22404 x<nowiki/>http://example.com<nowiki/>y
22405 http://example.com<nowiki/>?x
22406 http://example.com<nowiki/>&x
22407 http://example.com<nowiki/>'x
22408 http://example.com<nowiki/>,x
22409 http://example.com<nowiki/>.x
22410 http://example.com<nowiki/>;x
22411 http://example.com<nowiki/>:x
22412 http://example.com<nowiki/>;x
22413 http://example.com<nowiki/>!x
22414 http://example.com<nowiki/>=x
22415 http://example.com<nowiki/>(x)
22416 http://example.com(x<nowiki/>)
22417 !! end
22418
22419 !! test
22420 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22421 !! html/parsoid
22422 <p>x
22423 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22424 y
22425 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22426 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22427 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22428 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22429 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22430 </p>
22431 !! wikitext
22432 x
22433 http://example.com
22434 y
22435 "http://example.com"
22436 (http://example.com)
22437 (http://example.com) foo
22438 http://example.com,
22439 http://example.com, foo
22440 !! html/php
22441 <p>x
22442 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22443 y
22444 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22445 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22446 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22447 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22448 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22449 </p>
22450 !! end
22451
22452 !! test
22453 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22454 !! html/parsoid
22455 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22456 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22457 !! wikitext
22458 http://example.com.,;:!?\
22459 -http://example.com:
22460 !! html/php
22461 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22462 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22463 </p>
22464 !! end
22465
22466 !! test
22467 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22468 !! html/parsoid
22469 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22470 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22471 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22472 !! wikitext
22473 RFC 123<nowiki/>4
22474 RFC 123<nowiki/>y
22475 X<nowiki/>RFC 123<nowiki/>y
22476 !! end
22477
22478 !! test
22479 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22480 !! html/parsoid
22481 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22482 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22483 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22484 </p>
22485 !! wikitext
22486 RFC 123?foo
22487 RFC 123&foo
22488 -RFC 123-
22489 !! html/php
22490 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22491 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22492 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22493 </p>
22494 !! end
22495
22496 !! test
22497 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22498 !! html/parsoid
22499 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22500 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22501 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22502 !! wikitext
22503 PMID 123<nowiki/>4
22504 PMID 123<nowiki/>y
22505 X<nowiki/>PMID 123<nowiki/>y
22506 !! end
22507
22508 !! test
22509 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (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>?foo
22512 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22513 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22514 </p>
22515 !! wikitext
22516 PMID 123?foo
22517 PMID 123&foo
22518 -PMID 123-
22519 !! html/php
22520 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22521 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22522 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22523 </p>
22524 !! end
22525
22526 !! test
22527 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22528 !! html/parsoid
22529 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22530 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22531 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22532 </p>
22533 !! wikitext
22534 ISBN 1234567890<nowiki/>1
22535 ISBN 1234567890<nowiki/>x
22536 a<nowiki/>ISBN 1234567890<nowiki/>b
22537 !! end
22538
22539 !! test
22540 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22541 !! html/parsoid
22542 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22543 !! wikitext
22544 -ISBN 1234567890's
22545 !! html/php
22546 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22547 </p>
22548 !! end
22549
22550 !! test
22551 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22552 !! options
22553 parsoid=html2wt
22554 !! html/*
22555 <p>this is not a link: http://example.com
22556 </p>
22557 !! wikitext
22558 this is not a link: <nowiki>http://example.com</nowiki>
22559 !! end
22560
22561 !! test
22562 Links 15. Link trails can't become link prefixes.
22563 !! options
22564 language=is
22565 !! wikitext
22566 [[Söfnuður]]-[[00]]
22567 !! html/php
22568 <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>
22569 </p>
22570 !! html/parsoid
22571 <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>
22572 !! end
22573
22574 #### --------------- Quotes ---------------
22575 #### 1. Quotes inside <b> and <i>
22576 #### 2. Link fragments separated by <i> and <b> tags
22577 #### 3. Link fragments inside <i> and <b>
22578 #### 4. No escaping needed
22579 #### --------------------------------------
22580 !! test
22581 1a. Quotes inside <b> and <i>
22582 !! options
22583 parsoid=html2wt,wt2wt
22584 !! wikitext
22585 ''<nowiki/>'foo'''
22586 ''<nowiki>''foo''</nowiki>''
22587 ''<nowiki>'''foo'''</nowiki>''
22588 ''foo''<nowiki/>'s
22589 '''<nowiki/>'foo''''
22590 '''<nowiki>''foo''</nowiki>'''
22591 '''<nowiki>'''foo'''</nowiki>'''
22592 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22593 '''foo'''<nowiki/>'s
22594 '''foo''
22595 ''foo''<nowiki/>'
22596 ''foo'''<nowiki/>'
22597 '''foo''<nowiki/>'
22598 ''''foo'''
22599 '''foo'''<nowiki/>'
22600 ''''foo'''<nowiki/>'
22601 ''fools'<span> errand</span>''
22602 ''<span>fool</span>'s errand''
22603 '<nowiki/>''foo'' bar '''baz''
22604 a|!*#-:;+-~[]{}b'''x''
22605 !! html/*
22606 <p><i>'foo'</i>
22607 <i>''foo''</i>
22608 <i>'''foo'''</i>
22609 <i>foo</i>'s
22610 <b>'foo'</b>
22611 <b>''foo''</b>
22612 <b>'''foo'''</b>
22613 <b>foo'<i>bar'</i>baz</b>
22614 <b>foo</b>'s
22615 '<i>foo</i>
22616 <i>foo</i>'
22617 <i>foo'</i>'
22618 '<i>foo</i>'
22619 '<b>foo</b>
22620 <b>foo</b>'
22621 '<b>foo</b>'
22622 <i>fools'<span> errand</span></i>
22623 <i><span>fool</span>'s errand</i>
22624 '<i>foo</i> bar '<i>baz</i>
22625 a|!*#-:;+-~[]{}b'<i>x</i>
22626 </p>
22627 !! end
22628
22629 !! test
22630 1b. Quotes inside <b> and <i> with other tags on same line
22631 !! options
22632 parsoid=html2wt,wt2wt
22633 !! wikitext
22634 '''a'' foo ''[[bar]]''
22635 ''a''' foo ''[[bar]]''
22636 ''a''' foo '''{{echo|[[bar]]}}'''
22637 [[foo]] x'''[[bar]]''
22638 '''foo'' <ref>test</ref>
22639 '''foo'' <div title="name">test</div>
22640 '''foo'' and <br> bar
22641 <references />
22642 !! html
22643 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22644 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22645 <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>
22646 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22647 '<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>
22648 '<i>foo</i> <div title="name">test</div>
22649 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22650 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22651 <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>
22652 </ol>
22653 !! end
22654
22655 !! test
22656 2. Link fragments separated by <i> and <b> tags
22657 !! wikitext
22658 [[''foo''<nowiki>hello]]</nowiki>
22659
22660 [['''foo'''<nowiki>hello]]</nowiki>
22661 !! html
22662 <p>[[<i>foo</i>hello]]
22663 </p><p>[[<b>foo</b>hello]]
22664 </p>
22665 !! end
22666
22667 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22668 # this is one of the shortcomings of this format
22669 !! test
22670 3. Link fragments inside <i> and <b>
22671 !! wikitext
22672 ''[[foo''<nowiki>]]</nowiki>
22673
22674 '''[[foo'''<nowiki>]]</nowiki>
22675 !! html
22676 <p><i>[[foo</i>]]
22677 </p><p><b>[[foo</b>]]
22678 </p>
22679 !! end
22680
22681 !! test
22682 4. No escaping needed
22683 !! wikitext
22684 '<span>''bar''</span>'
22685 '<span>'''bar'''</span>'
22686 'a:b'foo
22687 !! html
22688 <p>'<span><i>bar</i></span>'
22689 '<span><b>bar</b></span>'
22690 'a:b'foo
22691 </p>
22692 !! end
22693
22694 #### ----------- Paragraphs ---------------
22695 #### 1. No unnecessary escapes
22696 #### --------------------------------------
22697
22698 !! test
22699 1. No unnecessary escapes
22700 !! wikitext
22701 bar <span><nowiki>[[foo]]</nowiki></span>
22702
22703 =bar <span><nowiki>[[foo]]</nowiki></span>
22704
22705 [[bar <span><nowiki>[[foo]]</nowiki></span>
22706
22707 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22708
22709 =bar <span>foo]]</span><nowiki>=</nowiki>
22710 !! html
22711 <p>bar <span>[[foo]]</span>
22712 </p><p>=bar <span>[[foo]]</span>
22713 </p><p>[[bar <span>[[foo]]</span>
22714 </p><p>]]bar <span>[[foo]]</span>
22715 </p><p>=bar <span>foo]]</span>=
22716 </p>
22717 !!end
22718
22719 #### ----------------------- PRE --------------------------
22720 #### 1. Leading whitespace in SOL context should be escaped
22721 #### ------------------------------------------------------
22722 !! test
22723 1. Leading whitespace in SOL context should be escaped
22724 !! options
22725 parsoid
22726 !! wikitext
22727 <nowiki> </nowiki>a
22728
22729 <nowiki> </nowiki> a
22730
22731 <nowiki> </nowiki>a(tab)
22732
22733 <nowiki> </nowiki> a
22734 <!--cmt-->
22735 <nowiki> </nowiki> a
22736
22737 a
22738 <nowiki> </nowiki>b
22739
22740 a
22741 <nowiki> </nowiki>b
22742
22743 a
22744 <nowiki> </nowiki> b
22745 !! html
22746 <p> a</p>
22747 <p> a</p>
22748 <p> a(tab)</p>
22749 <p> a</p>
22750 <p><!--cmt--> a</p>
22751 <p>a
22752 b</p>
22753 <p>a
22754 b</p>
22755 <p>a
22756 b</p>
22757 !! end
22758
22759 !! test
22760 2. Leading whitespace in non-indent-pre contexts should not be escaped
22761 !! options
22762 parsoid
22763 !! wikitext
22764 foo <ref>''a''
22765 b</ref>
22766 <references />
22767 !! html
22768 <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>
22769 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22770 <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>
22771 b</span></li>
22772 </ol>
22773 !! end
22774
22775 !! test
22776 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22777 !! options
22778 parsoid
22779 !! wikitext
22780 <blockquote>
22781 a
22782 <span>b</span>
22783 c
22784 </blockquote>
22785 !! html
22786 <blockquote>
22787 <p>
22788 a
22789 <span>b</span>
22790 c</p>
22791 </blockquote>
22792 !! end
22793
22794 !! test
22795 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22796 !! options
22797 parsoid
22798 !! wikitext
22799 [[File:Foobar.jpg|thumb|caption]]
22800 !! html/parsoid
22801 <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>
22802 !! end
22803
22804 !! test
22805 5. Nowiki escaping should account for indent-pres
22806 !! options
22807 parsoid=html2wt
22808 !! html
22809 <pre>==foo==</pre>
22810 !! wikitext
22811 ==foo==
22812 !! end
22813
22814 !!test
22815 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
22816 !! options
22817 parsoid
22818 !! wikitext
22819 * foo
22820 * bar
22821 !! html
22822 <pre>
22823 * foo
22824 * bar
22825 </pre>
22826 !! end
22827
22828 #### --------------- Behavior Switches --------------------
22829
22830 !! test
22831 1. Valid behavior switches should be escaped
22832 !! options
22833 parsoid=html2wt
22834 !! html
22835 __TOC__
22836 <i>__TOC__</i>
22837 !! wikitext
22838 <nowiki>__TOC__</nowiki>
22839 ''<nowiki>__TOC__</nowiki>''
22840 !! end
22841
22842 !! test
22843 2. Invalid behavior switches should not be escaped
22844 !! options
22845 parsoid=html2wt
22846 !! html
22847 __TOO__
22848 __|__
22849 !! wikitext
22850 __TOO__
22851 __|__
22852 !! end
22853
22854 # We use indent-pre as an indirect way to test for sol-transparent behavior.
22855 !! test
22856 Behavior switches should be SOL-transparent
22857 !! wikitext
22858 __TOC__
22859
22860 <!-- this one's bogus -->
22861 __TOO__
22862
22863 __TOC__ foo
22864
22865 __TOC__ bar
22866 !! html/parsoid
22867 <meta property="mw:PageProp/toc" />
22868
22869 <!-- this one's bogus -->
22870 <pre>__TOO__</pre>
22871
22872 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
22873
22874 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
22875 !! end
22876
22877 #### --------------- HTML tags ---------------
22878 #### 1. a tags
22879 #### 2. other tags
22880 #### 3. multi-line html tag
22881 #### 4. extension tags
22882 #### -----------------------------------------
22883 !! test
22884 1. a tags
22885 !! options
22886 parsoid
22887 !! wikitext
22888 <a href="http://google.com">google</a>
22889 !! html
22890 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22891 !! end
22892
22893 !! test
22894 2. other tags
22895 !! wikitext
22896 * <nowiki><div>foo</div></nowiki>
22897 * <nowiki><div style="color:red">foo</div></nowiki>
22898 * <nowiki><td></nowiki>
22899 !! html
22900 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22901 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22902 <li> &lt;td&gt;</li></ul>
22903
22904 !! end
22905
22906 !! test
22907 3. multi-line html tag
22908 !! wikitext
22909 <nowiki><div
22910 >foo</div
22911 ></nowiki>
22912 !! html
22913 <p>&lt;div
22914 &gt;foo&lt;/div
22915 &gt;
22916 </p>
22917 !! end
22918
22919 !! test
22920 4. extension tags
22921 !! wikitext
22922 <nowiki><ref>foo</ref></nowiki>
22923
22924 <nowiki><ref>bar</nowiki>
22925
22926 baz<nowiki></ref></nowiki>
22927 !! html
22928 <p>&lt;ref&gt;foo&lt;/ref&gt;
22929 </p><p>&lt;ref&gt;bar
22930 </p><p>baz&lt;/ref&gt;
22931 </p>
22932 !! end
22933
22934 #### --------------- Others ---------------
22935 !! test
22936 Escaping nowikis
22937 !! wikitext
22938 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22939 !! html
22940 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22941 </p>
22942 !! end
22943
22944 ## The quote-char in the input is necessary for triggering the bug
22945 !! test
22946 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22947 !! options
22948 parsoid=wt2wt,html2wt
22949 !! wikitext
22950 foo's bar :
22951 !! html
22952 <p>foo's bar :</p>
22953 !! end
22954
22955 !! test
22956
22957 Tag-like HTML structures are passed through as text
22958 !! wikitext
22959 <x y>
22960
22961 <x.y>
22962
22963 <x-y>
22964
22965 1>2
22966
22967 x<y
22968
22969 a>b
22970
22971 1<d e>f
22972 !! html
22973 <p>&lt;x y&gt;
22974 </p><p>&lt;x.y&gt;
22975 </p><p>&lt;x-y&gt;
22976 </p><p>1&gt;2
22977 </p><p>x&lt;y
22978 </p><p>a&gt;b
22979 </p><p>1&lt;d e&gt;f
22980 </p>
22981 !! end
22982
22983 !! test
22984 HTML tag with necessary entities in attributes
22985 !! wikitext
22986 <span title="&amp;amp;">foo</span>
22987 !! html
22988 <p><span title="&amp;amp;">foo</span>
22989 </p>
22990 !! end
22991
22992 !! test
22993 HTML tag with 'unnecessary' entity encoding in attributes
22994 !! wikitext
22995 <span title="&amp;">foo</span>
22996 !! html
22997 <p><span title="&amp;">foo</span>
22998 </p>
22999 !! end
23000
23001 !! test
23002 HTML tag with broken attribute value quoting
23003 !! wikitext
23004 <span title="Hello world>Foo</span>
23005 !! html/php
23006 <p><span>Foo</span>
23007 </p>
23008 !! html/parsoid
23009 <p><span title="Hello world">Foo</span>
23010 </p>
23011 !! end
23012
23013 !! test
23014 Parsoid-only: HTML tag with broken attribute value quoting
23015 !! options
23016 parsoid
23017 !! wikitext
23018 <span title="Hello world>Foo</span>
23019 !! html
23020 <p><span title="Hello world">Foo</span>
23021 </p>
23022 !! end
23023
23024 !! test
23025 Table with broken attribute value quoting
23026 !! wikitext
23027 {|
23028 | title="Hello world|Foo
23029 |}
23030 !! html/php
23031 <table>
23032 <tr>
23033 <td>Foo
23034 </td></tr></table>
23035
23036 !! html/parsoid
23037 <table>
23038 <tr>
23039 <td title="Hello world">Foo
23040 </td></tr></table>
23041
23042 !! end
23043
23044 !! test
23045 Table with broken attribute value quoting on consecutive lines
23046 !! wikitext
23047 {|
23048 | title="Hello world|Foo
23049 | style="color:red|Bar
23050 |}
23051 !! html/php
23052 <table>
23053 <tr>
23054 <td>Foo
23055 </td>
23056 <td>Bar
23057 </td></tr></table>
23058
23059 !! html/parsoid
23060 <table><tbody>
23061 <tr>
23062 <td title="Hello world">Foo
23063 </td><td style="color: red">Bar
23064 </td></tr></tbody></table>
23065
23066 !! end
23067
23068 !! test
23069 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23070 !! options
23071 parsoid
23072 !! wikitext
23073 {{}}
23074 !! html
23075 {{}}
23076 !! end
23077
23078 !! test
23079 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23080 !! options
23081 parsoid
23082 !! wikitext
23083 }}{{
23084 !! html
23085 }}{{
23086 !! end
23087
23088 !!test
23089 Accept empty td cell attribute
23090 !! wikitext
23091 {|
23092 | align="center" | foo || |
23093 |}
23094 !! html
23095 <table>
23096 <tr>
23097 <td align="center"> foo </td>
23098 <td>
23099 </td></tr></table>
23100
23101 !!end
23102
23103 !!test
23104 Non-empty attributes in th-cells
23105 !! wikitext
23106 {|
23107 ! Foo !! style="color: red" | Bar
23108 |}
23109 !! html
23110 <table>
23111 <tr>
23112 <th> Foo </th>
23113 <th style="color: red"> Bar
23114 </th></tr></table>
23115
23116 !!end
23117
23118 !!test
23119 Accept empty attributes in th-cells
23120 !! wikitext
23121 {|
23122 !| foo !!| bar
23123 |}
23124 !! html
23125 <table>
23126 <tr>
23127 <th> foo </th>
23128 <th> bar
23129 </th></tr></table>
23130
23131 !!end
23132
23133 !!test
23134 Empty table rows go away
23135 !! wikitext
23136 {|
23137 | Hello
23138 | there
23139 |- class="foo"
23140 |-
23141 |}
23142 !! html
23143 <table>
23144 <tr>
23145 <td> Hello
23146 </td>
23147 <td> there
23148 </td></tr>
23149
23150 </table>
23151
23152 !! end
23153
23154 ###
23155 ### Parsoid-centric tests for testing RTing of inter-element separators
23156 ### Edge cases not tested by existing parser tests and specific to
23157 ### Parsoid-specific serialization strategies.
23158 ###
23159
23160 !!test
23161 RT-ed inter-element separators should be valid separators
23162 !! wikitext
23163 {|
23164 |- [[foo]]
23165 |}
23166 !! html
23167 <table>
23168
23169 </table>
23170
23171 !!end
23172
23173 # Parsoid-only since PHP parser relies on Tidy for correct output
23174 !!test
23175 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23176 !!options
23177 parsoid
23178 !! wikitext
23179 {|
23180 |<small>foo
23181 bar
23182 |}
23183
23184 {|
23185 |<small>foo<small>
23186 |}
23187 !! html
23188 <table>
23189 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23190 <p>bar</p></small></td></tr>
23191 </tbody></table>
23192
23193 <table>
23194 <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>
23195 </tbody></table>
23196 !!end
23197
23198 # Note that the "style" attribute is really a template parameter here.
23199 # The = would have to be {{=}} if you wanted the literal.
23200 !!test
23201 Empty TD followed by TD with tpl-generated attribute
23202 !! wikitext
23203 {|
23204 |-
23205 |
23206 |{{echo|style='color:red'}}|foo
23207 |}
23208 !! html
23209 <table>
23210
23211 <tr>
23212 <td>
23213 </td>
23214 <td>foo
23215 </td></tr></table>
23216
23217 !!end
23218
23219 !!test
23220 Indented table with an empty td
23221 !! wikitext
23222 {|
23223 |-
23224 |
23225 |foo
23226 |}
23227 !! html
23228 <table>
23229
23230 <tr>
23231 <td>
23232 </td>
23233 <td>foo
23234 </td></tr></table>
23235
23236 !!end
23237
23238 ## We have some newline diffs RT-ing this edge case
23239 ## and it is not important enough -- we seem to be emitting
23240 ## at most 2 newlines after a </tr> and this is unrelated to
23241 ## the issue from T85627 that this is testing.
23242 !!test
23243 Indented table with blank lines in between (T85627)
23244 !! options
23245 parsoid=wt2html
23246 !! wikitext
23247 {|
23248 |foo
23249
23250
23251 |}
23252 !! html
23253 <table>
23254
23255 <tr>
23256 <td>foo
23257 </td></tr></table>
23258
23259 !!end
23260
23261 !!test
23262 Indented block & table
23263 !! wikitext
23264 <div>foo</div>
23265 {|
23266 |foo
23267 |}
23268 !! html/php
23269 <div>foo</div>
23270 <table>
23271 <tr>
23272 <td>foo
23273 </td></tr></table>
23274
23275 !! html/parsoid
23276 <div data-parsoid='{"stx":"html"}'>foo</div>
23277 <table><tbody>
23278 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23279 </tbody></table>
23280 !!end
23281
23282 !! test
23283 Indent and comment before table row
23284 !! wikitext
23285 {|
23286 <!--hi-->|-
23287 | there
23288 |}
23289 !! html/php
23290 <table>
23291
23292 <tr>
23293 <td> there
23294 </td></tr></table>
23295
23296 !! html/parsoid
23297 <table>
23298 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23299 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23300 </tbody></table>
23301 !! end
23302
23303 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23304 !!test
23305 Empty TR followed by a template-generated TR
23306 !!options
23307 parsoid
23308 !! wikitext
23309 {|
23310 |-
23311 {{echo|<tr><td>foo</td></tr>}}
23312 |}
23313 !! html
23314 <table>
23315 <tbody>
23316 <tr></tr>
23317 <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}}]}'>
23318 <td>foo</td></tr>
23319 </tbody></table>
23320 !!end
23321
23322 ## PHP and parsoid output differ for this, and since this is primarily
23323 ## for testing Parsoid's serializer, marking this Parsoid only
23324 !!test
23325 Empty TR followed by mixed-ws-comment line should RT correctly
23326 !!options
23327 parsoid
23328 !! wikitext
23329 {|
23330 |-
23331 <!--c-->
23332 |-
23333 <!--c--> <!--d-->
23334 |}
23335 !! html
23336 <table>
23337 <tbody>
23338 <tr></tr>
23339 <!--c-->
23340 <tr>
23341 <!--c--> </tr><!--d-->
23342 </tbody></table>
23343
23344 !!end
23345
23346 !!test
23347 Multi-line image caption generated by templates with/without trailing newlines
23348 !! wikitext
23349 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23350 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23351 !! html/parsoid
23352 <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>
23353 <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>
23354 !!end
23355
23356 !! test
23357 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23358 !! options
23359 parsoid=html2wt
23360 !! html/parsoid
23361 <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>
23362
23363 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23364 !! wikitext
23365 <includeonly>foo</includeonly>
23366 new para
23367
23368 [[Category:Foo]]
23369
23370 = new heading =
23371 !! end
23372
23373 ## PHP emits broken html for this, and since this is primarily
23374 ## a Parsoid serializer test, marking this Parsoid only
23375 !!test
23376 Improperly nested inline or quotes tags with whitespace in between
23377 !! wikitext
23378 <span> <s>x</span> </s>
23379 ''' ''x''' ''
23380 !! html/parsoid
23381 <p><span> <s>x</s></span><s> </s>
23382 <b> <i>x</i></b><i> </i>
23383 </p>
23384 !!end
23385
23386 !!test
23387 Encapsulate protected attributes from wt
23388 !! wikitext
23389 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23390 !! html/parsoid
23391 <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>
23392 </body>
23393 !!end
23394
23395 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23396 ## Having nested or stray pre tags results in the attempt to add duplicates,
23397 ## causing an assertion fail. This test tries to prevent that situation.
23398 !!test
23399 Ensure ParagraphWrapper can deal with stray closing pre tags
23400 !!options
23401 parsoid=wt2html
23402 !! wikitext
23403 plain text</pre>
23404 !! html/parsoid
23405 plain text
23406 !!end
23407
23408 !!test
23409 1. Ensure fostered text content is wrapped in element nodes
23410 !!options
23411 parsoid=wt2html
23412 !! wikitext
23413 <table>hi</table><table>ho</table>
23414 !! html/parsoid
23415 <p>hi</p>
23416 <table></table>
23417 <p>ho</p>
23418 <table></table>
23419 !!end
23420
23421 !!test
23422 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23423 !!options
23424 parsoid=wt2html,wt2wt
23425 !! wikitext
23426 <table>
23427 <tr> || ||
23428 <td> a
23429 </table>
23430 !! html/parsoid
23431 <p> || ||
23432 </p><table>
23433 <tbody><tr><td> a</td></tr>
23434 </tbody></table>
23435 !!end
23436
23437 !!test
23438 Encapsulation properly handles null DSR information from foster box
23439 !!options
23440 parsoid=wt2html,wt2wt
23441 !! wikitext
23442 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23443 !! html/parsoid
23444 <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>
23445 !!end
23446
23447 !!test
23448 1. Encapsulate foster-parented transclusion content
23449 !!options
23450 parsoid=wt2wt,wt2html
23451 !! wikitext
23452 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23453 !! html/parsoid
23454 <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>
23455 <tbody>
23456 <tr>
23457 <td>bar</td>
23458 </tr>
23459 </tbody>
23460 </table>
23461 !!end
23462
23463 !!test
23464 2. Encapsulate foster-parented transclusion content
23465 !!options
23466 parsoid=wt2wt,wt2html
23467 !! wikitext
23468 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23469 !! html/parsoid
23470 <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>
23471 <table>
23472 <tbody>
23473 <tr>
23474 <td>bar</td>
23475 </tr>
23476 </tbody>
23477 </table>
23478 !!end
23479
23480 !!test
23481 3. Encapsulate foster-parented transclusion content
23482 !!options
23483 parsoid=wt2wt,wt2html
23484 !! wikitext
23485 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23486 !! html/parsoid
23487 <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;]}">
23488 <p>foo</p>
23489 </div>
23490 <table>
23491 <tbody>
23492 <tr>
23493 <td>bar</td>
23494 </tr>
23495 </tbody>
23496 </table>
23497 !!end
23498
23499 !!test
23500 4. Encapsulate foster-parented transclusion content
23501 !!options
23502 parsoid=wt2wt,wt2html
23503 !! wikitext
23504 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23505 !! html/parsoid
23506 <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;]}">
23507 <p>foo</p>
23508 </div>
23509 <table>
23510 <tbody>
23511 <tr>
23512 <td>bar</td>
23513 </tr>
23514 </tbody>
23515 </table>
23516 !!end
23517
23518 !!test
23519 5. Encapsulate foster-parented transclusion content
23520 !!options
23521 parsoid=wt2wt,wt2html
23522 !! wikitext
23523 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23524 !! html/parsoid
23525 <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>
23526 <table>
23527 <tbody>
23528 <tr>
23529 <td>
23530 <div>
23531 <p>foo</p>
23532 </div>
23533 </td>
23534 </tr>
23535 </tbody>
23536 </table>
23537 !!end
23538
23539 !!test
23540 6. Encapsulate foster-parented transclusion content
23541 !!options
23542 parsoid=wt2wt,wt2html
23543 !! wikitext
23544 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23545 !! html/parsoid
23546 <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>
23547 <table>
23548 <tbody>
23549 <tr>
23550 <td>
23551 <div>
23552 <p>foo</p>
23553 </div>
23554 </td>
23555 </tr>
23556 </tbody>
23557 </table>
23558 <p>ok</p>
23559 !!end
23560
23561 !!test
23562 7. Encapsulate foster-parented transclusion content
23563 !!options
23564 parsoid=wt2wt,wt2html
23565 !! wikitext
23566 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23567 !! html/parsoid
23568 <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>
23569 <table>
23570 <tbody>
23571 <tr>
23572 <td>bar</td>
23573 </tr>
23574 </tbody>
23575 </table>
23576 !!end
23577
23578 # Note that the wt is broken on purpose: the = should be {{=}} if you
23579 # don't want it to be a template parameter key.
23580 !!test
23581 8. Encapsulate foster-parented transclusion content
23582 !!options
23583 parsoid=wt2wt,wt2html
23584 !! wikitext
23585 {{echo|a
23586 }}{|{{echo|style='color:red'}}
23587 |-
23588 |b
23589 |}
23590 !! html/parsoid
23591 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23592 <span> </span>
23593 <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>
23594 <table>
23595 <tbody>
23596 <tr>
23597 <td>b</td>
23598 </tr>
23599 </tbody>
23600 </table>
23601 !!end
23602
23603 !!test
23604 9. Encapsulate foster-parented transclusion content
23605 !!options
23606 parsoid=wt2wt,wt2html
23607 !! wikitext
23608 <table>{{echo|hi</table>hello}}
23609 !! html/parsoid
23610 <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>
23611 !!end
23612
23613 !!test
23614 Table in fosterable position
23615 !!options
23616 parsoid=wt2html,wt2wt
23617 !! wikitext
23618 {{OpenTable}}
23619 <div>
23620 {|
23621 |}
23622 </div>
23623 |}
23624 !! html/parsoid
23625 <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">
23626 </span>
23627 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23628
23629 <table>
23630 </table>
23631 !!end
23632
23633 # Parsoid only for bug 64747
23634 !! test
23635 Properly encapsulate empty-content transclusions in fosterable positions
23636 !! wikitext
23637 <table>
23638 {{#if:|
23639 <td>foo</td>
23640 }}
23641 </table>
23642 !! html/parsoid
23643 <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":["","","",""]}]]}'>
23644
23645 </table>
23646 !! end
23647
23648 !!test
23649 Support <object> element with .data attribute
23650 !!options
23651 parsoid=html2wt
23652 !! html/parsoid
23653 <object data="test.swf"></object>
23654 !! wikitext
23655 <object data="test.swf"></object>
23656 !!end
23657
23658 !! test
23659 Don't block XML namespace declaration
23660 !! wikitext
23661 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23662 !! html/php
23663 <p><span>MediaWiki</span>
23664 </p>
23665 !! html/parsoid
23666 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23667 !! end
23668
23669 # -----------------------------------------------------------------
23670 # The following section of tests are primarily to spec requirements
23671 # around serialization of new/edited content.
23672 #
23673 # All these tests are marked Parsoid html2wt and html2html only
23674 # ----------------------------------------------------------------
23675
23676 # 'mi' is a localinterwiki prefix as well as a language
23677 !! test
23678 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23679 !! options
23680 parsoid=html2wt
23681 !! html
23682 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23683 !! wikitext
23684 [[Foo]]
23685 !! end
23686
23687 # See T93839
23688 !! test
23689 New wikilinks should be serialized properly
23690 !! options
23691 parsoid=html2wt
23692 !! html
23693 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23694 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23695 !! wikitext
23696 [[Foo]]
23697 [[Foo]]
23698 !! end
23699
23700 !! test
23701 New wiki links (href variations)
23702 !! options
23703 parsoid=html2wt
23704 !! html
23705 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23706 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23707 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23708 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23709 !! wikitext
23710 [[Foo_bar]]
23711 [[Foo_bar]]
23712 [[Foo_bar]]
23713 [[Toxine bactérienne]]
23714 !! end
23715
23716 !! test
23717 New wiki links (content string variations)
23718 !! options
23719 parsoid=html2wt
23720 !! html
23721 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23722 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23723 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23724 !! wikitext
23725 [[Foo_bar]]
23726 [[Foo bar]]
23727 [[Foo_bar|./Foo_bar]]
23728 !! end
23729
23730 !! test
23731 New category links (href variations)
23732 !! options
23733 parsoid=html2wt
23734 !! html
23735 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23736 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23737 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23738 !! wikitext
23739 [[Category:Toxine bactérienne]]
23740 [[Category:Toxine bactérienne]]
23741 [[Category:Toxine bactérienne]]
23742 !! end
23743
23744 !! test
23745 New sol transparent links don't need indent-pre nowiki protection
23746 !! options
23747 parsoid=html2wt
23748 language=de
23749 !! html
23750 <link rel="mw:PageProp/redirect" href="./Main_Page">
23751 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23752 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23753 !! wikitext
23754 #WEITERLEITUNG [[Main Page]]
23755 <!-- this is good --> [[Category:Good]]
23756 <!-- this is great --> [[Kategorie:Great]]
23757 !! end
23758
23759 !! test
23760 New interlanguage links (href variations)
23761 !! options
23762 parsoid=html2wt
23763 !! html
23764 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23765 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23766 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23767 !! wikitext
23768 [[es:Toxine bactérienne]]
23769 [[es:Toxine_bactérienne]]
23770 [[es:Toxine_bactérienne]]
23771 !! end
23772
23773 !! test
23774 Image: Modifying size of an image (1)
23775 !! options
23776 parsoid={
23777 "modes": ["wt2wt"],
23778 "changes": [
23779 ["img[height]", "attr", "height", "22"],
23780 ["img[width]", "attr", "width", "200"]
23781 ]
23782 }
23783 !! wikitext
23784 [[Image:Foobar.jpg|230x230px]]
23785 !! wikitext/edited
23786 [[Image:Foobar.jpg|200x200px]]
23787 !!end
23788
23789 !! test
23790 Image: Modifying size of an image (2)
23791 !! options
23792 parsoid={
23793 "modes": ["wt2wt"],
23794 "changes": [
23795 ["img[height]", "attr", "height", "100"],
23796 ["img[width]", "attr", "width", "500"]
23797 ]
23798 }
23799 !! wikitext
23800 [[Image:Foobar.jpg|230x230px]]
23801 !! wikitext/edited
23802 [[Image:Foobar.jpg|500x500px]]
23803 !!end
23804
23805 # Change in size is ignored so long as class='mw-default-size'
23806 !! test
23807 Image: Modifying size of an image (3)
23808 !! options
23809 parsoid={
23810 "modes": ["wt2wt"],
23811 "changes": [
23812 ["figure[class]", "removeClass", "mw-default-size"],
23813 ["figure img", "attr", "height", "19"],
23814 ["figure img", "attr", "width", "170"]
23815 ]
23816 }
23817 !! wikitext
23818 [[Image:Foobar.jpg|thumb]]
23819 !! wikitext/edited
23820 [[Image:Foobar.jpg|thumb|170x170px]]
23821 !!end
23822
23823 !! test
23824 Image: Modifying alignment of an image (bug 48665)
23825 !! options
23826 parsoid={
23827 "modes": ["wt2wt"],
23828 "changes": [
23829 ["figure[class]", "removeClass", "mw-halign-right"],
23830 ["figure[class]", "addClass", "mw-halign-left"]
23831 ]
23832 }
23833 !! wikitext
23834 [[Image:Foobar.jpg|thumb|caption|right]]
23835 !! wikitext/edited
23836 [[Image:Foobar.jpg|thumb|caption|left]]
23837 !! end
23838
23839 !! test
23840 Image: Modifying mw-default-size of an frameless image (bug 62805)
23841 !! options
23842 parsoid={
23843 "modes": ["wt2wt"],
23844 "changes": [
23845 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23846 ]
23847 }
23848 !! wikitext
23849 [[Image:Foobar.jpg|frameless|right]]
23850 !! wikitext/edited
23851 [[Image:Foobar.jpg|frameless|right|220x220px]]
23852 !! end
23853
23854 !! test
23855 Image: Modifying valign of an image (bug 49221)
23856 !! options
23857 parsoid={
23858 "modes": ["wt2wt"],
23859 "changes": [
23860 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23861 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23862 ]
23863 }
23864 !! wikitext
23865 [[File:Foobar.jpg|20px|middle]]
23866 !! wikitext/edited
23867 [[File:Foobar.jpg|20px|text-top]]
23868 !! end
23869
23870 !! test
23871 Image: Modifying alt attribute of an image (bug 56400)
23872 !! options
23873 parsoid={
23874 "modes": ["wt2wt"],
23875 "changes": [
23876 ["img[alt]", "attr", "alt", "some alternate edited text"]
23877 ]
23878 }
23879 !! wikitext
23880 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23881 !! wikitext/edited
23882 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23883 !!end
23884
23885 !! test
23886 Image: Modifying caption of an image
23887 !! options
23888 parsoid={
23889 "modes": ["wt2wt"],
23890 "changes": [
23891 ["figcaption", "text", "new caption"]
23892 ]
23893 }
23894 !! wikitext
23895 [[Image:Foobar.jpg|thumb|original caption]]
23896 !! wikitext/edited
23897 [[Image:Foobar.jpg|thumb|new caption]]
23898 !!end
23899
23900 !! test
23901 Image: empty alt attribute (bug 48924)
23902 !! options
23903 parsoid
23904 !! wikitext
23905 [[File:Foobar.jpg|thumb|alt=|bar]]
23906 !! html
23907 <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>
23908 !! end
23909
23910 #!! test
23911 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23912 #!! options
23913 #parsoid=html2wt
23914 #language=ar
23915 #!! html
23916 #<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>
23917 #!! wikitext
23918 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23919 #!! end
23920
23921 !! test
23922 Image: Block level image should have \n before and after
23923 !! wikitext
23924 123
23925 [[File:Foobar.jpg|right|thumb|150x150px]]
23926 456
23927 !! html/parsoid
23928 <p>123</p>
23929 <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>
23930 <p>456</p>
23931 !!end
23932
23933 !! test
23934 Image: New block level image should have \n before and after (existing content)
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" 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>
23942 <p>456</p>
23943 !!end
23944
23945 !! test
23946 Image: upright option (parsoid)
23947 !! wikitext
23948 [[File:Foobar.jpg|thumb|upright|caption]]
23949 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23950 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23951 !! html/parsoid
23952 <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>
23953 <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>
23954 <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>
23955 !!end
23956
23957 !! test
23958 Image: upright option is ignored on inline and frame images (parsoid)
23959 !! wikitext
23960 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23961 !! html/parsoid
23962 <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>
23963 !!end
23964
23965 !! test
23966 Image: from basic HTML (1)
23967 !! options
23968 parsoid=html2wt
23969 !! html/parsoid
23970 <span typeof="mw:Image">
23971 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23972 </span>
23973 !! wikitext
23974 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23975 !! end
23976
23977 !! test
23978 Image: from basic HTML (2)
23979 !! options
23980 parsoid=html2wt
23981 !! html/parsoid
23982 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23983 !! wikitext
23984 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23985 !! end
23986
23987 !! test
23988 Image: from basic HTML (3)
23989 !! options
23990 parsoid=html2wt
23991 !! html/parsoid
23992 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
23993 !! wikitext
23994 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
23995 !! end
23996
23997 !! test
23998 Image: from basic HTML (4)
23999 !! options
24000 parsoid=html2wt
24001 !! html/parsoid
24002 <img src="./File:Foobar.jpg">
24003 !! wikitext
24004 [[File:Foobar.jpg|link=]]
24005 !! end
24006
24007 !! test
24008 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24009 !! options
24010 parsoid=html2wt
24011 !! html
24012 <ul>
24013 <li><p>foo</p></li>
24014 </ul>
24015 !! wikitext
24016 * foo
24017 !! end
24018
24019 !! test
24020 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24021 !! options
24022 parsoid=html2wt
24023 !! html
24024 <ul> <li>foo</li></ul>
24025 !! wikitext
24026 * foo
24027 !! end
24028
24029 !! test
24030 Don't strip leading whitespace when handling indent-pre suppressing tags
24031 !! options
24032 parsoid=html2wt
24033 !! html
24034 <table>
24035 <tr><td> indented row</td></tr>
24036 </table>
24037 <blockquote><p>
24038 <b>This is very bold of you!</b>
24039 </p>
24040 <table><tr><td>
24041 indented cell (no pre-wrapping!)
24042 </td></tr></table>
24043 </blockquote>
24044 <p>foo</p>
24045 <div>bar</div>
24046 !! wikitext
24047 {|
24048 | indented row
24049 |}
24050 <blockquote>
24051 '''This is very bold of you!'''
24052
24053 {|
24054 |
24055 indented cell (no pre-wrapping!)
24056 |}
24057 </blockquote>
24058 foo
24059 <div>bar</div>
24060 !! end
24061
24062 !! test
24063 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24064 !! options
24065 parsoid=html2wt
24066 !! wikitext
24067 foo
24068 <nowiki> </nowiki><span>bar</span>
24069
24070 <span>foo2
24071 <nowiki> </nowiki></span>bar2
24072
24073 <div>foo</div>
24074 <nowiki> </nowiki><span>bar</span>
24075
24076 <div>
24077 <nowiki> </nowiki><span>foo</span>
24078 </div>
24079 !! html
24080 <p>foo</p>
24081 <span>bar</span>
24082
24083 <span>foo2
24084 </span>bar2
24085
24086 <div>foo</div>
24087 <span>bar</span>
24088
24089 <div>
24090 <span>foo</span>
24091 </div>
24092 !! end
24093
24094 !! test
24095 Lists: Dont insert newlines in a serialized list item.
24096 !! options
24097 parsoid=html2wt
24098 !! html
24099 <ul><li>a<br>b</li><li>c</li></ul>
24100 !! wikitext
24101 * a<br>b
24102 * c
24103 !! end
24104
24105 !! test
24106 Headings: Force sol-transparent links and behavior switches to serialize before/after
24107 !! options
24108 parsoid=html2wt
24109 !! html
24110 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24111 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24112
24113 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24114 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24115
24116 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24117
24118 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24119 !! wikitext
24120 == hello there ==
24121 [[Category:A1]]
24122 [[Category:A2]]
24123
24124 == hi pal ==
24125
24126 <!--foo--> [[Category:A3]]
24127
24128 == how goes it ==
24129
24130 == it goes well ==
24131 [[Category:A4]] <!--bar-->
24132
24133 ==howdy [[Category:A5]] ==
24134
24135 __TOC__
24136
24137 == ok ==
24138 !! end
24139
24140 !! test
24141 Headings: Don't hoist metas that come from templates
24142 !! options
24143 parsoid=html2wt
24144 !! html
24145 <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>
24146 !! wikitext
24147 == {{echo|foo [[Category:Foo]]}} ==
24148 !! end
24149
24150 !! test
24151 Headings: Category in ref isn't hoisted
24152 !! options
24153 parsoid=html2wt
24154 !! html
24155 <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>
24156
24157 <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>
24158 !! wikitext
24159 == foo <ref>bar
24160 [[Category:Baz]] </ref> ==
24161
24162 <references />
24163 !! end
24164
24165 !! test
24166 Parsoid: Serialize positional parameters with = in them as named parameter
24167 !! options
24168 parsoid=html2wt
24169 !! html
24170 <p about="#mwt1" typeof="mw:Transclusion"
24171 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24172
24173 <p about="#mwt1" typeof="mw:Transclusion"
24174 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24175
24176 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24177 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24178 <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>
24179 !! wikitext
24180 {{echo|1 = f=oo}}
24181
24182 {{echo|1 = f=oo|2 = bar}}
24183
24184 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24185 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24186 {{echo|<nowiki>f=oo</nowiki>|bar}}
24187 !! end
24188
24189 !! test
24190 Parsoid: Serialize positional parameters with = in extlink as named parameter
24191 !! options
24192 parsoid=html2wt
24193 !! html
24194 <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>
24195 !! wikitext
24196 {{echo|1 = http://stuff?is=ok}}
24197 !! end
24198
24199 !! test
24200 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24201 !! options
24202 parsoid=html2wt
24203 !! html
24204 <div>a<p>b</p></div>
24205 <div>a
24206 <p>b</p></div>
24207 <div>
24208 a
24209 <p>b</p></div>
24210 !! wikitext
24211 <div>a
24212 b
24213 </div>
24214 <div>a
24215 b
24216 </div>
24217 <div>
24218 a
24219
24220 b
24221 </div>
24222 !! end
24223
24224 !! test
24225 Substrings resembling wikitext in hrefs should not get nowiki escapes
24226 !! options
24227 parsoid=html2wt
24228 !! html
24229 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24230 !! wikitext
24231 [[Foo''bar''baz]]
24232 !! end
24233
24234 !! test
24235 Enforce single-line context in the serializer
24236 !! options
24237 parsoid=html2wt
24238 !! html
24239 <h2>testing
24240 123</h2>
24241
24242 <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">
24243 </span><span about="#mwt1">you</span> </h2>
24244
24245 <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>
24246
24247 <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
24248 there</span></li></ol>
24249
24250 <ul><li>asd
24251 sdf</li></ul>
24252
24253 <ul><li>foo
24254 bar
24255 baz</li>
24256 <li>foo <b>bar</b>
24257 baz</li></ul>
24258 !! wikitext
24259 == testing 123 ==
24260
24261 == hi {{bogus|there
24262 you}} ==
24263
24264 == foo <ref>hello
24265 there</ref> ==
24266
24267 <references />
24268
24269 * asd sdf
24270
24271 * foo bar baz
24272 * foo '''bar''' baz
24273 !! end
24274
24275 !! test
24276 Serialize new placeholder space without spans
24277 !! options
24278 parsoid=html2wt
24279 !! html
24280 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24281
24282 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24283
24284 <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>
24285 !! wikitext
24286 foo : bar
24287
24288 foo : bar
24289
24290 <ref>foo : bar</ref>ok
24291 !! end
24292
24293
24294 #-----------------------
24295 # Tag minimization tests
24296 #-----------------------
24297
24298 !! test
24299 1. I/B quote minimization: wikitext-only tags should be combined
24300 !! options
24301 parsoid=html2wt
24302 !! html
24303 <p><i>A</i><i>B</i></p>
24304 <p><b>A</b><b>B</b></p>
24305 <p><i>A</i><b><i>B</i></b></p>
24306 <p><b>A</b><i><b>B</b></i></p>
24307 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24308 <p><i><b>A</b></i><i><b>B</b></i></p>
24309 <p><i><b>A</b></i><b><i>B</i></b></p>
24310 <p><b><i>A</i></b><i><b>B</b></i></p>
24311 !! wikitext
24312 ''AB''
24313
24314 '''AB'''
24315
24316 ''A'''B'''''
24317
24318 '''A''B'''''
24319
24320 '''A''BC''D'''
24321
24322 '''''AB'''''
24323
24324 '''''AB'''''
24325
24326 '''''AB'''''
24327 !! end
24328
24329 !! test
24330 2. I/B quote minimization: wikitext and html tags should not be combined
24331 !! options
24332 parsoid=html2wt
24333 !! html
24334 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24335 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24336 !! wikitext
24337 ''A''<i>B</i>
24338
24339 ''A''<nowiki/>'''<i>B</i>'''
24340 !! end
24341
24342 !! test
24343 3. I/B quote minimization: templated content stops minimization
24344 !! options
24345 parsoid=html2wt
24346 !! html
24347 <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>
24348 <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>
24349 !! wikitext
24350 ''A''{{echo|''B''}}
24351
24352 ''A''{{echo|'''''B'''''}}
24353 !! end
24354
24355 !! test
24356 4. I/B quote minimization: new content should be mimimized with adjacent old content
24357 !! options
24358 parsoid=html2wt
24359 !! html
24360 <p><i>A</i><i>B</i></p>
24361 <p><b>A</b><b>B</b></p>
24362 <p><i>A</i><b><i>B</i></b></p>
24363 !! wikitext
24364 ''AB''
24365
24366 '''AB'''
24367
24368 ''A'''B'''''
24369 !! end
24370
24371 !! test
24372 5a. Merge adjacent quote nodes if they've been edited
24373 !! options
24374 parsoid={
24375 "modes": ["wt2wt", "selser"],
24376 "changes": [
24377 ["p", "contents", "remove", ":contains('b')"]
24378 ]
24379 }
24380 !! wikitext
24381 ''a''b''c''
24382 !! wikitext/edited
24383 ''ac''
24384 !! end
24385
24386 !! test
24387 5b. Merge adjacent quote nodes if they've been edited
24388 !! options
24389 parsoid={
24390 "modes": ["wt2wt", "selser"],
24391 "changes": [
24392 ["#x", "remove"]
24393 ]
24394 }
24395 !! wikitext
24396 ''a''<span id="x">b</span>''c''
24397 !! wikitext/edited
24398 ''ac''
24399 !! end
24400
24401 !! test
24402 1. Merge adjacent link nodes as long as at least one element is new
24403 !! options
24404 parsoid={
24405 "modes": ["html2wt"],
24406 "scrubWikitext": true
24407 }
24408 !! html
24409 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24410 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24411 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24412 !! wikitext
24413 [[Football]]
24414 [[Football]]
24415 [[Football|Foot]][[Football|ball]]
24416 !! end
24417
24418 !! test
24419 2. Merge adjacent link nodes and enable additional normalizations
24420 !! options
24421 parsoid={
24422 "modes": ["html2wt"],
24423 "scrubWikitext": true
24424 }
24425 !! html
24426 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24427 !! wikitext
24428 [[Football|''Football'']]
24429 !! end
24430
24431 !! test
24432 3. Don't merge adjacent link nodes if scrubWikitext is false
24433 !! options
24434 parsoid={
24435 "modes": ["html2wt"],
24436 "scrubWikitext": false
24437 }
24438 !! html
24439 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24440 !! wikitext
24441 [[Football|Foot]][[Football|ball]]
24442 !! end
24443
24444 #------------------------------
24445 # End of tag minimization tests
24446 #------------------------------
24447
24448 !!test
24449 Bug 54262: New entities
24450 !! options
24451 parsoid=html2wt
24452 !! wikitext
24453 &nbsp;
24454 !! html
24455 <span typeof="mw:Entity">&nbsp;</span>
24456 !! end
24457
24458 ## Note that there is no wikitext output for 'unknownproperty' ##
24459 ## Unknown magic words are silently dropped ##
24460
24461 !! test
24462 Magic words
24463 !! options
24464 parsoid=html2wt
24465 !! html/parsoid
24466 <meta property='mw:PageProp/toc' />
24467 <meta property='mw:PageProp/notoc' />
24468 <meta property='mw:PageProp/forcetoc' />
24469 <meta property='mw:PageProp/index' />
24470 <meta property='mw:PageProp/noindex' />
24471 <meta property='mw:PageProp/nogallery' />
24472 <meta property='mw:PageProp/noeditsection' />
24473 <meta property='mw:PageProp/notitleconvert' />
24474 <meta property='mw:PageProp/nocontentconvert' />
24475 <meta property='mw:PageProp/unknownproperty' />
24476 !! wikitext
24477 __TOC__
24478 __NOTOC__
24479 __FORCETOC__
24480 __INDEX__
24481 __NOINDEX__
24482 __NOGALLERY__
24483 __NOEDITSECTION__
24484 __NOTITLECONVERT__
24485 __NOCONTENTCONVERT__
24486 !! end
24487
24488 !! test
24489 Consecutive <pre>s should not get merged
24490 !! options
24491 parsoid=html2wt,html2html
24492 !! html
24493 <pre>a</pre><pre>b</pre>
24494
24495 <pre>c
24496 </pre><pre>
24497 d</pre>
24498
24499 <pre>e
24500
24501 </pre><pre>
24502
24503 f</pre>
24504 !! wikitext
24505 a
24506
24507 b
24508
24509 c
24510
24511 d
24512
24513 e
24514
24515
24516
24517 f
24518 !! end
24519
24520 !! test
24521 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24522 !! options
24523 parsoid=html2wt
24524 !! html
24525 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24526 !! wikitext
24527 [[Special:BookSources/1234567890|ISBN 1234567895]]
24528 !! end
24529
24530 !! test
24531 Edited RFC links not serializable as RFC links should serialize as extlinks
24532 !! options
24533 parsoid=html2wt
24534 !! html
24535 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24536 !! wikitext
24537 [//tools.ietf.org/html/rfc123 New RFC]
24538 !! end
24539
24540 !! test
24541 Edited PMID links not serializable as PMID links should serialize as extlinks
24542 !! options
24543 parsoid=html2wt
24544 !! html
24545 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24546 !! wikitext
24547 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24548 !! end
24549
24550 !! test
24551 WTS of autolinks with trailing/surrounding context
24552 !! options
24553 parsoid=html2wt
24554 !! html/parsoid
24555 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24556 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24557 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24558 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24559 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24560 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24561 !! wikitext
24562 http://cscott.net<nowiki/>'''foo'''
24563
24564 http://cscott.net<b>foo</b>
24565
24566 '''http://cscott.net<nowiki/>'''
24567
24568 '''http://cscott.net '''
24569
24570 '''http://cscott.net<nowiki/>x'''
24571
24572 http://cscott.net<nowiki/>x
24573 !! end
24574
24575 !! test
24576 WTS of autolinks with nowikis (round-trip)
24577 !! wikitext
24578 x<nowiki/>http://cscott.net<nowiki/>x
24579 !! html/parsoid
24580 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24581 !! end
24582
24583 # this is the "easy" test because it leaves in place all the
24584 # data-parsoid information indicating this is an autolink
24585 !! test
24586 WTS of autolinks with escapes (editing)
24587 !! options
24588 parsoid={
24589 "modes": ["wt2wt"],
24590 "changes": [
24591 [ "meta", "remove" ]
24592 ]
24593 }
24594 !! wikitext
24595 x<nowiki/>http://cscott.net<nowiki/>x
24596 !! wikitext/edited
24597 x<nowiki/>http://cscott.net<nowiki/>x
24598 !! end
24599
24600 !! test
24601 Edited Redirect link should emit a non-piped wikitext link
24602 !! options
24603 parsoid=html2wt
24604 !! html
24605 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
24606 !! wikitext
24607 #REDIRECT [[Bar]]
24608 !! end
24609
24610 !! test
24611 T75121: Infer extension name from typeOf if data-mw is not present
24612 !! options
24613 parsoid=html2wt
24614 !! html
24615 <div typeOf="mw:Extension/foo"></div>
24616 !! wikitext
24617 <foo />
24618 !! end
24619
24620 # Note that the <p> wrapping isn't present in PHP parser output
24621 # The important thing for this test is that P-wrapping doesn't
24622 # interfere with the <nowiki> protection for leading - in <td>
24623 # (which isn't necessary for <th>).
24624 !! test
24625 T88318: p-wrapped dash in table.
24626 !! options
24627 parsoid=html2wt,wt2wt
24628 !! html/parsoid
24629 <table><tbody>
24630 <tr><th><p>-</p></th><th><p>- </p></th></tr>
24631 <tr><td><p>-</p></td><td><p>- </p></td></tr>
24632 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
24633 </tbody></table>
24634 !! wikitext
24635 {|
24636 !-
24637 !-
24638 |-
24639 |<nowiki>-</nowiki>
24640 |<nowiki>- </nowiki>
24641 |-
24642 |<small>-</small>
24643 |<br>
24644 -
24645 |<br>
24646 -
24647 |}
24648 !! html/php+tidy
24649 <table>
24650 <tr>
24651 <th>-</th>
24652 <th>-</th>
24653 </tr>
24654 <tr>
24655 <td>-</td>
24656 <td>-</td>
24657 </tr>
24658 <tr>
24659 <td><small>-</small></td>
24660 <td><br />
24661 <p>-</p>
24662 </td>
24663 <td><br />
24664 <p>-</p>
24665 </td>
24666 </tr>
24667 </table>
24668 !! end
24669
24670 !! test
24671 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
24672 !! options
24673 parsoid=html2wt
24674 !! html
24675 <table id='mwAb'>
24676 <td id='mwAc'>foo</td>
24677 <td id='serialize-this'>bar</td>
24678 </table>
24679 !! wikitext
24680 {|
24681 |foo
24682 | id="serialize-this" |bar
24683 |}
24684 !! end
24685
24686 !! test
24687 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24688 !! options
24689 parsoid=html2wt
24690 !! html
24691 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24692 !! wikitext
24693 <div id="hello">ok</div>
24694 !! end
24695
24696 !! test
24697 WTS change modes
24698 !! options
24699 parsoid={
24700 "modes": ["wt2wt"],
24701 "changes": [
24702 [ "#xyz", "before", "<b>before</b> stuff " ],
24703 [ "#xyz", "after", " stuff <i>after</i>" ],
24704 [ "#xyz", "html", "x <b>y</b> z" ]
24705 ]
24706 }
24707 !! wikitext
24708 <span id="xyz">hello</span>
24709 !! wikitext/edited
24710 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24711 !! end
24712
24713 !! test
24714 Never serialize a-tag as html, regardless of what data-parsoid has to say
24715 !! options
24716 parsoid=html2wt
24717 !! html
24718 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24719 !! wikitext
24720 [[Foo]]
24721 !! end
24722
24723 ## SSS FIXME: This is broken output nevertheless.
24724 ## What might be a reasonable non-broken output for this?
24725 ## This is an edge case unlikely to be seen in production
24726 ## that I am not wasting more time on this right now.
24727 !! test
24728 Never serialize a-tag as html, no matter what attributes it has
24729 !! options
24730 parsoid=html2wt
24731 !! html
24732 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
24733 !! wikitext
24734 [http://boo.org http://boohoo.org]
24735 !! end
24736
24737 # --------------------------------------------
24738 # Tests spec'ing wikitext serialization norms |
24739 # --------------------------------------------
24740
24741 !! test
24742 Lists: Add space after bullets
24743 !! options
24744 parsoid=html2wt
24745 !! html
24746 <ul>
24747 <li>foo</li>
24748 <li> bar</li>
24749 <li><span> baz</span></li>
24750 </ul>
24751 !! wikitext
24752 * foo
24753 * bar
24754 * <span> baz</span>
24755 !! end
24756
24757 !! test
24758 Headings: Add space before/after == (T53744)
24759 !! options
24760 parsoid=html2wt
24761 !! html
24762 <h2>foo</h2>
24763 <h2> bar</h2>
24764 <h2>baz </h2>
24765 <h2><span> baz</span></h2>
24766
24767 <!-- Even after hoisted content -->
24768 <h2> <link href="Category:A2" rel="mw:PageProp/Category" />ok</h2>
24769 !! wikitext
24770 == foo ==
24771
24772 == bar ==
24773
24774 == baz ==
24775
24776 == <span> baz</span> ==
24777
24778 <!-- Even after hoisted content -->
24779 [[Category:A2]]
24780
24781 == ok ==
24782 !! end
24783
24784 !! test
24785 1. Headings: suppress newly created empty headings
24786 !! options
24787 parsoid={
24788 "modes": ["html2wt"],
24789 "scrubWikitext": true
24790 }
24791 !! html
24792 <h2></h2>
24793 !! wikitext
24794 !! end
24795
24796 !! test
24797 2. Headings: don't suppress empty headings if scrubWikitext is false
24798 !! options
24799 parsoid=html2wt
24800 !! html
24801 <h2></h2>
24802 !! wikitext
24803 ==<nowiki/>==
24804 !! end
24805
24806 !! test
24807 3. Headings: don't suppress empty headings for existing headings even if scrubWikitext is true
24808 !! options
24809 parsoid={
24810 "modes": ["html2wt"],
24811 "scrubWikitext": true
24812 }
24813 !! html
24814 <h2 data-parsoid='{}'></h2>
24815 !! wikitext
24816 ==<nowiki/>==
24817 !! end
24818
24819 !! test
24820 1. WT Quote Tags: suppress newly created empty style tags
24821 !! options
24822 parsoid={
24823 "modes": ["html2wt"],
24824 "scrubWikitext": true
24825 }
24826 !! html
24827 <i></i><b></b>
24828 !! wikitext
24829 !! end
24830
24831 !! test
24832 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
24833 !! options
24834 parsoid=html2wt
24835 !! html
24836 <i></i><b></b>
24837 !! wikitext
24838 ''<nowiki/>'''''<nowiki/>'''
24839 !! end
24840
24841 !! test
24842 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
24843 !! options
24844 parsoid={
24845 "modes": ["html2wt"],
24846 "scrubWikitext": true
24847 }
24848 !! html
24849 <p> hi</p>
24850 !! wikitext
24851 hi
24852 !! end
24853
24854 !! test
24855 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
24856 !! options
24857 parsoid=html2wt
24858 !! html
24859 <p> hi</p>
24860 !! wikitext
24861 <nowiki> </nowiki>hi
24862 !! end
24863
24864 # ---------------------------------------------------
24865 # End of tests spec'ing wikitext serialization norms |
24866 # ---------------------------------------------------
24867
24868 # -----------------------------------------------------------------
24869 # End of section for Parsoid-only html2wt tests for serialization
24870 # of new content
24871 # -----------------------------------------------------------------
24872
24873 # -----------------------------------------------------------------
24874 # The following section of tests are primarily to spec behavior of
24875 # the selective serializer. All these tests have manual selser
24876 # changes. The automated selser changes for all tests handle the
24877 # wide variation of changes, but these tests here capture specs
24878 # deterministically.
24879 # ----------------------------------------------------------------
24880
24881 ## T90517
24882 !! test
24883 Selser: New comments should not be lost
24884 !! options
24885 parsoid={
24886 "modes": ["selser"],
24887 "changes": [
24888 [ "#a", "after", "<!--c1-->" ],
24889 [ "#b", "before", "<!--c2-->" ]
24890 ]
24891 }
24892 !! wikitext
24893 <span id="a">a</span>
24894
24895 <span id="b">b</span>
24896 !! wikitext/edited
24897 <span id="a">a</span><!--c1-->
24898
24899 <!--c2--><span id="b">b</span>
24900 !! end
24901
24902 ## T89383
24903 !! test
24904 Selser: Check for validity of DSR before using it
24905 !! options
24906 parsoid={
24907 "modes": ["selser"],
24908 "changes": [
24909 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
24910 ]
24911 }
24912 !! wikitext
24913 <span id="a">a</span>
24914 !! wikitext/edited
24915 {{DISPLAYTITLE:foo}}
24916 <span id="a">a</span>
24917 !! end
24918
24919 !! test
24920 1. DOMDiff: Changes to <ref> content should be looked up using id
24921 !! options
24922 parsoid={
24923 "modes": ["selser"],
24924 "changes": [
24925 ["#X", "after", "bar"],
24926 ["#Y", "after", "baz"]
24927 ]
24928 }
24929 !! wikitext
24930 X <ref><span id="X">foo</span></ref>
24931 Y <ref name="a" />
24932 <references>
24933 <ref name="a"><span id="Y">foo</span></ref>
24934 </references>
24935 !! wikitext/edited
24936 X <ref><span id="X">foo</span>bar</ref>
24937 Y <ref name="a" />
24938 <references>
24939 <ref name="a"><span id="Y">foo</span>baz</ref>
24940 </references>
24941 !! end
24942
24943 !! test
24944 2. DOMDiff: Changes to <ref> content should be looked up using id
24945 !! options
24946 parsoid={
24947 "modes": ["selser"],
24948 "changes": [
24949 ["#Z", "after", "bar"]
24950 ]
24951 }
24952 !! wikitext
24953 A <ref>foo bar for a</ref>
24954 B <ref group="X" name="b" />
24955
24956 <references />
24957
24958 <references group="X">
24959 <ref name="b"><span id="Z">foo</span></ref>
24960 </references>
24961 !! wikitext/edited
24962 A <ref>foo bar for a</ref>
24963 B <ref group="X" name="b" />
24964
24965 <references />
24966
24967 <references group="X">
24968 <ref name="b"><span id="Z">foo</span>bar</ref>
24969 </references>
24970 !! end