Merge "Document OutputPage::addVaryHeader()"
[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_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <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>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <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>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <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
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 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''.
604 !! html
605 <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>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !! end
679
680
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !! end
739
740
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !! end
823
824
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,2+3)
843 !! wikitext
844 '''''foo'''''
845 !! html/*
846 <p><i><b>foo</b></i>
847 </p>
848 !! end
849
850 !! test
851 Italics and bold: 5-quote opening sequence: (5,3)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 '''''foo'''
856 !! html/*
857 <p><i><b>foo</b></i>
858 </p>
859 !!end
860
861 # same html as previous, but wikitext adjusted to match parsoid html2wt
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,3+2)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !! end
870
871 !! test
872 Italics and bold: 5-quote opening sequence: (5,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 '''''foo''''
877 !! html/*
878 <p><i><b>foo'</b></i>
879 </p>
880 !!end
881
882 !! test
883 Italics and bold: 5-quote opening sequence: (5,5)
884 !! wikitext
885 '''''foo'''''
886 !! html
887 <p><i><b>foo</b></i>
888 </p>
889 !!end
890
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,6)
893 !! wikitext
894 '''''foo''''''
895 !! html/*
896 <p><i><b>foo'</b></i>
897 </p>
898 !! end
899
900 ###
901 ### multiple quote sequences in a line
902 ###
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2)
905 !! options
906 parsoid=wt2html
907 !! wikitext
908 ''foo''''bar''
909 !! html/*
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !!end
913
914
915 # same html as previous, but wikitext adjusted to match parsoid html2wt
916 !! test
917 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
918 !! wikitext
919 ''foo'<nowiki/>'''bar'''''
920 !! html
921 <p><i>foo'<b>bar</b></i>
922 </p>
923 !! end
924
925
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 ''foo''''bar'''
932 !! html/*
933 <p><i>foo'<b>bar</b></i>
934 </p>
935 !!end
936
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
941 !! wikitext
942 ''foo'<nowiki/>'''bar'''''
943 !! html
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,4)
951 !! options
952 parsoid=wt2html
953 !! wikitext
954 ''foo''''bar''''
955 !! html/*
956 <p><i>foo'<b>bar'</b></i>
957 </p>
958 !!end
959
960
961 # same html as previous, but wikitext adjusted to match parsoid html2wt
962 !! test
963 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
964 !! wikitext
965 ''foo'<nowiki/>'''bar'<nowiki/>'''''
966 !! html
967 <p><i>foo'<b>bar'</b></i>
968 </p>
969 !! end
970
971
972 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
973 !! test
974 Italics and bold: multiple quote sequences: (3,4,2)
975 !! options
976 parsoid=wt2html
977 !! wikitext
978 '''foo''''bar''
979 !! html/php
980 <p><b>foo'</b>bar
981 </p>
982 !! html/parsoid
983 <p><b>foo'</b>bar<i></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
990 !! options
991 parsoid
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
999 </p>
1000 !! end
1001
1002
1003 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1004 !! test
1005 Italics and bold: multiple quote sequences: (3,4,3)
1006 !! options
1007 parsoid=wt2html
1008 !! wikitext
1009 '''foo''''bar'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b>foo'</b>bar<b></b>
1015 </p>
1016 !!end
1017
1018 # same html as previous, but wikitext adjusted to match parsoid html2wt
1019 !! test
1020 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1021 !! wikitext
1022 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1028 </p>
1029 !! end
1030
1031 ###
1032 ### other quote tests
1033 ###
1034 !! test
1035 Italics and bold: other quote tests: (2,3,5)
1036 !! wikitext
1037 ''this is about '''foo's family'''''
1038 !! html
1039 <p><i>this is about <b>foo's family</b></i>
1040 </p>
1041 !!end
1042
1043
1044 !! test
1045 Italics and bold: other quote tests: (2,(3,3),2)
1046 !! wikitext
1047 ''this is about '''foo's''' family''
1048 !! html
1049 <p><i>this is about <b>foo's</b> family</i>
1050 </p>
1051 !!end
1052
1053
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3,2)
1056 !! options
1057 parsoid=wt2html
1058 !! wikitext
1059 '''this is about ''foo'''s family''
1060 !! html/*
1061 <p><b>this is about <i>foo</i></b><i>s family</i>
1062 </p>
1063 !!end
1064
1065
1066 # same html as previous, but wikitext adjusted to match parsoid html2wt
1067 !! test
1068 Italics and bold: other quote tests: (3,2,3+2+2,2)
1069 !! wikitext
1070 '''this is about ''foo'''''<nowiki/>''s family''
1071 !! html
1072 <p><b>this is about <i>foo</i></b><i>s family</i>
1073 </p>
1074 !! end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (3,2,3,3)
1079 !! wikitext
1080 '''this is about ''foo'''s family'''
1081 !! html/*
1082 <p>'<i>this is about </i>foo<b>s family</b>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,(2,2),3)
1089 !! wikitext
1090 '''this is about ''foo's'' family'''
1091 !! html
1092 <p><b>this is about <i>foo's</i> family</b>
1093 </p>
1094 !!end
1095
1096
1097 !! test
1098 Italicized possessive
1099 !! wikitext
1100 The ''[[Main Page]]'''s talk page.
1101 !! html/php
1102 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1103 </p>
1104 !! html/parsoid
1105 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1106 !! end
1107
1108 !! test
1109 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1110 (Requires tidy for PHP parser output to be fixed up)
1111 !! options
1112 parsoid=wt2html,wt2wt
1113 !! wikitext
1114 {|
1115 !''a!!''b
1116 |''a||''b
1117 |}
1118 !! html/php+tidy
1119 <table>
1120 <tr>
1121 <th><i>a</i></th>
1122 <th><i>b</i></th>
1123 <td><i>a</i></td>
1124 <td><i>b</i></td>
1125 </tr>
1126 </table>
1127 !! html/parsoid
1128 <table>
1129 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1130 <td><i>a</i></td><td><i>b</i></td></tr>
1131 </tbody></table>
1132 !! end
1133
1134 ###
1135 ### Non-html5 tags
1136 ###
1137
1138 !! test
1139 Non-html5 tags should be accepted
1140 !! wikitext
1141 <center>''foo''</center>
1142 <big>''foo''</big>
1143 <font>''foo''</font>
1144 <strike>''foo''</strike>
1145 <tt>''foo''</tt>
1146 !! html
1147 <center><i>foo</i></center>
1148 <p><big><i>foo</i></big>
1149 <font><i>foo</i></font>
1150 <strike><i>foo</i></strike>
1151 <tt><i>foo</i></tt>
1152 </p>
1153 !! end
1154
1155 !! test
1156 <wbr> is valid wikitext (bug 52468)
1157 !! wikitext
1158 <wbr>
1159 !! html
1160 <p><wbr />
1161 </p>
1162 !! end
1163
1164 # <strike> is HTML4, <s> is HTML4/5.
1165 !! test
1166 <s> or <strike> for strikethrough
1167 !! wikitext
1168 <strike>strike</strike>
1169
1170 <s>s</s>
1171 !! html
1172 <p><strike>strike</strike>
1173 </p><p><s>s</s>
1174 </p>
1175 !! end
1176
1177 ## a not permitted
1178 ## i,b,br omitted
1179 !! test
1180 Text-level semantic html elements in wikitext
1181 !! wikitext
1182 <em>text</em>
1183 <strong>text</strong>
1184 <small>text</small>
1185 <s>text</s>
1186 <cite>text</cite>
1187 <q>text</q>
1188 <dfn>text</dfn>
1189 <abbr>text</abbr>
1190 <data>text</data>
1191 <time>text</time>
1192 <code>text</code>
1193 <var>text</var>
1194 <samp>text</samp>
1195 <kbd>text</kbd>
1196 <sub>text</sub>
1197 <u>text</u>
1198 <mark>text</mark>
1199 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1200 <bdi>text</bdi>
1201 <bdo>text</bdo>
1202 <span>text</span>
1203 <wbr />
1204 !! html
1205 <p><em>text</em>
1206 <strong>text</strong>
1207 <small>text</small>
1208 <s>text</s>
1209 <cite>text</cite>
1210 <q>text</q>
1211 <dfn>text</dfn>
1212 <abbr>text</abbr>
1213 <data>text</data>
1214 <time>text</time>
1215 <code>text</code>
1216 <var>text</var>
1217 <samp>text</samp>
1218 <kbd>text</kbd>
1219 <sub>text</sub>
1220 <u>text</u>
1221 <mark>text</mark>
1222 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1223 <bdi>text</bdi>
1224 <bdo>text</bdo>
1225 <span>text</span>
1226 <wbr />
1227 </p>
1228 !! end
1229
1230 # test cases taken from
1231 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1232 !! test
1233 Ruby markup (W3C-style)
1234 !! wikitext
1235 ; Mono-ruby for individual base characters
1236 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1237 ; Group ruby
1238 : <ruby>今日<rt>きょう</rt></ruby>
1239 ; Jukugo ruby
1240 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1241 ; Inline ruby
1242 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1243 ; Double-sided ruby
1244 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1245 <ruby>
1246 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1247 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1248 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1249 </ruby>
1250 !! html
1251 <dl><dt> Mono-ruby for individual base characters</dt>
1252 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1253 <dt> Group ruby</dt>
1254 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1255 <dt> Jukugo ruby</dt>
1256 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1257 <dt> Inline ruby</dt>
1258 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1259 <dt> Double-sided ruby</dt>
1260 <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>
1261 <p><ruby>
1262 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1263 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1264 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1265 </ruby>
1266 </p>
1267 !! end
1268
1269 # The next two test different paths in the sanitizer.
1270 !! test
1271 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1272 !! wikitext
1273 <blockquote|>a</blockquote>
1274
1275 <b→> doesn't terminate </b→>
1276
1277 <bä> doesn't terminate </bä>
1278
1279 <boo> doesn't terminate </boo>
1280
1281 <s.foo> doesn't terminate </s.foo>
1282
1283 <sub-ID#1>
1284 !! html
1285 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1286 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1287 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1288 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1289 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1290 </p><p>&lt;sub-ID#1&gt;
1291 </p>
1292 !! end
1293
1294 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1295 # If the non-word-character tag made it through the sanitizer, tidy
1296 # would munge it up.
1297 !! test
1298 Non-word characters don't terminate tag names + tidy
1299 !! wikitext
1300 <blockquote|>a</blockquote>
1301
1302 <b→> doesn't terminate </b→>
1303
1304 <bä> doesn't terminate </bä>
1305
1306 <boo> doesn't terminate </boo>
1307
1308 <s.foo> doesn't terminate </s.foo>
1309
1310 <sub-ID#1>
1311 !! html+tidy
1312 <p>&lt;blockquote|&gt;a</p>
1313 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1314 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1315 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1316 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1317 <p>&lt;sub-ID#1&gt;</p>
1318 !! end
1319
1320 ###
1321 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1322 ### This checks that HTML5 tags (with non-word characters in the tag
1323 ### name) make it safely through the parser -- the Sanitizer will
1324 ### munge them later, as it should.
1325 ###
1326 !! test
1327 Non-word characters are valid in extension tags (T19663)
1328 !! wikitext
1329 <tåg>tåg</tåg>
1330 !! html/php
1331 <pre>
1332 'tåg'
1333 array (
1334 )
1335 </pre>
1336
1337 !! end
1338
1339 !! test
1340 Isolated close tags should be treated as literal text (bug 52760)
1341 !! options
1342 parsoid=wt2html
1343 !! wikitext
1344 </b>
1345
1346 <s.foo>s</s>
1347 !! html/php+tidy
1348 <p>&lt;s.foo&gt;s</p>
1349 !! html/parsoid
1350 <p>&lt;s.foo&gt;s</p>
1351 !! end
1352
1353 ###
1354 ### Special characters
1355 ###
1356
1357 !! test
1358 Bare pipe character (bug 52363)
1359 !! wikitext
1360 |
1361 !! html
1362 <p>|
1363 </p>
1364 !! end
1365
1366 !! test
1367 Bare pipe character from a template (bug 52363)
1368 !! wikitext
1369 {{pipe}}
1370 !! html
1371 <p>|
1372 </p>
1373 !! end
1374
1375 ###
1376 ### <nowiki> test cases
1377 ###
1378
1379 !! test
1380 <nowiki> unordered list
1381 !! wikitext
1382 <nowiki>* This is not an unordered list item.</nowiki>
1383 !! html/php
1384 <p>* This is not an unordered list item.
1385 </p>
1386 !! html/parsoid
1387 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1388 !! end
1389
1390 !! test
1391 <nowiki> spacing
1392 !! wikitext
1393 <nowiki>Lorem ipsum dolor
1394
1395 sed abit.
1396 sed nullum.
1397
1398 :and a colon
1399 </nowiki>
1400 !! html/php
1401 <p>Lorem ipsum dolor
1402
1403 sed abit.
1404 sed nullum.
1405
1406 :and a colon
1407
1408 </p>
1409 !! html/parsoid
1410 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </span></p>
1417 !! end
1418
1419 !! test
1420 nowiki 3
1421 !! wikitext
1422 :There is not nowiki.
1423 :There is <nowiki>nowiki</nowiki>.
1424
1425 #There is not nowiki.
1426 #There is <nowiki>nowiki</nowiki>.
1427
1428 *There is not nowiki.
1429 *There is <nowiki>nowiki</nowiki>.
1430 !! html/php
1431 <dl><dd>There is not nowiki.</dd>
1432 <dd>There is nowiki.</dd></dl>
1433 <ol><li>There is not nowiki.</li>
1434 <li>There is nowiki.</li></ol>
1435 <ul><li>There is not nowiki.</li>
1436 <li>There is nowiki.</li></ul>
1437
1438 !! html/parsoid
1439 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1440 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1441
1442 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1443 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1444
1445 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1447 !! end
1448
1449 !! test
1450 Entities inside <nowiki>
1451 !! wikitext
1452 <nowiki>&lt;</nowiki>
1453 !! html
1454 <p>&lt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 Entities inside template parameters
1460 !! wikitext
1461 {{echo|&ndash;}}
1462 !! html/php+tidy
1463 <p>–</p>
1464 !! html/parsoid
1465 <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>
1466 !! end
1467
1468 !! test
1469 Properly escape nowiki when combined with other wiki markup
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <p>* &lt;/nowiki&gt; tag</p>
1474 !! wikitext
1475 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1476 !! end
1477
1478 !! test
1479 T93824: Put escaped HTML tags inside nowiki
1480 !! options
1481 parsoid=html2wt
1482 !! html/parsoid
1483 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1484 !! wikitext
1485 <nowiki><h2>foo</h2></nowiki>
1486 !! end
1487
1488 !! test
1489 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1490 !! options
1491 parsoid=html2wt
1492 !! html/parsoid
1493 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1494 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1495 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1496 !! wikitext
1497 This text: L'[[Foo]]
1498 This text: L<nowiki>''</nowiki>[[Foo]]
1499 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1500 !! end
1501
1502 # This test fails because wikitext whitespace is not normalized before comparing.
1503 !! test
1504 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1505 !! options
1506 parsoid=html2wt
1507 !! html/parsoid
1508 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1509 </p>
1510 !! wikitext
1511 This text : L<nowiki>''</nowiki>[[Foo]]
1512 !! end
1513
1514 # This test and the next one are html2wt only as they test that incorrect wikitext
1515 # passed in template arguments gets escaped or wrapped in nowikis where required.
1516 !! test
1517 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <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>
1522 <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>
1523 !! wikitext
1524 {{echo|foo{{!}}bar}}
1525 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1526 !! end
1527
1528 !! test
1529 T53961: Output correct nowikis in template arguments
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <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>
1534 <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>
1535 <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>
1536 <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>
1537 <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>
1538 !! wikitext
1539 {{echo|a [ b}}
1540 {{echo|a <nowiki>}}</nowiki> b}}
1541 {{echo|<nowiki>a [[ b</nowiki>}}
1542 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1543 {{echo|a <nowiki>}</nowiki>}}
1544 !! end
1545
1546 !! test
1547 Cases where "!!" needs nowiki protection
1548 !! options
1549 parsoid=html2wt
1550 !! html/parsoid
1551 <table>
1552 <tr><th>this needs protection !! here</th></tr>
1553 </table>
1554
1555 <table>
1556 <tr><th>this does not need
1557 protection !! here</th></tr>
1558 </table>
1559 !! wikitext
1560 {|
1561 !<nowiki>this needs protection !! here</nowiki>
1562 |}
1563
1564 {|
1565 !this does not need
1566 protection !! here
1567 |}
1568 !! end
1569
1570 ###
1571 ### Comments
1572 ###
1573 !! test
1574 Comments and Indent-Pre
1575 !! wikitext
1576 <!-- comment 1 --> asdf
1577
1578 <!-- comment 1 --> asdf
1579 <!-- comment 2 -->
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->xyz
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 --> xyz
1586 !! html
1587 <pre>asdf
1588 </pre>
1589 <pre>asdf
1590 </pre>
1591 <pre>asdf
1592 </pre>
1593 <p>xyz
1594 </p>
1595 <pre>asdf
1596 xyz
1597 </pre>
1598 !! end
1599
1600 !! test
1601 Comment test 2a
1602 !! wikitext
1603 asdf
1604 <!-- comment 1 -->
1605 jkl
1606 !! html
1607 <p>asdf
1608 jkl
1609 </p>
1610 !! end
1611
1612 !! test
1613 Comment test 2b
1614 !! wikitext
1615 asdf
1616 <!-- comment 1 -->
1617
1618 jkl
1619 !! html
1620 <p>asdf
1621 </p><p>jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 3
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630 <!-- comment 2 -->
1631 jkl
1632 !! html
1633 <p>asdf
1634 jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 4
1640 !! wikitext
1641 asdf<!-- comment 1 -->jkl
1642 !! html
1643 <p>asdfjkl
1644 </p>
1645 !! end
1646
1647 !! test
1648 Comment spacing
1649 !! wikitext
1650 a
1651 <!-- foo --> b <!-- bar -->
1652 c
1653 !! html
1654 <p>a
1655 </p>
1656 <pre> b
1657 </pre>
1658 <p>c
1659 </p>
1660 !! end
1661
1662 !! test
1663 Comment whitespace
1664 !! wikitext
1665 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1666 !! html
1667
1668 !! end
1669
1670 !! test
1671 Comment semantics and delimiters
1672 !! wikitext
1673 <!-- --><!----><!-----><!------>
1674 !! html/php
1675
1676 !! html/parsoid
1677 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1678 !! end
1679
1680 !! test
1681 Comment semantics and delimiters, redux
1682 !! wikitext
1683 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1684 -- foo -- funky huh? ... -->
1685 !! html/php
1686
1687 !! html/parsoid
1688 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1689 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1690 !! end
1691
1692 !! test
1693 Comment semantics and delimiters: directors cut
1694 !! wikitext
1695 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1696 everything starting with < followed by !-- until the first -- and > we see,
1697 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1698 -->-->
1699 !! html/php
1700 <p>--&gt;
1701 </p>
1702 !! html/parsoid
1703 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1704 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1705 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1706 --><p>--></p>
1707 !! end
1708
1709 !! test
1710 Comment semantics: nesting
1711 !! wikitext
1712 <!--<!-- no, we're not going to do anything fancy here -->-->
1713 !! html/php
1714 <p>--&gt;
1715 </p>
1716 !! html/parsoid
1717 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1718 !! end
1719
1720 # Parsoid closes the unclosed comment, even if it means a slight
1721 # round-trip diff.
1722 !! test
1723 Comment semantics: unclosed comment at end
1724 !! options
1725 parsoid=wt2html,html2html
1726 !! wikitext
1727 <!--This comment will run out to the end of the document
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!--This comment will run out to the end of the document-->
1732 !! end
1733
1734 !! test
1735 Comment semantics: normalize comments to play nice with XML and browsers
1736 !! wikitext
1737 <!-- Browsers --!> think this is closed -->
1738 <!--> This would normally be text -->
1739 <!---> As would this -->
1740 <!-- XML doesn't like trailing dashes -------->
1741 <!-- Nor doubled hyphens -- anywhere in the data -->
1742 But this is not a comment.
1743 !! html/php
1744 <p>But this is not a comment.
1745 </p>
1746 !! html/parsoid
1747 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1748 <!--&#x3E; This would normally be text -->
1749 <!--&#x2D;&#x3E; As would this -->
1750 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1751 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1752 <p>But this is not a comment.</p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: round-trip even text which contains encoded -->
1757 !! wikitext
1758 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1759 !! html/parsoid
1760 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1761 !! end
1762
1763 !! test
1764 Comment in template title
1765 !! wikitext
1766 {{f<!---->oo}}
1767 !! html
1768 <p>FOO
1769 </p>
1770 !! end
1771
1772 !! test
1773 Comment on its own line post-expand
1774 !! wikitext
1775 a
1776 {{blank}}<!---->
1777 b
1778 !! html
1779 <p>a
1780 </p><p>b
1781 </p>
1782 !! end
1783
1784 !! test
1785 Comment on its own line post-expand with non-significant whitespace
1786 !! wikitext
1787 a
1788 {{blank}} <!---->
1789 b
1790 !! html
1791 <p>a
1792 </p><p>b
1793 </p>
1794 !! end
1795
1796 !! test
1797 Multiple comments should still parse as SOL-transparent
1798 !! options
1799 parsoid=wt2html,wt2wt
1800 !! wikitext
1801 <!--c1-->*a
1802 <!--c2--><!--c3--><!--c4-->*b
1803 !! html/php
1804 <ul><li>a</li>
1805 <li>b</li></ul>
1806
1807 !! html/parsoid
1808 <!--c1--><ul>
1809 <li>a
1810 </li>
1811 <!--c2--><!--c3--><!--c4-->
1812 <li>b
1813 </li>
1814 </ul>
1815 !! end
1816
1817 ###
1818 ### paragraph wrapping tests
1819 ###
1820 !! test
1821 No block tags
1822 !! wikitext
1823 a
1824
1825 b
1826 !! html
1827 <p>a
1828 </p><p>b
1829 </p>
1830 !! end
1831
1832 !! test
1833 Block tag on one line (<div>)
1834 !! wikitext
1835 a <div>foo</div>
1836
1837 b
1838 !! html
1839 a <div>foo</div>
1840 <p>b
1841 </p>
1842 !! html+tidy
1843 <p>a</p>
1844 <div>foo</div>
1845 <p>b</p>
1846 !! end
1847
1848 !! test
1849 Block tag on one line (<blockquote>)
1850 !! wikitext
1851 a <blockquote>foo</blockquote>
1852
1853 b
1854 !! html
1855 a <blockquote>foo</blockquote>
1856 <p>b
1857 </p>
1858 !! html+tidy
1859 <p>a</p>
1860 <blockquote>
1861 <p>foo</p>
1862 </blockquote>
1863 <p>b</p>
1864 !! end
1865
1866 !! test
1867 Block tag on both lines (<div>)
1868 !! wikitext
1869 a <div>foo</div>
1870
1871 b <div>foo</div>
1872 !! html
1873 a <div>foo</div>
1874 b <div>foo</div>
1875
1876 !! html+tidy
1877 <p>a</p>
1878 <div>foo</div>
1879 <p>b</p>
1880 <div>foo</div>
1881 !! end
1882
1883 !! test
1884 Block tag on both lines (<blockquote>)
1885 !! wikitext
1886 a <blockquote>foo</blockquote>
1887
1888 b <blockquote>foo</blockquote>
1889 !! html
1890 a <blockquote>foo</blockquote>
1891 b <blockquote>foo</blockquote>
1892
1893 !! html+tidy
1894 <p>a</p>
1895 <blockquote>
1896 <p>foo</p>
1897 </blockquote>
1898 <p>b</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 !! end
1903
1904 !! test
1905 Multiple lines without block tags
1906 !! wikitext
1907 <div>foo</div> a
1908 b
1909 c
1910 d<!--foo--> e
1911 x <div>foo</div> z
1912 !! html
1913 <div>foo</div> a
1914 <p>b
1915 c
1916 d e
1917 </p>
1918 x <div>foo</div> z
1919
1920 !! html+tidy
1921 <div>foo</div>
1922 <p>a</p>
1923 <p>b c d e</p>
1924 <p>x</p>
1925 <div>foo</div>
1926 <p>z</p>
1927 !! end
1928
1929 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1930 # So, we have a separate section for Parsoid. We don't want
1931 # to mimic this stripping behavior in Parsoid. It affects
1932 # editing experience and also requires us to maintain additional
1933 # info for RT-ing.
1934 !! test
1935 Empty lines between lines with block tags
1936 !! wikitext
1937 <div></div>
1938
1939
1940 <div></div>a
1941
1942 b
1943 <div>a</div>b
1944
1945 <div>b</div>d
1946
1947
1948 <div>e</div>
1949 !! html
1950 <div></div>
1951 <p><br />
1952 </p>
1953 <div></div>a
1954 <p>b
1955 </p>
1956 <div>a</div>b
1957 <div>b</div>d
1958 <p><br />
1959 </p>
1960 <div>e</div>
1961
1962 !! html+tidy
1963 <p><br /></p>
1964 <p>a</p>
1965 <p>b</p>
1966 <div>a</div>
1967 <p>b</p>
1968 <div>b</div>
1969 <p>d</p>
1970 <p><br /></p>
1971 <div>e</div>
1972 !! html/parsoid
1973 <div data-parsoid='{"stx":"html"}'></div>
1974
1975 <p><br /></p>
1976 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1977
1978 <p>b</p>
1979 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1980
1981 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1982
1983 <p><br /></p>
1984 <div data-parsoid='{"stx":"html"}'>e</div>
1985 !! end
1986
1987 ## PHP parser emits output which is broken
1988 !! test
1989 Unclosed HTML p-tags should be handled properly
1990 !! wikitext
1991 <div><p>foo</div>
1992 a
1993
1994 b
1995 !! html/php+tidy
1996 <div>
1997 <p>foo</p>
1998 </div>
1999 <p>a</p>
2000 <p>b</p>
2001 !! html/parsoid
2002 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! end
2006
2007 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2008 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2009 ## them for now.
2010 !! test
2011 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2012 !! options
2013 parsoid=wt2html
2014 !! wikitext
2015 a [[Category:A1]] [[Category:A2]]
2016 [[Category:A3]]
2017 [[Category:A4]]
2018 !! html/parsoid
2019 <p>a</p>
2020 <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"/>
2021 !! end
2022
2023 !! test
2024 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 [[Category:A1]]a
2029 !! html/parsoid
2030 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2031 !! end
2032
2033 ###
2034 ### Preformatted text
2035 ###
2036 !! test
2037 Preformatted text
2038 !! wikitext
2039 This is some
2040 Preformatted text
2041 With ''italic''
2042 And '''bold'''
2043 And a [[Main Page|link]]
2044 !! html
2045 <pre>This is some
2046 Preformatted text
2047 With <i>italic</i>
2048 And <b>bold</b>
2049 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2050 </pre>
2051 !! end
2052
2053 !! test
2054 Tabs don't trigger preformatted text
2055 !! wikitext
2056 This is not
2057 preformatted text.
2058 This is preformatted text.
2059 So is this.
2060 !! html/php
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! html/parsoid
2068 <p> This is not
2069 preformatted text.</p>
2070 <pre>This is preformatted text.
2071 So is this.</pre>
2072 !! end
2073
2074 !! test
2075 Space before tab needs nowiki pre protection
2076 !! options
2077 parsoid=html2wt
2078 !! html/parsoid
2079 <p> a</p>
2080 !! wikitext
2081 <nowiki> </nowiki> a
2082 !! end
2083
2084 !! test
2085 Ident preformatting with inline content
2086 !! wikitext
2087 a
2088 ''b''
2089 !! html
2090 <pre>a
2091 <i>b</i>
2092 </pre>
2093 !! end
2094
2095 !! test
2096 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2097 !! wikitext
2098 <pre><nowiki>
2099 <b>
2100 <cite>
2101 <em>
2102 </nowiki></pre>
2103 !! html
2104 <pre>
2105 &lt;b&gt;
2106 &lt;cite&gt;
2107 &lt;em&gt;
2108 </pre>
2109
2110 !! end
2111
2112 !! test
2113 Regression with preformatted in <center>
2114 !! wikitext
2115 <center>
2116 Blah
2117 </center>
2118 !! html
2119 <center>
2120 <pre>Blah
2121 </pre>
2122 </center>
2123
2124 !! end
2125
2126 !! test
2127 Bug 52763: Preformatted in <blockquote>
2128 !! wikitext
2129 <blockquote>
2130 Blah
2131 {|
2132 |
2133 indented cell (no pre-wrapping!)
2134 |}
2135 </blockquote>
2136 !! html
2137 <blockquote>
2138 <p> Blah
2139 </p>
2140 <table>
2141 <tr>
2142 <td>
2143 <p> indented cell (no pre-wrapping!)
2144 </p>
2145 </td></tr></table>
2146 </blockquote>
2147
2148 !! end
2149
2150 !! test
2151 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2152 !! wikitext
2153 <blockquote>
2154 Foo
2155
2156 Bar
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo
2161 </p><p>Bar
2162 </p>
2163 </blockquote>
2164
2165 !! end
2166
2167 !! test
2168 Bug 15491: <ins>/<del> in blockquote
2169 !! wikitext
2170 <blockquote>
2171 Foo <del>bar</del> <ins>baz</ins> quux
2172 </blockquote>
2173 !! html
2174 <blockquote>
2175 <p>Foo <del>bar</del> <ins>baz</ins> quux
2176 </p>
2177 </blockquote>
2178
2179 !! end
2180
2181 # Note that the p-wrapping is newline sensitive, which could be
2182 # considered a bug: tidy will wrap only the 'Foo' in the example
2183 # below in a <p> tag. (see comment 23-25 of bug #6200)
2184 !! test
2185 Bug 15491: <ins>/<del> in blockquote (2)
2186 !! wikitext
2187 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2188 </blockquote>
2189 !! html
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192
2193 !! html+tidy
2194 <blockquote>
2195 <p>Foo</p>
2196 <del>bar</del> <ins>baz</ins> quux</blockquote>
2197 !! end
2198
2199 !! test
2200 <pre> with attributes (bug 3202)
2201 !! wikitext
2202 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2203 !! html
2204 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2205
2206 !! end
2207
2208 !! test
2209 <pre> with width attribute (bug 3202)
2210 !! wikitext
2211 <pre width="8">Narrow screen goodies</pre>
2212 !! html
2213 <pre width="8">Narrow screen goodies</pre>
2214
2215 !! end
2216
2217 !! test
2218 <pre> with forbidden attribute (bug 3202)
2219 !! wikitext
2220 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2221 !! html
2222 <pre width="8">Narrow screen goodies</pre>
2223
2224 !! end
2225
2226 !! test
2227 Entities inside <pre>
2228 !! wikitext
2229 <pre>&lt;</pre>
2230 !! html
2231 <pre>&lt;</pre>
2232
2233 !! end
2234
2235 !! test
2236 <pre> with forbidden attribute values (bug 3202)
2237 !! wikitext
2238 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2239 !! html
2240 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2241
2242 !! end
2243
2244 !! test
2245 <nowiki> inside <pre> (bug 13238)
2246 !! wikitext
2247 <pre>
2248 <nowiki>
2249 </pre>
2250 <pre>
2251 <nowiki></nowiki>
2252 </pre>
2253 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2254 !! html
2255 <pre>
2256 &lt;nowiki&gt;
2257 </pre>
2258 <pre>
2259
2260 </pre>
2261 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2262
2263 !! end
2264
2265 !! test
2266 <nowiki> and <pre> preference (first one wins)
2267 !! wikitext
2268 <pre>
2269 <nowiki>
2270 </pre>
2271 </nowiki>
2272 </pre>
2273
2274 <nowiki>
2275 <pre>
2276 <nowiki>
2277 </pre>
2278 </nowiki>
2279 </pre>
2280
2281 !! html/php
2282 <pre>
2283 &lt;nowiki&gt;
2284 </pre>
2285 <p>&lt;/nowiki&gt;
2286 &lt;/pre&gt;
2287 </p><p>
2288 &lt;pre&gt;
2289 &lt;nowiki&gt;
2290 &lt;/pre&gt;
2291
2292 &lt;/pre&gt;
2293 </p>
2294 !! html/parsoid
2295 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2296 </pre>
2297 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2298 &lt;/pre></p>
2299
2300 <p><span typeof="mw:Nowiki">
2301 &lt;pre>
2302 &lt;nowiki>
2303 &lt;/pre>
2304 </span>
2305 &lt;/pre></p>
2306 !! end
2307
2308 !! test
2309 </pre> inside nowiki
2310 !! wikitext
2311 <nowiki></pre></nowiki>
2312 !! html
2313 <p>&lt;/pre&gt;
2314 </p>
2315 !! end
2316
2317 # Parsoid doesn't strip empty tags, like Tidy does.
2318 !! test
2319 Empty pre; pre inside other HTML tags (bug 54946)
2320 !! options
2321 parsoid=wt2html,wt2wt
2322 !! wikitext
2323 a
2324
2325 <div><pre>
2326 foo
2327 </pre></div>
2328 <pre></pre>
2329 !! html/php
2330 <p>a
2331 </p>
2332 <div><pre>
2333 foo
2334 </pre></div>
2335 <pre></pre>
2336
2337 !! html/php+tidy
2338 <p>a</p>
2339 <div>
2340 <pre>
2341 foo
2342 </pre></div>
2343 !! html/parsoid
2344 <p>a</p>
2345
2346 <div><pre>foo
2347 </pre></div>
2348 <pre></pre>
2349 !! end
2350
2351 !! test
2352 HTML pre followed by indent-pre
2353 !! wikitext
2354 <pre>foo</pre>
2355 bar
2356 !! html
2357 <pre>foo</pre>
2358 <pre>bar
2359 </pre>
2360 !! end
2361
2362 # Note that tidy removes the empty <p> tags from the start and end.
2363 # Parsoid does not, by design.
2364 !!test
2365 Block tag pre
2366 !! wikitext
2367 <p><pre>foo</pre></p>
2368 !! html/php+tidy
2369 <pre>
2370 foo
2371 </pre>
2372 !! html/parsoid
2373 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2374 !!end
2375
2376 !!test
2377 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2378 !! wikitext
2379 {{echo|}}
2380 !! html
2381
2382 !!end
2383
2384 !!test
2385 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2386 !! wikitext
2387 {{echo|
2388 foo}}
2389 !! html
2390 <p>foo
2391 </p>
2392 !!end
2393
2394 !! test
2395 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2396 !! wikitext
2397 {{echo|a
2398 b}}
2399 !! html
2400 <pre>a
2401 </pre>
2402 <p>b
2403 </p>
2404 !!end
2405
2406 !! test
2407 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2408 !! wikitext
2409 {{echo|a
2410 b
2411 c
2412 d
2413 e
2414 }}
2415 !! html
2416 <pre>a
2417 </pre>
2418 <p>b
2419 c
2420 </p>
2421 <pre>d
2422 </pre>
2423 <p>e
2424 </p>
2425 !!end
2426
2427 !!test
2428 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2429 !! wikitext
2430 {{echo| foo}}
2431
2432 {{echo| foo}}{{echo| bar}}
2433
2434 {{echo| foo}}
2435 {{echo| bar}}
2436
2437 {{echo|<!--cmt--> foo}}
2438
2439 <!--cmt-->{{echo| foo}}
2440
2441 {{echo|{{echo| }}bar}}
2442 !! html
2443 <pre>foo
2444 </pre>
2445 <pre>foo bar
2446 </pre>
2447 <pre>foo
2448 bar
2449 </pre>
2450 <pre>foo
2451 </pre>
2452 <pre>foo
2453 </pre>
2454 <pre>bar
2455 </pre>
2456 !!end
2457
2458 !! test
2459 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2460 !! wikitext
2461 {{echo| }}a
2462
2463 {{echo|
2464 }}a
2465
2466 {{echo|
2467 b}}
2468
2469 {{echo|a
2470 }}b
2471
2472 {{echo|a
2473 }} b
2474 !! html
2475 <pre>a
2476 </pre>
2477 <p><br />
2478 </p>
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>b
2484 </pre>
2485 <p>a
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 !!end
2494
2495 !! test
2496 Pres with newline attributes
2497 !! wikitext
2498 <pre class="one
2499 two">hi</pre>
2500 !! html/php
2501 <pre class="one two">hi</pre>
2502
2503 !! html/parsoid
2504 <pre class="one
2505 two" data-parsoid='{"stx":"html"}'>hi</pre>
2506 !! end
2507
2508 !! test
2509 Things that look like <pre> tags aren't treated as such
2510 !! wikitext
2511 Barack Obama <President> of the United States
2512 <President></President>
2513 !! html
2514 <p>Barack Obama &lt;President&gt; of the United States
2515 &lt;President&gt;&lt;/President&gt;
2516 </p>
2517 !! end
2518
2519 ## PHP parser discards the "<pre " string
2520 !! test
2521 Handle broken pre-like tags (bug 64025)
2522 !! options
2523 parsoid=wt2html
2524 !! wikitext
2525 {{echo|<pre <pre>x</pre>}}
2526
2527 <table><pre </table>
2528 !! html/php
2529 <pre>x</pre>
2530 <table><pre></pre></table>
2531
2532 !! html/parsoid
2533 <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>
2534
2535
2536 <p>&lt;pre </p>
2537
2538 <table></table>
2539 !! end
2540
2541 !! test
2542 Parsoid: handle pre with space after attribute
2543 !! options
2544 parsoid=wt2html
2545 !! wikitext
2546 <pre style="width:50%;" >{{echo|foo}}</pre>
2547 !! html/php
2548 <pre style="width:50%;">{{echo|foo}}</pre>
2549
2550 !! html/parsoid
2551 <pre style="width:50%;">{{echo|foo}}</pre>
2552 !! end
2553
2554 # TODO / maybe: fix wt2wt for this
2555 !! test
2556 Parsoid: Don't paragraph-wrap fosterable content
2557 !! options
2558 parsoid=wt2html
2559 !! wikitext
2560 {|
2561 <td></td>
2562 <td></td>
2563
2564
2565
2566 |}
2567 !! html
2568 <table>
2569
2570 <tbody>
2571 <tr>
2572 <td></td>
2573
2574 <td></td></tr>
2575
2576
2577
2578 </tbody></table>
2579 !! end
2580
2581 !! test
2582 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2583 !! options
2584 parsoid=wt2html
2585 !! wikitext
2586 {|
2587 <td>
2588 <td>
2589 </td>
2590
2591
2592
2593 |}
2594 !! html
2595 <table>
2596
2597 <tbody>
2598 <tr>
2599 <td></td>
2600
2601 <td>
2602 </td></tr>
2603
2604
2605
2606 </tbody></table>
2607 !! end
2608
2609
2610 #--------------------------------------------------------------------
2611 # Transclusion parameter whitespace stripping tests
2612 # Behavior is different for positional and named parameters
2613 #--------------------------------------------------------------------
2614 !! test
2615 Templates: Strip leading and trailing whitespace from named-param values
2616 !! wikitext
2617 {{echo|1= a }}
2618
2619 {{echo|1= {{echo|b}} }}
2620
2621 {{echo| 1 =
2622 c }}
2623
2624 {{echo| 1 =
2625 * d
2626 }}
2627 !! html
2628 <p>a
2629 </p><p>b
2630 </p><p>c
2631 </p>
2632 <ul><li> d</li></ul>
2633
2634 !! end
2635
2636 !! test
2637 Templates: Don't strip whitespace from positional-param values
2638 !! wikitext
2639 {{echo|a }}
2640
2641 {{echo|{{echo|b}} }}
2642
2643 {{echo| c
2644 }}
2645
2646 {{echo| {{echo|d}}
2647 }}
2648
2649 {{echo|
2650 e}}
2651
2652 {{echo|
2653 * f}}
2654
2655 {{echo|
2656 }}g
2657 !! html
2658 <p>a
2659 </p><p>b
2660 </p>
2661 <pre>c
2662 </pre>
2663 <p><br />
2664 </p>
2665 <pre>d
2666 </pre>
2667 <p><br />
2668 </p>
2669 <pre>e
2670 </pre>
2671 <p><br />
2672 </p>
2673 <ul><li> f</li></ul>
2674 <p><br />
2675 </p>
2676 <pre>g
2677 </pre>
2678 !! end
2679
2680 !! test
2681 Templates: Handle empty comment-and-ws-only lines correctly
2682 !! wikitext
2683 {{echo|foo
2684 <!--should be ignored-->
2685 <!--should be ignored as well-->
2686 bar}}
2687 !! html
2688 <p>foo
2689 bar
2690 </p>
2691 !! end
2692
2693 !! test
2694 Templates: Handle comments in the target
2695 !! wikitext
2696 {{echo
2697 <!-- should be ignored -->
2698 |foo}}
2699
2700 {{echo<!-- should be ignored -->
2701 |foo}}
2702
2703 {{echo<!-- should be ignored -->|foo}}
2704
2705 {{<!-- should be ignored -->echo|foo}}
2706 !!html/parsoid
2707 <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>
2708
2709 <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>
2710
2711 <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>
2712
2713 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2714 !!end
2715
2716 !! test
2717 Templates: Handle comments in parameter names (bug 67657)
2718 !! wikitext
2719 {{echo|1
2720 <!-- should be ignored -->
2721 =foo}}
2722
2723 {{echo|
2724 <!-- should be ignored -->
2725 1 = foo}}
2726
2727 {{echo|1<!-- should be ignored --> = foo}}
2728
2729 {{echo|<!-- should be ignored -->1 = foo}}
2730 !!html/parsoid
2731 <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>
2732
2733 <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>
2734
2735 <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>
2736
2737 <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>
2738 !!end
2739
2740 !! test
2741 Templates: Other wikitext in parameter names (bug 67657)
2742 !! wikitext
2743 {{echo|''1''=foo}}
2744 !!html/parsoid
2745 <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>
2746 !!html/php
2747 <p>{{{1}}}
2748 </p>
2749 !!end
2750
2751 #--------------------------------------------------------------------
2752 # Transclusion parameter escaping tests
2753 #--------------------------------------------------------------------
2754 !! test
2755 Templates: Parsoid parameter escaping test 1
2756 !! wikitext
2757 {{echo|[foo]|{{echo|[bar]}}}}
2758 !! html/php+tidy
2759 <p>[foo]</p>
2760 !! html/parsoid
2761 <p about="#mwt1" typeof="mw:Transclusion"
2762 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2763 !! end
2764
2765 !! test
2766 Parsoid: Pipes in external links in template parameter
2767 !! wikitext
2768 {{echo|[{{echo|http://example.com}} link]}}
2769 !! html/php+tidy
2770 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2771 !! html/parsoid
2772 <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>
2773 !! end
2774
2775 !! test
2776 Parsoid: pipe in transclusion parameter
2777 !! wikitext
2778 {{echo|http://foo.com/a&#124;b}}
2779 !! html/php+tidy
2780 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2781 !! html/parsoid
2782 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2783 typeof="mw:Transclusion"
2784 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>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in external link target and content in template parameter
2789 !! options
2790 parsoid=html2wt,wt2wt
2791 !! wikitext
2792 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2793 !! html/php+tidy
2794 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2795 !! html/parsoid
2796 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2797 typeof="mw:Transclusion"
2798 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2799 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2800 !! end
2801
2802 !! test
2803 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2804 !! options
2805 parsoid
2806 !! wikitext
2807 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2808 !! html
2809 <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>
2810 !! end
2811
2812 !! test
2813 Templates: Don't escape already nowiki-escaped text in template parameters
2814 !! options
2815 parsoid=html2wt,wt2wt
2816 !! wikitext
2817 {{echo|foo<nowiki>|</nowiki>bar}}
2818 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2819 {{echo|<nowiki></nowiki>}}
2820 !! html/php+tidy
2821 <p>foo|bar &lt;div&gt;</p>
2822 !! html/parsoid
2823 <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>
2824 <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>
2825 <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>
2826 </p>
2827 !! end
2828
2829 ## Bug 52824
2830 !! test
2831 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|{{echo|1=bar}}}}
2836 !! html/php+tidy
2837 <p>bar</p>
2838 !! html/parsoid
2839 <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>
2840 !! end
2841
2842 ## Bug 56733
2843 !! test
2844 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2845 !! wikitext
2846 {{echo|a : b}}
2847 !! html/php+tidy
2848 <p>a&#160;: b</p>
2849 !! html/parsoid
2850 <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>
2851 !! end
2852
2853 ## Bug T73412
2854 !! test
2855 Templates: Preserve blank parameter names
2856 !! wikitext
2857 {{echo|=foo}}
2858 !! html/php+tidy
2859 <p>{{{1}}}</p>
2860 !! html/parsoid
2861 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2862 !! end
2863
2864 !! test
2865 Templates: Preserve blank parameter names in other positions
2866 !! wikitext
2867 {{blank_param|bar|=foo}}
2868 !! html/php+tidy
2869 <p>bar foo</p>
2870 !! html/parsoid
2871 <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
2872 foo</p>
2873 !! end
2874
2875 ###
2876 ### Parsoid-centric tests for testing RT edge cases for pre
2877 ###
2878
2879 !!test
2880 1a. Indent-Pre and Comments
2881 !! wikitext
2882 a
2883 <!--a-->
2884 c
2885 !! html
2886 <pre>a
2887 </pre>
2888 <p>c
2889 </p>
2890 !!end
2891
2892 !!test
2893 1b. Indent-Pre and Comments
2894 !! wikitext
2895 a
2896 <!--a-->
2897 c
2898 !! html
2899 <pre>a
2900 </pre>
2901 <p>c
2902 </p>
2903 !!end
2904
2905 !!test
2906 1c. Indent-Pre and Comments
2907 !! wikitext
2908 <!--a--> a
2909
2910 <!--a--> a
2911 !! html
2912 <pre> a
2913 </pre>
2914 <pre> a
2915 </pre>
2916 !!end
2917
2918 !!test
2919 1d. Indent-Pre and Comments
2920 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2921 !! wikitext
2922 <!--a--> a
2923
2924 <!--b-->b
2925 !! html
2926 <pre>a
2927 </pre>
2928 <pre>b
2929 </pre>
2930 !!end
2931
2932 !!test
2933 2a. Indent-Pre and tables
2934 !! wikitext
2935 {|
2936 |-
2937 !h1!!h2
2938 |foo||bar
2939 |}
2940 !! html
2941 <table>
2942
2943 <tr>
2944 <th>h1</th>
2945 <th>h2
2946 </th>
2947 <td>foo</td>
2948 <td>bar
2949 </td></tr></table>
2950
2951 !!end
2952
2953 !!test
2954 2b. Indent-Pre and tables
2955 !! wikitext
2956 {|
2957 |-
2958 |foo
2959 |}
2960 !! html
2961 <table>
2962
2963 <tr>
2964 <td>foo
2965 </td></tr></table>
2966
2967 !!end
2968
2969 !!test
2970 2c. Indent-Pre and tables (bug 42252)
2971 !! wikitext
2972 {|
2973 |+ foo
2974 ! | bar
2975 |}
2976 !! html
2977 <table>
2978 <caption> foo
2979 </caption>
2980 <tr>
2981 <th> bar
2982 </th></tr></table>
2983
2984 !!end
2985
2986 !!test
2987 2d. Indent-Pre and tables
2988 !! wikitext
2989 a
2990 {|
2991 | b
2992 |}
2993 !! html/php
2994 <pre>a
2995 </pre>
2996 <table>
2997 <tr>
2998 <td> b
2999 </td></tr></table>
3000
3001 !! html/parsoid
3002 <pre>a</pre>
3003 <table>
3004 <tbody><tr><td> b</td></tr>
3005 </tbody></table>
3006 !!end
3007
3008 !!test
3009 2e. Indent-Pre and table-line syntax
3010 !! wikitext
3011 a
3012 | b
3013 | c
3014 !! html/php
3015 <pre>a
3016 | b
3017 | c
3018 </pre>
3019 !!end
3020
3021 !!test
3022 2f. Indent-pre started by table-line syntax
3023 !! wikitext
3024 a
3025 | b
3026 | c
3027 !! html/php
3028 <p>a
3029 </p>
3030 <pre>| b
3031 | c
3032 </pre>
3033 !! html/parsoid
3034 <p>a</p>
3035 <pre>
3036 | b
3037 | c</pre>
3038 !!end
3039
3040 !!test
3041 3a. Indent-Pre and block tags (single-line html)
3042 !! wikitext
3043 a <p> foo </p>
3044 b <div> foo </div>
3045 c <blockquote> foo </blockquote>
3046 <span> foo </span>
3047 !! html
3048 a <p> foo </p>
3049 b <div> foo </div>
3050 c <blockquote> foo </blockquote>
3051 <pre><span> foo </span>
3052 </pre>
3053 !! html/parsoid
3054 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3055 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3056 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3057 <pre><span> foo </span>
3058 </pre>
3059 !! html+tidy
3060 <p>a</p>
3061 <p>foo</p>
3062 <p>b</p>
3063 <div>foo</div>
3064 <p>c</p>
3065 <blockquote>
3066 <p>foo</p>
3067 </blockquote>
3068 <pre>
3069 <span> foo </span>
3070 </pre>
3071 !! end
3072
3073 !!test
3074 3b. Indent-Pre and block tags (multi-line html)
3075 !! wikitext
3076 a <span>foo</span>
3077 b <div> foo </div>
3078 !! html
3079 <pre>a <span>foo</span>
3080 </pre>
3081 b <div> foo </div>
3082
3083 !! html/parsoid
3084 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3085 b <div data-parsoid='{"stx":"html"}'> foo </div>
3086 !! html+tidy
3087 <pre>
3088 a <span>foo</span>
3089 </pre>
3090 <p>b</p>
3091 <div>foo</div>
3092 !!end
3093
3094 !!test
3095 3c. Indent-Pre and block tags (pre-content on separate line)
3096 !! wikitext
3097 <p>
3098 foo
3099 </p>
3100
3101 <div>
3102 foo
3103 </div>
3104
3105 <center>
3106 foo
3107 </center>
3108
3109 <blockquote>
3110 foo
3111 </blockquote>
3112
3113 <blockquote>
3114 <pre>
3115 foo
3116 </pre>
3117 </blockquote>
3118
3119 <table><tr><td>
3120 foo
3121 </td></tr></table>
3122
3123 <ul><li>
3124 foo
3125 </li></ul>
3126
3127 !! html
3128 <p>
3129 foo
3130 </p>
3131 <div>
3132 <pre>foo
3133 </pre>
3134 </div>
3135 <center>
3136 <pre>foo
3137 </pre>
3138 </center>
3139 <blockquote>
3140 <p> foo
3141 </p>
3142 </blockquote>
3143 <blockquote>
3144 <pre>
3145 foo
3146 </pre>
3147 </blockquote>
3148 <table><tr><td>
3149 <pre>foo
3150 </pre>
3151 </td></tr></table>
3152 <ul><li>
3153 foo
3154 </li></ul>
3155
3156 !!end
3157
3158 !!test
3159 4. Indent-Pre and extension tags
3160 !! wikitext
3161 a <gallery>
3162 File:foobar.jpg
3163 </gallery>
3164 !! html
3165 a <ul class="gallery mw-gallery-traditional">
3166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3167 <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>
3168 <div class="gallerytext">
3169 </div>
3170 </div></li>
3171 </ul>
3172
3173 !! html+tidy
3174 <p>a</p>
3175 <ul class="gallery mw-gallery-traditional">
3176 <li class="gallerybox" style="width: 155px">
3177 <div style="width: 155px">
3178 <div class="thumb" style="width: 150px;">
3179 <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>
3180 </div>
3181 <div class="gallerytext"></div>
3182 </div>
3183 </li>
3184 </ul>
3185 !!end
3186
3187 !! test
3188 Table wikitext syntax outside wiki-tables
3189 !! wikitext
3190 a
3191 ! not a table heading
3192 |- not a table row
3193 | not a table cell
3194 | class="foo bar" | baz
3195 b
3196 |}
3197 |-
3198 c
3199 !! html
3200 <p>a
3201 ! not a table heading
3202 |- not a table row
3203 | not a table cell
3204 | class="foo bar" | baz
3205 b
3206 |}
3207 |-
3208 c
3209 </p>
3210 !! end
3211
3212 !!test
3213 Render paragraphs when indent-pre is suppressed in blocklevels
3214 !! wikitext
3215 <blockquote>
3216 foo
3217
3218 bar
3219 </blockquote>
3220 !! html
3221 <blockquote>
3222 <p> foo
3223 </p><p> bar
3224 </p>
3225 </blockquote>
3226
3227 !!end
3228
3229 !!test
3230 4. Multiple spaces at start-of-line
3231 !! wikitext
3232 <p> foo </p>
3233 foo
3234 {|
3235 |foo
3236 |}
3237 !! html
3238 <p> foo </p>
3239 <pre> foo
3240 </pre>
3241 <table>
3242 <tr>
3243 <td>foo
3244 </td></tr></table>
3245
3246 !!end
3247
3248 ## NOTE: the leading white-space chars on empty line are significant
3249 !! test
3250 5a. White-space in indent-pre
3251 !! wikitext
3252 a<br />
3253
3254 b
3255 !! html
3256 <pre>a<br />
3257
3258 b
3259 </pre>
3260 !! end
3261
3262 ## NOTE: the leading white-space chars on empty line are significant
3263 !! test
3264 5b. White-space in indent-pre
3265 !! wikitext
3266 a
3267
3268 b
3269
3270
3271 c
3272 !! html
3273 <pre>a
3274
3275 b
3276
3277
3278 c
3279 </pre>
3280 !! end
3281
3282 !! test
3283 5c. White-space in indent-pre
3284 !! wikitext
3285 ''a''
3286 ''b''
3287 ''c''
3288 !! html
3289 <pre><i>a</i>
3290 <i>b</i>
3291 <i>c</i>
3292 </pre>
3293 !! end
3294
3295 !! test
3296 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3297 !! wikitext
3298 a
3299
3300 <!-- continue -->
3301 b
3302
3303 c
3304
3305 d
3306 !! html
3307 <pre>a
3308
3309 b
3310 </pre>
3311 <pre>c
3312
3313 </pre>
3314 <p>d
3315 </p>
3316 !! end
3317
3318 !! test
3319 7a. Indent-pre and category links
3320 !! options
3321 parsoid=wt2html,wt2wt
3322 !! wikitext
3323 [[Category:foo]] <!-- No pre-wrapping -->
3324 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3325 !! html/php+tidy
3326 !! html/parsoid
3327 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3328 <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 -->
3329 !! end
3330
3331 !! test
3332 7b. Indent-pre and category links
3333 !! options
3334 parsoid=wt2html,wt2wt
3335 !! wikitext
3336 [[Category:foo]] a
3337 [[Category:foo]] {{echo|b}}
3338 !! html
3339 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3340 <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>
3341 !! end
3342
3343 !! test
3344 Indent-Pre: Newlines in comments shouldn't affect sol state
3345 !! wikitext
3346 a <!--
3347 foo
3348 --> b
3349 !! html/php+tidy
3350 <p>a b</p>
3351 !! html/parsoid
3352 <p>a <!--
3353 foo
3354 --> b</p>
3355 !! end
3356
3357 ###
3358 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3359 ###
3360
3361 !!test
3362 HTML-pre: 1. embedded newlines
3363 !! wikitext
3364 <pre>foo</pre>
3365
3366 <pre>
3367 foo
3368 </pre>
3369
3370 <pre>
3371
3372 foo
3373 </pre>
3374
3375 <pre>
3376
3377
3378 foo
3379 </pre>
3380 !! html/php+tidy
3381 <pre>
3382 foo
3383 </pre>
3384 <pre>
3385 foo
3386 </pre>
3387 <pre>
3388
3389 foo
3390 </pre>
3391 <pre>
3392
3393
3394 foo
3395 </pre>
3396 !! html/parsoid
3397 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3398
3399 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3400 foo
3401 </pre>
3402
3403 <pre data-parsoid='{"stx":"html"}'>
3404
3405 foo
3406 </pre>
3407
3408 <pre data-parsoid='{"stx":"html"}'>
3409
3410
3411 foo
3412 </pre>
3413 !!end
3414
3415 !! test
3416 HTML-pre: big spaces
3417 !! wikitext
3418 <pre>
3419
3420
3421
3422
3423 haha
3424
3425
3426
3427
3428 haha
3429
3430
3431
3432
3433 </pre>
3434 !! html/php+tidy
3435 <pre>
3436
3437
3438
3439
3440 haha
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 </pre>
3451 !! html/parsoid
3452 <pre data-parsoid='{"stx":"html"}'>
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 </pre>
3468 !! end
3469
3470 !!test
3471 HTML-pre: 2: indented text
3472 !! wikitext
3473 <pre>
3474 foo
3475 </pre>
3476 !! html
3477 <pre>
3478 foo
3479 </pre>
3480
3481 !!end
3482
3483 !!test
3484 HTML-pre: 3: other wikitext
3485 !! wikitext
3486 <pre>
3487 * foo
3488 # bar
3489 = no-h =
3490 '' no-italic ''
3491 [[ NoLink ]]
3492 </pre>
3493 !! html/php
3494 <pre>
3495 * foo
3496 # bar
3497 = no-h =
3498 '' no-italic ''
3499 [[ NoLink ]]
3500 </pre>
3501
3502 !! html/parsoid
3503 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3504 # bar
3505 = no-h =
3506 '' no-italic ''
3507 [[ NoLink ]]
3508 </pre>
3509 !!end
3510
3511 ###
3512 ### Definition lists
3513 ###
3514 !! test
3515 Simple definition
3516 !! wikitext
3517 ; name : Definition
3518 !! html
3519 <dl><dt> name&#160;</dt>
3520 <dd> Definition</dd></dl>
3521
3522 !! end
3523
3524 !! test
3525 Definition list for indentation only
3526 !! wikitext
3527 : Indented text
3528 !! html
3529 <dl><dd> Indented text</dd></dl>
3530
3531 !! end
3532
3533 !! test
3534 Definition list with no space
3535 !! wikitext
3536 ;name:Definition
3537 !! html
3538 <dl><dt>name</dt>
3539 <dd>Definition</dd></dl>
3540
3541 !!end
3542
3543 !! test
3544 Definition list with URL link
3545 !! wikitext
3546 ; http://example.com/ : definition
3547 !! html
3548 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3549 <dd> definition</dd></dl>
3550
3551 !! end
3552
3553 !! test
3554 Definition list with bracketed URL link
3555 !! wikitext
3556 ;[http://www.example.com/ Example]:Something about it
3557 !! html
3558 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3559 <dd>Something about it</dd></dl>
3560
3561 !! end
3562
3563 !! test
3564 Definition list with wikilink containing colon
3565 !! wikitext
3566 ; [[Help:FAQ]]: The least-read page on Wikipedia
3567 !! html
3568 <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>
3569 <dd> The least-read page on Wikipedia</dd></dl>
3570
3571 !! end
3572
3573 # At Brion's and JeLuF's insistence... :)
3574 !! test
3575 Definition list with news link containing colon
3576 !! wikitext
3577 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3578 !! html/php
3579 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3580 <dd> This isn't even a real newsgroup!</dd></dl>
3581
3582 !! html/parsoid
3583 <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>
3584 !! end
3585
3586 !! test
3587 Malformed definition list with colon
3588 !! wikitext
3589 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3590 !! html
3591 <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>
3592
3593 !! end
3594
3595 !! test
3596 Definition lists: colon in external link text
3597 !! wikitext
3598 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3599 !! html
3600 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3601 <dd> OK, I made that up</dd></dl>
3602
3603 !! end
3604
3605 !! test
3606 Definition lists: colon in HTML attribute
3607 !! wikitext
3608 ;<b style="display: inline">bold</b>
3609 !! html
3610 <dl><dt><b style="display: inline">bold</b></dt></dl>
3611
3612 !! end
3613
3614 !! test
3615 Definition lists: self-closed tag
3616 !! wikitext
3617 ;one<br/>two : two-line fun
3618 !! html
3619 <dl><dt>one<br />two&#160;</dt>
3620 <dd> two-line fun</dd></dl>
3621
3622 !! end
3623
3624 !! test
3625 Bug 11748: Literal closing tags
3626 !! wikitext
3627 <dl>
3628 <dt>test 1</dt>
3629 <dd>test test test test test</dd>
3630 <dt>test 2</dt>
3631 <dd>test test test test test</dd>
3632 </dl>
3633 !! html
3634 <dl>
3635 <dt>test 1</dt>
3636 <dd>test test test test test</dd>
3637 <dt>test 2</dt>
3638 <dd>test test test test test</dd>
3639 </dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3645 !! wikitext
3646 <ul><li>
3647 ; term : description
3648 * unordered
3649 </li></ul>
3650 !! html
3651 <ul><li>
3652 <dl><dt> term&#160;</dt>
3653 <dd> description</dd></dl>
3654 <ul><li> unordered</li></ul>
3655 </li></ul>
3656
3657 !! end
3658
3659 !! test
3660
3661 Definition list with empty definition and following paragraph
3662 !! wikitext
3663 ; term:
3664 Paragraph text
3665 !! html
3666 <dl><dt> term</dt>
3667 <dd></dd></dl>
3668 <p>Paragraph text
3669 </p>
3670 !! end
3671
3672 !! test
3673 Nested definition lists using html syntax
3674 !! wikitext
3675 <dl><dt>x</dt>
3676 <dd>a</dd>
3677 <dd>b</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition Lists: No nesting: Multiple dd's
3683 !! wikitext
3684 ;x
3685 :a
3686 :b
3687 !! html
3688 <dl><dt>x</dt>
3689 <dd>a</dd>
3690 <dd>b</dd></dl>
3691
3692 !! end
3693
3694 !! test
3695 Definition Lists: Indentation: Regular
3696 !! wikitext
3697 :i1
3698 ::i2
3699 :::i3
3700 !! html
3701 <dl><dd>i1
3702 <dl><dd>i2
3703 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3704
3705 !! end
3706
3707 !! test
3708 Definition Lists: Indentation: Missing 1st level
3709 !! wikitext
3710 ::i2
3711 :::i3
3712 !! html
3713 <dl><dd><dl><dd>i2
3714 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition Lists: Indentation: Multi-level indent
3720 !! wikitext
3721 :::i3
3722 !! html
3723 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3724
3725 !! end
3726
3727 !! test
3728 Definition Lists: Hacky use to indent tables
3729 !! wikitext
3730 ::{|
3731 |foo
3732 |bar
3733 |}
3734 this text
3735 should be left alone
3736 !! html
3737 <dl><dd><dl><dd><table>
3738 <tr>
3739 <td>foo
3740 </td>
3741 <td>bar
3742 </td></tr></table></dd></dl></dd></dl>
3743 <p>this text
3744 should be left alone
3745 </p>
3746 !! end
3747
3748 !! test
3749 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3750 !! wikitext
3751 <!-- foo -->
3752 ::{|
3753 |foo
3754 |bar
3755 |}<!-- bar -->
3756 this text
3757 should be left alone
3758 !! html/parsoid
3759 <!-- foo -->
3760 <dl><dd><dl><dd><table><tr>
3761 <td>foo</td>
3762 <td>bar</td>
3763 </tr></table><!-- bar --></dd></dl></dd></dl>
3764 <p>this text
3765 should be left alone</p>
3766 !! end
3767
3768 !! test
3769 Definition Lists: Hacky use to indent tables, with comment before table
3770 !! wikitext
3771 ::<!-- foo -->{|
3772 |foo
3773 |}
3774 !! html/parsoid
3775 <dl><dd><dl><dd><!-- foo --><table><tr>
3776 <td>foo</td>
3777 </tr></table></dd></dl></dd></dl>
3778 !! end
3779
3780 # The trailing whitespace in this test is to catch a regression in
3781 # Parsoid after T54473.
3782 !! test
3783 Definition Lists: Hacky use to indent tables (WS-insensitive)
3784 !! wikitext
3785 : {|
3786 |a
3787 |}
3788 !! html/php
3789 <dl><dd><table>
3790 <tr>
3791 <td>a
3792 </td></tr></table></dd></dl>
3793
3794 !! html/parsoid
3795 <dl><dd> <table>
3796 <tbody><tr><td>a</td></tr>
3797 </tbody></table> </dd></dl>
3798 !! end
3799
3800 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3801 ## as an empty dt item. It also ignores all but the last ";" when followed
3802 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3803 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3804 ## ";"s.
3805 ##
3806 ## Ex: ";;t2 ::d2" is transformed into:
3807 ##
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>
3811 ## <dl>
3812 ## <dt></dt>
3813 ## <dd>d2</dd>
3814 ## </dl>
3815 ## </dd>
3816 ## </dl>
3817 ##
3818 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3819 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3820 ##
3821 ## <dl>
3822 ## <dt>
3823 ## <dl>
3824 ## <dt>t2 </dt>
3825 ## <dd>:d2</dd>
3826 ## </dl>
3827 ## </dt>
3828 ## </dl>
3829 ##
3830 ## All Parsoid only definition list tests have this difference.
3831 ##
3832 ## See also: https://phabricator.wikimedia.org/T8569
3833 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3834
3835 !! test
3836 Table / list interaction: indented table with lists in table contents
3837 !! wikitext
3838 :{|
3839 |-
3840 | a
3841 * b
3842 |-
3843 | c
3844 * d
3845 |}
3846 !! html
3847 <dl><dd><table>
3848
3849 <tr>
3850 <td> a
3851 <ul><li> b</li></ul>
3852 </td></tr>
3853 <tr>
3854 <td> c
3855 <ul><li> d</li></ul>
3856 </td></tr></table></dd></dl>
3857
3858 !! end
3859
3860 !!test
3861 Table / list interaction: lists nested in tables nested in indented lists
3862 !! wikitext
3863 :{|
3864 |
3865 :a
3866 :b
3867 |
3868 *c
3869 *d
3870 |}
3871
3872 *e
3873 *f
3874 !! html
3875 <dl><dd><table>
3876 <tr>
3877 <td>
3878 <dl><dd>a</dd>
3879 <dd>b</dd></dl>
3880 </td>
3881 <td>
3882 <ul><li>c</li>
3883 <li>d</li></ul>
3884 </td></tr></table></dd></dl>
3885 <ul><li>e</li>
3886 <li>f</li></ul>
3887
3888 !!end
3889
3890 !! test
3891 Definition Lists: Nesting: Multi-level (Parsoid only)
3892 !! options
3893 parsoid
3894 !! wikitext
3895 ;t1 :d1
3896 ;;t2 ::d2
3897 ;;;t3 :::d3
3898 !! html
3899 <dl>
3900 <dt>t1 </dt>
3901 <dd>d1</dd>
3902 <dt>
3903 <dl>
3904 <dt>t2 </dt>
3905 <dd>:d2</dd>
3906 <dt>
3907 <dl>
3908 <dt>t3 </dt>
3909 <dd>::d3</dd>
3910 </dl>
3911 </dt>
3912 </dl>
3913 </dt>
3914 </dl>
3915
3916
3917 !! end
3918
3919
3920 !! test
3921 Definition Lists: Nesting: Test 2 (Parsoid only)
3922 !! wikitext
3923 ;t1
3924 ::d2
3925 !! html/php+tidy
3926 <dl>
3927 <dt>t1</dt>
3928 <dd>
3929 <dl>
3930 <dd>d2</dd>
3931 </dl>
3932 </dd>
3933 </dl>
3934 !! html/parsoid
3935 <dl>
3936 <dt>t1</dt>
3937 <dd>
3938 <dl>
3939 <dd>d2</dd>
3940 </dl>
3941 </dd>
3942 </dl>
3943
3944 !! end
3945
3946
3947 !! test
3948 Definition Lists: Nesting: Test 3 (Parsoid only)
3949 !! wikitext
3950 :;t1
3951 ::::d2
3952 !! html/php+tidy
3953 <dl>
3954 <dd>
3955 <dl>
3956 <dt>t1</dt>
3957 <dd>
3958 <dl>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 !! html/parsoid
3970 <dl>
3971 <dd>
3972 <dl>
3973 <dt>t1</dt>
3974 <dd>
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dd>d2</dd>
3979 </dl>
3980 </dd>
3981 </dl>
3982 </dd>
3983 </dl>
3984 </dd>
3985 </dl>
3986
3987 !! end
3988
3989
3990 !! test
3991 Definition Lists: Nesting: Test 4
3992 !! wikitext
3993 ::;t3
3994 :::d3
3995 !! html
3996 <dl><dd><dl><dd><dl><dt>t3</dt>
3997 <dd>d3</dd></dl></dd></dl></dd></dl>
3998
3999 !! end
4000
4001
4002 ## The Parsoid team believes the following three test exposes a
4003 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4004 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4005 ## It also exposes a "misfeature" in tidy, which doesn't like
4006 ## <dl> tags with a single <dt> child; it converts the <dt> into
4007 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4008 !! test
4009 Definition Lists: Mixed Lists: Test 1
4010 !! wikitext
4011 :;* foo
4012 ::* bar
4013 :; baz
4014 !! html/php
4015 <dl><dd><dl><dt><ul><li> foo</li>
4016 <li> bar</li></ul></dt></dl>
4017 <dl><dt> baz</dt></dl></dd></dl>
4018
4019 !! html/php+tidy
4020 <dl>
4021 <dd>
4022 <dl>
4023 <dd>
4024 <ul>
4025 <li>foo</li>
4026 <li>bar</li>
4027 </ul>
4028 </dd>
4029 </dl>
4030 <dl>
4031 <dt>baz</dt>
4032 </dl>
4033 </dd>
4034 </dl>
4035 !! html/parsoid
4036 <dl>
4037 <dd><dl>
4038 <dt><ul>
4039 <li> foo
4040 </li>
4041 </ul></dt>
4042 <dd><ul>
4043 <li> bar
4044 </li>
4045 </ul></dd>
4046 <dt> baz</dt>
4047 </dl></dd>
4048 </dl>
4049 !! end
4050
4051 !! test
4052 Definition Lists: Mixed Lists: Test 2
4053 !! wikitext
4054 *: d1
4055 *: d2
4056 !! html
4057 <ul><li><dl><dd> d1</dd>
4058 <dd> d2</dd></dl></li></ul>
4059
4060 !! end
4061
4062
4063 !! test
4064 Definition Lists: Mixed Lists: Test 3
4065 !! wikitext
4066 *::: d1
4067 *::: d2
4068 !! html
4069 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4070 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4071
4072 !! end
4073
4074
4075 !! test
4076 Definition Lists: Mixed Lists: Test 4
4077 !! wikitext
4078 *;d1 :d2
4079 *;d3 :d4
4080 !! html
4081 <ul><li><dl><dt>d1&#160;</dt>
4082 <dd>d2</dd>
4083 <dt>d3&#160;</dt>
4084 <dd>d4</dd></dl></li></ul>
4085
4086 !! end
4087
4088
4089 !! test
4090 Definition Lists: Mixed Lists: Test 5
4091 !! wikitext
4092 *:d1
4093 *:: d2
4094 !! html
4095 <ul><li><dl><dd>d1
4096 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4097
4098 !! end
4099
4100
4101 !! test
4102 Definition Lists: Mixed Lists: Test 6
4103 !! wikitext
4104 #*:d1
4105 #*::: d3
4106 !! html
4107 <ol><li><ul><li><dl><dd>d1
4108 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4109
4110 !! end
4111
4112
4113 !! test
4114 Definition Lists: Mixed Lists: Test 7
4115 !! wikitext
4116 :* d1
4117 :* d2
4118 !! html
4119 <dl><dd><ul><li> d1</li>
4120 <li> d2</li></ul></dd></dl>
4121
4122 !! end
4123
4124
4125 !! test
4126 Definition Lists: Mixed Lists: Test 8
4127 !! wikitext
4128 :* d1
4129 ::* d2
4130 !! html
4131 <dl><dd><ul><li> d1</li></ul>
4132 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4133
4134 !! end
4135
4136
4137 !! test
4138 Definition Lists: Mixed Lists: Test 9
4139 !! wikitext
4140 *;foo :bar
4141 !! html
4142 <ul><li><dl><dt>foo&#160;</dt>
4143 <dd>bar</dd></dl></li></ul>
4144
4145 !! end
4146
4147
4148 !! test
4149 Definition Lists: Mixed Lists: Test 10
4150 !! wikitext
4151 *#;foo :bar
4152 !! html
4153 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4154 <dd>bar</dd></dl></li></ol></li></ul>
4155
4156 !! end
4157
4158 # The Parsoid team disagrees with the PHP parser's seemingly-random
4159 # rules regarding dd/dt on the next two tests. Parsoid is more
4160 # consistent, and recognizes the shared nesting and keeps the
4161 # still-open tags around until the nesting is complete.
4162 # (And tidy again converts <dt> to <dd> before 'bar'.)
4163
4164 !! test
4165 Definition Lists: Mixed Lists: Test 11
4166 !! wikitext
4167 *#*#;*;;foo :bar
4168 *#*#;boo :baz
4169 !! html/php
4170 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4171 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4172 <dl><dt>boo&#160;</dt>
4173 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4174
4175 !! html/php+tidy
4176 <ul>
4177 <li>
4178 <ol>
4179 <li>
4180 <ul>
4181 <li>
4182 <ol>
4183 <li>
4184 <dl>
4185 <dt>foo&#160;</dt>
4186 <dd>
4187 <ul>
4188 <li>
4189 <dl>
4190 <dd>
4191 <dl>
4192 <dt>bar</dt>
4193 </dl>
4194 </dd>
4195 </dl>
4196 </li>
4197 </ul>
4198 </dd>
4199 </dl>
4200 <dl>
4201 <dt>boo&#160;</dt>
4202 <dd>baz</dd>
4203 </dl>
4204 </li>
4205 </ol>
4206 </li>
4207 </ul>
4208 </li>
4209 </ol>
4210 </li>
4211 </ul>
4212 !! html/parsoid
4213 <ul>
4214 <li>
4215 <ol>
4216 <li>
4217 <ul>
4218 <li>
4219 <ol>
4220 <li>
4221 <dl>
4222 <dt>
4223 <ul>
4224 <li>
4225 <dl>
4226 <dt>
4227 <dl>
4228 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4229 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4230 </dl></dt>
4231 </dl></li>
4232 </ul></dt>
4233 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4234 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4235 </dl></li>
4236 </ol></li>
4237 </ul></li>
4238 </ol></li>
4239 </ul>
4240 !! end
4241
4242
4243 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4244 # From whitelist:
4245 # * The test is wrong, there are two colons where there should be :;
4246 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4247 !! test
4248 Definition Lists: Weird Ones: Test 1
4249 !! wikitext
4250 *#;*::;; foo : bar (who uses this?)
4251 !! html/php
4252 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4253 <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>
4254
4255 !! html/php+tidy
4256 <ul>
4257 <li>
4258 <ol>
4259 <li>
4260 <dl>
4261 <dt>foo&#160;</dt>
4262 <dd>
4263 <ul>
4264 <li>
4265 <dl>
4266 <dd>
4267 <dl>
4268 <dd>
4269 <dl>
4270 <dd>
4271 <dl>
4272 <dt>bar (who uses this?)</dt>
4273 </dl>
4274 </dd>
4275 </dl>
4276 </dd>
4277 </dl>
4278 </dd>
4279 </dl>
4280 </li>
4281 </ul>
4282 </dd>
4283 </dl>
4284 </li>
4285 </ol>
4286 </li>
4287 </ul>
4288 !! html/parsoid
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dd>
4299 <dl>
4300 <dd>
4301 <dl>
4302 <dt>
4303 <dl>
4304 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4305 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4306 </dl></dt>
4307 </dl></dd>
4308 </dl></dd>
4309 </dl></li>
4310 </ul></dt>
4311 </dl></li>
4312 </ol></li>
4313 </ul>
4314 !! end
4315
4316 !! test
4317 Definition Lists: colons occurring in tags
4318 !! wikitext
4319 ;a:b
4320 ;'''a:b'''
4321 ;<i>a:b</i>
4322 ;<span>a:b</span>
4323 ;<div>a:b</div>
4324 ;<div>a
4325 :b</div>
4326 ;{{echo|a:b}}
4327 ;{{echo|''a:b''}}
4328 ;;;''a:b''
4329 !! html+tidy
4330 <dl>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><b>a:b</b></dt>
4334 <dt><i>a:b</i></dt>
4335 <dt><span>a:b</span></dt>
4336 <dd>
4337 <div>a:b</div>
4338 </dd>
4339 <dd>
4340 <div>a
4341 <dl>
4342 <dd>b</dd>
4343 </dl>
4344 </div>
4345 </dd>
4346 <dt>a</dt>
4347 <dd>b</dd>
4348 <dt><i>a:b</i></dt>
4349 </dl>
4350 <dl>
4351 <dd>
4352 <dl>
4353 <dd>
4354 <dl>
4355 <dt><i>a:b</i></dt>
4356 </dl>
4357 </dd>
4358 </dl>
4359 </dd>
4360 </dl>
4361 !! html/parsoid
4362 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4363 <dt><b>a:b</b></dt>
4364 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4365 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4366 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4367 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4368 <dd>b</dd>
4369 <dt><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:b"}},"i":0}}]}'>a:b</span></dt>
4370 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4371 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4372 !! end
4373
4374 !! test
4375 Definition Lists: colons and tables 1
4376 !! wikitext
4377 :{|
4378 | x
4379 |}
4380 :{|
4381 | y
4382 |}
4383 !! html
4384 <dl><dd><table>
4385 <tr>
4386 <td> x
4387 </td></tr></table></dd></dl>
4388 <dl><dd><table>
4389 <tr>
4390 <td> y
4391 </td></tr></table></dd></dl>
4392
4393 !! end
4394
4395 # Parsoid's output (as documented below) differs from php's in this case.
4396 # This is probably a bug. If we fixup parsoid to match php's output, the
4397 # above test should pass and the below test case can be removed. It is
4398 # unclear which output is more desirable.
4399
4400 !! test
4401 Definition Lists: colons and tables 2
4402 !! wikitext
4403 :{|
4404 | x
4405 |}
4406 :{|
4407 | y
4408 |}
4409 !! html/parsoid
4410 <dl><dd><table>
4411 <tr>
4412 <td> x
4413 </td></tr></table></dd>
4414 <dd><table>
4415 <tr>
4416 <td> y
4417 </td></tr></table></dd></dl>
4418 !! end
4419
4420 !! test
4421 Definition Lists: template interaction
4422 !! wikitext
4423 ::{{definition_list}}
4424
4425 :one
4426 ::{{definition_list}}
4427 :::two
4428 :::three
4429 ::four
4430 !! html/parsoid
4431 <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">
4432 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4433
4434 <dl><dd data-parsoid='{}'>one
4435 <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">
4436 </span><dd about="#mwt2">two
4437 <dl><dd>two</dd>
4438 <dd>three</dd></dl></dd>
4439 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4440 !! end
4441
4442
4443 ###
4444 ### External links
4445 ###
4446 !! test
4447 External links: non-bracketed
4448 !! wikitext
4449 Non-bracketed: http://example.com
4450 !! html
4451 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4452 </p>
4453 !! end
4454
4455 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4456 !! test
4457 External links: numbered
4458 !! wikitext
4459 Numbered: [http://example.com]
4460 Numbered: [http://example.net]
4461 Numbered: [http://example.com]
4462 !! html/php
4463 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4464 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4465 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4466 </p>
4467 !! html/parsoid
4468 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4469 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4470 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4471 !!end
4472
4473 !! test
4474 External links: specified text
4475 !! wikitext
4476 Specified text: [http://example.com link]
4477 !! html
4478 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4479 </p>
4480 !!end
4481
4482 !! test
4483 External links: trail
4484 !! wikitext
4485 Linktrails should not work for external links: [http://example.com link]s
4486 !! html
4487 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4488 </p>
4489 !! end
4490
4491 !! test
4492 External links: dollar sign in URL
4493 !! wikitext
4494 http://example.com/1$2345
4495 !! html
4496 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4497 </p>
4498 !! end
4499
4500 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4501 !! test
4502 External links: dollar sign in URL (autonumber)
4503 !! wikitext
4504 [http://example.com/1$2345]
4505 !! html/php
4506 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4507 </p>
4508 !! html/parsoid
4509 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4510 !!end
4511
4512 !! test
4513 External links: open square bracket forbidden in URL (bug 4377)
4514 !! options
4515 parsoid=wt2html,wt2wt,html2html
4516 !! wikitext
4517 http://example.com/1[2345
4518 !! html/php
4519 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4520 </p>
4521 !! html/parsoid
4522 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4523 !! end
4524
4525 !! test
4526 External links: open square bracket forbidden in URL (named) (bug 4377)
4527 !! options
4528 parsoid=wt2html,html2html
4529 !! wikitext
4530 [http://example.com/1[2345]
4531 !! html/php
4532 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4533 </p>
4534 !! html/parsoid
4535 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4536 !!end
4537
4538 # parsoid adds a space before the link name
4539 !! test
4540 External links: open square bracket forbidden in URL (named) (bug 4377)
4541 Parsoid variant.
4542 !! wikitext
4543 [http://example.com/1 [2345]
4544 !! html
4545 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4546 </p>
4547 !!end
4548
4549 !! test
4550 External links: nowiki in URL link text (bug 6230)
4551 !! wikitext
4552 [http://example.com/ <nowiki>''example site''</nowiki>]
4553 !! html
4554 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4555 </p>
4556 !! end
4557
4558 !! test
4559 External links: newline forbidden in text (bug 6230 regression check)
4560 !! wikitext
4561 [http://example.com/ first
4562 second]
4563 !! html
4564 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4565 second]
4566 </p>
4567 !!end
4568
4569 !! test
4570 External links: Pipe char between url and text
4571 !! wikitext
4572 [http://example.com | link]
4573 !! html
4574 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4575 </p>
4576 !!end
4577
4578 !! test
4579 External links: protocol-relative URL in brackets
4580 !! wikitext
4581 [//example.com/ Test]
4582 !! html
4583 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4584 </p>
4585 !! end
4586
4587 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4588 !! test
4589 External links: protocol-relative URL in brackets without text
4590 !! wikitext
4591 [//example.com]
4592 !! html/php
4593 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4594 </p>
4595 !! html/parsoid
4596 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4597 !! end
4598
4599 !! test
4600 External links: protocol-relative URL in free text is left alone
4601 !! wikitext
4602 //example.com/Foo
4603 !! html
4604 <p>//example.com/Foo
4605 </p>
4606 !!end
4607
4608 !! test
4609 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4610 !! wikitext
4611 foo//example.com/Foo
4612 !! html
4613 <p>foo//example.com/Foo
4614 </p>
4615 !! end
4616
4617 !! test
4618 External links: with no contents
4619 !! wikitext
4620 [http://en.wikipedia.org/wiki/Foo]
4621
4622 [[wikipedia:Foo|Bar]]
4623
4624 [[wikipedia:Foo|<span>Bar</span>]]
4625 !! html/php
4626 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4627 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4628 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4629 </p>
4630 !! html/parsoid
4631 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4632 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4633 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4634 !! end
4635
4636 !! test
4637 External links: Free with trailing punctuation
4638 !! wikitext
4639 http://example.com,
4640 http://example.com;
4641 http://example.com\
4642 http://example.com.
4643 http://example.com:
4644 http://example.com!
4645 http://example.com?
4646 http://example.com)
4647 http://example.com/url_with_(brackets)
4648 (http://example.com/url_without_brackets)
4649 http://example.com/url_with_entity&nbsp;
4650 http://example.com/url_with_entity&#xA0;
4651 http://example.com/url_with_entity&#160;
4652 http://example.com/url_with_entity&lt;
4653 http://example.com/url_with_entity&#x3C;
4654 http://example.com/url_with_entity&#60;
4655 !! html/php
4656 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4657 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4658 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4659 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4660 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4661 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4662 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4663 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4664 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4665 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4666 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4667 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4668 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4669 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4670 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4671 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4672 </p>
4673 !! html/parsoid
4674 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4675 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4676 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4677 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4678 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4679 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4680 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4681 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4682 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4683 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4684 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4685 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4686 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4687 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4688 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4689 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4690 !! end
4691
4692 !! test
4693 External links: Lone protocols are never linked (T105697)
4694 !! wikitext
4695 http://
4696 http://;
4697 (http://)
4698 bitcoin:
4699 bitcoin:;
4700 (bitcoin:)
4701 !! html
4702 <p>http://
4703 http://;
4704 (http://)
4705 bitcoin:
4706 bitcoin:;
4707 (bitcoin:)
4708 </p>
4709 !! end
4710
4711 !! test
4712 External links: No preceding word characters allowed (bug 65278)
4713 !! wikitext
4714 NOPEhttp://example.com
4715 N0http://example.com
4716 ok:http://example.com
4717 ok-http://example.com
4718 !! html
4719 <p>NOPEhttp://example.com
4720 N0http://example.com
4721 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4722 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4723 </p>
4724 !! end
4725
4726 !! test
4727 External image
4728 !! wikitext
4729 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4730 !! html
4731 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4732 </p>
4733 !! end
4734
4735 !! test
4736 External image from https
4737 !! wikitext
4738 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4739 !! html
4740 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4741 </p>
4742 !! end
4743
4744 !! test
4745 External image (when not allowed)
4746 !! options
4747 wgAllowExternalImages=0
4748 !! wikitext
4749 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4750 !! html
4751 <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>
4752 </p>
4753 !! end
4754
4755 !! test
4756 Link to non-http image, no img tag
4757 !! wikitext
4758 Link to non-http image, no img tag: ftp://example.com/test.jpg
4759 !! html
4760 <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>
4761 </p>
4762 !! end
4763
4764 !! test
4765 External links: terminating separator
4766 !! wikitext
4767 Terminating separator: http://example.com/thing,
4768 !! html
4769 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4770 </p>
4771 !! end
4772
4773 !! test
4774 External links: intervening separator
4775 !! wikitext
4776 Intervening separator: http://example.com/1,2,3
4777 !! html
4778 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4779 </p>
4780 !! end
4781
4782 !! test
4783 External links: old bug with URL in query
4784 !! wikitext
4785 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4786 !! html
4787 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4788 </p>
4789 !! end
4790
4791 !! test
4792 External links: old URL-in-URL bug, mixed protocols
4793 !! wikitext
4794 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4795 !! html
4796 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4797 </p>
4798 !!end
4799
4800 !! test
4801 External links: URL in text
4802 !! wikitext
4803 URL in text: [http://example.com http://example.com]
4804 !! html
4805 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4806 </p>
4807 !! end
4808
4809 !! test
4810 External links: Clickable images
4811 !! wikitext
4812 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4813 !! html/php
4814 <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>
4815 </p>
4816 !! html/parsoid
4817 <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>
4818 !! end
4819
4820 !! test
4821 External links: raw ampersand
4822 !! wikitext
4823 Old &amp; use: http://x&y
4824 !! html
4825 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4826 </p>
4827 !! end
4828
4829 !! test
4830 External links: encoded ampersand
4831 !! wikitext
4832 Old &amp; use: http://x&amp;y
4833 !! html/php
4834 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4835 </p>
4836 !! html/parsoid
4837 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4838 !! end
4839
4840 !! test
4841 External links: encoded equals (bug 6102)
4842 !! wikitext
4843 http://example.com/?foo&#61;bar
4844 !! html/php
4845 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4846 </p>
4847 !! html/parsoid
4848 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4849 !! end
4850
4851 ##
4852 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4853 ## does it number them. As discussed in bug 53505, we can identify
4854 ## autonumbered links via CSS.
4855 ##
4856
4857 !! test
4858 External links: [raw ampersand]
4859 !! wikitext
4860 Old &amp; use: [http://x&y]
4861 !! html/php
4862 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4863 </p>
4864 !! html/parsoid
4865 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4866 !! end
4867
4868 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4869 # mode will return the [raw ampersand] wikitext
4870 !! test
4871 External links: [encoded ampersand]
4872 !! options
4873 parsoid=wt2html,wt2wt,html2html
4874 !! wikitext
4875 Old &amp; use: [http://x&amp;y]
4876 !! html/php
4877 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4878 </p>
4879 !! html/parsoid
4880 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4881 !! end
4882
4883 !! test
4884 External links: [raw equals]
4885 !! wikitext
4886 [http://example.com/?foo=bar]
4887 !! html/php
4888 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4889 </p>
4890 !! html/parsoid
4891 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4892 !! end
4893
4894 # note that parsoid html is identical to [raw equals] case; so html2wt
4895 # mode will return the [raw equals] wikitext
4896 !! test
4897 External links: [encoded equals] (bug 6102)
4898 !! options
4899 parsoid=wt2html,wt2wt,html2html
4900 !! wikitext
4901 [http://example.com/?foo&#61;bar]
4902 !! html/php
4903 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4907 !! end
4908
4909 # xxx parsoid strips the IDN character, so the round-trip tests will
4910 # obviously fail and are disabled. --cscott
4911 !! test
4912 External links: [IDN ignored character reference in hostname; strip it right off]
4913 !! options
4914 parsoid=wt2html,wt2wt,html2html
4915 !! wikitext
4916 [http://e&zwnj;xample.com/]
4917 !! html/php
4918 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4919 </p>
4920 !! html/parsoid
4921 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4922 !! end
4923
4924 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4925 # Where an external link could easily circumvent the sanitization of the text of
4926 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4927 # test demands a higher standard. That's a bit strange.
4928 #
4929 # Example:
4930 #
4931 # http://e‌xample.com -> [http://example.com|http://example.com]
4932 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4933 #
4934 # The first example is sanitized, but the second is not. Any security benefits
4935 # from this production are trivial to circumvent. Either remove this test and
4936 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4937 # the test accordingly.
4938 #
4939 # All our love,
4940 # The Parsoid team.
4941 # xxx parsoid strips the IDN character, so the round-trip tests will
4942 # obviously fail and are disabled. --cscott
4943 !! test
4944 External links: IDN ignored character reference in hostname; strip it right off
4945 !! options
4946 parsoid=wt2html,html2html
4947 !! wikitext
4948 http://e&zwnj;xample.com/
4949 !! html/php
4950 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4951 </p>
4952 !! html/parsoid
4953 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4954 !! end
4955
4956 !! test
4957 External links: www.jpeg.org (bug 554)
4958 !! wikitext
4959 http://www.jpeg.org
4960 !! html
4961 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4962 </p>
4963 !! end
4964
4965 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4966 !! test
4967 External links: URL within URL (original bug 2)
4968 !! wikitext
4969 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4970 !! html/php
4971 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4972 </p>
4973 !! html/parsoid
4974 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4975 !! end
4976
4977 !! test
4978 BUG 361: URL inside bracketed URL
4979 !! wikitext
4980 [http://www.example.com/foo http://www.example.com/bar]
4981 !! html
4982 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4983 </p>
4984 !! end
4985
4986 !! test
4987 BUG 361: URL within URL, not bracketed
4988 !! wikitext
4989 http://www.example.com/foo?=http://www.example.com/bar
4990 !! html
4991 <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>
4992 </p>
4993 !! end
4994
4995 !! test
4996 BUG 289: ">"-token in URL-tail
4997 !! wikitext
4998 http://www.example.com/<hello>
4999 !! html
5000 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5001 </p>
5002 !!end
5003
5004 !! test
5005 BUG 289: literal ">"-token in URL-tail
5006 !! wikitext
5007 http://www.example.com/<b>html</b>
5008 !! html/php
5009 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5010 </p>
5011 !! html/parsoid
5012 <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>
5013 !! end
5014
5015 !! test
5016 BUG 289: ">"-token in bracketed URL
5017 !! wikitext
5018 [http://www.example.com/<hello> stuff]
5019 !! html
5020 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5021 </p>
5022 !!end
5023
5024 !! test
5025 BUG 289: literal ">"-token in bracketed URL
5026 !! wikitext
5027 [http://www.example.com/<b>html</b> stuff]
5028 !! html
5029 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5030 </p>
5031 !!end
5032
5033 !! test
5034 BUG 289: literal double quote at end of URL
5035 !! wikitext
5036 http://www.example.com/"hello"
5037 !! html
5038 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5039 </p>
5040 !!end
5041
5042 !! test
5043 BUG 289: literal double quote in bracketed URL
5044 !! wikitext
5045 [http://www.example.com/"hello" stuff]
5046 !! html
5047 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5048 </p>
5049 !!end
5050
5051 !! test
5052 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5053 !! wikitext
5054 [http://www.example.com test]
5055 !! html
5056 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5057 </p>
5058 !! end
5059
5060 !! test
5061 External links: link text with spaces
5062 !! wikitext
5063 [http://www.example.com a b c]
5064 [http://www.example.com ''a'' ''b'']
5065 !! html
5066 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5067 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5068 </p>
5069 !! end
5070
5071 !! test
5072 External links: wiki links within external link (Bug 3695)
5073 !! wikitext
5074 [http://example.com [[wikilink]] embedded in ext link]
5075 !! html/php
5076 <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>
5077 </p>
5078 !! html/parsoid
5079 <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>
5080 !! end
5081
5082 !! test
5083 BUG 787: Links with one slash after the url protocol are invalid
5084 !! wikitext
5085 http:/example.com
5086
5087 [http:/example.com title]
5088 !! html
5089 <p>http:/example.com
5090 </p><p>[http:/example.com title]
5091 </p>
5092 !! end
5093
5094 !! test
5095 Bracketed external links with template-generated invalid target
5096 !! wikitext
5097 [{{echo|http:/example.com}} title]
5098 !! html
5099 <p>[http:/example.com title]
5100 </p>
5101 !! end
5102
5103 !! test
5104 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5105 !! wikitext
5106 ''[http://example.com text'']
5107 [http://example.com '''text]'''
5108 ''Something [http://example.com in italic'']
5109 ''Something [http://example.com mixed''''', even bold]'''
5110 '''''Now [http://example.com both''''']
5111 !! html
5112 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5113 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5114 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5115 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5116 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5117 </p>
5118 !! end
5119
5120
5121 !! test
5122 Bug 4781: %26 in URL
5123 !! wikitext
5124 http://www.example.com/?title=AT%26T
5125 !! html/php
5126 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5127 </p>
5128 !! html/parsoid
5129 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5130 !! end
5131
5132 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5133 # % is actually legal in HTML5. Any change in output would need testing though.
5134 !! test
5135 Bug 4781, 5267: %25 in URL
5136 !! wikitext
5137 http://www.example.com/?title=100%25_Bran
5138 !! html/php
5139 <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>
5140 </p>
5141 !! html/parsoid
5142 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5143 !! end
5144
5145 !! test
5146 Bug 4781, 5267: %28, %29 in URL
5147 !! wikitext
5148 http://www.example.com/?title=Ben-Hur_%281959_film%29
5149 !! html/php
5150 <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>
5151 </p>
5152 !! html/parsoid
5153 <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>
5154 !! end
5155
5156
5157 !! test
5158 Bug 4781: %26 in autonumber URL
5159 !! wikitext
5160 [http://www.example.com/?title=AT%26T]
5161 !! html/php
5162 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5163 </p>
5164 !! html/parsoid
5165 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5166 !! end
5167
5168 !! test
5169 Bug 4781, 5267: %26 in autonumber URL
5170 !! wikitext
5171 [http://www.example.com/?title=100%25_Bran]
5172 !! html/php
5173 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5174 </p>
5175 !! html/parsoid
5176 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5177 !! end
5178
5179 !! test
5180 Bug 4781, 5267: %28, %29 in autonumber URL
5181 !! wikitext
5182 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5183 !! html/php
5184 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5185 </p>
5186 !! html/parsoid
5187 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5188 !! end
5189
5190
5191 !! test
5192 Bug 4781: %26 in bracketed URL
5193 !! wikitext
5194 [http://www.example.com/?title=AT%26T link]
5195 !! html/php
5196 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5197 </p>
5198 !! html/parsoid
5199 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5200 !! end
5201
5202 !! test
5203 Bug 4781, 5267: %25 in bracketed URL
5204 !! wikitext
5205 [http://www.example.com/?title=100%25_Bran link]
5206 !! html
5207 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5208 </p>
5209 !! end
5210
5211 !! test
5212 Bug 4781, 5267: %28, %29 in bracketed URL
5213 !! wikitext
5214 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5215 !! html/php
5216 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5217 </p>
5218 !! html/parsoid
5219 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5220 !! end
5221
5222 !! test
5223 External link containing a period in the anchor. (bug 63947)
5224 !! wikitext
5225 [//foo.org/bar#baz. bang]
5226
5227 [//foo.org/bar. bang]
5228 !! html/php
5229 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5234 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5235 !! end
5236
5237 !! test
5238 External link containing a single quote. (bug 63947)
5239 !! wikitext
5240 [//foo.org/bar'baz]
5241
5242 [//foo.org/bar'baz bang]
5243 !! html/php
5244 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5245 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5246 </p>
5247 !! html/parsoid
5248 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5249 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5250 !! end
5251
5252 !! test
5253 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5254 !! wikitext
5255 Some [http://example.com/ pretty ''italics'' and stuff]!
5256 !! html
5257 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5258 </p>
5259 !! end
5260
5261 !! test
5262 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5263 !! wikitext
5264 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5265 !! html
5266 <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>
5267 </p>
5268 !! end
5269
5270 !! test
5271 External link containing double-single-quotes with no space separating the url from text in italics
5272 !! wikitext
5273 [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]].]
5274 !! html/php
5275 <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>
5276 </p>
5277 !! html/php+tidy
5278 <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>
5279 !! html/parsoid
5280 <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>
5281 !! end
5282
5283 !! test
5284 External link with comments in link text
5285 !! wikitext
5286 [http://www.google.com Google <!-- comment -->]
5287 !! html/php
5288 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5289 </p>
5290 !! html/parsoid
5291 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5292 !! end
5293
5294 !! test
5295 External link to bare IPv4 address
5296 !! wikitext
5297 [http://192.168.0.1 Link]
5298 !! html/php
5299 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5300 </p>
5301 !! html/parsoid
5302 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5303 !! end
5304
5305 !! test
5306 URL-encoding in URL functions (single parameter)
5307 !! wikitext
5308 {{localurl:Some page|amp=&}}
5309 !! html
5310 <p>/index.php?title=Some_page&amp;amp=&amp;
5311 </p>
5312 !! end
5313
5314 !! test
5315 URL-encoding in URL functions (multiple parameters)
5316 !! wikitext
5317 {{localurl:Some page|q=?&amp=&}}
5318 !! html
5319 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5320 </p>
5321 !! end
5322
5323 !! test
5324 Brackets in urls
5325 !! wikitext
5326 http://example.com/index.php?foozoid%5B%5D=bar
5327
5328 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5329 !! html/php
5330 <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>
5331 </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>
5332 </p>
5333 !! html/parsoid
5334 <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>
5335
5336 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5337 !! end
5338
5339 !! test
5340 IPv6 urls, autolink format (T23261)
5341 !! wikitext
5342 http://[2404:130:0:1000::187:2]/index.php
5343
5344 Examples from RFC 2373, section 2.2:
5345 * http://[1080::8:800:200C:417A]/unicast
5346 * http://[FF01::101]/multicast
5347 * http://[::1]/loopback
5348 * http://[::]/unspecified
5349 * http://[::13.1.68.3]/ipv4compat
5350 * http://[::FFFF:129.144.52.38]/ipv4compat
5351
5352 Examples from RFC 2732, section 2:
5353 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5354 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5355 * http://[3ffe:2a00:100:7031::1]
5356 * http://[1080::8:800:200C:417A]/foo
5357 * http://[::192.9.5.5]/ipng
5358 * http://[::FFFF:129.144.52.38]:80/index.html
5359 * http://[2010:836B:4179::836B:4179]
5360
5361 !! html/php
5362 <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>
5363 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5364 </p>
5365 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5366 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5367 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5368 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5369 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5370 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5371 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5372 </p>
5373 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5374 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5375 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5376 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5377 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5378 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5379 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5380
5381 !! html/parsoid
5382 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5383
5384 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5385 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5386 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5387 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5388 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5389 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5390 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5391
5392 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5393 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5394 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5395 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5396 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5397 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5398 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5399 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5400 !! end
5401
5402 !! test
5403 IPv6 urls, bracketed format (T23261)
5404 !! wikitext
5405 [http://[2404:130:0:1000::187:2]/index.php test]
5406
5407 Examples from RFC 2373, section 2.2:
5408 * [http://[1080::8:800:200C:417A] unicast]
5409 * [http://[FF01::101] multicast]
5410 * [http://[::1]/ loopback]
5411 * [http://[::] unspecified]
5412 * [http://[::13.1.68.3] ipv4compat]
5413 * [http://[::FFFF:129.144.52.38] ipv4compat]
5414
5415 Examples from RFC 2732, section 2:
5416 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5417 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5418 * [http://[3ffe:2a00:100:7031::1] 3]
5419 * [http://[1080::8:800:200C:417A]/foo 4]
5420 * [http://[::192.9.5.5]/ipng 5]
5421 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5422 * [http://[2010:836B:4179::836B:4179] 7]
5423
5424 !! html/php
5425 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5426 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5427 </p>
5428 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5429 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5430 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5431 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5432 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5433 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5434 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5435 </p>
5436 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5437 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5438 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5439 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5440 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5441 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5442 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5443
5444 !! html/parsoid
5445 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5446
5447 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5448 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5449 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5450 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5451 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5452 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5453 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5454
5455 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5456 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5461 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5462 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5463 !! end
5464
5465 !! test
5466 Non-extlinks in brackets
5467 !! wikitext
5468 [foo]
5469 [foo bar]
5470 [foo ''bar'']
5471 [fool's] errand
5472 [fool's errand]
5473 [{{echo|foo}}]
5474 [{{echo|foo}} bar]
5475 [{{echo|foo}} ''bar'']
5476 [{{echo|foo}}l's] errand
5477 [{{echo|foo}}l's errand]
5478 [url={{echo|foo}}]
5479 [url=http://example.com]
5480 [http:// bare protocols don't count]
5481 !! html/php
5482 <p>[foo]
5483 [foo bar]
5484 [foo <i>bar</i>]
5485 [fool's] errand
5486 [fool's errand]
5487 [foo]
5488 [foo bar]
5489 [foo <i>bar</i>]
5490 [fool's] errand
5491 [fool's errand]
5492 [url=foo]
5493 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5494 [http:// bare protocols don't count]
5495 </p>
5496 !! html/parsoid
5497 <p>[foo]
5498 [foo bar]
5499 [foo <i>bar</i>]
5500 [fool's] errand
5501 [fool's errand]
5502 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5503 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5504 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5505 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5506 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5507 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5508 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5509 [http:// bare protocols don't count]</p>
5510 !! end
5511
5512 !! test
5513 Percent encoding in external links
5514 !! wikitext
5515 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5516 !! html/php
5517 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5518 </p>
5519 !! html/parsoid
5520 <p><a rel="mw:ExtLink"
5521 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5522 !! end
5523
5524 !! test
5525 Use url link syntax for links where the content is equal the link target
5526 !! wikitext
5527 http://example.com
5528 !! html/php
5529 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5530 </p>
5531 !! html/parsoid
5532 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5533 !! end
5534
5535 !! test
5536 Parenthesis in external links, especially URL links
5537 !! wikitext
5538 http://example.com)
5539
5540 http://example.com/test)
5541
5542 http://example.com/(test)
5543
5544 http://example.com/((test)
5545
5546 (http://example.com/(test))
5547
5548 (http://example.com/(test)))))
5549
5550 http://example.com/a)b
5551
5552 [http://example.com) foo]
5553 !! html/php
5554 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5555 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5556 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5557 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5558 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5559 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5560 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5561 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5562 </p>
5563 !! html/parsoid
5564 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5565 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5566 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5567 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5568 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5569 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5570 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5571 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5572 !! end
5573
5574 !! test
5575 Parenthesis in external links, w/ transclusion or comment
5576 !! wikitext
5577 (http://example.com/{{echo|hi}})
5578
5579 (http://example.com<!-- hi -->)
5580 !! html/php
5581 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5582 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5583 </p>
5584 !! html/parsoid
5585 <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>
5586
5587 <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>
5588 !! end
5589
5590 !! test
5591 Serialize <a> tags with invalid link targets as plain text
5592 !! options
5593 parsoid=html2wt
5594 !! html/parsoid
5595 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5596 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5597 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5598 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5599 !! wikitext
5600 text
5601 <nowiki>*</nowiki>text
5602 <nowiki>[[foo]]</nowiki>
5603 <nowiki>*a [[foo]]</nowiki>
5604 !! end
5605
5606 !! test
5607 mw:ExtLink -vs- mw:WikiLink (T94723)
5608 !! options
5609 parsoid=html2wt
5610 !! html/parsoid
5611 <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>
5612 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5613 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5614 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5615 <p>
5616 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5617 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5618 </p>
5619 !! wikitext
5620 [[Foo|Bar]]
5621 [[Foo|Bar]]
5622 [[wikipedia:Foo|Bar]]
5623 [[wikipedia:Foo|Bar]]
5624
5625 [[wikipedia:European_Robin|European Robin]]
5626 [[wikipedia:European_Robin|European Robin]]
5627 !! end
5628
5629 !! test
5630 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5631 !! options
5632 parsoid=wt2wt
5633 !! wikitext
5634 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5635 !! html/parsoid
5636 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5637 !! end
5638
5639
5640 ###
5641 ### Quotes
5642 ###
5643
5644 !! test
5645 Quotes
5646 !! wikitext
5647 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5648
5649 Normal text. '''''Bold italic text.''''' Normal text.
5650 !! html
5651 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5652 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5653 </p>
5654 !! end
5655
5656
5657 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5658 # parser strips. The wikitext contains just the first half of the bold
5659 # quote pair.
5660 !! test
5661 Unclosed and unmatched quotes
5662 !! wikitext
5663 '''''Bold italic text '''with bold deactivated''' in between.'''''
5664
5665 '''''Bold italic text ''with italic deactivated'' in between.'''''
5666
5667 '''Bold text..
5668
5669 ..spanning two paragraphs (should not work).'''
5670
5671 '''Bold tag left open
5672
5673 ''Italic tag left open
5674
5675 Normal text.
5676
5677 <!-- Unmatching number of opening, closing tags: -->
5678 '''This year''''s election ''should'' beat '''last year''''s.
5679
5680 ''Tom'''s car is bigger than ''Susan'''s.
5681
5682 Plain ''italic'''s plain
5683 !! html/php
5684 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5685 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5686 </p><p><b>Bold text..</b>
5687 </p><p>..spanning two paragraphs (should not work).
5688 </p><p><b>Bold tag left open</b>
5689 </p><p><i>Italic tag left open</i>
5690 </p><p>Normal text.
5691 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5692 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5693 </p><p>Plain <i>italic'</i>s plain
5694 </p>
5695 !! html/parsoid
5696 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5697 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5698 </p><p><b>Bold text..</b>
5699 </p><p>..spanning two paragraphs (should not work).<b></b>
5700 </p><p><b>Bold tag left open</b>
5701 </p><p><i>Italic tag left open</i>
5702 </p><p>Normal text.
5703 </p>
5704 <!-- Unmatching number of opening, closing tags: -->
5705 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5706 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5707 </p><p>Plain <i>italic'</i>s plain
5708 </p>
5709 !! end
5710
5711 ###
5712 ### Tables
5713 ###
5714 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User's_Guide:_Using_tables
5715 ###
5716
5717 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5718 # is the bare minimum required by the spec, see:
5719 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5720 # Parsoid team replies: empty table tags are legal in HTML5
5721 !! test
5722 A table with no data.
5723 !! options
5724 parsoid=wt2html
5725 !! wikitext
5726 {||}
5727 !! html/php
5728
5729 !! html/parsoid
5730 <table></table>
5731
5732 !! end
5733
5734 !! test
5735 A table with stray table end tags on start tag line (wt2html)
5736 !! options
5737 parsoid=wt2html
5738 !! wikitext
5739 {|style="color: red;"|}
5740
5741 {|style="color: red;" |}
5742 |foo
5743 |}
5744
5745 {|style="color: red;"|} id="foo"
5746 |foo
5747 |}
5748
5749 {|style="color: red;" |} id="foo"
5750 |foo
5751 |}
5752 !! html
5753 <table style="color: red;"></table>
5754
5755 <table style="color: red;">
5756 <tbody><tr>
5757 <td>foo</td>
5758 </tr></tbody>
5759 </table>
5760
5761 <table style="color: red;" id="foo">
5762 <tbody><tr>
5763 <td>foo</td>
5764 </tr></tbody>
5765 </table>
5766
5767 <table style="color: red;" id="foo">
5768 <tbody><tr>
5769 <td>foo</td>
5770 </tr></tbody>
5771 </table>
5772
5773 !! end
5774
5775 !! test
5776 A table with no data (take 2)
5777 !! wikitext
5778 {|
5779 |}
5780 !! html/parsoid
5781 <table></table>
5782 !! end
5783
5784 # A table with nothing but a caption is invalid XHTML, we might want to render
5785 # this as <p>caption</p>
5786 # Parsoid team replies: table with only a caption is legal in HTML5
5787 !! test
5788 A table with nothing but a caption
5789 !! wikitext
5790 {|
5791 |+ caption
5792 |}
5793 !! html/php
5794 <table>
5795 <caption> caption
5796 </caption><tr><td></td></tr></table>
5797
5798 !! html/parsoid
5799 <table><caption> caption</caption></table>
5800 !! end
5801
5802 !! test
5803 A table with caption with default-spaced attributes and a table row
5804 !! wikitext
5805 {|
5806 |+ style="color: red;" | caption1
5807 |-
5808 | foo
5809 |}
5810 !! html
5811 <table>
5812 <caption style="color: red;"> caption1
5813 </caption>
5814 <tr>
5815 <td> foo
5816 </td></tr></table>
5817
5818 !! end
5819
5820 !! test
5821 A table with captions with non-default spaced attributes and a table row
5822 !! wikitext
5823 {|
5824 |+style="color: red;"|caption2
5825 |+ style="color: red;"| caption3
5826 |-
5827 | foo
5828 |}
5829 !! html
5830 <table>
5831 <caption style="color: red;">caption2
5832 </caption>
5833 <caption style="color: red;"> caption3
5834 </caption>
5835 <tr>
5836 <td> foo
5837 </td></tr></table>
5838
5839 !! end
5840
5841 !! test
5842 Table td-cell syntax variations
5843 !! wikitext
5844 {|
5845 | foo bar foo | baz
5846 | foo bar foo || baz
5847 | style='color:red;' | baz
5848 | style='color:red;' || baz
5849 |}
5850 !! html
5851 <table>
5852 <tr>
5853 <td> baz
5854 </td>
5855 <td> foo bar foo </td>
5856 <td> baz
5857 </td>
5858 <td style="color:red;"> baz
5859 </td>
5860 <td> style='color:red;' </td>
5861 <td> baz
5862 </td></tr></table>
5863
5864 !! end
5865
5866 !! test
5867 Simple table
5868 !! wikitext
5869 {|
5870 | 1 || 2
5871 |-
5872 | 3 || 4
5873 |}
5874 !! html
5875 <table>
5876 <tr>
5877 <td> 1 </td>
5878 <td> 2
5879 </td></tr>
5880 <tr>
5881 <td> 3 </td>
5882 <td> 4
5883 </td></tr></table>
5884
5885 !! end
5886
5887 !! test
5888 Simple table but with multiple dashes for row wikitext
5889 !! wikitext
5890 {|
5891 | foo
5892 |-----
5893 | bar
5894 |}
5895 !! html
5896 <table>
5897 <tr>
5898 <td> foo
5899 </td></tr>
5900 <tr>
5901 <td> bar
5902 </td></tr></table>
5903
5904 !! end
5905
5906 !! test
5907 Multiplication table
5908 !! wikitext
5909 {| border="1" cellpadding="2"
5910 |+Multiplication table
5911 |-
5912 ! &times; !! 1 !! 2 !! 3
5913 |-
5914 ! 1
5915 | 1 || 2 || 3
5916 |-
5917 ! 2
5918 | 2 || 4 || 6
5919 |-
5920 ! 3
5921 | 3 || 6 || 9
5922 |-
5923 ! 4
5924 | 4 || 8 || 12
5925 |-
5926 ! 5
5927 | 5 || 10 || 15
5928 |}
5929 !! html
5930 <table border="1" cellpadding="2">
5931 <caption>Multiplication table
5932 </caption>
5933 <tr>
5934 <th> &#215; </th>
5935 <th> 1 </th>
5936 <th> 2 </th>
5937 <th> 3
5938 </th></tr>
5939 <tr>
5940 <th> 1
5941 </th>
5942 <td> 1 </td>
5943 <td> 2 </td>
5944 <td> 3
5945 </td></tr>
5946 <tr>
5947 <th> 2
5948 </th>
5949 <td> 2 </td>
5950 <td> 4 </td>
5951 <td> 6
5952 </td></tr>
5953 <tr>
5954 <th> 3
5955 </th>
5956 <td> 3 </td>
5957 <td> 6 </td>
5958 <td> 9
5959 </td></tr>
5960 <tr>
5961 <th> 4
5962 </th>
5963 <td> 4 </td>
5964 <td> 8 </td>
5965 <td> 12
5966 </td></tr>
5967 <tr>
5968 <th> 5
5969 </th>
5970 <td> 5 </td>
5971 <td> 10 </td>
5972 <td> 15
5973 </td></tr></table>
5974
5975 !! end
5976
5977 !! test
5978 Accept "||" in table headings
5979 !! wikitext
5980 {|
5981 !h1 || h2
5982 |}
5983 !! html
5984 <table>
5985 <tr>
5986 <th>h1 </th>
5987 <th> h2
5988 </th></tr></table>
5989
5990 !! end
5991
5992 !! test
5993 Accept "!!" in table data
5994 !! wikitext
5995 {|
5996 | Foo!! ||
5997 |}
5998 !! html
5999 <table>
6000 <tr>
6001 <td> Foo!! </td>
6002 <td>
6003 </td></tr></table>
6004
6005 !! html/parsoid
6006 <table>
6007 <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>
6008 </tbody></table>
6009 !! end
6010
6011 !! test
6012 Accept "||" in indented table headings
6013 !! wikitext
6014 :{|
6015 !h1 || h2
6016 |}
6017 !! html
6018 <dl><dd><table>
6019 <tr>
6020 <th>h1 </th>
6021 <th> h2
6022 </th></tr></table></dd></dl>
6023
6024 !! end
6025
6026 !! test
6027 Accept "!!" in templates
6028 !! wikitext
6029 {|
6030 !a {{echo|b!!c}}
6031 |}
6032 !! html/php
6033 <table>
6034 <tr>
6035 <th>a b</th>
6036 <th>c
6037 </th></tr></table>
6038
6039 !! html/parsoid
6040 <table>
6041 <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>
6042 !! end
6043
6044 !! test
6045 Accept "!!" in table headings after newline
6046 !! wikitext
6047 {|
6048 !a
6049 b!!c
6050 |}
6051 !! html/php
6052 <table>
6053 <tr>
6054 <th>a
6055 <p>b!!c
6056 </p>
6057 </th></tr></table>
6058
6059 !! html/parsoid
6060 <table>
6061 <tbody><tr><th>a
6062 <p>b!!c</p></th></tr>
6063 </tbody></table>
6064 !! end
6065
6066 !! test
6067 Accept "!!" in table data of mixed wikitext / html syntax
6068 !! wikitext
6069 {|
6070 !a
6071 <tr><td>b!!c</td></tr>
6072 |}
6073 !! html+tidy
6074 <table>
6075 <tr>
6076 <th>a</th>
6077 </tr>
6078 <tr>
6079 <td>b!!c</td>
6080 </tr>
6081 </table>
6082 !! html/parsoid
6083 <table>
6084 <tbody><tr><th>a</th></tr>
6085 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6086 </tbody></table>
6087 !! end
6088
6089 !! test
6090 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6091 !! wikitext
6092 {|
6093 !| h1
6094 || a
6095 |}
6096 !! html
6097 <table>
6098 <tr>
6099 <th> h1
6100 </th>
6101 <td> a
6102 </td></tr></table>
6103
6104 !! end
6105
6106 !!test
6107 Accept "| !" at start of line in tables (ignore !-attribute)
6108 !! wikitext
6109 {|
6110 |-
6111 | !style="color:red" | bar
6112 |}
6113 !! html
6114 <table>
6115
6116 <tr>
6117 <td> bar
6118 </td></tr></table>
6119
6120 !!end
6121
6122 !!test
6123 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 +/-
6124 !! wikitext
6125 {|
6126 |-
6127 |style='color:red;'|+1
6128 |style='color:blue;'|-1
6129 |-
6130 | 1 || 2 || 3
6131 | 1 ||+2 ||-3
6132 |-
6133 | +1
6134 | -1
6135 |}
6136 !! html
6137 <table>
6138
6139 <tr>
6140 <td style="color:red;">+1
6141 </td>
6142 <td style="color:blue;">-1
6143 </td></tr>
6144 <tr>
6145 <td> 1 </td>
6146 <td> 2 </td>
6147 <td> 3
6148 </td>
6149 <td> 1 </td>
6150 <td>+2 </td>
6151 <td>-3
6152 </td></tr>
6153 <tr>
6154 <td> +1
6155 </td>
6156 <td> -1
6157 </td></tr></table>
6158
6159 !!end
6160
6161 !! test
6162 Table rowspan
6163 !! wikitext
6164 {| border=1
6165 | Cell 1, row 1
6166 |rowspan=2| Cell 2, row 1 (and 2)
6167 | Cell 3, row 1
6168 |-
6169 | Cell 1, row 2
6170 | Cell 3, row 2
6171 |}
6172 !! html
6173 <table border="1">
6174 <tr>
6175 <td> Cell 1, row 1
6176 </td>
6177 <td rowspan="2"> Cell 2, row 1 (and 2)
6178 </td>
6179 <td> Cell 3, row 1
6180 </td></tr>
6181 <tr>
6182 <td> Cell 1, row 2
6183 </td>
6184 <td> Cell 3, row 2
6185 </td></tr></table>
6186
6187 !! end
6188
6189 !! test
6190 Nested table
6191 !! wikitext
6192 {| border=1
6193 | &alpha;
6194 |
6195 {| bgcolor=#ABCDEF border=2
6196 |nested
6197 |-
6198 |table
6199 |}
6200 |the original table again
6201 |}
6202 !! html
6203 <table border="1">
6204 <tr>
6205 <td> &#945;
6206 </td>
6207 <td>
6208 <table bgcolor="#ABCDEF" border="2">
6209 <tr>
6210 <td>nested
6211 </td></tr>
6212 <tr>
6213 <td>table
6214 </td></tr></table>
6215 </td>
6216 <td>the original table again
6217 </td></tr></table>
6218
6219 !! end
6220
6221 !! test
6222 Invalid attributes in table cell (bug 1830)
6223 !! wikitext
6224 {|
6225 |Cell:|broken
6226 |}
6227 !! html
6228 <table>
6229 <tr>
6230 <td>broken
6231 </td></tr></table>
6232
6233 !! end
6234
6235 !! test
6236 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6237 !! wikitext
6238 {|
6239 | title="foo" |bar
6240 | title="foo<nowiki>|</nowiki>" |bar
6241 | title="foo<nowiki>|</nowiki>" bar
6242 |}
6243 !! html
6244 <table>
6245 <tr>
6246 <td title="foo">bar
6247 </td>
6248 <td title="foo&#124;">bar
6249 </td>
6250 <td> title="foo|" bar
6251 </td></tr></table>
6252
6253 !! end
6254
6255 # The "|}" to close the table is missing from the input, so parsoid's
6256 # *2wt modes will fail.
6257 !! test
6258 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6259 !! options
6260 parsoid=wt2html,html2html
6261 !! wikitext
6262 {|
6263 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6264 !! html/php
6265 <table>
6266 <tr>
6267 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6268 <td>]" onmouseover="alert(document.cookie)"&gt;test
6269 </td>
6270 </tr>
6271 </table>
6272
6273 !! html/parsoid
6274 <table><tbody>
6275 <tr>
6276 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6277 !! end
6278
6279 # FIXME: The php output is broken.
6280 !! test
6281 ! and || in td attributes should not be parsed as <th>/<td>
6282 !! wikitext
6283 {|
6284 | style="color: red !important;" data-contrived="put this here ||" | foo
6285 |}
6286 !! html/php
6287 <table>
6288 <tr>
6289 <td> style="color: red !important;" data-contrived="put this here </td>
6290 <td> foo
6291 </td></tr></table>
6292
6293 !! html/parsoid
6294 <table>
6295 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6296 </tbody></table>
6297 !! end
6298
6299 !! test
6300 Indented table markup mixed with indented pre content (proposed in bug 6200)
6301 !! wikitext
6302 <table>
6303 <tr>
6304 <td>
6305 Text that should be rendered preformatted
6306 </td>
6307 </tr>
6308 </table>
6309 !! html
6310 <table>
6311 <tr>
6312 <td>
6313 <pre>Text that should be rendered preformatted
6314 </pre>
6315 </td>
6316 </tr>
6317 </table>
6318
6319 !! end
6320
6321 !! test
6322 1. Template-generated table cell attributes and cell content
6323 !! wikitext
6324 {|
6325 |{{table_attribs}}
6326 | {{table_attribs}}
6327 || {{table_attribs_5}}
6328 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6329 |align=center {{table_attribs}}
6330 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6331 |}
6332 !! html
6333 <table>
6334 <tr>
6335 <td style="color:red;">Foo
6336 </td>
6337 <td style="color:red;">Foo
6338 </td>
6339 <td> style="color:red;"</td>
6340 <td>Bar
6341 </td>
6342 <td style="color:red;">Foo
6343 </td>
6344 <td align="center" style="color:red;">Foo
6345 </td>
6346 <td align="center" style="color:red;">Foo
6347 </td></tr></table>
6348
6349 !! end
6350
6351 !! test
6352 2. Template-generated table cell attributes and cell content
6353 !! wikitext
6354 {|
6355 |{{table_attribs_2}}
6356 |}
6357 !! html/php
6358 <table>
6359 <tr>
6360 <td style="color:red;">Foo
6361 </td>
6362 <td>Bar</td>
6363 <td>Baz
6364 </td></tr></table>
6365
6366 !! html/parsoid
6367 <table>
6368 <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>
6369 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6370 </tbody></table>
6371 !! end
6372
6373 !! test
6374 3. Template-generated table cell attributes and cell content
6375 !! wikitext
6376 {|
6377 !align=center {{table_header_cells}}
6378 |-
6379 |align=center {{table_cells}}
6380 |}
6381 !! html/php
6382 <table>
6383 <tr>
6384 <th align="center" style="color:red;">Foo</th>
6385 <th style="color:red;"><i>Bar</i></th>
6386 <th style="color:brown;"><i>Foo</i> and Baz
6387 </th></tr>
6388 <tr>
6389 <td align="center" style="color:red;">Foo</td>
6390 <td style="color:red;"><i>Bar</i></td>
6391 <td style="color:brown;"><i>Foo</i> and Baz
6392 </td></tr></table>
6393
6394 !! html/parsoid
6395 <table>
6396 <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>
6397 <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>
6398 </tbody></table>
6399 !! end
6400
6401 !! test
6402 4. Template-generated table cell attributes and cell content inside a templated table
6403 !! wikitext
6404 {{tbl-start}}
6405 !align=center {{table_header_cells}}
6406 |-
6407 |align=center {{table_cells}}
6408 {{tbl-end}}
6409 !! html/php
6410 <table>
6411 <tr>
6412 <th align="center" style="color:red;">Foo</th>
6413 <th style="color:red;"><i>Bar</i></th>
6414 <th style="color:brown;"><i>Foo</i> and Baz
6415 </th></tr>
6416 <tr>
6417 <td align="center" style="color:red;">Foo</td>
6418 <td style="color:red;"><i>Bar</i></td>
6419 <td style="color:brown;"><i>Foo</i> and Baz
6420 </td></tr></table>
6421
6422 !! html/parsoid
6423 <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}}]}'>
6424 <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>
6425 <tr>
6426 <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>
6427 </tbody></table>
6428 !! end
6429
6430 ## Edge case fix to prevent future regressions
6431 !! test
6432 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6433 !! wikitext
6434 {|
6435 |{{table_attribs_7}}
6436 |}
6437 <references />
6438 !! html/parsoid
6439 <table>
6440 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6441 </tbody></table>
6442 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6443 !! end
6444
6445 !! test
6446 Table with row followed by newlines and table heading
6447 !! wikitext
6448 {|
6449 |-
6450
6451 ! foo
6452 |}
6453 !! html
6454 <table>
6455
6456
6457 <tr>
6458 <th> foo
6459 </th></tr></table>
6460
6461 !! end
6462
6463 !! test
6464 Table with empty line following the start tag
6465 !! wikitext
6466 {|
6467
6468 |-
6469 | foo
6470 |}
6471 !! html
6472 <table>
6473
6474
6475 <tr>
6476 <td> foo
6477 </td></tr></table>
6478
6479 !! end
6480
6481 # FIXME: Preserve the attribute properly (with an empty string as value) in
6482 # the PHP parser. Parsoid implements the behavior below.
6483 !! test
6484 Table attributes with empty value
6485 !! wikitext
6486 {|
6487 | style=| hello
6488 |}
6489 !! html/parsoid
6490 <table>
6491 <tbody>
6492 <tr>
6493 <td style=""> hello
6494 </td></tr></tbody></table>
6495
6496 !! end
6497
6498 !! test
6499 Wikitext table with a lot of comments
6500 !! wikitext
6501 {|
6502 <!-- c0 -->
6503 | foo
6504 <!-- c1 -->
6505 |-<!-- c2 -->
6506 <!-- c3 -->
6507 |<!-- c4 -->
6508 <!-- c5 -->
6509 |}
6510 !! html
6511 <table>
6512 <tr>
6513 <td> foo
6514 </td></tr>
6515 <tr>
6516 <td>
6517 </td></tr></table>
6518
6519 !! end
6520
6521 !! test
6522 Wikitext table comments represented in parsoid dom
6523 !! wikitext
6524 {|<!--c1--><!--c2-->
6525 |-<!--c3-->
6526 | x
6527 |}
6528 !! html/php+tidy
6529 <table>
6530 <tr>
6531 <td>x</td>
6532 </tr>
6533 </table>
6534 !! html/parsoid
6535 <table><!--c1--><!--c2-->
6536 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6537 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6538 </tbody></table>
6539 !! end
6540
6541 !! test
6542 Wikitext table with double-line table cell
6543 !! wikitext
6544 {|
6545 |a
6546 b
6547 |}
6548 !! html
6549 <table>
6550 <tr>
6551 <td>a
6552 <p>b
6553 </p>
6554 </td></tr></table>
6555
6556 !! end
6557
6558 !! test
6559 Table cell with a single comment
6560 !! wikitext
6561 {|
6562 | <!-- c1 -->
6563 | a
6564 |}
6565 !! html
6566 <table>
6567 <tr>
6568 <td>
6569 </td>
6570 <td> a
6571 </td></tr></table>
6572
6573 !! end
6574
6575 !! test
6576 Table-cell after a comment-only-empty-line
6577 !! wikitext
6578 {|
6579 |a
6580 <!--c1-->
6581 <!--c2-->| b
6582 |}
6583 !! html
6584 <table>
6585 <tr>
6586 <td>a
6587 </td>
6588 <td> b
6589 </td></tr></table>
6590
6591 !! html/parsoid
6592 <table>
6593 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6594 <!--c1-->
6595 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6596 </tbody></table>
6597
6598 !! end
6599
6600 !! test
6601 Build table with {{!}}
6602 !! wikitext
6603 {{{!}} class="wikitable"
6604 ! header
6605 ! second header
6606 {{!}}- style="color:red;"
6607 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6608 {{!}}}
6609 !! html
6610 <table class="wikitable">
6611 <tr>
6612 <th> header
6613 </th>
6614 <th> second header
6615 </th></tr>
6616 <tr style="color:red;">
6617 <td> data </td>
6618 <td style="color:red;"> second data
6619 </td></tr></table>
6620
6621 !! end
6622
6623 !! test
6624 Build table with pipe as data
6625 !! wikitext
6626 {| class="wikitable"
6627 ! header
6628 ! second header
6629 |- style="color:red;"
6630 | data || style="color:red;" | second data
6631 |-
6632 | style="color:red;" | data with | || style="color:red;" | second data with |
6633 |-
6634 || data with | ||| second data with |
6635 |}
6636 !! html
6637 <table class="wikitable">
6638 <tr>
6639 <th> header
6640 </th>
6641 <th> second header
6642 </th></tr>
6643 <tr style="color:red;">
6644 <td> data </td>
6645 <td style="color:red;"> second data
6646 </td></tr>
6647 <tr>
6648 <td style="color:red;"> data with | </td>
6649 <td style="color:red;"> second data with |
6650 </td></tr>
6651 <tr>
6652 <td> data with | </td>
6653 <td> second data with |
6654 </td></tr></table>
6655
6656 !! end
6657
6658 !! test
6659 Build table with wikilink
6660 !! wikitext
6661 {| class="wikitable"
6662 ! header || second header
6663 |- style="color:red;"
6664 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6665 |-
6666 | data || second data [[Main Page|link|text with pipe]]
6667 |}
6668 !! html
6669 <table class="wikitable">
6670 <tr>
6671 <th> header </th>
6672 <th> second header
6673 </th></tr>
6674 <tr style="color:red;">
6675 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6676 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6677 </td></tr>
6678 <tr>
6679 <td> data </td>
6680 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6681 </td></tr></table>
6682
6683 !! end
6684
6685 # The expected HTML structure in this test is debatable. The PHP parser does
6686 # not parse this kind of table at all. The main focus for Parsoid is on
6687 # round-tripping, so this output is ok for now. TODO: revisit!
6688 !! test
6689 Wikitext table with html-syntax row
6690 !! wikitext
6691 {|
6692 |-
6693 <td>foo</td>
6694 |}
6695 !! html/parsoid
6696 <table>
6697 <tbody>
6698 <tr>
6699 <td>foo</td></tr></tbody></table>
6700 !! end
6701
6702 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6703 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6704 ## PHP parser, which tidy then compounds by fostering the content
6705 ## entirely out of the table. Parsoid recognizes the table context
6706 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6707 ## depends on PHP's treatment of broken table markup!
6708 !! test
6709 Implicit <td> after a |-
6710 !! options
6711 parsoid=wt2html,html2html
6712 !! wikitext
6713 {|
6714 |-
6715 a
6716 |}
6717 !! html/php
6718 <table>
6719
6720 a
6721 </table>
6722
6723 !! html/php+tidy
6724 <p>a</p>
6725 !! html/parsoid
6726 <table>
6727 <tr><td>a</td></tr>
6728 </table>
6729 !! end
6730
6731 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6732 !! test
6733 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6734 !! options
6735 parsoid=wt2html,html2html
6736 !! wikitext
6737 {|
6738 |-
6739 |
6740 a
6741 |-
6742 b
6743 |}
6744 !! html/php
6745 <table>
6746
6747 <tr>
6748 <td>
6749 <pre>a
6750 </pre>
6751 </td></tr>
6752 b
6753 </table>
6754
6755 !! html/php+tidy
6756 <p>b</p>
6757 <table>
6758 <tr>
6759 <td>
6760 <pre>
6761 a
6762 </pre></td>
6763 </tr>
6764 </table>
6765 !! html/parsoid
6766 <table>
6767 <tbody>
6768 <tr><td><pre>a</pre></td></tr>
6769 <tr><td> b</td></tr>
6770 </tbody>
6771 </table>
6772 !! end
6773
6774 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6775 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6776 !! test
6777 Lists should be recognized in an implicit <td> context
6778 !! options
6779 parsoid=wt2html,html2html
6780 !! wikitext
6781 {|
6782 |-
6783 *a
6784 |}
6785 !! html/php
6786 <table>
6787
6788 <ul><li>a</li></ul>
6789 </table>
6790
6791 !! html/php+tidy
6792 <ul>
6793 <li>a</li>
6794 </ul>
6795 !! html/parsoid
6796 <table>
6797 <tr>
6798 <td><ul>
6799 <li>a</li>
6800 </ul></td>
6801 </tr>
6802 </table>
6803 !! end
6804
6805 !! test
6806 Table cells not properly parsed in an implicit-td context
6807 !! wikitext
6808 {|
6809 |-
6810 {{table_attribs_4}} || a || b
6811 |}
6812 !! html/php+tidy
6813 <table>
6814 <tr>
6815 <td style="background-color:#DC241f;" width="10px"></td>
6816 <td>a</td>
6817 <td>b</td>
6818 </tr>
6819 </table>
6820 !! html/parsoid
6821 <table>
6822 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6823 <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>
6824 </tbody></table>
6825 !! end
6826
6827 !! test
6828 Parsoid: Round-trip tables directly followed by content (bug 51219)
6829 !! options
6830 parsoid=wt2html,wt2wt
6831 !! wikitext
6832 {|
6833 |foo
6834 |} bar
6835
6836 {|
6837 |baz
6838 |}<b>quux</b>
6839 !! html+tidy
6840 <table>
6841 <tr>
6842 <td>foo</td>
6843 </tr>
6844 </table>
6845 <p>bar</p>
6846 <table>
6847 <tr>
6848 <td>baz</td>
6849 </tr>
6850 </table>
6851 <p><b>quux</b></p>
6852 !! end
6853
6854 !! test
6855 Parsoid: Default to a newline after tables in new content (bug 51219)
6856 !! options
6857 parsoid=html2wt
6858 !! html/parsoid
6859 <table><tbody>
6860 <tr><td>foo</td></tr></tbody></table> bar
6861 <table><tbody>
6862 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6863 !! wikitext
6864 {|
6865 |foo
6866 |}
6867 <nowiki> </nowiki>bar
6868 {|
6869 |baz
6870 |}
6871 '''quux'''
6872 !! end
6873
6874 !! test
6875 Parsoid: newline inducing block nodes don't suppress <nowiki>
6876 !! options
6877 parsoid=html2wt
6878 !! html/parsoid
6879 a<h1>foo</h1>
6880 !! wikitext
6881 <nowiki> </nowiki>a
6882
6883 = foo =
6884 !! end
6885
6886 !! test
6887 Parsoid: Row-syntax table headings followed by comment & table cells
6888 !! options
6889 parsoid=wt2html,wt2wt
6890 !! wikitext
6891 {|
6892 ! foo || bar
6893 <!-- foo --> || baz || quux
6894 |}
6895 !! html/php
6896 <table>
6897 <tr>
6898 <th> foo </th>
6899 <th> bar
6900 </th>
6901 <td> baz </td>
6902 <td> quux
6903 </td></tr></table>
6904
6905 !! html/parsoid
6906 <table>
6907 <tbody><tr><th> foo </th><th> bar
6908 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6909 </tbody></table>
6910 !! end
6911
6912 !!test
6913 Parsoid: Recover better from broken table attributes
6914 !!options
6915 parsoid=wt2html
6916 !!wikitext
6917 {| class="foo
6918 | class="bar" |
6919 foo
6920 |}
6921 !!html/php+tidy
6922 <table class="foo">
6923 <tr>
6924 <td class="bar">
6925 <p>foo</p>
6926 </td>
6927 </tr>
6928 </table>
6929 !!html/parsoid
6930 <table class="foo">
6931 <tr>
6932 <td class="bar">
6933 <p>foo</p></td></tr>
6934 </tbody></table>
6935 !!end
6936
6937 !! test
6938 Tables: Digest broken attributes on table and tr tag
6939 !! options
6940 parsoid=wt2html
6941 !! wikitext
6942 {| || |} ++
6943 |- || || ++ --
6944 |- > [
6945 |}
6946 !! html
6947 <table>
6948 <tbody>
6949 <tr></tr>
6950 <tr></tr>
6951 </tbody></table>
6952 !! end
6953
6954 !! test
6955 Strip unsupported table tags
6956 !! options
6957 parsoid=html2wt
6958 !! html/parsoid
6959 <table>
6960 <thead>
6961 <tr>
6962 <th>Month</th>
6963 <th>Savings</th>
6964 </tr>
6965 </thead>
6966 <tbody>
6967 <tr>
6968 <td>January</td>
6969 <td>$100</td>
6970 </tr>
6971 <tr>
6972 <td>February</td>
6973 <td>$80</td>
6974 </tr>
6975 </tbody>
6976 <tfoot>
6977 <tr>
6978 <td>Sum</td>
6979 <td>$180</td>
6980 </tr>
6981 </tfoot>
6982 </table>
6983 !! wikitext
6984 {|
6985
6986 !Month
6987 !Savings
6988
6989 |January
6990 |$100
6991
6992 |-
6993 |February
6994 |$80
6995
6996 |Sum
6997 |$180
6998
6999 |}
7000 !! end
7001
7002 !!test
7003 Testing serialization after deletion of table cells
7004 !!options
7005 parsoid={
7006 "modes": ["wt2wt", "selser"],
7007 "changes": [
7008 ["#x", "remove"]
7009 ]
7010 }
7011 !!wikitext
7012 {|
7013 !h1 !!h2 !!h3
7014 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7015 |}
7016 !! wikitext/edited
7017 {|
7018 !h1 !!h2 !!h3
7019 |c2 |||c3
7020 |}
7021 !!end
7022
7023 ###
7024 ### Internal links
7025 ###
7026 !! test
7027 Plain link, capitalized
7028 !! wikitext
7029 [[Main Page]]
7030 !! html
7031 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7032 </p>
7033 !! end
7034
7035 !! test
7036 Plain link, uncapitalized
7037 !! wikitext
7038 [[main Page]]
7039 !! html
7040 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7041 </p>
7042 !! end
7043
7044 !! test
7045 Piped link
7046 !! wikitext
7047 [[Main Page|The Main Page]]
7048 !! html
7049 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7050 </p>
7051 !! end
7052
7053 !! test
7054 Piped link with comment in link text
7055 !! wikitext
7056 [[Main Page|The Main<!--front--> Page]]
7057 !! html
7058 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7059 </p>
7060 !! end
7061
7062 !! test
7063 Piped link with multiple pipe characters in link text
7064 !! wikitext
7065 [[Main Page||The|Main|Page|]]
7066 !! html/php
7067 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7068 </p>
7069 !! html/parsoid
7070 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7071 !! end
7072
7073 !! test
7074 Broken link
7075 !! wikitext
7076 [[Zigzagzogzagzig]]
7077 !! html
7078 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7079 </p>
7080 !! end
7081
7082 !! test
7083 Broken link with fragment
7084 !! wikitext
7085 [[Zigzagzogzagzig#zug]]
7086 !! html
7087 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7088 </p>
7089 !! end
7090
7091 !! test
7092 Special page link with fragment
7093 !! wikitext
7094 [[Special:Version#anchor]]
7095 !! html
7096 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7097 </p>
7098 !! end
7099
7100 !! test
7101 Nonexistent special page link with fragment
7102 !! wikitext
7103 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7104 !! html
7105 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7106 </p>
7107 !! end
7108
7109 !! test
7110 Link with prefix
7111 !! wikitext
7112 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7113 !! html
7114 <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>
7115 </p>
7116 !! end
7117
7118 !! test
7119 Link with suffix
7120 !! wikitext
7121 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7122 !! html
7123 <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>!!!
7124 </p>
7125 !! end
7126
7127 !! article
7128 prefixed article
7129 !! text
7130 Some text
7131 !! endarticle
7132
7133 !! test
7134 Bug 43661: Piped links with identical prefixes
7135 !! wikitext
7136 [[prefixed article|prefixed articles with spaces]]
7137
7138 [[prefixed article|prefixed articlesaoeu]]
7139
7140 [[Main Page|Main Page test]]
7141 !! html
7142 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7143 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7144 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7145 </p>
7146 !! end
7147
7148
7149 !! test
7150 Link with HTML entity in suffix / tail
7151 !! wikitext
7152 [[Main Page]]&quot;, [[Main Page]]&#97;
7153 !! html/php
7154 <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;
7155 </p>
7156 !! html/parsoid
7157 <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>
7158 !! end
7159
7160 !! test
7161 Link with 3 brackets
7162 !! wikitext
7163 [[[Main Page]]]
7164 !! html
7165 <p>[[[Main Page]]]
7166 </p>
7167 !! end
7168
7169 !! test
7170 Link with 4 brackets
7171 !! wikitext
7172 [[[[Main Page]]]]
7173 !! html
7174 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7175 </p>
7176 !! end
7177
7178 !! test
7179 Piped link with 3 brackets
7180 !! wikitext
7181 [[[main page|the main page]]]
7182 !! html
7183 <p>[[[main page|the main page]]]
7184 </p>
7185 !! end
7186
7187 !! test
7188 Piped link with extlink-like text
7189 !! wikitext
7190 [[Main Page|[bar]]]
7191 [[Main Page|This is a [bar]]]
7192 !! html/php
7193 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7194 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7195 </p>
7196 !! html/parsoid
7197 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7198 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7199 !! end
7200
7201 !! test
7202 Link with multiple pipes
7203 !! wikitext
7204 [[Main Page|The|Main|Page]]
7205 !! html
7206 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7207 </p>
7208 !! end
7209
7210 # Note that parsoid does not munge anchor text; all non-space
7211 # characters are valid in HTML5 ids.
7212 !! test
7213 Anchor containing a #. (bug 63430)
7214 !! wikitext
7215 [[Main Page#And#Link]]
7216 !! html/php
7217 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7218 </p>
7219 !! html/parsoid
7220 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7221 !! end
7222
7223 !! test
7224 Link to namespaces
7225 !! wikitext
7226 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7227 !! html
7228 <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>
7229 </p>
7230 !! end
7231
7232 !! test
7233 Link with space in namespace
7234 !! wikitext
7235 [[User talk:Foo bar]]
7236 !! html
7237 <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>
7238 </p>
7239 !! end
7240
7241 !! article
7242 MemoryAlpha:AlphaTest
7243 !! text
7244 This is an article in the MemoryAlpha namespace
7245 (which shadows the memoryalpha interwiki link).
7246 !! endarticle
7247
7248 !! test
7249 Namespace takes precedence over interwiki link (bug 51680)
7250 !! wikitext
7251 [[MemoryAlpha:AlphaTest]]
7252 !! html
7253 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7254 </p>
7255 !! end
7256
7257 # The previous test doesn't work correctly in html2*, due to not recognizing the
7258 # link as an internal one. This one checks for the correct behavior.
7259 !! test
7260 Link to namespace preferred over interwiki with correct rel attribute
7261 !! options
7262 parsoid=html2wt,html2html
7263 !! html/parsoid
7264 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7265 !! wikitext
7266 [[MemoryAlpha:AlphaTest]]
7267 !! end
7268
7269 !! test
7270 Piped link to namespace
7271 !! wikitext
7272 [[Meta:Disclaimers|The disclaimers]]
7273 !! html
7274 <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>
7275 </p>
7276 !! end
7277
7278 !! test
7279 Link containing }
7280 !! wikitext
7281 [[Usually caused by a typo (oops}]]
7282 !! html
7283 <p>[[Usually caused by a typo (oops}]]
7284 </p>
7285 !! end
7286
7287 !! article
7288 7% Solution
7289 !! text
7290 Just a test of an article title containing a percent.
7291 !! endarticle
7292
7293 !! test
7294 Link containing % (not as a hex sequence)
7295 !! wikitext
7296 [[7% Solution]]
7297 !! html/php
7298 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7299 </p>
7300 !! html/parsoid
7301 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7302 !! end
7303
7304 # note that the parsoid HTML is identical to the previous test output,
7305 # so the previous test ensures that the html2wt mode will generate the
7306 # "not as a hex sequence" wikitext.
7307 !! test
7308 Link containing % as a single hex sequence interpreted to char
7309 !! options
7310 parsoid=wt2wt,wt2html,html2html
7311 !! wikitext
7312 [[7%25 Solution]]
7313 !! html/php
7314 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7315 </p>
7316 !! html/parsoid
7317 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7318 !!end
7319
7320 !! test
7321 Link containing % as a double hex sequence interpreted to hex sequence
7322 !! wikitext
7323 [[7%2525 Solution]]
7324 !! html
7325 <p>[[7%2525 Solution]]
7326 </p>
7327 !!end
7328
7329 # note that parsoid does not munge anchor text; all non-space
7330 # characters are valid in HTML5 anchors.
7331 !! test
7332 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7333 Example for such a section: == < ==
7334 !! wikitext
7335 [[%23%3c]][[%23%3e]]
7336 !! html/php
7337 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7338 </p>
7339 !! html/parsoid
7340 <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>
7341 !! end
7342
7343 !! test
7344 Link containing "<#" and ">#" as a hex sequences
7345 !! wikitext
7346 [[%3c%23]][[%3e%23]]
7347 !! html
7348 <p>[[%3c%23]][[%3e%23]]
7349 </p>
7350 !! end
7351
7352 !! test
7353 Link containing an equals sign
7354 !! wikitext
7355 [[Special:BookSources/isbn=4-00-026157-6]]
7356 !! html/php
7357 <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>
7358 </p>
7359 !! html/parsoid
7360 <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>
7361 !! end
7362
7363 !! article
7364 Foo~bar
7365 !! text
7366 Just a test of an article title containing a tilde.
7367 !! endarticle
7368
7369 # note that links containing signatures, like [[Foo~~~~]], are
7370 # massaged by the pre-save transform (PST) and so the tildes are never
7371 # seen by the parser.
7372 !! test
7373 Link containing a tilde
7374 !! wikitext
7375 [[Foo~bar]]
7376 !! html/php
7377 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7378 </p>
7379 !! html/parsoid
7380 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7381 !! end
7382
7383 !! test
7384 Link containing double-single-quotes '' (bug 4598)
7385 !! wikitext
7386 [[Lista d''e paise d''o munno]]
7387 !! html/php
7388 <p><a href="/index.php?title=Lista_d''e_paise_d''o_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>
7389 </p>
7390 !! html/parsoid
7391 <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>
7392 !! end
7393
7394 !! test
7395 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7396 !! wikitext
7397 Some [[Link|pretty ''italics'' and stuff]]!
7398 !! html/php
7399 <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>!
7400 </p>
7401 !! html/parsoid
7402 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7403 !! end
7404
7405 !! test
7406 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7407 !! wikitext
7408 ''Some [[Link|pretty ''italics'' and stuff]]!''
7409 !! html
7410 <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>
7411 </p>
7412 !! end
7413
7414 !! test
7415 Link with double quotes in title part (literal) and alternate part (interpreted)
7416 !! wikitext
7417 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7418
7419 [[''Pentecoste'']]
7420
7421 [[''Pentecoste''|Pentecoste]]
7422
7423 [[''Pentecoste''|''Pentecoste'']]
7424 !! html/php
7425 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_&#39;&#39;Pentecoste&#39;&#39;.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7426 </p><p><a href="/index.php?title=''Pentecoste''&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7427 </p><p><a href="/index.php?title=''Pentecoste''&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
7428 </p><p><a href="/index.php?title=''Pentecoste''&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
7429 </p>
7430 !! html/parsoid
7431 <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>
7432 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7433 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7434 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7435 !! end
7436
7437 !! test
7438 Broken image links with HTML captions (bug 39700)
7439 !! wikitext
7440 [[File:Nonexistent|<script></script>]]
7441 [[File:Nonexistent|100x100px|<script></script>]]
7442 [[File:Nonexistent|&lt;]]
7443 [[File:Nonexistent|a<i>b</i>c]]
7444 !! html/php
7445 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7446 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7447 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7448 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7449 </p>
7450 !! html/parsoid
7451 <p><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;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7452 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7453 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7454 <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 data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7455 !! end
7456
7457 !! test
7458 Plain link to URL
7459 !! wikitext
7460 [[http://www.example.com]]
7461 !! html/php
7462 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7463 </p>
7464 !! html/parsoid
7465 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7466 !! end
7467
7468 !! test
7469 Plain link to URL with link text
7470 !! wikitext
7471 [[http://www.example.com Link text]]
7472 !! html
7473 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7474 </p>
7475 !! end
7476
7477 !! test
7478 Plain link to protocol-relative URL
7479 !! wikitext
7480 [[//www.example.com]]
7481 !! html/php
7482 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7483 </p>
7484 !! html/parsoid
7485 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7486 !! end
7487
7488 !! test
7489 Plain link to protocol-relative URL with link text
7490 !! wikitext
7491 [[//www.example.com Link text]]
7492 !! html
7493 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7494 </p>
7495 !! end
7496
7497 !! test
7498 Plain link to page with question mark in title
7499 !! wikitext
7500 [[A?b]]
7501
7502 [[A?b|Baz]]
7503 !! html
7504 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7505 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7506 </p>
7507 !! end
7508
7509
7510 # I'm fairly sure the expected result here is wrong.
7511 # We want these to be URL links, not pseudo-pages with URLs for titles....
7512 # However the current output is also pretty screwy.
7513 #
7514 # ----
7515 # I'm changing it to match the current output--it arguably makes more
7516 # sense in the light of the test above. Old expected result was:
7517 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7518 #</p>
7519 # But I think this test is bordering on "garbage in, garbage out" anyway.
7520 # -- wtm
7521 !! test
7522 Piped link to URL
7523 !! wikitext
7524 Piped link to URL: [[http://www.example.com|an example URL]]
7525 !! html/php
7526 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7527 </p>
7528 !! html/parsoid
7529 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7530 !! end
7531
7532 !! test
7533 BUG 2: [[page|http://url/]] should link to page, not http://url/
7534 !! wikitext
7535 [[Main Page|http://url/]]
7536 !! html/php
7537 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7538 </p>
7539 !! html/parsoid
7540 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7541 !! end
7542
7543 # Parsoid does not mark self-links, by design.
7544 !! test
7545 BUG 337: Escaped self-links should be bold
7546 !! options
7547 title=[[Bug462]]
7548 !! wikitext
7549 [[Bu&#103;462]] [[Bug462]]
7550 !! html/php
7551 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7552 </p>
7553 !! html/php+tidy
7554 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7555 !! html/parsoid
7556 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7557 !! end
7558
7559 !! test
7560 Self-link to section should not be bold
7561 !! options
7562 title=[[Main Page]]
7563 !! wikitext
7564 [[Main Page#section]]
7565 !! html
7566 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7567 </p>
7568 !! end
7569
7570 !! article
7571 00
7572 !! text
7573 This is 00.
7574 !! endarticle
7575
7576 !!test
7577 Self-link to numeric title
7578 !!options
7579 title=[[0]]
7580 !! wikitext
7581 [[0]]
7582 !! html
7583 <p><strong class="selflink">0</strong>
7584 </p>
7585 !!end
7586
7587 !!test
7588 Link to numeric-equivalent title
7589 !!options
7590 title=[[0]]
7591 !! wikitext
7592 [[00]]
7593 !! html
7594 <p><a href="/wiki/00" title="00">00</a>
7595 </p>
7596 !!end
7597
7598 !! test
7599 <nowiki> inside a link
7600 !! wikitext
7601 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7602 !! html
7603 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7604 </p>
7605 !! end
7606
7607 !! test
7608 Non-breaking spaces in title
7609 !! wikitext
7610 [[&nbsp; Main &nbsp; Page &nbsp;]]
7611 !! html
7612 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7613 </p>
7614 !!end
7615
7616 !! test
7617 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7618 !! options
7619 language=ca
7620 !! wikitext
7621 '''[[Main Page]]'''
7622 !! html
7623 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7624 </p>
7625 !! end
7626
7627 !! test
7628 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7629 !! options
7630 language=ca
7631 !! wikitext
7632 ''[[Main Page]]''
7633 !! html
7634 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7635 </p>
7636 !! end
7637
7638 !! test
7639 Internal link with en linktrail: no apostrophes (bug 27473)
7640 !! options
7641 language=en
7642 !! wikitext
7643 [[Something]]'nice
7644 !! html
7645 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7646 </p>
7647 !! end
7648
7649 !! test
7650 Internal link with ca linktrail with apostrophes (bug 27473)
7651 !! options
7652 language=ca
7653 !! wikitext
7654 [[Something]]'nice
7655 !! html
7656 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7657 </p>
7658 !! end
7659
7660 !! test
7661 Internal link with kaa linktrail with apostrophes (bug 27473)
7662 !! options
7663 language=kaa
7664 !! wikitext
7665 [[Something]]'nice
7666 !! html
7667 <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>
7668 </p>
7669 !! end
7670
7671 !! test
7672 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7673 !! wikitext
7674 [[User:Foo/Test/63636:Bar|Test]]
7675 !! html/php
7676 <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>
7677 </p>
7678 !! html/parsoid
7679 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7680 !! end
7681
7682 !! test
7683 Purely hash wikilink
7684 !! options
7685 title=[[User:test/123]]
7686 !! wikitext
7687 [[#a|b]]
7688 !! html/php
7689 <p><a href="#a">b</a>
7690 </p>
7691 !! html/parsoid
7692 <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>
7693 !! end
7694
7695 !! test
7696 1. Interaction of linktrail and template encapsulation
7697 !! options
7698 parsoid
7699 !! wikitext
7700 {{echo|[[Foo]]}}l
7701 !! html
7702 <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>
7703 !! end
7704
7705 !! test
7706 2. Interaction of linktrail and template encapsulation
7707 !! options
7708 parsoid
7709 !! wikitext
7710 {{echo|Some [[Fool]]}}s
7711 !! html
7712 <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>
7713 !! end
7714
7715 !! test
7716 3. Interaction of linktrail and template encapsulation
7717 !! options
7718 parsoid
7719 !! wikitext
7720 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7721 !! html
7722 <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>
7723 !! end
7724
7725 !! article
7726 Söfnuður
7727 !! text
7728 Test.
7729 !! endarticle
7730
7731 !! test
7732 Internal link with is link prefix
7733 !! options
7734 language=is
7735 !! wikitext
7736 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7737 !! html
7738 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7739 </p>
7740 !! end
7741
7742 !! article
7743 Mótmælendatrú
7744 !! text
7745 Test.
7746 !! endarticle
7747
7748 !! test
7749 Internal link with is link trail and link prefix
7750 !! options
7751 language=is
7752 !! wikitext
7753 [[mótmælendatrú|xxx]]ar
7754 [[mótmælendatrú]]ar
7755 mótmælenda[[söfnuður]]
7756 mótmælenda[[söfnuður|söfnuðir]]
7757 mótmælenda[[söfnuður|söfnuðir]]xxx
7758 !! html
7759 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7760 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7761 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7762 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7763 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7764 </p>
7765 !! end
7766
7767 !! test
7768 Parsoid link trail escaping
7769 !! options
7770 parsoid=html2wt,html2html
7771 !! html/parsoid
7772 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7773 !! wikitext
7774 [[apple]]<nowiki/>s
7775 !! end
7776
7777 !! test
7778 Parsoid link prefix escaping
7779 !! options
7780 language=is
7781 parsoid=html2wt,html2html
7782 !! html/parsoid
7783 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7784 !! wikitext
7785 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7786 !! end
7787
7788 !! test
7789 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7790 !! wikitext
7791 [[Foo| bar]]
7792
7793 [[Foo| ''bar'']]
7794
7795 [http://wp.org foo]
7796
7797 [http://wp.org ''foo'']
7798 !! html
7799 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7800 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7801 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7802 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7803 </p>
7804 !! end
7805
7806 !! test
7807 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7808 !! options
7809 parsoid
7810 !! wikitext
7811 [[Foo|{{echo|a}} b {{echo|c}}]]
7812 !! html
7813 <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>
7814 !! end
7815
7816 !! test
7817 Link with angle bracket after anchor
7818 !! wikitext
7819 [[Foo#<bar>]]
7820 !! html/php
7821 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7822 </p>
7823 !! html/parsoid
7824 <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>
7825 !! end
7826
7827 ###
7828 ### Interwiki links (see maintenance/interwiki.sql)
7829 ###
7830
7831 !! test
7832 Inline interwiki link
7833 !! options
7834 parsoid=wt2html,wt2wt,html2html
7835 !! wikitext
7836 [[MeatBall:SoftSecurity]]
7837 !! html/php
7838 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7839 </p>
7840 !! html/parsoid
7841 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7842 !! end
7843
7844 !! test
7845 Inline interwiki link with empty title (bug 2372)
7846 !! options
7847 parsoid=wt2html,wt2wt,html2html
7848 !! wikitext
7849 [[MeatBall:]]
7850 !! html/php
7851 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7852 </p>
7853 !! html/parsoid
7854 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7855 !! end
7856
7857 !! test
7858 Interwiki link encoding conversion (bug 1636)
7859 !! wikitext
7860 *[[Wikipedia:ro:Olteni&#0355;a]]
7861 *[[Wikipedia:ro:Olteni&#355;a]]
7862 !! html
7863 <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>
7864 <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>
7865
7866 !! html+tidy
7867 <ul>
7868 <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>
7869 <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>
7870 </ul>
7871 !! end
7872
7873 !! test
7874 Interwiki link with fragment (bug 2130)
7875 !! wikitext
7876 [[MeatBall:SoftSecurity#foo]]
7877 !! html
7878 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7879 </p>
7880 !! end
7881
7882 # Ideally the wikipedia: prefix here should be proto-relative too
7883 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7884 # define the 'en' prefix, and originally the test used 'wikipedia',
7885 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7886 # article.
7887 !! test
7888 Different interwiki prefixes mapping to the same URL
7889 !! wikitext
7890 [[:en:Foo]]
7891
7892 [[:en:Foo|Foo]]
7893
7894 [[wikipedia:Foo]]
7895
7896 [[:wikipedia:Foo|Foo]]
7897
7898 [[wikipedia:en:Foo]]
7899
7900 [[:wikipedia:en:Foo]]
7901
7902 [[ wikiPEdia :Foo]]
7903 !! html/parsoid
7904 <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>
7905
7906 <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>
7907
7908 <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>
7909
7910 <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>
7911
7912 <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>
7913
7914 <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>
7915
7916 <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>
7917 !! end
7918
7919 !! test
7920 Interwiki links that cannot be represented in wiki syntax
7921 !! wikitext
7922 [[meatball:ok]]
7923 [[meatball:ok#foo|ok with fragment]]
7924 [[meatball:ok_as_well?|ok ending with ? mark]]
7925 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7926 [http://de.wikipedia.org/wiki/#foo is just fragment]
7927
7928 !! html/php
7929 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7930 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7931 <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>
7932 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7933 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7934 </p>
7935 !! html/parsoid
7936 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7937 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7938 <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>
7939 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7940 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7941 !! end
7942
7943 !! test
7944 Interwiki links: trail
7945 !! wikitext
7946 [[wikipedia:Foo|Ba]]r
7947 !! html/php
7948 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7949 </p>
7950 !! html/parsoid
7951 <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>
7952 !! end
7953
7954 !! test
7955 Local interwiki link
7956 !! options
7957 parsoid=wt2html,wt2wt,html2html
7958 !! wikitext
7959 [[local:Template:Foo]]
7960 !! html/php
7961 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7962 </p>
7963 !! html/parsoid
7964 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7965 !! end
7966
7967 # Parsoid does not mark self-links, by design.
7968 !! test
7969 Local interwiki link: self-link to current page
7970 !! options
7971 title=[[Main Page]]
7972 parsoid=wt2html,wt2wt,html2html
7973 !! wikitext
7974 [[local:Main Page]]
7975 !! html/php
7976 <p><strong class="selflink">local:Main Page</strong>
7977 </p>
7978 !! html/parsoid
7979 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7980 !! end
7981
7982 !! test
7983 Local interwiki link: prefix only (bug 64167)
7984 !! options
7985 parsoid=wt2html,wt2wt,html2html
7986 !! wikitext
7987 [[local:]]
7988 !! html/php
7989 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7990 </p>
7991 !! html/parsoid
7992 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7993 !! end
7994
7995 !! test
7996 Local interwiki link: with additional interwiki prefix (bug 61357)
7997 !! options
7998 parsoid=wt2html,wt2wt,html2html
7999 !! wikitext
8000 [[local:meatball:Hello]]
8001 !! html/php
8002 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8003 </p>
8004 !! html/parsoid
8005 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8006 !! end
8007
8008 !! test
8009 Multiple local interwiki link prefixes
8010 !! wikitext
8011 [[local:local:local:local:mi:local:Foo]]
8012 !! options
8013 parsoid=wt2html,wt2wt,html2html
8014 !! html/php
8015 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8016 </p>
8017 !! html/parsoid
8018 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8019 !! end
8020
8021 ###
8022 ### Interlanguage links
8023 ### Language links (so that searching for '### language' matches..)
8024 ###
8025
8026 !! test
8027 Interlanguage link
8028 !! options
8029 parsoid=wt2html,wt2wt,html2html
8030 !! wikitext
8031 Blah blah blah
8032 [[zh:Chinese]]
8033 !! html/php
8034 <p>Blah blah blah
8035 </p>
8036 !! html/parsoid
8037 <p>Blah blah blah</p>
8038 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8039 !! end
8040
8041 !! test
8042 Interlanguage link with spacing
8043 !! options
8044 parsoid=wt2html,wt2wt,html2html
8045 !! wikitext
8046 Blah blah blah
8047 [[ zh : Chinese ]]
8048 !! html/php
8049 <p>Blah blah blah
8050 </p>
8051 !! html/parsoid
8052 <p>Blah blah blah</p>
8053 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8054 !! end
8055
8056 !! test
8057 Double interlanguage link
8058 !! options
8059 parsoid=wt2html,wt2wt,html2html
8060 !! wikitext
8061 Blah blah blah
8062 [[es:Spanish]]
8063 [[zh:Chinese]]
8064 !! html/php
8065 <p>Blah blah blah
8066 </p>
8067 !! html/parsoid
8068 <p>Blah blah blah</p>
8069 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8070 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8071 !! end
8072
8073 !! test
8074 Interlanguage link variations
8075 !! options
8076 parsoid=wt2html,wt2wt,html2html
8077 !! wikitext
8078 Blah blah blah
8079 [[ es :Spanish]]
8080 [[ ZH :Chinese]]
8081 [[es:Foo_bar]]
8082 !! html/php
8083 <p>Blah blah blah
8084 </p>
8085 !! html/parsoid
8086 <p>Blah blah blah</p>
8087 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8088 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8089 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8090 !! end
8091
8092 !! test
8093 Space and question mark encoding in interlanguage links (T95473)
8094 !! options
8095 parsoid=wt2html,wt2wt,html2html
8096 !! wikitext
8097 Blah blah blah
8098 [[es:Foo bar?]]
8099 !! html/php
8100 <p>Blah blah blah
8101 </p>
8102 !! html/parsoid
8103 <p>Blah blah blah</p>
8104 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8105 !! end
8106
8107 !! test
8108 Interlanguage link, with prefix links
8109 !! options
8110 language=ln
8111 !! wikitext
8112 Blah blah blah
8113 [[zh:Chinese]]
8114 !! html/php
8115 <p>Blah blah blah
8116 </p>
8117 !! html/parsoid
8118 <p>Blah blah blah</p>
8119 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8120 !! end
8121
8122 !! test
8123 Double interlanguage link, with prefix links (bug 8897)
8124 !! options
8125 language=ln
8126 !! wikitext
8127 Blah blah blah
8128 [[es:Spanish]]
8129 [[zh:Chinese]]
8130 !! html/php
8131 <p>Blah blah blah
8132 </p>
8133 !! html/parsoid
8134 <p>Blah blah blah</p>
8135 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8136 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8137 !! end
8138
8139 !! test
8140 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8141 !! wikitext
8142 Blah blah blah
8143 [[mul:Article]]
8144 !! html/php
8145 <p>Blah blah blah
8146 </p>
8147 !! html/parsoid
8148 <p>Blah blah blah</p>
8149 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8150 !! end
8151
8152 !! test
8153 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8154 !! options
8155 language=ln
8156 !! wikitext
8157 [[WW&nbsp;II]]
8158 !! html
8159 <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>
8160 </p>
8161 !! end
8162
8163 !! test
8164 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8165 !! options
8166 parsoid=html2wt
8167 !! html/parsoid
8168 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8169 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8170 !! wikitext
8171 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8172
8173 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8174 !! end
8175
8176 !! test
8177 Parsoid: handle constructor well
8178 !! wikitext
8179 [[constructor]]
8180
8181 [[constructor:foo]]
8182 !! html/php
8183 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8184 </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>
8185 </p>
8186 !! html/parsoid
8187 <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>
8188
8189 <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>
8190 !! end
8191
8192 !! article
8193 ko:
8194 !! text
8195 Test.
8196 !! endarticle
8197
8198 # Note that `ko` isn't a known interlanguage prefix
8199 !! test
8200 Parsoid: recognize interlanguage links without a target page
8201 !! options
8202 ill
8203 !! wikitext
8204 [[es:]]
8205
8206 [[ko:]]
8207 !! html/php
8208 es:
8209 !! html/parsoid
8210 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8211
8212 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8213 !! end
8214
8215 # Note that `ko` isn't a known interwiki prefix
8216 !! test
8217 Parsoid: recognize interwiki links without a target page
8218 !! options
8219 parsoid=wt2html,wt2wt,html2html
8220 !! wikitext
8221 [[:es:]]
8222
8223 [[:ko:]]
8224 !! html/php
8225 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8226 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8227 </p>
8228 !! html/parsoid
8229 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8230 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8231 !! end
8232
8233 !! test
8234 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8235 !! wikitext
8236 [[mi:Foo]]
8237 !! html/php
8238 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8239 </p>
8240 !! html/parsoid
8241 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8242 !! end
8243
8244 !! test
8245 Interlanguage link with preceding local interwiki link (bug 68085)
8246 !! options
8247 parsoid=wt2html,wt2wt,html2html
8248 !! wikitext
8249 Blah blah blah
8250 [[local:es:Spanish]]
8251 !! html/php
8252 <p>Blah blah blah
8253 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8254 </p>
8255 !! html/parsoid
8256 <p>Blah blah blah
8257 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8258 !! end
8259
8260 !! test
8261 Looks like an interlanguage link, but is actually a local interwiki
8262 !! options
8263 parsoid=wt2html,wt2wt,html2html
8264 !! wikitext
8265 Blah blah blah
8266 [[mi:Template:Foo]]
8267 !! html/php
8268 <p>Blah blah blah
8269 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8270 </p>
8271 !! html/parsoid
8272 <p>Blah blah blah
8273 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8274 !! end
8275
8276 ###
8277 ### Redirects, Parsoid-only
8278 ###
8279
8280 !! test
8281 1. Simple redirect to page
8282 !! wikitext
8283 #REDIRECT [[Main Page]]
8284 !! html/parsoid
8285 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8286 !! end
8287
8288 !! test
8289 2. Other redirect variants
8290 !! wikitext
8291 #REDIRECT [[Main_Page]]
8292 !! html/parsoid
8293 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8294 !! end
8295
8296 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8297 # This tests the Parsoid bail-out code.
8298 !! test
8299 3. Other redirect variants
8300 !! wikitext
8301 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8302 !! html/parsoid
8303 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8304 !! end
8305
8306 !! test
8307 4. Redirect to a templated destination
8308 !! wikitext
8309 #REDIRECT [[{{echo|Foo}}bar]]
8310 !! html/parsoid
8311 <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"}]]}'/>
8312 !! end
8313
8314 !! test
8315 Empty redirect
8316 !! options
8317 parsoid=wt2html,wt2wt
8318 !! wikitext
8319 #REDIRECT [[]]
8320 !! html/parsoid
8321 <ol>
8322 <li>REDIRECT [[]]</li></ol>
8323 !! end
8324
8325 !! test
8326 Optional colon in #REDIRECT
8327 !! options
8328 # the colon is archaic syntax. we support it for wt2html, but we
8329 # don't care that it roundtrips back to the modern syntax.
8330 parsoid=wt2html,html2html
8331 !! wikitext
8332 #REDIRECT:[[Main Page]]
8333 !! html/parsoid
8334 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8335 !! end
8336
8337 !! test
8338 Whitespace in #REDIRECT with optional colon
8339 !! options
8340 # the colon and gratuitous whitespace is archaic syntax. we support
8341 # it for wt2html, but we don't care that it roundtrips back to the
8342 # modern syntax (without extra whitespace)
8343 parsoid=wt2html,html2html
8344 !! wikitext
8345
8346 #REDIRECT
8347 :
8348 [[Main Page]]
8349 !! html/parsoid
8350 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8351 !! end
8352
8353 !! test
8354 Piped link in #REDIRECT
8355 !! options
8356 # content after piped link is ignored. we support this syntax,
8357 # but don't care that the piped link is lost when we roundtrip this.
8358 parsoid=wt2html
8359 !! wikitext
8360 #REDIRECT [[Main Page|bar]]
8361 !! html/parsoid
8362 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8363 !! end
8364
8365 !! test
8366 Redirect to category (T104502)
8367 !! options
8368 parsoid=wt2html,wt2wt
8369 !! wikitext
8370 #REDIRECT [[Category:Foo]]
8371 !! html/parsoid
8372 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8373 !! end
8374
8375 !! test
8376 Redirect to category with URL encoding (T104502)
8377 !! options
8378 parsoid=wt2html
8379 !! wikitext
8380 #REDIRECT [[Category%3AFoo]]
8381 !! html/parsoid
8382 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8383 !! end
8384
8385 !! test
8386 Redirect to category page
8387 !! wikitext
8388 #REDIRECT [[:Category:Foo]]
8389 !! html/parsoid
8390 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8391 !! end
8392
8393 !! test
8394 Redirect to image page (1)
8395 !! wikitext
8396 #REDIRECT [[File:Wiki.png]]
8397 !! html/parsoid
8398 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8399 !! end
8400
8401 !! test
8402 Redirect to image page (2)
8403 !! wikitext
8404 #REDIRECT [[Image:Wiki.png]]
8405 !! html/parsoid
8406 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8407 !! end
8408
8409 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8410 # Next test confirms this.
8411 !! test
8412 Redirect to language (1) (T104918)
8413 !! options
8414 parsoid=wt2html,wt2wt,html2html
8415 !! wikitext
8416 #REDIRECT [[en:File:Wiki.png]]
8417 !! html/parsoid
8418 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8419 !! end
8420
8421 !! test
8422 Redirect to language (2) (T104918)
8423 !! wikitext
8424 #REDIRECT [[:en:File:Wiki.png]]
8425 !! html/parsoid
8426 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8427 !! end
8428
8429 !! test
8430 Redirect to interwiki (T104918)
8431 !! wikitext
8432 #REDIRECT [[meatball:File:Wiki.png]]
8433 !! html/parsoid
8434 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8435 !! end
8436
8437 !! test
8438 Non-English #REDIRECT
8439 !! options
8440 language=is
8441 !! wikitext
8442 #TILVÍSUN [[Main Page]]
8443 !! html/parsoid
8444 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8445 !! end
8446
8447 !! test
8448 Redirect syntax under text isn't considered a redirect
8449 !! wikitext
8450 some text
8451 #redirect [[Main Page]]
8452 !! html/parsoid
8453 <p>some text</p>
8454 <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>
8455 !! end
8456
8457 # FIXME: Should hoist the redirect to the top of the page and ensure there
8458 # is only one.
8459 !! test
8460 New redirect
8461 !! options
8462 parsoid=html2wt
8463 !! html/parsoid
8464 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8465 !! wikitext
8466 Foo
8467 #REDIRECT [[Foo]]
8468 !! end
8469
8470 ##
8471 ## XHTML tidiness
8472 ###
8473
8474 !! test
8475 <br> to <br />
8476 !! wikitext
8477 1<br>2<br />3
8478 !! html
8479 <p>1<br />2<br />3
8480 </p>
8481 !! end
8482
8483 !! test
8484 Broken br tag sanitization
8485 !! wikitext
8486 </br>
8487 !! html/php
8488 <p>&lt;/br&gt;
8489 </p>
8490 !! end
8491
8492 # TODO: Fix html2html mode (bug 51055)!
8493 !! test
8494 Parsoid: Broken br tag recognition
8495 !! options
8496 parsoid=wt2html
8497 !! wikitext
8498 </br>
8499
8500 <br/ >
8501 !! html+tidy
8502 <p><br /></p>
8503 <p><br /></p>
8504 !! end
8505
8506 !! test
8507 Incorrecly removing closing slashes from correctly formed XHTML
8508 !! wikitext
8509 <br style="clear:both;" />
8510 !! html
8511 <p><br style="clear:both;" />
8512 </p>
8513 !! end
8514
8515 !! test
8516 Failing to transform badly formed HTML into correct XHTML
8517 !! wikitext
8518 <br style="clear: left;">
8519 <br style="clear: right;">
8520 <br style="clear: both;">
8521 !! html
8522 <p><br style="clear: left;" />
8523 <br style="clear: right;" />
8524 <br style="clear: both;" />
8525 </p>
8526 !!end
8527
8528 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8529 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8530 !! test
8531 Handling html with a div self-closing tag
8532 !! wikitext
8533 <div title />
8534 <div title/>
8535 <div title/ >
8536 <div title=bar />
8537 <div title=bar/>
8538 <div title=bar/ >
8539 !! html/php
8540 <p>&lt;div title /&gt;
8541 &lt;div title/&gt;
8542 </p>
8543 <div>
8544 <p>&lt;div title=bar /&gt;
8545 &lt;div title=bar/&gt;
8546 </p>
8547 <div title="bar/"></div>
8548 </div>
8549
8550 !! html/parsoid
8551 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8552 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8553 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8554 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8555 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8556 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8557 !! end
8558
8559 !! test
8560 Handling html with a br self-closing tag
8561 !! wikitext
8562 <br title />
8563 <br title/>
8564 <br title/ >
8565 <br title=bar />
8566 <br title=bar/>
8567 <br title=bar/ >
8568 !! html/php
8569 <p><br title="" />
8570 <br title="" />
8571 <br />
8572 <br title="bar" />
8573 <br title="bar" />
8574 <br title="bar/" />
8575 </p>
8576 !! html/parsoid
8577 <p><br title="" />
8578 <br title="" />
8579 <br title="" />
8580 <br title="bar" />
8581 <br title="bar" />
8582 <br title="bar/" />
8583 </p>
8584 !! end
8585
8586 !! test
8587 Horizontal ruler (should it add that extra space?)
8588 !! wikitext
8589 <hr>
8590 <hr >
8591 foo <hr
8592 > bar
8593 !! html+tidy
8594 <hr />
8595 <hr />
8596 <p>foo</p>
8597 <hr />
8598 <p>bar</p>
8599 !! end
8600
8601 !! test
8602 Horizontal ruler -- 4+ dashes render hr
8603 !! wikitext
8604 ----
8605 !! html
8606 <hr />
8607
8608 !! end
8609
8610 !! test
8611 Horizontal ruler -- eats additional dashes on the same line
8612 !! wikitext
8613 ---------
8614 !! html
8615 <hr />
8616
8617 !! end
8618
8619 !! test
8620 Horizontal ruler -- does not collapse dashes on consecutive lines
8621 !! wikitext
8622 ----
8623 ----
8624 !! html
8625 <hr />
8626 <hr />
8627
8628 !! end
8629
8630 !! test
8631 Horizontal ruler -- <4 dashes render as plain text
8632 !! wikitext
8633 ---
8634 !! html
8635 <p>---
8636 </p>
8637 !! end
8638
8639 !! test
8640 Horizontal ruler -- Supports content following dashes on same line
8641 !! wikitext
8642 ---- Foo
8643 !! html
8644 <hr /> Foo
8645
8646 !! html+tidy
8647 <hr />
8648 <p>Foo</p>
8649 !! end
8650
8651 ###
8652 ### Block-level elements
8653 ###
8654 !! test
8655 Common list
8656 !! wikitext
8657 *Common list
8658 * item 2
8659 *item 3
8660 !! html
8661 <ul><li>Common list</li>
8662 <li> item 2</li>
8663 <li>item 3</li></ul>
8664
8665 !! end
8666
8667 !! test
8668 Numbered list
8669 !! wikitext
8670 #Numbered list
8671 #item 2
8672 # item 3
8673 !! html
8674 <ol><li>Numbered list</li>
8675 <li>item 2</li>
8676 <li> item 3</li></ol>
8677
8678 !! end
8679
8680 !! test
8681 Mixed list
8682 !! wikitext
8683 *Mixed list
8684 *# with numbers
8685 ** and bullets
8686 *# and numbers
8687 *bullets again
8688 **bullet level 2
8689 ***bullet level 3
8690 ***#Number on level 4
8691 **bullet level 2
8692 **#Number on level 3
8693 **#Number on level 3
8694 *#number level 2
8695 *Level 1
8696 *** Level 3
8697 #** Level 3, but ordered
8698 !! html
8699 <ul><li>Mixed list
8700 <ol><li> with numbers</li></ol>
8701 <ul><li> and bullets</li></ul>
8702 <ol><li> and numbers</li></ol></li>
8703 <li>bullets again
8704 <ul><li>bullet level 2
8705 <ul><li>bullet level 3
8706 <ol><li>Number on level 4</li></ol></li></ul></li>
8707 <li>bullet level 2
8708 <ol><li>Number on level 3</li>
8709 <li>Number on level 3</li></ol></li></ul>
8710 <ol><li>number level 2</li></ol></li>
8711 <li>Level 1
8712 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8713 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8714
8715 !! end
8716
8717 !! test
8718 Nested lists 1
8719 !! wikitext
8720 *foo
8721 **bar
8722 !! html
8723 <ul><li>foo
8724 <ul><li>bar</li></ul></li></ul>
8725
8726 !! end
8727
8728 !! test
8729 Nested lists 2
8730 !! wikitext
8731 **foo
8732 *bar
8733 !! html
8734 <ul><li><ul><li>foo</li></ul></li>
8735 <li>bar</li></ul>
8736
8737 !! end
8738
8739 !! test
8740 Nested lists 3 (first element empty)
8741 !! wikitext
8742 *
8743 **bar
8744 !! html
8745 <ul><li>
8746 <ul><li>bar</li></ul></li></ul>
8747
8748 !! end
8749
8750 !! test
8751 Nested lists 4 (first element empty)
8752 !! wikitext
8753 **
8754 *bar
8755 !! html
8756 <ul><li><ul><li></li></ul></li>
8757 <li>bar</li></ul>
8758
8759 !! end
8760
8761 !! test
8762 Nested lists 5 (both elements empty)
8763 !! wikitext
8764 **
8765 *
8766 !! html
8767 <ul><li><ul><li></li></ul></li>
8768 <li></li></ul>
8769
8770 !! end
8771
8772 !! test
8773 Nested lists 6 (both elements empty)
8774 !! wikitext
8775 *
8776 **
8777 !! html
8778 <ul><li>
8779 <ul><li></li></ul></li></ul>
8780
8781 !! end
8782
8783 !! test
8784 Nested lists 7 (skip initial nesting levels)
8785 !! wikitext
8786 *** foo
8787 !! html
8788 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8789
8790 !! end
8791
8792 !! test
8793 Nested lists 8 (multiple nesting transitions)
8794 !! wikitext
8795 * foo
8796 *** bar
8797 ** baz
8798 * boo
8799 !! html
8800 <ul><li> foo
8801 <ul><li><ul><li> bar</li></ul></li>
8802 <li> baz</li></ul></li>
8803 <li> boo</li></ul>
8804
8805 !! end
8806
8807 !! test
8808 Nested lists 9 (extension interaction)
8809 !! options
8810 parsoid
8811 !! wikitext
8812 *<references />
8813 !! html/parsoid
8814 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8815 !! end
8816
8817 !! test
8818 1. Lists with start-of-line-transparent tokens before bullets: Comments
8819 !! wikitext
8820 *foo
8821 *<!--cmt-->bar
8822 <!--cmt-->*baz
8823 !! html
8824 <ul><li>foo</li>
8825 <li>bar</li>
8826 <li>baz</li></ul>
8827
8828 !! end
8829
8830 !! test
8831 2. Lists with start-of-line-transparent tokens before bullets: Template close
8832 !! wikitext
8833 *foo {{echo|bar
8834 }}*baz
8835 !! html
8836 <ul><li>foo bar</li>
8837 <li>baz</li></ul>
8838
8839 !! end
8840
8841 !! test
8842 List items are not parsed correctly following a <pre> block (bug 785)
8843 !! wikitext
8844 * <pre>foo</pre>
8845 * <pre>bar</pre>
8846 * zar
8847 !! html/php
8848 <ul><li> <pre>foo</pre></li>
8849 <li> <pre>bar</pre></li>
8850 <li> zar</li></ul>
8851
8852 !! html/parsoid
8853 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8854 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8855 <li> zar</li></ul>
8856 !! end
8857
8858 !! test
8859 List items from template
8860 !! wikitext
8861
8862 {{inner list}}
8863 * item 2
8864
8865 * item 0
8866 {{inner list}}
8867 * item 2
8868
8869 * item 0
8870 * notSOL{{inner list}}
8871 * item 2
8872 !! html
8873 <ul><li> item 1</li>
8874 <li> item 2</li></ul>
8875 <ul><li> item 0</li>
8876 <li> item 1</li>
8877 <li> item 2</li></ul>
8878 <ul><li> item 0</li>
8879 <li> notSOL</li>
8880 <li> item 1</li>
8881 <li> item 2</li></ul>
8882
8883 !! end
8884
8885 !! test
8886 List interrupted by empty line or heading
8887 !! wikitext
8888 * foo
8889
8890 ** bar
8891 == A heading ==
8892 * Another list item
8893 !! html
8894 <ul><li> foo</li></ul>
8895 <ul><li><ul><li> bar</li></ul></li></ul>
8896 <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>
8897 <ul><li> Another list item</li></ul>
8898
8899 !!end
8900
8901 !!test
8902 Multiple list tags generated by templates
8903 !! wikitext
8904 {{echo|<li>}}a
8905 {{echo|<li>}}b
8906 {{echo|<li>}}c
8907 !! html
8908 <li>a
8909 <li>b
8910 <li>c</li>
8911 </li>
8912 </li>
8913
8914 !! html+tidy
8915 <ul>
8916 <li>a</li>
8917 <li>b</li>
8918 <li>c</li>
8919 </ul>
8920 !!end
8921
8922 !!test
8923 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8924 !! wikitext
8925 *a
8926 <!--This line will NOT split the list-->
8927 *b
8928 <!--This line will NOT split the list either-->
8929 *c
8930 <!--foo--> <!----> <!--This line NOT split the list either-->
8931 *d
8932 !! html
8933 <ul><li>a</li>
8934 <li>b</li>
8935 <li>c</li>
8936 <li>d</li></ul>
8937
8938 !!end
8939
8940 !!test
8941 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8942 !! wikitext
8943 *a
8944 <!--This line will NOT split the list-->
8945 *b
8946 <!--This line will NOT split the list either-->
8947 *c
8948 <!--foo--> <!----> <!--This line NOT split the list
8949 either-->
8950 *d
8951 !! html
8952 <ul><li>a</li>
8953 <li>b</li>
8954 <li>c</li>
8955 <li>d</li></ul>
8956
8957 !!end
8958
8959 !!test
8960 Test the li-hack
8961 (The PHP parser relies on Tidy for the hack)
8962 !!options
8963 parsoid=wt2html,wt2wt
8964 !! wikitext
8965 * foo
8966 * <li>li-hack
8967 * {{echo|<li>templated li-hack}}
8968 * <!--foo--> <li> unsupported li-hack with preceding comments
8969
8970 <ul>
8971 <li><li>not a li-hack
8972 </li>
8973 </ul>
8974 !! html+tidy
8975 <ul>
8976 <li>foo</li>
8977 <li>li-hack</li>
8978 <li>templated li-hack</li>
8979 <li>unsupported li-hack with preceding comments</li>
8980 </ul>
8981 <ul>
8982 <li>not a li-hack</li>
8983 </ul>
8984 !!end
8985
8986 !! test
8987 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8988 !! options
8989 parsoid
8990 !! wikitext
8991 # foo
8992 ## bar
8993 * foo
8994 ** bar
8995 : foo
8996 :: bar
8997 !! html
8998 <ol>
8999 <li> foo<ol>
9000 <li> bar</li>
9001 </ol></li>
9002 </ol><ul>
9003 <li> foo<ul>
9004 <li> bar</li>
9005 </ul></li>
9006 </ul><dl>
9007 <dd> foo<dl>
9008 <dd> bar</dd>
9009 </dl></dd>
9010 </dl>
9011 !! end
9012
9013 !! test
9014 Parsoid: Test of whitespace serialization with Templated bullets
9015 !! options
9016 parsoid
9017 !! wikitext
9018 * {{bullet}}
9019 !! html
9020 <ul>
9021 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9022 </ul>
9023 !! end
9024
9025 # ------------------------------------------------------------------------
9026 # The next set of tests are about Parsoid's ability to handle badly nested
9027 # tags (parse, minimize scope of fixup, and roundtrip back)
9028 # ------------------------------------------------------------------------
9029
9030 !! test
9031 Unbalanced closing block tags break a list
9032 (php parser relies on Tidy to fix up)
9033 !! wikitext
9034 <div>
9035 *a</div><div>
9036 *b</div>
9037 !! html+tidy
9038 <div>
9039 <ul>
9040 <li>a</li>
9041 </ul>
9042 </div>
9043 <div>
9044 <ul>
9045 <li>b</li>
9046 </ul>
9047 </div>
9048 !! end
9049
9050 # Parsoid fails this test, but it might be tricky to support properly.
9051 # See bug 68395.
9052 !! test
9053 Unbalanced closing non-block tags don't break a list
9054 (php parser relies on Tidy to fix up)
9055 !! wikitext
9056 <span>
9057 *a</span><span>
9058 *b</span>
9059 !! html/php+tidy
9060 <ul>
9061 <li><span>a</span></li>
9062 <li><span>b</span></li>
9063 </ul>
9064 !! html/parsoid
9065 <span>
9066 <ul>
9067 <li>a<span></span>
9068 </li>
9069 <li>b
9070 </li>
9071 </ul>
9072 </span>
9073 !! end
9074
9075 !! test
9076 Unclosed formatting tags that straddle lists are closed and reopened
9077 (php parser relies on Tidy to fix up)
9078 !! options
9079 parsoid=wt2html,wt2wt,html2html
9080 !! wikitext
9081 # <s> a
9082 # b </s>
9083 !! html/php+tidy
9084 <ol>
9085 <li><s>a</s></li>
9086 <li><s>b</s></li>
9087 </ol>
9088 !! html/parsoid
9089 <ol><li> <s> a</s></li>
9090 <li><s> b </s></li></ol>
9091 !! end
9092
9093 # See bug 68395.
9094 !!test
9095 1. List embedded in a formatting tag
9096 !! wikitext
9097 <small>
9098 * foo
9099 </small>
9100 !! html/php+tidy
9101 <ul>
9102 <li><small>foo</small></li>
9103 </ul>
9104 !! html/parsoid
9105 <small>
9106 <ul>
9107 <li> foo</li>
9108 </ul>
9109 </small>
9110 !!end
9111
9112 ## Ugly Parsoid output here
9113 ## Not sure what the right output is.
9114 !!test
9115 2. List embedded in a formatting tag
9116 !! wikitext
9117 <small>
9118 *a
9119 *b</small>
9120 !! html/php+tidy
9121 <ul>
9122 <li><small>a</small></li>
9123 <li><small>b</small></li>
9124 </ul>
9125 !! html/parsoid
9126 <small></small>
9127 <ul><small>
9128 <li>a</li>
9129 </small>
9130 <li><small>b</small></li>
9131 </ul>
9132 !!end
9133
9134 # Ugly Parsoid and PHP parser output here
9135 # Not sure if we want to make this a test!
9136 #
9137 ## !!test
9138 ## 3. Unclosed formatting tags in list elements
9139 ## !! wikitext
9140 ## *<small>a
9141 ## *<small>b
9142 ## !! html/php+tidy
9143 ## <ul>
9144 ## <li><small>a</small></li>
9145 ## <li><small><small>b</small></small></li>
9146 ## </ul>
9147 ## !! html/parsoid
9148 ## <ul>
9149 ## <li><small>a</small></li>
9150 ## <small>
9151 ## <li><small>b</small></li>
9152 ## </small></ul>
9153 ## !!end
9154
9155 # This is a bug in the PHP parser + tidy combination.
9156 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9157 # and then fostered out of the table by tidy.)
9158 # We believe the Parsoid output to be correct.
9159 !! test
9160 Table with missing opening <tr> tag
9161 !! options
9162 parsoid=wt2html,wt2wt
9163 !! wikitext
9164 <table>
9165 <td>foo</td>
9166 </tr>
9167 </table>
9168 !! html+tidy
9169 <table>
9170 <tr>
9171 <td>foo</td>
9172 </tr>
9173 </table>
9174 !! end
9175
9176 ###
9177 ### Magic Words
9178 ###
9179
9180 # Note that the current date is hard-coded as
9181 # 1970-01-01T00:02:03Z (a Thursday)
9182 # when running parser tests. The timezone is also fixed to GMT, so
9183 # local date will be identical to current date.
9184
9185 !! test
9186 Magic Word: {{CURRENTDAY}}
9187 !! wikitext
9188 {{CURRENTDAY}}
9189 !! html
9190 <p>1
9191 </p>
9192 !! end
9193
9194 !! test
9195 Magic Word: {{CURRENTDAY2}}
9196 !! wikitext
9197 {{CURRENTDAY2}}
9198 !! html
9199 <p>01
9200 </p>
9201 !! end
9202
9203 !! test
9204 Magic Word: {{CURRENTDAYNAME}}
9205 !! wikitext
9206 {{CURRENTDAYNAME}}
9207 !! html
9208 <p>Thursday
9209 </p>
9210 !! end
9211
9212 !! test
9213 Magic Word: {{CURRENTDOW}}
9214 !! wikitext
9215 {{CURRENTDOW}}
9216 !! html
9217 <p>4
9218 </p>
9219 !! end
9220
9221 !! test
9222 Magic Word: {{CURRENTMONTH}}
9223 !! wikitext
9224 {{CURRENTMONTH}}
9225 !! html
9226 <p>01
9227 </p>
9228 !! end
9229
9230 !! test
9231 Magic Word: {{CURRENTMONTH1}}
9232 !! wikitext
9233 {{CURRENTMONTH1}}
9234 !! html
9235 <p>1
9236 </p>
9237 !! end
9238
9239 !! test
9240 Magic Word: {{CURRENTMONTHABBREV}}
9241 !! wikitext
9242 {{CURRENTMONTHABBREV}}
9243 !! html
9244 <p>Jan
9245 </p>
9246 !! end
9247
9248 !! test
9249 Magic Word: {{CURRENTMONTHNAME}}
9250 !! wikitext
9251 {{CURRENTMONTHNAME}}
9252 !! html
9253 <p>January
9254 </p>
9255 !! end
9256
9257 !! test
9258 Magic Word: {{CURRENTMONTHNAMEGEN}}
9259 !! wikitext
9260 {{CURRENTMONTHNAMEGEN}}
9261 !! html
9262 <p>January
9263 </p>
9264 !! end
9265
9266 !! test
9267 Magic Word: {{CURRENTTIME}}
9268 !! wikitext
9269 {{CURRENTTIME}}
9270 !! html
9271 <p>00:02
9272 </p>
9273 !! end
9274
9275 !! test
9276 Magic Word: {{CURRENTHOUR}}
9277 !! wikitext
9278 {{CURRENTHOUR}}
9279 !! html
9280 <p>00
9281 </p>
9282 !! end
9283
9284 !! test
9285 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9286 !! wikitext
9287 {{CURRENTWEEK}}
9288 !! html
9289 <p>1
9290 </p>
9291 !! end
9292
9293 !! test
9294 Magic Word: {{CURRENTYEAR}}
9295 !! wikitext
9296 {{CURRENTYEAR}}
9297 !! html
9298 <p>1970
9299 </p>
9300 !! end
9301
9302 !! test
9303 Magic Word: {{CURRENTTIMESTAMP}}
9304 !! wikitext
9305 {{CURRENTTIMESTAMP}}
9306 !! html
9307 <p>19700101000203
9308 </p>
9309 !! end
9310
9311 !! test
9312 Magic Words LOCAL (UTC)
9313 !! wikitext
9314 * {{LOCALMONTH}}
9315 * {{LOCALMONTH1}}
9316 * {{LOCALMONTHNAME}}
9317 * {{LOCALMONTHNAMEGEN}}
9318 * {{LOCALMONTHABBREV}}
9319 * {{LOCALDAY}}
9320 * {{LOCALDAY2}}
9321 * {{LOCALDAYNAME}}
9322 * {{LOCALYEAR}}
9323 * {{LOCALTIME}}
9324 * {{LOCALHOUR}}
9325 * {{LOCALWEEK}}
9326 * {{LOCALDOW}}
9327 * {{LOCALTIMESTAMP}}
9328 !! html
9329 <ul><li> 01</li>
9330 <li> 1</li>
9331 <li> January</li>
9332 <li> January</li>
9333 <li> Jan</li>
9334 <li> 1</li>
9335 <li> 01</li>
9336 <li> Thursday</li>
9337 <li> 1970</li>
9338 <li> 00:02</li>
9339 <li> 00</li>
9340 <li> 1</li>
9341 <li> 4</li>
9342 <li> 19700101000203</li></ul>
9343
9344 !! end
9345
9346 !! test
9347 Magic Word: {{FULLPAGENAME}}
9348 !! options
9349 title=[[User:Ævar Arnfjörð Bjarmason]]
9350 !! wikitext
9351 {{FULLPAGENAME}}
9352 !! html
9353 <p>User:Ævar Arnfjörð Bjarmason
9354 </p>
9355 !! end
9356
9357 !! test
9358 Magic Word: {{FULLPAGENAMEE}}
9359 !! options
9360 title=[[User:Ævar Arnfjörð Bjarmason]]
9361 !! wikitext
9362 {{FULLPAGENAMEE}}
9363 !! html
9364 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9365 </p>
9366 !! end
9367
9368 !! test
9369 Magic Word: {{TALKSPACE}}
9370 !! options
9371 title=[[User:Ævar Arnfjörð Bjarmason]]
9372 !! wikitext
9373 {{TALKSPACE}}
9374 !! html
9375 <p>User talk
9376 </p>
9377 !! end
9378
9379 !! test
9380 Magic Word: {{TALKSPACE}}, same namespace
9381 !! options
9382 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9383 !! wikitext
9384 {{TALKSPACE}}
9385 !! html
9386 <p>User talk
9387 </p>
9388 !! end
9389
9390 !! test
9391 Magic Word: {{TALKSPACE}}, main namespace
9392 !! options
9393 title=[[Parser Test]]
9394 !! wikitext
9395 {{TALKSPACE}}
9396 !! html
9397 <p>Talk
9398 </p>
9399 !! end
9400
9401 !! test
9402 Magic Word: {{TALKSPACEE}}
9403 !! options
9404 title=[[User:Ævar Arnfjörð Bjarmason]]
9405 !! wikitext
9406 {{TALKSPACEE}}
9407 !! html
9408 <p>User_talk
9409 </p>
9410 !! end
9411
9412 !! test
9413 Magic Word: {{SUBJECTSPACE}}
9414 !! options
9415 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9416 !! wikitext
9417 {{SUBJECTSPACE}}
9418 !! html
9419 <p>User
9420 </p>
9421 !! end
9422
9423 !! test
9424 Magic Word: {{SUBJECTSPACE}}, same namespace
9425 !! options
9426 title=[[User:Ævar Arnfjörð Bjarmason]]
9427 !! wikitext
9428 {{SUBJECTSPACE}}
9429 !! html
9430 <p>User
9431 </p>
9432 !! end
9433
9434 !! test
9435 Magic Word: {{SUBJECTSPACE}}, main namespace
9436 !! options
9437 title=[[Parser Test]]
9438 !! wikitext
9439 {{SUBJECTSPACE}}
9440 !! html
9441
9442 !! end
9443
9444 !! test
9445 Magic Word: {{SUBJECTSPACEE}}
9446 !! options
9447 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9448 !! wikitext
9449 {{SUBJECTSPACEE}}
9450 !! html
9451 <p>User
9452 </p>
9453 !! end
9454
9455 !! test
9456 Magic Word: {{NAMESPACE}}
9457 !! options
9458 title=[[User:Ævar Arnfjörð Bjarmason]]
9459 !! wikitext
9460 {{NAMESPACE}}
9461 !! html
9462 <p>User
9463 </p>
9464 !! end
9465
9466 !! test
9467 Magic Word: {{NAMESPACEE}}
9468 !! options
9469 title=[[User:Ævar Arnfjörð Bjarmason]]
9470 !! wikitext
9471 {{NAMESPACEE}}
9472 !! html
9473 <p>User
9474 </p>
9475 !! end
9476
9477 !! test
9478 Magic Word: {{NAMESPACENUMBER}}
9479 !! options
9480 title=[[User:Ævar Arnfjörð Bjarmason]]
9481 !! wikitext
9482 {{NAMESPACENUMBER}}
9483 !! html
9484 <p>2
9485 </p>
9486 !! end
9487
9488 !! test
9489 Magic Word: {{SUBPAGENAME}}
9490 !! options
9491 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9492 !! wikitext
9493 {{SUBPAGENAME}}
9494 !! html
9495 <p>sub ö
9496 </p>
9497 !! end
9498
9499 !! test
9500 Magic Word: {{SUBPAGENAMEE}}
9501 !! options
9502 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9503 !! wikitext
9504 {{SUBPAGENAMEE}}
9505 !! html
9506 <p>sub_%C3%B6
9507 </p>
9508 !! end
9509
9510 !! test
9511 Magic Word: {{ROOTPAGENAME}}
9512 !! options
9513 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9514 !! wikitext
9515 {{ROOTPAGENAME}}
9516 !! html
9517 <p>Ævar Arnfjörð Bjarmason
9518 </p>
9519 !! end
9520
9521 !! test
9522 Magic Word: {{ROOTPAGENAMEE}}
9523 !! options
9524 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9525 !! wikitext
9526 {{ROOTPAGENAMEE}}
9527 !! html
9528 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9529 </p>
9530 !! end
9531
9532 !! test
9533 Magic Word: {{BASEPAGENAME}}
9534 !! options
9535 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9536 !! wikitext
9537 {{BASEPAGENAME}}
9538 !! html
9539 <p>Ævar Arnfjörð Bjarmason
9540 </p>
9541 !! end
9542
9543 !! test
9544 Magic Word: {{BASEPAGENAMEE}}
9545 !! options
9546 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9547 !! wikitext
9548 {{BASEPAGENAMEE}}
9549 !! html
9550 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9551 </p>
9552 !! end
9553
9554 !! test
9555 Magic Word: {{TALKPAGENAME}}
9556 !! options
9557 title=[[User:Ævar Arnfjörð Bjarmason]]
9558 !! wikitext
9559 {{TALKPAGENAME}}
9560 !! html
9561 <p>User talk:Ævar Arnfjörð Bjarmason
9562 </p>
9563 !! end
9564
9565 !! test
9566 Magic Word: {{TALKPAGENAMEE}}
9567 !! options
9568 title=[[User:Ævar Arnfjörð Bjarmason]]
9569 !! wikitext
9570 {{TALKPAGENAMEE}}
9571 !! html
9572 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9573 </p>
9574 !! end
9575
9576 !! test
9577 Magic Word: {{SUBJECTPAGENAME}}
9578 !! options
9579 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9580 !! wikitext
9581 {{SUBJECTPAGENAME}}
9582 !! html
9583 <p>User:Ævar Arnfjörð Bjarmason
9584 </p>
9585 !! end
9586
9587 !! test
9588 Magic Word: {{SUBJECTPAGENAMEE}}
9589 !! options
9590 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9591 !! wikitext
9592 {{SUBJECTPAGENAMEE}}
9593 !! html
9594 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9595 </p>
9596 !! end
9597
9598 !! test
9599 Magic Word: {{NUMBEROFFILES}}
9600 !! wikitext
9601 {{NUMBEROFFILES}}
9602 !! html
9603 <p>5
9604 </p>
9605 !! end
9606
9607 !! test
9608 Magic Word: {{PAGENAME}}
9609 !! options
9610 title=[[User:Ævar Arnfjörð Bjarmason]]
9611 !! wikitext
9612 {{PAGENAME}}
9613 !! html
9614 <p>Ævar Arnfjörð Bjarmason
9615 </p>
9616 !! end
9617
9618 !! test
9619 Magic Word: {{PAGENAME}} with metacharacters
9620 !! options
9621 title=[['foo & bar = baz']]
9622 !! wikitext
9623 ''{{PAGENAME}}''
9624 !! html/php
9625 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9626 </p>
9627 !! html+tidy
9628 <p><i>'foo &amp; bar = baz'</i></p>
9629 !! end
9630
9631 !! test
9632 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9633 !! options
9634 title=[[*RFC 1234 http://example.com/]]
9635 !! wikitext
9636 {{PAGENAME}}
9637 !! html/php
9638 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9639 </p>
9640 !! html+tidy
9641 <p>*RFC 1234 http://example.com/</p>
9642 !! end
9643
9644 !! test
9645 Magic Word: {{PAGENAMEE}}
9646 !! options
9647 title=[[User:Ævar Arnfjörð Bjarmason]]
9648 !! wikitext
9649 {{PAGENAMEE}}
9650 !! html
9651 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9652 </p>
9653 !! end
9654
9655 !! test
9656 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9657 !! options
9658 title=[[*RFC 1234 http://example.com/]]
9659 !! wikitext
9660 {{PAGENAMEE}}
9661 !! html/php
9662 <p>&#42;RFC_1234_http&#58;//example.com/
9663 </p>
9664 !! html+tidy
9665 <p>*RFC_1234_http://example.com/</p>
9666 !! end
9667
9668 !! test
9669 Magic Word: {{REVISIONID}}
9670 !! wikitext
9671 {{REVISIONID}}
9672 !! html
9673 <p>1337
9674 </p>
9675 !! end
9676
9677 !! test
9678 Magic Word: {{SCRIPTPATH}}
9679 !! wikitext
9680 {{SCRIPTPATH}}
9681 !! html
9682 <p>/
9683 </p>
9684 !! end
9685
9686 !! test
9687 Magic Word: {{STYLEPATH}}
9688 !! wikitext
9689 {{STYLEPATH}}
9690 !! html
9691 <p>/skins
9692 </p>
9693 !! end
9694
9695 !! test
9696 Magic Word: {{SERVER}}
9697 !! wikitext
9698 {{SERVER}}
9699 !! html
9700 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9701 </p>
9702 !! end
9703
9704 !! test
9705 Magic Word: {{SERVERNAME}}
9706 !! wikitext
9707 {{SERVERNAME}}
9708 !! html
9709 <p>example.org
9710 </p>
9711 !! end
9712
9713 !! test
9714 Magic Word: {{SITENAME}}
9715 !! wikitext
9716 {{SITENAME}}
9717 !! html
9718 <p>MediaWiki
9719 </p>
9720 !! end
9721
9722 !! test
9723 Case-sensitive magic words, when cased differently, should just be template transclusions
9724 !! wikitext
9725 {{CurrentMonth}}
9726 {{currentday}}
9727 {{cURreNTweEK}}
9728 {{currentHour}}
9729 !! html
9730 <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>
9731 <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>
9732 <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>
9733 <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>
9734 </p>
9735 !! end
9736
9737 !! test
9738 Case-insensitive magic words should still work with weird casing.
9739 !! wikitext
9740 {{sErVeRNaMe}}
9741 {{LCFirst:AOEU}}
9742 {{ucFIRST:aoeu}}
9743 {{SERver}}
9744 !! html
9745 <p>example.org
9746 aOEU
9747 Aoeu
9748 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9749 </p>
9750 !! end
9751
9752 # From plwiki:PLOS_ONE
9753 !! test
9754 Parsoid: Page property magic word with magic word contents
9755 !! wikitext
9756 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9757 !! html/parsoid
9758 <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>"}]]}'/>
9759 !! end
9760
9761 !! test
9762 Parsoid: Template-generated DISPLAYTITLE
9763 !! wikitext
9764 {{{{echo|DISPLAYTITLE}}:Foo}}
9765 !! html/parsoid
9766 <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}}]}'/>
9767 !! end
9768
9769 !! test
9770 Namespace 1 {{ns:1}}
9771 !! wikitext
9772 {{ns:1}}
9773 !! html
9774 <p>Talk
9775 </p>
9776 !! end
9777
9778 !! test
9779 Namespace 1 {{ns:01}}
9780 !! wikitext
9781 {{ns:01}}
9782 !! html
9783 <p>Talk
9784 </p>
9785 !! end
9786
9787 !! test
9788 Namespace 0 {{ns:0}} (bug 4783)
9789 !! wikitext
9790 {{ns:0}}
9791 !! html
9792
9793 !! end
9794
9795 !! test
9796 Namespace 0 {{ns:00}} (bug 4783)
9797 !! wikitext
9798 {{ns:00}}
9799 !! html
9800
9801 !! end
9802
9803 !! test
9804 Namespace -1 {{ns:-1}}
9805 !! wikitext
9806 {{ns:-1}}
9807 !! html
9808 <p>Special
9809 </p>
9810 !! end
9811
9812 !! test
9813 Namespace User {{ns:User}}
9814 !! wikitext
9815 {{ns:User}}
9816 !! html
9817 <p>User
9818 </p>
9819 !! end
9820
9821 !! test
9822 Namespace User talk {{ns:User_talk}}
9823 !! wikitext
9824 {{ns:User_talk}}
9825 !! html
9826 <p>User talk
9827 </p>
9828 !! end
9829
9830 !! test
9831 Namespace User talk {{ns:uSeR tAlK}}
9832 !! wikitext
9833 {{ns:uSeR tAlK}}
9834 !! html
9835 <p>User talk
9836 </p>
9837 !! end
9838
9839 !! test
9840 Namespace File {{ns:File}}
9841 !! wikitext
9842 {{ns:File}}
9843 !! html
9844 <p>File
9845 </p>
9846 !! end
9847
9848 !! test
9849 Namespace File {{ns:Image}}
9850 !! wikitext
9851 {{ns:Image}}
9852 !! html
9853 <p>File
9854 </p>
9855 !! end
9856
9857 !! test
9858 Namespace (lang=de) Benutzer {{ns:User}}
9859 !! options
9860 language=de
9861 !! wikitext
9862 {{ns:User}}
9863 !! html
9864 <p>Benutzer
9865 </p>
9866 !! end
9867
9868 !! test
9869 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9870 !! options
9871 language=de
9872 !! wikitext
9873 {{ns:3}}
9874 !! html
9875 <p>Benutzer Diskussion
9876 </p>
9877 !! end
9878
9879
9880 !! test
9881 Urlencode
9882 !! wikitext
9883 {{urlencode:hi world?!}}
9884 {{urlencode:hi world?!|WIKI}}
9885 {{urlencode:hi world?!|PATH}}
9886 {{urlencode:hi world?!|QUERY}}
9887 !! html
9888 <p>hi+world%3F%21
9889 hi_world%3F!
9890 hi%20world%3F%21
9891 hi+world%3F%21
9892 </p>
9893 !! end
9894
9895 !! test
9896 Magic Word: prioritize type info over data-parsoid
9897 !! options
9898 parsoid=html2wt
9899 !! html/parsoid
9900 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9901 !! wikitext
9902 __FORCETOC__
9903 !! end
9904
9905 !! test
9906 Magic Word: serialize on separate line (parsoid)
9907 !! options
9908 parsoid=wt2wt,html2wt
9909 !! wikitext
9910 foo
9911 __NOTOC__
9912 bar
9913 !! html/parsoid
9914 foo<meta property="mw:PageProp/notoc"/>bar
9915 !! end
9916
9917 !! test
9918 Magic Word: rt non-english wikis
9919 !! options
9920 parsoid=wt2wt
9921 language=de
9922 !! wikitext
9923 __NOEDITSECTION__
9924 !! html/parsoid
9925 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9926 !! end
9927
9928 !!test
9929 __proto__ is treated as normal wikitext (T105997)
9930 !!wikitext
9931 __proto__
9932 !!html
9933 <p>__proto__
9934 </p>
9935 !!end
9936
9937 ###
9938 ### Magic links
9939 ###
9940 !! test
9941 Magic links: internal link to RFC (bug 479)
9942 !! wikitext
9943 [[RFC 123]]
9944 !! html/php
9945 <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>
9946 </p>
9947 !! html/parsoid
9948 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
9949 !! end
9950
9951 !! test
9952 Magic links: RFC (bug 479)
9953 !! wikitext
9954 RFC 822
9955 !! html/php
9956 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9957 </p>
9958 !! html/parsoid
9959 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
9960 !! end
9961
9962 !! test
9963 Magic links: RFC (bug 65278)
9964 !! wikitext
9965 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9966 !! html/php
9967 <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.
9968 </p>
9969 !! html/parsoid
9970 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
9971 !! end
9972
9973 !! test
9974 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9975 !! wikitext
9976 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9977 RFC
9978 822
9979 !! html/php
9980 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9981 RFC
9982 822
9983 </p>
9984 !! html/parsoid
9985 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
9986 RFC
9987 822</p>
9988 !! end
9989
9990 !! test
9991 Magic links: ISBN (bug 1937)
9992 !! wikitext
9993 ISBN 0-306-40615-2
9994 !! html/php
9995 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9996 </p>
9997 !! html/parsoid
9998 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
9999 !! end
10000
10001 !! test
10002 Magic links: ISBN (bug 65278)
10003 !! wikitext
10004 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10005 !! html/php
10006 <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.
10007 </p>
10008 !! html/parsoid
10009 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10010 !! end
10011
10012 !! test
10013 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10014 !! wikitext
10015 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10016 ISBN
10017 9780316098113
10018 ISBN 978
10019 0316098113
10020 !! html/php
10021 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10022 ISBN
10023 9780316098113
10024 ISBN 978
10025 0316098113
10026 </p>
10027 !! html/parsoid
10028 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10029 ISBN
10030 9780316098113
10031 ISBN 978
10032 0316098113</p>
10033 !! end
10034
10035 !! test
10036 Magic links: PMID incorrectly converts space to underscore
10037 !! wikitext
10038 PMID 1234
10039 !! html/php
10040 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10041 </p>
10042 !! html/parsoid
10043 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10044 !! end
10045
10046 !! test
10047 Magic links: PMID (bug 65278)
10048 !! wikitext
10049 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10050 !! html/php
10051 <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.
10052 </p>
10053 !! html/parsoid
10054 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10055 !! end
10056
10057 !! test
10058 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10059 !! wikitext
10060 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10061 PMID
10062 1234
10063 !! html/php
10064 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10065 PMID
10066 1234
10067 </p>
10068 !! html/parsoid
10069 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10070 PMID
10071 1234</p>
10072 !! end
10073
10074 ###
10075 ### Templates
10076 ####
10077
10078 !! test
10079 Nonexistent template
10080 !! wikitext
10081 {{thistemplatedoesnotexist}}
10082 !! html
10083 <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>
10084 </p>
10085 !! end
10086
10087 !! test
10088 Template with invalid target containing tags
10089 !! wikitext
10090 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10091 !! html
10092 <p>{{a<b>b</b>|foo|a=b|a = b}}
10093 </p>
10094 !! end
10095
10096 !! test
10097 Template with invalid target containing unclosed tag
10098 !! wikitext
10099 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10100 !! html
10101 <p>{{a<b>|foo|a=b|a = b}}</b>
10102 </p>
10103 !! end
10104
10105 !! test
10106 Template with invalid target containing wikilink
10107 !! wikitext
10108 {{[[Main Page]]}}
10109 !! html/php
10110 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10111 </p>
10112 !! html/parsoid
10113 <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>
10114 !! end
10115
10116 !! test
10117 Template with just whitespace in it, bug #68421
10118 !! wikitext
10119 {{echo|{{ }}}}
10120 !! html/parsoid
10121 <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>
10122 !! end
10123
10124 !! article
10125 Template:test
10126 !! text
10127 This is a test template
10128 !! endarticle
10129
10130 !! test
10131 Simple template
10132 !! wikitext
10133 {{test}}
10134 !! html
10135 <p>This is a test template
10136 </p>
10137 !! end
10138
10139 !! test
10140 Template with explicit namespace
10141 !! wikitext
10142 {{Template:test}}
10143 !! html
10144 <p>This is a test template
10145 </p>
10146 !! end
10147
10148
10149 !! article
10150 Template:paramtest
10151 !! text
10152 This is a test template with parameter {{{param}}}
10153 !! endarticle
10154
10155 !! test
10156 Template parameter
10157 !! wikitext
10158 {{paramtest|param=foo}}
10159 !! html
10160 <p>This is a test template with parameter foo
10161 </p>
10162 !! end
10163
10164 !! article
10165 Template:paramtestnum
10166 !! text
10167 [[{{{1}}}|{{{2}}}]]
10168 !! endarticle
10169
10170 !! test
10171 Template unnamed parameter
10172 !! wikitext
10173 {{paramtestnum|Main Page|the main page}}
10174 !! html
10175 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10176 </p>
10177 !! end
10178
10179 !! article
10180 Template:templatesimple
10181 !! text
10182 (test)
10183 !! endarticle
10184
10185 !! article
10186 Template:templateredirect
10187 !! text
10188 #redirect [[Template:templatesimple]]
10189 !! endarticle
10190
10191 !! article
10192 Template:templateasargtestnum
10193 !! text
10194 {{{{{1}}}}}
10195 !! endarticle
10196
10197 !! article
10198 Template:templateasargtest
10199 !! text
10200 {{template{{{templ}}}}}
10201 !! endarticle
10202
10203 !! article
10204 Template:templateasargtest2
10205 !! text
10206 {{{{{templ}}}}}
10207 !! endarticle
10208
10209 !! test
10210 Template with template name as unnamed argument
10211 !! wikitext
10212 {{templateasargtestnum|templatesimple}}
10213 !! html
10214 <p>(test)
10215 </p>
10216 !! end
10217
10218 !! test
10219 Template with template name as argument
10220 !! wikitext
10221 {{templateasargtest|templ=simple}}
10222 !! html
10223 <p>(test)
10224 </p>
10225 !! end
10226
10227 !! test
10228 Template with template name as argument (2)
10229 !! wikitext
10230 {{templateasargtest2|templ=templatesimple}}
10231 !! html
10232 <p>(test)
10233 </p>
10234 !! end
10235
10236 !! article
10237 Template:templateasargtestdefault
10238 !! text
10239 {{{{{templ|templatesimple}}}}}
10240 !! endarticle
10241
10242 !! article
10243 Template:templa
10244 !! text
10245 '''templ'''
10246 !! endarticle
10247
10248 !! test
10249 Template with default value
10250 !! wikitext
10251 {{templateasargtestdefault}}
10252 !! html
10253 <p>(test)
10254 </p>
10255 !! end
10256
10257 !! test
10258 Template with default value (value set)
10259 !! wikitext
10260 {{templateasargtestdefault|templ=templa}}
10261 !! html
10262 <p><b>templ</b>
10263 </p>
10264 !! end
10265
10266 !! test
10267 Template redirect
10268 !! wikitext
10269 {{templateredirect}}
10270 !! html/php
10271 <p>(test)
10272 </p>
10273 !! html/parsoid
10274 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10275 !! end
10276
10277 !! test
10278 Template with argument in separate line
10279 !! wikitext
10280 {{ templateasargtest |
10281 templ = simple }}
10282 !! html
10283 <p>(test)
10284 </p>
10285 !! end
10286
10287 !! test
10288 Template with complex template as argument
10289 !! wikitext
10290 {{paramtest|
10291 param ={{ templateasargtest |
10292 templ = simple }}}}
10293 !! html
10294 <p>This is a test template with parameter (test)
10295 </p>
10296 !! end
10297
10298 !! test
10299 Template with thumb image (with link in description)
10300 !! wikitext
10301 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10302 !! html/php
10303 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>
10304
10305 !! html+tidy
10306 <p>This is a test template with parameter</p>
10307 <div class="thumb tright">
10308 <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>
10309 <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>
10310 </div>
10311 </div>
10312 !! html/parsoid
10313 <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>
10314 !! end
10315
10316 !! article
10317 Template:complextemplate
10318 !! text
10319 {{{1}}} {{paramtest|
10320 param ={{{param}}}}}
10321 !! endarticle
10322
10323 !! test
10324 Template with complex arguments
10325 !! wikitext
10326 {{complextemplate|
10327 param ={{ templateasargtest |
10328 templ = simple }}|[[Template:complextemplate|link]]}}
10329 !! html
10330 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10331 </p>
10332 !! end
10333
10334 !! test
10335 BUG 553: link with two variables in a piped link
10336 !! wikitext
10337 {|
10338 |[[{{{1}}}|{{{2}}}]]
10339 |}
10340 !! html
10341 <table>
10342 <tr>
10343 <td>[[{{{1}}}|{{{2}}}]]
10344 </td></tr></table>
10345
10346 !! end
10347
10348 !! test
10349 Magic variable as template parameter
10350 !! wikitext
10351 {{paramtest|param={{SITENAME}}}}
10352 !! html
10353 <p>This is a test template with parameter MediaWiki
10354 </p>
10355 !! end
10356
10357 !! article
10358 Template:linktest
10359 !! text
10360 [[{{{param}}}|link]]
10361 !! endarticle
10362
10363 !! test
10364 Template parameter as link source
10365 !! wikitext
10366 {{linktest|param=Main Page}}
10367 !! html
10368 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10369 </p>
10370 !! end
10371
10372 !!article
10373 Template:paramtest2
10374 !! text
10375 including another template, {{paramtest|param={{{arg}}}}}
10376 !! endarticle
10377
10378 !! test
10379 Template passing argument to another template
10380 !! wikitext
10381 {{paramtest2|arg='hmm'}}
10382 !! html
10383 <p>including another template, This is a test template with parameter 'hmm'
10384 </p>
10385 !! end
10386
10387 !! article
10388 Template:Linktest2
10389 !! text
10390 Main Page
10391 !! endarticle
10392
10393 !! test
10394 Template as link source
10395 !! wikitext
10396 [[{{linktest2}}]]
10397
10398 [[{{linktest2}}|Main Page]]
10399
10400 [[{{linktest2}}]]Page
10401 !! html
10402 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10403 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10404 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10405 </p>
10406 !! end
10407
10408
10409 !! article
10410 Template:loop1
10411 !! text
10412 {{loop2}}
10413 !! endarticle
10414
10415 !! article
10416 Template:loop2
10417 !! text
10418 {{loop1}}
10419 !! endarticle
10420
10421 !! test
10422 Template infinite loop
10423 !! wikitext
10424 {{loop1}}
10425 !! html
10426 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10427 </p>
10428 !! end
10429
10430 !! test
10431 Template from main namespace
10432 !! wikitext
10433 {{:Main Page}}
10434 !! html
10435 <p>blah blah
10436 </p>
10437 !! end
10438
10439 !! article
10440 Template:table
10441 !! text
10442 {|
10443 | 1 || 2
10444 |-
10445 | 3 || 4
10446 |}
10447 !! endarticle
10448
10449 !! test
10450 BUG 529: Template with table, not included at beginning of line
10451 !! wikitext
10452 foo {{table}}
10453 !! html
10454 <p>foo
10455 </p>
10456 <table>
10457 <tr>
10458 <td> 1 </td>
10459 <td> 2
10460 </td></tr>
10461 <tr>
10462 <td> 3 </td>
10463 <td> 4
10464 </td></tr></table>
10465
10466 !! end
10467
10468 !! test
10469 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10470 !! wikitext
10471 foo
10472 {{table}}
10473 !! html
10474 <p>foo
10475 </p>
10476 <table>
10477 <tr>
10478 <td> 1 </td>
10479 <td> 2
10480 </td></tr>
10481 <tr>
10482 <td> 3 </td>
10483 <td> 4
10484 </td></tr></table>
10485
10486 !! end
10487
10488 !! test
10489 BUG 41: Template parameters shown as broken links
10490 !! wikitext
10491 {{{parameter}}}
10492 !! html
10493 <p>{{{parameter}}}
10494 </p>
10495 !! end
10496
10497 !! test
10498 Template with targets containing wikilinks
10499 !! wikitext
10500 {{[[foo]]}}
10501
10502 {{[[{{echo|foo}}]]}}
10503
10504 {{{{echo|[[foo}}]]}}
10505 !! html
10506 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10507 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10508 </p><p>{{[[foo}}]]
10509 </p>
10510 !! end
10511
10512 !! article
10513 Template:''
10514 !! text
10515 bar
10516 !! endarticle
10517
10518 !! test
10519 Templates: Double quotes as template target
10520 !! wikitext
10521 foo {{''}} baz
10522 !! html/php
10523 <p>foo bar baz
10524 </p>
10525 !! html/parsoid
10526 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10527 </p>
10528 !! end
10529
10530 !! article
10531 Template:MSGNW test
10532 !! text
10533 ''None'' of '''this''' should be
10534 * interpreted
10535 but rather passed unmodified
10536 {{test}}
10537 <gallery>
10538 File:Foobar.jpg
10539 </gallery>
10540 <!-- comment -->
10541 !! endarticle
10542
10543 # hmm, fix this or just deprecate msgnw and document its behavior?
10544 !! test
10545 msgnw keyword
10546 !! wikitext
10547 {{msgnw:MSGNW test}}
10548 !! html/php
10549 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10550 &#42; interpreted
10551 &#32;but rather passed unmodified
10552 &#123;&#123;test&#125;&#125;
10553 &#60;gallery&#62;
10554 File:Foobar.jpg
10555 &#60;/gallery&#62;
10556 &#60;!-- comment --&#62;
10557 </p>
10558 !! end
10559
10560 !! test
10561 int keyword
10562 !! wikitext
10563 {{int:youhavenewmessages|lots of money|not!}}
10564 !! html
10565 <p>You have lots of money (not!).
10566 </p>
10567 !! end
10568
10569 !! test
10570 int keyword - non-existing message
10571 !! wikitext
10572 {{int:var}}
10573 !! html
10574 <p>&lt;var&gt;
10575 </p>
10576 !! end
10577
10578 !! article
10579 Template:Includes
10580 !! text
10581 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10582 !! endarticle
10583
10584 !! test
10585 <includeonly> and <noinclude> being included
10586 !! wikitext
10587 {{Includes}}
10588 !! html
10589 <p>Foobar
10590 </p>
10591 !! end
10592
10593 !! article
10594 Template:Includes2
10595 !! text
10596 <onlyinclude>Foo</onlyinclude>bar
10597 !! endarticle
10598
10599 !! test
10600 <onlyinclude> being included
10601 !! wikitext
10602 {{Includes2}}
10603 !! html
10604 <p>Foo
10605 </p>
10606 !! end
10607
10608
10609 !! article
10610 Template:Includes3
10611 !! text
10612 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10613 !! endarticle
10614
10615 !! test
10616 <onlyinclude> and <includeonly> being included
10617 !! wikitext
10618 {{Includes3}}
10619 !! html
10620 <p>Foo
10621 </p>
10622 !! end
10623
10624 !! test
10625 <includeonly> and <noinclude> on a page
10626 !! wikitext
10627 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10628 !! html
10629 <p>Foozar
10630 </p>
10631 !! end
10632
10633 !! test
10634 Un-closed <noinclude>
10635 !! wikitext
10636 <noinclude>
10637 !! html
10638 !! end
10639
10640 !! test
10641 <onlyinclude> on a page
10642 !! wikitext
10643 <onlyinclude>Foo</onlyinclude>bar
10644 !! html
10645 <p>Foobar
10646 </p>
10647 !! end
10648
10649 !! test
10650 Un-closed <onlyinclude>
10651 !! wikitext
10652 <onlyinclude>
10653 !! html
10654 !! end
10655
10656 !!test
10657 Self-closed noinclude, includeonly, onlyinclude tags
10658 !! wikitext
10659 <noinclude />
10660 <includeonly />
10661 <onlyinclude />
10662 !! html
10663 <p><br />
10664 </p>
10665 !!end
10666
10667 !!test
10668 Unbalanced includeonly and noinclude tags
10669 !! wikitext
10670 {|
10671 |a</noinclude>
10672 |b</noinclude></noinclude>
10673 |c</noinclude></includeonly>
10674 |d</includeonly></includeonly>
10675 |}
10676 !! html
10677 <table>
10678 <tr>
10679 <td>a
10680 </td>
10681 <td>b
10682 </td>
10683 <td>c&lt;/includeonly&gt;
10684 </td>
10685 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10686 </td></tr></table>
10687
10688 !!end
10689
10690 !! article
10691 Template:Includeonly section
10692 !! text
10693 <includeonly>
10694 ==Includeonly section==
10695 </includeonly>
10696 ==Section T-1==
10697 !!endarticle
10698
10699 !! test
10700 Bug 6563: Edit link generation for section shown by <includeonly>
10701 !! wikitext
10702 {{includeonly section}}
10703 !! html
10704 <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>
10705 <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>
10706
10707 !! end
10708
10709 # Uses same input as the contents of [[Template:Includeonly section]]
10710 !! test
10711 Bug 6563: Section extraction for section shown by <includeonly>
10712 !! options
10713 section=T-2
10714 !! wikitext
10715 <includeonly>
10716 ==Includeonly section==
10717 </includeonly>
10718 ==Section T-2==
10719 !! html
10720 ==Section T-2==
10721 !! end
10722
10723 !! test
10724 Bug 6563: Edit link generation for section suppressed by <includeonly>
10725 !! wikitext
10726 <includeonly>
10727 ==Includeonly section==
10728 </includeonly>
10729 ==Section 1==
10730 !! html
10731 <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>
10732
10733 !! end
10734
10735 !! test
10736 Bug 6563: Section extraction for section suppressed by <includeonly>
10737 !! options
10738 section=1
10739 !! wikitext
10740 <includeonly>
10741 ==Includeonly section==
10742 </includeonly>
10743 ==Section 1==
10744 !! html
10745 ==Section 1==
10746 !! end
10747
10748 !! test
10749 Un-closed <includeonly>
10750 !! wikitext
10751 <includeonly>
10752 !! html
10753 !! end
10754
10755 !! test
10756 Includes and comments at SOL
10757 !! wikitext
10758 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10759
10760 <noinclude>
10761 some
10762 </noinclude>* stuff
10763 * here
10764
10765 <includeonly>can have stuff</includeonly>=== here ===
10766
10767 !! html/php
10768 <h2><span class="mw-headline" id="hu">hu</span></h2>
10769 <p>some
10770 </p>
10771 <ul><li> stuff</li>
10772 <li> here</li></ul>
10773 <h3><span class="mw-headline" id="here">here</span></h3>
10774
10775 !! html/parsoid
10776 <!-- 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>
10777
10778 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10779 <p>some</p>
10780 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10781 <li> here</li></ul>
10782
10783 <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>
10784
10785 !! end
10786
10787 # TODO: test with DOM fragment reuse!
10788 !! test
10789 Parsoid: DOM fragment reuse
10790 !! options
10791 parsoid=wt2wt,wt2html
10792 !! wikitext
10793 a{{echo|b<table></table>c}}d
10794
10795 a{{echo|b
10796 <table></table>
10797 c}}d
10798
10799 {{echo|a
10800
10801 <table></table>
10802
10803 b}}
10804 !! html
10805 <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>
10806
10807 <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">
10808 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10809 </span><p about="#mwt2">cd</p>
10810
10811 <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">
10812
10813 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10814
10815 </span><p about="#mwt3">b</p>
10816 !! end
10817
10818 !! test
10819 Parsoid: Merge double tds (T52603)
10820 !! options
10821 parsoid
10822 !! wikitext
10823 {|
10824 |{{echo|{{!}} foo}}
10825 |}
10826 !! html
10827 <table><tbody>
10828 <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>
10829 </tbody></table>
10830 !! end
10831
10832 !! test
10833 Parsoid: Merge double tds in nested transclusion content (T52603)
10834 !! options
10835 parsoid
10836 !! wikitext
10837 {{echo|<div>}}
10838 {|
10839 |{{echo|{{!}} foo}}
10840 |}
10841 {{echo|</div>}}
10842 !! html
10843 <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}}]}'>
10844 <table><tbody>
10845 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10846 </tbody></table>
10847 </div>
10848 !! end
10849
10850 ###
10851 ### <includeonly> and <noinclude> in attributes
10852 ###
10853 !!test
10854 0. includeonly around the entire attribute
10855 !! wikitext
10856 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10857 !! html
10858 <p><span id="v2">bar</span>
10859 </p>
10860 !!end
10861
10862 !!test
10863 1. includeonly in html attr key
10864 !! wikitext
10865 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10866 !! html
10867 <p><span id="foo">bar</span>
10868 </p>
10869 !!end
10870
10871 !!test
10872 2. includeonly in html attr value
10873 !! wikitext
10874 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10875 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10876 !! html
10877 <p><span id="v1">bar</span>
10878 <span id="v1">bar</span>
10879 </p>
10880 !!end
10881
10882 !!test
10883 3. includeonly in part of an attr value
10884 !! wikitext
10885 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10886 !! html
10887 <p><span style="color:red;">bar</span>
10888 </p>
10889 !!end
10890
10891 !!test
10892 4. includeonly in table attributes
10893 !! wikitext
10894 {|
10895 |- <noinclude>
10896 |-
10897 |a
10898 </noinclude>
10899 |- <includeonly>
10900 |-
10901 |b
10902 </includeonly>
10903 |}
10904 !! html
10905 <table>
10906
10907
10908 <tr>
10909 <td>a
10910 </td></tr>
10911 </table>
10912
10913 !!end
10914
10915 ###
10916 ### Token Stream Patcher tests
10917 ###
10918 ### These tests won't always pass wt2wt and other modes because
10919 ### on serialization, the table will be output on a new line.
10920 ### For now, we are blacklisting them, and using this to test selser.
10921 ###
10922
10923 !!test
10924 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10925 !!options
10926 parsoid=wt2html,wt2wt
10927 !!wikitext
10928 {{echo|}}{| width = '100%'
10929 |foo
10930 |}
10931 !!html/parsoid
10932 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10933 <tbody><tr><td>foo</td></tr>
10934 </tbody></table>
10935 !!end
10936
10937 !!test
10938 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10939 !!options
10940 parsoid=wt2html,wt2wt
10941 !!wikitext
10942 <includeonly>a</includeonly>{| {{{b}}}
10943 |c
10944 |}
10945 !!html/parsoid
10946 <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}}}":""}}'>
10947 <tbody><tr><td>c</td></tr>
10948 </tbody></table>
10949
10950 !!end
10951
10952 ###
10953 ### Testing parsing of templates where a template arg
10954 ### has the same name as the template itself.
10955 ###
10956
10957 !! article
10958 Template:quote
10959 !! text
10960 {{{quote|{{{1}}}}}}
10961 !! endarticle
10962
10963 !!test
10964 Templates: Template Name/Arg clash: 1. Use of positional param
10965 !! wikitext
10966 {{quote|foo}}
10967 !! html
10968 <p>foo
10969 </p>
10970 !!end
10971
10972 !!test
10973 Templates: Template Name/Arg clash: 2. Use of named param
10974 !! wikitext
10975 {{quote|quote=foo}}
10976 !! html
10977 <p>foo
10978 </p>
10979 !!end
10980
10981 !!test
10982 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10983 !! wikitext
10984 {{quote|quote}}
10985 !! html
10986 <p>quote
10987 </p>
10988 !!end
10989
10990 ###
10991 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10992 ###
10993
10994 !!test
10995 Templates: 1. Simple use
10996 !! wikitext
10997 {{echo|Foo}}
10998 !! html
10999 <p>Foo
11000 </p>
11001 !!end
11002
11003 !!test
11004 Templates: 2. Inside a block tag
11005 !! wikitext
11006 <div>{{echo|Foo}}</div>
11007 <blockquote>{{echo|Foo}}</blockquote>
11008 !! html
11009 <div>Foo</div>
11010 <blockquote>Foo</blockquote>
11011
11012 !! html+tidy
11013 <div>Foo</div>
11014 <blockquote>
11015 <p>Foo</p>
11016 </blockquote>
11017 !!end
11018
11019 !!test
11020 Templates: P-wrapping: 1a. Templates on consecutive lines
11021 !! wikitext
11022 {{echo|Foo}}
11023 {{echo|bar}}
11024 !! html
11025 <p>Foo
11026 bar
11027 </p>
11028 !!end
11029
11030 !!test
11031 Templates: P-wrapping: 1b. Templates on consecutive lines
11032 !! wikitext
11033 Foo
11034
11035 {{echo|bar}}
11036 {{echo|baz}}
11037 !! html
11038 <p>Foo
11039 </p><p>bar
11040 baz
11041 </p>
11042 !!end
11043
11044 !!test
11045 Templates: P-wrapping: 1c. Templates on consecutive lines
11046 !! wikitext
11047 {{echo|Foo}}
11048 {{echo|bar}} <div>baz</div>
11049 !! html
11050 <p>Foo
11051 </p>
11052 bar <div>baz</div>
11053
11054 !! html+tidy
11055 <p>Foo</p>
11056 <p>bar</p>
11057 <div>baz</div>
11058 !! end
11059
11060 !!test
11061 Templates: P-wrapping: 1d. Template preceded by comment-only line
11062 !!options
11063 parsoid
11064 !! wikitext
11065 <!-- foo -->
11066 {{echo|Bar}}
11067 !! html
11068 <!-- foo -->
11069
11070 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11071 !!end
11072
11073 !!test
11074 Templates: Inline Text: 1. Multiple template uses
11075 !! wikitext
11076 {{echo|Foo}}bar{{echo|baz}}
11077 !! html
11078 <p>Foobarbaz
11079 </p>
11080 !!end
11081
11082 !!test
11083 Templates: Inline Text: 2. Back-to-back template uses
11084 !! wikitext
11085 {{echo|Foo}}{{echo|bar}}
11086 !! html
11087 <p>Foobar
11088 </p>
11089 !!end
11090
11091 !!test
11092 Templates: Block Tags: 1. Multiple template uses
11093 !! wikitext
11094 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11095 !! html
11096 <div>Foo</div><div>bar</div><div>baz</div>
11097
11098 !!end
11099
11100 !!test
11101 Templates: Block Tags: 2. Back-to-back template uses
11102 !! wikitext
11103 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11104 !! html
11105 <div>Foo</div><div>bar</div>
11106
11107 !!end
11108
11109 # This is an edge case relating to paragraph wrapping.
11110 !!test
11111 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11112 !! wikitext
11113 {{echo|a
11114 b</p>}}
11115 !! html/parsoid
11116 <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
11117 b</p>
11118 !!end
11119
11120 !!test
11121 Templates: Links: 1. Simple example
11122 !! wikitext
11123 {{echo|[[Foo|bar]]}}
11124 !! html
11125 <p><a href="/wiki/Foo" title="Foo">bar</a>
11126 </p>
11127 !!end
11128
11129 !!test
11130 Templates: Links: 2. Generation of link href
11131 !! wikitext
11132 [[{{echo|Foo}}|bar]]
11133 !! html
11134 <p><a href="/wiki/Foo" title="Foo">bar</a>
11135 </p>
11136 !!end
11137
11138 !!test
11139 Templates: Links: 3. Generation of part of a link href
11140 !! wikitext
11141 [[Fo{{echo|o}}|bar]]
11142
11143 [[Foo{{echo|bar}}]]
11144
11145 [[Foo{{echo|bar}}baz]]
11146
11147 [[Foo{{echo|bar}}|bar]]
11148
11149 [[:Foo{{echo|bar}}]]
11150
11151 [[:Foo{{echo|bar}}|bar]]
11152 !! html
11153 <p><a href="/wiki/Foo" title="Foo">bar</a>
11154 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11155 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11156 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11157 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11158 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11159 </p>
11160 !!end
11161
11162 !!test
11163 Templates: Links: 4. Multiple templates generating link href
11164 !! wikitext
11165 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11166 !! html
11167 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11168 </p>
11169 !!end
11170
11171 !!test
11172 Templates: Links: 5. Generation of link text
11173 !! wikitext
11174 [[Foo|{{echo|bar}}]]
11175 !! html
11176 <p><a href="/wiki/Foo" title="Foo">bar</a>
11177 </p>
11178 !!end
11179
11180 !!test
11181 Templates: Links: 5. Nested templates (only outermost template should be marked)
11182 !! wikitext
11183 {{echo|[[{{echo|Foo}}|bar]]}}
11184 !! html
11185 <p><a href="/wiki/Foo" title="Foo">bar</a>
11186 </p>
11187 !!end
11188
11189 !!test
11190 Templates: HTML Tag: 1. Generation of HTML attr. key
11191 !! wikitext
11192 <div {{echo|style}}="color:red;">foo</div>
11193 !! html
11194 <div style="color:red;">foo</div>
11195
11196 !!end
11197
11198 !!test
11199 Templates: HTML Tag: 2. Generation of HTML attr. value
11200 !! wikitext
11201 <div style={{echo|'color:red;'}}>foo</div>
11202 !! html
11203 <div style="color:red;">foo</div>
11204
11205 !!end
11206
11207 !!test
11208 Templates: HTML Tag: 3. Generation of HTML attr key and value
11209 !! wikitext
11210 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11211 !! html
11212 <div style="color:red;">foo</div>
11213
11214 !!end
11215
11216 !!test
11217 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11218 !! wikitext
11219 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11220 !! html
11221 <div title="This is a long title with just one piece templated">foo</div>
11222
11223 !!end
11224
11225 !!test
11226 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11227 !! wikitext
11228 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11229 !! html
11230 <div title="This is a long title with just one piece templated">foo</div>
11231
11232 !!end
11233
11234 !!test
11235 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11236 !! wikitext
11237 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11238 !! html
11239 <div title="This is a long title with just one piece templated">foo</div>
11240
11241 !!end
11242
11243 # SSS FIXME: While it is great we added support for all this,
11244 # do we want to make this part of the spec? Maybe we want to
11245 # deprecate this kind of usage in the future?
11246 !!test
11247 Templates: HTML Tag: 7. Generation of partial attribute key string
11248 !! wikitext
11249 <div st{{echo|yle}}="color:red;">foo</div>
11250 !! html
11251 <div style="color:red;">foo</div>
11252
11253 !!end
11254
11255 !! test
11256 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11257 !! wikitext
11258 <div {{echo|1=id="v1"}}>bar</div>
11259 !! html
11260 <div id="v1">bar</div>
11261
11262 !!end
11263
11264 !! test
11265 Templates: HTML Tag: 9. Multiple template-generated attributes
11266 !! wikitext
11267 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11268 !! html
11269 <div id="v1" title="foo">bar</div>
11270
11271 !!end
11272
11273 !! test
11274 Templates: Support for templates generating attributes and content
11275 !! wikitext
11276 {| {{mixed_attr_content_template}}
11277 |-
11278 |bar
11279 |}
11280 !! html/php
11281 <table style="color:red;" title="T48811">
11282
11283 <tr>
11284 <td>foo
11285 </td></tr>
11286 <tr>
11287 <td>bar
11288 </td></tr></table>
11289
11290 !! html/parsoid
11291 <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|}"]}'>
11292 <tbody><tr>
11293 <td>foo</td></tr>
11294 <tr>
11295 <td>bar</td></tr>
11296 </tbody></table>
11297 !!end
11298
11299 !! test
11300 1. Entities and nowikis inside templated attributes should be handled correctly
11301 !! wikitext
11302 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11303 !! html/php
11304 <div style="background:#f9f9f9;">foo</div>
11305
11306 !! html/parsoid
11307 <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>
11308 !! end
11309
11310 !! test
11311 2. Entities and nowikis inside templated attributes should be handled correctly
11312 !! wikitext
11313 {|
11314 |{{table_attribs_3}}
11315 |}
11316 !! html/php
11317 <table>
11318 <tr>
11319 <td style="background:#f9f9f9;">Foo
11320 </td></tr></table>
11321
11322 !! html/parsoid
11323 <table>
11324 <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>
11325 </tbody></table>
11326 !! end
11327
11328 !! test
11329 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11330 !! wikitext
11331 {{tbl-start}}
11332 |{{table_attribs_3}}
11333 {{tbl-end}}
11334 !! html/php
11335 <table>
11336 <tr>
11337 <td style="background:#f9f9f9;">Foo
11338 </td></tr></table>
11339
11340 !! html/parsoid
11341 <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}}]}'>
11342 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11343 </tbody></table>
11344 !! end
11345
11346 # T107622
11347 !! test
11348 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11349 !! wikitext
11350 {|
11351 | {{table_attribs_6}} hi
11352 |}
11353 !! html/php
11354 <table>
11355 <tr>
11356 <td style="background: red;"> hi
11357 </td></tr></table>
11358
11359 !! html/parsoid
11360 <table>
11361 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["| ",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
11362 </tbody></table>
11363 !! end
11364
11365 !!test
11366 Templates: HTML Tables: 1. Generating start of a HTML table
11367 !! wikitext
11368 {{echo|<table><tr><td>foo</td>}}</tr></table>
11369 !! html
11370 <table><tr><td>foo</td></tr></table>
11371
11372 !!end
11373
11374 !!test
11375 Templates: HTML Tables: 2a. Generating middle of a HTML table
11376 !! wikitext
11377 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11378 !! html
11379 <table><tr><td>foo</td></tr></table>
11380
11381 !!end
11382
11383 !!test
11384 Templates: HTML Tables: 2b. Generating middle of a HTML table
11385 !! wikitext
11386 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11387 !! html
11388 <table><tr><td>foo</td></tr></table>
11389
11390 !!end
11391
11392 !!test
11393 Templates: HTML Tables: 3. Generating end of a HTML table
11394 !! wikitext
11395 <table><tr>{{echo|<td>foo</td></tr></table>}}
11396 !! html
11397 <table><tr><td>foo</td></tr></table>
11398
11399 !!end
11400
11401 !!test
11402 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11403 !! wikitext
11404 {{echo|<table>}}<tr><td>foo</td></tr></table>
11405 !! html
11406 <table><tr><td>foo</td></tr></table>
11407
11408 !!end
11409
11410 !!test
11411 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11412 !! wikitext
11413 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11414 !! html
11415 <table><tr><td>foo</td></tr></table>
11416
11417 !!end
11418
11419 !!test
11420 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11421 !! wikitext
11422 <table><tr>{{echo|<td>}}foo</td></tr></table>
11423 !! html
11424 <table><tr><td>foo</td></tr></table>
11425
11426 !!end
11427
11428 !!test
11429 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11430 !! wikitext
11431 <table><tr><td>foo{{echo|</td>}}</tr></table>
11432 !! html
11433 <table><tr><td>foo</td></tr></table>
11434
11435 !!end
11436
11437 !!test
11438 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11439 !! wikitext
11440 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11441 !! html
11442 <table><tr><td>foo</td></tr></table>
11443
11444 !!end
11445
11446 !!test
11447 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11448 !! wikitext
11449 <table><tr><td>foo</td></tr>{{echo|</table>}}
11450 !! html
11451 <table><tr><td>foo</td></tr></table>
11452
11453 !!end
11454
11455 !!test
11456 Templates: HTML Tables: 5. Proper fostering of categories from inside
11457 !!options
11458 parsoid=wt2html,wt2wt
11459 !! wikitext
11460 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11461 <!--Two categories (Bug 50330)-->
11462 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11463 !! html
11464 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11465 <!--Two categories (Bug 50330)-->
11466 <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>
11467 !!end
11468
11469 !!test
11470 Templates: Wiki Tables: 1a. Fostering of entire template content
11471 !! wikitext
11472 {|
11473 {{echo|a}}
11474 |}
11475 !! html
11476 <table>
11477 a
11478 <tr><td></td></tr></table>
11479
11480 !! html+tidy
11481 <p>a</p>
11482 <table>
11483 <tr>
11484 <td></td>
11485 </tr>
11486 </table>
11487 !! end
11488
11489 !!test
11490 Templates: Wiki Tables: 1b. Fostering of entire template content
11491 !! wikitext
11492 {|
11493 {{echo|<div>}}
11494 foo
11495 {{echo|</div>}}
11496 |}
11497 !! html
11498 <table>
11499 <div>
11500 <p>foo
11501 </p>
11502 </div>
11503 <tr><td></td></tr></table>
11504
11505 !! html+tidy
11506 <div>
11507 <p>foo</p>
11508 </div>
11509 <table>
11510 <tr>
11511 <td></td>
11512 </tr>
11513 </table>
11514 !! end
11515
11516 !!test
11517 Templates: Wiki Tables: 2. Fostering of partial template content
11518 !! wikitext
11519 {|
11520 {{echo|a
11521 <div>b</div>}}
11522 |}
11523 !! html
11524 <table>
11525 a
11526 <div>b</div>
11527 <tr><td></td></tr></table>
11528
11529 !! html+tidy
11530 <p>a</p>
11531 <div>b</div>
11532 <table>
11533 <tr>
11534 <td></td>
11535 </tr>
11536 </table>
11537 !! end
11538
11539 !!test
11540 Templates: Wiki Tables: 3. td-content via multiple templates
11541 !! wikitext
11542 {|
11543 {{echo|{{pipe}}a}}{{echo|b}}
11544 |}
11545 !! html
11546 <table>
11547 <tr>
11548 <td>ab
11549 </td></tr></table>
11550
11551 !!end
11552
11553 !!test
11554 Templates: Wiki Tables: 4. Templated tags, no content
11555 !! wikitext
11556 {{tbl-start}}
11557 {{tbl-end}}
11558 !! html
11559 <table>
11560 <tr><td></td></tr></table>
11561
11562 !!end
11563
11564 !!test
11565 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11566 !! wikitext
11567 {{tbl-start}}
11568 |foo
11569 {{tbl-end}}
11570 !! html
11571 <table>
11572 <tr>
11573 <td>foo
11574 </td></tr></table>
11575
11576 !!end
11577
11578 !!test
11579 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11580 !! wikitext
11581 {{tbl-start}}
11582 {{!}}foo
11583 {{tbl-end}}
11584 !! html
11585 <table>
11586 <tr>
11587 <td>foo
11588 </td></tr></table>
11589
11590 !!end
11591
11592 ## This test case is very specific to Parsoid's internals
11593 ## and is hence only tested for Parsoid's code. Parsoid uses
11594 ## a <meta> marker tag for <ref> tags and they are expanded
11595 ## much later. We are verifying that this <meta> tag usage
11596 ## doesn't prevent foster parenting.
11597 !!test
11598 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11599 !!wikitext
11600 {{PartialTable}}<ref>foo</ref>
11601 |}
11602
11603 <references />
11604 !!html/parsoid
11605 <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">
11606 <tbody>
11607 </tbody></table>
11608
11609 <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>
11610 !!end
11611
11612 !! test
11613 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11614 !! wikitext
11615 {{echo|
11616 {{{!}}
11617 {{!}}-}}
11618 <onlyinclude>
11619 |foo
11620 </onlyinclude>
11621 {{!}}}
11622 !! html/parsoid
11623 <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{{!}}}"]}'>
11624 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11625 <tbody><tr>
11626
11627 <td>foo
11628 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11629 </tbody></table>
11630 !! end
11631
11632 !!test
11633 Templates: Lists: Multi-line list-items via templates
11634 !! wikitext
11635 *{{echo|a {{nonexistent|
11636 unused}}}}
11637 *{{echo|b {{nonexistent|
11638 unused}}}}
11639 !! html
11640 <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>
11641 <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>
11642
11643 !!end
11644
11645 !!test
11646 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11647 !! wikitext
11648 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11649 !! html
11650 <p><i>ab</i>c<i>d</i>e
11651 </p>
11652 !!end
11653
11654 !!test
11655 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11656 (PHP parser generates misnested html)
11657 !! wikitext
11658 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11659 !! html/parsoid
11660 <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>
11661 !!end
11662
11663 !!test
11664 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11665 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11666 !! options
11667 parsoid=wt2html,wt2wt
11668 !! wikitext
11669 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11670 !! html
11671 <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>
11672 <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>
11673 <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>
11674 !!end
11675
11676 !!test
11677 Templates: Ugly nesting: 4. Divs opened/closed across templates
11678 !! wikitext
11679 a<div>b{{echo|c</div>d}}e
11680 !! html
11681 a<div>bc</div>de
11682
11683 !! html+tidy
11684 <p>a</p>
11685 <div>bc</div>
11686 <p>de</p>
11687 !! end
11688
11689 !!test
11690 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11691 (Parsoid-centric)
11692 !! options
11693 parsoid
11694 !! wikitext
11695 {|
11696 |{{echo|foo</table>}}
11697 |bar
11698 |}
11699 !! html
11700 <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|}"]}'>
11701
11702 <tbody>
11703 <tr>
11704 <td>foo</td></tr></tbody></table><span about="#mwt1">
11705 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11706 |}</span>
11707 !!end
11708
11709 !!test
11710 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11711 (Parsoid-centric)
11712 !! options
11713 parsoid
11714 !! wikitext
11715 <table>
11716 <tr>
11717 <td>
11718 <table>
11719 <tr>
11720 <td>1. {{echo|foo </table>}}</td>
11721 <td> bar </td>
11722 <td>2. {{echo|baz </table>}}</td>
11723 </tr>
11724 <tr>
11725 <td>abc</td>
11726 </tr>
11727 </table>
11728 </td>
11729 </tr>
11730 <tr>
11731 <td>xyz</td>
11732 </tr>
11733 </table>
11734 !! html
11735 <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>"]}'>
11736 <tbody><tr>
11737 <td>
11738 <table>
11739 <tbody><tr>
11740 <td>1. foo </td></tr></tbody></table></td>
11741 <td> bar </td>
11742 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11743 </span><span about="#mwt2">
11744 </span><span about="#mwt2">
11745 </span><span about="#mwt2">abc</span><span about="#mwt2">
11746 </span><span about="#mwt2">
11747 </span><span about="#mwt2">
11748 </span><span about="#mwt2">
11749 </span><span about="#mwt2">
11750 </span><span about="#mwt2">
11751 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11752 </span><span about="#mwt2">
11753 </span>
11754 !!end
11755
11756 !! test
11757 Templates: Ugly templates: 3. newline-only template parameter
11758 !! wikitext
11759 foo {{echo|
11760 }}
11761 !! html
11762 <p>foo
11763 </p>
11764 !! end
11765
11766 # This looks like a bug: a single newline triggers p/br for some reason.
11767 !! test
11768 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11769 !! wikitext
11770 {{echo|
11771 }}
11772 !! html
11773 <p><br />
11774 </p>
11775 !! end
11776
11777 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11778 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11779 !! test
11780 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11781 !! wikitext
11782 {{echo|<table>}}
11783 {{echo|<div>foo}}
11784 {{echo|</table>}}
11785 !! html/parsoid
11786 <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
11787 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11788 </table>
11789 !! end
11790
11791 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11792 # that are "identical" and generate nesting cycles in the algorithm
11793 !! test
11794 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11795 !! wikitext
11796 {{echo|<table><tr><td><table>}}
11797 {{echo|<div>}}
11798 {{echo|</div>}}
11799 !! html/parsoid
11800 <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"}'>
11801 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11802 </table></td></tr></tbody></table>
11803 !! end
11804
11805 !!test
11806 Parser Functions: 1. Simple example
11807 !! wikitext
11808 {{uc:foo}}
11809 !! html
11810 <p>FOO
11811 </p>
11812 !!end
11813
11814 !!test
11815 Parser Functions: 2. Nested use (only outermost should be marked up)
11816 !! wikitext
11817 {{uc:{{lc:FOO}}}}
11818 !! html
11819 <p>FOO
11820 </p>
11821 !!end
11822
11823 ###
11824 ### Pre-save transform tests
11825 ###
11826 !! test
11827 pre-save transform: subst:
11828 !! options
11829 pst
11830 !! wikitext
11831 {{subst:test}}
11832 !! html/php
11833 This is a test template
11834 !! end
11835
11836 !! test
11837 pre-save transform: normal template
11838 !! options
11839 pst
11840 !! wikitext
11841 {{test}}
11842 !! html/php
11843 {{test}}
11844 !! end
11845
11846 !! test
11847 pre-save transform: nonexistent template
11848 !! options
11849 pst
11850 !! wikitext
11851 {{thistemplatedoesnotexist}}
11852 !! html/php
11853 {{thistemplatedoesnotexist}}
11854 !! end
11855
11856 !! test
11857 pre-save transform: subst magic variables
11858 !! options
11859 pst
11860 !! wikitext
11861 {{subst:SITENAME}}
11862 !! html/php
11863 MediaWiki
11864 !! end
11865
11866 # This is bug 89, which I fixed. -- wtm
11867 !! test
11868 pre-save transform: subst: templates with parameters
11869 !! options
11870 pst
11871 !! wikitext
11872 {{subst:paramtest|param="something else"}}
11873 !! html/php
11874 This is a test template with parameter "something else"
11875 !! end
11876
11877 !! article
11878 Template:nowikitest
11879 !! text
11880 <nowiki>'''not wiki'''</nowiki>
11881 !! endarticle
11882
11883 !! test
11884 pre-save transform: nowiki in subst (bug 1188)
11885 !! options
11886 pst
11887 !! wikitext
11888 {{subst:nowikitest}}
11889 !! html/php
11890 <nowiki>'''not wiki'''</nowiki>
11891 !! end
11892
11893 !! article
11894 Template:commenttest
11895 !! text
11896 This template has <!-- a comment --> in it.
11897 !! endarticle
11898
11899 !! test
11900 pre-save transform: comment in subst (bug 1936)
11901 !! options
11902 pst
11903 !! wikitext
11904 {{subst:commenttest}}
11905 !! html/php
11906 This template has <!-- a comment --> in it.
11907 !! end
11908
11909 !! test
11910 pre-save transform: unclosed tag
11911 !! options
11912 pst noxml
11913 !! wikitext
11914 <nowiki>'''not wiki'''
11915 !! html/php
11916 <nowiki>'''not wiki'''
11917 !! end
11918
11919 !! test
11920 pre-save transform: mixed tag case
11921 !! options
11922 pst noxml
11923 !! wikitext
11924 <NOwiki>'''not wiki'''</noWIKI>
11925 !! html/php
11926 <NOwiki>'''not wiki'''</noWIKI>
11927 !! end
11928
11929 !! test
11930 pre-save transform: unclosed comment in <nowiki>
11931 !! options
11932 pst noxml
11933 !! wikitext
11934 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11935 !! html/php
11936 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11937 !!end
11938
11939 # Leading @ in this template definition works around a limitation
11940 # in parsoid's parserTests which otherwise strips the <span> from the
11941 # result (confusing it for a template wrapper)
11942 !! article
11943 Template:dangerous
11944 !!text
11945 @<span onmouseover="alert('crap')">Oh no</span>
11946 !!endarticle
11947
11948 !!test
11949 (confirming safety of fix for subst bug 1936)
11950 !! wikitext
11951 {{Template:dangerous}}
11952 !! html
11953 <p>@<span>Oh no</span>
11954 </p>
11955 !! end
11956
11957 !! test
11958 pre-save transform: comment containing gallery (bug 5024)
11959 !! options
11960 pst
11961 !! wikitext
11962 <!-- <gallery>data</gallery> -->
11963 !! html/php
11964 <!-- <gallery>data</gallery> -->
11965 !!end
11966
11967 !! test
11968 pre-save transform: comment containing extension
11969 !! options
11970 pst
11971 !! wikitext
11972 <!-- <tag>data</tag> -->
11973 !! html/php
11974 <!-- <tag>data</tag> -->
11975 !!end
11976
11977 !! test
11978 pre-save transform: comment containing nowiki
11979 !! options
11980 pst
11981 !! wikitext
11982 <!-- <nowiki>data</nowiki> -->
11983 !! html/php
11984 <!-- <nowiki>data</nowiki> -->
11985 !!end
11986
11987 !! test
11988 pre-save transform: <noinclude> in subst (bug 3298)
11989 !! options
11990 pst
11991 !! wikitext
11992 {{subst:Includes}}
11993 !! html/php
11994 Foobar
11995 !! end
11996
11997 !! test
11998 pre-save transform: <onlyinclude> in subst (bug 3298)
11999 !! options
12000 pst
12001 !! wikitext
12002 {{subst:Includes2}}
12003 !! html/php
12004 Foo
12005 !! end
12006
12007 !! article
12008 Template:SubstTest
12009 !!text
12010 {{<includeonly>subst:</includeonly>Includes}}
12011 !! endarticle
12012
12013 !! article
12014 Template:SafeSubstTest
12015 !! text
12016 {{<includeonly>safesubst:</includeonly>Includes}}
12017 !! endarticle
12018
12019 !! test
12020 bug 22297: safesubst: works during PST
12021 !! options
12022 pst
12023 !! wikitext
12024 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12025 !! html/php
12026 FoobarFoobar
12027 !! end
12028
12029 !! test
12030 bug 22297: safesubst: works during normal parse
12031 !! wikitext
12032 {{SafeSubstTest}}
12033 !! html
12034 <p>Foobar
12035 </p>
12036 !! end
12037
12038 !! test
12039 subst: does not work during normal parse
12040 !! wikitext
12041 {{SubstTest}}
12042 !! html
12043 <p>{{subst:Includes}}
12044 </p>
12045 !! end
12046
12047 !! test
12048 pre-save transform: context links ("pipe trick")
12049 !! options
12050 pst
12051 !! wikitext
12052 [[Article (context)|]]
12053 [[Bar:Article|]]
12054 [[:Bar:Article|]]
12055 [[Bar:Article (context)|]]
12056 [[:Bar:Article (context)|]]
12057 [[|Article]]
12058 [[|Article (context)]]
12059 [[Bar:X (Y) Z|]]
12060 [[:Bar:X (Y) Z|]]
12061 !! html/php
12062 [[Article (context)|Article]]
12063 [[Bar:Article|Article]]
12064 [[:Bar:Article|Article]]
12065 [[Bar:Article (context)|Article]]
12066 [[:Bar:Article (context)|Article]]
12067 [[Article]]
12068 [[Article (context)]]
12069 [[Bar:X (Y) Z|X (Y) Z]]
12070 [[:Bar:X (Y) Z|X (Y) Z]]
12071 !! end
12072
12073 !! test
12074 pre-save transform: context links ("pipe trick") with interwiki prefix
12075 !! options
12076 pst
12077 !! wikitext
12078 [[interwiki:Article|]]
12079 [[:interwiki:Article|]]
12080 [[interwiki:Bar:Article|]]
12081 [[:interwiki:Bar:Article|]]
12082 !! html/php
12083 [[interwiki:Article|Article]]
12084 [[:interwiki:Article|Article]]
12085 [[interwiki:Bar:Article|Bar:Article]]
12086 [[:interwiki:Bar:Article|Bar:Article]]
12087 !! end
12088
12089 !! test
12090 pre-save transform: context links ("pipe trick") with parens in title
12091 !! options
12092 pst title=[[Somearticle (context)]]
12093 !! wikitext
12094 [[|Article]]
12095 !! html/php
12096 [[Article (context)|Article]]
12097 !! end
12098
12099 !! test
12100 pre-save transform: context links ("pipe trick") with comma in title
12101 !! options
12102 pst title=[[Someplace, Somewhere]]
12103 !! wikitext
12104 [[|Otherplace]]
12105 [[Otherplace, Elsewhere|]]
12106 [[Otherplace, Elsewhere, Anywhere|]]
12107 !! html/php
12108 [[Otherplace, Somewhere|Otherplace]]
12109 [[Otherplace, Elsewhere|Otherplace]]
12110 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12111 !! end
12112
12113 !! test
12114 pre-save transform: context links ("pipe trick") with parens and comma
12115 !! options
12116 pst title=[[Someplace (IGNORED), Somewhere]]
12117 !! wikitext
12118 [[|Otherplace]]
12119 [[Otherplace (place), Elsewhere|]]
12120 !! html/php
12121 [[Otherplace, Somewhere|Otherplace]]
12122 [[Otherplace (place), Elsewhere|Otherplace]]
12123 !! end
12124
12125 !! test
12126 pre-save transform: context links ("pipe trick") with comma and parens
12127 !! options
12128 pst title=[[Who, me? (context)]]
12129 !! wikitext
12130 [[|Yes, you.]]
12131 [[Me, Myself, and I (1937 song)|]]
12132 !! html/php
12133 [[Yes, you. (context)|Yes, you.]]
12134 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12135 !! end
12136
12137 !! test
12138 pre-save transform: context links ("pipe trick") with namespace
12139 !! options
12140 pst title=[[Ns:Somearticle]]
12141 !! wikitext
12142 [[|Article]]
12143 !! html/php
12144 [[Ns:Article|Article]]
12145 !! end
12146
12147 !! test
12148 pre-save transform: context links ("pipe trick") with namespace and parens
12149 !! options
12150 pst title=[[Ns:Somearticle (context)]]
12151 !! wikitext
12152 [[|Article]]
12153 !! html/php
12154 [[Ns:Article (context)|Article]]
12155 !! end
12156
12157 !! test
12158 pre-save transform: context links ("pipe trick") with namespace and comma
12159 !! options
12160 pst title=[[Ns:Somearticle, Context, Whatever]]
12161 !! wikitext
12162 [[|Article]]
12163 !! html/php
12164 [[Ns:Article, Context, Whatever|Article]]
12165 !! end
12166
12167 !! test
12168 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12169 !! options
12170 pst title=[[Ns:Somearticle, Context (context)]]
12171 !! wikitext
12172 [[|Article]]
12173 !! html/php
12174 [[Ns:Article (context)|Article]]
12175 !! end
12176
12177 !! test
12178 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12179 !! options
12180 pst title=[[Ns:Somearticle (IGNORED), Context]]
12181 !! wikitext
12182 [[|Article]]
12183 !! html/php
12184 [[Ns:Article, Context|Article]]
12185 !! end
12186
12187 !! test
12188 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12189 !! options
12190 pst
12191 !! wikitext
12192 [[Article(context)|]]
12193 [[Bar:Article(context)|]]
12194 [[:Bar:Article(context)|]]
12195 [[|Article(context)]]
12196 [[Bar:X(Y)Z|]]
12197 [[:Bar:X(Y)Z|]]
12198 !! html/php
12199 [[Article(context)|Article]]
12200 [[Bar:Article(context)|Article]]
12201 [[:Bar:Article(context)|Article]]
12202 [[Article(context)]]
12203 [[Bar:X(Y)Z|X(Y)Z]]
12204 [[:Bar:X(Y)Z|X(Y)Z]]
12205 !! end
12206
12207 !! test
12208 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12209 !! options
12210 pst
12211 !! wikitext
12212 [[Article (context)|]]
12213 [[Bar:Article (context)|]]
12214 [[:Bar:Article (context)|]]
12215 [[|Article (context)]]
12216 [[Bar:X (Y) Z|]]
12217 [[:Bar:X (Y) Z|]]
12218 !! html/php
12219 [[Article (context)|Article]]
12220 [[Bar:Article (context)|Article]]
12221 [[:Bar:Article (context)|Article]]
12222 [[Article (context)]]
12223 [[Bar:X (Y) Z|X (Y) Z]]
12224 [[:Bar:X (Y) Z|X (Y) Z]]
12225 !! end
12226
12227 !! test
12228 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12229 !! options
12230 pst
12231 !! wikitext
12232 [[Article(context)|]]
12233 [[Bar:Article(context)|]]
12234 [[:Bar:Article(context)|]]
12235 [[|Article(context)]]
12236 [[Bar:X(Y)Z|]]
12237 [[:Bar:X(Y)Z|]]
12238 !! html/php
12239 [[Article(context)|Article]]
12240 [[Bar:Article(context)|Article]]
12241 [[:Bar:Article(context)|Article]]
12242 [[Article(context)]]
12243 [[Bar:X(Y)Z|X(Y)Z]]
12244 [[:Bar:X(Y)Z|X(Y)Z]]
12245 !! end
12246
12247 !! test
12248 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12249 !! options
12250 pst
12251 !! wikitext
12252 [[Article (context), context|]]
12253 [[Article (context),context|]]
12254 [[Bar:Article (context), context|]]
12255 [[Bar:Article (context),context|]]
12256 [[:Bar:Article (context), context|]]
12257 [[:Bar:Article (context),context|]]
12258 !! html/php
12259 [[Article (context), context|Article]]
12260 [[Article (context),context|Article]]
12261 [[Bar:Article (context), context|Article]]
12262 [[Bar:Article (context),context|Article]]
12263 [[:Bar:Article (context), context|Article]]
12264 [[:Bar:Article (context),context|Article]]
12265 !! end
12266
12267 !! test
12268 pre-save transform: trim trailing empty lines
12269 !! options
12270 pst
12271 !! wikitext
12272 Empty lines are trimmed
12273
12274
12275
12276
12277 !! html/php
12278 Empty lines are trimmed
12279 !! end
12280
12281 !! test
12282 pre-save transform: Signature expansion
12283 !! options
12284 pst
12285 !! wikitext
12286 * ~~~
12287 * <noinclude>~~~</noinclude>
12288 * <includeonly>~~~</includeonly>
12289 * <onlyinclude>~~~</onlyinclude>
12290 !! html/php
12291 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12292 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12293 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12294 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12295 !! end
12296
12297
12298 !! test
12299 pre-save transform: Signature expansion in nowiki tags (bug 93)
12300 !! options
12301 pst disabled
12302 !! wikitext
12303 Shall not expand:
12304
12305 <nowiki>~~~~</nowiki>
12306
12307 <includeonly><nowiki>~~~~</nowiki></includeonly>
12308
12309 <noinclude><nowiki>~~~~</nowiki></noinclude>
12310
12311 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12312
12313 {{subst:Foo}} shall be converted to FOO
12314
12315 As well as inside noinclude/onlyinclude
12316 <noinclude>{{subst:Foo}}</noinclude>
12317 <onlyinclude>{{subst:Foo}}</onlyinclude>
12318
12319 But not inside includeonly
12320 <includeonly>{{subst:Foo}}</includeonly>
12321 !! html/php
12322 Shall not expand:
12323
12324 <nowiki>~~~~</nowiki>
12325
12326 <includeonly><nowiki>~~~~</nowiki></includeonly>
12327
12328 <noinclude><nowiki>~~~~</nowiki></noinclude>
12329
12330 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12331
12332 FOO shall be converted to FOO
12333
12334 As well as inside noinclude/onlyinclude
12335 <noinclude>FOO</noinclude>
12336 <onlyinclude>FOO</onlyinclude>
12337
12338 But not inside includeonly
12339 <includeonly>{{subst:Foo}}</includeonly>
12340 !! end
12341
12342 !! test
12343 Parsoid: Recognize nowiki with trailing space in tags
12344 !! options
12345 parsoid=wt2html
12346 !! wikitext
12347 <nowiki ><div>[[foo]]</nowiki >
12348
12349 a<nowiki / >b
12350
12351 c<nowiki />d
12352
12353 e<nowiki/ >f
12354 !! html
12355 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12356 <p>ab</p>
12357 <p>cd</p>
12358 <p>ef</p>
12359 !! end
12360
12361 !! test
12362 Parsoid: Recognize nowiki with odd capitalization
12363 !! options
12364 parsoid=wt2html
12365 !! wikitext
12366 <noWikI ><div>[[foo]]</Nowiki >
12367 !! html
12368 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12369 !! end
12370
12371
12372 !! test
12373 Parsoid: Escape nowiki with trailing space in tags
12374 !! options
12375 parsoid=html2wt
12376 !! html/parsoid
12377 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12378 <p>a&lt;nowiki /&gt;b</p>
12379 <p>c&lt;nowiki/ &gt;d</p>
12380 !! wikitext
12381 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12382
12383 a&lt;nowiki /&gt;b
12384
12385 c&lt;nowiki/ &gt;d
12386 !! end
12387
12388 !! test
12389 Parsoid: Escape weird noWikI capitalizations
12390 !! options
12391 parsoid=html2wt
12392 !! html/parsoid
12393 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12394 !! wikitext
12395 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12396 !! end
12397
12398 ###
12399 ### Message transform tests
12400 ###
12401 !! test
12402 message transform: magic variables
12403 !! options
12404 msg
12405 !! wikitext
12406 {{SITENAME}}
12407 !! html
12408 MediaWiki
12409 !! end
12410
12411 !! test
12412 message transform: should not transform wiki markup
12413 !! options
12414 msg
12415 !! wikitext
12416 ''test''
12417 !! html
12418 ''test''
12419 !! end
12420
12421 !! test
12422 message transform: <noinclude> in transcluded template (bug 4926)
12423 !! options
12424 msg
12425 !! wikitext
12426 {{Includes}}
12427 !! html
12428 Foobar
12429 !! end
12430
12431 !! test
12432 message transform: <onlyinclude> in transcluded template (bug 4926)
12433 !! options
12434 msg
12435 !! wikitext
12436 {{Includes2}}
12437 !! html
12438 Foo
12439 !! end
12440
12441 !! test
12442 {{#special:}} page name, known
12443 !! options
12444 msg
12445 !! wikitext
12446 {{#special:Recentchanges}}
12447 !! html
12448 Special:RecentChanges
12449 !! end
12450
12451 !! test
12452 {{#special:}} page name with subpage, known
12453 !! options
12454 msg
12455 !! wikitext
12456 {{#special:Recentchanges/param}}
12457 !! html
12458 Special:RecentChanges/param
12459 !! end
12460
12461 !! test
12462 {{#special:}} page name, unknown
12463 !! options
12464 msg
12465 !! wikitext
12466 {{#special:foobar nonexistent}}
12467 !! html
12468 Special:Foobar nonexistent
12469 !! end
12470
12471 !! test
12472 {{#speciale:}} page name, known
12473 !! options
12474 msg
12475 !! wikitext
12476 {{#speciale:Recentchanges}}
12477 !! html
12478 Special:RecentChanges
12479 !! end
12480
12481 !! test
12482 {{#speciale:}} page name with subpage, known
12483 !! options
12484 msg
12485 !! wikitext
12486 {{#speciale:Recentchanges/param}}
12487 !! html
12488 Special:RecentChanges/param
12489 !! end
12490
12491 !! test
12492 {{#speciale:}} page name, unknown
12493 !! options
12494 msg
12495 !! wikitext
12496 {{#speciale:foobar nonexistent}}
12497 !! html
12498 Special:Foobar_nonexistent
12499 !! end
12500
12501 ###
12502 ### Images
12503 ###
12504 ### For Parsoid-specific tests, see
12505 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12506
12507 !! test
12508 Simple image
12509 !! options
12510 parsoid=wt2html,wt2wt,html2html
12511 !! wikitext
12512 [[Image:foobar.jpg]]
12513 !! html/php
12514 <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>
12515 </p>
12516 !! html/parsoid
12517 <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>
12518 !! end
12519
12520 !! test
12521 Simple image (using File: namespace, now canonical)
12522 !! wikitext
12523 [[File:Foobar.jpg]]
12524 !! html/php
12525 <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>
12526 </p>
12527 !! html/parsoid
12528 <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>
12529 !! end
12530
12531 !! test
12532 Right-aligned image
12533 !! wikitext
12534 [[File:Foobar.jpg|right]]
12535 !! html/php
12536 <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>
12537
12538 !! html/parsoid
12539 <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>
12540 !! end
12541
12542 !! test
12543 Image with caption
12544 !! wikitext
12545 [[File:Foobar.jpg|right|Caption text]]
12546 !! html/php
12547 <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>
12548
12549 !! html/parsoid
12550 <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>
12551 !! end
12552
12553 !! test
12554 Image with caption, bug 53312 #1
12555 !! wikitext
12556 [[File:Foobar.jpg|right|Caption page stuff]]
12557 !! html/php
12558 <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>
12559
12560 !! html/parsoid
12561 <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>
12562 !! end
12563
12564 !! test
12565 Image with caption, bug 53312 #2
12566 !! wikitext
12567 [[File:Foobar.jpg|right|Caption page=]]
12568 !! html/php
12569 <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>
12570
12571 !! html/parsoid
12572 <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>
12573 !! end
12574
12575 !! test
12576 Image with caption, bug 53312 #3
12577 !! wikitext
12578 [[File:Foobar.jpg|right|Caption page=stuff]]
12579 !! html/php
12580 <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>
12581
12582 !! html/parsoid
12583 <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>
12584 !! end
12585
12586 !! test
12587 Allow empty links in image captions (Bug 60753)
12588 !! options
12589 thumbsize=220
12590 !! wikitext
12591 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12592 [[]]
12593 [[Link2]]
12594 ]]
12595 !! html/php
12596 <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>
12597
12598 !! html/parsoid
12599 <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>
12600 [[]]
12601 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12602 </figcaption></figure>
12603 !! end
12604
12605 !! test
12606 Titles in unlinked images (T23454)
12607 !! wikitext
12608 [[File:Foobar.jpg|link=|stuff]]
12609 !! html/php
12610 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12611 </p>
12612 !! end
12613
12614 !! test
12615 Link with empty target
12616 !! wikitext
12617 [[]]
12618 !! html
12619 <p>[[]]
12620 </p>
12621 !! end
12622
12623 !! test
12624 Image with link trail
12625 !! wikitext
12626 Linktrails should not work for images: [[File:Foobar.jpg]]s
12627 !! html/php
12628 <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
12629 </p>
12630 !! html/parsoid
12631 <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>
12632 !! end
12633
12634 !! test
12635 Image with empty attribute
12636 !! options
12637 parsoid=wt2html,wt2wt,html2html
12638 !! wikitext
12639 [[File:Foobar.jpg|right||Caption text]]
12640 !! html/php
12641 <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>
12642
12643 !! html/parsoid
12644 <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>
12645 !! end
12646
12647 !! test
12648 1. Block image with individual attributes from templates
12649 !! wikitext
12650 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12651 !! html/php
12652 <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>
12653
12654 !! html/parsoid
12655 <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>
12656 !! end
12657
12658 !! test
12659 2. Block Image with individual attributes from templates
12660 !! wikitext
12661 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12662 !! html/php
12663 <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>
12664
12665 !! html/parsoid
12666 <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>
12667 !! end
12668
12669 !! test
12670 3. Inline image with individual attributes from templates
12671 !! wikitext
12672 [[File:Foobar.jpg|{{echo|50px}}]]
12673 !! html/php
12674 <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>
12675 </p>
12676 !! html/parsoid
12677 <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>
12678 !! end
12679
12680 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12681 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12682 !! test
12683 Image with multiple attributes from the same template
12684 !! wikitext
12685 [[File:Foobar.jpg|{{image_attribs}}]]
12686 !! html/php
12687 <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>
12688
12689 !! html/parsoid
12690 <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>
12691 !! end
12692
12693 !! test
12694 Image with link tails
12695 !! options
12696 thumbsize=220
12697 !! wikitext
12698 123[[File:Foobar.jpg]]456
12699 123[[File:Foobar.jpg|right]]456
12700 123[[File:Foobar.jpg|thumb]]456
12701 !! html/php
12702 <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
12703 </p>
12704 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
12705 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
12706
12707 !! html/php+tidy
12708 <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>
12709 <p>123</p>
12710 <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>
12711 <p>456 123</p>
12712 <div class="thumb tright">
12713 <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>
12714 <div class="thumbcaption">
12715 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12716 </div>
12717 </div>
12718 </div>
12719 <p>456</p>
12720 !! html/parsoid
12721 <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>
12722 <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>
12723 <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>
12724 !! end
12725
12726 !! test
12727 Image with multiple captions -- only last one is accepted
12728 !! wikitext
12729 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12730 !! html/php
12731 <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>
12732
12733 !! html/parsoid
12734 <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>
12735 !! end
12736
12737 !! test
12738 Image with multiple widths -- use last
12739 !! wikitext
12740 [[File:Foobar.jpg|200px|300px|caption]]
12741 !! html/php
12742 <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>
12743 </p>
12744 !! html/parsoid
12745 <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>
12746 !! end
12747
12748 !! test
12749 Image with multiple alignments -- use first (bug 48664)
12750 !! options
12751 thumbsize=220
12752 !! wikitext
12753 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12754
12755 [[File:Foobar.jpg|middle|text-top|caption]]
12756 !! html/php
12757 <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>
12758 <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>
12759 </p>
12760 !! html/parsoid
12761 <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>
12762 <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>
12763 !! end
12764
12765 !! test
12766 Image with width attribute at different positions
12767 !! wikitext
12768 [[File:Foobar.jpg|200px|right|Caption]]
12769 [[File:Foobar.jpg|right|200px|Caption]]
12770 [[File:Foobar.jpg|right|Caption|200px]]
12771 !! html/php
12772 <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>
12773 <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>
12774 <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>
12775
12776 !! html/parsoid
12777 <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>
12778 <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>
12779 <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>
12780 !! end
12781
12782 # a sad bit of backward-compatibility
12783 !! test
12784 Image with size specified with pxpx (bug 13500, 51628)
12785 !! options
12786 parsoid=wt2html,wt2wt,html2html
12787 !! wikitext
12788 [[File:Foobar.jpg|20pxpx]]
12789 [[File:Foobar.jpg|200x20pxpx]]
12790 !! html/php
12791 <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>
12792 <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>
12793 </p>
12794 !! html/parsoid
12795 <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>
12796 !! end
12797
12798 !! test
12799 Image with link parameter, wiki target
12800 !! wikitext
12801 [[File:Foobar.jpg|link=Main Page]]
12802 !! html/php
12803 <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>
12804 </p>
12805 !! html/parsoid
12806 <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>
12807 !! end
12808
12809 # parsoid bug 49293 (part 1)
12810 !! test
12811 Image with link parameter, URL target
12812 !! wikitext
12813 [[File:Foobar.jpg|link=http://example.com/]]
12814 !! html/php
12815 <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>
12816 </p>
12817 !! html/parsoid
12818 <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>
12819 !! end
12820
12821 # parsoid bug 49293 (part 2)
12822 !! test
12823 Image with link parameter, protocol-less URL target
12824 !! wikitext
12825 [[File:Foobar.jpg|link=//example.com/]]
12826 !! html/php
12827 <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>
12828 </p>
12829 !! html/parsoid
12830 <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>
12831 !! end
12832
12833 !! test
12834 Escaping non-block captions (T107435)
12835 !! options
12836 parsoid={
12837 "modes": ["wt2wt"],
12838 "changes": [
12839 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12840 ]
12841 }
12842 !! wikitext
12843 [[Image:Foobar.jpg|caption]]
12844 !! wikitext/edited
12845 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12846 !! end
12847
12848 !! test
12849 Image with link parameter, wgExternalLinkTarget
12850 !! wikitext
12851 [[Image:foobar.jpg|link=http://example.com/]]
12852 !! config
12853 wgExternalLinkTarget='foobar'
12854 !! html
12855 <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>
12856 </p>
12857 !! end
12858
12859 !! test
12860 Image with link parameter, wgNoFollowLinks set to false
12861 !! wikitext
12862 [[Image:foobar.jpg|link=http://example.com/]]
12863 !! config
12864 wgNoFollowLinks=false
12865 !! html
12866 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12867 </p>
12868 !! end
12869
12870 !! test
12871 Image with link parameter, wgNoFollowDomainExceptions
12872 !! wikitext
12873 [[Image:foobar.jpg|link=http://example.com/]]
12874 !! config
12875 wgNoFollowDomainExceptions='example.com'
12876 !! html
12877 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12878 </p>
12879 !! end
12880
12881 !! test
12882 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12883 !! wikitext
12884 [[Image:foobar.jpg|link=http://example.com/|Title]]
12885 !! config
12886 wgExternalLinkTarget='foobar'
12887 !! html
12888 <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>
12889 </p>
12890 !! end
12891
12892 !! test
12893 Image with empty link parameter
12894 !! wikitext
12895 [[File:Foobar.jpg|link=]]
12896 !! html/php
12897 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12898 </p>
12899 !! html/parsoid
12900 <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>
12901 !! end
12902
12903 !! test
12904 Image with link parameter (wiki target) and unnamed parameter
12905 !! wikitext
12906 [[File:Foobar.jpg|link=Main_Page|Title]]
12907 !! html/php
12908 <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>
12909 </p>
12910 !! html/parsoid
12911 <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>
12912 !! end
12913
12914 !! test
12915 Image with link parameter (URL target) and unnamed parameter
12916 !! wikitext
12917 [[File:Foobar.jpg|link=http://example.com/|Title]]
12918 !! html/php
12919 <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>
12920 </p>
12921 !! html/parsoid
12922 <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>
12923 !! end
12924
12925 !! test
12926 Thumbnail image with link parameter
12927 !! options
12928 thumbsize=220
12929 parsoid=wt2html,wt2wt,html2html
12930 !! wikitext
12931 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12932 !! html/php
12933 <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>
12934
12935 !! html/parsoid
12936 <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>
12937 !! end
12938
12939 !! test
12940 Manually-specified thumbnail image
12941 !! options
12942 thumbsize=220
12943 !! wikitext
12944 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12945 !! html/php
12946 <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>
12947
12948 !! html/parsoid
12949 <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>
12950 !! end
12951
12952 !! test
12953 Manually-specified thumbnail image with explicit link to wiki page
12954 !! options
12955 thumbsize=220
12956 parsoid=wt2html,wt2wt,html2html
12957 !! wikitext
12958 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12959 !! html/php
12960 <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>
12961
12962 !! html/parsoid
12963 <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>
12964 !! end
12965
12966 !! test
12967 Manually-specified thumbnail image with explicit link to url
12968 !! options
12969 thumbsize=220
12970 parsoid=wt2html,wt2wt,html2html
12971 !! wikitext
12972 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12973 !! html/php
12974 <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>
12975
12976 !! html/parsoid
12977 <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>
12978 !! end
12979
12980 !! test
12981 Manually-specified thumbnail image with explicit no link
12982 !! options
12983 thumbsize=220
12984 parsoid=wt2html,wt2wt,html2html
12985 !! wikitext
12986 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12987 !! html/php
12988 <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>
12989
12990 !! html/parsoid
12991 <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>
12992 !! end
12993
12994 !! test
12995 Manually-specified thumbnail image with explicit link and alt text
12996 !! options
12997 thumbsize=220
12998 parsoid=wt2html,wt2wt,html2html
12999 !! wikitext
13000 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13001 !! html/php
13002 <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>
13003
13004 !! html/parsoid
13005 <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>
13006 !! end
13007
13008 !! test
13009 Image with frame and link
13010 !! options
13011 parsoid=wt2html,wt2wt,html2html
13012 !! wikitext
13013 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13014 !! html/php
13015 <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>
13016
13017 !! html/parsoid
13018 <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>
13019 !! end
13020
13021 !! test
13022 Image with frame and link and explicit alt
13023 !! options
13024 parsoid=wt2html,wt2wt,html2html
13025 !! wikitext
13026 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13027 !! html/php
13028 <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>
13029
13030 !! html/parsoid
13031 <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>
13032 !! end
13033
13034 !! test
13035 Image with wiki markup in implicit alt
13036 !! wikitext
13037 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13038
13039 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13040 !! html/php
13041 <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>
13042 </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>
13043 </p>
13044 !! html/parsoid
13045 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"testing &lt;b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[27,37,3,3]}\">bold&lt;/b> in alt"}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13046 <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" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13047 !! end
13048
13049 !! test
13050 Alt image option should handle most kinds of wikitext without barfing
13051 !! wikitext
13052 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13053 !! html/php
13054 <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>
13055
13056 !! html/parsoid
13057 <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>
13058 !! end
13059
13060 ###################
13061 # Conflicting image format options.
13062 # First option specified should 'win'.
13063 # All three cases in each test should be identical.
13064
13065 !! test
13066 Image with 'frameless' first.
13067 !! options
13068 parsoid=wt2html,wt2wt,html2html
13069 !! wikitext
13070 [[File:Foobar.jpg|frameless|caption]]
13071
13072 [[File:Foobar.jpg|frameless|frame|caption]]
13073
13074 [[File:Foobar.jpg|frameless|thumb|caption]]
13075 !! html/php
13076 <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>
13077 </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>
13078 </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>
13079 </p>
13080 !! html/parsoid
13081 <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>
13082 <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>
13083 <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>
13084 !! end
13085
13086 !! test
13087 Image with 'frame' first.
13088 !! options
13089 parsoid=wt2html,wt2wt,html2html
13090 !! wikitext
13091 [[File:Foobar.jpg|frame|caption]]
13092 [[File:Foobar.jpg|frame|frameless|caption]]
13093 [[File:Foobar.jpg|frame|thumb|caption]]
13094 !! html/php
13095 <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>
13096 <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>
13097 <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>
13098
13099 !! html/parsoid
13100 <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>
13101 <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>
13102 <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>
13103 !! end
13104
13105 !! test
13106 Image with 'thumb' first.
13107 !! options
13108 parsoid=wt2html,wt2wt,html2html
13109 !! wikitext
13110 [[File:Foobar.jpg|thumb|caption]]
13111 [[File:Foobar.jpg|thumb|frameless|caption]]
13112 [[File:Foobar.jpg|thumb|frame|caption]]
13113 !! html/php
13114 <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>
13115 <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>
13116 <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>
13117
13118 !! html/parsoid
13119 <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>
13120 <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>
13121 <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>
13122 !! end
13123
13124 ###################
13125 # Image sizing.
13126 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13127 # and https://phabricator.wikimedia.org/T64258
13128 # Foobar has actual size of 1941x220
13129 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13130 # a scalable format.
13131 # 2. Framed images always ignore size options; always render at default size.
13132 # 3. "Unspecified format" and border are the only types which can be
13133 # enlarged.
13134
13135 !! test
13136 Image: "unspecified format" and border enlarge
13137 !! options
13138 parsoid=wt2html,wt2wt,html2html
13139 !! wikitext
13140 [[File:Foobar.jpg|2000px]]
13141
13142 [[File:Foobar.jpg|border|2000px]]
13143 !! html/php
13144 <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>
13145 </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>
13146 </p>
13147 !! html/parsoid
13148 <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>
13149 <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>
13150 !! end
13151
13152 !! test
13153 Image: "unspecified format" and border reduce
13154 !! options
13155 parsoid=wt2html,wt2wt,html2html
13156 !! wikitext
13157 [[File:Foobar.jpg|1000px]]
13158
13159 [[File:Foobar.jpg|border|1000px]]
13160 !! html/php
13161 <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>
13162 </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>
13163 </p>
13164 !! html/parsoid
13165 <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>
13166 <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>
13167 !! end
13168
13169 !! test
13170 Image: thumbs reduce
13171 !! options
13172 parsoid=wt2html,wt2wt,html2html
13173 !! wikitext
13174 [[File:Foobar.jpg|thumb|50px]]
13175 !! html/php
13176 <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>
13177
13178 !! html/parsoid
13179 <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>
13180 !! end
13181
13182 !! test
13183 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13184 !! options
13185 parsoid=wt2html,wt2wt,html2html
13186 !! wikitext
13187 [[File:Foobar.jpg|thumb|2000px]]
13188
13189 [[File:Foobar.svg|thumb|2000px]]
13190 !! html/php
13191 <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>
13192 <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>
13193
13194 !! html/parsoid
13195 <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>
13196 <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>
13197 !! end
13198
13199 !! test
13200 Image: frameless can reduce in size
13201 !! options
13202 parsoid=wt2html,wt2wt,html2html
13203 !! wikitext
13204 [[File:Foobar.jpg|frameless|50px]]
13205 !! html/php
13206 <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>
13207 </p>
13208 !! html/parsoid
13209 <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>
13210 !! end
13211
13212 !! test
13213 Image: bitmap frameless can't be enlarged past original size, but vector can
13214 !! options
13215 parsoid=wt2html,wt2wt,html2html
13216 !! wikitext
13217 [[File:Foobar.jpg|frameless|2000px]]
13218
13219 [[File:Foobar.svg|frameless|2000px]]
13220 !! html/php
13221 <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>
13222 </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>
13223 </p>
13224 !! html/parsoid
13225 <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>
13226 <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>
13227 !! end
13228
13229 !! test
13230 Image: framed images are always unscaled.
13231 !! options
13232 parsoid=wt2html,wt2wt,html2html
13233 !! wikitext
13234 [[File:Foobar.jpg|frame]]
13235
13236 [[File:Foobar.jpg|frame|50px]]
13237
13238 [[File:Foobar.jpg|frame|50x50px]]
13239
13240 [[File:Foobar.jpg|frame|2000px]]
13241 !! html/php
13242 <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>
13243 <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>
13244 <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>
13245 <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>
13246
13247 !! html/parsoid
13248 <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>
13249 <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>
13250 <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>
13251 <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>
13252 !! end
13253
13254 ###################
13255
13256 !! test
13257 Link to image page- image page normally doesn't exists, hence edit link
13258 Add test with existing image page
13259 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13260 !! wikitext
13261 [[:Image:test]]
13262 !! html
13263 <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>
13264 </p>
13265 !! end
13266
13267 !! test
13268 bug 18784 Link to non-existent image page with caption should use caption as link text
13269 !! wikitext
13270 [[:Image:test|caption]]
13271 !! html
13272 <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>
13273 </p>
13274 !! end
13275
13276 !! test
13277 Frameless image caption with a free URL
13278 !! wikitext
13279 [[File:Foobar.jpg|http://example.com]]
13280 !! html/php
13281 <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>
13282 </p>
13283 !! html/parsoid
13284 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;url&amp;quot;,&amp;quot;dsr&amp;quot;:[18,36,0,0]}\">http://example.com&lt;/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>
13285 !! end
13286
13287 !! test
13288 Thumbnail image caption with a free URL
13289 !! options
13290 thumbsize=220
13291 !! wikitext
13292 [[File:Foobar.jpg|thumb|http://example.com]]
13293 !! html/php
13294 <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>
13295
13296 !! html/parsoid
13297 <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>
13298 !! end
13299
13300 !! test
13301 Thumbnail image caption with a free URL and explicit alt
13302 !! options
13303 thumbsize=220
13304 parsoid=wt2html,wt2wt,html2html
13305 !! wikitext
13306 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13307 !! html/php
13308 <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>
13309
13310 !! html/parsoid
13311 <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>
13312 !! end
13313
13314 !! test
13315 SVG thumbnails with no language set
13316 !! options
13317 !! wikitext
13318 [[File:Foobar.svg|thumb|caption]]
13319 !! html/php
13320 <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>
13321
13322 !! html/parsoid
13323 <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>
13324 !! end
13325
13326 !! test
13327 SVG thumbnails with language de
13328 !! options
13329 parsoid=wt2html,wt2wt,html2html
13330 !! wikitext
13331 [[File:Foobar.svg|thumb|caption|lang=de]]
13332 !! html/php
13333 <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>
13334
13335 !! html/parsoid
13336 <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>
13337 !! end
13338
13339 !! test
13340 SVG thumbnails with invalid language code
13341 !! options
13342 parsoid=wt2html,wt2wt,html2html
13343 !! wikitext
13344 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13345 !! html/php
13346 <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>
13347
13348 !! html/parsoid
13349 <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>
13350 !! end
13351
13352 !! test
13353 BUG 1887: A ISBN with a thumbnail
13354 !! wikitext
13355 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13356 !! html/php
13357 <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>
13358
13359 !! html/parsoid
13360 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
13361 !! end
13362
13363 !! test
13364 BUG 1887: A RFC with a thumbnail
13365 !! wikitext
13366 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13367 !! html/php
13368 <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>
13369
13370 !! html/parsoid
13371 <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>
13372 !! end
13373
13374 !! test
13375 BUG 1887: A mailto link with a thumbnail
13376 !! wikitext
13377 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13378 !! html/php
13379 <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>
13380
13381 !! html/parsoid
13382 <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>
13383 !! end
13384
13385 # Pending resolution to bug 368
13386 !! test
13387 BUG 648: Frameless image caption with a link
13388 !! wikitext
13389 [[File:Foobar.jpg|text with a [[link]] in it]]
13390 !! html/php
13391 <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>
13392 </p>
13393 !! html/parsoid
13394 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with 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;:[30,38,2,2]}\">link&lt;/a> 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>
13395 !! end
13396
13397 !! test
13398 BUG 648: Frameless image caption with a link (suffix)
13399 !! wikitext
13400 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13401 !! html/php
13402 <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>
13403 </p>
13404 !! html/parsoid
13405 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with 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;:[30,41,2,5],&amp;quot;tail&amp;quot;:&amp;quot;foo&amp;quot;}\">linkfoo&lt;/a> 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>
13406 !! end
13407
13408 !! test
13409 BUG 648: Frameless image caption with an interwiki link
13410 !! wikitext
13411 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13412 !! html/php
13413 <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>
13414 </p>
13415 !! html/parsoid
13416 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,47,2,2]}\">MeatBall:Link&lt;/a> 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>
13417 !! end
13418
13419 !! test
13420 BUG 648: Frameless image caption with a piped interwiki link
13421 !! wikitext
13422 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13423 !! html/php
13424 <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>
13425 </p>
13426 !! html/parsoid
13427 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;piped&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,52,16,2]}\">link&lt;/a> 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>
13428 !! end
13429
13430 !! test
13431 T107474: Frameless image caption with <nowiki>
13432 !! wikitext
13433 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13434 !! html/parsoid
13435 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,75,8,9]}\">text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><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>
13436 !! end
13437
13438 !! test
13439 Escape HTML special chars in image alt text
13440 !! wikitext
13441 [[File:Foobar.jpg|& < > "]]
13442 !! html/php
13443 <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>
13444 </p>
13445 !! html/parsoid
13446 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;amp; &amp;lt; &amp;gt; \""}'><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>
13447 !! end
13448
13449 !! test
13450 BUG 499: Alt text should have &#1234;, not &amp;1234;
13451 !! wikitext
13452 [[File:Foobar.jpg|&#9792;]]
13453 !! html/php
13454 <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>
13455 </p>
13456 !! html/parsoid
13457 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#9792;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;♀&amp;quot;,&amp;quot;dsr&amp;quot;:[18,25,null,null]}\">♀&lt;/span>"}'><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>
13458 !! end
13459
13460 !! test
13461 Broken image caption with link
13462 !! options
13463 parsoid=wt2html,wt2wt,html2html
13464 !! wikitext
13465 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13466 !! html/php
13467 <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.
13468 </p>
13469 !! html/parsoid
13470 <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>
13471 !! end
13472
13473 !! test
13474 Image caption containing another image
13475 !! wikitext
13476 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13477 !! html/php
13478 <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>
13479
13480 !! html/parsoid
13481 <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>
13482 !! end
13483
13484 !! test
13485 Image: caption containing a newline
13486 !! wikitext
13487 [[File:Foobar.jpg|This
13488 *is some text]]
13489 !! html/php
13490 <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>
13491 </p>
13492 !! html/parsoid
13493 <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>
13494 !!end
13495
13496 !!test
13497 Image: caption containing leading space
13498 (The leading space should not trigger nowiki escaping in wt2wt mode)
13499 !! wikitext
13500 [[File:Foobar.jpg|thumb| bar]]
13501 !! html/php
13502 <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>
13503
13504 !! html/parsoid
13505 <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>
13506 !!end
13507
13508 !! test
13509 Image: caption containing a table
13510 !! options
13511 parsoid=wt2html,wt2wt,html2html
13512 !! wikitext
13513 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13514 {|
13515 ! Foo !! Bar
13516 |-
13517 | Foo1 || Bar1
13518 |}
13519 and some more text.]]
13520 !! html/php
13521 <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>
13522
13523 !! html/parsoid
13524 <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
13525 <table>
13526 <tbody>
13527 <tr><th>Foo </th><th>Bar</th></tr>
13528 <tr>
13529 <td>Foo1 </td>
13530 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13531 !! end
13532
13533 !! test
13534 Bug 3090: External links other than http: in image captions
13535 !! wikitext
13536 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13537 !! html/php
13538 <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>
13539
13540 !! html/parsoid
13541 <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>
13542 !! end
13543
13544 !! test
13545 Custom class
13546 !! options
13547 parsoid=wt2html,wt2wt,html2html
13548 !! wikitext
13549 [[Image:foobar.jpg|a|class=b]]
13550 !! html/php
13551 <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>
13552 </p>
13553 !! html/parsoid
13554 <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>
13555 !! end
13556
13557 !! test
13558 Localized image handling (1).
13559 !! options
13560 parsoid=wt2html,wt2wt,html2html
13561 language=es
13562 !! wikitext
13563 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13564 !! html/php
13565 <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>
13566
13567 !! html/parsoid
13568 <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>
13569 !! end
13570
13571 !! test
13572 Localized image handling (2).
13573 !! options
13574 thumbsize=220
13575 parsoid=wt2html,wt2wt,html2html
13576 language=es
13577 !! wikitext
13578 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13579 !! html/php
13580 <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>
13581
13582 !! html/parsoid
13583 <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>
13584 !! end
13585
13586 !! test
13587 "border", "frameless" and "class" attributes on an image.
13588 !! options
13589 thumbsize=220
13590 parsoid=wt2html,wt2wt,html2html
13591 !! wikitext
13592 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13593 !! html/php
13594 <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>
13595 </p>
13596 !! html/parsoid
13597 <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>
13598 !! end
13599
13600 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13601 !! test
13602 Invalid image attributes (bug 62500)
13603 !! options
13604 thumbsize=220
13605 parsoid=wt2html,wt2wt,html2html
13606 !! wikitext
13607 [[File:Foobar.jpg|thumb|float|left|caption]]
13608
13609 [[File:Foobar.jpg|thumb|righ|caption]]
13610
13611 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13612 !! html/php
13613 <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>
13614 <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>
13615 <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>
13616
13617 !! html/parsoid
13618 <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>
13619 <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>
13620 <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>
13621 !! end
13622
13623 !! article
13624 File:Barfoo.jpg
13625 !! text
13626 #REDIRECT [[File:Barfoo.jpg]]
13627 !! endarticle
13628
13629 # FIXME: Parsoid should run this test -- but we'd need to teach the
13630 # mockAPI about the redirected Barfoo.jpg image.
13631 !! test
13632 Redirected image
13633 !! wikitext
13634 [[Image:Barfoo.jpg]]
13635 !! html/php
13636 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13637 </p>
13638 !! end
13639
13640 !! test
13641 Missing image with uploads disabled
13642 !! options
13643 wgEnableUploads=0
13644 !! wikitext
13645 [[File:Foobaz.jpg]]
13646 !! html/php
13647 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13648 </p>
13649 !! html/parsoid
13650 <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>
13651 !! end
13652
13653 # Parsoid-specific testing for images
13654 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13655 # Currently imperfect due to a flaw in the Parsoid testrunner
13656 # Work in progress
13657 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13658 # image tests.
13659
13660 !! test
13661 Parsoid-specific image handling - simple image with size and middle alignment
13662 !! wikitext
13663 [[File:Foobar.jpg|middle|50px]]
13664 !! html/parsoid
13665 <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>
13666 !! end
13667
13668 !! test
13669 Parsoid-specific image handling - simple image with size, middle alignment,
13670 non-standard namespace alias
13671 !! options
13672 parsoid=wt2wt,wt2html,html2html
13673 !! wikitext
13674 [[Image:Foobar.jpg|middle|50px]]
13675 !! html/parsoid
13676 <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>
13677 !! end
13678
13679 !! test
13680 Parsoid-specific image handling - simple image with size and middle alignment
13681 (existing content)
13682 !! wikitext
13683 [[File:Foobar.jpg|50px|middle]]
13684 !! html/parsoid
13685 <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>
13686 !! end
13687
13688 !! test
13689 Parsoid-specific image handling - simple image with size and middle alignment
13690 and non-standard namespace name
13691 !! options
13692 parsoid=wt2html,wt2wt,html2html
13693 !! wikitext
13694 [[Image:Foobar.jpg|50px|middle]]
13695 !! html/parsoid
13696 <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>
13697 !! end
13698
13699 !! test
13700 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13701 !! wikitext
13702 [[File:Foobar.jpg|500x10px|baseline|caption]]
13703 !! html/parsoid
13704 <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>
13705 !! end
13706
13707 !! test
13708 Parsoid-specific image handling - simple image with border and size spec
13709 !! wikitext
13710 [[File:Foobar.jpg|50px|border|caption]]
13711 !! html/parsoid
13712 <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>
13713 !! end
13714
13715 !! test
13716 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13717 !! wikitext
13718 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13719 !! html/parsoid
13720 <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>
13721 !! end
13722
13723 !! test
13724 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13725 (existing content)
13726 !! wikitext
13727 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13728 !! html/parsoid
13729 <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>
13730 !! end
13731
13732 !! test
13733 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13734 !! wikitext
13735 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13736 !! html/parsoid
13737 <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>
13738 !! end
13739
13740 !! test
13741 Parsoid-specific image handling - thumbnail with specific size, halign,
13742 valign, and caption (existing content)
13743 !! wikitext
13744 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13745 !! html/parsoid
13746 <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>
13747 !! end
13748
13749 !! test
13750 Parsoid-specific image handling - framed image with specific size and caption
13751 (size is ignored)
13752 !! options
13753 parsoid=wt2html,wt2wt,html2html
13754 !! wikitext
13755 [[File:Foobar.jpg|frame|500x50px|caption]]
13756 !! html/parsoid
13757 <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>
13758 !! end
13759
13760 !! test
13761 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13762 (size is ignored)
13763 !! options
13764 parsoid=wt2html,wt2wt,html2html
13765 !! wikitext
13766 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13767 !! html/parsoid
13768 <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>
13769 !! end
13770
13771 !! test
13772 Parsoid-specific image handling - frameless image with specific size, border, and caption
13773 !! wikitext
13774 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13775 !! html/parsoid
13776 <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>
13777 !! end
13778
13779 !! test
13780 Parsoid-specific image handling - simple image with a formatted caption
13781 !! wikitext
13782 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13783 !! html/parsoid
13784 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[18,81,7,8]}\">&lt;tbody data-parsoid=\"{&amp;quot;dsr&amp;quot;:[25,73,0,0]}\">&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[25,54,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[29,39,4,5]}\">a&lt;/td>&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[39,49,4,5]}\">b&lt;/td>&lt;/tr>&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[54,73,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[58,68,4,5]}\">c&lt;/td>&lt;/tr>&lt;/tbody>&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>
13785 !! end
13786
13787 !! test
13788 Parsoid-specific image handling - caption with a template in it
13789 !! wikitext
13790 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13791 !! html/parsoid
13792 <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>
13793 !! end
13794
13795 !! test
13796 Parsoid-specific image handling - caption with unbalanced tags in it
13797 !! options
13798 parsoid=wt2html,wt2wt,html2html
13799 !! wikitext
13800 foo
13801 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13802 bar
13803 !! html/parsoid
13804 <p>foo</p>
13805 <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>
13806 <p>bar</p>
13807 !! end
13808
13809 !! test
13810 Parsoid-specific image handling - empty caption (1)
13811 !! options
13812 parsoid=wt2html,wt2wt
13813 !! wikitext
13814 [[File:Foobar.jpg|thumb|]]
13815 !! html/parsoid
13816 <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>
13817 !! end
13818
13819 # empty captions don't get serialized unless we're in the "round trip" case
13820 !! test
13821 Parsoid-specific image handling - empty caption (2)
13822 !! options
13823 parsoid=html2wt
13824 !! html/parsoid
13825 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13826 <a href="./File:Foobar.jpg">
13827 <img resource="./File:Foobar.jpg"
13828 src="//example.com/images/3/3a/Foobar.jpg"
13829 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13830 height="25" width="220"/>
13831 </a>
13832 <figcaption></figcaption>
13833 </figure>
13834 !! wikitext
13835 [[File:Foobar.jpg|thumb]]
13836 !! end
13837
13838 !! test
13839 Parsoid-specific image handling - whitespace caption
13840 !! wikitext
13841 [[File:Foobar.jpg|thumb| ]]
13842 !! html/parsoid
13843 <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>
13844 !! end
13845
13846 !! test
13847 Parsoid-specific image handling - lang option
13848 !! wikitext
13849 foo
13850 [[File:Foobar.svg|lang=de|caption]]
13851 bar
13852 !! html/parsoid
13853 <p>foo
13854 <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>
13855 bar</p>
13856 !! end
13857
13858 ## Edge case bugs in Parsoid from T93580
13859 !! test
13860 T93580: 1. Templated <ref> inside block images
13861 !! wikitext
13862 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13863
13864 <references />
13865 !! html/parsoid
13866 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
13867
13868 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
13869 !! end
13870
13871 !! test
13872 T93580: 2. <ref> inside inline images
13873 !! wikitext
13874 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
13875
13876 <references />
13877 !! html/parsoid
13878 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13879
13880 <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" data-parsoid="{}">foo</span></li></ol>
13881 !! end
13882
13883 !! test
13884 T93580: 3. Templated <ref> inside inline images
13885 !! wikitext
13886 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
13887
13888 <references />
13889 !! html/parsoid
13890 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,96,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;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,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;]}]],&amp;quot;tmp&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;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13891
13892 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
13893 !! end
13894
13895 ###
13896 ### Subpages
13897 ###
13898 !! article
13899 Subpage test/subpage
13900 !! text
13901 foo
13902 !! endarticle
13903
13904 !! test
13905 Subpage link
13906 !! options
13907 subpage title=[[Subpage test]]
13908 !! wikitext
13909 [[/subpage]]
13910 !! html
13911 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13912 </p>
13913 !! end
13914
13915 !! test
13916 Subpage noslash link
13917 !! options
13918 subpage title=[[Subpage test]]
13919 !! wikitext
13920 [[/subpage/]]
13921 !! html
13922 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13923 </p>
13924 !! end
13925
13926 !! article
13927 Subpage test/1/2/subpage
13928 !! text
13929 blah
13930 !! endarticle
13931
13932 !! test
13933 Relative subpage noslash link
13934 !! options
13935 parsoid=wt2wt,wt2html,html2html
13936 subpage title=[[Subpage test/1/2/3/4]]
13937 !! wikitext
13938 [[../../subpage/]]
13939
13940 [[../../subpage]]
13941 !! html/php
13942 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13943 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13944 </p>
13945 !! html/parsoid
13946 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13947 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13948 !! end
13949
13950 !! test
13951 Parsoid: dot-slash prefixed wikilinks
13952 !! wikitext
13953 [[./foo]]
13954
13955 [[././bar]]
13956
13957 [[././baz/]]
13958 !! html/php
13959 <p>[[./foo]]
13960 </p><p>[[././bar]]
13961 </p><p>[[././baz/]]
13962 </p>
13963 !! html/parsoid
13964 <p>[[./foo]]
13965 </p><p>[[././bar]]
13966 </p><p>[[././baz/]]
13967 </p>
13968 !! end
13969
13970 !! test
13971 Render invalid page names as plain text (bug 51090)
13972 !! wikitext
13973 [[./../foo|bar]]
13974 [[foo�|bar]]
13975 [[foo/.|bar]]
13976 [[foo/..|bar]]
13977 [[foo~~~bar]]
13978 [[foo>bar]]
13979 [[foo[bar]]
13980 [[.]]
13981 [[..]]
13982 [[foo././bar]]
13983
13984 [[{{echo|./../foo}}|bar]]
13985 [[{{echo|foo/.}}|bar]]
13986 [[{{echo|foo/..}}|bar]]
13987 [[{{echo|foo~~~~bar}}]]
13988 [[{{echo|foo>bar}}]]
13989 [[{{echo|foo././bar}}]]
13990 [[{{echo|foo{bar}}]]
13991 [[{{echo|foo}bar}}]]
13992 [[{{echo|foo[bar}}]]
13993 [[{{echo|foo]bar}}]]
13994 [[{{echo|foo<bar}}]]
13995 !!html/php
13996 <p>[[./../foo|bar]]
13997 [[foo�|bar]]
13998 [[foo/.|bar]]
13999 [[foo/..|bar]]
14000 [[foo~~~bar]]
14001 [[foo&gt;bar]]
14002 [[foo[bar]]
14003 [[.]]
14004 [[..]]
14005 [[foo././bar]]
14006 </p><p>[[./../foo|bar]]
14007 [[foo/.|bar]]
14008 [[foo/..|bar]]
14009 [[foo~~~~bar]]
14010 [[foo&gt;bar]]
14011 [[foo././bar]]
14012 [[foo{bar]]
14013 [[foo}bar]]
14014 [[foo[bar]]
14015 [[foo]bar]]
14016 [[foo&lt;bar]]
14017 </p>
14018 !!html/parsoid
14019 <p>[[./../foo|bar]]
14020 [[foo�|bar]]
14021 [[foo/.|bar]]
14022 [[foo/..|bar]]
14023 [[foo~~~bar]]
14024 [[foo>bar]]
14025 [[foo[bar]]
14026 [[.]]
14027 [[..]]
14028 [[foo././bar]]</p>
14029
14030 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14031 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14032 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14033 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14034 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14035 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14036 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14037 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14038 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14039 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14040 [[<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>
14041 !!end
14042
14043 !! test
14044 Disabled subpages
14045 !! wikitext
14046 [[/subpage]]
14047 !! html
14048 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14049 </p>
14050 !! end
14051
14052 !! test
14053 BUG 561: {{/Subpage}}
14054 !! options
14055 subpage title=[[Page]]
14056 !! wikitext
14057 {{/Subpage}}
14058 !! html
14059 <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>
14060 </p>
14061 !! end
14062
14063 ###
14064 ### Categories
14065 ###
14066 !! article
14067 Category:MediaWiki User's Guide
14068 !! text
14069 blah
14070 !! endarticle
14071
14072 !! test
14073 Link to category
14074 !! wikitext
14075 [[:Category:MediaWiki User's Guide]]
14076 !! html
14077 <p><a href="/wiki/Category:MediaWiki_User's_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14078 </p>
14079 !! end
14080
14081 !! test
14082 Simple category
14083 !! options
14084 cat
14085 !! wikitext
14086 [[Category:MediaWiki User's Guide]]
14087 !! html
14088 <a href="/wiki/Category:MediaWiki_User's_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14089 !! end
14090
14091 !! test
14092 PAGESINCATEGORY invalid title fatal (r33546 fix)
14093 !! wikitext
14094 {{PAGESINCATEGORY:<bogus>}}
14095 !! html
14096 <p>0
14097 </p>
14098 !! end
14099
14100 !! test
14101 Category with different sort key
14102 !! options
14103 cat
14104 !! wikitext
14105 [[Category:MediaWiki User's Guide|Foo]]
14106 !! html
14107 <a href="/wiki/Category:MediaWiki_User's_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14108 !! end
14109
14110 !! test
14111 Category with identical sort key
14112 !! options
14113 cat
14114 !! wikitext
14115 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14116 !! html
14117 <a href="/wiki/Category:MediaWiki_User's_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14118 !! end
14119
14120 !! test
14121 Category with empty sort key
14122 !! options
14123 cat
14124 pst
14125 !! wikitext
14126 [[Category:MediaWiki User's Guide|]]
14127 !! html
14128 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14129 !! end
14130
14131 !! test
14132 Category with empty sort key and parentheses
14133 !! options
14134 cat
14135 pst
14136 !! wikitext
14137 [[Category:Foo (bar)|]]
14138 !! html
14139 [[Category:Foo (bar)|Foo]]
14140 !! end
14141
14142 !! test
14143 Category with link tail
14144 !! options
14145 cat
14146 pst
14147 !! wikitext
14148 123[[Category:Foo]]456
14149 !! html
14150 123[[Category:Foo]]456
14151 !! end
14152
14153 !! test
14154 Category with template
14155 !! options
14156 cat
14157 pst
14158 !! wikitext
14159 [[Category:{{echo|Foo}}]]
14160 !! html
14161 [[Category:{{echo|Foo}}]]
14162 !! end
14163
14164 !! test
14165 Category with template in sort key
14166 !! options
14167 cat
14168 pst
14169 !! wikitext
14170 [[Category:Foo|{{echo|Bar}}]]
14171 !! html
14172 [[Category:Foo|{{echo|Bar}}]]
14173 !! end
14174
14175 !! test
14176 Category with template in sort key and title
14177 !! options
14178 cat
14179 pst
14180 !! wikitext
14181 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14182 !! html
14183 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14184 !! end
14185
14186 !! test
14187 Category / paragraph interactions
14188 !! wikitext
14189 Foo [[Category:Baz]] Bar
14190
14191 Foo [[Category:Baz]]
14192 Bar
14193
14194 Foo
14195 [[Category:Baz]]
14196 Bar
14197
14198 Foo
14199 [[Category:Baz]] Bar
14200
14201 Foo
14202 [[Category:Baz]]
14203 [[Category:Baz]]
14204 [[Category:Baz]]
14205 Bar
14206
14207 [[Category:Baz]]
14208 [[Category:Baz]]
14209 [[Category:Baz]]
14210
14211 [[Category:Baz]]
14212 {{echo|[[Category:Baz]]}}
14213 [[Category:Baz]]
14214 !! html
14215 <p>Foo Bar
14216 </p><p>Foo
14217 Bar
14218 </p><p>Foo
14219 Bar
14220 </p><p>Foo Bar
14221 </p><p>Foo
14222 Bar
14223 </p>
14224 !! end
14225
14226 ## The whitespace on the empty line is part of the test. Please do not delete
14227 !! test
14228 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14229 !! options
14230 parsoid=wt2html,wt2wt
14231 !! wikitext
14232 This
14233
14234 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14235
14236 {{echo|[[Category:Foo]] and so should this!}}
14237 !! html
14238 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14239 </p>
14240 !! html/parsoid
14241 <p>This
14242
14243 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14244
14245 <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>
14246 !! end
14247
14248 ## Parsoid will not try to wt2wt this while preserving newlines because
14249 ## it suppresses excess newlines within list items -- and we don't want to
14250 ## introduce a special case just for categories, which is, in reality somewhat
14251 ## odd behavior -- categories are unlikely to be used in list items like this
14252 ## in top-level pages and are only likely to show up in template-generated
14253 ## list items where this RT-ing is a non-issue.
14254 ##
14255 ## The whitespace on the empty line is part of the test. Please do not delete
14256 !! test
14257 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14258 !! options
14259 parsoid=wt2html
14260 !! wikitext
14261 * This
14262
14263 [[Category:Foo]] and this should be part of the same list item
14264 * So should this
14265
14266 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14267 !! html
14268 <ul><li>This and this should be part of the same list item</li>
14269 <li>So should this and this should be part of the same list item</li></ul>
14270 !! html/parsoid
14271 <ul>
14272 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14273 <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>
14274 </ul>
14275 !! end
14276
14277 ## Newlines and categories that follow the last item of a list
14278 ## are treated differently because this (list followed by categories)
14279 ## is an extremely common pattern on wikis.
14280 !! test
14281 3. Categories and newlines: newline suppression for last list item should RT properly
14282 !! wikitext
14283 * a
14284 * b
14285
14286 [[Category:Foo]]
14287
14288 [[Category:Bar]]
14289 [[Category:Baz]]
14290 !! html/parsoid
14291 <ul><li> a</li>
14292 <li> b</li></ul>
14293
14294 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14295
14296 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14297 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14298 !! end
14299
14300 !! test
14301 4. Categories and newlines: newline suppression for last list item should RT properly
14302 !! wikitext
14303 * a
14304 **** b
14305
14306 [[Category:Foo]]
14307 !! html/parsoid
14308 <ul><li> a
14309 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14310
14311 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14312 !! end
14313
14314 ## only wt2html for this to make sure the algo only applies to the rightmost path
14315 !! test
14316 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14317 !! options
14318 parsoid=wt2html
14319 !! wikitext
14320 * a
14321 ** b
14322 [[Category:Foo]]
14323 * c
14324 ** d
14325 [[Category:Foo]]
14326 !! html/parsoid
14327 <ul><li> a
14328 <ul><li> b
14329 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14330 <li> c
14331 <ul><li> d</li></ul></li></ul>
14332 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14333 !! end
14334
14335 !! test
14336 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14337 !! wikitext
14338 * a [[Category:Foo]]
14339 !! html/parsoid
14340 <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>
14341 !! end
14342
14343 # This test also demonstrates because of newline+category tunneling
14344 # through the list hander, template wrapping doesn't expand to the
14345 # containing list when the list item swallows the category.
14346 !! test
14347 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14348 !! wikitext
14349 * {{echo|a
14350 [[Category:Foo]]}}
14351 !! html/parsoid
14352 <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">
14353 </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>
14354 !! end
14355
14356 !! test
14357 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14358 !! wikitext
14359 * a
14360
14361 {{echo|[[Category:Foo]]
14362 [[Category:Bar]]}}
14363 [[Category:Baz]]
14364 !! html/parsoid
14365 <ul><li> a</li></ul>
14366
14367 <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">
14368 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14369 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14370 !! end
14371
14372 !! test
14373 Parsoid: Serialize link to category page with colon escape
14374 !! options
14375 parsoid
14376 !! wikitext
14377
14378 [[:Category:Foo]]
14379 [[:Category:Foo|Bar]]
14380 !! html
14381 <p>
14382 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14383 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14384 </p>
14385 !! end
14386
14387 # html2wt localizes the "Category" namespace.
14388 # XXX the <link> element needs an empty data-parsoid attribute, or
14389 # else the html2html test fails because spaces are inserted.
14390 !! test
14391 Link prefix/suffixes aren't applied to category links
14392 !! options
14393 parsoid=wt2html,wt2wt,html2html
14394 language=is
14395 !! wikitext
14396 x[[Category:Foo]]y
14397 !! html/php
14398 <p>xy
14399 </p>
14400 !! html/parsoid
14401 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14402 !! end
14403
14404 !! test
14405 Parsoid: Serialize link to file page with colon escape
14406 !! options
14407 parsoid
14408 !! wikitext
14409
14410 [[:File:Foo.png]]
14411 [[:File:Foo.png|Bar]]
14412 !! html
14413 <p>
14414 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14415 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14416 </p>
14417 !! end
14418
14419 !! test
14420 Parsoid: Serialize a genuine category link without colon escape
14421 !! options
14422 parsoid
14423 !! wikitext
14424 [[Category:Foo]]
14425 [[Category:Foo|Bar]]
14426 !! html
14427 <link rel="mw:PageProp/Category" href="./Category:Foo">
14428 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14429 !! end
14430
14431 !! test
14432 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14433 !! options
14434 parsoid=html2wt
14435 !! html/parsoid
14436 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14437 !! wikitext
14438 [[Category:Toxine bactérienne]]
14439 !! end
14440
14441 !! test
14442 Parsoid: Defaultsort
14443 !! wikitext
14444 {{DEFAULTSORT:Foo}}
14445 !! html/parsoid
14446 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14447 !! end
14448
14449 !! test
14450 Parsoid: Defaultsort (template-generated)
14451 !! wikitext
14452 {{{{echo|DEFAULTSORT}}:Foo}}
14453 !! html/parsoid
14454 <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}}]}'/>
14455 !! end
14456
14457 ###
14458 ### Inter-language links
14459 ###
14460 !! test
14461 Interlanguage links
14462 !! options
14463 ill
14464 !! wikitext
14465 [[es:Alimento]]
14466 [[fr:Nourriture]]
14467 [[zh:食品]]
14468 !! html/php
14469 es:Alimento fr:Nourriture zh:食品
14470 !! html/parsoid
14471 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14472 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14473 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14474 !! end
14475
14476 !! test
14477 Duplicate interlanguage links (bug 24502)
14478 !! options
14479 ill
14480 !! wikitext
14481 [[es:1]]
14482 [[es:2]]
14483 [[fr:1]]
14484 [[fr:2]]
14485 !! html/php
14486 es:1 fr:1
14487 !! html/parsoid
14488 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14489 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14490 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14491 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14492 !! end
14493
14494 ###
14495 ### Sections
14496 ###
14497 !! test
14498 Basic section headings
14499 !! wikitext
14500 == Headline 1 ==
14501 Some text
14502
14503 ==Headline 2==
14504 More
14505 ===Smaller headline===
14506 Blah blah
14507 !! html
14508 <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>
14509 <p>Some text
14510 </p>
14511 <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>
14512 <p>More
14513 </p>
14514 <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>
14515 <p>Blah blah
14516 </p>
14517 !! end
14518
14519 !! test
14520 Section headings with TOC
14521 !! wikitext
14522 == Headline 1 ==
14523 === Subheadline 1 ===
14524 ===== Skipping a level =====
14525 ====== Skipping a level ======
14526
14527 == Headline 2 ==
14528 Some text
14529 ===Another headline===
14530 !! html
14531 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14532 <ul>
14533 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14534 <ul>
14535 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14536 <ul>
14537 <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>
14538 <ul>
14539 <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>
14540 </ul>
14541 </li>
14542 </ul>
14543 </li>
14544 </ul>
14545 </li>
14546 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14547 <ul>
14548 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14549 </ul>
14550 </li>
14551 </ul>
14552 </div>
14553
14554 <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>
14555 <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>
14556 <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>
14557 <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>
14558 <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>
14559 <p>Some text
14560 </p>
14561 <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>
14562
14563 !! end
14564
14565 !! test
14566 TOC anchors don't collide
14567 !! wikitext
14568 __FORCETOC__
14569 == Headline 2 ==
14570 == Headline ==
14571 == Headline 2 ==
14572 == Headline ==
14573 !! html/php
14574 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14575 <ul>
14576 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14577 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14578 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14579 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14580 </ul>
14581 </div>
14582
14583 <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>
14584 <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>
14585 <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>
14586 <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>
14587
14588 !! end
14589
14590 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14591 !! test
14592 Handling of sections up to level 6 and beyond
14593 !! wikitext
14594 = Level 1 Heading=
14595 == Level 2 Heading==
14596 === Level 3 Heading===
14597 ==== Level 4 Heading====
14598 ===== Level 5 Heading=====
14599 ====== Level 6 Heading======
14600 ======= Level 7 Heading=======
14601 ======== Level 8 Heading========
14602 ========= Level 9 Heading=========
14603 ========== Level 10 Heading==========
14604 !! html
14605 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14606 <ul>
14607 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14608 <ul>
14609 <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>
14610 <ul>
14611 <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>
14612 <ul>
14613 <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>
14614 <ul>
14615 <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>
14616 <ul>
14617 <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>
14618 <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>
14619 <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>
14620 <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>
14621 <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>
14622 </ul>
14623 </li>
14624 </ul>
14625 </li>
14626 </ul>
14627 </li>
14628 </ul>
14629 </li>
14630 </ul>
14631 </li>
14632 </ul>
14633 </div>
14634
14635 <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>
14636 <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>
14637 <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>
14638 <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>
14639 <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>
14640 <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>
14641 <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>
14642 <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>
14643 <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>
14644 <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>
14645
14646 !! end
14647
14648 !! test
14649 TOC regression (T11764)
14650 !! wikitext
14651 == title 1 ==
14652 === title 1.1 ===
14653 ==== title 1.1.1 ====
14654 === title 1.2 ===
14655 == title 2 ==
14656 === title 2.1 ===
14657 !! html
14658 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14659 <ul>
14660 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14661 <ul>
14662 <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>
14663 <ul>
14664 <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>
14665 </ul>
14666 </li>
14667 <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>
14668 </ul>
14669 </li>
14670 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14671 <ul>
14672 <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>
14673 </ul>
14674 </li>
14675 </ul>
14676 </div>
14677
14678 <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>
14679 <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>
14680 <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>
14681 <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>
14682 <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>
14683 <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>
14684
14685 !! end
14686
14687 !! test
14688 TOC for heading containing <span id="..."></span> (T96153)
14689 !! wikitext
14690 __FORCETOC__
14691 ==<span id="old-anchor"></span>New title==
14692 !! html/php
14693 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14694 <ul>
14695 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14696 </ul>
14697 </div>
14698
14699 <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>
14700
14701 !! end
14702
14703 !! test
14704 TOC with wgMaxTocLevel=3 (bug 6204)
14705 !! options
14706 wgMaxTocLevel=3
14707 !! wikitext
14708 == title 1 ==
14709 === title 1.1 ===
14710 ==== title 1.1.1 ====
14711 === title 1.2 ===
14712 == title 2 ==
14713 === title 2.1 ===
14714 !! html
14715 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14716 <ul>
14717 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14718 <ul>
14719 <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>
14720 <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>
14721 </ul>
14722 </li>
14723 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14724 <ul>
14725 <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>
14726 </ul>
14727 </li>
14728 </ul>
14729 </div>
14730
14731 <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>
14732 <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>
14733 <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>
14734 <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>
14735 <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>
14736 <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>
14737
14738 !! end
14739
14740 !! test
14741 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14742 !! options
14743 wgMaxTocLevel=3
14744 !! wikitext
14745 ==Section 1==
14746 ===Section 1.1===
14747 ====Section 1.1.1====
14748 ====Section 1.1.1.1====
14749 ==Section 2==
14750 !! html
14751 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14752 <ul>
14753 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14754 <ul>
14755 <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>
14756 </ul>
14757 </li>
14758 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14759 </ul>
14760 </div>
14761
14762 <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>
14763 <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>
14764 <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>
14765 <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>
14766 <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>
14767
14768 !! end
14769
14770
14771 !! test
14772 Resolving duplicate section names
14773 !! wikitext
14774 == Foo bar ==
14775 == Foo bar ==
14776 !! html
14777 <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>
14778 <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>
14779
14780 !! end
14781
14782 !! test
14783 Resolving duplicate section names with differing case (bug 10721)
14784 !! wikitext
14785 == Foo bar ==
14786 == Foo Bar ==
14787 !! html
14788 <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>
14789 <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>
14790
14791 !! end
14792
14793 !! article
14794 Template:sections
14795 !! text
14796 ===Section 1===
14797 ==Section 2==
14798 !! endarticle
14799
14800 !! test
14801 Template with sections, __NOTOC__
14802 !! wikitext
14803 __NOTOC__
14804 ==Section 0==
14805 {{sections}}
14806 ==Section 4==
14807 !! html
14808 <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>
14809 <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>
14810 <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>
14811 <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>
14812
14813 !! end
14814
14815 !! test
14816 __NOEDITSECTION__ keyword
14817 !! wikitext
14818 __NOEDITSECTION__
14819 ==Section 1==
14820 ==Section 2==
14821 !! html
14822 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14823 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14824
14825 !! end
14826
14827 !! test
14828 Link inside a section heading
14829 !! wikitext
14830 ==Section with a [[Main Page|link]] in it==
14831 !! html
14832 <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>
14833
14834 !! end
14835
14836 !! test
14837 TOC regression (T14077)
14838 !! wikitext
14839 __TOC__
14840 == title 1 ==
14841 === title 1.1 ===
14842 == title 2 ==
14843 !! html
14844 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14845 <ul>
14846 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14847 <ul>
14848 <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>
14849 </ul>
14850 </li>
14851 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14852 </ul>
14853 </div>
14854
14855 <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>
14856 <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>
14857 <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>
14858
14859 !! end
14860
14861 !! test
14862 BUG 1219 URL next to image (good)
14863 !! wikitext
14864 http://example.com [[File:Foobar.jpg]]
14865 !! html/php
14866 <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>
14867 </p>
14868 !! html/parsoid
14869 <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>
14870 !!end
14871
14872 !! test
14873 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14874 !! wikitext
14875 ===
14876 The line above must have a trailing space!
14877 === <!--
14878 --> <!-- -->
14879 But just in case it doesn't...
14880 !! html
14881 <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>
14882 <p>The line above must have a trailing space!
14883 </p>
14884 <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>
14885 <p>But just in case it doesn't...
14886 </p>
14887 !! end
14888
14889 !! test
14890 Header with special characters (bug 25462)
14891 !! wikitext
14892 The tooltips shall not show entities to the user (ie. be double escaped)
14893
14894 == text > text ==
14895 section 1
14896
14897 == text < text ==
14898 section 2
14899
14900 == text & text ==
14901 section 3
14902
14903 == text ' text ==
14904 section 4
14905
14906 == text " text ==
14907 section 5
14908 !! html
14909 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14910 </p>
14911 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14912 <ul>
14913 <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>
14914 <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>
14915 <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>
14916 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14917 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14918 </ul>
14919 </div>
14920
14921 <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>
14922 <p>section 1
14923 </p>
14924 <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>
14925 <p>section 2
14926 </p>
14927 <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>
14928 <p>section 3
14929 </p>
14930 <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>
14931 <p>section 4
14932 </p>
14933 <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>
14934 <p>section 5
14935 </p>
14936 !! end
14937
14938 !! test
14939 Header with space, plus and underscore as entity
14940 !! wikitext
14941 Id should not contain + for spaces
14942
14943 == Space between Text ==
14944 section 1
14945
14946 == Space-Entity&#32;between&#32;Text ==
14947 section 2
14948
14949 == Plus+between+Text ==
14950 section 3
14951
14952 == Plus-Entity&#43;between&#43;Text ==
14953 section 4
14954
14955 == Underscore_between_Text ==
14956 section 5
14957
14958 == Underscore-Entity&#95;between&#95;Text ==
14959 section 6
14960
14961 [[#Space between Text]]
14962 [[#Space-Entity&#32;between&#32;Text]]
14963 [[#Plus+between+Text]]
14964 [[#Plus-Entity&#43;between&#43;Text]]
14965 [[#Underscore_between_Text]]
14966 [[#Underscore-Entity&#95;between&#95;Text]]
14967 !! html
14968 <p>Id should not contain + for spaces
14969 </p>
14970 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14971 <ul>
14972 <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>
14973 <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>
14974 <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>
14975 <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>
14976 <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>
14977 <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>
14978 </ul>
14979 </div>
14980
14981 <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>
14982 <p>section 1
14983 </p>
14984 <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>
14985 <p>section 2
14986 </p>
14987 <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>
14988 <p>section 3
14989 </p>
14990 <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>
14991 <p>section 4
14992 </p>
14993 <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>
14994 <p>section 5
14995 </p>
14996 <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>
14997 <p>section 6
14998 </p><p><a href="#Space_between_Text">#Space between Text</a>
14999 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15000 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15001 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15002 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15003 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15004 </p>
15005 !! end
15006
15007 !! test
15008 Headers with excess '=' characters
15009 (Are similar tests necessary beyond the 1st level?)
15010 !! wikitext
15011 =foo==
15012 ==foo=
15013 =''italic'' heading==
15014 ==''italic'' heading=
15015 !! html
15016 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15017 <ul>
15018 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15019 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15020 <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>
15021 <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>
15022 </ul>
15023 </div>
15024
15025 <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>
15026 <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>
15027 <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>
15028 <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>
15029
15030 !! end
15031
15032 !! test
15033 HTML headers vs TOC (bug 23393)
15034 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15035 !! wikitext
15036 <h1>Header 1</h1>
15037 == Header 1.1 ==
15038 == Header 1.2 ==
15039
15040 <h1>Header 2
15041 </h1>
15042 == Header 2.1 ==
15043 == Header 2.2 ==
15044 __NOEDITSECTION__
15045 !! html
15046 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15047 <ul>
15048 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15049 <ul>
15050 <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>
15051 <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>
15052 </ul>
15053 </li>
15054 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15055 <ul>
15056 <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>
15057 <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>
15058 </ul>
15059 </li>
15060 </ul>
15061 </div>
15062
15063 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15064 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15065 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15066 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15067 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15068 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15069
15070 !! end
15071
15072 !! test
15073 Single-line or multiline-comments can follow headings
15074 !! options
15075 parsoid=wt2html,wt2wt
15076 !! wikitext
15077 ==foo==<!---->
15078 ==bar==<!--c1-->
15079 ==baz==<!--
15080 c2
15081 c3-->
15082 !! html
15083 <h2><span class="mw-headline" id="foo">foo</span></h2>
15084 <h2><span class="mw-headline" id="bar">bar</span></h2>
15085 <h2><span class="mw-headline" id="baz">baz</span></h2>
15086
15087 !! end
15088
15089 !! test
15090 BUG 1219 URL next to image (broken)
15091 !! wikitext
15092 http://example.com[[File:Foobar.jpg]]
15093 !! html/php
15094 <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>
15095 </p>
15096 !! html/parsoid
15097 <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>
15098 !!end
15099
15100 !! test
15101 Bug 1186 news: in the middle of text
15102 !! wikitext
15103 http://en.wikinews.org/wiki/Wikinews:Workplace
15104 !! html
15105 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15106 </p>
15107 !!end
15108
15109
15110 !! test
15111 Namespaced link must have a title
15112 !! wikitext
15113 [[Project:]]
15114 !! html
15115 <p>[[Project:]]
15116 </p>
15117 !!end
15118
15119 !! test
15120 Namespaced link must have a title (bad fragment version)
15121 !! wikitext
15122 [[Project:#fragment]]
15123 !! html
15124 <p>[[Project:#fragment]]
15125 </p>
15126 !!end
15127
15128
15129 ###
15130 ### HTML tags and HTML attributes
15131 ###
15132
15133 !! test
15134 div with no attributes
15135 !! wikitext
15136 <div>HTML rocks</div>
15137 !! html
15138 <div>HTML rocks</div>
15139
15140 !! end
15141
15142 !! test
15143 div with double-quoted attribute
15144 !! wikitext
15145 <div id="rock">HTML rocks</div>
15146 !! html
15147 <div id="rock">HTML rocks</div>
15148
15149 !! end
15150
15151 !! test
15152 div with single-quoted attribute
15153 !! wikitext
15154 <div id='rock'>HTML rocks</div>
15155 !! html
15156 <div id="rock">HTML rocks</div>
15157
15158 !! end
15159
15160 !! test
15161 div with unquoted attribute
15162 !! wikitext
15163 <div id=rock>HTML rocks</div>
15164 !! html
15165 <div id="rock">HTML rocks</div>
15166
15167 !! end
15168
15169 !! test
15170 div with illegal double attributes
15171 !! wikitext
15172 <div id="a" id="b">HTML rocks</div>
15173 !! html
15174 <div id="b">HTML rocks</div>
15175
15176 !!end
15177
15178 # FIXME: produce empty string instead of "class" in the PHP parser, following
15179 # the HTML5 spec.
15180 !! test
15181 div with empty attribute value, space before equals
15182 !! options
15183 parsoid
15184 !! wikitext
15185 <div class =>HTML rocks</div>
15186 !! html
15187 <div class="">HTML rocks</div>
15188
15189 !! end
15190
15191 !! test
15192 div with multiple empty attribute values
15193 !! options
15194 parsoid
15195 !! wikitext
15196 <div id= title=>HTML rocks</div>
15197 !! html
15198 <div id="" title="">HTML rocks</div>
15199
15200 !! end
15201
15202 !! test
15203 table with multiple empty attribute values
15204 !! options
15205 parsoid
15206 !! wikitext
15207 {| title= id=
15208 | hi
15209 |}
15210 !! html
15211 <table title="" id="">
15212 <tbody><tr><td> hi</td></tr>
15213 </tbody></table>
15214 !! end
15215
15216 !! test
15217 div with braces in attribute value
15218 !! wikitext
15219 <div title="{}">Foo</div>
15220 !! html/php
15221 <div title="&#123;}">Foo</div>
15222
15223 !! html/parsoid
15224 <div title="{}">Foo</div>
15225 !! end
15226
15227 # This it very inconsistent in the PHP parser: it returns
15228 # class="class" if there is a space between the name and the equal sign (see
15229 # 'div with empty attribute value, space before equals'), but strips the
15230 # attribute completely if the space is missing. We hope that not much content
15231 # depends on this, so are implementing the behavior below in Parsoid for
15232 # consistencies' sake.
15233 # FIXME: fix this behavior in the PHP parser?
15234 !! test
15235 div with empty attribute value, no space before equals
15236 !! options
15237 parsoid=wt2html,html2html
15238 !! wikitext
15239 <div class=>HTML rocks</div>
15240 !! html/php
15241 <div>HTML rocks</div>
15242
15243 !! html/parsoid
15244 <div class="">HTML rocks</div>
15245 !! end
15246
15247 !! test
15248 HTML multiple attributes correction
15249 !! wikitext
15250 <p class="error" class="awesome">Awesome!</p>
15251 !! html
15252 <p class="awesome">Awesome!</p>
15253
15254 !!end
15255
15256 !! test
15257 Table multiple attributes correction
15258 !! wikitext
15259 {|
15260 !+ class="error" class="awesome"| status
15261 |}
15262 !! html
15263 <table>
15264 <tr>
15265 <th class="awesome"> status
15266 </th></tr></table>
15267
15268 !!end
15269
15270 !! test
15271 DIV IN UPPERCASE
15272 !! wikitext
15273 <DIV ID="x">HTML ROCKS</DIV>
15274 !! html
15275 <div id="x">HTML ROCKS</div>
15276
15277 !!end
15278
15279 !! test
15280 Non-ASCII pseudo-tags are rendered as text
15281 !! wikitext
15282 <khyô>
15283 !! html
15284 <p>&lt;khyô&gt;
15285 </p>
15286 !! end
15287
15288 !! test
15289 Pseudo-tag with URL 'name' renders as url link
15290 !! wikitext
15291 <http://example.com/>
15292 !! html
15293 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15294 </p>
15295 !! end
15296
15297 !! test
15298 text with amp in the middle of nowhere
15299 !! wikitext
15300 Remember AT&T?
15301 !! html
15302 <p>Remember AT&amp;T?
15303 </p>
15304 !! end
15305
15306 !! test
15307 text with character entity: eacute
15308 !! wikitext
15309 I always thought &eacute; was a cute letter.
15310 !! html
15311 <p>I always thought &#233; was a cute letter.
15312 </p>
15313 !! html+tidy
15314 <p>I always thought é was a cute letter.</p>
15315 !! end
15316
15317 !! test
15318 text with entity-escaped character entity-like string: eacute
15319 !! wikitext
15320 I always thought &amp;eacute; was a cute letter.
15321 !! html
15322 <p>I always thought &amp;eacute; was a cute letter.
15323 </p>
15324 !! end
15325
15326 !! test
15327 text with undefined character entity: xacute
15328 !! wikitext
15329 I always thought &xacute; was a cute letter.
15330 !! html
15331 <p>I always thought &amp;xacute; was a cute letter.
15332 </p>
15333 !! end
15334
15335 !! test
15336 HTML5 tags
15337 !! wikitext
15338 <data value="5">five</data>
15339 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15340 <mark>This highlighted text</mark>
15341 !! html
15342 <p><data value="5">five</data>
15343 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15344 <mark>This highlighted text</mark>
15345 </p>
15346 !! end
15347
15348 !! test
15349 HTML tag with leading space is parsed as text
15350 !! wikitext
15351 < div>foo< /div>
15352 !! html
15353 <p>&lt; div&gt;foo&lt; /div&gt;
15354 </p>
15355 !! end
15356
15357 ###
15358 ### Nesting tests (see bug 41545, 50604, 51081)
15359 ###
15360
15361 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15362 # Note that html2wt is considerably more difficult if we use <b> in
15363 # the test case, instead of <big>
15364 !! test
15365 Ensure that HTML adoption agency algorithm is properly implemented.
15366 !! wikitext
15367 <big>X<big>Y</big>Z</big>
15368 !! html
15369 <p><big>X<big>Y</big>Z</big>
15370 </p>
15371 !! end
15372
15373 # This was bug 41545 in the PHP parser.
15374 # Note that tidy doesn't handle this correctly.
15375 !! test
15376 Nesting of <kbd>
15377 !! wikitext
15378 <kbd>X<kbd>Y</kbd>Z</kbd>
15379 !! html
15380 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15381 </p>
15382 !! end
15383
15384 # The following cases were bug 51081 in the PHP parser.
15385 # Note that there are some other nestable tags (b, i, etc) which are
15386 # not covered; see bug 51081 for discussion.
15387
15388 # Note that tidy doesn't handle this correctly.
15389 !! test
15390 Nesting of <em>
15391 !! wikitext
15392 <em>X<em>Y</em>Z</em>
15393 !! html
15394 <p><em>X<em>Y</em>Z</em>
15395 </p>
15396 !! end
15397
15398 # Note that tidy doesn't handle this correctly.
15399 !! test
15400 Nesting of <strong>
15401 !! wikitext
15402 <strong>X<strong>Y</strong>Z</strong>
15403 !! html
15404 <p><strong>X<strong>Y</strong>Z</strong>
15405 </p>
15406 !! end
15407
15408 !! test
15409 Nesting of <q>
15410 !! wikitext
15411 <q>X<q>Y</q>Z</q>
15412 !! html+tidy
15413 <p><q>X<q>Y</q>Z</q></p>
15414 !! end
15415
15416 # Note that tidy doesn't handle this correctly.
15417 !! test
15418 Nesting of <ruby>
15419 !! wikitext
15420 <ruby>X<ruby>Y</ruby>Z</ruby>
15421 !! html
15422 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15423 </p>
15424 !! end
15425
15426 # Note that tidy doesn't handle this correctly.
15427 !! test
15428 Nesting of <bdo>
15429 !! wikitext
15430 <bdo>X<bdo>Y</bdo>Z</bdo>
15431 !! html
15432 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15433 </p>
15434 !! end
15435
15436
15437 ###
15438 ### Media links
15439 ###
15440
15441 !! test
15442 Media link
15443 !! wikitext
15444 [[Media:Foobar.jpg]]
15445 !! html
15446 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15447 </p>
15448 !! end
15449
15450 !! test
15451 Media link with text
15452 !! wikitext
15453 [[Media:Foobar.jpg|A neat file to look at]]
15454 !! html
15455 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15456 </p>
15457 !! end
15458
15459 # FIXME: this is still bad HTML tag nesting
15460 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15461 !! test
15462 Media link with nasty text
15463 !! wikitext
15464 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15465 !! html
15466 <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>
15467
15468 !! html+tidy
15469 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15470 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15471 !! end
15472
15473 !! test
15474 Media link to nonexistent file (bug 1702)
15475 !! wikitext
15476 [[Media:No such.jpg]]
15477 !! html
15478 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15479 </p>
15480 !! end
15481
15482 !! test
15483 Image link to nonexistent file (bug 1850 - good)
15484 !! wikitext
15485 [[File:No_such.jpg]]
15486 !! html/php
15487 <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>
15488 </p>
15489 !! html/parsoid
15490 <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>
15491 !! end
15492
15493 !! test
15494 :Image link to nonexistent file (bug 1850 - bad)
15495 !! wikitext
15496 [[:Image:No such.jpg]]
15497 !! html/php
15498 <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>
15499 </p>
15500 !! html/parsoid
15501 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15502 !! end
15503
15504
15505
15506 !! test
15507 Character reference normalization in link text (bug 1938)
15508 !! wikitext
15509 [[Main Page|this&that]]
15510 !! html
15511 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15512 </p>
15513 !!end
15514
15515 !! article
15516 אַ
15517 !! text
15518 Test for unicode normalization
15519
15520 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15521 !! endarticle
15522
15523 !! test
15524 (bug 19451) Links should refer to the normalized form.
15525 !! wikitext
15526 [[&#xFB2E;]]
15527 [[&#x5d0;&#x5b7;]]
15528 [[&#x5d0;ַ]]
15529 [[א&#x5b7;]]
15530 [[אַ]]
15531 !! html
15532 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15533 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15534 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15535 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15536 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15537 </p>
15538 !! end
15539
15540 !! test
15541 Empty attribute crash test (bug 2067)
15542 !! wikitext
15543 <font color="">foo</font>
15544 !! html
15545 <p><font color="">foo</font>
15546 </p>
15547 !! end
15548
15549 !! test
15550 Empty attribute crash test single-quotes (bug 2067)
15551 !! wikitext
15552 <font color=''>foo</font>
15553 !! html
15554 <p><font color="">foo</font>
15555 </p>
15556 !! end
15557
15558 !! test
15559 Attribute test: equals, then nothing
15560 !! wikitext
15561 <font color=>foo</font>
15562 !! html
15563 <p><font>foo</font>
15564 </p>
15565 !! end
15566
15567 !! test
15568 Attribute test: unquoted value
15569 !! wikitext
15570 <font color=x>foo</font>
15571 !! html
15572 <p><font color="x">foo</font>
15573 </p>
15574 !! end
15575
15576 !! test
15577 Attribute test: unquoted but illegal value (hash)
15578 !! wikitext
15579 <font color=#x>foo</font>
15580 !! html
15581 <p><font color="#x">foo</font>
15582 </p>
15583 !! end
15584
15585 # Parsoid does not serialize to empty attribute syntax,
15586 # so wt2wt and html2wt cases are skipped
15587 !! test
15588 Attribute test: no value (T54330)
15589 !! options
15590 parsoid=wt2html,html2html
15591 !! wikitext
15592 <font color>foo</font>
15593 !! html/php
15594 <p><font color="">foo</font>
15595 </p>
15596 !! html/parsoid
15597 <p><font color="">foo</font></p>
15598 !! end
15599
15600 !! test
15601 Bug 2095: link with three closing brackets
15602 !! wikitext
15603 [[Main Page]]]
15604 !! html/php
15605 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15606 </p>
15607 !! html/parsoid
15608 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15609 !! end
15610
15611 !! test
15612 Bug 2095: link with pipe and three closing brackets
15613 !! wikitext
15614 [[Main Page|link]]]
15615 !! html/php
15616 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15617 </p>
15618 !! html/parsoid
15619 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15620 !! end
15621
15622 !! test
15623 Bug 2095: link with pipe and three closing brackets, version 2
15624 !! wikitext
15625 [[Main Page|[http://example.com/]]]
15626 !! html/php
15627 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15628 </p>
15629 !! html/parsoid
15630 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15631 !! end
15632
15633
15634 ###
15635 ### Safety
15636 ###
15637
15638 !! article
15639 Template:Dangerous attribute
15640 !! text
15641 " onmouseover="alert(document.cookie)
15642 !! endarticle
15643
15644 !! article
15645 Template:Dangerous style attribute
15646 !! text
15647 border-size: expression(alert(document.cookie))
15648 !! endarticle
15649
15650 !! article
15651 Template:Div style
15652 !! text
15653 <div style="float: right; {{{1}}}">Magic div</div>
15654 !! endarticle
15655
15656 !! test
15657 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15658 !! wikitext
15659 <div title="{{test}}"></div>
15660 !! html
15661 <div title="This is a test template"></div>
15662
15663 !! end
15664
15665 # Parsoid has enough context to handle this case
15666 !! test
15667 Bug 2304: HTML attribute safety (dangerous template; 2309)
15668 !! wikitext
15669 <div title="{{dangerous attribute}}"></div>
15670 !! html/php
15671 <div title=""></div>
15672
15673 !! html/parsoid
15674 <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>
15675 !! end
15676
15677 !! test
15678 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15679 !! wikitext
15680 <div style="{{dangerous style attribute}}"></div>
15681 !! html
15682 <div style="/* insecure input */"></div>
15683
15684 !! end
15685
15686 !! test
15687 Bug 2304: HTML attribute safety (safe parameter; 2309)
15688 !! wikitext
15689 {{div style|width: 200px}}
15690 !! html
15691 <div style="float: right; width: 200px">Magic div</div>
15692
15693 !! end
15694
15695 !! test
15696 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15697 !! wikitext
15698 {{div style|width: expression(alert(document.cookie))}}
15699 !! html
15700 <div style="/* insecure input */">Magic div</div>
15701
15702 !! end
15703
15704 !! test
15705 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15706 !! wikitext
15707 {{div style|"><script>alert(document.cookie)</script>}}
15708 !! html
15709 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15710
15711 !! end
15712
15713 !! test
15714 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15715 !! wikitext
15716 {{div style|" ><script>alert(document.cookie)</script>}}
15717 !! html
15718 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15719
15720 !! end
15721
15722 !! test
15723 Bug 2304: HTML attribute safety (link)
15724 !! wikitext
15725 <div title="[[Main Page]]"></div>
15726 !! html
15727 <div title="&#91;&#91;Main Page]]"></div>
15728
15729 !! end
15730
15731 !! test
15732 Bug 2304: HTML attribute safety (italics)
15733 !! wikitext
15734 <div title="''foobar''"></div>
15735 !! html
15736 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15737
15738 !! end
15739
15740 !! test
15741 Bug 2304: HTML attribute safety (bold)
15742 !! wikitext
15743 <div title="'''foobar'''"></div>
15744 !! html
15745 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15746
15747 !! end
15748
15749
15750 !! test
15751 Bug 2304: HTML attribute safety (ISBN)
15752 !! wikitext
15753 <div title="ISBN 1234567890"></div>
15754 !! html
15755 <div title="&#73;SBN 1234567890"></div>
15756
15757 !! end
15758
15759 !! test
15760 Bug 2304: HTML attribute safety (RFC)
15761 !! wikitext
15762 <div title="RFC 1234"></div>
15763 !! html
15764 <div title="&#82;FC 1234"></div>
15765
15766 !! end
15767
15768 !! test
15769 Bug 2304: HTML attribute safety (PMID)
15770 !! wikitext
15771 <div title="PMID 1234567890"></div>
15772 !! html
15773 <div title="&#80;MID 1234567890"></div>
15774
15775 !! end
15776
15777 !! test
15778 Bug 2304: HTML attribute safety (web link)
15779 !! wikitext
15780 <div title="http://example.com/"></div>
15781 !! html
15782 <div title="http&#58;//example.com/"></div>
15783
15784 !! end
15785
15786 !! test
15787 Bug 2304: HTML attribute safety (named web link)
15788 !! wikitext
15789 <div title="[http://example.com/ link]"></div>
15790 !! html
15791 <div title="&#91;http&#58;//example.com/ link]"></div>
15792
15793 !! end
15794
15795 !! test
15796 Bug 3244: HTML attribute safety (extension; safe)
15797 !! wikitext
15798 <div style="<nowiki>background:blue</nowiki>"></div>
15799 !! html
15800 <div style="background:blue"></div>
15801
15802 !! end
15803
15804 !! test
15805 Bug 3244: HTML attribute safety (extension; unsafe)
15806 !! wikitext
15807 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15808 !! html
15809 <div style="/* insecure input */"></div>
15810
15811 !! end
15812
15813 # More MSIE fun discovered by Tom Gilder
15814
15815 !! test
15816 MSIE CSS safety test: spurious slash
15817 !! wikitext
15818 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15819 !! html
15820 <div style="/* insecure input */">evil</div>
15821
15822 !! end
15823
15824 !! test
15825 MSIE CSS safety test: hex code
15826 !! wikitext
15827 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15828 !! html
15829 <div style="/* insecure input */">evil</div>
15830
15831 !! end
15832
15833 !! test
15834 MSIE CSS safety test: comment in url
15835 !! wikitext
15836 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15837 !! html
15838 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15839
15840 !! end
15841
15842 !! test
15843 MSIE CSS safety test: comment in expression
15844 !! wikitext
15845 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15846 !! html
15847 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15848
15849 !! end
15850
15851 !! test
15852 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15853 !! wikitext
15854 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15855 !! html
15856 <p style="/* invalid control char */">A</p>
15857
15858 !! end
15859
15860 !! test
15861 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15862 !! wikitext
15863 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15864 <div style="top:EXPRESSION(alert())">B</div>
15865 !! html
15866 <p style="/* insecure input */">A</p>
15867 <div style="/* insecure input */">B</div>
15868
15869 !! end
15870
15871 !! test
15872 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15873 !! wikitext
15874 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15875 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15876 !! html
15877 <div style="/* insecure input */">A</div>
15878 <p style="/* insecure input */">B</p>
15879
15880 !! end
15881
15882 !! test
15883 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15884 !! wikitext
15885 <div style="background-image:url⁽javascript:alert())">A</div>
15886 <div style="background-image:url₍javascript:alert())">B</div>
15887 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15888 !! html
15889 <div style="/* insecure input */">A</div>
15890 <div style="/* insecure input */">B</div>
15891 <p style="/* insecure input */">C</p>
15892
15893 !! end
15894
15895 !! test
15896 Opera -o-link CSS
15897 !! wikitext
15898 <div
15899 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;"
15900 style="-o-link:attr(title);-o-link-source:current">X</div>
15901 !! html
15902 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15903
15904 !! end
15905
15906 !! test
15907 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15908 !! wikitext
15909 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15910 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15911 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15912 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15913 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15914 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15915 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15916 !! html
15917 <p style="/* insecure input */">A</p>
15918 <p style="/* insecure input */">B</p>
15919 <p style="/* insecure input */">C</p>
15920 <p style="/* insecure input */">D</p>
15921 <p style="/* insecure input */">E</p>
15922 <p style="/* insecure input */">F</p>
15923 <p style="/* insecure input */">G</p>
15924
15925 !! end
15926
15927 !! test
15928 Table attribute legitimate extension
15929 !! wikitext
15930 {|
15931 !+ style="<nowiki>color:blue</nowiki>"| status
15932 |}
15933 !! html
15934 <table>
15935 <tr>
15936 <th style="color:blue"> status
15937 </th></tr></table>
15938
15939 !!end
15940
15941 !! test
15942 Table attribute safety
15943 !! wikitext
15944 {|
15945 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15946 |}
15947 !! html
15948 <table>
15949 <tr>
15950 <th style="/* insecure input */"> status
15951 </th></tr></table>
15952
15953 !! end
15954
15955 !! test
15956 CSS line continuation 1
15957 !! wikitext
15958 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15959 !! html
15960 <div style="/* insecure input */"></div>
15961
15962 !! end
15963
15964 !! test
15965 CSS line continuation 2
15966 !! wikitext
15967 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15968 !! html
15969 <div style="/* invalid control char */"></div>
15970
15971 !! end
15972
15973 !! article
15974 Template:Identity
15975 !! text
15976 {{{1}}}
15977 !! endarticle
15978
15979 !! test
15980 Expansion of multi-line templates in attribute values (bug 6255)
15981 !! wikitext
15982 <div style="background: {{identity|#00FF00}}">-</div>
15983 !! html
15984 <div style="background: #00FF00">-</div>
15985
15986 !! end
15987
15988
15989 !! test
15990 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15991 !! wikitext
15992 <div style="background:
15993 #00FF00">-</div>
15994 !! html/php
15995 <div style="background: #00FF00">-</div>
15996
15997 !! html/parsoid
15998 <div style="background:
15999 #00FF00">-</div>
16000 !! end
16001
16002 !! test
16003 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16004 !! wikitext
16005 <div style="background: &#10;#00FF00">-</div>
16006 !! html
16007 <div style="background: &#10;#00FF00">-</div>
16008
16009 !! end
16010
16011 !! test
16012 evil <math>-wiki-tags without Extension:Math enabled
16013 !! wikitext
16014 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16015 !! html+tidy
16016 <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>
16017 !! end
16018
16019 ###
16020 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16021 ###
16022 !! test
16023 Parser hook: empty input
16024 !! wikitext
16025 <tag></tag>
16026 !! html/php
16027 <pre>
16028 ''
16029 array (
16030 )
16031 </pre>
16032
16033 !! end
16034
16035 !! test
16036 Parser hook: empty input using terminated empty elements
16037 !! wikitext
16038 <tag/>
16039 !! html/php
16040 <pre>
16041 NULL
16042 array (
16043 )
16044 </pre>
16045
16046 !! end
16047
16048 !! test
16049 Parser hook: empty input using terminated empty elements (space before)
16050 !! wikitext
16051 <tag />
16052 !! html/php
16053 <pre>
16054 NULL
16055 array (
16056 )
16057 </pre>
16058
16059 !! end
16060
16061 !! test
16062 Parser hook: basic input
16063 !! wikitext
16064 <tag>input</tag>
16065 !! html/php
16066 <pre>
16067 'input'
16068 array (
16069 )
16070 </pre>
16071
16072 !! end
16073
16074
16075 !! test
16076 Parser hook: case insensitive
16077 !! wikitext
16078 <TAG>input</TAG>
16079 !! html/php
16080 <pre>
16081 'input'
16082 array (
16083 )
16084 </pre>
16085
16086 !! end
16087
16088
16089 !! test
16090 Parser hook: case insensitive, redux
16091 !! wikitext
16092 <TaG>input</TAg>
16093 !! html/php
16094 <pre>
16095 'input'
16096 array (
16097 )
16098 </pre>
16099
16100 !! end
16101
16102 !! test
16103 Parser hook: nested tags
16104 !! options
16105 noxml
16106 !! wikitext
16107 <tag><tag></tag></tag>
16108 !! html/php
16109 <pre>
16110 '<tag>'
16111 array (
16112 )
16113 </pre>&lt;/tag&gt;
16114
16115 !! end
16116
16117 !! test
16118 Parser hook: basic arguments
16119 !! wikitext
16120 <tag width=200 height = "100" depth = '50' square></tag>
16121 !! html/php
16122 <pre>
16123 ''
16124 array (
16125 'width' => '200',
16126 'height' => '100',
16127 'depth' => '50',
16128 'square' => '',
16129 )
16130 </pre>
16131
16132 !! end
16133
16134 !! test
16135 Parser hook: argument containing a forward slash (bug 5344)
16136 !! wikitext
16137 <tag filename='/tmp/bla'></tag>
16138 !! html/php
16139 <pre>
16140 ''
16141 array (
16142 'filename' => '/tmp/bla',
16143 )
16144 </pre>
16145
16146 !! end
16147
16148 !! test
16149 Parser hook: empty input using terminated empty elements (bug 2374)
16150 !! wikitext
16151 <tag foo=bar/>text
16152 !! html/php
16153 <pre>
16154 NULL
16155 array (
16156 'foo' => 'bar',
16157 )
16158 </pre>text
16159
16160 !! end
16161
16162 # </tag> should be output literally since there is no matching tag that begins it
16163 !! test
16164 Parser hook: basic arguments using terminated empty elements (bug 2374)
16165 !! wikitext
16166 <tag width=200 height = "100" depth = '50' square/>
16167 other stuff
16168 </tag>
16169 !! html/php
16170 <pre>
16171 NULL
16172 array (
16173 'width' => '200',
16174 'height' => '100',
16175 'depth' => '50',
16176 'square' => '',
16177 )
16178 </pre>
16179 <p>other stuff
16180 &lt;/tag&gt;
16181 </p>
16182 !! end
16183
16184 ###
16185 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16186 ###
16187
16188 !! test
16189 Parser hook: static parser hook not inside a comment
16190 !! wikitext
16191 <statictag>hello, world</statictag>
16192 <statictag action=flush/>
16193 !! html/php
16194 <p>hello, world
16195 </p>
16196 !! end
16197
16198
16199 !! test
16200 Parser hook: static parser hook inside a comment
16201 !! wikitext
16202 <!-- <statictag>hello, world</statictag> -->
16203 <statictag action=flush/>
16204 !! html/php
16205 <p><br />
16206 </p>
16207 !! end
16208
16209 # Nested template calls; this case was broken by Parser.php rev 1.506,
16210 # since reverted.
16211
16212 !! article
16213 Template:One-parameter
16214 !! text
16215 (My parameter is: {{{1}}})
16216 !! endarticle
16217
16218 !! article
16219 Template:Map-one-parameter
16220 !! text
16221 {{{{{1}}}|{{{2}}}}}
16222 !! endarticle
16223
16224 !! test
16225 Nested template calls
16226 !! wikitext
16227 {{Map-one-parameter|One-parameter|param}}
16228 !! html
16229 <p>(My parameter is: param)
16230 </p>
16231 !! end
16232
16233
16234 ###
16235 ### Sanitizer
16236 ###
16237
16238 # HTML+Tidy effectively strips out the empty tags completely
16239 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16240 # which Tidy would have done for the PHP parser had there been content inside it.
16241 !! test
16242 Sanitizer: Closing of open tags
16243 !! wikitext
16244 <s></s><table></table>
16245 !! html
16246 <s></s><table></table>
16247
16248 !! html/parsoid
16249 <p><s></s></p><table></table>
16250 !! end
16251
16252 !! test
16253 Sanitizer: Closing of open but not closed tags
16254 !! wikitext
16255 <s>foo
16256 !! html
16257 <p><s>foo</s>
16258 </p>
16259 !! end
16260
16261 !! test
16262 Sanitizer: Closing of closed but not open tags
16263 !! options
16264 parsoid=wt2html
16265 !! wikitext
16266 </s>
16267 !! html/php+tidy
16268 !! html/parsoid
16269 !! end
16270
16271 !! test
16272 Sanitizer: Closing of closed but not open table tags
16273 !! options
16274 parsoid=wt2html
16275 !! wikitext
16276 Table not started</td></tr></table>
16277 !! html/php+tidy
16278 <p>Table not started</p>
16279 !! html/parsoid
16280 <p>Table not started</p>
16281 !! end
16282
16283 !! test
16284 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16285 !! wikitext
16286 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16287 !! html
16288 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16289 </p>
16290 !! end
16291
16292 # In HTML5, the restrictions are that id must contain at least one character,
16293 # and must not contain any space characters.
16294 !! test
16295 Sanitizer: Validating the contents of the id attribute (bug 4515)
16296 !! options
16297 disabled
16298 !! wikitext
16299 <br id="" /><br id="a space" />
16300 !! html
16301 Something ...
16302 !! end
16303
16304 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16305 !! test
16306 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16307 !! options
16308 disabled
16309 !! wikitext
16310 <br id="foo" /><br id="foo" />
16311 !! html
16312 Something need to be done. foo-2 ?
16313 !! end
16314
16315 !! test
16316 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16317 !! wikitext
16318 <div itemscope>
16319 <meta itemprop="hello" content="world">
16320 <meta http-equiv="refresh" content="5">
16321 <meta itemprop="hello" http-equiv="refresh" content="5">
16322 <link itemprop="hello" href="{{SERVER}}">
16323 <link rel="stylesheet" href="{{SERVER}}">
16324 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16325 </div>
16326 !! html
16327 <div itemscope="">
16328 <p> <meta itemprop="hello" content="world" />
16329 &lt;meta http-equiv="refresh" content="5"&gt;
16330 <meta itemprop="hello" content="5" />
16331 </p>
16332 <link itemprop="hello" href="http&#58;//example.org" />
16333 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16334 <link itemprop="hello" href="http&#58;//example.org" />
16335 </div>
16336
16337 !! end
16338
16339 !! test
16340 Language converter: output gets cut off unexpectedly (bug 5757)
16341 !! options
16342 language=zh
16343 !! wikitext
16344 this bit is safe: }-
16345
16346 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16347
16348 then we get cut off here: }-
16349
16350 all additional text is vanished
16351 !! html
16352 <p>this bit is safe: }-
16353 </p><p>but if we add a conversion instance: xxx
16354 </p><p>then we get cut off here: }-
16355 </p><p>all additional text is vanished
16356 </p>
16357 !! end
16358
16359 !! test
16360 Self closed html pairs (bug 5487)
16361 !! options
16362 !! wikitext
16363 <center><font id="bug" />Centered text</center>
16364 <div><font id="bug2" />In div text</div>
16365 !! html
16366 <center>&lt;font id="bug" /&gt;Centered text</center>
16367 <div>&lt;font id="bug2" /&gt;In div text</div>
16368
16369 !! end
16370
16371 #
16372 #
16373 #
16374
16375 !! test
16376 Punctuation: nbsp before exclamation
16377 !! wikitext
16378 C'est grave !
16379 !! html
16380 <p>C'est grave&#160;!
16381 </p>
16382 !! end
16383
16384 !! test
16385 Punctuation: CSS !important (bug 11874)
16386 !! wikitext
16387 <div style="width:50% !important">important</div>
16388 !! html
16389 <div style="width:50% !important">important</div>
16390
16391 !!end
16392
16393 !! test
16394 Punctuation: CSS ! important (bug 11874; with space after)
16395 !! wikitext
16396 <div style="width:50% ! important">important</div>
16397 !! html
16398 <div style="width:50% ! important">important</div>
16399
16400 !!end
16401
16402 !! test
16403 HTML bullet list, closed tags (bug 5497)
16404 !! wikitext
16405 <ul>
16406 <li>One</li>
16407 <li>Two</li>
16408 </ul>
16409 !! html/php
16410 <ul>
16411 <li>One</li>
16412 <li>Two</li>
16413 </ul>
16414
16415 !! html/parsoid
16416 <ul data-parsoid='{"stx":"html"}'>
16417 <li data-parsoid='{"stx":"html"}'>One</li>
16418 <li data-parsoid='{"stx":"html"}'>Two</li>
16419 </ul>
16420
16421 !! end
16422
16423 !! test
16424 HTML bullet list, unclosed tags (bug 5497)
16425 !! wikitext
16426 <ul>
16427 <li>One
16428 <li>Two
16429 </ul>
16430 !! html/php+tidy
16431 <ul>
16432 <li>One</li>
16433 <li>Two</li>
16434 </ul>
16435 !! html/parsoid
16436 <ul data-parsoid='{"stx":"html"}'>
16437 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16438 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16439 </ul>
16440
16441 !! end
16442
16443 !! test
16444 HTML ordered list, closed tags (bug 5497)
16445 !! wikitext
16446 <ol>
16447 <li>One</li>
16448 <li>Two</li>
16449 </ol>
16450 !! html/php
16451 <ol>
16452 <li>One</li>
16453 <li>Two</li>
16454 </ol>
16455
16456 !! html/parsoid
16457 <ol data-parsoid='{"stx":"html"}'>
16458 <li data-parsoid='{"stx":"html"}'>One</li>
16459 <li data-parsoid='{"stx":"html"}'>Two</li>
16460 </ol>
16461
16462 !! end
16463
16464 !! test
16465 HTML ordered list, unclosed tags (bug 5497)
16466 !! options
16467 !! wikitext
16468 <ol>
16469 <li>One
16470 <li>Two
16471 </ol>
16472 !! html/php+tidy
16473 <ol>
16474 <li>One</li>
16475 <li>Two</li>
16476 </ol>
16477 !! html/parsoid
16478 <ol data-parsoid='{"stx":"html"}'>
16479 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16480 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16481 </ol>
16482
16483 !! end
16484
16485 !! test
16486 HTML nested bullet list, closed tags (bug 5497)
16487 !! wikitext
16488 <ul>
16489 <li>One</li>
16490 <li>Two:
16491 <ul>
16492 <li>Sub-one</li>
16493 <li>Sub-two</li>
16494 </ul>
16495 </li>
16496 </ul>
16497 !! html
16498 <ul>
16499 <li>One</li>
16500 <li>Two:
16501 <ul>
16502 <li>Sub-one</li>
16503 <li>Sub-two</li>
16504 </ul>
16505 </li>
16506 </ul>
16507
16508 !! end
16509
16510 !! test
16511 HTML nested bullet list, open tags (bug 5497)
16512 !! wikitext
16513 <ul>
16514 <li>One
16515 <li>Two:
16516 <ul>
16517 <li>Sub-one
16518 <li>Sub-two
16519 </ul>
16520 </ul>
16521 !! html/php+tidy
16522 <ul>
16523 <li>One</li>
16524 <li>Two:
16525 <ul>
16526 <li>Sub-one</li>
16527 <li>Sub-two</li>
16528 </ul>
16529 </li>
16530 </ul>
16531 !! html/parsoid
16532 <ul>
16533 <li>One
16534 </li>
16535 <li>Two:
16536 <ul>
16537 <li>Sub-one
16538 </li>
16539 <li>Sub-two
16540 </li>
16541 </ul>
16542 </li>
16543 </ul>
16544
16545 !! end
16546
16547 !! test
16548 HTML nested ordered list, closed tags (bug 5497)
16549 !! wikitext
16550 <ol>
16551 <li>One</li>
16552 <li>Two:
16553 <ol>
16554 <li>Sub-one</li>
16555 <li>Sub-two</li>
16556 </ol>
16557 </li>
16558 </ol>
16559 !! html
16560 <ol>
16561 <li>One</li>
16562 <li>Two:
16563 <ol>
16564 <li>Sub-one</li>
16565 <li>Sub-two</li>
16566 </ol>
16567 </li>
16568 </ol>
16569
16570 !! end
16571
16572 !! test
16573 HTML nested ordered list, open tags (bug 5497)
16574 !! wikitext
16575 <ol>
16576 <li>One
16577 <li>Two:
16578 <ol>
16579 <li>Sub-one
16580 <li>Sub-two
16581 </ol>
16582 </ol>
16583 !! html/php
16584 <ol>
16585 <li>One
16586 <li>Two:
16587 <ol>
16588 <li>Sub-one
16589 <li>Sub-two
16590 </ol>
16591 </ol>
16592
16593 !! html/parsoid
16594 <ol>
16595 <li>One
16596 </li>
16597 <li>Two:
16598 <ol>
16599 <li>Sub-one
16600 </li>
16601 <li>Sub-two
16602 </li>
16603 </ol>
16604 </li>
16605 </ol>
16606
16607 !! end
16608
16609 !! test
16610 HTML ordered list item with parameters oddity
16611 !! wikitext
16612 <ol><li id="fragment">One</li>
16613 </ol>
16614 !! html
16615 <ol><li id="fragment">One</li>
16616 </ol>
16617
16618 !! end
16619
16620 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16621 !!test
16622 bug 5918: autonumbering
16623 !! wikitext
16624 [http://first/] [http://second] [ftp://ftp]
16625
16626 ftp://inlineftp
16627
16628 [mailto:enclosed@mail.tld With target]
16629
16630 [mailto:enclosed@mail.tld]
16631
16632 mailto:inline@mail.tld
16633 !! html/php
16634 <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>
16635 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16636 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16637 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16638 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16639 </p>
16640 !! html/parsoid
16641 <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>
16642 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16643 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16644 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16645 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16646 !! end
16647
16648
16649 #
16650 # Security and HTML correctness
16651 # From Nick Jenkins' fuzz testing
16652 #
16653
16654 !! test
16655 Fuzz testing: Parser13
16656 !! wikitext
16657 {|
16658 | http://a|
16659 !! html
16660 <table>
16661 <tr>
16662 <td>
16663 </td>
16664 </tr>
16665 </table>
16666
16667 !! end
16668
16669 !! test
16670 Fuzz testing: Parser14
16671 !! wikitext
16672 == onmouseover= ==
16673 http://__TOC__
16674 !! html
16675 <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>
16676 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16677 <ul>
16678 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16679 </ul>
16680 </div>
16681
16682
16683 !! html+tidy
16684 <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>
16685 <p>http://</p>
16686 <div id="toc" class="toc">
16687 <div id="toctitle">
16688 <h2>Contents</h2>
16689 </div>
16690 <ul>
16691 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16692 </ul>
16693 </div>
16694 <p></p>
16695 !! end
16696
16697 !! test
16698 Fuzz testing: Parser14-table
16699 !! wikitext
16700 ==a==
16701 {| STYLE=__TOC__
16702 !! html
16703 <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>
16704 <table style="&#95;_TOC&#95;_">
16705 <tr><td></td></tr>
16706 </table>
16707
16708 !! html+tidy
16709 <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>
16710 <table style="__TOC__">
16711 <tr>
16712 <td></td>
16713 </tr>
16714 </table>
16715 !! end
16716
16717 # Known to produce bogus xml (extra </td>)
16718 !! test
16719 Fuzz testing: Parser16
16720 !! options
16721 noxml
16722 !! wikitext
16723 {|
16724 !https://||||||
16725 !! html
16726 <table>
16727 <tr>
16728 <th>https://</th>
16729 <th></th>
16730 <th></th>
16731 <th>
16732 </td>
16733 </tr>
16734 </table>
16735
16736 !! html+tidy
16737 <table>
16738 <tr>
16739 <th>https://</th>
16740 <th></th>
16741 <th></th>
16742 <th></th>
16743 </tr>
16744 </table>
16745 !! end
16746
16747 !! test
16748 Fuzz testing: Parser21
16749 !! wikitext
16750 {|
16751 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16752 |
16753 !! html
16754 <table>
16755 <tr>
16756 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16757 </th>
16758 <td>
16759 </td>
16760 </tr>
16761 </table>
16762
16763 !! end
16764
16765 !! test
16766 Fuzz testing: Parser22
16767 !! wikitext
16768 http://===r:::https://b
16769
16770 {|
16771 !! html
16772 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16773 </p>
16774 <table>
16775 <tr><td></td></tr>
16776 </table>
16777
16778 !! end
16779
16780 # Known to produce bad XML for now
16781 !! test
16782 Fuzz testing: Parser24
16783 !! options
16784 noxml
16785 !! wikitext
16786 {|
16787 {{{|
16788 <u CLASS=
16789 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16790 <br style="onmouseover='alert(document.cookie);' " />
16791
16792 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16793 |
16794 !! html
16795 <table>
16796 {{{|
16797 <u class="&#124;">}}}} &gt;
16798 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16799
16800 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16801 <tr>
16802 <td></u>
16803 </td>
16804 </tr>
16805 </table>
16806
16807 !! end
16808
16809 # Note: the current result listed for this is not what the original one was,
16810 # but the original bug was JavaScript injection, which is fixed in any case.
16811 # It's not clear that the original result listed was any more correct than the
16812 # current one. Original result:
16813 # <p>{{{|
16814 # </p>
16815 # <li class="&#124;&#124;">
16816 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16817 !!test
16818 Fuzz testing: Parser25 (bug 6055)
16819 !! wikitext
16820 {{{
16821 |
16822 <LI CLASS=||
16823 >
16824 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16825 !! html
16826 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16827 </p>
16828 !! end
16829
16830 !!test
16831 Fuzz testing: URL adjacent extension (with space, clean)
16832 !! wikitext
16833 http://example.com <nowiki>junk</nowiki>
16834 !! html/php
16835 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16836 </p>
16837 !! html/parsoid
16838 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16839 !! end
16840
16841 !!test
16842 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16843 !! wikitext
16844 http://example.com<nowiki>junk</nowiki>
16845 !! html/php
16846 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16847 </p>
16848 !! html/parsoid
16849 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16850 !! end
16851
16852 !!test
16853 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16854 !! wikitext
16855 http://example.com<pre>junk</pre>
16856 !! html/php
16857 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16858
16859 !! html/php+tidy
16860 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16861 <pre>
16862 junk
16863 </pre>
16864 !! html/parsoid
16865 <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>
16866 !!end
16867
16868 !!test
16869 Fuzz testing: image with bogus manual thumbnail
16870 !! wikitext
16871 [[Image:foobar.jpg|thumbnail= ]]
16872 !! html/php
16873 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16874
16875 !! html/parsoid
16876 <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>
16877 !!end
16878
16879 !! test
16880 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16881 !! wikitext
16882 <pre dir="&#10;"></pre>
16883 !! html
16884 <pre dir="&#10;"></pre>
16885
16886 !! end
16887
16888 !! test
16889 Parsing optional HTML elements (Bug 6171)
16890 !! options
16891 !! wikitext
16892 <table>
16893 <tr>
16894 <td> Some tabular data</td>
16895 <td> More tabular data ...
16896 <td> And yet som tabular data</td>
16897 </tr>
16898 </table>
16899 !! html
16900 <table>
16901 <tr>
16902 <td> Some tabular data</td>
16903 <td> More tabular data ...
16904 </td><td> And yet som tabular data</td>
16905 </tr>
16906 </table>
16907
16908 !! end
16909
16910 !! test
16911 Correct handling of <td>, <tr> (Bug 6171)
16912 !! options
16913 !! wikitext
16914 <table>
16915 <tr>
16916 <td> Some tabular data</td>
16917 <td> More tabular data ...</td>
16918 <td> And yet som tabular data</td>
16919 </tr>
16920 </table>
16921 !! html
16922 <table>
16923 <tr>
16924 <td> Some tabular data</td>
16925 <td> More tabular data ...</td>
16926 <td> And yet som tabular data</td>
16927 </tr>
16928 </table>
16929
16930 !! end
16931
16932
16933 !! test
16934 Parsing crashing regression (fr:JavaScript)
16935 !! wikitext
16936 </body></x>
16937 !! html
16938 <p>&lt;/body&gt;&lt;/x&gt;
16939 </p>
16940 !! end
16941
16942 !! test
16943 Inline wiki vs wiki block nesting
16944 !! wikitext
16945 '''Bold paragraph
16946
16947 New wiki paragraph
16948 !! html
16949 <p><b>Bold paragraph</b>
16950 </p><p>New wiki paragraph
16951 </p>
16952 !! end
16953
16954 # FIXME: The current php output is documented
16955 # and desired output is the parsoid target.
16956 !! test
16957 Inline HTML vs wiki block nesting
16958 !! wikitext
16959 <b>Bold paragraph
16960
16961 New wiki paragraph
16962 !! html/php
16963 <p><b>Bold paragraph
16964 </p><p>New wiki paragraph</b>
16965 </p>
16966 !! html/parsoid
16967 <p><b>Bold paragraph</b>
16968 </p><p>New wiki paragraph
16969 </p>
16970 !! end
16971
16972 # Original result was this:
16973 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16974 # </p>
16975 # While that might be marginally more intuitive, maybe, the six-apostrophe
16976 # construct is clearly pathological and the result stated here (which is what
16977 # the parser actually does) is about as reasonable as anything.
16978 !!test
16979 Mixing markup for italics and bold
16980 !! options
16981 !! wikitext
16982 '''bold''''''bold''bolditalics'''''
16983 !! html
16984 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16985 </p>
16986 !! end
16987
16988
16989 !! article
16990 Xyzzyx
16991 !! text
16992 Article for special page transclusion test
16993 !! endarticle
16994
16995 !! test
16996 Special page transclusion
16997 !! options
16998 !! wikitext
16999 {{Special:Prefixindex/Xyzzyx}}
17000 !! html
17001 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17002
17003 !! end
17004
17005 !! test
17006 Special page transclusion twice (bug 5021)
17007 !! options
17008 !! wikitext
17009 {{Special:Prefixindex/Xyzzyx}}
17010 {{Special:Prefixindex/Xyzzyx}}
17011 !! html
17012 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17013 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17014
17015 !! end
17016
17017 !! test
17018 Transclusion of default MediaWiki message
17019 !! wikitext
17020 {{MediaWiki:Mainpage}}
17021 !! html
17022 <p>Main Page
17023 </p>
17024 !! end
17025
17026 !! test
17027 Transclusion of nonexistent MediaWiki message
17028 !! wikitext
17029 {{MediaWiki:Mainpagexxx}}
17030 !! html
17031 <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>
17032 </p>
17033 !! end
17034
17035 !! test
17036 Transclusion of MediaWiki message with underscore
17037 !! wikitext
17038 {{MediaWiki:history_short}}
17039 !! html
17040 <p>History
17041 </p>
17042 !! end
17043
17044 !! test
17045 Transclusion of MediaWiki message with space
17046 !! wikitext
17047 {{MediaWiki:history short}}
17048 !! html
17049 <p>History
17050 </p>
17051 !! end
17052
17053 !! test
17054 Invalid header with following text
17055 !! wikitext
17056 = x = y
17057 !! html
17058 <p>= x = y
17059 </p>
17060 !! end
17061
17062
17063 !! test
17064 Section extraction test (section 0)
17065 !! options
17066 section=0
17067 !! wikitext
17068 start
17069 ==a==
17070 ===aa===
17071 ====aaa====
17072 ==b==
17073 ===ba===
17074 ===bb===
17075 ====bba====
17076 ===bc===
17077 ==c==
17078 ===ca===
17079 !! html/php
17080 start
17081 !! end
17082
17083 !! test
17084 Section extraction test (section 1)
17085 !! options
17086 section=1
17087 !! wikitext
17088 start
17089 ==a==
17090 ===aa===
17091 ====aaa====
17092 ==b==
17093 ===ba===
17094 ===bb===
17095 ====bba====
17096 ===bc===
17097 ==c==
17098 ===ca===
17099 !! html/php
17100 ==a==
17101 ===aa===
17102 ====aaa====
17103 !! end
17104
17105 !! test
17106 Section extraction test (section 2)
17107 !! options
17108 section=2
17109 !! wikitext
17110 start
17111 ==a==
17112 ===aa===
17113 ====aaa====
17114 ==b==
17115 ===ba===
17116 ===bb===
17117 ====bba====
17118 ===bc===
17119 ==c==
17120 ===ca===
17121 !! html/php
17122 ===aa===
17123 ====aaa====
17124 !! end
17125
17126 !! test
17127 Section extraction test (section 3)
17128 !! options
17129 section=3
17130 !! wikitext
17131 start
17132 ==a==
17133 ===aa===
17134 ====aaa====
17135 ==b==
17136 ===ba===
17137 ===bb===
17138 ====bba====
17139 ===bc===
17140 ==c==
17141 ===ca===
17142 !! html/php
17143 ====aaa====
17144 !! end
17145
17146 !! test
17147 Section extraction test (section 4)
17148 !! options
17149 section=4
17150 !! wikitext
17151 start
17152 ==a==
17153 ===aa===
17154 ====aaa====
17155 ==b==
17156 ===ba===
17157 ===bb===
17158 ====bba====
17159 ===bc===
17160 ==c==
17161 ===ca===
17162 !! html/php
17163 ==b==
17164 ===ba===
17165 ===bb===
17166 ====bba====
17167 ===bc===
17168 !! end
17169
17170 !! test
17171 Section extraction test (section 5)
17172 !! options
17173 section=5
17174 !! wikitext
17175 start
17176 ==a==
17177 ===aa===
17178 ====aaa====
17179 ==b==
17180 ===ba===
17181 ===bb===
17182 ====bba====
17183 ===bc===
17184 ==c==
17185 ===ca===
17186 !! html/php
17187 ===ba===
17188 !! end
17189
17190 !! test
17191 Section extraction test (section 6)
17192 !! options
17193 section=6
17194 !! wikitext
17195 start
17196 ==a==
17197 ===aa===
17198 ====aaa====
17199 ==b==
17200 ===ba===
17201 ===bb===
17202 ====bba====
17203 ===bc===
17204 ==c==
17205 ===ca===
17206 !! html/php
17207 ===bb===
17208 ====bba====
17209 !! end
17210
17211 !! test
17212 Section extraction test (section 7)
17213 !! options
17214 section=7
17215 !! wikitext
17216 start
17217 ==a==
17218 ===aa===
17219 ====aaa====
17220 ==b==
17221 ===ba===
17222 ===bb===
17223 ====bba====
17224 ===bc===
17225 ==c==
17226 ===ca===
17227 !! html/php
17228 ====bba====
17229 !! end
17230
17231 !! test
17232 Section extraction test (section 8)
17233 !! options
17234 section=8
17235 !! wikitext
17236 start
17237 ==a==
17238 ===aa===
17239 ====aaa====
17240 ==b==
17241 ===ba===
17242 ===bb===
17243 ====bba====
17244 ===bc===
17245 ==c==
17246 ===ca===
17247 !! html/php
17248 ===bc===
17249 !! end
17250
17251 !! test
17252 Section extraction test (section 9)
17253 !! options
17254 section=9
17255 !! wikitext
17256 start
17257 ==a==
17258 ===aa===
17259 ====aaa====
17260 ==b==
17261 ===ba===
17262 ===bb===
17263 ====bba====
17264 ===bc===
17265 ==c==
17266 ===ca===
17267 !! html/php
17268 ==c==
17269 ===ca===
17270 !! end
17271
17272 !! test
17273 Section extraction test (section 10)
17274 !! options
17275 section=10
17276 !! wikitext
17277 start
17278 ==a==
17279 ===aa===
17280 ====aaa====
17281 ==b==
17282 ===ba===
17283 ===bb===
17284 ====bba====
17285 ===bc===
17286 ==c==
17287 ===ca===
17288 !! html/php
17289 ===ca===
17290 !! end
17291
17292 !! test
17293 Section extraction test (nonexistent section 11)
17294 !! options
17295 section=11
17296 !! wikitext
17297 start
17298 ==a==
17299 ===aa===
17300 ====aaa====
17301 ==b==
17302 ===ba===
17303 ===bb===
17304 ====bba====
17305 ===bc===
17306 ==c==
17307 ===ca===
17308 !! html/php
17309 !! end
17310
17311 !! test
17312 Section extraction test with bogus heading (section 1)
17313 !! options
17314 section=1
17315 !! wikitext
17316 ==a==
17317 ==bogus== not a legal section
17318 ==b==
17319 !! html/php
17320 ==a==
17321 ==bogus== not a legal section
17322 !! end
17323
17324 !! test
17325 Section extraction test with bogus heading (section 2)
17326 !! options
17327 section=2
17328 !! wikitext
17329 ==a==
17330 ==bogus== not a legal section
17331 ==b==
17332 !! html/php
17333 ==b==
17334 !! end
17335
17336 !! test
17337 Section extraction test with comment after heading (section 1)
17338 !! options
17339 section=1
17340 !! wikitext
17341 ==a==
17342 ==b== <!-- -->
17343 ==c==
17344 !! html/php
17345 ==a==
17346 !! end
17347
17348 !! test
17349 Section extraction test with comment after heading (section 2)
17350 !! options
17351 section=2
17352 !! wikitext
17353 ==a==
17354 ==b== <!-- -->
17355 ==c==
17356 !! html/php
17357 ==b== <!-- -->
17358 !! end
17359
17360 !! test
17361 Section extraction test with bogus <nowiki> heading (section 1)
17362 !! options
17363 section=1
17364 !! wikitext
17365 ==a==
17366 ==bogus== <nowiki>not a legal section</nowiki>
17367 ==b==
17368 !! html/php
17369 ==a==
17370 ==bogus== <nowiki>not a legal section</nowiki>
17371 !! end
17372
17373 !! test
17374 Section extraction test with bogus <nowiki> heading (section 2)
17375 !! options
17376 section=2
17377 !! wikitext
17378 ==a==
17379 ==bogus== <nowiki>not a legal section</nowiki>
17380 ==b==
17381 !! html/php
17382 ==b==
17383 !! end
17384
17385 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17386 # instead of respecting commented sections
17387 !! test
17388 Section extraction prefixed by comment (section 1)
17389 !! options
17390 section=1
17391 !! wikitext
17392 <!-- -->==sec1==
17393 ==sec2==
17394 !! html/php
17395 ==sec2==
17396 !!end
17397
17398 !! test
17399 Section extraction prefixed by comment (section 2)
17400 !! options
17401 section=2
17402 !! wikitext
17403 <!-- -->==sec1==
17404 ==sec2==
17405 !! html/php
17406
17407 !!end
17408
17409 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17410 # instead of respecting HTML-style headings
17411 !! test
17412 Section extraction, mixed wiki and html (section 1)
17413 !! options
17414 section=1
17415 !! wikitext
17416 <h2>unmarked</h2>
17417 unmarked
17418 ==1==
17419 one
17420 ==2==
17421 two
17422 !! html/php
17423 ==1==
17424 one
17425 !! end
17426
17427 !! test
17428 Section extraction, mixed wiki and html (section 2)
17429 !! options
17430 section=2
17431 !! wikitext
17432 <h2>unmarked</h2>
17433 unmarked
17434 ==1==
17435 one
17436 ==2==
17437 two
17438 !! html/php
17439 ==2==
17440 two
17441 !! end
17442
17443
17444 # Formerly testing for bug 3342
17445 !! test
17446 Section extraction, heading surrounded by <noinclude>
17447 !! options
17448 section=1
17449 !! wikitext
17450 <noinclude>==unmarked==</noinclude>
17451 ==marked==
17452 !! html/php
17453 ==marked==
17454 !!end
17455
17456 # Test behavior of bug 19910
17457 !! test
17458 Sectiion with all-equals
17459 !! options
17460 section=2
17461 !! wikitext
17462 ===
17463 The line above must have a trailing space
17464 === <!--
17465 --> <!-- -->
17466 But just in case it doesn't...
17467 !! html/php
17468 === <!--
17469 --> <!-- -->
17470 But just in case it doesn't...
17471 !! end
17472
17473 !! test
17474 Section replacement test (section 0)
17475 !! options
17476 replace=0,"xxx"
17477 !! wikitext
17478 start
17479 ==a==
17480 ===aa===
17481 ====aaa====
17482 ==b==
17483 ===ba===
17484 ===bb===
17485 ====bba====
17486 ===bc===
17487 ==c==
17488 ===ca===
17489 !! html/php
17490 xxx
17491
17492 ==a==
17493 ===aa===
17494 ====aaa====
17495 ==b==
17496 ===ba===
17497 ===bb===
17498 ====bba====
17499 ===bc===
17500 ==c==
17501 ===ca===
17502 !! end
17503
17504 !! test
17505 Section replacement test (section 1)
17506 !! options
17507 replace=1,"xxx"
17508 !! wikitext
17509 start
17510 ==a==
17511 ===aa===
17512 ====aaa====
17513 ==b==
17514 ===ba===
17515 ===bb===
17516 ====bba====
17517 ===bc===
17518 ==c==
17519 ===ca===
17520 !! html/php
17521 start
17522 xxx
17523
17524 ==b==
17525 ===ba===
17526 ===bb===
17527 ====bba====
17528 ===bc===
17529 ==c==
17530 ===ca===
17531 !! end
17532
17533 !! test
17534 Section replacement test (section 2)
17535 !! options
17536 replace=2,"xxx"
17537 !! wikitext
17538 start
17539 ==a==
17540 ===aa===
17541 ====aaa====
17542 ==b==
17543 ===ba===
17544 ===bb===
17545 ====bba====
17546 ===bc===
17547 ==c==
17548 ===ca===
17549 !! html/php
17550 start
17551 ==a==
17552 xxx
17553
17554 ==b==
17555 ===ba===
17556 ===bb===
17557 ====bba====
17558 ===bc===
17559 ==c==
17560 ===ca===
17561 !! end
17562
17563 !! test
17564 Section replacement test (section 3)
17565 !! options
17566 replace=3,"xxx"
17567 !! wikitext
17568 start
17569 ==a==
17570 ===aa===
17571 ====aaa====
17572 ==b==
17573 ===ba===
17574 ===bb===
17575 ====bba====
17576 ===bc===
17577 ==c==
17578 ===ca===
17579 !! html/php
17580 start
17581 ==a==
17582 ===aa===
17583 xxx
17584
17585 ==b==
17586 ===ba===
17587 ===bb===
17588 ====bba====
17589 ===bc===
17590 ==c==
17591 ===ca===
17592 !! end
17593
17594 !! test
17595 Section replacement test (section 4)
17596 !! options
17597 replace=4,"xxx"
17598 !! wikitext
17599 start
17600 ==a==
17601 ===aa===
17602 ====aaa====
17603 ==b==
17604 ===ba===
17605 ===bb===
17606 ====bba====
17607 ===bc===
17608 ==c==
17609 ===ca===
17610 !! html/php
17611 start
17612 ==a==
17613 ===aa===
17614 ====aaa====
17615 xxx
17616
17617 ==c==
17618 ===ca===
17619 !! end
17620
17621 !! test
17622 Section replacement test (section 5)
17623 !! options
17624 replace=5,"xxx"
17625 !! wikitext
17626 start
17627 ==a==
17628 ===aa===
17629 ====aaa====
17630 ==b==
17631 ===ba===
17632 ===bb===
17633 ====bba====
17634 ===bc===
17635 ==c==
17636 ===ca===
17637 !! html/php
17638 start
17639 ==a==
17640 ===aa===
17641 ====aaa====
17642 ==b==
17643 xxx
17644
17645 ===bb===
17646 ====bba====
17647 ===bc===
17648 ==c==
17649 ===ca===
17650 !! end
17651
17652 !! test
17653 Section replacement test (section 6)
17654 !! options
17655 replace=6,"xxx"
17656 !! wikitext
17657 start
17658 ==a==
17659 ===aa===
17660 ====aaa====
17661 ==b==
17662 ===ba===
17663 ===bb===
17664 ====bba====
17665 ===bc===
17666 ==c==
17667 ===ca===
17668 !! html/php
17669 start
17670 ==a==
17671 ===aa===
17672 ====aaa====
17673 ==b==
17674 ===ba===
17675 xxx
17676
17677 ===bc===
17678 ==c==
17679 ===ca===
17680 !! end
17681
17682 !! test
17683 Section replacement test (section 7)
17684 !! options
17685 replace=7,"xxx"
17686 !! wikitext
17687 start
17688 ==a==
17689 ===aa===
17690 ====aaa====
17691 ==b==
17692 ===ba===
17693 ===bb===
17694 ====bba====
17695 ===bc===
17696 ==c==
17697 ===ca===
17698 !! html/php
17699 start
17700 ==a==
17701 ===aa===
17702 ====aaa====
17703 ==b==
17704 ===ba===
17705 ===bb===
17706 xxx
17707
17708 ===bc===
17709 ==c==
17710 ===ca===
17711 !! end
17712
17713 !! test
17714 Section replacement test (section 8)
17715 !! options
17716 replace=8,"xxx"
17717 !! wikitext
17718 start
17719 ==a==
17720 ===aa===
17721 ====aaa====
17722 ==b==
17723 ===ba===
17724 ===bb===
17725 ====bba====
17726 ===bc===
17727 ==c==
17728 ===ca===
17729 !! html/php
17730 start
17731 ==a==
17732 ===aa===
17733 ====aaa====
17734 ==b==
17735 ===ba===
17736 ===bb===
17737 ====bba====
17738 xxx
17739
17740 ==c==
17741 ===ca===
17742 !!end
17743
17744 !! test
17745 Section replacement test (section 9)
17746 !! options
17747 replace=9,"xxx"
17748 !! wikitext
17749 start
17750 ==a==
17751 ===aa===
17752 ====aaa====
17753 ==b==
17754 ===ba===
17755 ===bb===
17756 ====bba====
17757 ===bc===
17758 ==c==
17759 ===ca===
17760 !! html/php
17761 start
17762 ==a==
17763 ===aa===
17764 ====aaa====
17765 ==b==
17766 ===ba===
17767 ===bb===
17768 ====bba====
17769 ===bc===
17770 xxx
17771 !! end
17772
17773 !! test
17774 Section replacement test (section 10)
17775 !! options
17776 replace=10,"xxx"
17777 !! wikitext
17778 start
17779 ==a==
17780 ===aa===
17781 ====aaa====
17782 ==b==
17783 ===ba===
17784 ===bb===
17785 ====bba====
17786 ===bc===
17787 ==c==
17788 ===ca===
17789 !! html/php
17790 start
17791 ==a==
17792 ===aa===
17793 ====aaa====
17794 ==b==
17795 ===ba===
17796 ===bb===
17797 ====bba====
17798 ===bc===
17799 ==c==
17800 xxx
17801 !! end
17802
17803 !! test
17804 Section replacement test with initial whitespace (bug 13728)
17805 !! options
17806 replace=2,"xxx"
17807 !! wikitext
17808 Preformatted initial line
17809 ==a==
17810 ===a===
17811 !! html/php
17812 Preformatted initial line
17813 ==a==
17814 xxx
17815 !! end
17816
17817
17818 !! test
17819 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17820 !! options
17821 section=1
17822 !! wikitext
17823 ==a==
17824 a
17825 !! html/php
17826 ==a==
17827 a
17828 !! end
17829
17830 !! test
17831 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17832 !! options
17833 section=1
17834 !! wikitext
17835 ==a==
17836 a
17837 !! html/php
17838 ==a==
17839 a
17840 !! end
17841
17842
17843 !! test
17844 Section extraction, <pre> around bogus header (bug 10309)
17845 !! options
17846 noxml section=2
17847 !! wikitext
17848 == Section One ==
17849 <pre>
17850 =======
17851 </pre>
17852
17853 == Section Two ==
17854 stuff
17855 !! html/php
17856 == Section Two ==
17857 stuff
17858 !! end
17859
17860 !! test
17861 Section replacement, <pre> around bogus header (bug 10309)
17862 !! options
17863 noxml replace=2,"xxx"
17864 !! wikitext
17865 == Section One ==
17866 <pre>
17867 =======
17868 </pre>
17869
17870 == Section Two ==
17871 stuff
17872 !! html/php
17873 == Section One ==
17874 <pre>
17875 =======
17876 </pre>
17877
17878 xxx
17879 !! end
17880
17881
17882 !! test
17883 Handling of &#x0A; in URLs
17884 !! wikitext
17885 ** irc://&#x0A;a
17886 !! html/php
17887 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17888
17889 !! html/parsoid
17890 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17891 a">irc://
17892 a</a></li></ul></li></ul>
17893 !! end
17894
17895 !! test
17896 Handling of %0A in URLs
17897 !! wikitext
17898 ** irc://%0Aa
17899 !! html/php
17900 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17901
17902 !! html/parsoid
17903 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17904 !! end
17905
17906
17907 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17908 !! test
17909 5 quotes, code coverage +1 line
17910 !! options
17911 parsoid=wt2html
17912 !! wikitext
17913 '''''
17914 !! html/php
17915 !! html/parsoid
17916 <p><b><i></i></b></p>
17917 !! end
17918
17919 # same html as previous, but wikitext adjusted to match parsoid html2wt
17920 # note that wt2html and html2html will put the <i> before the <b>
17921 !! test
17922 5 quotes, code coverage +1 line w/ nowiki (1)
17923 !! options
17924 parsoid=wt2wt,html2wt
17925 !! wikitext
17926 '''''<nowiki/>'''''
17927 !! html/php
17928 <p><i></i>
17929 </p>
17930 !! html/parsoid
17931 <p><b><i></i></b></p>
17932 !! end
17933
17934 # same as previous, just swapping the <i> and <b>
17935 !! test
17936 5 quotes, code coverage +1 line w/ nowiki (2)
17937 !! wikitext
17938 '''''<nowiki/>'''''
17939 !! html/php
17940 <p><i></i>
17941 </p>
17942 !! html/parsoid
17943 <p><i><b></b></i></p>
17944 !! end
17945
17946 !! test
17947 Special:Search page linking.
17948 !! wikitext
17949 {{Special:search}}
17950 !! html
17951 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17952 </p>
17953 !! end
17954
17955 !! test
17956 {{!}} is a magic word
17957 !! wikitext
17958 {{!}} is a magic word there and {{!}} is still a magic word here
17959 !! html/php
17960 <p>| is a magic word there and | is still a magic word here
17961 </p>
17962 !! html/parsoid
17963 <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>
17964 !! end
17965
17966 !! test
17967 Say the magic word
17968 !! options
17969 title=[[Parser test]]
17970 !! wikitext
17971 * {{PAGENAME}}
17972 * {{PAGENAMEE}}
17973 * {{FULLPAGENAME}}
17974 * {{FULLPAGENAMEE}}
17975 * {{BASEPAGENAME}}
17976 * {{BASEPAGENAMEE}}
17977 * {{SUBPAGENAME}}
17978 * {{SUBPAGENAMEE}}
17979 * {{ROOTPAGENAME}}
17980 * {{ROOTPAGENAMEE}}
17981 * {{TALKPAGENAME}}
17982 * {{TALKPAGENAMEE}}
17983 * {{SUBJECTPAGENAME}}
17984 * {{SUBJECTPAGENAMEE}}
17985 * {{NAMESPACEE}}
17986 * {{NAMESPACE}}
17987 * {{NAMESPACENUMBER}}
17988 * {{TALKSPACE}}
17989 * {{TALKSPACEE}}
17990 * {{SUBJECTSPACE}}
17991 * {{SUBJECTSPACEE}}
17992 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17993 !! html
17994 <ul><li> Parser test</li>
17995 <li> Parser_test</li>
17996 <li> Parser test</li>
17997 <li> Parser_test</li>
17998 <li> Parser test</li>
17999 <li> Parser_test</li>
18000 <li> Parser test</li>
18001 <li> Parser_test</li>
18002 <li> Parser test</li>
18003 <li> Parser_test</li>
18004 <li> Talk:Parser test</li>
18005 <li> Talk:Parser_test</li>
18006 <li> Parser test</li>
18007 <li> Parser_test</li>
18008 <li> </li>
18009 <li> </li>
18010 <li> 0</li>
18011 <li> Talk</li>
18012 <li> Talk</li>
18013 <li> </li>
18014 <li> </li>
18015 <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>
18016
18017 !! end
18018 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18019
18020 !! test
18021 Gallery
18022 !! wikitext
18023 <gallery>
18024 image1.png |
18025 image2.gif|||||
18026
18027 image3|
18028 image4 |300px| centre
18029 image5.svg| http://///////
18030 [[x|xx]]]]
18031 * image6
18032 </gallery>
18033 !! html
18034 <ul class="gallery mw-gallery-traditional">
18035 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18036 <div class="thumb" style="height: 150px;">Image1.png</div>
18037 <div class="gallerytext">
18038 </div>
18039 </div></li>
18040 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18041 <div class="thumb" style="height: 150px;">Image2.gif</div>
18042 <div class="gallerytext">
18043 <p>||||
18044 </p>
18045 </div>
18046 </div></li>
18047 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18048 <div class="thumb" style="height: 150px;">Image3</div>
18049 <div class="gallerytext">
18050 </div>
18051 </div></li>
18052 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18053 <div class="thumb" style="height: 150px;">Image4</div>
18054 <div class="gallerytext">
18055 <p>300px| centre
18056 </p>
18057 </div>
18058 </div></li>
18059 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18060 <div class="thumb" style="height: 150px;">Image5.svg</div>
18061 <div class="gallerytext">
18062 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18063 </p>
18064 </div>
18065 </div></li>
18066 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18067 <div class="thumb" style="height: 150px;">* image6</div>
18068 <div class="gallerytext">
18069 </div>
18070 </div></li>
18071 </ul>
18072
18073 !! end
18074
18075 !! test
18076 Gallery (with options)
18077 !! wikitext
18078 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18079 File:Nonexistent.jpg|caption
18080 File:Nonexistent.jpg
18081 image:foobar.jpg|some '''caption''' [[Main Page]]
18082 image:foobar.jpg
18083 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18084 </gallery>
18085 !! html
18086 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18087 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18088 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18089 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18090 <div class="gallerytext">
18091 <p>caption
18092 </p>
18093 </div>
18094 </div></li>
18095 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18096 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18097 <div class="gallerytext">
18098 </div>
18099 </div></li>
18100 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18101 <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>
18102 <div class="gallerytext">
18103 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18104 </p>
18105 </div>
18106 </div></li>
18107 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18108 <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>
18109 <div class="gallerytext">
18110 </div>
18111 </div></li>
18112 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18113 <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>
18114 <div class="gallerytext">
18115 <p>Blabla|blabla.
18116 </p>
18117 </div>
18118 </div></li>
18119 </ul>
18120
18121 !! end
18122
18123 !! test
18124 Gallery with link that has fragment
18125 !! wikitext
18126 <gallery>
18127 image:foobar.jpg|link=Main_Page
18128 image:foobar.jpg|link=Main_Page#section
18129 image:foobar.jpg|link=Main Page#section|caption
18130 </gallery>
18131 !! html
18132 <ul class="gallery mw-gallery-traditional">
18133 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18134 <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>
18135 <div class="gallerytext">
18136 </div>
18137 </div></li>
18138 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18139 <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>
18140 <div class="gallerytext">
18141 </div>
18142 </div></li>
18143 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18144 <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>
18145 <div class="gallerytext">
18146 <p>caption
18147 </p>
18148 </div>
18149 </div></li>
18150 </ul>
18151
18152 !! end
18153
18154 !! test
18155 Gallery with wikitext inside caption
18156 !! wikitext
18157 <gallery>
18158 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18159 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18160 </gallery>
18161 !! html
18162 <ul class="gallery mw-gallery-traditional">
18163 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18164 <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>
18165 <div class="gallerytext">
18166 <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>
18167 </p>
18168 </div>
18169 </div></li>
18170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18171 <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>
18172 <div class="gallerytext">
18173 <p>This is a test template
18174 </p>
18175 </div>
18176 </div></li>
18177 </ul>
18178
18179 !! end
18180
18181 !! test
18182 gallery (with showfilename option)
18183 !! wikitext
18184 <gallery showfilename>
18185 File:Nonexistent.jpg|caption
18186 File:Nonexistent.jpg
18187 image:foobar.jpg|some '''caption''' [[Main Page]]
18188 File:Foobar.jpg
18189 </gallery>
18190 !! html
18191 <ul class="gallery mw-gallery-traditional">
18192 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18193 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18194 <div class="gallerytext">
18195 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18196 caption
18197 </p>
18198 </div>
18199 </div></li>
18200 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18201 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18202 <div class="gallerytext">
18203 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18204 </p>
18205 </div>
18206 </div></li>
18207 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18208 <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>
18209 <div class="gallerytext">
18210 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18211 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18212 </p>
18213 </div>
18214 </div></li>
18215 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18216 <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>
18217 <div class="gallerytext">
18218 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18219 </p>
18220 </div>
18221 </div></li>
18222 </ul>
18223
18224 !! end
18225
18226 !! test
18227 Gallery (with namespace-less filenames)
18228 !! wikitext
18229 <gallery>
18230 File:Nonexistent.jpg
18231 Nonexistent.jpg
18232 image:foobar.jpg
18233 foobar.jpg
18234 </gallery>
18235 !! html
18236 <ul class="gallery mw-gallery-traditional">
18237 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18238 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18239 <div class="gallerytext">
18240 </div>
18241 </div></li>
18242 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18243 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18244 <div class="gallerytext">
18245 </div>
18246 </div></li>
18247 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18248 <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>
18249 <div class="gallerytext">
18250 </div>
18251 </div></li>
18252 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18253 <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>
18254 <div class="gallerytext">
18255 </div>
18256 </div></li>
18257 </ul>
18258
18259 !! end
18260
18261 !! test
18262 HTML Hex character encoding (spells the word "JavaScript")
18263 !! options
18264 parsoid=wt2html,wt2wt,html2html
18265 !! wikitext
18266 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18267 !! html/php
18268 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18269 </p>
18270 !! html/php+tidy
18271 <p>JavaScript</p>
18272 !! html/parsoid
18273 <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>
18274 !! end
18275
18276 !! test
18277 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18278 !! wikitext
18279 &#xsee;&#XSEE;
18280 !! html/php
18281 <p>&amp;#xsee;&amp;#XSEE;
18282 </p>
18283 !! html/parsoid
18284 <p>&amp;#xsee;&amp;#XSEE;</p>
18285 !! end
18286
18287 !! test
18288 HTML Hex character encoding mixed case
18289 !! options
18290 parsoid=wt2html,wt2wt,html2html
18291 !! wikitext
18292 &#xEE;&#Xee;
18293 !! html/php
18294 <p>&#xee;&#xee;
18295 </p>
18296 !! html/php+tidy
18297 <p>îî</p>
18298 !! html/parsoid
18299 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18300 !! end
18301
18302 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18303 # Note that U+000C (form feed) is not a valid XML character, so
18304 # it is banned even though allowed in HTML5.
18305 !! test
18306 Illegal character references (T106578)
18307 !! wikitext
18308 ; Null: &#00;
18309 ; FF: &#xC;
18310 ; CR: &#xD;
18311 ; Control (low): &#8;
18312 ; Control (high): &#x7F; &#x9F;
18313 ; Surrogate: &#xD83D;&#xDCA9;
18314 ; This is an okay astral character: &#x1F4A9;
18315 !! html+tidy
18316 <dl>
18317 <dt>Null</dt>
18318 <dd>&amp;#00;</dd>
18319 <dt>FF</dt>
18320 <dd>&amp;#xC;</dd>
18321 <dt>CR</dt>
18322 <dd>&amp;#xD;</dd>
18323 <dt>Control (low)</dt>
18324 <dd>&amp;#8;</dd>
18325 <dt>Control (high)</dt>
18326 <dd>&amp;#x7F; &amp;#x9F;</dd>
18327 <dt>Surrogate</dt>
18328 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18329 <dt>This is an okay astral character</dt>
18330 <dd>💩</dd>
18331 </dl>
18332 !! end
18333
18334 !! test
18335 __FORCETOC__ override
18336 !! wikitext
18337 __NEWSECTIONLINK__
18338 __FORCETOC__
18339 !! html/php
18340 <p><br />
18341 </p>
18342 !! end
18343
18344 !! test
18345 ISBN code coverage
18346 !! wikitext
18347 ISBN 978-0-1234-56&#x20;789
18348 !! html
18349 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18350 </p>
18351 !! html+tidy
18352 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18353 !! html/parsoid
18354 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18355 !! end
18356
18357 !! test
18358 ISBN followed by 5 spaces
18359 !! wikitext
18360 ISBN
18361 !! html
18362 <p>ISBN
18363 </p>
18364 !! end
18365
18366 !! test
18367 Double ISBN
18368 !! wikitext
18369 ISBN ISBN 1234567890
18370 !! html/php
18371 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18372 </p>
18373 !! html/parsoid
18374 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18375 !! end
18376
18377 # Uppercase X and lowercase x as well
18378 !! test
18379 ISBN with an X
18380 !! wikitext
18381 ISBN 3-462-04561-X
18382 ISBN 3-462-04561-x
18383 ISBN 080442957X
18384 ISBN 080442957x
18385 ISBN 978080442957X
18386 ISBN 978080442957x
18387 !! html/php
18388 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18389 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18390 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18391 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18392 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18393 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18394 </p>
18395 !! html/parsoid
18396 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18397 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18398 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18399 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18400 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18401 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18402 !! end
18403
18404 !! test
18405 ISBN with empty prefix (parsoid test)
18406 !! wikitext
18407 ISBN 1234567890
18408 !! html/php
18409 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18410 </p>
18411 !! html/parsoid
18412 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18413 !! end
18414
18415 !! test
18416 Bug 22905: <abbr> followed by ISBN followed by </a>
18417 !! wikitext
18418 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18419 !! html/php
18420 <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>
18421 </p>
18422 !! html/parsoid
18423 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18424 !! end
18425
18426 !! test
18427 Double RFC
18428 !! wikitext
18429 RFC RFC 1234
18430 !! html
18431 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18432 </p>
18433 !! end
18434
18435 !! test
18436 Double RFC with a wiki link
18437 !! wikitext
18438 RFC [[RFC 1234]]
18439 !! html
18440 <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>
18441 </p>
18442 !! end
18443
18444 !! test
18445 RFC code coverage
18446 !! wikitext
18447 RFC 983&#x20;987
18448 !! html
18449 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18450 </p>
18451 !! html+tidy
18452 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18453 !! end
18454
18455 !! test
18456 Centre-aligned image
18457 !! wikitext
18458 [[Image:foobar.jpg|centre]]
18459 !! html
18460 <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>
18461
18462 !!end
18463
18464 !! test
18465 None-aligned image
18466 !! wikitext
18467 [[Image:foobar.jpg|none]]
18468 !! html
18469 <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>
18470
18471 !!end
18472
18473 !! test
18474 Width + Height sized image (using px) (height is ignored)
18475 !! wikitext
18476 [[Image:foobar.jpg|640x480px]]
18477 !! html
18478 <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>
18479 </p>
18480 !!end
18481
18482 !! test
18483 Width-sized image (using px, no following whitespace)
18484 !! wikitext
18485 [[Image:foobar.jpg|640px]]
18486 !! html
18487 <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>
18488 </p>
18489 !!end
18490
18491 !! test
18492 Width-sized image (using px, with following whitespace - test regression from r39467)
18493 !! wikitext
18494 [[Image:foobar.jpg|640px ]]
18495 !! html
18496 <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>
18497 </p>
18498 !!end
18499
18500 !! test
18501 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18502 !! wikitext
18503 [[Image:foobar.jpg| 640px]]
18504 !! html
18505 <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>
18506 </p>
18507 !!end
18508
18509 !! test
18510 Image with page parameter
18511 !! options
18512 djvu
18513 !! wikitext
18514 [[File:LoremIpsum.djvu|page=2]]
18515 !! html/php
18516 <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>
18517 </p>
18518 !! html/parsoid
18519 <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>
18520 !! end
18521
18522 !! test
18523 Another italics / bold test
18524 !! wikitext
18525 ''' ''x'
18526 !! html
18527 <pre>'<i> </i>x'
18528 </pre>
18529 !!end
18530
18531 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18532 !! test
18533 dt/dd/dl test
18534 !! wikitext
18535 :;;;::
18536 !! html/php
18537 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18538
18539 !! html/parsoid
18540 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18541
18542 !!end
18543
18544
18545 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18546 !! test
18547 Images with the "|" character in the comment
18548 !! wikitext
18549 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18550 !! html/php
18551 <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>
18552
18553 !! html/parsoid
18554 <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>
18555 !! end
18556
18557 !! test
18558 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18559 !! wikitext
18560 <html><script>alert(1);</script></html>
18561 !! html
18562 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18563 </p>
18564 !! end
18565
18566 !! test
18567 HTML with raw HTML ($wgRawHtml==true)
18568 !! options
18569 wgRawHtml=1
18570 !! wikitext
18571 <html><script>alert(1);</script></html>
18572 !! html
18573 <p><script>alert(1);</script>
18574 </p>
18575 !! end
18576
18577 !! test
18578 Parents of subpages, one level up
18579 !! options
18580 subpage title=[[Subpage test/L1/L2/L3]]
18581 !! wikitext
18582 [[../|L2]]
18583 !! html
18584 <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>
18585 </p>
18586 !! end
18587
18588
18589 !! test
18590 Parents of subpages, one level up, not named
18591 !! options
18592 subpage title=[[Subpage test/L1/L2/L3]]
18593 !! wikitext
18594 [[../]]
18595 !! html
18596 <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>
18597 </p>
18598 !! end
18599
18600
18601
18602 !! test
18603 Parents of subpages, two levels up
18604 !! options
18605 subpage title=[[Subpage test/L1/L2/L3]]
18606 !! wikitext
18607 [[../../|L1]]2
18608
18609 [[../../|L1]]l
18610 !! html
18611 <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
18612 </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>
18613 </p>
18614 !! end
18615
18616 !! test
18617 Parents of subpages, two levels up, without trailing slash or name.
18618 !! options
18619 subpage title=[[Subpage test/L1/L2/L3]]
18620 !! wikitext
18621 [[../..]]
18622 !! html
18623 <p>[[../..]]
18624 </p>
18625 !! end
18626
18627 !! test
18628 Parents of subpages, two levels up, with lots of extra trailing slashes.
18629 !! options
18630 subpage title=[[Subpage test/L1/L2/L3]]
18631 !! wikitext
18632 [[../../////]]
18633 !! html
18634 <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>
18635 </p>
18636 !! end
18637
18638 !! article
18639 Subpage test/L1/L2/L3Sibling
18640 !! text
18641 Sibling article
18642 !! endarticle
18643
18644 !! test
18645 Transclusion of a sibling page (one level up)
18646 !! options
18647 subpage title=[[Subpage test/L1/L2/L3]]
18648 !! wikitext
18649 {{../L3Sibling}}
18650 !! html
18651 <p>Sibling article
18652 </p>
18653 !! end
18654
18655 !! test
18656 Transclusion of a child page
18657 !! options
18658 subpage title=[[Subpage test/L1/L2]]
18659 !! wikitext
18660 {{/L3Sibling}}
18661 !! html
18662 <p>Sibling article
18663 </p>
18664 !! end
18665
18666 !! test
18667 Non-transclusion because of too many up levels
18668 !! options
18669 subpage title=[[Subpage test/L1/L2/L3]]
18670 !! wikitext
18671 {{../../../../More than parent}}
18672 !! html
18673 <p>{{../../../../More than parent}}
18674 </p>
18675 !! end
18676
18677 !! test
18678 Definition list code coverage
18679 !! wikitext
18680 ; title : def
18681 ; title : def
18682 ;title: def
18683 !! html/php
18684 <dl><dt> title &#160;</dt>
18685 <dd> def</dd>
18686 <dt> title&#160;</dt>
18687 <dd> def</dd>
18688 <dt>title</dt>
18689 <dd> def</dd></dl>
18690
18691 !! html/parsoid
18692 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18693 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18694 <dt>title</dt><dd> def</dd></dl>
18695 !! end
18696
18697 !! test
18698 Don't fall for the self-closing div
18699 !! wikitext
18700 <div>hello world</div/>
18701 !! html
18702 <div>hello world</div>
18703
18704 !! end
18705
18706 !! test
18707 MSGNW magic word
18708 !! wikitext
18709 {{MSGNW:msg}}
18710 !! html/php
18711 <p>&#91;&#91;:Template:Msg&#93;&#93;
18712 </p>
18713 !! end
18714
18715 !! test
18716 RAW magic word
18717 !! wikitext
18718 {{RAW:QUERTY}}
18719 !! html
18720 <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>
18721 </p>
18722 !! end
18723
18724 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18725 !! test
18726 Always escape literal '>' in output, not just after '<'
18727 !! wikitext
18728 ><>
18729 !! html
18730 <p>&gt;&lt;&gt;
18731 </p>
18732 !! end
18733
18734 !! test
18735 Template caching
18736 !! wikitext
18737 {{Test}}
18738 {{Test}}
18739 !! html
18740 <p>This is a test template
18741 This is a test template
18742 </p>
18743 !! end
18744
18745
18746 !! article
18747 MediaWiki:Fake
18748 !! text
18749 ==header==
18750 !! endarticle
18751
18752 !! test
18753 Inclusion of !userCanEdit() content
18754 !! wikitext
18755 {{MediaWiki:Fake}}
18756 !! html
18757 <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>
18758
18759 !! end
18760
18761
18762 !! test
18763 Out-of-order TOC heading levels
18764 !! wikitext
18765 ==2==
18766 ======6======
18767 ===3===
18768 =1=
18769 =====5=====
18770 ==2==
18771 !! html
18772 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18773 <ul>
18774 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18775 <ul>
18776 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18777 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18778 </ul>
18779 </li>
18780 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18781 <ul>
18782 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18783 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18784 </ul>
18785 </li>
18786 </ul>
18787 </div>
18788
18789 <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>
18790 <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>
18791 <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>
18792 <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>
18793 <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>
18794 <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>
18795
18796 !! end
18797
18798
18799 !! test
18800 ISBN with a dummy number
18801 !! wikitext
18802 ISBN ---
18803 !! html
18804 <p>ISBN ---
18805 </p>
18806 !! end
18807
18808
18809 !! test
18810 ISBN with space-delimited number
18811 !! wikitext
18812 ISBN 92 9017 032 8
18813 !! html
18814 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18815 </p>
18816 !! end
18817
18818
18819 !! test
18820 ISBN with multiple spaces, no number
18821 !! wikitext
18822 ISBN foo
18823 !! html
18824 <p>ISBN foo
18825 </p>
18826 !! end
18827
18828
18829 !! test
18830 ISBN length
18831 !! wikitext
18832 ISBN 123456789
18833
18834 ISBN 1234567890
18835
18836 ISBN 12345678901
18837 !! html
18838 <p>ISBN 123456789
18839 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18840 </p><p>ISBN 12345678901
18841 </p>
18842 !! end
18843
18844
18845 !! test
18846 ISBN with trailing year (bug 8110)
18847 !! wikitext
18848 ISBN 1-234-56789-0 - 2006
18849
18850 ISBN 1 234 56789 0 - 2006
18851 !! html
18852 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18853 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18854 </p>
18855 !! end
18856
18857
18858 !! test
18859 anchorencode
18860 !! wikitext
18861 {{anchorencode:foo bar©#%n}}
18862 !! html
18863 <p>foo_bar.C2.A9.23.25n
18864 </p>
18865 !! end
18866
18867 !! test
18868 anchorencode trims spaces
18869 !! wikitext
18870 {{anchorencode: __pretty__please__}}
18871 !! html
18872 <p>pretty_please
18873 </p>
18874 !! end
18875
18876 !! test
18877 anchorencode deals with links
18878 !! wikitext
18879 {{anchorencode: [[hello|world]] [[hi]]}}
18880 !! html
18881 <p>world_hi
18882 </p>
18883 !! end
18884
18885 !! test
18886 anchorencode deals with templates
18887 !! wikitext
18888 {{anchorencode: {{Foo}} }}
18889 !! html
18890 <p>FOO
18891 </p>
18892 !! end
18893
18894 !! test
18895 anchorencode encodes like the TOC generator: (bug 18431)
18896 !! wikitext
18897 === _ +:.3A%3A&&amp;]] ===
18898 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18899 __NOEDITSECTION__
18900 !! html
18901 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18902 <p>.2B:.3A.253A.26.26.5D.5D
18903 </p>
18904 !! end
18905
18906 !! test
18907 Bug 6200: blockquotes and paragraph formatting
18908 !! wikitext
18909 <blockquote>
18910 foo
18911 </blockquote>
18912
18913 bar
18914
18915 baz
18916 !! html
18917 <blockquote>
18918 <p>foo
18919 </p>
18920 </blockquote>
18921 <p>bar
18922 </p>
18923 <pre>baz
18924 </pre>
18925 !! end
18926
18927 !! test
18928 Bug 8293: Use of center tag ruins paragraph formatting
18929 !! wikitext
18930 <center>
18931 foo
18932 </center>
18933
18934 bar
18935
18936 baz
18937 !! html
18938 <center>
18939 <p>foo
18940 </p>
18941 </center>
18942 <p>bar
18943 </p>
18944 <pre>baz
18945 </pre>
18946 !! end
18947
18948 !!test
18949 Parsing of overlapping (improperly nested) inline html tags
18950 !! wikitext
18951 <span><s>x</span></s>
18952 !! html/php
18953 <p><span><s>x&lt;/span&gt;</s></span>
18954 </p>
18955 !! html/parsoid
18956 <p><span><s>x</s></span>
18957 </p>
18958 !!end
18959
18960 ###
18961 ### Language variants related tests
18962 ###
18963 !! test
18964 Self-link in language variants
18965 !! options
18966 title=[[Dunav]] language=sr
18967 !! wikitext
18968 Both [[Dunav]] and [[Дунав]] are names for this river.
18969 !! html
18970 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18971 </p>
18972 !!end
18973
18974 !! article
18975 Дуна
18976 !! text
18977 content
18978 !! endarticle
18979
18980 !! test
18981 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18982 !! options
18983 title=[[Duna]] language=sr
18984 !! wikitext
18985 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18986 !! html
18987 <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.
18988 </p>
18989 !! end
18990
18991 !! test
18992 Link to a section of a variant of this title shouldn't be parsed as self-link
18993 !! options
18994 title=[[Duna]] language=sr
18995 !! wikitext
18996 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18997 !! html
18998 <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.
18999 </p>
19000 !! end
19001
19002 !! test
19003 Link to pages in language variants
19004 !! options
19005 language=sr
19006 !! wikitext
19007 Main Page can be written as [[Маин Паге]]
19008 !! html
19009 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19010 </p>
19011 !!end
19012
19013
19014 !! test
19015 Multiple links to pages in language variants
19016 !! options
19017 language=sr
19018 !! wikitext
19019 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19020 !! html
19021 <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>.
19022 </p>
19023 !!end
19024
19025
19026 !! test
19027 Simple template in language variants
19028 !! options
19029 language=sr
19030 !! wikitext
19031 {{тест}}
19032 !! html
19033 <p>This is a test template
19034 </p>
19035 !! end
19036
19037
19038 !! test
19039 Template with explicit namespace in language variants
19040 !! options
19041 language=sr
19042 !! wikitext
19043 {{Template:тест}}
19044 !! html
19045 <p>This is a test template
19046 </p>
19047 !! end
19048
19049
19050 !! test
19051 Basic test for template parameter in language variants
19052 !! options
19053 language=sr
19054 !! wikitext
19055 {{парамтест|param=foo}}
19056 !! html
19057 <p>This is a test template with parameter foo
19058 </p>
19059 !! end
19060
19061
19062 !! test
19063 Simple category in language variants
19064 !! options
19065 language=sr cat
19066 !! wikitext
19067 [[Category:МедиаWики Усер'с Гуиде]]
19068 !! html
19069 <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's_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
19070 !! end
19071
19072
19073 !! article
19074 Category:分类
19075 !! text
19076 blah
19077 !! endarticle
19078
19079 !! article
19080 Category:分類
19081 !! text
19082 blah
19083 !! endarticle
19084
19085 !! test
19086 Don't convert blue categorylinks to another variant (bug 33210)
19087 !! options
19088 language=zh cat
19089 !! wikitext
19090 [[A]][[Category:分类]]
19091 !! html
19092 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19093 !! end
19094
19095
19096 !! test
19097 Stripping -{}- tags (language variants)
19098 !! options
19099 language=sr
19100 !! wikitext
19101 Latin proverb: -{Ne nuntium necare}-
19102 !! html
19103 <p>Latin proverb: Ne nuntium necare
19104 </p>
19105 !! end
19106
19107
19108 !! test
19109 Prevent conversion with -{}- tags (language variants)
19110 !! options
19111 language=sr variant=sr-ec
19112 !! wikitext
19113 Latinski: -{Ne nuntium necare}-
19114 !! html
19115 <p>Латински: Ne nuntium necare
19116 </p>
19117 !! end
19118
19119
19120 !! test
19121 Prevent conversion of text with -{}- tags (language variants)
19122 !! options
19123 language=sr variant=sr-ec
19124 !! wikitext
19125 Latinski: -{Ne nuntium necare}-
19126 !! html
19127 <p>Латински: Ne nuntium necare
19128 </p>
19129 !! end
19130
19131
19132 !! test
19133 Prevent conversion of links with -{}- tags (language variants)
19134 !! options
19135 language=sr variant=sr-ec
19136 !! wikitext
19137 -{[[Main Page]]}-
19138 !! html
19139 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19140 </p>
19141 !! end
19142
19143
19144 !! test
19145 -{}- tags within headlines (within html for parserConvert())
19146 !! options
19147 language=sr variant=sr-ec
19148 !! wikitext
19149 == -{Naslov}- ==
19150 !! html
19151 <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>
19152
19153 !! end
19154
19155
19156 !! test
19157 Explicit definition of language variant alternatives
19158 !! options
19159 language=zh variant=zh-tw
19160 !! wikitext
19161 -{zh:China;zh-tw:Taiwan}-, not China
19162 !! html
19163 <p>Taiwan, not China
19164 </p>
19165 !! end
19166
19167
19168 !! test
19169 Conversion around HTML tags
19170 !! options
19171 language=sr variant=sr-ec
19172 !! wikitext
19173 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19174 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19175 !! html
19176 <p>
19177 <span title="ЛаCтин">ски</span>
19178 </p>
19179 !! end
19180
19181
19182 !! test
19183 Explicit session-wise language variant mapping (A flag and - flag)
19184 !! options
19185 language=zh variant=zh-tw
19186 !! wikitext
19187 Taiwan is not China.
19188 But -{A|zh:China;zh-tw:Taiwan}- is China,
19189 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19190 and -{China}- is China.
19191 !! html
19192 <p>Taiwan is not China.
19193 But Taiwan is Taiwan,
19194 (This should be stripped!)
19195 and China is China.
19196 </p>
19197 !! end
19198
19199 !! test
19200 Explicit session-wise language variant mapping (H flag for hide)
19201 !! options
19202 language=zh variant=zh-tw
19203 !! wikitext
19204 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19205 Taiwan is China.
19206 !! html
19207 <p>(This should be stripped!)
19208 Taiwan is Taiwan.
19209 </p>
19210 !! end
19211
19212 !! test
19213 Adding explicit conversion rule for title (T flag)
19214 !! options
19215 language=zh variant=zh-tw showtitle
19216 !! wikitext
19217 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19218 !! html
19219 Taiwan
19220 <p>Should be stripped!
19221 </p>
19222 !! end
19223
19224 !! test
19225 Testing that changing the language variant here in the tests actually works
19226 !! options
19227 language=zh variant=zh showtitle
19228 !! wikitext
19229 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19230 !! html
19231 China
19232 <p>Should be stripped!
19233 </p>
19234 !! end
19235
19236 !! test
19237 Recursive conversion of alt and title attrs shouldn't clear converter state
19238 !! options
19239 language=zh variant=zh-cn showtitle
19240 !! wikitext
19241 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19242 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19243 !! html
19244 China
19245 <p>
19246 Should be stripped<span title="Exclamation">!</span>
19247 </p>
19248 !! end
19249
19250 !! test
19251 Bug 24072: more test on conversion rule for title
19252 !! options
19253 language=zh variant=zh-tw showtitle
19254 !! wikitext
19255 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19256 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19257 !! html
19258 Taiwan
19259 <p>This should be stripped!
19260 This won't take interferes with the title rule.
19261 </p>
19262 !! end
19263
19264 !! test
19265 Partly disable title conversion if variant == main language code
19266 !! options
19267 language=zh variant=zh title=[[ZH]] showtitle
19268 !! wikitext
19269 -{T|zh-cn:CN;zh-tw:TW}-
19270 !! html
19271 ZH
19272 <p>
19273 </p>
19274 !! end
19275
19276 !! test
19277 Partly disable title conversion if variant == main language code, more
19278 !! options
19279 language=zh variant=zh title=[[ZH]] showtitle
19280 !! wikitext
19281 -{T|TW}-
19282 !! html
19283 ZH
19284 <p>
19285 </p>
19286 !! end
19287
19288 !! test
19289 Raw output of variant escape tags (R flag)
19290 !! options
19291 language=zh variant=zh-tw
19292 !! wikitext
19293 Raw: -{R|zh:China;zh-tw:Taiwan}-
19294 !! html
19295 <p>Raw: zh:China;zh-tw:Taiwan
19296 </p>
19297 !! end
19298
19299 !! test
19300 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19301 !! options
19302 language=zh variant=zh-cn
19303 !! input
19304 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19305 !! result
19306 <p>0
19307 </p>
19308 !! end
19309
19310 !! test
19311 Conversion rules from [numeric-only string] to [something else] (T48634)
19312 !! options
19313 language=zh variant=zh-cn
19314 !! input
19315 -{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
19316 !! result
19317 <p>D12345EE12345
19318 </p>
19319 !! end
19320
19321 !! test
19322 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19323 !! options
19324 language=zh variant=zh-cn
19325 !! input
19326 -{H|zh-cn:foo;zh-tw:;}-foobar
19327 !! result
19328 <p>foobar
19329 </p>
19330 !! end
19331
19332 !! test
19333 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19334 !! options
19335 language=zh variant=zh-cn
19336 !! input
19337 -{H|=>zh-cn:foo;}-foobar
19338 !! result
19339 <p>foobar
19340 </p>
19341 !! end
19342
19343 !! test
19344 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19345 !! options
19346 language=zh variant=zh-cn
19347 !! input
19348 -{H|}-foobar
19349 !! result
19350 <p>foobar
19351 </p>
19352 !! end
19353
19354 !! test
19355 Nested using of manual convert syntax
19356 !! options
19357 language=zh variant=zh-hk
19358 !! wikitext
19359 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19360 !! html
19361 <p>Nested: Hello Hong Kong!
19362 </p>
19363 !! end
19364
19365 !! test
19366 Proper conversion of text in external links
19367 !! options
19368 language=sr variant=sr-ec
19369 !! wikitext
19370 http://www.google.com
19371 gopher://www.google.com
19372 [http://www.google.com http://www.google.com]
19373 [gopher://www.google.com gopher://www.google.com]
19374 [https://www.google.com irc://www.google.com]
19375 [ftp://www.google.com www.google.com/ftp://dir]
19376 [//www.google.com www.google.com]
19377 !! html
19378 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19379 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19380 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19381 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19382 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19383 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19384 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19385 </p>
19386 !! end
19387
19388 !! test
19389 Do not convert roman numbers to language variants
19390 !! options
19391 language=sr variant=sr-ec
19392 !! wikitext
19393 Fridrih IV je car.
19394 !! html
19395 <p>Фридрих IV је цар.
19396 </p>
19397 !! end
19398
19399 !! test
19400 Unclosed language converter markup "-{"
19401 !! options
19402 language=sr
19403 !! wikitext
19404 -{T|hello
19405 !! html
19406 <p>-{T|hello
19407 </p>
19408 !! end
19409
19410 !! test
19411 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19412 !! options
19413 language=sr
19414 !! wikitext
19415 -{R|=&gt;}-
19416 !! html
19417 <p>=&gt;
19418 </p>
19419 !!end
19420
19421 !! test
19422 Don't break link parsing if language converter markup is in the caption.
19423 !! options
19424 language=sr variant=sr-ec
19425 !! wikitext
19426 [[Main Page|-{R|main page}-]]
19427 !! html
19428 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19429 </p>
19430 !! end
19431
19432 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19433 !! test
19434 Don't break image parsing if language converter markup is in the caption.
19435 !! options
19436 language=sr
19437 !! wikitext
19438 [[File:Foobar.jpg|-{R|caption}-]]
19439 !! html/parsoid
19440 <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>
19441 </p>
19442 !! end
19443
19444 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19445 !! test
19446 Don't break list handling if language converter markup is in the item.
19447 !! options
19448 language=zh variant=zh-cn
19449 !! wikitext
19450 ;-{zh-cn:AAA;zh-tw:BBB}-
19451 !! html/php
19452 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19453
19454 !! html/parsoid
19455 <dl><dt>AAA
19456 </dt></dl>
19457 !! end
19458
19459 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19460 !! test
19461 Don't break table handling if language converter markup is in the cell.
19462 !! options
19463 language=sr variant=sr-ec
19464 !! wikitext
19465 {|
19466 |-
19467 | -{R|B}-
19468 |}
19469 !! html/php
19470 <table>
19471
19472 <tr>
19473 <td>Б}-
19474 </td></tr></table>
19475
19476 !! html/parsoid
19477 <table>
19478
19479 <tr>
19480 <td> B
19481 </td></tr></table>
19482
19483 !! end
19484
19485 !! test
19486 Bug 529: Uncovered bullet
19487 !! wikitext
19488 * Foo {{bullet}}
19489 !! html
19490 <ul><li> Foo </li>
19491 <li> Bar</li></ul>
19492
19493 !! end
19494
19495 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19496 # Templates in Wikipedia rely on this behavior, as tidy has always been
19497 # enabled there. These tests are normally run *without* tidy, so specify the
19498 # full output here.
19499 # To test realistic parsing behavior, apply a tidy-like transformation to both
19500 # the expected output and your parser's output.
19501 !! test
19502 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19503 !! wikitext
19504 ******* Foo {{bullet}}
19505 !! html
19506 <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>
19507 <li> Bar</li></ul>
19508
19509 !! end
19510
19511 !! test
19512 Bug 529: Uncovered table already at line-start
19513 !! wikitext
19514 x
19515
19516 {{table}}
19517 y
19518 !! html
19519 <p>x
19520 </p>
19521 <table>
19522 <tr>
19523 <td> 1 </td>
19524 <td> 2
19525 </td></tr>
19526 <tr>
19527 <td> 3 </td>
19528 <td> 4
19529 </td></tr></table>
19530 <p>y
19531 </p>
19532 !! end
19533
19534 !! test
19535 Bug 529: Uncovered bullet in parser function result
19536 !! wikitext
19537 * Foo {{lc:{{bullet}} }}
19538 !! html
19539 <ul><li> Foo </li>
19540 <li> bar</li></ul>
19541
19542 !! end
19543
19544 !! test
19545 Bug 5678: Double-parsed template argument
19546 !! wikitext
19547 {{lc:{{{1}}}|hello}}
19548 !! html
19549 <p>{{{1}}}
19550 </p>
19551 !! end
19552
19553 !! test
19554 Bug 5678: Double-parsed template invocation
19555 !! wikitext
19556 {{lc:{{paramtest {{!}} param = hello }} }}
19557 !! html
19558 <p>{{paramtest | param = hello }}
19559 </p>
19560 !! end
19561
19562 !! test
19563 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19564 !! options
19565 language=cs
19566 title=[[Main Page]]
19567 !! wikitext
19568 {{PRVNÍVELKÉ:ěščř}}
19569 {{prvnívelké:ěščř}}
19570 {{PRVNÍMALÉ:ěščř}}
19571 {{prvnímalé:ěščř}}
19572 {{MALÁ:ěščř}}
19573 {{malá:ěščř}}
19574 {{VELKÁ:ěščř}}
19575 {{velká:ěščř}}
19576 !! html
19577 <p>Ěščř
19578 Ěščř
19579 ěščř
19580 ěščř
19581 ěščř
19582 ěščř
19583 ĚŠČŘ
19584 ĚŠČŘ
19585 </p>
19586 !! end
19587
19588 !! test
19589 Morwen/13: Unclosed link followed by heading
19590 !! wikitext
19591 [[link
19592 ==heading==
19593 !! html
19594 <p>[[link
19595 </p>
19596 <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>
19597
19598 !! end
19599
19600 !! test
19601 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19602 !! wikitext
19603 {{foo|
19604 =heading=
19605 !! html
19606 <p>{{foo|
19607 </p>
19608 <h1><span class="mw-headline" id="heading">heading</span></h1>
19609
19610 !! end
19611
19612 !! test
19613 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19614 !! wikitext
19615 {{foo|
19616 ==heading==
19617 !! html
19618 <p>{{foo|
19619 </p>
19620 <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>
19621
19622 !! end
19623
19624 !! test
19625 Tildes in comments
19626 !! options
19627 pst
19628 !! wikitext
19629 <!-- ~~~~ -->
19630 !! html
19631 <!-- ~~~~ -->
19632 !! end
19633
19634 !! test
19635 Paragraphs inside divs (no extra line breaks)
19636 !! wikitext
19637 <div>Line one
19638
19639 Line two</div>
19640 !! html
19641 <div>Line one
19642 Line two</div>
19643
19644 !! end
19645
19646 !! test
19647 Paragraphs inside divs (extra line break on open)
19648 !! wikitext
19649 <div>
19650 Line one
19651
19652 Line two</div>
19653 !! html
19654 <div>
19655 <p>Line one
19656 </p>
19657 Line two</div>
19658
19659 !! end
19660
19661 !! test
19662 Paragraphs inside divs (extra line break on close)
19663 !! wikitext
19664 <div>Line one
19665
19666 Line two
19667 </div>
19668 !! html
19669 <div>Line one
19670 <p>Line two
19671 </p>
19672 </div>
19673
19674 !! end
19675
19676 !! test
19677 Paragraphs inside divs (extra line break on open and close)
19678 !! wikitext
19679 <div>
19680 Line one
19681
19682 Line two
19683 </div>
19684 !! html
19685 <div>
19686 <p>Line one
19687 </p><p>Line two
19688 </p>
19689 </div>
19690
19691 !! end
19692
19693 !! test
19694 Nesting tags, paragraphs on lines which begin with <div>
19695 !! wikitext
19696 <div></div><strong>A
19697 B</strong>
19698 !! html/php+tidy
19699 <p><strong>A</strong></p>
19700 <p><strong>B</strong></p>
19701 !! html/parsoid
19702 <div></div>
19703 <p><strong>A
19704 B</strong>
19705 </p>
19706 !! end
19707
19708 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19709 !! test
19710 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19711 !! wikitext
19712 <blockquote>Line one
19713
19714 Line two</blockquote>
19715 !! html
19716 <blockquote>Line one
19717 Line two</blockquote>
19718
19719 !! html+tidy
19720 <blockquote>
19721 <p>Line one Line two</p>
19722 </blockquote>
19723 !! end
19724
19725 !! test
19726 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19727 !! wikitext
19728 <blockquote>
19729 Line one
19730
19731 Line two</blockquote>
19732 !! html
19733 <blockquote>
19734 <p>Line one
19735 </p>
19736 Line two</blockquote>
19737
19738 !! html+tidy
19739 <blockquote>
19740 <p>Line one</p>
19741 Line two</blockquote>
19742 !! end
19743
19744 !! test
19745 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19746 !! wikitext
19747 <blockquote>Line one
19748
19749 Line two
19750 </blockquote>
19751 !! html
19752 <blockquote>Line one
19753 <p>Line two
19754 </p>
19755 </blockquote>
19756
19757 !! html+tidy
19758 <blockquote>
19759 <p>Line one</p>
19760 <p>Line two</p>
19761 </blockquote>
19762 !! end
19763
19764 !! test
19765 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19766 !! wikitext
19767 <blockquote>
19768 Line one
19769
19770 Line two
19771 </blockquote>
19772 !! html
19773 <blockquote>
19774 <p>Line one
19775 </p><p>Line two
19776 </p>
19777 </blockquote>
19778
19779 !! html+tidy
19780 <blockquote>
19781 <p>Line one</p>
19782 <p>Line two</p>
19783 </blockquote>
19784 !! end
19785
19786 !! test
19787 Paragraphs inside blockquotes/divs (no extra line breaks)
19788 !! wikitext
19789 <blockquote><div>Line one
19790
19791 Line two</div></blockquote>
19792 !! html
19793 <blockquote><div>Line one
19794 Line two</div></blockquote>
19795
19796 !! end
19797
19798 !! test
19799 Paragraphs inside blockquotes/divs (extra line break on open)
19800 !! wikitext
19801 <blockquote><div>
19802 Line one
19803
19804 Line two</div></blockquote>
19805 !! html
19806 <blockquote><div>
19807 <p>Line one
19808 </p>
19809 Line two</div></blockquote>
19810
19811 !! end
19812
19813 !! test
19814 Paragraphs inside blockquotes/divs (extra line break on close)
19815 !! wikitext
19816 <blockquote><div>Line one
19817
19818 Line two
19819 </div></blockquote>
19820 !! html
19821 <blockquote><div>Line one
19822 <p>Line two
19823 </p>
19824 </div></blockquote>
19825
19826 !! end
19827
19828 !! test
19829 Paragraphs inside blockquotes/divs (extra line break on open and close)
19830 !! wikitext
19831 <blockquote><div>
19832 Line one
19833
19834 Line two
19835 </div></blockquote>
19836 !! html
19837 <blockquote><div>
19838 <p>Line one
19839 </p><p>Line two
19840 </p>
19841 </div></blockquote>
19842
19843 !! end
19844
19845 !! test
19846 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19847 !! options
19848 wgLinkHolderBatchSize=0
19849 !! wikitext
19850 [[meatball:1]]
19851 [[meatball:2]]
19852 [[meatball:3]]
19853 !! html
19854 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19855 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19856 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19857 </p>
19858 !! end
19859
19860 !! test
19861 Free external link invading image caption
19862 !! wikitext
19863 [[Image:Foobar.jpg|thumb|http://x|hello]]
19864 !! html
19865 <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>
19866
19867 !! end
19868
19869 !! test
19870 Bug 15196: localised external link numbers
19871 !! options
19872 language=fa
19873 !! wikitext
19874 [http://en.wikipedia.org/]
19875 !! html/php
19876 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19877 </p>
19878 !! html/parsoid
19879 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19880 !! end
19881
19882 !! test
19883 Multibyte character in padleft
19884 !! wikitext
19885 {{padleft:-Hello|7|Æ}}
19886 !! html
19887 <p>Æ-Hello
19888 </p>
19889 !! end
19890
19891 !! test
19892 Multibyte character in padright
19893 !! wikitext
19894 {{padright:Hello-|7|Æ}}
19895 !! html
19896 <p>Hello-Æ
19897 </p>
19898 !! end
19899
19900 !!test
19901 formatdate parser function
19902 !! wikitext
19903 {{#formatdate:2009-03-24}}
19904 !! html
19905 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19906 </p>
19907 !! end
19908
19909 !!test
19910 formatdate parser function, with default format
19911 !! wikitext
19912 {{#formatdate:2009-03-24|mdy}}
19913 !! html
19914 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19915 </p>
19916 !! end
19917
19918 !! test
19919 Spacing of numbers in formatted dates
19920 !! wikitext
19921 {{#formatdate:January 15}}
19922 !! html
19923 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19924 </p>
19925 !! end
19926
19927 !! test
19928 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
19929 !! options
19930 language=nl title=[[MediaWiki:Common.css]]
19931 !! wikitext
19932 {{#formatdate:2009-03-24|dmy}}
19933 !! html
19934 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19935 </p>
19936 !! end
19937
19938 #
19939 #
19940 #
19941
19942 #
19943 # Edit comments
19944 #
19945
19946 !! test
19947 Edit comment with link
19948 !! options
19949 comment
19950 !! wikitext
19951 I like the [[Main Page]] a lot
19952 !! html
19953 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19954 !!end
19955
19956 !! test
19957 Edit comment with link and link text
19958 !! options
19959 comment
19960 !! wikitext
19961 I like the [[Main Page|best pages]] a lot
19962 !! html
19963 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19964 !!end
19965
19966 !! test
19967 Edit comment with link and link text with suffix
19968 !! options
19969 comment
19970 !! wikitext
19971 I like the [[Main Page|best page]]s a lot
19972 !! html
19973 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19974 !!end
19975
19976 !! test
19977 Edit comment with section link (non-local, eg in history list)
19978 !! options
19979 comment title=[[Main Page]]
19980 !! wikitext
19981 /* External links */ removed bogus entries
19982 !! html
19983 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19984 !!end
19985
19986 !! test
19987 Edit comment with section link and text before it (non-local, eg in history list)
19988 !! options
19989 comment title=[[Main Page]]
19990 !! wikitext
19991 pre-comment text /* External links */ removed bogus entries
19992 !! html
19993 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>
19994 !!end
19995
19996 !! test
19997 Edit comment with section link (local, eg in diff view)
19998 !! options
19999 comment local title=[[Main Page]]
20000 !! wikitext
20001 /* External links */ removed bogus entries
20002 !! html
20003 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20004 !!end
20005
20006 !! test
20007 Edit comment with subpage link (bug 14080)
20008 !! options
20009 comment
20010 subpage
20011 title=[[Subpage test]]
20012 !! wikitext
20013 Poked at a [[/subpage]] here...
20014 !! html
20015 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20016 !!end
20017
20018 !! test
20019 Edit comment with subpage link and link text (bug 14080)
20020 !! options
20021 comment
20022 subpage
20023 title=[[Subpage test]]
20024 !! wikitext
20025 Poked at a [[/subpage|neat little page]] here...
20026 !! html
20027 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20028 !!end
20029
20030 !! test
20031 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20032 !! options
20033 comment
20034 title=[[Subpage test]]
20035 !! wikitext
20036 Poked at a [[/subpage]] here...
20037 !! html
20038 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...
20039 !!end
20040
20041 !! test
20042 Edit comment with bare anchor link (local, as on diff)
20043 !! options
20044 comment
20045 local
20046 title=[[Main Page]]
20047 !! wikitext
20048 [[#section]]
20049 !! html
20050 <a href="#section">#section</a>
20051 !! end
20052
20053 !! test
20054 Edit comment with bare anchor link (non-local, as on history)
20055 !! options
20056 comment
20057 title=[[Main Page]]
20058 !! wikitext
20059 [[#section]]
20060 !! html
20061 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20062 !! end
20063
20064 !! test
20065 Anchor starting with underscore
20066 !! wikitext
20067 [[#_ref|One]]
20068 !! html
20069 <p><a href="#_ref">One</a>
20070 </p>
20071 !! end
20072
20073 !! test
20074 Id starting with underscore
20075 !! wikitext
20076 <div id="_ref"></div>
20077 !! html
20078 <div id="_ref"></div>
20079
20080 !! end
20081
20082 !! test
20083 Space normalisation on autocomment (bug 22784)
20084 !! options
20085 comment
20086 title=[[Main Page]]
20087 !! wikitext
20088 /* __hello__world__ */
20089 !! html
20090 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20091 !! end
20092
20093 !! test
20094 percent-encoding and + signs in comments (Bug 26410)
20095 !! options
20096 comment
20097 !! wikitext
20098 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20099 !! html/php
20100 <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>
20101 !! end
20102
20103 # Parsoid doesn't support this yet: see bug 73581
20104 # but it *should* omit the 'src' attribute if the image is bad.
20105 # PHP side of tests was disabled in
20106 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20107 # because of issues in the PHP parserTests infrastructure
20108 # (but the output below is indeed what the PHP side emits)
20109 !! test
20110 Bad images - basic functionality
20111 !! wikitext
20112 [[File:Bad.jpg]]
20113 !! DISABLED/html/php
20114 !! html/parsoid
20115 <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>
20116 !! end
20117
20118 !! test
20119 Bad images - bug 16039: text after bad image disappears
20120 !! wikitext
20121 Foo bar
20122 [[File:Bad.jpg]]
20123 Bar foo
20124 !! DISABLED/html/php
20125 <p>Foo bar
20126 </p><p>Bar foo
20127 </p>
20128 !! html/parsoid
20129 <p>Foo bar
20130 <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>
20131 Bar foo</p>
20132 !! end
20133
20134 !! test
20135 Verify that displaytitle works (bug #22501) no displaytitle
20136 !! options
20137 showtitle
20138 !! config
20139 wgAllowDisplayTitle=true
20140 wgRestrictDisplayTitle=false
20141 !! wikitext
20142 this is not the the title
20143 !! html/php
20144 Parser test
20145 <p>this is not the the title
20146 </p>
20147 !! end
20148
20149 !! test
20150 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20151 !! options
20152 showtitle
20153 title=[[Screen]]
20154 !! config
20155 wgAllowDisplayTitle=true
20156 wgRestrictDisplayTitle=false
20157 !! wikitext
20158 this is not the the title
20159 {{DISPLAYTITLE:whatever}}
20160 !! html/php
20161 whatever
20162 <p>this is not the the title
20163 </p>
20164 !! end
20165
20166 !! test
20167 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20168 !! options
20169 showtitle
20170 title=[[Screen]]
20171 !! config
20172 wgAllowDisplayTitle=true
20173 wgRestrictDisplayTitle=true
20174 !! wikitext
20175 this is not the the title
20176 {{DISPLAYTITLE:whatever}}
20177 !! html/php
20178 Screen
20179 <p>this is not the the title
20180 </p>
20181 !! end
20182
20183 !! test
20184 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20185 !! options
20186 showtitle
20187 title=[[Screen]]
20188 !! config
20189 wgAllowDisplayTitle=true
20190 wgRestrictDisplayTitle=true
20191 !! wikitext
20192 this is not the the title
20193 {{DISPLAYTITLE:screen}}
20194 !! html/php
20195 screen
20196 <p>this is not the the title
20197 </p>
20198 !! end
20199
20200 !! test
20201 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20202 !! options
20203 showtitle
20204 title=[[Screen]]
20205 !! config
20206 wgAllowDisplayTitle=false
20207 !! wikitext
20208 this is not the the title
20209 {{DISPLAYTITLE:screen}}
20210 !! html/php
20211 Screen
20212 <p>this is not the the title
20213 <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>
20214 </p>
20215 !! end
20216
20217 !! test
20218 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20219 !! options
20220 showtitle
20221 title=[[Screen]]
20222 !! config
20223 wgAllowDisplayTitle=false
20224 !! wikitext
20225 this is not the the title
20226 !! html/php
20227 Screen
20228 <p>this is not the the title
20229 </p>
20230 !! end
20231
20232 !! test
20233 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20234 !! options
20235 showtitle
20236 title=[[Screen]]
20237 !! config
20238 wgAllowDisplayTitle=true
20239 wgRestrictDisplayTitle=true
20240 !! wikitext
20241 this is not the the title
20242 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20243 !! html/php
20244 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20245 <p>this is not the the title
20246 </p>
20247 !! end
20248
20249 !! test
20250 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20251 !! options
20252 showtitle
20253 title=[[Screen]]
20254 !! config
20255 wgAllowDisplayTitle=true
20256 wgRestrictDisplayTitle=true
20257 !! wikitext
20258 this is not the the title
20259 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20260 !! html/php
20261 <span style="color: red;">s</span>creen
20262 <p>this is not the the title
20263 </p>
20264 !! end
20265
20266 !! test
20267 Page status indicators: Empty name is invalid
20268 !! options
20269 showindicators
20270 !! wikitext
20271 <indicator name=" "></indicator>
20272 <indicator></indicator>
20273 !! html
20274 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20275 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20276 </p>
20277 !! end
20278
20279 !! test
20280 Page status indicators: Weird syntaxes that are okay
20281 !! options
20282 showindicators
20283 !! wikitext
20284 <indicator name="empty" />
20285 <indicator name="name"></indicator>
20286 !! html
20287 empty=
20288 name=
20289 <p><br />
20290 </p>
20291 !! end
20292
20293 !! test
20294 Page status indicators: Torture test
20295 !! options
20296 showindicators
20297 !! wikitext
20298 <indicator name="01">hello world</indicator>
20299 <indicator name="02">[[Main Page]]</indicator>
20300 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20301 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20302 <indicator name="05">* foo
20303 * bar</indicator>
20304 <indicator name="06"><nowiki>foo</nowiki></indicator>
20305 <indicator name="07"> Preformatted</indicator>
20306 <indicator name="08"><div>Broken tag</indicator>
20307 <indicator name="09">{| class=wikitable
20308 | cell
20309 |}</indicator>
20310 <indicator name="10">Two
20311
20312 paragraphs</indicator>
20313 !! html
20314 01=hello world
20315 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20316 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" />
20317 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>
20318 05=<ul><li> foo</li>
20319 <li> bar</li></ul>
20320
20321 06=foo
20322 07=<pre>Preformatted
20323 </pre>
20324 08=<div>Broken tag</div>
20325
20326 09=<table class="wikitable">
20327 <tr>
20328 <td> cell
20329 </td></tr></table>
20330
20331 10=<p>Two
20332 </p><p>paragraphs
20333 </p>
20334 <p><br />
20335 </p><p><br />
20336 </p><p><br />
20337 </p><p><br />
20338 </p><p><br />
20339 </p>
20340 !! end
20341
20342 !! test
20343 preload: check <noinclude> and <includeonly>
20344 !! options
20345 preload
20346 !! wikitext
20347 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20348 !! html/php
20349 Hello kind world.
20350 !! end
20351
20352 !! test
20353 preload: check <onlyinclude>
20354 !! options
20355 preload
20356 !! wikitext
20357 Goodbye <onlyinclude>Hello world</onlyinclude>
20358 !! html/php
20359 Hello world
20360 !! end
20361
20362 !! test
20363 preload: can pass tags through if we want to
20364 !! options
20365 preload
20366 !! wikitext
20367 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20368 !! html/php
20369 <includeonly>Hello world</includeonly>
20370 !! end
20371
20372 !! test
20373 preload: check that it doesn't try to do tricks
20374 !! options
20375 preload
20376 !! wikitext
20377 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20378 !! html/php
20379 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20380 !! end
20381
20382 !! test
20383 Play a bit with r67090 and bug 3158
20384 !! wikitext
20385 <div style="width:50% !important">&nbsp;</div>
20386 <div style="width:50%&nbsp;!important">&nbsp;</div>
20387 <div style="width:50%&#160;!important">&nbsp;</div>
20388 <div style="border : solid;">&nbsp;</div>
20389 !! html/php
20390 <div style="width:50% !important">&#160;</div>
20391 <div style="width:50% !important">&#160;</div>
20392 <div style="width:50% !important">&#160;</div>
20393 <div style="border&#160;: solid;">&#160;</div>
20394
20395 !! html/parsoid
20396 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20397 <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>
20398 <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>
20399 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20400
20401 !! end
20402
20403 !! test
20404 HTML5 data attributes
20405 !! wikitext
20406 <span data-foo="bar">Baz</span>
20407 <p data-abc-def_hij="">Quuz</p>
20408 !! html
20409 <p><span data-foo="bar">Baz</span>
20410 </p>
20411 <p data-abc-def_hij="">Quuz</p>
20412
20413 !! end
20414
20415 !! test
20416 percent-encoding and + signs in internal links (Bug 26410)
20417 !! wikitext
20418 [[User:+%]] [[Page+title%]]
20419 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20420 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20421 [[%33%45]] [[%33%45+]]
20422 !! html/php
20423 <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>
20424 <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>
20425 <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>
20426 <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>
20427 </p>
20428 !! html/parsoid
20429 <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>
20430 <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>
20431 <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":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bar&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bar&amp;quot;},&amp;quot;dsr&amp;quot;:[94,101,2,2]}\">bar&lt;/a>"}'><a href="./File:%25+abc9"><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>
20432 <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>
20433 !! end
20434
20435 !! test
20436 Special characters in embedded file links (bug 27679)
20437 !! wikitext
20438 [[File:Contains & ampersand.jpg]]
20439 [[File:Does not exist.jpg|Title with & ampersand]]
20440 !! html/php
20441 <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>
20442 <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>
20443 </p>
20444 !! html/parsoid
20445 <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>
20446 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp;amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
20447 !! end
20448
20449 !! test
20450 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20451 !! wikitext
20452 Text&apos;s been normalized?
20453 !! html
20454 <p>Text&#39;s been normalized?
20455 </p>
20456 !! end
20457
20458 !! test
20459 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20460 !! wikitext
20461 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20462 !! html
20463 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20464 </p>
20465 !! end
20466
20467 !! test
20468 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20469 !! wikitext
20470 [http://www.example.org/ ideograms]
20471 !! html
20472 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20473 </p>
20474 !! end
20475
20476 !! test
20477 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20478 !! wikitext
20479 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20480 !! html
20481 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20482 </p>
20483 !! end
20484
20485 !! article
20486 Mediawiki:loop1
20487 !! text
20488 {{Identical|A}}
20489 !! endarticle
20490
20491 !! article
20492 Mediawiki:loop2
20493 !! text
20494 {{Identical|B}}
20495 !! endarticle
20496
20497 !! article
20498 Template:Identical
20499 !! text
20500 {{int:loop1}}
20501 {{int:loop2}}
20502 !! endarticle
20503
20504 !! test
20505 Bug 31098 Template which includes system messages which includes the template
20506 !! wikitext
20507 {{Identical}}
20508 !! html
20509 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20510 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20511 </p>
20512 !! end
20513
20514 !! test
20515 Bug31490 Turkish: ucfirst 'blah'
20516 !! options
20517 language=tr
20518 !! wikitext
20519 {{ucfirst:blah}}
20520 !! html
20521 <p>Blah
20522 </p>
20523 !! end
20524
20525 !! test
20526 Bug31490 Turkish: ucfirst 'ix'
20527 !! options
20528 language=tr
20529 !! wikitext
20530 {{ucfirst:ix}}
20531 !! html
20532 <p>İx
20533 </p>
20534 !! end
20535
20536 !! test
20537 Bug31490 Turkish: lcfirst 'BLAH'
20538 !! options
20539 language=tr
20540 !! wikitext
20541 {{lcfirst:BLAH}}
20542 !! html
20543 <p>bLAH
20544 </p>
20545 !! end
20546
20547 !! test
20548 Bug31490 Turkish: ucfırst (with a dotless i)
20549 !! options
20550 language=tr
20551 !! wikitext
20552 {{ucfırst:blah}}
20553 !! html
20554 <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>
20555 </p>
20556 !! end
20557
20558 !! test
20559 Bug31490 ucfırst (with a dotless i) with English language
20560 !! options
20561 language=en
20562 !! wikitext
20563 {{ucfırst:blah}}
20564 !! html
20565 <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>
20566 </p>
20567 !! end
20568
20569 !! test
20570 Bug 26375: TOC with italics
20571 !! options
20572 title=[[Main Page]]
20573 !! wikitext
20574 __TOC__
20575 == ''Lost'' episodes ==
20576 !! html
20577 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20578 <ul>
20579 <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>
20580 </ul>
20581 </div>
20582
20583 <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>
20584
20585 !! end
20586
20587 !! test
20588 Bug 26375: TOC with bold
20589 !! options
20590 title=[[Main Page]]
20591 !! wikitext
20592 __TOC__
20593 == '''should be bold''' then normal text ==
20594 !! html
20595 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20596 <ul>
20597 <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>
20598 </ul>
20599 </div>
20600
20601 <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>
20602
20603 !! end
20604
20605 !! test
20606 Bug 33845: Headings become cursive in TOC when they contain an image
20607 !! options
20608 title=[[Main Page]]
20609 !! wikitext
20610 __TOC__
20611 == Image [[Image:foobar.jpg]] ==
20612 !! html
20613 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20614 <ul>
20615 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20616 </ul>
20617 </div>
20618
20619 <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>
20620
20621 !! end
20622
20623 !! test
20624 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20625 !! options
20626 title=[[Main Page]]
20627 !! wikitext
20628 __TOC__
20629 == <blockquote>Quote</blockquote> ==
20630 !! html
20631 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20632 <ul>
20633 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20634 </ul>
20635 </div>
20636
20637 <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>
20638
20639 !! html+tidy
20640 <p></p>
20641 <div id="toc" class="toc">
20642 <div id="toctitle">
20643 <h2>Contents</h2>
20644 </div>
20645 <ul>
20646 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20647 </ul>
20648 </div>
20649 <p></p>
20650 <h2><span class="mw-headline" id="Quote"></span></h2>
20651 <blockquote>
20652 <p><span class="mw-headline" id="Quote">Quote</span></p>
20653 </blockquote>
20654 <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>
20655 !! end
20656
20657 !! test
20658 Unclosed tags in TOC
20659 !! options
20660 title=[[Main Page]]
20661 !! wikitext
20662 __TOC__
20663 == Proof: 2 < 3 ==
20664 <small>Hanc marginis exiguitas non caperet.</small>
20665 QED
20666 !! html
20667 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20668 <ul>
20669 <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>
20670 </ul>
20671 </div>
20672
20673 <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>
20674 <p><small>Hanc marginis exiguitas non caperet.</small>
20675 QED
20676 </p>
20677 !! end
20678
20679 !! test
20680 Multiple tags in TOC
20681 !! wikitext
20682 __TOC__
20683 == <i>Foo</i> <b>Bar</b> ==
20684
20685 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20686 !! html
20687 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20688 <ul>
20689 <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>
20690 <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>
20691 </ul>
20692 </div>
20693
20694 <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>
20695 <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>
20696
20697 !! html+tidy
20698 <p></p>
20699 <div id="toc" class="toc">
20700 <div id="toctitle">
20701 <h2>Contents</h2>
20702 </div>
20703 <ul>
20704 <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>
20705 <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>
20706 </ul>
20707 </div>
20708 <p></p>
20709 <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>
20710 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20711 <blockquote>
20712 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20713 </blockquote>
20714 <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>
20715 !! end
20716
20717 !! test
20718 Tags with parameters in TOC
20719 !! wikitext
20720 __TOC__
20721 == <sup class="in-h2">Hello</sup> ==
20722
20723 == <sup class="a > b">Evilbye</sup> ==
20724 !! html
20725 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20726 <ul>
20727 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20728 <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>
20729 </ul>
20730 </div>
20731
20732 <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>
20733 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20734
20735 !! end
20736
20737 !! test
20738 span tags with directionality in TOC
20739 !! wikitext
20740 __TOC__
20741 == <span dir="ltr">C++</span> ==
20742
20743 == <span dir="rtl">זבנג!</span> ==
20744
20745 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20746
20747 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20748
20749 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20750 !! html
20751 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20752 <ul>
20753 <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>
20754 <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>
20755 <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>
20756 <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>
20757 <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>
20758 </ul>
20759 </div>
20760
20761 <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>
20762 <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>
20763 <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>
20764 <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>
20765 <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>
20766
20767 !! end
20768
20769 !! test
20770 Bug 72884: bdi element in ToC
20771 !! wikitext
20772 __TOC__
20773 == <bdi>test</bdi> ==
20774 !! html
20775 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20776 <ul>
20777 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20778 </ul>
20779 </div>
20780
20781 <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>
20782
20783 !! end
20784
20785 # Note that the html output does not have the <p></p>, but the
20786 # html+tidy output *does*. This is because the empty <p></p> is
20787 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20788 !! test
20789 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20790 !! wikitext
20791 __TOC__
20792 == x ==
20793 !! html
20794 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20795 <ul>
20796 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20797 </ul>
20798 </div>
20799
20800 <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>
20801
20802 !! html+tidy
20803 <p></p>
20804 <div id="toc" class="toc">
20805 <div id="toctitle">
20806 <h2>Contents</h2>
20807 </div>
20808 <ul>
20809 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20810 </ul>
20811 </div>
20812 <p></p>
20813 <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>
20814 !! end
20815
20816 !! article
20817 MediaWiki:Bug32057
20818 !! text
20819 == {{int:headline_sample}} ==
20820 !! endarticle
20821
20822 !! test
20823 Bug 32057: Title needed when expanding <h> nodes.
20824 !! options
20825 title=[[Main Page]]
20826 !! wikitext
20827 {{int:Bug32057}}
20828 !! html
20829 <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>
20830
20831 !! end
20832
20833 !! test
20834 Strip marker in urlencode
20835 !! wikitext
20836 {{urlencode:x<nowiki/>y}}
20837 {{urlencode:x<nowiki/>y|wiki}}
20838 {{urlencode:x<nowiki/>y|path}}
20839 {{urlencode:x<pre id="one">two</pre>y}}
20840 !! html
20841 <p>xy
20842 xy
20843 xy
20844 xy
20845 </p>
20846 !! end
20847
20848 !! test
20849 Strip marker in lc
20850 !! wikitext
20851 {{lc:x<nowiki/>y}}
20852 !! html
20853 <p>xy
20854 </p>
20855 !! end
20856
20857 !! test
20858 Strip marker in uc
20859 !! wikitext
20860 {{uc:x<nowiki/>y}}
20861 !! html
20862 <p>XY
20863 </p>
20864 !! end
20865
20866 !! test
20867 Strip marker in formatNum
20868 !! wikitext
20869 {{formatnum:1<nowiki/>2}}
20870 {{formatnum:1<nowiki/>2|R}}
20871 !! html
20872 <p>12
20873 12
20874 </p>
20875 !! end
20876
20877 !! test
20878 Check noCommafy in formatNum
20879 !! options
20880 language=be-tarask
20881 !! wikitext
20882 {{formatnum:123456.78}}
20883 {{formatnum:123456.78|NOSEP}}
20884 !! html
20885 <p>123 456,78
20886 123456.78
20887 </p>
20888 !! end
20889
20890 !! test
20891 Wrong option for formatNum (bug 56199)
20892 !! wikitext
20893 {{formatnum:1,234.56|Random}}
20894 {{formatnum:1,234.56|EVERYTHING}}
20895 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20896 !! html
20897 <p>1,234.56
20898 1,234.56
20899 1,234.56
20900 </p>
20901 !! end
20902
20903 !! test
20904 Strip marker in grammar
20905 !! options
20906 language=fi
20907 !! wikitext
20908 {{grammar:elative|foo<nowiki/>bar}}
20909 !! html
20910 <p>foobarista
20911 </p>
20912 !! end
20913
20914 !! test
20915 Strip marker in padleft
20916 !! wikitext
20917 {{padleft:|2|x<nowiki/>y}}
20918 !! html
20919 <p>xy
20920 </p>
20921 !! end
20922
20923 !! test
20924 Strip marker in padright
20925 !! wikitext
20926 {{padright:|2|x<nowiki/>y}}
20927 !! html
20928 <p>xy
20929 </p>
20930 !! end
20931
20932 !! test
20933 Strip marker in anchorencode
20934 !! wikitext
20935 {{anchorencode:x<nowiki/>y}}
20936 !! html
20937 <p>xy
20938 </p>
20939 !! end
20940
20941 !! test
20942 nowiki inside link inside heading (bug 18295)
20943 !! wikitext
20944 ==[[foo|x<nowiki>y</nowiki>z]]==
20945 !! html
20946 <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>
20947
20948 !! end
20949
20950 !! test
20951 new support for bdi element (bug 31817)
20952 !! wikitext
20953 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20954 !! html
20955 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20956
20957 !!end
20958
20959 !! test
20960 Ignore pipe between table row attributes
20961 !! wikitext
20962 {|
20963 | quux
20964 |- id=foo | style='color: red'
20965 | bar
20966 |}
20967 !! html
20968 <table>
20969 <tr>
20970 <td> quux
20971 </td></tr>
20972 <tr id="foo" style="color: red">
20973 <td> bar
20974 </td></tr></table>
20975
20976 !! end
20977
20978 !!test
20979 Gallery override link with WikiLink (bug 34852)
20980 !! wikitext
20981 <gallery>
20982 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20983 </gallery>
20984 !! html
20985 <ul class="gallery mw-gallery-traditional">
20986 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20987 <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>
20988 <div class="gallerytext">
20989 <p>caption
20990 </p>
20991 </div>
20992 </div></li>
20993 </ul>
20994
20995 !! end
20996
20997 !!test
20998 Gallery override link with absolute external link (bug 34852)
20999 !! wikitext
21000 <gallery>
21001 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21002 </gallery>
21003 !! html
21004 <ul class="gallery mw-gallery-traditional">
21005 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21006 <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>
21007 <div class="gallerytext">
21008 <p>caption
21009 </p>
21010 </div>
21011 </div></li>
21012 </ul>
21013
21014 !! end
21015
21016 !!test
21017 Gallery override link with malicious javascript (bug 34852)
21018 !! wikitext
21019 <gallery>
21020 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21021 </gallery>
21022 !! html
21023 <ul class="gallery mw-gallery-traditional">
21024 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21025 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(&#39;malicious_javascript_code!&#39;);"><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>
21026 <div class="gallerytext">
21027 <p>caption
21028 </p>
21029 </div>
21030 </div></li>
21031 </ul>
21032
21033 !! end
21034
21035 !!test
21036 Gallery with invalid title as link (bug 43964)
21037 !! wikitext
21038 <gallery>
21039 File:foobar.jpg|link=<
21040 </gallery>
21041 !! html
21042 <ul class="gallery mw-gallery-traditional">
21043 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21044 <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>
21045 <div class="gallerytext">
21046 </div>
21047 </div></li>
21048 </ul>
21049
21050 !! end
21051
21052 !!test
21053 Language parser function
21054 !! wikitext
21055 {{#language:ar}}
21056 !! html
21057 <p>العربية
21058 </p>
21059 !! end
21060
21061 !!test
21062 Padleft and padright as substr
21063 !! wikitext
21064 {{padleft:|3|abcde}}
21065 {{padright:|3|abcde}}
21066 !! html
21067 <p>abc
21068 abc
21069 </p>
21070 !! end
21071
21072 !!test
21073 Special parser function
21074 !! wikitext
21075 {{#special:RandomPage}}
21076 {{#special:BaDtItLe}}
21077 {{#special:Foobar}}
21078 !! html
21079 <p>Special:Random
21080 Special:Badtitle
21081 Special:Foobar
21082 </p>
21083 !! end
21084
21085 !!test
21086 Bug 34939 - Case insensitive link parsing ([HttP://])
21087 !! wikitext
21088 [HttP://MediaWiki.Org/]
21089 !! html/php
21090 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21091 </p>
21092 !! html/parsoid
21093 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21094 !! end
21095
21096 !!test
21097 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21098 !! wikitext
21099 [HttP://MediaWiki.Org/ MediaWiki]
21100 !! html
21101 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21102 </p>
21103 !! end
21104
21105 !!test
21106 Bug 34939 - Case insensitive link parsing (HttP://)
21107 !! wikitext
21108 HttP://MediaWiki.Org/
21109 !! html/php
21110 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21111 </p>
21112 !! html/parsoid
21113 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21114 !! end
21115
21116 !!test
21117 Disable TOC
21118 !! options
21119 notoc
21120 !! wikitext
21121 Lead
21122 == Section 1 ==
21123 == Section 2 ==
21124 == Section 3 ==
21125 == Section 4 ==
21126 == Section 5 ==
21127 !! html
21128 <p>Lead
21129 </p>
21130
21131 <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>
21132 <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>
21133 <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>
21134 <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>
21135 <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>
21136
21137 !! end
21138
21139
21140 ###
21141 ### Parsoid-specific tests
21142 ### Parsoid-PHP parser incompatibilities
21143 ###
21144 !!test
21145 1. SOL-sensitive wikitext tokens as template-args
21146 !!options
21147 parsoid=wt2html,wt2wt
21148 !! wikitext
21149 {{echo|*a}}
21150 {{echo|#a}}
21151 {{echo|:a}}
21152 !! html
21153 <span about="#mwt1" typeof="mw:Transclusion">
21154 </span><ul about="#mwt1"><li>a</li>
21155 </ul>
21156 <span about="#mwt2" typeof="mw:Transclusion">
21157 </span><ol about="#mwt2"><li>a</li>
21158 </ol>
21159 <span about="#mwt3" typeof="mw:Transclusion">
21160 </span><dl about="#mwt3"><dd>a</dd>
21161 </dl>
21162 !!end
21163
21164 #### -----------------------------------------------------------------
21165 #### Parsoid-specific functionality tests
21166 #### -----------------------------------------------------------------
21167
21168 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21169 # We know wt2wt will fail, but we expect selser to pass.
21170 # Due to the nature of our testing, wt2wt and selser tests will enter the
21171 # blacklist and we'll catch selser regressions based on changes to the
21172 # blacklist entries for selser tests.
21173 !! test
21174 1. Bad treebuilder fixup of formatting elt is cleaned up
21175 !! options
21176 parsoid=wt2html,wt2wt
21177 !! wikitext
21178 {|
21179 |
21180 <small>
21181 [[Image:Foobar.jpg|right|Test]]
21182 </small>
21183 |}
21184 !! html/parsoid
21185 <table>
21186 <tbody><tr><td>
21187 <small>
21188 <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>
21189 </small>
21190 </td></tr>
21191 </tbody></table>
21192 !! end
21193
21194 !! test
21195 2. Bad treebuilder fixup of formatting elt is cleaned up
21196 !! options
21197 parsoid=wt2html,wt2wt
21198 !! wikitext
21199 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21200
21201 <small>[[Image:Foobar.jpg|right|300px]]</small>
21202 !! html/parsoid
21203
21204 <p><b>foo</b></p>
21205 <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>
21206 <p><b>bar</b></p>
21207 <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>
21208 !! end
21209
21210 !! test
21211 3. Bad treebuilder fixup of formatting elt is cleaned up
21212 !! options
21213 parsoid=wt2html,wt2wt
21214 !! wikitext
21215 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21216 !! html/parsoid
21217 <p><small><b>foo</b></small></p>
21218 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><small><b>caption</b></small></figcaption></figure>
21219 <p><small><b>bar</b></small></p>
21220 !! end
21221
21222 !! test
21223 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21224 !! options
21225 parsoid=wt2html,wt2wt
21226 !! wikitext
21227 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21228 !! html/parsoid
21229 <p><b><small></small></b></p>
21230 <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>
21231 <p></p>
21232 !! end
21233
21234 #### ----------------------------------------------------------------
21235 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21236 #### tags. Parsoid's output for these tags differs from that of the
21237 #### PHP parser.
21238 #### ----------------------------------------------------------------
21239
21240 !!test
21241 Ref: 1. ref-location should be replaced with an index span
21242 !!options
21243 parsoid
21244 !! wikitext
21245 A <ref>foo</ref>
21246 B <ref name="x">foo</ref>
21247 C <ref name="y" />
21248 <references />
21249 !! html
21250 <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>
21251 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>
21252 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>
21253 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21254 <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>
21255 <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>
21256 <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>
21257 </ol>
21258 !!end
21259
21260 !!test
21261 Ref: 2. ref-tags with identical names should all get the same index
21262 !!options
21263 parsoid
21264 !! wikitext
21265 A <ref name="x">foo</ref>
21266 B <ref name="x" />
21267 <references />
21268 !! html
21269 <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>
21270 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>
21271 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21272 <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>
21273 </ol>
21274 !!end
21275
21276 !!test
21277 Ref: 3. spaces in ref-names should be ignored
21278 !!options
21279 parsoid
21280 !! wikitext
21281 A <ref name="x">foo</ref>
21282 B <ref name=" x " />
21283 C <ref name= x />
21284 <references />
21285 !! html
21286 <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>
21287 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>
21288 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>
21289 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21290 <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>
21291 </ol>
21292 !!end
21293
21294 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21295 !!test
21296 Ref: 4. 'constructor' should be accepted as a valid ref-name
21297 !!options
21298 parsoid
21299 !! wikitext
21300 A <ref name="constructor">foo</ref>
21301 <references />
21302 !! html
21303 <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>
21304 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21305 <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>
21306 </ol>
21307 !!end
21308
21309 !!test
21310 Ref: 5. body should accept generic wikitext
21311 !!options
21312 parsoid
21313 !! wikitext
21314 A <ref>
21315 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21316 </ref>
21317
21318 <references />
21319 !! html
21320 <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>
21321
21322 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21323 <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>
21324 </span></li>
21325 </ol>
21326 !!end
21327
21328 !!test
21329 Ref: 6. indent-pres should not be output in ref-body
21330 !!options
21331 parsoid
21332 !! wikitext
21333 A <ref>
21334 foo
21335 bar
21336 baz
21337 </ref>
21338
21339 <references />
21340 !! html
21341 <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>
21342
21343 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21344 <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
21345 bar
21346 baz
21347 </span></li>
21348 </ol>
21349 !!end
21350
21351 !!test
21352 Ref: 7. No p-wrapping in ref-body
21353 !!options
21354 parsoid
21355 !! wikitext
21356 A <ref>
21357 foo
21358
21359 bar
21360
21361
21362 baz
21363
21364
21365
21366 booz
21367 </ref>
21368
21369 <references />
21370 !! html
21371 <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>
21372
21373 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21374 <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
21375
21376 bar
21377
21378
21379 baz
21380
21381
21382
21383 booz
21384 </span></li>
21385 </ol>
21386 !!end
21387
21388 !!test
21389 Ref: 8. transclusion wikitext has lower precedence
21390 !!options
21391 parsoid
21392 !! wikitext
21393 A <ref> foo {{echo|</ref> B C}}
21394
21395 <references />
21396 !! html
21397 <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>
21398 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21399 <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>
21400 </ol>
21401 !!end
21402
21403 !!test
21404 Ref: 9. unclosed comments should not leak out of ref-body
21405 !!options
21406 parsoid
21407 !! wikitext
21408 A <ref> foo <!--</ref> B C
21409 <references />
21410 !! html
21411 <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>
21412 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21413 <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>
21414 </ol>
21415 !!end
21416
21417 !!test
21418 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21419 !!options
21420 parsoid
21421 !! wikitext
21422 A <ref> <b> foo </ref> B C
21423
21424 <references />
21425 !! html
21426 <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>
21427
21428
21429 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21430 <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>
21431 </ol>
21432 !!end
21433
21434 !!test
21435 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21436 !!options
21437 parsoid
21438 !! wikitext
21439 A <ref>foo</ref> B
21440 C <ref>bar</ref> D
21441 <references />
21442 !! html
21443 <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
21444 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>
21445 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21446 <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>
21447 <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>
21448 </ol>
21449 !!end
21450
21451 !!test
21452 Ref: 12. ref-tags act as trailing newline migration barrier
21453 !! wikitext
21454 <!--the newline at the end of this line moves out of the p tag-->a
21455
21456 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21457 <ref />
21458
21459 c
21460 <references />
21461 !! html/parsoid
21462 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21463
21464
21465 <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>
21466 <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>
21467
21468 <p>c</p>
21469 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21470 <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>
21471 <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>
21472 !!end
21473
21474 !!test
21475 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21476 !!options
21477 parsoid
21478 !! wikitext
21479 <ref>foo</ref> A
21480 <ref>bar
21481 </ref> B
21482 <references />
21483 !! html
21484 <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
21485 <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>
21486 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21487 <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>
21488 <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
21489 </span></li>
21490 </ol>
21491 !!end
21492
21493 !!test
21494 Ref: 14. A nested ref-tag should be emitted as plain text
21495 !!options
21496 parsoid
21497 !! wikitext
21498 <ref>foo <ref>bar</ref> baz</ref>
21499
21500 <references />
21501 !! html
21502 <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>
21503 </p>
21504 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21505 <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>
21506 </ol>
21507 !!end
21508
21509 !!test
21510 Ref: 15. ref-tags with identical names should get identical indexes
21511 !!options
21512 parsoid
21513 !! wikitext
21514 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21515 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21516
21517 <references />
21518 !! html
21519 <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>
21520 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>
21521
21522 <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>
21523 </ol>
21524 !!end
21525
21526 ## We don't bother wt2wt-ing non-standard whitespace
21527 !!test
21528 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21529 !!options
21530 parsoid=wt2html
21531 !! wikitext
21532 A <ref >foo</ref >
21533
21534 <references />
21535 !! html
21536 <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>
21537 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21538 <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>
21539 !!end
21540
21541 !!test
21542 Ref: 17. Generate valid HTML5 id/about attributes
21543 !!options
21544 parsoid
21545 !!wikitext
21546 <ref name="a b">foo</ref>
21547
21548 <references />
21549 !!html
21550 <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>
21551 </p>
21552
21553 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21554 <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>
21555 </ol>
21556 !!end
21557
21558 !!test
21559 Ref: 18. T58916: Extension attributes should be parsed as plain text
21560 !!options
21561 parsoid
21562 !!wikitext
21563 <ref name="{{echo|a}}">foo</ref>
21564
21565 <references />
21566 !!html
21567 <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>
21568 </p>
21569
21570 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21571 <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>
21572 </ol>
21573 !!end
21574
21575 !!test
21576 Ref: 19. ref-tags with identical name encodings should get identical indexes
21577 !!options
21578 parsoid
21579 !! wikitext
21580 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21581
21582 <references />
21583 !! html
21584 <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>
21585 </p>
21586 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21587 <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>
21588 </ol>
21589 !!end
21590
21591 !!test
21592 Ref: 20. ref-tags with identical names but different content should keep it
21593 !!options
21594 parsoid
21595 !! wikitext
21596 A <ref name="foo">Foo one</ref>
21597 B <ref name="foo">Foo two</ref>
21598 C <ref name="foo" />
21599
21600 <references />
21601 !! html
21602 <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>
21603 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>
21604 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>
21605
21606 <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>
21607 </ol>
21608 !!end
21609
21610 !!test
21611 References: 1. references tag without any refs should be handled properly
21612 !! wikitext
21613 <references />
21614 !! html/parsoid
21615 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21616 !!end
21617
21618 !!test
21619 References: 2. references tag with group only outputs references from that group
21620 !! wikitext
21621 A <ref group="a">foo</ref>
21622 B <ref group="b">bar</ref>
21623 C <ref>baz</ref>
21624
21625 <references group="a" />
21626 <references />
21627 <references group="b" />
21628 !! html/parsoid
21629 <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>
21630 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>
21631 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>
21632
21633 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21634 <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>
21635 </ol>
21636 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21637 <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>
21638 </ol>
21639 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21640 <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>
21641 </ol>
21642 !!end
21643
21644 !!test
21645 References: 3. ref list should be cleared after processing references
21646 !! wikitext
21647 A <ref>foo</ref>
21648
21649 <references />
21650
21651 B <ref>bar</ref>
21652
21653 <references />
21654 !! html/parsoid
21655 <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>
21656
21657 <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>
21658 </ol>
21659
21660 <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>
21661
21662 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21663 <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>
21664 </ol>
21665 !!end
21666
21667 !!test
21668 References: 4. only referenced group should be cleared after processing references
21669 !! wikitext
21670 A <ref group="a">afoo</ref>
21671 B <ref>bfoo</ref>
21672
21673 <references group="a" />
21674
21675 C <ref>cfoo</ref>
21676
21677 <references />
21678 !! html/parsoid
21679 <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>
21680 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>
21681
21682 <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>
21683 </ol>
21684
21685 <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>
21686
21687 <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>
21688 </ol>
21689 !!end
21690
21691 !!test
21692 References: 5. ref tags in references should be processed while ignoring all other content
21693 !! wikitext
21694 A <ref name="a" />
21695 B <ref name="b">bar</ref>
21696
21697 <references>
21698 <ref name="a">foo</ref>
21699 This should just get lost.
21700 </references>
21701 !! html/parsoid
21702 <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>
21703 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>
21704
21705
21706 <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>
21707 </ol>
21708 !!end
21709
21710 !!test
21711 References: 6. <references /> from a transclusion
21712 !! wikitext
21713 <ref>Foo</ref> {{echo|<references />}}
21714 !! html/parsoid
21715 <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>
21716 </ol>
21717 !!end
21718
21719 !! test
21720 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21721 !! wikitext
21722 A <ref>foo bar for a</ref>
21723 B <ref group="X" name="b" />
21724
21725 <references />
21726
21727 <references group="X">
21728 <ref name="b">foo</ref>
21729 </references>
21730 !! html/parsoid
21731 <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>
21732 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>
21733 </p>
21734
21735 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21736 <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>
21737 </ol>
21738
21739 <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"}}'>
21740 <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>
21741 </ol>
21742 !! end
21743
21744 !! test
21745 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21746 !! wikitext
21747 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21748 <references />
21749 !! html/parsoid
21750 <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>
21751 <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>
21752 </ol>
21753 !!end
21754
21755 # This test only works in wt2html now as the <references /> are always generated
21756 # unless selser is active. Once T72722 is fixed, we should add a changes test
21757 # here to ensure that unrelated changes don't add the new <references /> in
21758 # wt2wt.
21759 !! test
21760 References: 9. Generate missing references list at the end
21761 !! wikitext
21762 A <ref>foo</ref>
21763 B <ref group="inexistent">bar</ref>
21764 !! html/parsoid
21765 <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>
21766 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21767 <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>
21768 </ol>
21769 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21770 <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>
21771 </ol>
21772 !! end
21773
21774 !! test
21775 References: 10. New <references/> shouldn't be added for unrelated edits.
21776 !! options
21777 parsoid={
21778 "modes": ["selser"],
21779 "changes": [["#x", "remove"]],
21780 "selser": "noauto"
21781 }
21782 !! wikitext
21783 Unrelated text<span id="x"> that's going to disappear</span>.
21784 A <ref>foo</ref>
21785 !! wikitext/edited
21786 Unrelated text.
21787 A <ref>foo</ref>
21788 !!end
21789
21790 !! test
21791 Entities in ref name
21792 !! wikitext
21793 <ref name="test &amp; me">hi</ref>
21794 <references />
21795 !! html/parsoid
21796 <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>
21797 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21798 <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>
21799 </ol>
21800 !! end
21801
21802 # This test is wt2html only because we're permitting the serializer to produce
21803 # dirty diffs, normalizing the unclosed references to the self-closed version.
21804 !! test
21805 Generate references for unclosed references tag
21806 !! options
21807 parsoid=wt2html
21808 !! wikitext
21809 a<ref>foo</ref>
21810
21811 <references>
21812 !! html/parsoid
21813 <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>
21814 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21815 <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>
21816 !! end
21817
21818 !! test
21819 New reference serializes on its own line
21820 !! options
21821 parsoid=wt2wt,html2wt
21822 !! wikitext
21823 foo
21824 <references />
21825 !! html/parsoid
21826 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21827 !! end
21828
21829 #### ----------------------------------------------------------------
21830 #### Parsoid-only testing of Parsoid's impl of LST
21831 #### Not implemented yet, see
21832 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21833 #### ----------------------------------------------------------------
21834
21835 !!test
21836 LST Sections: 1. Simple section start and end
21837 !! wikitext
21838 <section begin="2011-05-16" />
21839 <section end="2014-04-10 (MW 1.23wmf22)" />
21840 !! html/parsoid
21841 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21842 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21843 !! end
21844
21845 #--------- Test stripping of empty nodes in template content ----------
21846 !!test
21847 Empty LI and TR nodes should be stripped from template content
21848 !!wikitext
21849 {{EmptyLITest}}
21850 {{EmptyTRTest}}
21851 !!html/parsoid
21852 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21853 <li>a</li>
21854 <li>b</li>
21855 </ul>
21856 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21857 <tbody>
21858 <tr>
21859 <td>foo</td>
21860 </tr>
21861 <tr>
21862 <td>bar</td>
21863 </tr>
21864 </tbody>
21865 </table>
21866 !!end
21867
21868 !!test
21869 Empty LI and TR nodes should not be stripped from top-level content
21870 !!wikitext
21871 * a
21872 *
21873 * b
21874 {|
21875 |-
21876 |-
21877 |foo
21878 |}
21879 !!html/parsoid
21880 <ul>
21881 <li> a</li>
21882 <li></li>
21883 <li> b</li>
21884 </ul>
21885 <table>
21886 <tbody>
21887 <tr></tr>
21888 <tr>
21889 <td>foo</td>
21890 </tr>
21891 </tbody>
21892 </table>
21893 !!end
21894
21895 !!test
21896 Empty TR nodes should not be stripped if they have any attributes set
21897 !!wikitext
21898 {{EmptyTRWithHTMLAttrTest}}
21899 !!html/parsoid
21900 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21901 <tr align="center"></tr>
21902 <tr><td>foo</td></tr>
21903 <tr align="center"></tr>
21904 <tr><td>bar</td></tr>
21905 </table>
21906 !!end
21907
21908 #### ----------------------------------------------------------------
21909 #### The following section of tests are primarily to test
21910 #### wikitext escaping capabilities of Parsoid. Given that
21911 #### escaping can be done any number of ways, the wikitext (input)
21912 #### is always adjusted to reflect how Parsoid adds nowiki
21913 #### escape tags.
21914 ####
21915 #### We are marking several tests as parsoid-only since the
21916 #### HTML in the result section is different from what the
21917 #### PHP parser generates for it.
21918 #### ----------------------------------------------------------------
21919
21920
21921 #### --------------- Headings ---------------
21922 #### 0. Unnested
21923 #### 1. Nested inside html <h1>=foo=</h1>
21924 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21925 #### 3. Nested inside html with wikitext split by html tags
21926 #### 4. No escape needed
21927 #### 5. Empty headings <h1></h1>
21928 #### 6. Heading chars in SOL context
21929 #### ----------------------------------------
21930 !! test
21931 Headings: 0. Unnested
21932 !! options
21933 parsoid=html2wt
21934 !! html/parsoid
21935 <p>=foo=</p>
21936
21937 <p> =foo=
21938 <!--cmt-->
21939 =foo=</p>
21940
21941 <p>=foo<i>a</i>=</p>
21942 !! wikitext
21943 <nowiki>=foo=</nowiki>
21944
21945 <nowiki> </nowiki>=foo=
21946 <!--cmt-->
21947 <nowiki>=foo=</nowiki>
21948
21949 =foo''a''<nowiki>=</nowiki>
21950 !!end
21951
21952 # New headings and existing headings are handled differently
21953 !! test
21954 Headings: 1. Nested inside html
21955 !! options
21956 parsoid=html2wt
21957 !! html/parsoid
21958 <h1>=foo=</h1>
21959 <h2>=foo=</h2>
21960 <h3>=foo=</h3>
21961
21962 <h1 data-parsoid=''>=foo=</h1>
21963 <h2 data-parsoid=''>=foo=</h2>
21964 <h3 data-parsoid=''>=foo=</h3>
21965 <h4 data-parsoid=''>=foo=</h4>
21966 <h5 data-parsoid=''>=foo=</h5>
21967 <h6 data-parsoid=''>=foo=</h6>
21968 !! wikitext
21969 = =foo= =
21970
21971 == =foo= ==
21972
21973 === =foo= ===
21974
21975 =<nowiki>=foo=</nowiki>=
21976 ==<nowiki>=foo=</nowiki>==
21977 ===<nowiki>=foo=</nowiki>===
21978 ====<nowiki>=foo=</nowiki>====
21979 =====<nowiki>=foo=</nowiki>=====
21980 ======<nowiki>=foo=</nowiki>======
21981
21982 !!end
21983
21984 !! test
21985 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21986 !! options
21987 parsoid=html2wt
21988 !! html/parsoid
21989 <h1>foo</h1>*bar
21990 <h1>foo</h1>=bar
21991 <h1>foo</h1>=bar=
21992 !! wikitext
21993 = foo =
21994 <nowiki>*</nowiki>bar
21995
21996 = foo =
21997 =bar
21998
21999 = foo =
22000 <nowiki>=bar=</nowiki>
22001 !!end
22002
22003 !! test
22004 Headings: 3. Nested inside html with wikitext split by html tags
22005 !! options
22006 parsoid=html2wt
22007 !! html/parsoid
22008 <h1>=<b>bold</b>foo=</h1>
22009 !! wikitext
22010 = ='''bold'''<nowiki>foo=</nowiki> =
22011 !!end
22012
22013 !! test
22014 Headings: 4a. No escaping needed (testing just h1 and h2)
22015 !! options
22016 parsoid=html2wt
22017 !! html/parsoid
22018 <h1>=foo</h1>
22019 <h1>foo=</h1>
22020 <h1> =foo= </h1>
22021 <h1>=foo= bar</h1>
22022 <h2>=foo</h2>
22023 <h2>foo=</h2>
22024 <h1>=</h1>
22025 <h1><i>=</i>foo=</h1>
22026 !! wikitext
22027 = =foo =
22028
22029 = foo= =
22030
22031 = =foo= =
22032
22033 = =foo= bar =
22034
22035 == =foo ==
22036
22037 == foo= ==
22038
22039 = = =
22040
22041 = ''=''foo= =
22042 !!end
22043
22044 !! test
22045 Headings: 4b. No escaping needed (inside p-tags)
22046 !! options
22047 parsoid=html2wt
22048 !! html/parsoid
22049 <p>===
22050 =foo= x
22051 =foo= <s></s>
22052 </p>
22053 !! wikitext
22054 ===
22055 =foo= x
22056 =foo= <s></s>
22057 !!end
22058
22059 !! test
22060 Headings: 5. Empty headings
22061 !! options
22062 parsoid=html2wt
22063 !! html/parsoid
22064 <h1 data-parsoid='{}'></h1>
22065
22066 <h2 data-parsoid='{}'></h2>
22067
22068 <h3 data-parsoid='{}'></h3>
22069
22070 <h4 data-parsoid='{}'></h4>
22071
22072 <h5 data-parsoid='{}'></h5>
22073
22074 <h6 data-parsoid='{}'></h6>
22075 !! wikitext
22076 =<nowiki/>=
22077
22078 ==<nowiki/>==
22079
22080 ===<nowiki/>===
22081
22082 ====<nowiki/>====
22083
22084 =====<nowiki/>=====
22085
22086 ======<nowiki/>======
22087 !!end
22088
22089 !! test
22090 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22091 !! options
22092 parsoid=html2wt
22093 !! html/parsoid
22094 <p>=a=</p>
22095
22096 <p>=a=</p>
22097
22098 <p>=a=</p>
22099 !! wikitext
22100 <nowiki>=a=</nowiki>
22101
22102 <nowiki>=a=</nowiki>
22103
22104 <nowiki>=a=</nowiki>
22105 !!end
22106
22107 !! test
22108 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22109 !! options
22110 parsoid=html2wt
22111 !! html/parsoid
22112 <p>=a=
22113 b</p>
22114
22115 <p>=a=
22116 b</p>
22117
22118 <p>=a=
22119 b</p>
22120 !! wikitext
22121 <nowiki>=a=</nowiki>
22122 b
22123
22124 <nowiki>=a=</nowiki>
22125 b
22126
22127 <nowiki>=a=</nowiki>
22128 b
22129 !!end
22130
22131 !! test
22132 Headings: 6c. Heading chars in SOL context (leading newline break)
22133 !! options
22134 parsoid=html2wt
22135 !! html/parsoid
22136 <p>a
22137 =b=</p>
22138 !! wikitext
22139 a
22140 <nowiki>=b=</nowiki>
22141 !!end
22142
22143 !! test
22144 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22145 !! options
22146 parsoid=html2wt
22147 !! html/parsoid
22148 <!--c0--><p>=a=</p>
22149
22150 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22151 !! wikitext
22152 <!--c0--><nowiki>=a=</nowiki>
22153
22154 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22155 !!end
22156
22157 !! test
22158 Headings: 6d. Heading chars in SOL context (No escaping needed)
22159 !! options
22160 parsoid=html2wt
22161 !! html/parsoid
22162 =a=<div>b</div>
22163 !! wikitext
22164 =a=<div>b</div>
22165 !!end
22166
22167 !! test
22168 Headings: 7. Insert a newline between new content and headings
22169 !! options
22170 parsoid=html2wt
22171 !! html/parsoid
22172 <h2>NEW</h2>
22173 <p>new</p>
22174 <h2 data-parsoid='{}'>A</h2>
22175 <p data-parsoid='{}'>a</p>
22176 !! wikitext
22177 == NEW ==
22178 new
22179
22180 ==A==
22181 a
22182
22183 !! end
22184
22185 #### --------------- Lists ---------------
22186 #### 0. Outside nests (*foo, etc.)
22187 #### 1. Nested inside html <ul><li>*foo</li></ul>
22188 #### 2. Inside definition lists
22189 #### 3. Only bullets at start should be escaped
22190 #### 4. No escapes needed
22191 #### 5. No unnecessary escapes
22192 #### 6. Escape bullets in SOL position
22193 #### 7. Escape bullets in a multi-line context
22194 #### ----------------------------------------
22195
22196 !! test
22197 Lists: 0. Outside nests
22198 !! options
22199 parsoid=html2wt
22200 !! html/parsoid
22201 <p>*foo</p>
22202
22203 <p>#foo</p>
22204
22205 <p>;Foo:bar</p>
22206 !! wikitext
22207 <nowiki>*</nowiki>foo
22208
22209 <nowiki>#</nowiki>foo
22210
22211 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22212 !!end
22213
22214 !! test
22215 Lists: 1. Nested inside html
22216 !! options
22217 parsoid=html2wt
22218 !! html/parsoid
22219 <ul><li>*foo</li></ul>
22220 <ul><li>#foo</li></ul>
22221 <ul><li>:foo</li></ul>
22222 <ul><li>;foo</li></ul>
22223 <ol><li>*foo</li></ol>
22224 <ol><li>#foo</li></ol>
22225 <ol><li>:foo</li></ol>
22226 <ol><li>;foo</li></ol>
22227
22228 !! wikitext
22229 *<nowiki>*foo</nowiki>
22230
22231 *<nowiki>#foo</nowiki>
22232
22233 *<nowiki>:foo</nowiki>
22234
22235 *<nowiki>;foo</nowiki>
22236
22237 #<nowiki>*foo</nowiki>
22238
22239 #<nowiki>#foo</nowiki>
22240
22241 #<nowiki>:foo</nowiki>
22242
22243 #<nowiki>;foo</nowiki>
22244 !!end
22245
22246 !! test
22247 Lists: 2. Inside definition lists
22248 !! options
22249 parsoid=html2wt
22250 !! html/parsoid
22251 <dl><dt>;foo</dt></dl>
22252 <dl><dt>:foo</dt></dl>
22253 <dl><dt>:foo</dt>
22254 <dd>bar</dd></dl>
22255 <dl><dd>:foo</dd></dl>
22256
22257 !! wikitext
22258 ;<nowiki>;foo</nowiki>
22259
22260 ;<nowiki>:foo</nowiki>
22261
22262 ;<nowiki>:foo</nowiki>
22263 :bar
22264
22265 :<nowiki>:foo</nowiki>
22266 !!end
22267
22268 !! test
22269 Lists: 3. Only bullets at start of text should be escaped
22270 !! options
22271 parsoid=html2wt
22272 !! html/parsoid
22273 <ul><li>*foo*bar</li></ul>
22274 <ul><li>*foo<i>it</i>*bar</li></ul>
22275
22276 !! wikitext
22277 *<nowiki>*foo*bar</nowiki>
22278
22279 *<nowiki>*foo</nowiki>''it''*bar
22280 !!end
22281
22282 !! test
22283 Lists: 4. No escapes needed
22284 !! options
22285 parsoid=html2wt
22286 !! html/parsoid
22287 <ul>
22288 <li>foo*bar
22289 </li>
22290 </ul>
22291 <ul>
22292 <li><i>foo</i>*bar
22293 </li>
22294 </ul>
22295 <ul>
22296 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22297 </li>
22298 </ul>
22299 <ul>
22300 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22301 </li>
22302 </ul>
22303 !! wikitext
22304 *foo*bar
22305
22306 *''foo''*bar
22307
22308 *[[Foo]]: bar
22309
22310 *[[Foo]]*bar
22311 !!end
22312
22313 !! test
22314 Lists: 5. No unnecessary escapes
22315 !! options
22316 parsoid=html2wt
22317 !! html/parsoid
22318 <ul><li> bar <span>[[foo]]</span></li></ul>
22319 <ul><li> =bar <span>[[foo]]</span></li></ul>
22320 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22321 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22322 <ul><li> =bar <span>foo]]</span>=</li></ul>
22323 <ul><li> <s></s>: a</li></ul>
22324 <ul><li> <i>* foo</i></li></ul>
22325
22326 !! wikitext
22327 * bar <span><nowiki>[[foo]]</nowiki></span>
22328
22329 * =bar <span><nowiki>[[foo]]</nowiki></span>
22330
22331 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22332
22333 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22334
22335 * =bar <span>foo]]</span>=
22336
22337 * <s></s>: a
22338
22339 * ''* foo''
22340 !!end
22341
22342 !! test
22343 Lists: 6. Escape bullets in SOL position
22344 !! options
22345 parsoid=html2wt
22346 !! html/parsoid
22347 <p><!--cmt-->*foo</p>
22348 !! wikitext
22349 <!--cmt--><nowiki>*</nowiki>foo
22350 !!end
22351
22352 !! test
22353 Lists: 7. Escape bullets in a multi-line context
22354 !! options
22355 parsoid=html2wt
22356 !! html/parsoid
22357 <p>a
22358 *b
22359 </p>
22360 !! wikitext
22361 a
22362 <nowiki>*</nowiki>b
22363 !!end
22364
22365 !! test
22366 Lists: 8. Escape colons only if not present in tags
22367 !! options
22368 parsoid=html2wt
22369 !! html/parsoid
22370 <dl><dt>a:b<i>c:d</i></dt></dl>
22371 !! wikitext
22372 ; <nowiki>a:b</nowiki>''c:d''
22373 !! end
22374
22375 #### --------------- HRs ---------------
22376 #### 1. Single line
22377 #### -----------------------------------
22378
22379 !! test
22380 HRs: 1. Single line
22381 !! options
22382 parsoid=html2wt
22383 !! html/parsoid
22384 <hr />----
22385 <hr />=foo=
22386 <hr />*foo
22387 !! wikitext
22388 ----<nowiki>----</nowiki>
22389 ----=foo=
22390 ----*foo
22391 !! end
22392
22393 #### --------------- Tables ---------------
22394 #### 1a. Simple example
22395 #### 1b. No escaping needed (!foo)
22396 #### 1c. No escaping needed (|foo)
22397 #### 1d. No escaping needed (|}foo)
22398 ####
22399 #### 2a. Nested in td (<td>foo|bar</td>)
22400 #### 2b. Nested in td (<td>foo||bar</td>)
22401 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22402 ####
22403 #### 3a. Nested in th (<th>foo!bar</th>)
22404 #### 3b. Nested in th (<th>foo!!bar</th>)
22405 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22406 ####
22407 #### 4a. Escape -
22408 #### 4b. Escape +
22409 #### 4c. No escaping needed
22410 #### --------------------------------------
22411
22412 !! test
22413 Tables: 1a. Simple example
22414 !! options
22415 parsoid=html2wt
22416 !! html/parsoid
22417 <p>{|
22418 |}
22419 </p>
22420 !! wikitext
22421 <nowiki>{|
22422 |}</nowiki>
22423 !! end
22424
22425 !! test
22426 Tables: 1b. No escaping needed
22427 !! options
22428 parsoid=html2wt
22429 !! html/parsoid
22430 <p>!foo
22431 </p>
22432 !! wikitext
22433 !foo
22434 !! end
22435
22436 !! test
22437 Tables: 1c. No escaping needed
22438 !! options
22439 parsoid=html2wt
22440 !! html/parsoid
22441 <p>|foo
22442 </p>
22443 !! wikitext
22444 |foo
22445 !! end
22446
22447 !! test
22448 Tables: 1d. No escaping needed
22449 !! options
22450 parsoid=html2wt
22451 !! html/parsoid
22452 <p>|}foo
22453 </p>
22454 !! wikitext
22455 |}foo
22456 !! end
22457
22458 !! test
22459 Tables: 2a. Nested in td
22460 !! options
22461 parsoid=html2wt
22462 !! html/parsoid
22463 <table><tbody><tr>
22464 <td>foo|bar</td></tr>
22465 <tr><td>x<div>a|b</div></td>
22466 </tbody></table>
22467 !! wikitext
22468 {|
22469 |<nowiki>foo|bar</nowiki>
22470 |-
22471 |x<div><nowiki>a|b</nowiki></div>
22472 |}
22473 !! html/php+tidy
22474 <table>
22475 <tr>
22476 <td>foo|bar</td>
22477 </tr>
22478 <tr>
22479 <td>x
22480 <div>a|b</div>
22481 </td>
22482 </tr>
22483 </table>
22484 !! end
22485
22486 !! test
22487 Tables: 2b. Nested in td
22488 !! options
22489 parsoid=html2wt
22490 !! html/parsoid
22491 <table><tbody><tr>
22492 <td>foo||bar</td>
22493 <td>a<i>b||c</i></td>
22494 <td>a<i><div>b||c</div></i></td>
22495 </tr></tbody></table>
22496 !! wikitext
22497 {|
22498 |<nowiki>foo||bar</nowiki>
22499 |a''<nowiki>b||c</nowiki>''
22500 |a''<div><nowiki>b||c</nowiki></div>''
22501 |}
22502 !! html/php
22503 <table>
22504 <tr>
22505 <td>foo||bar
22506 </td>
22507 <td>a<i>b||c</i>
22508 </td>
22509 <td>a<i><div>b||c</div></i>
22510 </td></tr></table>
22511
22512 !! end
22513
22514 !! test
22515 Tables: 2c. Nested in td -- no escaping needed
22516 !! options
22517 parsoid=html2wt
22518 !! html/*
22519 <table>
22520
22521 <tr>
22522 <td>foo!!bar
22523 </td></tr></table>
22524
22525 !! wikitext
22526 {|
22527
22528 |foo!!bar
22529 |}
22530 !! end
22531
22532 !! test
22533 Tables: 3a. Nested in th
22534 !! options
22535 parsoid=html2wt
22536 !! html/*
22537 <table>
22538
22539 <tr>
22540 <th>foo!bar
22541 </th></tr></table>
22542
22543 !! wikitext
22544 {|
22545
22546 !foo!bar
22547 |}
22548 !! end
22549
22550 !! test
22551 Tables: 3b. Nested in th
22552 !! options
22553 parsoid=html2wt
22554 !! html/parsoid
22555 <table><tbody>
22556 <tr><th>foo!!bar</th>
22557 <th><i>foo|bar</i></th>
22558 <th><i>foo!!bar</i></th>
22559 <th><i><span>foo!!bar</span></i></th>
22560 </tr></tbody></table>
22561 !! wikitext
22562 {|
22563 !<nowiki>foo!!bar</nowiki>
22564 !''<nowiki>foo|bar</nowiki>''
22565 !''<nowiki>foo!!bar</nowiki>''
22566 !''<span><nowiki>foo!!bar</nowiki></span>''
22567 |}
22568 !! html/php
22569 <table>
22570 <tr>
22571 <th>foo!!bar
22572 </th>
22573 <th><i>foo|bar</i>
22574 </th>
22575 <th><i>foo!!bar</i>
22576 </th>
22577 <th><i><span>foo!!bar</span></i>
22578 </th></tr></table>
22579
22580 !! end
22581
22582 !! test
22583 Tables: 3c. Nested in th
22584 !! options
22585 parsoid=html2wt
22586 !! html/parsoid
22587 <table><tbody>
22588 <tr><th>foo||bar</th>
22589 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22590 </tr></tbody></table>
22591 !! wikitext
22592 {|
22593 !<nowiki>foo||bar</nowiki>
22594 !<nowiki>foo||bar</nowiki>
22595 |}
22596 !! html/php
22597 <table>
22598 <tr>
22599 <th>foo||bar
22600 </th>
22601 <th>foo||bar
22602 </th></tr></table>
22603
22604 !! end
22605
22606 !! test
22607 Tables: 4a. Escape -
22608 !! options
22609 parsoid=html2wt
22610 !! html/*
22611 <table>
22612
22613 <tr>
22614 <th>-bar
22615 </th></tr>
22616 <tr>
22617 <td>-bar
22618 </td></tr></table>
22619
22620 !! wikitext
22621 {|
22622
22623 !-bar
22624
22625 |-
22626 |<nowiki>-bar</nowiki>
22627 |}
22628 !! end
22629
22630 !! test
22631 Tables: 4b. Escape +
22632 !! options
22633 parsoid=html2wt
22634 !! html/*
22635 <table>
22636
22637 <tr>
22638 <th>+bar
22639 </th></tr>
22640 <tr>
22641 <td>+bar
22642 </td></tr></table>
22643
22644 !! wikitext
22645 {|
22646
22647 !+bar
22648
22649 |-
22650 |<nowiki>+bar</nowiki>
22651 |}
22652 !! end
22653
22654 !! test
22655 Tables: 4c. No escaping needed
22656 !! options
22657 parsoid=html2wt
22658 !! html/parsoid
22659 <table><tbody>
22660 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22661 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22662 <tr><td>foo
22663 <p>bar|baz
22664 +bar
22665 -bar</p></td></tr>
22666 <tr><td>x
22667 <div>a|b</div></td>
22668 </tbody></table>
22669 !! wikitext
22670 {|
22671 |foo-bar
22672 |foo+bar
22673 |-
22674 |''foo''-bar
22675 |''foo''+bar
22676 |-
22677 |foo
22678 bar|baz
22679 +bar
22680 -bar
22681 |-
22682 |x
22683 <div>a|b</div>
22684 |}
22685 !! html/php
22686 <table>
22687 <tr>
22688 <td>foo-bar
22689 </td>
22690 <td>foo+bar
22691 </td></tr>
22692 <tr>
22693 <td><i>foo</i>-bar
22694 </td>
22695 <td><i>foo</i>+bar
22696 </td></tr>
22697 <tr>
22698 <td>foo
22699 <p>bar|baz
22700 +bar
22701 -bar
22702 </p>
22703 </td></tr>
22704 <tr>
22705 <td>x
22706 <div>a|b</div>
22707 </td></tr></table>
22708
22709 !! end
22710
22711 !! test
22712 Tables: 4d. No escaping needed
22713 !! options
22714 parsoid=html2wt
22715 !! html/parsoid
22716 <table>
22717 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22718 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22719 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22720 </tbody></table>
22721 !! wikitext
22722 {|
22723 |[[Foo]]-bar
22724 ||+1
22725 ||-2
22726 |}
22727 !! html/php
22728 <table>
22729 <tr>
22730 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22731 </td>
22732 <td>+1
22733 </td>
22734 <td>-2
22735 </td></tr></table>
22736
22737 !! end
22738
22739 !! test
22740 T97430: Don't emit empty nowiki pairs around marker meta tags
22741 !! options
22742 parsoid=html2wt
22743 !! html/parsoid
22744 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22745 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22746 !! wikitext
22747 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22748 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22749 !! end
22750
22751 !! test
22752 Unclosed xmlish element in table line shouldn't eat end delimiters
22753 !! options
22754 parsoid=html2wt
22755 !! html/parsoid
22756 <table>
22757 <tbody><tr><td> &lt;foo</td>
22758 <td> bar></td></tr>
22759 </tbody></table>
22760 !! wikitext
22761 {|
22762 | <foo
22763 | bar>
22764 |}
22765 !! html/php
22766 <table>
22767 <tr>
22768 <td> &lt;foo
22769 </td>
22770 <td> bar&gt;
22771 </td></tr></table>
22772
22773 !! end
22774
22775 #### --------------- Links ----------------
22776 #### 1. Quote marks in link text
22777 #### 2. Wikilinks: Escapes needed
22778 #### 3. Wikilinks: No escapes needed
22779 #### 4. Extlinks: Escapes needed
22780 #### 5. Extlinks: No escapes needed
22781 #### --------------------------------------
22782 !! test
22783 Links 1. WikiLinks: No escapes needed
22784 !! options
22785 parsoid=html2wt
22786 !! html/parsoid
22787 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22788 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22789 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22790 !! wikitext
22791 [[Foo|Foo''boo'']]
22792 [[Foo|[Foobar]]]
22793 [[Foo|x [Foobar] x]]
22794 !! html/php
22795 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22796 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22797 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22798 </p>
22799 !! end
22800
22801 !! test
22802 Links 2. WikiLinks: Escapes needed
22803 !! options
22804 parsoid=html2wt
22805 !! html/parsoid
22806 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22807 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22808 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22809 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22810 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22811 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22812 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22813 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22814 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22815 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22816 !! wikitext
22817 [[Foo|<nowiki>Foobar]</nowiki>]]
22818 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22819 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22820 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22821 [[Foo|<nowiki>|Bar</nowiki>]]
22822 [[Foo|<nowiki>]]bar</nowiki>]]
22823 [[Foo|<nowiki>[[bar</nowiki>]]
22824 [[Foo|<nowiki>x [[ y</nowiki>]]
22825 [[Foo|<nowiki>x ]] y</nowiki>]]
22826 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22827 !! html/php
22828 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22829 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22830 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22831 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22832 <a href="/wiki/Foo" title="Foo">|Bar</a>
22833 <a href="/wiki/Foo" title="Foo">]]bar</a>
22834 <a href="/wiki/Foo" title="Foo">[[bar</a>
22835 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22836 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22837 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22838 </p>
22839 !! end
22840
22841 !! test
22842 Links 3. WikiLinks: No escapes needed
22843 !! options
22844 parsoid=html2wt
22845 !! html/parsoid
22846 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22847 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22848 !! wikitext
22849 [[Foo|[Foobar]]
22850 [[Foo|foo|bar]]
22851 !! html/php
22852 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22853 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22854 </p>
22855 !! end
22856
22857 !! test
22858 Links 4. ExtLinks: Escapes needed
22859 !! options
22860 parsoid=html2wt
22861 !! html/parsoid
22862 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22863 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22864 <p>[http://google.com]</p>
22865 <p>[http://google.com google]</p>
22866 !! wikitext
22867 [http://google.com <nowiki>[google]</nowiki>]
22868 [http://google.com <nowiki>google]</nowiki>]
22869
22870 <nowiki>[http://google.com]</nowiki>
22871
22872 <nowiki>[http://google.com google]</nowiki>
22873
22874 !! html/php
22875 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22876 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22877 </p><p>[http://google.com]
22878 </p><p>[http://google.com google]
22879 </p>
22880 !! end
22881
22882 !! test
22883 Links 5. ExtLinks: No escapes needed
22884 !! options
22885 parsoid=html2wt
22886 !! html/parsoid
22887 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22888 !! wikitext
22889 [http://google.com [google]
22890 !! html/php
22891 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22892 </p>
22893 !! end
22894
22895 !! test
22896 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22897 !! options
22898 parsoid=html2wt
22899 !! html/parsoid
22900 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22901 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22902 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22903 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22904 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22905 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22906 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22907 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22908 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22909 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22910 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22911 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22912 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22913 </p>
22914 !! wikitext
22915 x<nowiki/>http://example.com<nowiki/>y
22916 http://example.com<nowiki/>?x
22917 http://example.com<nowiki/>&x
22918 http://example.com<nowiki/>'x
22919 http://example.com<nowiki/>,x
22920 http://example.com<nowiki/>.x
22921 http://example.com<nowiki/>;x
22922 http://example.com<nowiki/>:x
22923 http://example.com<nowiki/>;x
22924 http://example.com<nowiki/>!x
22925 http://example.com<nowiki/>=x
22926 http://example.com<nowiki/>(x)
22927 http://example.com(x<nowiki/>)
22928 !! end
22929
22930 !! test
22931 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22932 !! options
22933 parsoid=html2wt
22934 !! html/parsoid
22935 <p>x
22936 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22937 y
22938 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22939 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22940 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22941 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22942 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22943 </p>
22944 !! wikitext
22945 x
22946 http://example.com
22947 y
22948 "http://example.com"
22949 (http://example.com)
22950 (http://example.com) foo
22951 http://example.com,
22952 http://example.com, foo
22953 !! html/php
22954 <p>x
22955 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22956 y
22957 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22958 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22959 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22960 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22961 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22962 </p>
22963 !! end
22964
22965 !! test
22966 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22967 !! options
22968 parsoid=html2wt
22969 !! html/parsoid
22970 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22971 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22972 !! wikitext
22973 http://example.com.,;:!?\
22974 -http://example.com:
22975 !! html/php
22976 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22977 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22978 </p>
22979 !! end
22980
22981 !! test
22982 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22983 !! options
22984 parsoid=html2wt
22985 !! html/parsoid
22986 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22987 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22988 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22989 !! wikitext
22990 RFC 123<nowiki/>4
22991 RFC 123<nowiki/>y
22992 X<nowiki/>RFC 123<nowiki/>y
22993 !! end
22994
22995 !! test
22996 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22997 !! options
22998 parsoid=html2wt
22999 !! html/parsoid
23000 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23001 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23002 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23003 </p>
23004 !! wikitext
23005 RFC 123?foo
23006 RFC 123&foo
23007 -RFC 123-
23008 !! html/php
23009 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23010 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23011 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23012 </p>
23013 !! end
23014
23015 !! test
23016 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23017 !! options
23018 parsoid=html2wt
23019 !! html/parsoid
23020 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23021 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23022 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23023 !! wikitext
23024 PMID 123<nowiki/>4
23025 PMID 123<nowiki/>y
23026 X<nowiki/>PMID 123<nowiki/>y
23027 !! end
23028
23029 !! test
23030 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23031 !! options
23032 parsoid=html2wt
23033 !! html/parsoid
23034 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23035 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23036 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23037 </p>
23038 !! wikitext
23039 PMID 123?foo
23040 PMID 123&foo
23041 -PMID 123-
23042 !! html/php
23043 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23044 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23045 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23046 </p>
23047 !! end
23048
23049 !! test
23050 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23051 !! options
23052 parsoid=html2wt
23053 !! html/parsoid
23054 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23055 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23056 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23057 </p>
23058 !! wikitext
23059 ISBN 1234567890<nowiki/>1
23060 ISBN 1234567890<nowiki/>x
23061 a<nowiki/>ISBN 1234567890<nowiki/>b
23062 !! end
23063
23064 !! test
23065 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23066 !! options
23067 parsoid=html2wt
23068 !! html/parsoid
23069 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23070 !! wikitext
23071 -ISBN 1234567890's
23072 !! html/php
23073 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23074 </p>
23075 !! end
23076
23077 !! test
23078 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23079 !! options
23080 parsoid=html2wt
23081 !! html/*
23082 <p>this is not a link: http://example.com
23083 </p>
23084 !! wikitext
23085 <nowiki>this is not a link: http://example.com</nowiki>
23086 !! end
23087
23088 !! test
23089 Links 15. Link trails can't become link prefixes.
23090 !! options
23091 language=is
23092 parsoid=html2wt
23093 !! html/parsoid
23094 <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>
23095 !! wikitext
23096 [[Söfnuður]]-[[00]]
23097 !! html/php
23098 <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>
23099 </p>
23100 !! end
23101
23102 #### --------------- Quotes ---------------
23103 #### 1. Quotes inside <b> and <i>
23104 #### 2. Link fragments separated by <i> and <b> tags
23105 #### 3. Link fragments inside <i> and <b>
23106 #### 4. No escaping needed
23107 #### --------------------------------------
23108 !! test
23109 1a. Quotes inside <b> and <i>
23110 !! options
23111 parsoid=html2wt
23112 !! html/*
23113 <p><i>'foo'</i>
23114 <i>''foo''</i>
23115 <i>'''foo'''</i>
23116 <i>foo</i>'s
23117 <b>'foo'</b>
23118 <b>''foo''</b>
23119 <b>'''foo'''</b>
23120 <b>foo'<i>bar'</i>baz</b>
23121 <b>foo</b>'s
23122 '<i>foo</i>
23123 <i>foo</i>'
23124 <i>foo'</i>'
23125 '<i>foo</i>'
23126 '<b>foo</b>
23127 <b>foo</b>'
23128 '<b>foo</b>'
23129 <i>fools'<span> errand</span></i>
23130 <i><span>fool</span>'s errand</i>
23131 '<i>foo</i> bar '<i>baz</i>
23132 a|!*#-:;+-~[]{}b'<i>x</i>
23133 </p>
23134 !! wikitext
23135 ''<nowiki/>'foo'''
23136 ''<nowiki>''foo''</nowiki>''
23137 ''<nowiki>'''foo'''</nowiki>''
23138 ''foo''<nowiki/>'s
23139 '''<nowiki/>'foo''''
23140 '''<nowiki>''foo''</nowiki>'''
23141 '''<nowiki>'''foo'''</nowiki>'''
23142 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23143 '''foo'''<nowiki/>'s
23144 '''foo''
23145 ''foo''<nowiki/>'
23146 ''foo'''<nowiki/>'
23147 '''foo''<nowiki/>'
23148 ''''foo'''
23149 '''foo'''<nowiki/>'
23150 ''''foo'''<nowiki/>'
23151 ''fools'<span> errand</span>''
23152 ''<span>fool</span>'s errand''
23153 '<nowiki/>''foo'' bar '''baz''
23154 a|!*#-:;+-~[]{}b'''x''
23155 !! end
23156
23157 !! test
23158 1b. Quotes inside <b> and <i> with other tags on same line
23159 !! options
23160 parsoid=html2wt
23161 !! html/parsoid
23162 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23163 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23164 <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>
23165 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23166 '<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>
23167 '<i>foo</i> <div title="name">test</div>
23168 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23169 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23170 <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>
23171 </ol>
23172 !! wikitext
23173 '''a'' foo ''[[bar]]''
23174 ''a''' foo ''[[bar]]''
23175 ''a''' foo '''{{echo|[[bar]]}}'''
23176 [[foo]] x'''[[bar]]''
23177 '''foo'' <ref>test</ref>
23178 '''foo'' <div title="name">test</div>
23179 '''foo'' and <br> bar
23180 <references />
23181 !! end
23182
23183 !! test
23184 2. Link fragments separated by <i> and <b> tags
23185 !! options
23186 parsoid=html2wt
23187 !! html/parsoid
23188 <p>[[<i>foo</i>hello]]</p>
23189 <p>[[<b>foo</b>hello]]</p>
23190 !! wikitext
23191 [[''foo''<nowiki>hello]]</nowiki>
23192
23193 [['''foo'''<nowiki>hello]]</nowiki>
23194 !! end
23195
23196 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23197 # this is one of the shortcomings of this format
23198 !! test
23199 3. Link fragments inside <i> and <b>
23200 !! options
23201 parsoid=html2wt
23202 !! html/parsoid
23203 <p><i>[[foo</i>]]</p>
23204 <p><b>[[foo</b>]]</p>
23205 !! wikitext
23206 ''[[foo''<nowiki>]]</nowiki>
23207
23208 '''[[foo'''<nowiki>]]</nowiki>
23209 !! end
23210
23211 !! test
23212 4. No escaping needed
23213 !! options
23214 options=html2wt
23215 !! html/parsoid
23216 <p>'<span><i>bar</i></span>'
23217 '<span><b>bar</b></span>'
23218 'a:b'foo
23219 </p>
23220 !! wikitext
23221 '<span>''bar''</span>'
23222 '<span>'''bar'''</span>'
23223 'a:b'foo
23224 !! end
23225
23226 #### ----------- Paragraphs ---------------
23227 #### 1. No unnecessary escapes
23228 #### --------------------------------------
23229
23230 !! test
23231 1. No unnecessary escapes
23232 !! options
23233 parsoid=html2wt
23234 !! html/parsoid
23235 <p>bar <span>[[foo]]</span>
23236 </p><p>=bar <span>[[foo]]</span>
23237 </p><p>[[bar <span>[[foo]]</span>
23238 </p><p>]]bar <span>[[foo]]</span>
23239 </p><p>=bar <span>foo]]</span>=
23240 </p>
23241 !! wikitext
23242 bar <span><nowiki>[[foo]]</nowiki></span>
23243
23244 =bar <span><nowiki>[[foo]]</nowiki></span>
23245
23246 [[bar <span><nowiki>[[foo]]</nowiki></span>
23247
23248 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23249
23250 =bar <span>foo]]</span><nowiki>=</nowiki>
23251 !!end
23252
23253 #### ----------------------- PRE --------------------------
23254 #### 1. Leading whitespace in SOL context should be escaped
23255 #### ------------------------------------------------------
23256 !! test
23257 1. Leading whitespace in SOL context should be escaped
23258 !! options
23259 parsoid=html2wt
23260 !! html/parsoid
23261 <p> a</p>
23262
23263 <p> a</p>
23264
23265 <p> a(tab)</p>
23266
23267 <p> a
23268 <!--cmt-->
23269 a</p>
23270
23271 <p>a
23272 b</p>
23273
23274 <p>a
23275 b</p>
23276
23277 <p>a
23278 b</p>
23279 !! wikitext
23280 <nowiki> </nowiki>a
23281
23282 <nowiki> </nowiki> a
23283
23284 a(tab)
23285
23286 <nowiki> </nowiki> a
23287 <!--cmt-->
23288 <nowiki> </nowiki>a
23289
23290 a
23291 <nowiki> </nowiki>b
23292
23293 a
23294 b
23295
23296 a
23297 b
23298 !! html/php
23299 <p> a
23300 </p><p> a
23301 </p><p> a(tab)
23302 </p><p> a
23303 a
23304 </p><p>a
23305 b
23306 </p><p>a
23307 b
23308 </p><p>a
23309 b
23310 </p>
23311 !! end
23312
23313 !! test
23314 2. Leading whitespace in non-indent-pre contexts should not be escaped
23315 !! options
23316 parsoid=htm2wt
23317 !! html/parsoid
23318 <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>
23319 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23320 <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>
23321 b</span></li>
23322 </ol>
23323 !! wikitext
23324 foo <ref>''a''
23325 b</ref>
23326 <references />
23327 !! end
23328
23329 !! test
23330 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23331 !! options
23332 parsoid=html2wt
23333 !! html/parsoid
23334 <blockquote>
23335 <p>
23336 a
23337 <span>b</span>
23338 c</p>
23339 </blockquote>
23340 !! wikitext
23341 <blockquote>
23342 a
23343 <span>b</span>
23344 c
23345 </blockquote>
23346 !! end
23347
23348 !! test
23349 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23350 !! options
23351 options=html2wt
23352 !! html/parsoid
23353 <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>
23354 !! wikitext
23355 [[File:Foobar.jpg|thumb|caption]]
23356 !! end
23357
23358 !! test
23359 5. Nowiki escaping should account for indent-pres
23360 !! options
23361 parsoid=html2wt
23362 !! html/parsoid
23363 <pre>==foo==</pre>
23364 !! wikitext
23365 ==foo==
23366 !! end
23367
23368 !!test
23369 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23370 !! options
23371 parsoid=html2wt
23372 !! html/parsoid
23373 <pre>
23374 * foo
23375 * bar
23376 </pre>
23377 !! wikitext
23378 * foo
23379 * bar
23380 !! end
23381
23382 #### --------------- Behavior Switches --------------------
23383
23384 !! test
23385 1. Valid behavior switches should be escaped
23386 !! options
23387 parsoid=html2wt
23388 !! html/parsoid
23389 __TOC__
23390 <i>__TOC__</i>
23391 !! wikitext
23392 <nowiki>__TOC__</nowiki>
23393 ''<nowiki>__TOC__</nowiki>''
23394 !! end
23395
23396 !! test
23397 2. Invalid behavior switches should not be escaped
23398 !! options
23399 parsoid=html2wt
23400 !! html/parsoid
23401 __TOO__
23402 __|__
23403 !! wikitext
23404 __TOO__
23405 __|__
23406 !! end
23407
23408 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23409 !! test
23410 Behavior switches should be SOL-transparent
23411 !! options
23412 parsoid=html2wt
23413 !! html/parsoid
23414 <meta property="mw:PageProp/toc" />
23415
23416 <!-- this one's bogus -->
23417 <pre>__TOO__</pre>
23418
23419 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23420
23421 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23422 !! wikitext
23423 __TOC__
23424
23425 <!-- this one's bogus -->
23426 __TOO__
23427
23428 __TOC__ foo
23429
23430 __TOC__ bar
23431 !! end
23432
23433 #### --------------- HTML tags ---------------
23434 #### 1. a tags
23435 #### 2. other tags
23436 #### 3. multi-line html tag
23437 #### 4. extension tags
23438 #### -----------------------------------------
23439 !! test
23440 1. a tags
23441 !! options
23442 parsoid=html2wt
23443 !! html/parsoid
23444 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23445 !! wikitext
23446 <a href="http://google.com">google</a>
23447 !! end
23448
23449 !! test
23450 2. other tags
23451 !! options
23452 parsoid=html2wt
23453 !! html/parsoid
23454 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23455 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23456 <li> &lt;td&gt;</li></ul>
23457
23458 !! wikitext
23459 * <nowiki><div>foo</div></nowiki>
23460 * <nowiki><div style="color:red">foo</div></nowiki>
23461 * <nowiki><td></nowiki>
23462 !! end
23463
23464 !! test
23465 3. multi-line html tag
23466 !! options
23467 parsoid=html2wt
23468 !! html/parsoid
23469 <p>&lt;div
23470 &gt;foo&lt;/div
23471 &gt;
23472 </p>
23473 !! wikitext
23474 <nowiki><div
23475 >foo</div
23476 ></nowiki>
23477 !! end
23478
23479 !! test
23480 4. extension tags
23481 !! options
23482 parsoid=html2wt
23483 !! html/parsoid
23484 <p>&lt;ref&gt;foo&lt;/ref&gt;
23485 </p><p>&lt;ref&gt;bar
23486 </p><p>baz&lt;/ref&gt;
23487 </p>
23488 !! wikitext
23489 <nowiki><ref>foo</ref></nowiki>
23490
23491 <nowiki><ref>bar</nowiki>
23492
23493 baz<nowiki></ref></nowiki>
23494 !! end
23495
23496 #### --------------- Others ---------------
23497 !! test
23498 Escaping nowikis
23499 !! options
23500 parsoid=html2wt
23501 !! html/parsoid
23502 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23503 </p>
23504 !! wikitext
23505 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23506 !! end
23507
23508 ## The quote-char in the input is necessary for triggering the bug
23509 !! test
23510 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23511 !! options
23512 parsoid=html2wt
23513 !! html/parsoid
23514 <p>foo's bar :</p>
23515 !! wikitext
23516 foo's bar :
23517 !! end
23518
23519 #----------- End of wikitext escaping tests --------------
23520
23521 !! test
23522
23523 Tag-like HTML structures are passed through as text
23524 !! wikitext
23525 <x y>
23526
23527 <x.y>
23528
23529 <x-y>
23530
23531 1>2
23532
23533 x<y
23534
23535 a>b
23536
23537 1<d e>f
23538 !! html
23539 <p>&lt;x y&gt;
23540 </p><p>&lt;x.y&gt;
23541 </p><p>&lt;x-y&gt;
23542 </p><p>1&gt;2
23543 </p><p>x&lt;y
23544 </p><p>a&gt;b
23545 </p><p>1&lt;d e&gt;f
23546 </p>
23547 !! end
23548
23549 !! test
23550 HTML tag with necessary entities in attributes
23551 !! wikitext
23552 <span title="&amp;amp;">foo</span>
23553 !! html
23554 <p><span title="&amp;amp;">foo</span>
23555 </p>
23556 !! end
23557
23558 !! test
23559 HTML tag with 'unnecessary' entity encoding in attributes
23560 !! wikitext
23561 <span title="&amp;">foo</span>
23562 !! html
23563 <p><span title="&amp;">foo</span>
23564 </p>
23565 !! end
23566
23567 !! test
23568 HTML tag with broken attribute value quoting
23569 !! wikitext
23570 <span title="Hello world>Foo</span>
23571 !! html/php
23572 <p><span title="Hello world">Foo</span>
23573 </p>
23574 !! html/parsoid
23575 <p><span title="Hello world">Foo</span>
23576 </p>
23577 !! end
23578
23579 !! test
23580 Table with broken attribute value quoting
23581 !! wikitext
23582 {|
23583 | title="Hello world|Foo
23584 |}
23585 !! html/php
23586 <table>
23587 <tr>
23588 <td title="Hello world">Foo
23589 </td></tr></table>
23590
23591 !! html/parsoid
23592 <table>
23593 <tr>
23594 <td title="Hello world">Foo
23595 </td></tr></table>
23596
23597 !! end
23598
23599 !! test
23600 Table with broken attribute value quoting on consecutive lines
23601 !! wikitext
23602 {|
23603 | title="Hello world|Foo
23604 | style="color:red|Bar
23605 |}
23606 !! html/php
23607 <table>
23608 <tr>
23609 <td title="Hello world">Foo
23610 </td>
23611 <td style="color:red">Bar
23612 </td></tr></table>
23613
23614 !! html/parsoid
23615 <table><tbody>
23616 <tr>
23617 <td title="Hello world">Foo
23618 </td><td style="color: red">Bar
23619 </td></tr></tbody></table>
23620
23621 !! end
23622
23623 !! test
23624 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23625 !! options
23626 parsoid
23627 !! wikitext
23628 {{}}
23629 !! html
23630 {{}}
23631 !! end
23632
23633 !! test
23634 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23635 !! options
23636 parsoid
23637 !! wikitext
23638 }}{{
23639 !! html
23640 }}{{
23641 !! end
23642
23643 !!test
23644 Accept empty td cell attribute
23645 !! wikitext
23646 {|
23647 | align="center" | foo || |
23648 |}
23649 !! html
23650 <table>
23651 <tr>
23652 <td align="center"> foo </td>
23653 <td>
23654 </td></tr></table>
23655
23656 !!end
23657
23658 !!test
23659 Non-empty attributes in th-cells
23660 !! wikitext
23661 {|
23662 ! Foo !! style="color: red" | Bar
23663 |}
23664 !! html
23665 <table>
23666 <tr>
23667 <th> Foo </th>
23668 <th style="color: red"> Bar
23669 </th></tr></table>
23670
23671 !!end
23672
23673 !!test
23674 Accept empty attributes in th-cells
23675 !! wikitext
23676 {|
23677 !| foo !!| bar
23678 |}
23679 !! html
23680 <table>
23681 <tr>
23682 <th> foo </th>
23683 <th> bar
23684 </th></tr></table>
23685
23686 !!end
23687
23688 !!test
23689 Empty table rows go away
23690 !! wikitext
23691 {|
23692 | Hello
23693 | there
23694 |- class="foo"
23695 |-
23696 |}
23697 !! html
23698 <table>
23699 <tr>
23700 <td> Hello
23701 </td>
23702 <td> there
23703 </td></tr>
23704
23705 </table>
23706
23707 !! end
23708
23709 ###
23710 ### Parsoid-centric tests for testing RTing of inter-element separators
23711 ### Edge cases not tested by existing parser tests and specific to
23712 ### Parsoid-specific serialization strategies.
23713 ###
23714
23715 !!test
23716 RT-ed inter-element separators should be valid separators
23717 !! wikitext
23718 {|
23719 |- [[foo]]
23720 |}
23721 !! html
23722 <table>
23723
23724 </table>
23725
23726 !!end
23727
23728 # Parsoid-only since PHP parser relies on Tidy for correct output
23729 !!test
23730 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23731 !!options
23732 parsoid
23733 !! wikitext
23734 {|
23735 |<small>foo
23736 bar
23737 |}
23738
23739 {|
23740 |<small>foo<small>
23741 |}
23742 !! html
23743 <table>
23744 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23745 <p>bar</p></small></td></tr>
23746 </tbody></table>
23747
23748 <table>
23749 <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>
23750 </tbody></table>
23751 !!end
23752
23753 # Note that the "style" attribute is really a template parameter here.
23754 # The = would have to be {{=}} if you wanted the literal.
23755 !!test
23756 Empty TD followed by TD with tpl-generated attribute
23757 !! wikitext
23758 {|
23759 |-
23760 |
23761 |{{echo|style='color:red'}}|foo
23762 |}
23763 !! html
23764 <table>
23765
23766 <tr>
23767 <td>
23768 </td>
23769 <td>foo
23770 </td></tr></table>
23771
23772 !!end
23773
23774 !!test
23775 Indented table with an empty td
23776 !! wikitext
23777 {|
23778 |-
23779 |
23780 |foo
23781 |}
23782 !! html
23783 <table>
23784
23785 <tr>
23786 <td>
23787 </td>
23788 <td>foo
23789 </td></tr></table>
23790
23791 !!end
23792
23793 ## We have some newline diffs RT-ing this edge case
23794 ## and it is not important enough -- we seem to be emitting
23795 ## at most 2 newlines after a </tr> and this is unrelated to
23796 ## the issue from T85627 that this is testing.
23797 !!test
23798 Indented table with blank lines in between (T85627)
23799 !! options
23800 parsoid=wt2html
23801 !! wikitext
23802 {|
23803 |foo
23804
23805
23806 |}
23807 !! html
23808 <table>
23809
23810 <tr>
23811 <td>foo
23812 </td></tr></table>
23813
23814 !!end
23815
23816 !!test
23817 Indented block & table
23818 !! wikitext
23819 <div>foo</div>
23820 {|
23821 |foo
23822 |}
23823 !! html/php
23824 <div>foo</div>
23825 <table>
23826 <tr>
23827 <td>foo
23828 </td></tr></table>
23829
23830 !! html/parsoid
23831 <div data-parsoid='{"stx":"html"}'>foo</div>
23832 <table><tbody>
23833 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23834 </tbody></table>
23835 !!end
23836
23837 !! test
23838 Indent and comment before table row
23839 !! wikitext
23840 {|
23841 <!--hi-->|-
23842 | there
23843 |}
23844 !! html/php
23845 <table>
23846
23847 <tr>
23848 <td> there
23849 </td></tr></table>
23850
23851 !! html/parsoid
23852 <table>
23853 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23854 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23855 </tbody></table>
23856 !! end
23857
23858 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23859 !!test
23860 Empty TR followed by a template-generated TR
23861 !!options
23862 parsoid
23863 !! wikitext
23864 {|
23865 |-
23866 {{echo|<tr><td>foo</td></tr>}}
23867 |}
23868 !! html
23869 <table>
23870 <tbody>
23871 <tr></tr>
23872 <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}}]}'>
23873 <td>foo</td></tr>
23874 </tbody></table>
23875 !!end
23876
23877 ## PHP and parsoid output differ for this, and since this is primarily
23878 ## for testing Parsoid's serializer, marking this Parsoid only
23879 !!test
23880 Empty TR followed by mixed-ws-comment line should RT correctly
23881 !!options
23882 parsoid
23883 !! wikitext
23884 {|
23885 |-
23886 <!--c-->
23887 |-
23888 <!--c--> <!--d-->
23889 |}
23890 !! html
23891 <table>
23892 <tbody>
23893 <tr></tr>
23894 <!--c-->
23895 <tr>
23896 <!--c--> </tr><!--d-->
23897 </tbody></table>
23898
23899 !!end
23900
23901 !!test
23902 Multi-line image caption generated by templates with/without trailing newlines
23903 !! wikitext
23904 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23905 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23906 !! html/parsoid
23907 <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>
23908 <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>
23909 !!end
23910
23911 !! test
23912 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23913 !! options
23914 parsoid=html2wt
23915 !! html/parsoid
23916 <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>
23917
23918 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23919 !! wikitext
23920 <includeonly>foo</includeonly>
23921 new para
23922
23923 [[Category:Foo]]
23924
23925 = new heading =
23926 !! end
23927
23928 ## PHP emits broken html for this, and since this is primarily
23929 ## a Parsoid serializer test, marking this Parsoid only
23930 !!test
23931 Improperly nested inline or quotes tags with whitespace in between
23932 !! wikitext
23933 <span> <s>x</span> </s>
23934 ''' ''x''' ''
23935 !! html/parsoid
23936 <p><span> <s>x</s></span><s> </s>
23937 <b> <i>x</i></b><i> </i>
23938 </p>
23939 !!end
23940
23941 !!test
23942 Encapsulate protected attributes from wt
23943 !! wikitext
23944 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23945 !! html/parsoid
23946 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
23947 </body>
23948 !!end
23949
23950 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23951 ## Having nested or stray pre tags results in the attempt to add duplicates,
23952 ## causing an assertion fail. This test tries to prevent that situation.
23953 !!test
23954 Ensure ParagraphWrapper can deal with stray closing pre tags
23955 !!options
23956 parsoid=wt2html
23957 !! wikitext
23958 plain text</pre>
23959 !! html/parsoid
23960 plain text
23961 !!end
23962
23963 !!test
23964 1. Ensure fostered text content is wrapped in element nodes
23965 !!options
23966 parsoid=wt2html
23967 !! wikitext
23968 <table>hi</table><table>ho</table>
23969 !! html/parsoid
23970 <p>hi</p>
23971 <table></table>
23972 <p>ho</p>
23973 <table></table>
23974 !!end
23975
23976 !!test
23977 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23978 !!options
23979 parsoid=wt2html,wt2wt
23980 !! wikitext
23981 <table>
23982 <tr> || ||
23983 <td> a
23984 </table>
23985 !! html/parsoid
23986 <p> || ||
23987 </p><table>
23988 <tbody><tr><td> a</td></tr>
23989 </tbody></table>
23990 !!end
23991
23992 !!test
23993 Encapsulation properly handles null DSR information from foster box
23994 !!options
23995 parsoid=wt2html,wt2wt
23996 !! wikitext
23997 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23998 !! html/parsoid
23999 <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>
24000 !!end
24001
24002 !!test
24003 1. Encapsulate foster-parented transclusion content
24004 !!options
24005 parsoid=wt2wt,wt2html
24006 !! wikitext
24007 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24008 !! html/parsoid
24009 <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>
24010 <tbody>
24011 <tr>
24012 <td>bar</td>
24013 </tr>
24014 </tbody>
24015 </table>
24016 !!end
24017
24018 !!test
24019 2. Encapsulate foster-parented transclusion content
24020 !!options
24021 parsoid=wt2wt,wt2html
24022 !! wikitext
24023 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24024 !! html/parsoid
24025 <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>
24026 <table>
24027 <tbody>
24028 <tr>
24029 <td>bar</td>
24030 </tr>
24031 </tbody>
24032 </table>
24033 !!end
24034
24035 !!test
24036 3. Encapsulate foster-parented transclusion content
24037 !!options
24038 parsoid=wt2wt,wt2html
24039 !! wikitext
24040 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24041 !! html/parsoid
24042 <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;]}">
24043 <p>foo</p>
24044 </div>
24045 <table>
24046 <tbody>
24047 <tr>
24048 <td>bar</td>
24049 </tr>
24050 </tbody>
24051 </table>
24052 !!end
24053
24054 !!test
24055 4. Encapsulate foster-parented transclusion content
24056 !!options
24057 parsoid=wt2wt,wt2html
24058 !! wikitext
24059 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24060 !! html/parsoid
24061 <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;]}">
24062 <p>foo</p>
24063 </div>
24064 <table>
24065 <tbody>
24066 <tr>
24067 <td>bar</td>
24068 </tr>
24069 </tbody>
24070 </table>
24071 !!end
24072
24073 !!test
24074 5. Encapsulate foster-parented transclusion content
24075 !!options
24076 parsoid=wt2wt,wt2html
24077 !! wikitext
24078 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24079 !! html/parsoid
24080 <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>
24081 <table>
24082 <tbody>
24083 <tr>
24084 <td>
24085 <div>
24086 <p>foo</p>
24087 </div>
24088 </td>
24089 </tr>
24090 </tbody>
24091 </table>
24092 !!end
24093
24094 !!test
24095 6. Encapsulate foster-parented transclusion content
24096 !!options
24097 parsoid=wt2wt,wt2html
24098 !! wikitext
24099 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24100 !! html/parsoid
24101 <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>
24102 <table>
24103 <tbody>
24104 <tr>
24105 <td>
24106 <div>
24107 <p>foo</p>
24108 </div>
24109 </td>
24110 </tr>
24111 </tbody>
24112 </table>
24113 <p>ok</p>
24114 !!end
24115
24116 !!test
24117 7. Encapsulate foster-parented transclusion content
24118 !!options
24119 parsoid=wt2wt,wt2html
24120 !! wikitext
24121 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24122 !! html/parsoid
24123 <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>
24124 <table>
24125 <tbody>
24126 <tr>
24127 <td>bar</td>
24128 </tr>
24129 </tbody>
24130 </table>
24131 !!end
24132
24133 # Note that the wt is broken on purpose: the = should be {{=}} if you
24134 # don't want it to be a template parameter key.
24135 !!test
24136 8. Encapsulate foster-parented transclusion content
24137 !!options
24138 parsoid=wt2wt,wt2html
24139 !! wikitext
24140 {{echo|a
24141 }}{|{{echo|style='color:red'}}
24142 |-
24143 |b
24144 |}
24145 !! html/parsoid
24146 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24147 <span> </span>
24148 <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>
24149 <table>
24150 <tbody>
24151 <tr>
24152 <td>b</td>
24153 </tr>
24154 </tbody>
24155 </table>
24156 !!end
24157
24158 !!test
24159 9. Encapsulate foster-parented transclusion content
24160 !!options
24161 parsoid=wt2wt,wt2html
24162 !! wikitext
24163 <table>{{echo|hi</table>hello}}
24164 !! html/parsoid
24165 <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>
24166 !!end
24167
24168 !!test
24169 Table in fosterable position
24170 !!options
24171 parsoid=wt2html,wt2wt
24172 !! wikitext
24173 {{OpenTable}}
24174 <div>
24175 {|
24176 |}
24177 </div>
24178 |}
24179 !! html/parsoid
24180 <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">
24181 </span>
24182 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24183
24184 <table>
24185 </table>
24186 !!end
24187
24188 # Parsoid only for bug 64747
24189 !! test
24190 Properly encapsulate empty-content transclusions in fosterable positions
24191 !! wikitext
24192 <table>
24193 {{#if:|
24194 <td>foo</td>
24195 }}
24196 </table>
24197 !! html/parsoid
24198 <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":["","","",""]}]]}'>
24199
24200 </table>
24201 !! end
24202
24203 !!test
24204 Support <object> element with .data attribute
24205 !!options
24206 parsoid=html2wt
24207 !! html/parsoid
24208 <object data="test.swf"></object>
24209 !! wikitext
24210 <object data="test.swf"></object>
24211 !!end
24212
24213 !! test
24214 Don't block XML namespace declaration
24215 !! wikitext
24216 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24217 !! html/php
24218 <p><span>MediaWiki</span>
24219 </p>
24220 !! html/parsoid
24221 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24222 !! end
24223
24224 # -----------------------------------------------------------------
24225 # The following section of tests are primarily to spec requirements
24226 # around serialization of new/edited content.
24227 #
24228 # All these tests are marked Parsoid html2wt and html2html only
24229 # ----------------------------------------------------------------
24230
24231 # 'mi' is a localinterwiki prefix as well as a language
24232 !! test
24233 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24234 !! options
24235 parsoid=html2wt
24236 !! html/parsoid
24237 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24238 !! wikitext
24239 [[Foo]]
24240 !! end
24241
24242 # See T93839
24243 !! test
24244 New wikilinks should be serialized properly
24245 !! options
24246 parsoid=html2wt
24247 !! html/parsoid
24248 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24249 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24250 !! wikitext
24251 [[Foo]]
24252 [[Foo]]
24253 !! end
24254
24255 !! test
24256 New wiki links (href variations)
24257 !! options
24258 parsoid=html2wt
24259 !! html/parsoid
24260 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24261 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24262 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24263 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24264 !! wikitext
24265 [[Foo_bar]]
24266 [[Foo_bar]]
24267 [[Foo_bar]]
24268 [[Toxine bactérienne]]
24269 !! end
24270
24271 !! test
24272 New wiki links (content string variations)
24273 !! options
24274 parsoid=html2wt
24275 !! html/parsoid
24276 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24277 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24278 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24279 !! wikitext
24280 [[Foo_bar]]
24281 [[Foo bar]]
24282 [[Foo_bar|./Foo_bar]]
24283 !! end
24284
24285 !! test
24286 New category links (href variations)
24287 !! options
24288 parsoid=html2wt
24289 !! html/parsoid
24290 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24291 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24292 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24293 !! wikitext
24294 [[Category:Toxine bactérienne]]
24295 [[Category:Toxine bactérienne]]
24296 [[Category:Toxine bactérienne]]
24297 !! end
24298
24299 !! test
24300 New sol transparent links don't need indent-pre nowiki protection
24301 !! options
24302 parsoid=html2wt
24303 language=de
24304 !! html/parsoid
24305 <link rel="mw:PageProp/redirect" href="./Main_Page">
24306 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24307 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24308 !! wikitext
24309 #WEITERLEITUNG [[Main Page]]
24310 <!-- this is good --> [[Category:Good]]
24311 <!-- this is great --> [[Kategorie:Great]]
24312 !! end
24313
24314 !! test
24315 New interlanguage links (href variations)
24316 !! options
24317 parsoid=html2wt
24318 !! html/parsoid
24319 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24320 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24321 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24322 !! wikitext
24323 [[es:Toxine bactérienne]]
24324 [[es:Toxine_bactérienne]]
24325 [[es:Toxine_bactérienne]]
24326 !! end
24327
24328 !! test
24329 Image: Modifying size of an image (1)
24330 !! options
24331 parsoid={
24332 "modes": ["wt2wt"],
24333 "changes": [
24334 ["img[height]", "attr", "height", "22"],
24335 ["img[width]", "attr", "width", "200"]
24336 ]
24337 }
24338 !! wikitext
24339 [[Image:Foobar.jpg|230x230px]]
24340 !! wikitext/edited
24341 [[Image:Foobar.jpg|200x200px]]
24342 !!end
24343
24344 !! test
24345 Image: Modifying size of an image (2)
24346 !! options
24347 parsoid={
24348 "modes": ["wt2wt"],
24349 "changes": [
24350 ["img[height]", "attr", "height", "100"],
24351 ["img[width]", "attr", "width", "500"]
24352 ]
24353 }
24354 !! wikitext
24355 [[Image:Foobar.jpg|230x230px]]
24356 !! wikitext/edited
24357 [[Image:Foobar.jpg|500x500px]]
24358 !!end
24359
24360 # Change in size is ignored so long as class='mw-default-size'
24361 !! test
24362 Image: Modifying size of an image (3)
24363 !! options
24364 parsoid={
24365 "modes": ["wt2wt"],
24366 "changes": [
24367 ["figure[class]", "removeClass", "mw-default-size"],
24368 ["figure img", "attr", "height", "19"],
24369 ["figure img", "attr", "width", "170"]
24370 ]
24371 }
24372 !! wikitext
24373 [[Image:Foobar.jpg|thumb]]
24374 !! wikitext/edited
24375 [[Image:Foobar.jpg|thumb|170x170px]]
24376 !!end
24377
24378 !! test
24379 Image: Modifying alignment of an image (bug 48665)
24380 !! options
24381 parsoid={
24382 "modes": ["wt2wt"],
24383 "changes": [
24384 ["figure[class]", "removeClass", "mw-halign-right"],
24385 ["figure[class]", "addClass", "mw-halign-left"]
24386 ]
24387 }
24388 !! wikitext
24389 [[Image:Foobar.jpg|thumb|caption|right]]
24390 !! wikitext/edited
24391 [[Image:Foobar.jpg|thumb|caption|left]]
24392 !! end
24393
24394 !! test
24395 Image: Modifying mw-default-size of an frameless image (bug 62805)
24396 !! options
24397 parsoid={
24398 "modes": ["wt2wt"],
24399 "changes": [
24400 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24401 ]
24402 }
24403 !! wikitext
24404 [[Image:Foobar.jpg|frameless|right]]
24405 !! wikitext/edited
24406 [[Image:Foobar.jpg|frameless|right|220x220px]]
24407 !! end
24408
24409 !! test
24410 Image: Modifying valign of an image (bug 49221)
24411 !! options
24412 parsoid={
24413 "modes": ["wt2wt"],
24414 "changes": [
24415 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24416 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24417 ]
24418 }
24419 !! wikitext
24420 [[File:Foobar.jpg|20px|middle]]
24421 !! wikitext/edited
24422 [[File:Foobar.jpg|20px|text-top]]
24423 !! end
24424
24425 !! test
24426 Image: Modifying alt attribute of an image (bug 56400)
24427 !! options
24428 parsoid={
24429 "modes": ["wt2wt"],
24430 "changes": [
24431 ["img[alt]", "attr", "alt", "some alternate edited text"]
24432 ]
24433 }
24434 !! wikitext
24435 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24436 !! wikitext/edited
24437 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24438 !!end
24439
24440 !! test
24441 Image: Modifying caption of an image
24442 !! options
24443 parsoid={
24444 "modes": ["wt2wt"],
24445 "changes": [
24446 ["figcaption", "text", "new caption"]
24447 ]
24448 }
24449 !! wikitext
24450 [[Image:Foobar.jpg|thumb|original caption]]
24451 !! wikitext/edited
24452 [[Image:Foobar.jpg|thumb|new caption]]
24453 !!end
24454
24455 !! test
24456 Image: empty alt attribute (bug 48924)
24457 !! options
24458 parsoid
24459 !! wikitext
24460 [[File:Foobar.jpg|thumb|alt=|bar]]
24461 !! html
24462 <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>
24463 !! end
24464
24465 !! test
24466 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24467 !! options
24468 parsoid=html2wt
24469 language=ar
24470 disabled
24471 !! html/parsoid
24472 <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>
24473 !! wikitext
24474 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24475 !! end
24476
24477 !! test
24478 Image: Block level image should have \n before and after
24479 !! wikitext
24480 123
24481 [[File:Foobar.jpg|right|thumb|150x150px]]
24482 456
24483 !! html/parsoid
24484 <p>123</p>
24485 <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>
24486 <p>456</p>
24487 !!end
24488
24489 !! test
24490 Image: New block level image should have \n before and after (existing content)
24491 !! wikitext
24492 123
24493 [[File:Foobar.jpg|right|thumb|150x150px]]
24494 456
24495 !! html/parsoid
24496 <p>123</p>
24497 <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>
24498 <p>456</p>
24499 !!end
24500
24501 !! test
24502 Image: upright option (parsoid)
24503 !! wikitext
24504 [[File:Foobar.jpg|thumb|upright|caption]]
24505 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24506 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24507 !! html/parsoid
24508 <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>
24509 <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>
24510 <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>
24511 !!end
24512
24513 !! test
24514 Image: upright option is ignored on inline and frame images (parsoid)
24515 !! wikitext
24516 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24517 !! html/parsoid
24518 <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>
24519 !!end
24520
24521 !! test
24522 Image: from basic HTML (1)
24523 !! options
24524 parsoid=html2wt
24525 !! html/parsoid
24526 <span typeof="mw:Image">
24527 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24528 </span>
24529 !! wikitext
24530 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24531 !! end
24532
24533 !! test
24534 Image: from basic HTML (2)
24535 !! options
24536 parsoid=html2wt
24537 !! html/parsoid
24538 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24539 !! wikitext
24540 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24541 !! end
24542
24543 !! test
24544 Image: from basic HTML (3)
24545 !! options
24546 parsoid=html2wt
24547 !! html/parsoid
24548 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24549 !! wikitext
24550 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24551 !! end
24552
24553 !! test
24554 Image: from basic HTML (4)
24555 !! options
24556 parsoid=html2wt
24557 !! html/parsoid
24558 <img src="./File:Foobar.jpg">
24559 !! wikitext
24560 [[File:Foobar.jpg|link=]]
24561 !! end
24562
24563 !! test
24564 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24565 !! options
24566 parsoid=html2wt
24567 !! html/parsoid
24568 <ul>
24569 <li><p>foo</p></li>
24570 </ul>
24571 !! wikitext
24572 * foo
24573 !! end
24574
24575 !! test
24576 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24577 !! options
24578 parsoid=html2wt
24579 !! html/parsoid
24580 <ul> <li>foo</li></ul>
24581 !! wikitext
24582 * foo
24583 !! end
24584
24585 !! test
24586 Don't strip leading whitespace when handling indent-pre suppressing tags
24587 !! options
24588 parsoid=html2wt
24589 !! html/parsoid
24590 <table>
24591 <tr><td> indented row</td></tr>
24592 </table>
24593 <blockquote><p>
24594 <b>This is very bold of you!</b>
24595 </p>
24596 <table><tr><td>
24597 indented cell (no pre-wrapping!)
24598 </td></tr></table>
24599 </blockquote>
24600 <p>foo</p>
24601 <div>bar</div>
24602 !! wikitext
24603 {|
24604 | indented row
24605 |}
24606 <blockquote>
24607 '''This is very bold of you!'''
24608
24609 {|
24610 |
24611 indented cell (no pre-wrapping!)
24612 |}
24613 </blockquote>
24614 foo
24615 <div>bar</div>
24616 !! end
24617
24618 !! test
24619 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24620 !! options
24621 parsoid=html2wt
24622 !! html/parsoid
24623 <p>foo</p>
24624 <span>bar</span>
24625
24626 <span>foo2
24627 </span>bar2
24628
24629 <div>foo</div>
24630 <span>bar</span>
24631
24632 <div>
24633 <span>foo</span>
24634 </div>
24635 !! wikitext
24636 foo
24637 <nowiki> </nowiki><span>bar</span>
24638
24639 <span>foo2
24640 <nowiki> </nowiki></span>bar2
24641
24642 <div>foo</div>
24643 <nowiki> </nowiki><span>bar</span>
24644
24645 <div>
24646 <nowiki> </nowiki><span>foo</span>
24647 </div>
24648 !! end
24649
24650 !! test
24651 Lists: Dont insert newlines in a serialized list item.
24652 !! options
24653 parsoid=html2wt
24654 !! html/parsoid
24655 <ul><li>a<br>b</li><li>c</li></ul>
24656 !! wikitext
24657 * a<br>b
24658 * c
24659 !! end
24660
24661 !! test
24662 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24663 !! options
24664 parsoid={
24665 "modes": ["html2wt"],
24666 "scrubWikitext": false
24667 }
24668 !! html/parsoid
24669 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24670 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24671
24672 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24673 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24674
24675 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24676
24677 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24678 !! wikitext
24679 == hello there [[Category:A1]] ==
24680
24681 == [[Category:A2]] hi pal ==
24682
24683 == <!--foo--> [[Category:A3]] how goes it ==
24684
24685 == it goes well [[Category:A4]] <!--bar--> ==
24686
24687 ==howdy [[Category:A5]] ==
24688
24689 == __TOC__ ok ==
24690 !! end
24691
24692 !! test
24693 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24694 !! options
24695 parsoid={
24696 "modes": ["html2wt"],
24697 "scrubWikitext": true
24698 }
24699 !! html/parsoid
24700 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24701 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24702
24703 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24704 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24705
24706 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24707 !! wikitext
24708 == hello there ==
24709 [[Category:A1]]
24710 [[Category:A2]]
24711
24712 == hi pal ==
24713
24714 <!--foo--> [[Category:A3]]
24715
24716 == how goes it ==
24717
24718 == it goes well ==
24719 [[Category:A4]] <!--bar-->
24720
24721 __TOC__
24722
24723 == ok ==
24724 !! end
24725
24726 !! test
24727 Headings: Don't hoist metas that come from templates
24728 !! options
24729 parsoid={
24730 "modes": ["html2wt"],
24731 "scrubWikitext": true
24732 }
24733 !! html/parsoid
24734 <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>
24735 !! wikitext
24736 == {{echo|foo [[Category:Foo]]}} ==
24737 !! end
24738
24739 !! test
24740 Headings: Category in ref isn't hoisted
24741 !! options
24742 parsoid={
24743 "modes": ["html2wt"],
24744 "scrubWikitext": true
24745 }
24746 !! html/parsoid
24747 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
24748
24749 <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>
24750 !! wikitext
24751 == foo <ref>bar
24752 [[Category:Baz]] </ref> ==
24753
24754 <references />
24755 !! end
24756
24757 !! test
24758 Parsoid: Serialize positional parameters with = in them as named parameter
24759 !! options
24760 parsoid=html2wt
24761 !! html/parsoid
24762 <p about="#mwt1" typeof="mw:Transclusion"
24763 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24764
24765 <p about="#mwt1" typeof="mw:Transclusion"
24766 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24767
24768 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24769 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24770 <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>
24771 !! wikitext
24772 {{echo|1 = f=oo}}
24773
24774 {{echo|1 = f=oo|2 = bar}}
24775
24776 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24777 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24778 {{echo|<nowiki>f=oo</nowiki>|bar}}
24779 !! end
24780
24781 !! test
24782 Parsoid: Serialize positional parameters with = in extlink as named parameter
24783 !! options
24784 parsoid=html2wt
24785 !! html/parsoid
24786 <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>
24787 !! wikitext
24788 {{echo|1 = http://stuff?is=ok}}
24789 !! end
24790
24791 !! test
24792 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24793 !! options
24794 parsoid=html2wt
24795 !! html/parsoid
24796 <div>a<p>b</p></div>
24797 <div>a
24798 <p>b</p></div>
24799 <div>
24800 a
24801 <p>b</p></div>
24802 !! wikitext
24803 <div>a
24804 b
24805 </div>
24806 <div>a
24807 b
24808 </div>
24809 <div>
24810 a
24811
24812 b
24813 </div>
24814 !! end
24815
24816 !! test
24817 Substrings resembling wikitext in hrefs should not get nowiki escapes
24818 !! options
24819 parsoid=html2wt
24820 !! html/parsoid
24821 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24822 !! wikitext
24823 [[Foo''bar''baz]]
24824 !! end
24825
24826 !! test
24827 Enforce single-line context in the serializer
24828 !! options
24829 parsoid=html2wt
24830 !! html/parsoid
24831 <h2>testing
24832 123</h2>
24833
24834 <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">
24835 </span><span about="#mwt1">you</span> </h2>
24836
24837 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
24838
24839 <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
24840 there</span></li></ol>
24841
24842 <ul><li>asd
24843 sdf</li></ul>
24844
24845 <ul><li>foo
24846 bar
24847 baz</li>
24848 <li>foo <b>bar</b>
24849 baz</li></ul>
24850
24851 <dl><dt>hi
24852 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24853 ho</dd></dl>
24854
24855 <dl><dd> <table>
24856 <tbody><tr><td> ha
24857 ha
24858 ha</td></tr>
24859 </tbody></table></dd></dl>
24860 !! wikitext
24861 == testing 123 ==
24862
24863 == hi {{bogus|there
24864 you}} ==
24865
24866 == foo <ref>hello
24867 there</ref> ==
24868
24869 <references />
24870
24871 * asd sdf
24872
24873 * foo bar baz
24874 * foo '''bar''' baz
24875
24876 ; hi ho : hi ho
24877
24878 : {|
24879 | ha
24880 ha
24881 ha
24882 |}
24883 !! end
24884
24885 !! test
24886 Serialize new placeholder space without spans
24887 !! options
24888 parsoid=html2wt
24889 !! html/parsoid
24890 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24891
24892 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24893
24894 <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>
24895 !! wikitext
24896 foo : bar
24897
24898 foo : bar
24899
24900 <ref>foo : bar</ref>ok
24901 !! end
24902
24903
24904 #-----------------------
24905 # Tag minimization tests
24906 #-----------------------
24907
24908 !! test
24909 1. I/B quote minimization: wikitext-only tags should be combined
24910 !! options
24911 parsoid=html2wt
24912 !! html/parsoid
24913 <p><i>A</i><i>B</i></p>
24914 <p><b>A</b><b>B</b></p>
24915 <p><i>A</i><b><i>B</i></b></p>
24916 <p><b>A</b><i><b>B</b></i></p>
24917 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24918 <p><i><b>A</b></i><i><b>B</b></i></p>
24919 <p><i><b>A</b></i><b><i>B</i></b></p>
24920 <p><b><i>A</i></b><i><b>B</b></i></p>
24921 !! wikitext
24922 ''AB''
24923
24924 '''AB'''
24925
24926 ''A'''B'''''
24927
24928 '''A''B'''''
24929
24930 '''A''BC''D'''
24931
24932 '''''AB'''''
24933
24934 '''''AB'''''
24935
24936 '''''AB'''''
24937 !! end
24938
24939 !! test
24940 2. I/B quote minimization: wikitext and html tags should not be combined
24941 !! options
24942 parsoid=html2wt
24943 !! html/parsoid
24944 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24945 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24946 !! wikitext
24947 ''A''<i>B</i>
24948
24949 ''A''<nowiki/>'''<i>B</i>'''
24950 !! end
24951
24952 !! test
24953 3. I/B quote minimization: templated content stops minimization
24954 !! options
24955 parsoid=html2wt
24956 !! html/parsoid
24957 <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>
24958 <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>
24959 !! wikitext
24960 ''A''{{echo|''B''}}
24961
24962 ''A''{{echo|'''''B'''''}}
24963 !! end
24964
24965 !! test
24966 4. I/B quote minimization: new content should be mimimized with adjacent old content
24967 !! options
24968 parsoid=html2wt
24969 !! html/parsoid
24970 <p><i>A</i><i>B</i></p>
24971 <p><b>A</b><b>B</b></p>
24972 <p><i>A</i><b><i>B</i></b></p>
24973 !! wikitext
24974 ''AB''
24975
24976 '''AB'''
24977
24978 ''A'''B'''''
24979 !! end
24980
24981 !! test
24982 5a. Merge adjacent quote nodes if they've been edited
24983 !! options
24984 parsoid={
24985 "modes": ["wt2wt", "selser"],
24986 "changes": [
24987 ["p", "contents", "remove", ":contains('b')"]
24988 ]
24989 }
24990 !! wikitext
24991 ''a''b''c''
24992 !! wikitext/edited
24993 ''ac''
24994 !! end
24995
24996 !! test
24997 5b. Merge adjacent quote nodes if they've been edited
24998 !! options
24999 parsoid={
25000 "modes": ["wt2wt", "selser"],
25001 "changes": [
25002 ["#x", "remove"]
25003 ]
25004 }
25005 !! wikitext
25006 ''a''<span id="x">b</span>''c''
25007 !! wikitext/edited
25008 ''ac''
25009 !! end
25010
25011 !! test
25012 1. Merge adjacent link nodes as long as at least one element is new
25013 !! options
25014 parsoid={
25015 "modes": ["html2wt"],
25016 "scrubWikitext": true
25017 }
25018 !! html/parsoid
25019 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25020 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25021 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25022 !! wikitext
25023 [[Football]]
25024 [[Football]]
25025 [[Football|Foot]][[Football|ball]]
25026 !! end
25027
25028 !! test
25029 2. Merge adjacent link nodes and enable additional normalizations
25030 !! options
25031 parsoid={
25032 "modes": ["html2wt"],
25033 "scrubWikitext": true
25034 }
25035 !! html/parsoid
25036 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25037 !! wikitext
25038 [[Football|''Football'']]
25039 !! end
25040
25041 !! test
25042 3. Don't merge adjacent link nodes if scrubWikitext is false
25043 !! options
25044 parsoid={
25045 "modes": ["html2wt"],
25046 "scrubWikitext": false
25047 }
25048 !! html/parsoid
25049 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25050 !! wikitext
25051 [[Football|Foot]][[Football|ball]]
25052 !! end
25053
25054 #------------------------------
25055 # End of tag minimization tests
25056 #------------------------------
25057
25058 !!test
25059 Bug 54262: New entities
25060 !! options
25061 parsoid=html2wt
25062 !! html/parsoid
25063 <span typeof="mw:Entity">&nbsp;</span>
25064 !! wikitext
25065 &nbsp;
25066 !! end
25067
25068 ## Note that there is no wikitext output for 'unknownproperty' ##
25069 ## Unknown magic words are silently dropped ##
25070
25071 !! test
25072 Magic words
25073 !! options
25074 parsoid=html2wt
25075 !! html/parsoid
25076 <meta property='mw:PageProp/toc' />
25077 <meta property='mw:PageProp/notoc' />
25078 <meta property='mw:PageProp/forcetoc' />
25079 <meta property='mw:PageProp/index' />
25080 <meta property='mw:PageProp/noindex' />
25081 <meta property='mw:PageProp/nogallery' />
25082 <meta property='mw:PageProp/noeditsection' />
25083 <meta property='mw:PageProp/notitleconvert' />
25084 <meta property='mw:PageProp/nocontentconvert' />
25085 <meta property='mw:PageProp/unknownproperty' />
25086 !! wikitext
25087 __TOC__
25088 __NOTOC__
25089 __FORCETOC__
25090 __INDEX__
25091 __NOINDEX__
25092 __NOGALLERY__
25093 __NOEDITSECTION__
25094 __NOTITLECONVERT__
25095 __NOCONTENTCONVERT__
25096 !! end
25097
25098 !! test
25099 Consecutive <pre>s should not get merged
25100 !! options
25101 parsoid=html2wt,html2html
25102 !! html/parsoid
25103 <pre>a</pre><pre>b</pre>
25104
25105 <pre>c
25106 </pre><pre>
25107 d</pre>
25108
25109 <pre>e
25110
25111 </pre><pre>
25112
25113 f</pre>
25114 !! wikitext
25115 a
25116
25117 b
25118
25119 c
25120
25121 d
25122
25123 e
25124
25125
25126
25127 f
25128 !! end
25129
25130 !! test
25131 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25132 !! options
25133 parsoid=html2wt
25134 !! html/parsoid
25135 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25136 !! wikitext
25137 [[Special:BookSources/1234567890|ISBN 1234567895]]
25138 !! end
25139
25140 !! test
25141 Edited RFC links not serializable as RFC links should serialize as extlinks
25142 !! options
25143 parsoid=html2wt
25144 !! html/parsoid
25145 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25146 !! wikitext
25147 [//tools.ietf.org/html/rfc123 New RFC]
25148 !! end
25149
25150 !! test
25151 Edited PMID links not serializable as PMID links should serialize as extlinks
25152 !! options
25153 parsoid=html2wt
25154 !! html/parsoid
25155 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25156 !! wikitext
25157 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25158 !! end
25159
25160 !! test
25161 WTS of autolinks with trailing/surrounding context
25162 !! options
25163 parsoid=html2wt
25164 !! html/parsoid
25165 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25166 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25167 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25168 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25169 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25170 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25171 !! wikitext
25172 http://cscott.net<nowiki/>'''foo'''
25173
25174 http://cscott.net<b>foo</b>
25175
25176 '''http://cscott.net<nowiki/>'''
25177
25178 '''http://cscott.net '''
25179
25180 '''http://cscott.net<nowiki/>x'''
25181
25182 http://cscott.net<nowiki/>x
25183 !! end
25184
25185 !! test
25186 WTS of autolinks with nowikis (round-trip)
25187 !! wikitext
25188 x<nowiki/>http://cscott.net<nowiki/>x
25189 !! html/parsoid
25190 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25191 !! end
25192
25193 # this is the "easy" test because it leaves in place all the
25194 # data-parsoid information indicating this is an autolink
25195 !! test
25196 WTS of autolinks with escapes (editing)
25197 !! options
25198 parsoid={
25199 "modes": ["wt2wt"],
25200 "changes": [
25201 [ "meta", "remove" ]
25202 ]
25203 }
25204 !! wikitext
25205 x<nowiki/>http://cscott.net<nowiki/>x
25206 !! wikitext/edited
25207 x<nowiki/>http://cscott.net<nowiki/>x
25208 !! end
25209
25210 !! test
25211 WTS of edited autolink-like text (T103364)
25212 !! options
25213 parsoid={
25214 "modes": ["wt2wt"],
25215 "changes": [
25216 [ "span[typeof]", "removeAttr", "typeof" ]
25217 ]
25218 }
25219 !! wikitext
25220 Not a link: <nowiki>http://example.com</nowiki>.
25221 !! wikitext/edited
25222 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25223 !! end
25224
25225 !! test
25226 WTS of newly-authored autolink-like text (T103364)
25227 !! options
25228 parsoid=html2wt
25229 !! html/parsoid
25230 <p>http://example.com is not a link.</p>
25231 !! wikitext
25232 <nowiki>http://example.com is not a link.</nowiki>
25233 !! end
25234
25235 !! test
25236 WTS of autolink-like text after an autolink (T108563)
25237 !! options
25238 parsoid=html2wt
25239 !! html/parsoid
25240 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25241 !! wikitext
25242 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25243 !! end
25244
25245 !! test
25246 Magic links inside links (not autolinked)
25247 !! wikitext
25248 [[Foo|http://example.com]]
25249 [[Foo|RFC 1234]]
25250 [[Foo|PMID 1234]]
25251 [[Foo|ISBN 123456789x]]
25252
25253 [http://foo.com http://example.com]
25254 [http://foo.com RFC 1234]
25255 [http://foo.com PMID 1234]
25256 [http://foo.com ISBN 123456789x]
25257 !! html+tidy
25258 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
25259 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
25260 !! html/parsoid
25261 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25262 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25263 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25264 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25265
25266 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25267 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25268 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25269 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25270 !! end
25271
25272 !! test
25273 Magic links inside image captions (autolinked)
25274 !! wikitext
25275 [[File:Foobar.jpg|thumb|http://example.com]]
25276 [[File:Foobar.jpg|thumb|RFC 1234]]
25277 [[File:Foobar.jpg|thumb|PMID 1234]]
25278 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25279 !! html+tidy
25280 <div class="thumb tright">
25281 <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>
25282 <div class="thumbcaption">
25283 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25284 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25285 </div>
25286 </div>
25287 <div class="thumb tright">
25288 <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>
25289 <div class="thumbcaption">
25290 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25291 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25292 </div>
25293 </div>
25294 <div class="thumb tright">
25295 <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>
25296 <div class="thumbcaption">
25297 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25298 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25299 </div>
25300 </div>
25301 <div class="thumb tright">
25302 <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>
25303 <div class="thumbcaption">
25304 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25305 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25306 </div>
25307 </div>
25308 !! html/parsoid
25309 <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>
25310 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
25311 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
25312 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
25313 !! end
25314
25315 !! test
25316 WTS of magic word text (T109371)
25317 !! options
25318 parsoid=html2wt
25319 !! html/parsoid
25320 <p>RFC 1234</p>
25321 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25322 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25323 !! wikitext
25324 <nowiki>RFC 1234</nowiki>
25325
25326 [http://foo.com RFC 1234]
25327
25328 [[Foo|RFC 1234]]
25329 !! end
25330
25331 !! test
25332 Edited Redirect link should emit a non-piped wikitext link
25333 !! options
25334 parsoid=html2wt
25335 !! html/parsoid
25336 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25337 !! wikitext
25338 #REDIRECT [[Bar]]
25339 !! end
25340
25341 !! test
25342 T75121: Infer extension name from typeOf if data-mw is not present
25343 !! options
25344 parsoid=html2wt
25345 !! html/parsoid
25346 <div typeOf="mw:Extension/foo"></div>
25347 !! wikitext
25348 <foo />
25349 !! end
25350
25351 # Note that the <p> wrapping isn't present in PHP parser output
25352 # The important thing for this test is that P-wrapping doesn't
25353 # interfere with the <nowiki> protection for leading - in <td>
25354 # (which isn't necessary for <th>).
25355 !! test
25356 T88318: p-wrapped dash in table.
25357 !! options
25358 parsoid=html2wt,wt2wt
25359 !! html/parsoid
25360 <table><tbody>
25361 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25362 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25363 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25364 </tbody></table>
25365 !! wikitext
25366 {|
25367 !-
25368 !-
25369 |-
25370 |<nowiki>-</nowiki>
25371 |<nowiki>- </nowiki>
25372 |-
25373 |<small>-</small>
25374 |<br>
25375 -
25376 |<br>
25377 -
25378 |}
25379 !! html/php+tidy
25380 <table>
25381 <tr>
25382 <th>-</th>
25383 <th>-</th>
25384 </tr>
25385 <tr>
25386 <td>-</td>
25387 <td>-</td>
25388 </tr>
25389 <tr>
25390 <td><small>-</small></td>
25391 <td><br />
25392 <p>-</p>
25393 </td>
25394 <td><br />
25395 <p>-</p>
25396 </td>
25397 </tr>
25398 </table>
25399 !! end
25400
25401 !! test
25402 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25403 !! options
25404 parsoid=html2wt
25405 !! html/parsoid
25406 <table id='mwAb'>
25407 <td id='mwAc'>foo</td>
25408 <td id='serialize-this'>bar</td>
25409 </table>
25410 !! wikitext
25411 {|
25412 |foo
25413 | id="serialize-this" |bar
25414 |}
25415 !! end
25416
25417 !! test
25418 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25419 !! options
25420 parsoid=html2wt
25421 !! html/parsoid
25422 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25423 !! wikitext
25424 <div id="hello">ok</div>
25425 !! end
25426
25427 !! test
25428 WTS change modes
25429 !! options
25430 parsoid={
25431 "modes": ["wt2wt"],
25432 "changes": [
25433 [ "#xyz", "before", "<b>before</b> stuff " ],
25434 [ "#xyz", "after", " stuff <i>after</i>" ],
25435 [ "#xyz", "html", "x <b>y</b> z" ]
25436 ]
25437 }
25438 !! wikitext
25439 <span id="xyz">hello</span>
25440 !! wikitext/edited
25441 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25442 !! end
25443
25444 !! test
25445 Never serialize a-tag as html, regardless of what data-parsoid has to say
25446 !! options
25447 parsoid=html2wt
25448 !! html/parsoid
25449 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25450 !! wikitext
25451 [[Foo]]
25452 !! end
25453
25454 ## SSS FIXME: This is broken output nevertheless.
25455 ## What might be a reasonable non-broken output for this?
25456 ## This is an edge case unlikely to be seen in production
25457 ## that I am not wasting more time on this right now.
25458 !! test
25459 Never serialize a-tag as html, no matter what attributes it has
25460 !! options
25461 parsoid=html2wt
25462 !! html/parsoid
25463 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25464 !! wikitext
25465 [http://boo.org http://boohoo.org]
25466 !! end
25467
25468 # Misnested is an indication that selser can reuse the source but these have
25469 # shown to sneak through on occasion. See T101768.
25470 # The original wikitext here is: [http://test.com [[one]] two three]
25471 !! test
25472 Strip span tags added to mark as misnested
25473 !! options
25474 parsoid=html2wt
25475 !! html/parsoid
25476 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://test.com" data-parsoid='{"targetOff":17,"contentOffsets":[17,34]}'></a><a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"simple","a":{"href":"./One"},"sa":{"href":"one"},"misnested":true}'>one</a><span data-parsoid='{"misnested":true}'> two three</span></p>
25477 !! wikitext
25478 [http://test.com][[one]] two three
25479 !! end
25480
25481 # --------------------------------------------
25482 # Tests spec'ing wikitext serialization norms |
25483 # --------------------------------------------
25484
25485 !! test
25486 Lists: Add space after bullets
25487 !! options
25488 parsoid=html2wt
25489 !! html/parsoid
25490 <ul>
25491 <li>foo</li>
25492 <li> bar</li>
25493 <li><span> baz</span></li>
25494 </ul>
25495 !! wikitext
25496 * foo
25497 * bar
25498 * <span> baz</span>
25499 !! end
25500
25501 !! test
25502 1. Headings: Add space before/after == (T53744)
25503 !! options
25504 parsoid=html2wt
25505 !! html/parsoid
25506 <h2>foo</h2>
25507 <h2> bar</h2>
25508 <h2>baz </h2>
25509 <h2><span> baz</span></h2>
25510 !! wikitext
25511 == foo ==
25512
25513 == bar ==
25514
25515 == baz ==
25516
25517 == <span> baz</span> ==
25518 !! end
25519
25520 !! test
25521 2. Headings: Add space before/after == even after hoisted content
25522 !! options
25523 parsoid={
25524 "modes": ["html2wt"],
25525 "scrubWikitext": true
25526 }
25527 !! html/parsoid
25528 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25529 !! wikitext
25530 [[Category:A2]]
25531
25532 == ok ==
25533 !! end
25534
25535 !! test
25536 1. Headings: suppress newly created empty headings
25537 !! options
25538 parsoid={
25539 "modes": ["html2wt"],
25540 "scrubWikitext": true
25541 }
25542 !! html/parsoid
25543 <h2></h2>
25544 !! wikitext
25545 !! end
25546
25547 !! test
25548 2. Headings: don't suppress empty headings if scrubWikitext is false
25549 !! options
25550 parsoid=html2wt
25551 !! html/parsoid
25552 <h2></h2>
25553 !! wikitext
25554 ==<nowiki/>==
25555 !! end
25556
25557 !! test
25558 3. Headings: suppress empty headings on edits
25559 !! options
25560 parsoid={
25561 "modes": ["selser"],
25562 "scrubWikitext": true,
25563 "changes": [
25564 [ "#x", "remove"]
25565 ]
25566 }
25567 !! wikitext
25568 ==<span id="x">foo</span>==
25569 !! wikitext/edited
25570 !! end
25571
25572 !! test
25573 1. WT Quote Tags: suppress newly created empty style tags
25574 !! options
25575 parsoid={
25576 "modes": ["html2wt"],
25577 "scrubWikitext": true
25578 }
25579 !! html/parsoid
25580 <i></i><b></b>
25581 !! wikitext
25582 !! end
25583
25584 !! test
25585 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25586 !! options
25587 parsoid=html2wt
25588 !! html/parsoid
25589 <i></i><b></b>
25590 !! wikitext
25591 ''<nowiki/>'''''<nowiki/>'''
25592 !! end
25593
25594 !! test
25595 3. WT Quote Tags: suppress empty style tags on edits
25596 !! options
25597 parsoid={
25598 "modes": ["selser"],
25599 "scrubWikitext": true,
25600 "changes": [
25601 [ "#x", "remove"]
25602 ]
25603 }
25604 !! wikitext
25605 '''<span id="x">foo</span>'''
25606 !! wikitext/edited
25607 !! end
25608
25609 !! test
25610 1. Anchors: suppress newly created empty anchors
25611 !! options
25612 parsoid={
25613 "modes": ["html2wt"],
25614 "scrubWikitext": true
25615 }
25616 !! html/parsoid
25617 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25618 !! wikitext
25619 !! end
25620
25621 !! test
25622 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25623 !! options
25624 parsoid={
25625 "modes": ["html2wt"],
25626 "scrubWikitext": false
25627 }
25628 !! html/parsoid
25629 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25630 !! wikitext
25631 [[Test|<nowiki/>]]
25632 !! end
25633
25634 !! test
25635 3. Anchors: suppress empty anchors on edits
25636 !! options
25637 parsoid={
25638 "modes": ["selser"],
25639 "scrubWikitext": true,
25640 "changes": [
25641 [ "#x", "remove"]
25642 ]
25643 }
25644 !! wikitext
25645 [[Test|<span id="x">foo</span>]]
25646 !! wikitext/edited
25647 !! end
25648
25649 !! test
25650 3a. Anchors: do not suppress numbered extlinks
25651 !! options
25652 parsoid={
25653 "modes": ["wt2wt"],
25654 "scrubWikitext": true
25655 }
25656 !! wikitext
25657 [http://foo.com]
25658 !! html/parsoid
25659 <a rel="mw:ExtLink" href="http://foo.com"></a>
25660 !! end
25661
25662 !! test
25663 3b. Anchors: do not suppress numbered extlinks
25664 !! options
25665 parsoid={
25666 "modes": ["wt2wt"],
25667 "scrubWikitext": true,
25668 "changes": [
25669 [ "#x", "remove"]
25670 ]
25671 }
25672 !! wikitext
25673 [http://foo.com <span id="x">foo</span>]
25674 !! wikitext/edited
25675 [http://foo.com]
25676 !! end
25677
25678 !!test
25679 Normalizations should be restricted to edited content
25680 !!options
25681 parsoid={
25682 "modes": ["selser"],
25683 "scrubWikitext": true,
25684 "changes": [
25685 [ "h1", "before", "<i></i>"]
25686 ]
25687 }
25688 !!wikitext
25689 a
25690 = =
25691 b
25692 !!wikitext/edited
25693 a
25694 = =
25695 b
25696 !!end
25697
25698 !! test
25699 1. Multiple normalizations (html2wt)
25700 !! options
25701 parsoid={
25702 "modes": ["html2wt"],
25703 "scrubWikitext": true
25704 }
25705 !! html
25706 <h2><i></i></h2>
25707 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25708 </a><b><i></i></b>x</p>
25709 !! wikitext
25710
25711 [[foo]]
25712 x
25713
25714 !! end
25715
25716 !! test
25717 2. Multiple normalizations (selser)
25718 !! options
25719 parsoid={
25720 "modes": ["selser"],
25721 "scrubWikitext": true,
25722 "changes": [
25723 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25724 ]
25725 }
25726 !! wikitext
25727 <span id="x">foo</span>
25728 !! wikitext/edited
25729 <span id="x">foo</span>
25730
25731 x
25732 !! end
25733
25734 !! test
25735 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25736 !! options
25737 parsoid={
25738 "modes": ["html2wt"],
25739 "scrubWikitext": true
25740 }
25741 !! html/parsoid
25742 <p> hi</p>
25743 <p> hello</p>
25744 !! wikitext
25745 hi
25746
25747 hello
25748 !! end
25749
25750 !! test
25751 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25752 !! options
25753 parsoid=html2wt
25754 !! html/parsoid
25755 <p> hi</p>
25756 <p> hello</p>
25757 !! wikitext
25758 <nowiki> </nowiki>hi
25759
25760 <nowiki> </nowiki> hello
25761 !! end
25762
25763 !! test
25764 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25765 !! options
25766 parsoid={
25767 "modes": ["html2wt"],
25768 "scrubWikitext": true
25769 }
25770 !! html/parsoid
25771 <p>Foo
25772 bar
25773 baz</p>
25774
25775 <table><tr><td>Foo
25776 bar
25777 baz bang</td></tr></table>
25778
25779 <p><!--boo--> foo
25780 bar</p>
25781
25782 <p> foo
25783 bar<span>boo</span></p>
25784 !! wikitext
25785 Foo
25786 bar
25787 baz
25788
25789 {|
25790 |Foo
25791 bar
25792 baz bang
25793 |}
25794
25795 <!--boo-->foo
25796 bar
25797
25798 foo
25799 bar<span>boo</span>
25800 !! end
25801
25802 !! test
25803 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25804 !! options
25805 parsoid={
25806 "modes": ["selser"],
25807 "scrubWikitext": true,
25808 "changes": [
25809 [ "p", "html", " a\n b" ]
25810 ]
25811 }
25812 !! wikitext
25813 xyz
25814 !! wikitext/edited
25815 a
25816 b
25817 !! end
25818
25819 !! test
25820 1. New links that end in spaces
25821 !! options
25822 parsoid={
25823 "modes": ["html2wt"],
25824 "scrubWikitext": false
25825 }
25826 !! html/parsoid
25827 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25828 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25829 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25830 !! wikitext
25831 [[Berlin ]]<nowiki/>is the capital of Germany.
25832
25833 [[Foo ]]'''bar'''
25834
25835 [[Boston ]] is a city.
25836 !! end
25837
25838 !! test
25839 2. New links that end in spaces
25840 !! options
25841 parsoid={
25842 "modes": ["html2wt"],
25843 "scrubWikitext": true
25844 }
25845 !! html/parsoid
25846 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25847 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25848 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25849 !! wikitext
25850 [[Berlin]] is the capital of Germany.
25851
25852 [[Foo]] '''bar'''
25853
25854 [[Boston]] is a city.
25855 !! end
25856
25857 !! test
25858 1. Table cells with escapable prefixes
25859 !! options
25860 parsoid={
25861 "modes": ["html2wt"],
25862 "scrubWikitext": false
25863 }
25864 !! html
25865 <table>
25866 <tr><td>a</td></tr>
25867 <tr><td>-</td></tr>
25868 <tr><td>+</td></tr>
25869 </table>
25870 !! wikitext
25871 {|
25872 |a
25873 |-
25874 |<nowiki>-</nowiki>
25875 |-
25876 |<nowiki>+</nowiki>
25877 |}
25878 !! end
25879
25880 !! test
25881 2. Table cells with escapable prefixes
25882 !! options
25883 parsoid={
25884 "modes": ["html2wt"],
25885 "scrubWikitext": true
25886 }
25887 !! html
25888 <table>
25889 <tr><td>a</td></tr>
25890 <tr><td>-</td></tr>
25891 <tr><td>+</td></tr>
25892 </table>
25893 !! wikitext
25894 {|
25895 |a
25896 |-
25897 | -
25898 |-
25899 | +
25900 |}
25901 !! end
25902
25903 !! test
25904 3a. Table cells with escapable prefixes after edits
25905 !! options
25906 parsoid={
25907 "modes": ["selser"],
25908 "scrubWikitext": true,
25909 "changes": [
25910 [ "table tbody tr:first-child td:first-child", "remove"]
25911 ]
25912 }
25913 !! wikitext
25914 {|
25915 |a||-
25916 |}
25917 !! wikitext/edited
25918 {|
25919 | -
25920 |}
25921 !! end
25922
25923 !! test
25924 3b. Table cells with escapable prefixes after edits
25925 !! options
25926 parsoid={
25927 "modes": ["selser"],
25928 "scrubWikitext": true,
25929 "changes": [
25930 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25931 [ "#x", "remove" ]
25932 ]
25933 }
25934 !! wikitext
25935 {|
25936 |pqr
25937 |<span id="x">foo</span>+
25938 |}
25939 !! wikitext/edited
25940 {|
25941 | -
25942 | +
25943 |}
25944 !! end
25945
25946 # FIXME: This test will fail because
25947 # normalization doesn't realize that the id attribute
25948 # will eliminate the escapable scenario
25949 !! test
25950 4a. Table cells without escapable prefixes after edits
25951 !! options
25952 parsoid={
25953 "modes": ["selser"],
25954 "scrubWikitext": true,
25955 "changes": [
25956 [ "#x", "html", "-" ]
25957 ]
25958 }
25959 !! wikitext
25960 {|
25961 | id="x" |abcd
25962 |}
25963 !! wikitext/edited
25964 {|
25965 | id="x" |-
25966 |}
25967 !! end
25968
25969 ## This tests normalizer's ability to discriminate between
25970 ## cells having identical content.
25971 !! test
25972 4b. Table cells without escapable prefixes after edits
25973 !! options
25974 parsoid={
25975 "modes": ["selser"],
25976 "scrubWikitext": true,
25977 "changes": [
25978 [ "td", "html", "-" ]
25979 ]
25980 }
25981 !! wikitext
25982 {|
25983 |a||b
25984 |}
25985 !! wikitext/edited
25986 {|
25987 | -||-
25988 |}
25989 !! end
25990
25991 ## This tests normalizer's ability to not be tripped by
25992 ## comments (and whitespace)
25993 !! test
25994 4c. Table cells without escapable prefixes after edits
25995 !! options
25996 parsoid={
25997 "modes": ["selser"],
25998 "scrubWikitext": true,
25999 "changes": [
26000 [ "table tbody tr td:first-child", "remove" ]
26001 ]
26002 }
26003 !! wikitext
26004 {|
26005 |-
26006 <!--foo--> |a||-
26007 |}
26008 !! wikitext/edited
26009 {|
26010 |-
26011 <!--foo--> | -
26012 |}
26013 !! end
26014
26015 ## This tests normalizer's ability to handle HTML cells
26016 !! test
26017 4d. Table cells without escapable prefixes after edits
26018 !! options
26019 parsoid={
26020 "modes": ["selser"],
26021 "scrubWikitext": true,
26022 "changes": [
26023 [ "td", "html", "-" ]
26024 ]
26025 }
26026 !! wikitext
26027 <table>
26028 <tr><td>a</td></tr>
26029 </table>
26030 !! wikitext/edited
26031 <table>
26032 <tr><td>-</td></tr>
26033 </table>
26034 !! end
26035
26036 !! test
26037 Escape nowiki DOM elements
26038 !! options
26039 parsoid=html2wt
26040 !! html/parsoid
26041 <nowiki><i>foo</i></nowiki>
26042 !! wikitext
26043 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26044 !! end
26045
26046 # ---------------------------------------------------
26047 # End of tests spec'ing wikitext serialization norms |
26048 # ---------------------------------------------------
26049
26050 # -----------------------------------------------------------------
26051 # End of section for Parsoid-only html2wt tests for serialization
26052 # of new content
26053 # -----------------------------------------------------------------
26054
26055 # -----------------------------------------------------------------
26056 # The following section of tests are primarily to spec behavior of
26057 # the selective serializer. All these tests have manual selser
26058 # changes. The automated selser changes for all tests handle the
26059 # wide variation of changes, but these tests here capture specs
26060 # deterministically.
26061 # ----------------------------------------------------------------
26062
26063 ## T90517
26064 !! test
26065 Selser: New comments should not be lost
26066 !! options
26067 parsoid={
26068 "modes": ["selser"],
26069 "changes": [
26070 [ "#a", "after", "<!--c1-->" ],
26071 [ "#b", "before", "<!--c2-->" ]
26072 ]
26073 }
26074 !! wikitext
26075 <span id="a">a</span>
26076
26077 <span id="b">b</span>
26078 !! wikitext/edited
26079 <span id="a">a</span><!--c1-->
26080
26081 <!--c2--><span id="b">b</span>
26082 !! end
26083
26084 ## T89383
26085 !! test
26086 Selser: Check for validity of DSR before using it
26087 !! options
26088 parsoid={
26089 "modes": ["selser"],
26090 "changes": [
26091 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26092 ]
26093 }
26094 !! wikitext
26095 <span id="a">a</span>
26096 !! wikitext/edited
26097 {{DISPLAYTITLE:foo}}
26098 <span id="a">a</span>
26099 !! end
26100
26101 !! test
26102 1. DOMDiff: Changes to <ref> content should be looked up using id
26103 !! options
26104 parsoid={
26105 "modes": ["selser"],
26106 "changes": [
26107 ["#X", "after", "bar"],
26108 ["#Y", "after", "baz"]
26109 ]
26110 }
26111 !! wikitext
26112 X <ref><span id="X">foo</span></ref>
26113 Y <ref name="a" />
26114 <references>
26115 <ref name="a"><span id="Y">foo</span></ref>
26116 </references>
26117 !! wikitext/edited
26118 X <ref><span id="X">foo</span>bar</ref>
26119 Y <ref name="a" />
26120 <references>
26121 <ref name="a"><span id="Y">foo</span>baz</ref>
26122 </references>
26123 !! end
26124
26125 !! test
26126 2. DOMDiff: Changes to <ref> content should be looked up using id
26127 !! options
26128 parsoid={
26129 "modes": ["selser"],
26130 "changes": [
26131 ["#Z", "after", "bar"]
26132 ]
26133 }
26134 !! wikitext
26135 A <ref>foo bar for a</ref>
26136 B <ref group="X" name="b" />
26137
26138 <references />
26139
26140 <references group="X">
26141 <ref name="b"><span id="Z">foo</span></ref>
26142 </references>
26143 !! wikitext/edited
26144 A <ref>foo bar for a</ref>
26145 B <ref group="X" name="b" />
26146
26147 <references />
26148
26149 <references group="X">
26150 <ref name="b"><span id="Z">foo</span>bar</ref>
26151 </references>
26152 !! end