Merge "Allow stop characters as quoted attribute delimiters"
[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
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! end
2068
2069 !! test
2070 Ident preformatting with inline content
2071 !! wikitext
2072 a
2073 ''b''
2074 !! html
2075 <pre>a
2076 <i>b</i>
2077 </pre>
2078 !! end
2079
2080 !! test
2081 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2082 !! wikitext
2083 <pre><nowiki>
2084 <b>
2085 <cite>
2086 <em>
2087 </nowiki></pre>
2088 !! html
2089 <pre>
2090 &lt;b&gt;
2091 &lt;cite&gt;
2092 &lt;em&gt;
2093 </pre>
2094
2095 !! end
2096
2097 !! test
2098 Regression with preformatted in <center>
2099 !! wikitext
2100 <center>
2101 Blah
2102 </center>
2103 !! html
2104 <center>
2105 <pre>Blah
2106 </pre>
2107 </center>
2108
2109 !! end
2110
2111 !! test
2112 Bug 52763: Preformatted in <blockquote>
2113 !! wikitext
2114 <blockquote>
2115 Blah
2116 {|
2117 |
2118 indented cell (no pre-wrapping!)
2119 |}
2120 </blockquote>
2121 !! html
2122 <blockquote>
2123 <p> Blah
2124 </p>
2125 <table>
2126 <tr>
2127 <td>
2128 <p> indented cell (no pre-wrapping!)
2129 </p>
2130 </td></tr></table>
2131 </blockquote>
2132
2133 !! end
2134
2135 !! test
2136 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2137 !! wikitext
2138 <blockquote>
2139 Foo
2140
2141 Bar
2142 </blockquote>
2143 !! html
2144 <blockquote>
2145 <p>Foo
2146 </p><p>Bar
2147 </p>
2148 </blockquote>
2149
2150 !! end
2151
2152 !! test
2153 Bug 15491: <ins>/<del> in blockquote
2154 !! wikitext
2155 <blockquote>
2156 Foo <del>bar</del> <ins>baz</ins> quux
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo <del>bar</del> <ins>baz</ins> quux
2161 </p>
2162 </blockquote>
2163
2164 !! end
2165
2166 # Note that the p-wrapping is newline sensitive, which could be
2167 # considered a bug: tidy will wrap only the 'Foo' in the example
2168 # below in a <p> tag. (see comment 23-25 of bug #6200)
2169 !! test
2170 Bug 15491: <ins>/<del> in blockquote (2)
2171 !! wikitext
2172 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2173 </blockquote>
2174 !! html
2175 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177
2178 !! html+tidy
2179 <blockquote>
2180 <p>Foo</p>
2181 <del>bar</del> <ins>baz</ins> quux</blockquote>
2182 !! end
2183
2184 !! test
2185 <pre> with attributes (bug 3202)
2186 !! wikitext
2187 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2188 !! html
2189 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2190
2191 !! end
2192
2193 !! test
2194 <pre> with width attribute (bug 3202)
2195 !! wikitext
2196 <pre width="8">Narrow screen goodies</pre>
2197 !! html
2198 <pre width="8">Narrow screen goodies</pre>
2199
2200 !! end
2201
2202 !! test
2203 <pre> with forbidden attribute (bug 3202)
2204 !! wikitext
2205 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2206 !! html
2207 <pre width="8">Narrow screen goodies</pre>
2208
2209 !! end
2210
2211 !! test
2212 Entities inside <pre>
2213 !! wikitext
2214 <pre>&lt;</pre>
2215 !! html
2216 <pre>&lt;</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute values (bug 3202)
2222 !! wikitext
2223 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 <nowiki> inside <pre> (bug 13238)
2231 !! wikitext
2232 <pre>
2233 <nowiki>
2234 </pre>
2235 <pre>
2236 <nowiki></nowiki>
2237 </pre>
2238 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2239 !! html
2240 <pre>
2241 &lt;nowiki&gt;
2242 </pre>
2243 <pre>
2244
2245 </pre>
2246 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2247
2248 !! end
2249
2250 !! test
2251 <nowiki> and <pre> preference (first one wins)
2252 !! wikitext
2253 <pre>
2254 <nowiki>
2255 </pre>
2256 </nowiki>
2257 </pre>
2258
2259 <nowiki>
2260 <pre>
2261 <nowiki>
2262 </pre>
2263 </nowiki>
2264 </pre>
2265
2266 !! html/php
2267 <pre>
2268 &lt;nowiki&gt;
2269 </pre>
2270 <p>&lt;/nowiki&gt;
2271 &lt;/pre&gt;
2272 </p><p>
2273 &lt;pre&gt;
2274 &lt;nowiki&gt;
2275 &lt;/pre&gt;
2276
2277 &lt;/pre&gt;
2278 </p>
2279 !! html/parsoid
2280 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2281 </pre>
2282 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2283 &lt;/pre></p>
2284
2285 <p><span typeof="mw:Nowiki">
2286 &lt;pre>
2287 &lt;nowiki>
2288 &lt;/pre>
2289 </span>
2290 &lt;/pre></p>
2291 !! end
2292
2293 !! test
2294 </pre> inside nowiki
2295 !! wikitext
2296 <nowiki></pre></nowiki>
2297 !! html
2298 <p>&lt;/pre&gt;
2299 </p>
2300 !! end
2301
2302 # Parsoid doesn't strip empty tags, like Tidy does.
2303 !! test
2304 Empty pre; pre inside other HTML tags (bug 54946)
2305 !! options
2306 parsoid=wt2html,wt2wt
2307 !! wikitext
2308 a
2309
2310 <div><pre>
2311 foo
2312 </pre></div>
2313 <pre></pre>
2314 !! html/php
2315 <p>a
2316 </p>
2317 <div><pre>
2318 foo
2319 </pre></div>
2320 <pre></pre>
2321
2322 !! html/php+tidy
2323 <p>a</p>
2324 <div>
2325 <pre>
2326 foo
2327 </pre></div>
2328 !! html/parsoid
2329 <p>a</p>
2330
2331 <div><pre>foo
2332 </pre></div>
2333 <pre></pre>
2334 !! end
2335
2336 !! test
2337 HTML pre followed by indent-pre
2338 !! wikitext
2339 <pre>foo</pre>
2340 bar
2341 !! html
2342 <pre>foo</pre>
2343 <pre>bar
2344 </pre>
2345 !! end
2346
2347 # Note that tidy removes the empty <p> tags from the start and end.
2348 # Parsoid does not, by design.
2349 !!test
2350 Block tag pre
2351 !! wikitext
2352 <p><pre>foo</pre></p>
2353 !! html/php+tidy
2354 <pre>
2355 foo
2356 </pre>
2357 !! html/parsoid
2358 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2359 !!end
2360
2361 !!test
2362 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2363 !! wikitext
2364 {{echo|}}
2365 !! html
2366
2367 !!end
2368
2369 !!test
2370 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2371 !! wikitext
2372 {{echo|
2373 foo}}
2374 !! html
2375 <p>foo
2376 </p>
2377 !!end
2378
2379 !! test
2380 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2381 !! wikitext
2382 {{echo|a
2383 b}}
2384 !! html
2385 <pre>a
2386 </pre>
2387 <p>b
2388 </p>
2389 !!end
2390
2391 !! test
2392 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2393 !! wikitext
2394 {{echo|a
2395 b
2396 c
2397 d
2398 e
2399 }}
2400 !! html
2401 <pre>a
2402 </pre>
2403 <p>b
2404 c
2405 </p>
2406 <pre>d
2407 </pre>
2408 <p>e
2409 </p>
2410 !!end
2411
2412 !!test
2413 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2414 !! wikitext
2415 {{echo| foo}}
2416
2417 {{echo| foo}}{{echo| bar}}
2418
2419 {{echo| foo}}
2420 {{echo| bar}}
2421
2422 {{echo|<!--cmt--> foo}}
2423
2424 <!--cmt-->{{echo| foo}}
2425
2426 {{echo|{{echo| }}bar}}
2427 !! html
2428 <pre>foo
2429 </pre>
2430 <pre>foo bar
2431 </pre>
2432 <pre>foo
2433 bar
2434 </pre>
2435 <pre>foo
2436 </pre>
2437 <pre>foo
2438 </pre>
2439 <pre>bar
2440 </pre>
2441 !!end
2442
2443 !! test
2444 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2445 !! wikitext
2446 {{echo| }}a
2447
2448 {{echo|
2449 }}a
2450
2451 {{echo|
2452 b}}
2453
2454 {{echo|a
2455 }}b
2456
2457 {{echo|a
2458 }} b
2459 !! html
2460 <pre>a
2461 </pre>
2462 <p><br />
2463 </p>
2464 <pre>a
2465 </pre>
2466 <p><br />
2467 </p>
2468 <pre>b
2469 </pre>
2470 <p>a
2471 </p>
2472 <pre>b
2473 </pre>
2474 <p>a
2475 </p>
2476 <pre>b
2477 </pre>
2478 !!end
2479
2480 !! test
2481 Pres with newline attributes
2482 !! wikitext
2483 <pre class="one
2484 two">hi</pre>
2485 !! html/php
2486 <pre class="one two">hi</pre>
2487
2488 !! html/parsoid
2489 <pre class="one
2490 two" data-parsoid='{"stx":"html"}'>hi</pre>
2491 !! end
2492
2493 !! test
2494 Things that look like <pre> tags aren't treated as such
2495 !! wikitext
2496 Barack Obama <President> of the United States
2497 <President></President>
2498 !! html
2499 <p>Barack Obama &lt;President&gt; of the United States
2500 &lt;President&gt;&lt;/President&gt;
2501 </p>
2502 !! end
2503
2504 ## PHP parser discards the "<pre " string
2505 !! test
2506 Handle broken pre-like tags (bug 64025)
2507 !! options
2508 parsoid=wt2html
2509 !! wikitext
2510 {{echo|<pre <pre>x</pre>}}
2511
2512 <table><pre </table>
2513 !! html/php
2514 <pre>x</pre>
2515 <table><pre></pre></table>
2516
2517 !! html/parsoid
2518 <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>
2519
2520
2521 <p>&lt;pre </p>
2522
2523 <table></table>
2524 !! end
2525
2526 !! test
2527 Parsoid: handle pre with space after attribute
2528 !! options
2529 parsoid=wt2html
2530 !! wikitext
2531 <pre style="width:50%;" >{{echo|foo}}</pre>
2532 !! html/php
2533 <pre style="width:50%;">{{echo|foo}}</pre>
2534
2535 !! html/parsoid
2536 <pre style="width:50%;">{{echo|foo}}</pre>
2537 !! end
2538
2539 # TODO / maybe: fix wt2wt for this
2540 !! test
2541 Parsoid: Don't paragraph-wrap fosterable content
2542 !! options
2543 parsoid=wt2html
2544 !! wikitext
2545 {|
2546 <td></td>
2547 <td></td>
2548
2549
2550
2551 |}
2552 !! html
2553 <table>
2554
2555 <tbody>
2556 <tr>
2557 <td></td>
2558
2559 <td></td></tr>
2560
2561
2562
2563 </tbody></table>
2564 !! end
2565
2566 !! test
2567 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2568 !! options
2569 parsoid=wt2html
2570 !! wikitext
2571 {|
2572 <td>
2573 <td>
2574 </td>
2575
2576
2577
2578 |}
2579 !! html
2580 <table>
2581
2582 <tbody>
2583 <tr>
2584 <td></td>
2585
2586 <td>
2587 </td></tr>
2588
2589
2590
2591 </tbody></table>
2592 !! end
2593
2594
2595 #--------------------------------------------------------------------
2596 # Transclusion parameter whitespace stripping tests
2597 # Behavior is different for positional and named parameters
2598 #--------------------------------------------------------------------
2599 !! test
2600 Templates: Strip leading and trailing whitespace from named-param values
2601 !! wikitext
2602 {{echo|1= a }}
2603
2604 {{echo|1= {{echo|b}} }}
2605
2606 {{echo| 1 =
2607 c }}
2608
2609 {{echo| 1 =
2610 * d
2611 }}
2612 !! html
2613 <p>a
2614 </p><p>b
2615 </p><p>c
2616 </p>
2617 <ul><li> d</li></ul>
2618
2619 !! end
2620
2621 !! test
2622 Templates: Don't strip whitespace from positional-param values
2623 !! wikitext
2624 {{echo|a }}
2625
2626 {{echo|{{echo|b}} }}
2627
2628 {{echo| c
2629 }}
2630
2631 {{echo| {{echo|d}}
2632 }}
2633
2634 {{echo|
2635 e}}
2636
2637 {{echo|
2638 * f}}
2639
2640 {{echo|
2641 }}g
2642 !! html
2643 <p>a
2644 </p><p>b
2645 </p>
2646 <pre>c
2647 </pre>
2648 <p><br />
2649 </p>
2650 <pre>d
2651 </pre>
2652 <p><br />
2653 </p>
2654 <pre>e
2655 </pre>
2656 <p><br />
2657 </p>
2658 <ul><li> f</li></ul>
2659 <p><br />
2660 </p>
2661 <pre>g
2662 </pre>
2663 !! end
2664
2665 !! test
2666 Templates: Handle empty comment-and-ws-only lines correctly
2667 !! wikitext
2668 {{echo|foo
2669 <!--should be ignored-->
2670 <!--should be ignored as well-->
2671 bar}}
2672 !! html
2673 <p>foo
2674 bar
2675 </p>
2676 !! end
2677
2678 !! test
2679 Templates: Handle comments in the target
2680 !! wikitext
2681 {{echo
2682 <!-- should be ignored -->
2683 |foo}}
2684
2685 {{echo<!-- should be ignored -->
2686 |foo}}
2687
2688 {{echo<!-- should be ignored -->|foo}}
2689
2690 {{<!-- should be ignored -->echo|foo}}
2691 !!html/parsoid
2692 <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>
2693
2694 <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>
2695
2696 <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>
2697
2698 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2699 !!end
2700
2701 !! test
2702 Templates: Handle comments in parameter names (bug 67657)
2703 !! wikitext
2704 {{echo|1
2705 <!-- should be ignored -->
2706 =foo}}
2707
2708 {{echo|
2709 <!-- should be ignored -->
2710 1 = foo}}
2711
2712 {{echo|1<!-- should be ignored --> = foo}}
2713
2714 {{echo|<!-- should be ignored -->1 = foo}}
2715 !!html/parsoid
2716 <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>
2717
2718 <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>
2719
2720 <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>
2721
2722 <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>
2723 !!end
2724
2725 !! test
2726 Templates: Other wikitext in parameter names (bug 67657)
2727 !! wikitext
2728 {{echo|''1''=foo}}
2729 !!html/parsoid
2730 <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>
2731 !!html/php
2732 <p>{{{1}}}
2733 </p>
2734 !!end
2735
2736 #--------------------------------------------------------------------
2737 # Transclusion parameter escaping tests
2738 #--------------------------------------------------------------------
2739 !! test
2740 Templates: Parsoid parameter escaping test 1
2741 !! wikitext
2742 {{echo|[foo]|{{echo|[bar]}}}}
2743 !! html/php+tidy
2744 <p>[foo]</p>
2745 !! html/parsoid
2746 <p about="#mwt1" typeof="mw:Transclusion"
2747 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2748 !! end
2749
2750 !! test
2751 Parsoid: Pipes in external links in template parameter
2752 !! wikitext
2753 {{echo|[{{echo|http://example.com}} link]}}
2754 !! html/php+tidy
2755 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2756 !! html/parsoid
2757 <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>
2758 !! end
2759
2760 !! test
2761 Parsoid: pipe in transclusion parameter
2762 !! wikitext
2763 {{echo|http://foo.com/a&#124;b}}
2764 !! html/php+tidy
2765 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2766 !! html/parsoid
2767 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2768 typeof="mw:Transclusion"
2769 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>
2770 !! end
2771
2772 !! test
2773 Parsoid: Pipe in external link target and content in template parameter
2774 !! options
2775 parsoid=html2wt,wt2wt
2776 !! wikitext
2777 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2778 !! html/php+tidy
2779 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2780 !! html/parsoid
2781 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2782 typeof="mw:Transclusion"
2783 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2784 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2789 !! options
2790 parsoid
2791 !! wikitext
2792 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2793 !! html
2794 <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>
2795 !! end
2796
2797 !! test
2798 Templates: Don't escape already nowiki-escaped text in template parameters
2799 !! options
2800 parsoid=html2wt,wt2wt
2801 !! wikitext
2802 {{echo|foo<nowiki>|</nowiki>bar}}
2803 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2804 {{echo|<nowiki></nowiki>}}
2805 !! html/php+tidy
2806 <p>foo|bar &lt;div&gt;</p>
2807 !! html/parsoid
2808 <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>
2809 <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>
2810 <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>
2811 </p>
2812 !! end
2813
2814 ## Bug 52824
2815 !! test
2816 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2817 !! options
2818 parsoid=html2wt,wt2wt
2819 !! wikitext
2820 {{echo|{{echo|1=bar}}}}
2821 !! html/php+tidy
2822 <p>bar</p>
2823 !! html/parsoid
2824 <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>
2825 !! end
2826
2827 ## Bug 56733
2828 !! test
2829 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2830 !! wikitext
2831 {{echo|a : b}}
2832 !! html/php+tidy
2833 <p>a&#160;: b</p>
2834 !! html/parsoid
2835 <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>
2836 !! end
2837
2838 ## Bug T73412
2839 !! test
2840 Templates: Preserve blank parameter names
2841 !! wikitext
2842 {{echo|=foo}}
2843 !! html/php+tidy
2844 <p>{{{1}}}</p>
2845 !! html/parsoid
2846 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2847 !! end
2848
2849 !! test
2850 Templates: Preserve blank parameter names in other positions
2851 !! wikitext
2852 {{blank_param|bar|=foo}}
2853 !! html/php+tidy
2854 <p>bar foo</p>
2855 !! html/parsoid
2856 <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
2857 foo</p>
2858 !! end
2859
2860 ###
2861 ### Parsoid-centric tests for testing RT edge cases for pre
2862 ###
2863
2864 !!test
2865 1a. Indent-Pre and Comments
2866 !! wikitext
2867 a
2868 <!--a-->
2869 c
2870 !! html
2871 <pre>a
2872 </pre>
2873 <p>c
2874 </p>
2875 !!end
2876
2877 !!test
2878 1b. Indent-Pre and Comments
2879 !! wikitext
2880 a
2881 <!--a-->
2882 c
2883 !! html
2884 <pre>a
2885 </pre>
2886 <p>c
2887 </p>
2888 !!end
2889
2890 !!test
2891 1c. Indent-Pre and Comments
2892 !! wikitext
2893 <!--a--> a
2894
2895 <!--a--> a
2896 !! html
2897 <pre> a
2898 </pre>
2899 <pre> a
2900 </pre>
2901 !!end
2902
2903 !!test
2904 1d. Indent-Pre and Comments
2905 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2906 !! wikitext
2907 <!--a--> a
2908
2909 <!--b-->b
2910 !! html
2911 <pre>a
2912 </pre>
2913 <pre>b
2914 </pre>
2915 !!end
2916
2917 !!test
2918 2a. Indent-Pre and tables
2919 !! wikitext
2920 {|
2921 |-
2922 !h1!!h2
2923 |foo||bar
2924 |}
2925 !! html
2926 <table>
2927
2928 <tr>
2929 <th>h1</th>
2930 <th>h2
2931 </th>
2932 <td>foo</td>
2933 <td>bar
2934 </td></tr></table>
2935
2936 !!end
2937
2938 !!test
2939 2b. Indent-Pre and tables
2940 !! wikitext
2941 {|
2942 |-
2943 |foo
2944 |}
2945 !! html
2946 <table>
2947
2948 <tr>
2949 <td>foo
2950 </td></tr></table>
2951
2952 !!end
2953
2954 !!test
2955 2c. Indent-Pre and tables (bug 42252)
2956 !! wikitext
2957 {|
2958 |+ foo
2959 ! | bar
2960 |}
2961 !! html
2962 <table>
2963 <caption> foo
2964 </caption>
2965 <tr>
2966 <th> bar
2967 </th></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2d. Indent-Pre and tables
2973 !! wikitext
2974 a
2975 {|
2976 | b
2977 |}
2978 !! html/php
2979 <pre>a
2980 </pre>
2981 <table>
2982 <tr>
2983 <td> b
2984 </td></tr></table>
2985
2986 !! html/parsoid
2987 <pre>a</pre>
2988 <table>
2989 <tbody><tr><td> b</td></tr>
2990 </tbody></table>
2991 !!end
2992
2993 !!test
2994 2e. Indent-Pre and table-line syntax
2995 !! wikitext
2996 a
2997 | b
2998 | c
2999 !! html/php
3000 <pre>a
3001 | b
3002 | c
3003 </pre>
3004 !!end
3005
3006 !!test
3007 2f. Indent-pre started by table-line syntax
3008 !! wikitext
3009 a
3010 | b
3011 | c
3012 !! html/php
3013 <p>a
3014 </p>
3015 <pre>| b
3016 | c
3017 </pre>
3018 !! html/parsoid
3019 <p>a</p>
3020 <pre>
3021 | b
3022 | c</pre>
3023 !!end
3024
3025 !!test
3026 3a. Indent-Pre and block tags (single-line html)
3027 !! wikitext
3028 a <p> foo </p>
3029 b <div> foo </div>
3030 c <blockquote> foo </blockquote>
3031 <span> foo </span>
3032 !! html
3033 a <p> foo </p>
3034 b <div> foo </div>
3035 c <blockquote> foo </blockquote>
3036 <pre><span> foo </span>
3037 </pre>
3038 !! html/parsoid
3039 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3040 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3041 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3042 <pre><span> foo </span>
3043 </pre>
3044 !! html+tidy
3045 <p>a</p>
3046 <p>foo</p>
3047 <p>b</p>
3048 <div>foo</div>
3049 <p>c</p>
3050 <blockquote>
3051 <p>foo</p>
3052 </blockquote>
3053 <pre>
3054 <span> foo </span>
3055 </pre>
3056 !! end
3057
3058 !!test
3059 3b. Indent-Pre and block tags (multi-line html)
3060 !! wikitext
3061 a <span>foo</span>
3062 b <div> foo </div>
3063 !! html
3064 <pre>a <span>foo</span>
3065 </pre>
3066 b <div> foo </div>
3067
3068 !! html/parsoid
3069 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3070 b <div data-parsoid='{"stx":"html"}'> foo </div>
3071 !! html+tidy
3072 <pre>
3073 a <span>foo</span>
3074 </pre>
3075 <p>b</p>
3076 <div>foo</div>
3077 !!end
3078
3079 !!test
3080 3c. Indent-Pre and block tags (pre-content on separate line)
3081 !! wikitext
3082 <p>
3083 foo
3084 </p>
3085
3086 <div>
3087 foo
3088 </div>
3089
3090 <center>
3091 foo
3092 </center>
3093
3094 <blockquote>
3095 foo
3096 </blockquote>
3097
3098 <blockquote>
3099 <pre>
3100 foo
3101 </pre>
3102 </blockquote>
3103
3104 <table><tr><td>
3105 foo
3106 </td></tr></table>
3107
3108 <ul><li>
3109 foo
3110 </li></ul>
3111
3112 !! html
3113 <p>
3114 foo
3115 </p>
3116 <div>
3117 <pre>foo
3118 </pre>
3119 </div>
3120 <center>
3121 <pre>foo
3122 </pre>
3123 </center>
3124 <blockquote>
3125 <p> foo
3126 </p>
3127 </blockquote>
3128 <blockquote>
3129 <pre>
3130 foo
3131 </pre>
3132 </blockquote>
3133 <table><tr><td>
3134 <pre>foo
3135 </pre>
3136 </td></tr></table>
3137 <ul><li>
3138 foo
3139 </li></ul>
3140
3141 !!end
3142
3143 !!test
3144 4. Indent-Pre and extension tags
3145 !! wikitext
3146 a <gallery>
3147 File:foobar.jpg
3148 </gallery>
3149 !! html
3150 a <ul class="gallery mw-gallery-traditional">
3151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3152 <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>
3153 <div class="gallerytext">
3154 </div>
3155 </div></li>
3156 </ul>
3157
3158 !! html+tidy
3159 <p>a</p>
3160 <ul class="gallery mw-gallery-traditional">
3161 <li class="gallerybox" style="width: 155px">
3162 <div style="width: 155px">
3163 <div class="thumb" style="width: 150px;">
3164 <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>
3165 </div>
3166 <div class="gallerytext"></div>
3167 </div>
3168 </li>
3169 </ul>
3170 !!end
3171
3172 !! test
3173 Table wikitext syntax outside wiki-tables
3174 !! wikitext
3175 a
3176 ! not a table heading
3177 |- not a table row
3178 | not a table cell
3179 | class="foo bar" | baz
3180 b
3181 |}
3182 |-
3183 c
3184 !! html
3185 <p>a
3186 ! not a table heading
3187 |- not a table row
3188 | not a table cell
3189 | class="foo bar" | baz
3190 b
3191 |}
3192 |-
3193 c
3194 </p>
3195 !! end
3196
3197 !!test
3198 Render paragraphs when indent-pre is suppressed in blocklevels
3199 !! wikitext
3200 <blockquote>
3201 foo
3202
3203 bar
3204 </blockquote>
3205 !! html
3206 <blockquote>
3207 <p> foo
3208 </p><p> bar
3209 </p>
3210 </blockquote>
3211
3212 !!end
3213
3214 !!test
3215 4. Multiple spaces at start-of-line
3216 !! wikitext
3217 <p> foo </p>
3218 foo
3219 {|
3220 |foo
3221 |}
3222 !! html
3223 <p> foo </p>
3224 <pre> foo
3225 </pre>
3226 <table>
3227 <tr>
3228 <td>foo
3229 </td></tr></table>
3230
3231 !!end
3232
3233 ## NOTE: the leading white-space chars on empty line are significant
3234 !! test
3235 5a. White-space in indent-pre
3236 !! wikitext
3237 a<br />
3238
3239 b
3240 !! html
3241 <pre>a<br />
3242
3243 b
3244 </pre>
3245 !! end
3246
3247 ## NOTE: the leading white-space chars on empty line are significant
3248 !! test
3249 5b. White-space in indent-pre
3250 !! wikitext
3251 a
3252
3253 b
3254
3255
3256 c
3257 !! html
3258 <pre>a
3259
3260 b
3261
3262
3263 c
3264 </pre>
3265 !! end
3266
3267 !! test
3268 5c. White-space in indent-pre
3269 !! wikitext
3270 ''a''
3271 ''b''
3272 ''c''
3273 !! html
3274 <pre><i>a</i>
3275 <i>b</i>
3276 <i>c</i>
3277 </pre>
3278 !! end
3279
3280 !! test
3281 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3282 !! wikitext
3283 a
3284
3285 <!-- continue -->
3286 b
3287
3288 c
3289
3290 d
3291 !! html
3292 <pre>a
3293
3294 b
3295 </pre>
3296 <pre>c
3297
3298 </pre>
3299 <p>d
3300 </p>
3301 !! end
3302
3303 !! test
3304 7a. Indent-pre and category links
3305 !! options
3306 parsoid=wt2html,wt2wt
3307 !! wikitext
3308 [[Category:foo]] <!-- No pre-wrapping -->
3309 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3310 !! html/php+tidy
3311 !! html/parsoid
3312 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3313 <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 -->
3314 !! end
3315
3316 !! test
3317 7b. Indent-pre and category links
3318 !! options
3319 parsoid=wt2html,wt2wt
3320 !! wikitext
3321 [[Category:foo]] a
3322 [[Category:foo]] {{echo|b}}
3323 !! html
3324 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3325 <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>
3326 !! end
3327
3328 !! test
3329 Indent-Pre: Newlines in comments shouldn't affect sol state
3330 !! wikitext
3331 a <!--
3332 foo
3333 --> b
3334 !! html/php+tidy
3335 <p>a b</p>
3336 !! html/parsoid
3337 <p>a <!--
3338 foo
3339 --> b</p>
3340 !! end
3341
3342 ###
3343 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3344 ###
3345
3346 !!test
3347 HTML-pre: 1. embedded newlines
3348 !! wikitext
3349 <pre>foo</pre>
3350
3351 <pre>
3352 foo
3353 </pre>
3354
3355 <pre>
3356
3357 foo
3358 </pre>
3359
3360 <pre>
3361
3362
3363 foo
3364 </pre>
3365 !! html/php+tidy
3366 <pre>
3367 foo
3368 </pre>
3369 <pre>
3370 foo
3371 </pre>
3372 <pre>
3373
3374 foo
3375 </pre>
3376 <pre>
3377
3378
3379 foo
3380 </pre>
3381 !! html/parsoid
3382 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3383
3384 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3385 foo
3386 </pre>
3387
3388 <pre data-parsoid='{"stx":"html"}'>
3389
3390 foo
3391 </pre>
3392
3393 <pre data-parsoid='{"stx":"html"}'>
3394
3395
3396 foo
3397 </pre>
3398 !!end
3399
3400 !! test
3401 HTML-pre: big spaces
3402 !! wikitext
3403 <pre>
3404
3405
3406
3407
3408 haha
3409
3410
3411
3412
3413 haha
3414
3415
3416
3417
3418 </pre>
3419 !! html/php+tidy
3420 <pre>
3421
3422
3423
3424
3425 haha
3426
3427
3428
3429
3430 haha
3431
3432
3433
3434
3435 </pre>
3436 !! html/parsoid
3437 <pre data-parsoid='{"stx":"html"}'>
3438
3439
3440
3441
3442 haha
3443
3444
3445
3446
3447 haha
3448
3449
3450
3451
3452 </pre>
3453 !! end
3454
3455 !!test
3456 HTML-pre: 2: indented text
3457 !! wikitext
3458 <pre>
3459 foo
3460 </pre>
3461 !! html
3462 <pre>
3463 foo
3464 </pre>
3465
3466 !!end
3467
3468 !!test
3469 HTML-pre: 3: other wikitext
3470 !! wikitext
3471 <pre>
3472 * foo
3473 # bar
3474 = no-h =
3475 '' no-italic ''
3476 [[ NoLink ]]
3477 </pre>
3478 !! html/php
3479 <pre>
3480 * foo
3481 # bar
3482 = no-h =
3483 '' no-italic ''
3484 [[ NoLink ]]
3485 </pre>
3486
3487 !! html/parsoid
3488 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3489 # bar
3490 = no-h =
3491 '' no-italic ''
3492 [[ NoLink ]]
3493 </pre>
3494 !!end
3495
3496 ###
3497 ### Definition lists
3498 ###
3499 !! test
3500 Simple definition
3501 !! wikitext
3502 ; name : Definition
3503 !! html
3504 <dl><dt> name&#160;</dt>
3505 <dd> Definition</dd></dl>
3506
3507 !! end
3508
3509 !! test
3510 Definition list for indentation only
3511 !! wikitext
3512 : Indented text
3513 !! html
3514 <dl><dd> Indented text</dd></dl>
3515
3516 !! end
3517
3518 !! test
3519 Definition list with no space
3520 !! wikitext
3521 ;name:Definition
3522 !! html
3523 <dl><dt>name</dt>
3524 <dd>Definition</dd></dl>
3525
3526 !!end
3527
3528 !! test
3529 Definition list with URL link
3530 !! wikitext
3531 ; http://example.com/ : definition
3532 !! html
3533 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3534 <dd> definition</dd></dl>
3535
3536 !! end
3537
3538 !! test
3539 Definition list with bracketed URL link
3540 !! wikitext
3541 ;[http://www.example.com/ Example]:Something about it
3542 !! html
3543 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3544 <dd>Something about it</dd></dl>
3545
3546 !! end
3547
3548 !! test
3549 Definition list with wikilink containing colon
3550 !! wikitext
3551 ; [[Help:FAQ]]: The least-read page on Wikipedia
3552 !! html
3553 <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>
3554 <dd> The least-read page on Wikipedia</dd></dl>
3555
3556 !! end
3557
3558 # At Brion's and JeLuF's insistence... :)
3559 !! test
3560 Definition list with news link containing colon
3561 !! wikitext
3562 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3563 !! html/php
3564 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3565 <dd> This isn't even a real newsgroup!</dd></dl>
3566
3567 !! html/parsoid
3568 <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>
3569 !! end
3570
3571 !! test
3572 Malformed definition list with colon
3573 !! wikitext
3574 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3575 !! html
3576 <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>
3577
3578 !! end
3579
3580 !! test
3581 Definition lists: colon in external link text
3582 !! wikitext
3583 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3584 !! html
3585 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3586 <dd> OK, I made that up</dd></dl>
3587
3588 !! end
3589
3590 !! test
3591 Definition lists: colon in HTML attribute
3592 !! wikitext
3593 ;<b style="display: inline">bold</b>
3594 !! html
3595 <dl><dt><b style="display: inline">bold</b></dt></dl>
3596
3597 !! end
3598
3599 !! test
3600 Definition lists: self-closed tag
3601 !! wikitext
3602 ;one<br/>two : two-line fun
3603 !! html
3604 <dl><dt>one<br />two&#160;</dt>
3605 <dd> two-line fun</dd></dl>
3606
3607 !! end
3608
3609 !! test
3610 Bug 11748: Literal closing tags
3611 !! wikitext
3612 <dl>
3613 <dt>test 1</dt>
3614 <dd>test test test test test</dd>
3615 <dt>test 2</dt>
3616 <dd>test test test test test</dd>
3617 </dl>
3618 !! html
3619 <dl>
3620 <dt>test 1</dt>
3621 <dd>test test test test test</dd>
3622 <dt>test 2</dt>
3623 <dd>test test test test test</dd>
3624 </dl>
3625
3626 !! end
3627
3628 !! test
3629 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3630 !! wikitext
3631 <ul><li>
3632 ; term : description
3633 * unordered
3634 </li></ul>
3635 !! html
3636 <ul><li>
3637 <dl><dt> term&#160;</dt>
3638 <dd> description</dd></dl>
3639 <ul><li> unordered</li></ul>
3640 </li></ul>
3641
3642 !! end
3643
3644 !! test
3645
3646 Definition list with empty definition and following paragraph
3647 !! wikitext
3648 ; term:
3649 Paragraph text
3650 !! html
3651 <dl><dt> term</dt>
3652 <dd></dd></dl>
3653 <p>Paragraph text
3654 </p>
3655 !! end
3656
3657 !! test
3658 Nested definition lists using html syntax
3659 !! wikitext
3660 <dl><dt>x</dt>
3661 <dd>a</dd>
3662 <dd>b</dd></dl>
3663
3664 !! end
3665
3666 !! test
3667 Definition Lists: No nesting: Multiple dd's
3668 !! wikitext
3669 ;x
3670 :a
3671 :b
3672 !! html
3673 <dl><dt>x</dt>
3674 <dd>a</dd>
3675 <dd>b</dd></dl>
3676
3677 !! end
3678
3679 !! test
3680 Definition Lists: Indentation: Regular
3681 !! wikitext
3682 :i1
3683 ::i2
3684 :::i3
3685 !! html
3686 <dl><dd>i1
3687 <dl><dd>i2
3688 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3689
3690 !! end
3691
3692 !! test
3693 Definition Lists: Indentation: Missing 1st level
3694 !! wikitext
3695 ::i2
3696 :::i3
3697 !! html
3698 <dl><dd><dl><dd>i2
3699 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3700
3701 !! end
3702
3703 !! test
3704 Definition Lists: Indentation: Multi-level indent
3705 !! wikitext
3706 :::i3
3707 !! html
3708 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition Lists: Hacky use to indent tables
3714 !! wikitext
3715 ::{|
3716 |foo
3717 |bar
3718 |}
3719 this text
3720 should be left alone
3721 !! html
3722 <dl><dd><dl><dd><table>
3723 <tr>
3724 <td>foo
3725 </td>
3726 <td>bar
3727 </td></tr></table></dd></dl></dd></dl>
3728 <p>this text
3729 should be left alone
3730 </p>
3731 !! end
3732
3733 !! test
3734 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3735 !! wikitext
3736 <!-- foo -->
3737 ::{|
3738 |foo
3739 |bar
3740 |}<!-- bar -->
3741 this text
3742 should be left alone
3743 !! html/parsoid
3744 <!-- foo -->
3745 <dl><dd><dl><dd><table><tr>
3746 <td>foo</td>
3747 <td>bar</td>
3748 </tr></table><!-- bar --></dd></dl></dd></dl>
3749 <p>this text
3750 should be left alone</p>
3751 !! end
3752
3753 !! test
3754 Definition Lists: Hacky use to indent tables, with comment before table
3755 !! wikitext
3756 ::<!-- foo -->{|
3757 |foo
3758 |}
3759 !! html/parsoid
3760 <dl><dd><dl><dd><!-- foo --><table><tr>
3761 <td>foo</td>
3762 </tr></table></dd></dl></dd></dl>
3763 !! end
3764
3765 # The trailing whitespace in this test is to catch a regression in
3766 # Parsoid after T54473.
3767 !! test
3768 Definition Lists: Hacky use to indent tables (WS-insensitive)
3769 !! wikitext
3770 : {|
3771 |a
3772 |}
3773 !! html/php
3774 <dl><dd><table>
3775 <tr>
3776 <td>a
3777 </td></tr></table></dd></dl>
3778
3779 !! html/parsoid
3780 <dl><dd> <table>
3781 <tbody><tr><td>a</td></tr>
3782 </tbody></table> </dd></dl>
3783 !! end
3784
3785 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3786 ## as an empty dt item. It also ignores all but the last ";" when followed
3787 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3788 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3789 ## ";"s.
3790 ##
3791 ## Ex: ";;t2 ::d2" is transformed into:
3792 ##
3793 ## <dl>
3794 ## <dt>t2 </dt>
3795 ## <dd>
3796 ## <dl>
3797 ## <dt></dt>
3798 ## <dd>d2</dd>
3799 ## </dl>
3800 ## </dd>
3801 ## </dl>
3802 ##
3803 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3804 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3805 ##
3806 ## <dl>
3807 ## <dt>
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>:d2</dd>
3811 ## </dl>
3812 ## </dt>
3813 ## </dl>
3814 ##
3815 ## All Parsoid only definition list tests have this difference.
3816 ##
3817 ## See also: https://phabricator.wikimedia.org/T8569
3818 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3819
3820 !! test
3821 Table / list interaction: indented table with lists in table contents
3822 !! wikitext
3823 :{|
3824 |-
3825 | a
3826 * b
3827 |-
3828 | c
3829 * d
3830 |}
3831 !! html
3832 <dl><dd><table>
3833
3834 <tr>
3835 <td> a
3836 <ul><li> b</li></ul>
3837 </td></tr>
3838 <tr>
3839 <td> c
3840 <ul><li> d</li></ul>
3841 </td></tr></table></dd></dl>
3842
3843 !! end
3844
3845 !!test
3846 Table / list interaction: lists nested in tables nested in indented lists
3847 !! wikitext
3848 :{|
3849 |
3850 :a
3851 :b
3852 |
3853 *c
3854 *d
3855 |}
3856
3857 *e
3858 *f
3859 !! html
3860 <dl><dd><table>
3861 <tr>
3862 <td>
3863 <dl><dd>a</dd>
3864 <dd>b</dd></dl>
3865 </td>
3866 <td>
3867 <ul><li>c</li>
3868 <li>d</li></ul>
3869 </td></tr></table></dd></dl>
3870 <ul><li>e</li>
3871 <li>f</li></ul>
3872
3873 !!end
3874
3875 !! test
3876 Definition Lists: Nesting: Multi-level (Parsoid only)
3877 !! options
3878 parsoid
3879 !! wikitext
3880 ;t1 :d1
3881 ;;t2 ::d2
3882 ;;;t3 :::d3
3883 !! html
3884 <dl>
3885 <dt>t1 </dt>
3886 <dd>d1</dd>
3887 <dt>
3888 <dl>
3889 <dt>t2 </dt>
3890 <dd>:d2</dd>
3891 <dt>
3892 <dl>
3893 <dt>t3 </dt>
3894 <dd>::d3</dd>
3895 </dl>
3896 </dt>
3897 </dl>
3898 </dt>
3899 </dl>
3900
3901
3902 !! end
3903
3904
3905 !! test
3906 Definition Lists: Nesting: Test 2 (Parsoid only)
3907 !! wikitext
3908 ;t1
3909 ::d2
3910 !! html/php+tidy
3911 <dl>
3912 <dt>t1</dt>
3913 <dd>
3914 <dl>
3915 <dd>d2</dd>
3916 </dl>
3917 </dd>
3918 </dl>
3919 !! html/parsoid
3920 <dl>
3921 <dt>t1</dt>
3922 <dd>
3923 <dl>
3924 <dd>d2</dd>
3925 </dl>
3926 </dd>
3927 </dl>
3928
3929 !! end
3930
3931
3932 !! test
3933 Definition Lists: Nesting: Test 3 (Parsoid only)
3934 !! wikitext
3935 :;t1
3936 ::::d2
3937 !! html/php+tidy
3938 <dl>
3939 <dd>
3940 <dl>
3941 <dt>t1</dt>
3942 <dd>
3943 <dl>
3944 <dd>
3945 <dl>
3946 <dd>d2</dd>
3947 </dl>
3948 </dd>
3949 </dl>
3950 </dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954 !! html/parsoid
3955 <dl>
3956 <dd>
3957 <dl>
3958 <dt>t1</dt>
3959 <dd>
3960 <dl>
3961 <dd>
3962 <dl>
3963 <dd>d2</dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 </dd>
3970 </dl>
3971
3972 !! end
3973
3974
3975 !! test
3976 Definition Lists: Nesting: Test 4
3977 !! wikitext
3978 ::;t3
3979 :::d3
3980 !! html
3981 <dl><dd><dl><dd><dl><dt>t3</dt>
3982 <dd>d3</dd></dl></dd></dl></dd></dl>
3983
3984 !! end
3985
3986
3987 ## The Parsoid team believes the following three test exposes a
3988 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3989 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3990 ## It also exposes a "misfeature" in tidy, which doesn't like
3991 ## <dl> tags with a single <dt> child; it converts the <dt> into
3992 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3993 !! test
3994 Definition Lists: Mixed Lists: Test 1
3995 !! wikitext
3996 :;* foo
3997 ::* bar
3998 :; baz
3999 !! html/php
4000 <dl><dd><dl><dt><ul><li> foo</li>
4001 <li> bar</li></ul></dt></dl>
4002 <dl><dt> baz</dt></dl></dd></dl>
4003
4004 !! html/php+tidy
4005 <dl>
4006 <dd>
4007 <dl>
4008 <dd>
4009 <ul>
4010 <li>foo</li>
4011 <li>bar</li>
4012 </ul>
4013 </dd>
4014 </dl>
4015 <dl>
4016 <dt>baz</dt>
4017 </dl>
4018 </dd>
4019 </dl>
4020 !! html/parsoid
4021 <dl>
4022 <dd><dl>
4023 <dt><ul>
4024 <li> foo
4025 </li>
4026 </ul></dt>
4027 <dd><ul>
4028 <li> bar
4029 </li>
4030 </ul></dd>
4031 <dt> baz</dt>
4032 </dl></dd>
4033 </dl>
4034 !! end
4035
4036 !! test
4037 Definition Lists: Mixed Lists: Test 2
4038 !! wikitext
4039 *: d1
4040 *: d2
4041 !! html
4042 <ul><li><dl><dd> d1</dd>
4043 <dd> d2</dd></dl></li></ul>
4044
4045 !! end
4046
4047
4048 !! test
4049 Definition Lists: Mixed Lists: Test 3
4050 !! wikitext
4051 *::: d1
4052 *::: d2
4053 !! html
4054 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4055 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4056
4057 !! end
4058
4059
4060 !! test
4061 Definition Lists: Mixed Lists: Test 4
4062 !! wikitext
4063 *;d1 :d2
4064 *;d3 :d4
4065 !! html
4066 <ul><li><dl><dt>d1&#160;</dt>
4067 <dd>d2</dd>
4068 <dt>d3&#160;</dt>
4069 <dd>d4</dd></dl></li></ul>
4070
4071 !! end
4072
4073
4074 !! test
4075 Definition Lists: Mixed Lists: Test 5
4076 !! wikitext
4077 *:d1
4078 *:: d2
4079 !! html
4080 <ul><li><dl><dd>d1
4081 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Mixed Lists: Test 6
4088 !! wikitext
4089 #*:d1
4090 #*::: d3
4091 !! html
4092 <ol><li><ul><li><dl><dd>d1
4093 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4094
4095 !! end
4096
4097
4098 !! test
4099 Definition Lists: Mixed Lists: Test 7
4100 !! wikitext
4101 :* d1
4102 :* d2
4103 !! html
4104 <dl><dd><ul><li> d1</li>
4105 <li> d2</li></ul></dd></dl>
4106
4107 !! end
4108
4109
4110 !! test
4111 Definition Lists: Mixed Lists: Test 8
4112 !! wikitext
4113 :* d1
4114 ::* d2
4115 !! html
4116 <dl><dd><ul><li> d1</li></ul>
4117 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4118
4119 !! end
4120
4121
4122 !! test
4123 Definition Lists: Mixed Lists: Test 9
4124 !! wikitext
4125 *;foo :bar
4126 !! html
4127 <ul><li><dl><dt>foo&#160;</dt>
4128 <dd>bar</dd></dl></li></ul>
4129
4130 !! end
4131
4132
4133 !! test
4134 Definition Lists: Mixed Lists: Test 10
4135 !! wikitext
4136 *#;foo :bar
4137 !! html
4138 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4139 <dd>bar</dd></dl></li></ol></li></ul>
4140
4141 !! end
4142
4143 # The Parsoid team disagrees with the PHP parser's seemingly-random
4144 # rules regarding dd/dt on the next two tests. Parsoid is more
4145 # consistent, and recognizes the shared nesting and keeps the
4146 # still-open tags around until the nesting is complete.
4147 # (And tidy again converts <dt> to <dd> before 'bar'.)
4148
4149 !! test
4150 Definition Lists: Mixed Lists: Test 11
4151 !! wikitext
4152 *#*#;*;;foo :bar
4153 *#*#;boo :baz
4154 !! html/php
4155 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4156 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4157 <dl><dt>boo&#160;</dt>
4158 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4159
4160 !! html/php+tidy
4161 <ul>
4162 <li>
4163 <ol>
4164 <li>
4165 <ul>
4166 <li>
4167 <ol>
4168 <li>
4169 <dl>
4170 <dt>foo&#160;</dt>
4171 <dd>
4172 <ul>
4173 <li>
4174 <dl>
4175 <dd>
4176 <dl>
4177 <dt>bar</dt>
4178 </dl>
4179 </dd>
4180 </dl>
4181 </li>
4182 </ul>
4183 </dd>
4184 </dl>
4185 <dl>
4186 <dt>boo&#160;</dt>
4187 <dd>baz</dd>
4188 </dl>
4189 </li>
4190 </ol>
4191 </li>
4192 </ul>
4193 </li>
4194 </ol>
4195 </li>
4196 </ul>
4197 !! html/parsoid
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>
4208 <ul>
4209 <li>
4210 <dl>
4211 <dt>
4212 <dl>
4213 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4214 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4215 </dl></dt>
4216 </dl></li>
4217 </ul></dt>
4218 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4219 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4220 </dl></li>
4221 </ol></li>
4222 </ul></li>
4223 </ol></li>
4224 </ul>
4225 !! end
4226
4227
4228 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4229 # From whitelist:
4230 # * The test is wrong, there are two colons where there should be :;
4231 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4232 !! test
4233 Definition Lists: Weird Ones: Test 1
4234 !! wikitext
4235 *#;*::;; foo : bar (who uses this?)
4236 !! html/php
4237 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4238 <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>
4239
4240 !! html/php+tidy
4241 <ul>
4242 <li>
4243 <ol>
4244 <li>
4245 <dl>
4246 <dt>foo&#160;</dt>
4247 <dd>
4248 <ul>
4249 <li>
4250 <dl>
4251 <dd>
4252 <dl>
4253 <dd>
4254 <dl>
4255 <dd>
4256 <dl>
4257 <dt>bar (who uses this?)</dt>
4258 </dl>
4259 </dd>
4260 </dl>
4261 </dd>
4262 </dl>
4263 </dd>
4264 </dl>
4265 </li>
4266 </ul>
4267 </dd>
4268 </dl>
4269 </li>
4270 </ol>
4271 </li>
4272 </ul>
4273 !! html/parsoid
4274 <ul>
4275 <li>
4276 <ol>
4277 <li>
4278 <dl>
4279 <dt>
4280 <ul>
4281 <li>
4282 <dl>
4283 <dd>
4284 <dl>
4285 <dd>
4286 <dl>
4287 <dt>
4288 <dl>
4289 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4290 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4291 </dl></dt>
4292 </dl></dd>
4293 </dl></dd>
4294 </dl></li>
4295 </ul></dt>
4296 </dl></li>
4297 </ol></li>
4298 </ul>
4299 !! end
4300
4301 !! test
4302 Definition Lists: colons occurring in tags
4303 !! wikitext
4304 ;a:b
4305 ;'''a:b'''
4306 ;<i>a:b</i>
4307 ;<span>a:b</span>
4308 ;<div>a:b</div>
4309 ;<div>a
4310 :b</div>
4311 ;{{echo|a:b}}
4312 ;{{echo|''a:b''}}
4313 ;;;''a:b''
4314 !! html+tidy
4315 <dl>
4316 <dt>a</dt>
4317 <dd>b</dd>
4318 <dt><b>a:b</b></dt>
4319 <dt><i>a:b</i></dt>
4320 <dt><span>a:b</span></dt>
4321 <dd>
4322 <div>a:b</div>
4323 </dd>
4324 <dd>
4325 <div>a
4326 <dl>
4327 <dd>b</dd>
4328 </dl>
4329 </div>
4330 </dd>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><i>a:b</i></dt>
4334 </dl>
4335 <dl>
4336 <dd>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dt><i>a:b</i></dt>
4341 </dl>
4342 </dd>
4343 </dl>
4344 </dd>
4345 </dl>
4346 !! html/parsoid
4347 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4348 <dt><b>a:b</b></dt>
4349 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4350 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4351 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4352 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4353 <dd>b</dd>
4354 <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>
4355 <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>
4356 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4357 !! end
4358
4359 !! test
4360 Definition Lists: colons and tables 1
4361 !! wikitext
4362 :{|
4363 | x
4364 |}
4365 :{|
4366 | y
4367 |}
4368 !! html
4369 <dl><dd><table>
4370 <tr>
4371 <td> x
4372 </td></tr></table></dd></dl>
4373 <dl><dd><table>
4374 <tr>
4375 <td> y
4376 </td></tr></table></dd></dl>
4377
4378 !! end
4379
4380 # Parsoid's output (as documented below) differs from php's in this case.
4381 # This is probably a bug. If we fixup parsoid to match php's output, the
4382 # above test should pass and the below test case can be removed. It is
4383 # unclear which output is more desirable.
4384
4385 !! test
4386 Definition Lists: colons and tables 2
4387 !! wikitext
4388 :{|
4389 | x
4390 |}
4391 :{|
4392 | y
4393 |}
4394 !! html/parsoid
4395 <dl><dd><table>
4396 <tr>
4397 <td> x
4398 </td></tr></table></dd>
4399 <dd><table>
4400 <tr>
4401 <td> y
4402 </td></tr></table></dd></dl>
4403 !! end
4404
4405 !! test
4406 Definition Lists: template interaction
4407 !! wikitext
4408 ::{{definition_list}}
4409
4410 :one
4411 ::{{definition_list}}
4412 :::two
4413 :::three
4414 ::four
4415 !! html/parsoid
4416 <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">
4417 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4418
4419 <dl><dd data-parsoid='{}'>one
4420 <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">
4421 </span><dd about="#mwt2">two
4422 <dl><dd>two</dd>
4423 <dd>three</dd></dl></dd>
4424 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4425 !! end
4426
4427
4428 ###
4429 ### External links
4430 ###
4431 !! test
4432 External links: non-bracketed
4433 !! wikitext
4434 Non-bracketed: http://example.com
4435 !! html
4436 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4437 </p>
4438 !! end
4439
4440 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4441 !! test
4442 External links: numbered
4443 !! wikitext
4444 Numbered: [http://example.com]
4445 Numbered: [http://example.net]
4446 Numbered: [http://example.com]
4447 !! html/php
4448 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4449 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4450 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4451 </p>
4452 !! html/parsoid
4453 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4454 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4455 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4456 !!end
4457
4458 !! test
4459 External links: specified text
4460 !! wikitext
4461 Specified text: [http://example.com link]
4462 !! html
4463 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4464 </p>
4465 !!end
4466
4467 !! test
4468 External links: trail
4469 !! wikitext
4470 Linktrails should not work for external links: [http://example.com link]s
4471 !! html
4472 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4473 </p>
4474 !! end
4475
4476 !! test
4477 External links: dollar sign in URL
4478 !! wikitext
4479 http://example.com/1$2345
4480 !! html
4481 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4482 </p>
4483 !! end
4484
4485 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4486 !! test
4487 External links: dollar sign in URL (autonumber)
4488 !! wikitext
4489 [http://example.com/1$2345]
4490 !! html/php
4491 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4492 </p>
4493 !! html/parsoid
4494 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4495 !!end
4496
4497 !! test
4498 External links: open square bracket forbidden in URL (bug 4377)
4499 !! options
4500 parsoid=wt2html,wt2wt,html2html
4501 !! wikitext
4502 http://example.com/1[2345
4503 !! html/php
4504 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4505 </p>
4506 !! html/parsoid
4507 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4508 !! end
4509
4510 !! test
4511 External links: open square bracket forbidden in URL (named) (bug 4377)
4512 !! options
4513 parsoid=wt2html,html2html
4514 !! wikitext
4515 [http://example.com/1[2345]
4516 !! html/php
4517 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4518 </p>
4519 !! html/parsoid
4520 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4521 !!end
4522
4523 # parsoid adds a space before the link name
4524 !! test
4525 External links: open square bracket forbidden in URL (named) (bug 4377)
4526 Parsoid variant.
4527 !! wikitext
4528 [http://example.com/1 [2345]
4529 !! html
4530 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4531 </p>
4532 !!end
4533
4534 !! test
4535 External links: nowiki in URL link text (bug 6230)
4536 !! wikitext
4537 [http://example.com/ <nowiki>''example site''</nowiki>]
4538 !! html
4539 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4540 </p>
4541 !! end
4542
4543 !! test
4544 External links: newline forbidden in text (bug 6230 regression check)
4545 !! wikitext
4546 [http://example.com/ first
4547 second]
4548 !! html
4549 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4550 second]
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: Pipe char between url and text
4556 !! wikitext
4557 [http://example.com | link]
4558 !! html
4559 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4560 </p>
4561 !!end
4562
4563 !! test
4564 External links: protocol-relative URL in brackets
4565 !! wikitext
4566 [//example.com/ Test]
4567 !! html
4568 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4569 </p>
4570 !! end
4571
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: protocol-relative URL in brackets without text
4575 !! wikitext
4576 [//example.com]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4582 !! end
4583
4584 !! test
4585 External links: protocol-relative URL in free text is left alone
4586 !! wikitext
4587 //example.com/Foo
4588 !! html
4589 <p>//example.com/Foo
4590 </p>
4591 !!end
4592
4593 !! test
4594 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4595 !! wikitext
4596 foo//example.com/Foo
4597 !! html
4598 <p>foo//example.com/Foo
4599 </p>
4600 !! end
4601
4602 !! test
4603 External links: with no contents
4604 !! wikitext
4605 [http://en.wikipedia.org/wiki/Foo]
4606
4607 [[wikipedia:Foo|Bar]]
4608
4609 [[wikipedia:Foo|<span>Bar</span>]]
4610 !! html/php
4611 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4612 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4613 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4614 </p>
4615 !! html/parsoid
4616 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4617 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4618 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4619 !! end
4620
4621 !! test
4622 External links: Free with trailing punctuation
4623 !! wikitext
4624 http://example.com,
4625 http://example.com;
4626 http://example.com\
4627 http://example.com.
4628 http://example.com:
4629 http://example.com!
4630 http://example.com?
4631 http://example.com)
4632 http://example.com/url_with_(brackets)
4633 (http://example.com/url_without_brackets)
4634 http://example.com/url_with_entity&nbsp;
4635 http://example.com/url_with_entity&#xA0;
4636 http://example.com/url_with_entity&#160;
4637 http://example.com/url_with_entity&lt;
4638 http://example.com/url_with_entity&#x3C;
4639 http://example.com/url_with_entity&#60;
4640 !! html/php
4641 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4642 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4643 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4644 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4645 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4647 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4648 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4649 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4650 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4651 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4652 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4653 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4654 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4655 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4656 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4657 </p>
4658 !! html/parsoid
4659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4660 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4661 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4662 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4663 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4664 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4665 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4666 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4667 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4668 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4669 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4670 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4671 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4672 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4673 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4674 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4675 !! end
4676
4677 !! test
4678 External links: Lone protocols are never linked (T105697)
4679 !! wikitext
4680 http://
4681 http://;
4682 (http://)
4683 bitcoin:
4684 bitcoin:;
4685 (bitcoin:)
4686 !! html
4687 <p>http://
4688 http://;
4689 (http://)
4690 bitcoin:
4691 bitcoin:;
4692 (bitcoin:)
4693 </p>
4694 !! end
4695
4696 !! test
4697 External links: No preceding word characters allowed (bug 65278)
4698 !! wikitext
4699 NOPEhttp://example.com
4700 N0http://example.com
4701 ok:http://example.com
4702 ok-http://example.com
4703 !! html
4704 <p>NOPEhttp://example.com
4705 N0http://example.com
4706 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4707 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4708 </p>
4709 !! end
4710
4711 !! test
4712 External image
4713 !! wikitext
4714 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4715 !! html
4716 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4717 </p>
4718 !! end
4719
4720 !! test
4721 External image from https
4722 !! wikitext
4723 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4724 !! html
4725 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4726 </p>
4727 !! end
4728
4729 !! test
4730 External image (when not allowed)
4731 !! options
4732 wgAllowExternalImages=0
4733 !! wikitext
4734 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4735 !! html
4736 <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>
4737 </p>
4738 !! end
4739
4740 !! test
4741 Link to non-http image, no img tag
4742 !! wikitext
4743 Link to non-http image, no img tag: ftp://example.com/test.jpg
4744 !! html
4745 <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>
4746 </p>
4747 !! end
4748
4749 !! test
4750 External links: terminating separator
4751 !! wikitext
4752 Terminating separator: http://example.com/thing,
4753 !! html
4754 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4755 </p>
4756 !! end
4757
4758 !! test
4759 External links: intervening separator
4760 !! wikitext
4761 Intervening separator: http://example.com/1,2,3
4762 !! html
4763 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4764 </p>
4765 !! end
4766
4767 !! test
4768 External links: old bug with URL in query
4769 !! wikitext
4770 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4771 !! html
4772 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4773 </p>
4774 !! end
4775
4776 !! test
4777 External links: old URL-in-URL bug, mixed protocols
4778 !! wikitext
4779 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4780 !! html
4781 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4782 </p>
4783 !!end
4784
4785 !! test
4786 External links: URL in text
4787 !! wikitext
4788 URL in text: [http://example.com http://example.com]
4789 !! html
4790 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4791 </p>
4792 !! end
4793
4794 !! test
4795 External links: Clickable images
4796 !! wikitext
4797 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4798 !! html/php
4799 <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>
4800 </p>
4801 !! html/parsoid
4802 <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>
4803 !! end
4804
4805 !! test
4806 External links: raw ampersand
4807 !! wikitext
4808 Old &amp; use: http://x&y
4809 !! html
4810 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4811 </p>
4812 !! end
4813
4814 !! test
4815 External links: encoded ampersand
4816 !! wikitext
4817 Old &amp; use: http://x&amp;y
4818 !! html/php
4819 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4820 </p>
4821 !! html/parsoid
4822 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4823 !! end
4824
4825 !! test
4826 External links: encoded equals (bug 6102)
4827 !! wikitext
4828 http://example.com/?foo&#61;bar
4829 !! html/php
4830 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4831 </p>
4832 !! html/parsoid
4833 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4834 !! end
4835
4836 ##
4837 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4838 ## does it number them. As discussed in bug 53505, we can identify
4839 ## autonumbered links via CSS.
4840 ##
4841
4842 !! test
4843 External links: [raw ampersand]
4844 !! wikitext
4845 Old &amp; use: [http://x&y]
4846 !! html/php
4847 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4848 </p>
4849 !! html/parsoid
4850 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4851 !! end
4852
4853 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4854 # mode will return the [raw ampersand] wikitext
4855 !! test
4856 External links: [encoded ampersand]
4857 !! options
4858 parsoid=wt2html,wt2wt,html2html
4859 !! wikitext
4860 Old &amp; use: [http://x&amp;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 !! test
4869 External links: [raw equals]
4870 !! wikitext
4871 [http://example.com/?foo=bar]
4872 !! html/php
4873 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4874 </p>
4875 !! html/parsoid
4876 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4877 !! end
4878
4879 # note that parsoid html is identical to [raw equals] case; so html2wt
4880 # mode will return the [raw equals] wikitext
4881 !! test
4882 External links: [encoded equals] (bug 6102)
4883 !! options
4884 parsoid=wt2html,wt2wt,html2html
4885 !! wikitext
4886 [http://example.com/?foo&#61;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 # xxx parsoid strips the IDN character, so the round-trip tests will
4895 # obviously fail and are disabled. --cscott
4896 !! test
4897 External links: [IDN ignored character reference in hostname; strip it right off]
4898 !! options
4899 parsoid=wt2html,wt2wt,html2html
4900 !! wikitext
4901 [http://e&zwnj;xample.com/]
4902 !! html/php
4903 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4907 !! end
4908
4909 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4910 # Where an external link could easily circumvent the sanitization of the text of
4911 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4912 # test demands a higher standard. That's a bit strange.
4913 #
4914 # Example:
4915 #
4916 # http://e‌xample.com -> [http://example.com|http://example.com]
4917 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4918 #
4919 # The first example is sanitized, but the second is not. Any security benefits
4920 # from this production are trivial to circumvent. Either remove this test and
4921 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4922 # the test accordingly.
4923 #
4924 # All our love,
4925 # The Parsoid team.
4926 # xxx parsoid strips the IDN character, so the round-trip tests will
4927 # obviously fail and are disabled. --cscott
4928 !! test
4929 External links: IDN ignored character reference in hostname; strip it right off
4930 !! options
4931 parsoid=wt2html,html2html
4932 !! wikitext
4933 http://e&zwnj;xample.com/
4934 !! html/php
4935 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4936 </p>
4937 !! html/parsoid
4938 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4939 !! end
4940
4941 !! test
4942 External links: www.jpeg.org (bug 554)
4943 !! wikitext
4944 http://www.jpeg.org
4945 !! html
4946 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4947 </p>
4948 !! end
4949
4950 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4951 !! test
4952 External links: URL within URL (original bug 2)
4953 !! wikitext
4954 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4960 !! end
4961
4962 !! test
4963 BUG 361: URL inside bracketed URL
4964 !! wikitext
4965 [http://www.example.com/foo http://www.example.com/bar]
4966 !! html
4967 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4968 </p>
4969 !! end
4970
4971 !! test
4972 BUG 361: URL within URL, not bracketed
4973 !! wikitext
4974 http://www.example.com/foo?=http://www.example.com/bar
4975 !! html
4976 <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>
4977 </p>
4978 !! end
4979
4980 !! test
4981 BUG 289: ">"-token in URL-tail
4982 !! wikitext
4983 http://www.example.com/<hello>
4984 !! html
4985 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4986 </p>
4987 !!end
4988
4989 !! test
4990 BUG 289: literal ">"-token in URL-tail
4991 !! wikitext
4992 http://www.example.com/<b>html</b>
4993 !! html/php
4994 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4995 </p>
4996 !! html/parsoid
4997 <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>
4998 !! end
4999
5000 !! test
5001 BUG 289: ">"-token in bracketed URL
5002 !! wikitext
5003 [http://www.example.com/<hello> stuff]
5004 !! html
5005 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5006 </p>
5007 !!end
5008
5009 !! test
5010 BUG 289: literal ">"-token in bracketed URL
5011 !! wikitext
5012 [http://www.example.com/<b>html</b> stuff]
5013 !! html
5014 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5015 </p>
5016 !!end
5017
5018 !! test
5019 BUG 289: literal double quote at end of URL
5020 !! wikitext
5021 http://www.example.com/"hello"
5022 !! html
5023 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5024 </p>
5025 !!end
5026
5027 !! test
5028 BUG 289: literal double quote in bracketed URL
5029 !! wikitext
5030 [http://www.example.com/"hello" stuff]
5031 !! html
5032 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5033 </p>
5034 !!end
5035
5036 !! test
5037 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5038 !! wikitext
5039 [http://www.example.com test]
5040 !! html
5041 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5042 </p>
5043 !! end
5044
5045 !! test
5046 External links: link text with spaces
5047 !! wikitext
5048 [http://www.example.com a b c]
5049 [http://www.example.com ''a'' ''b'']
5050 !! html
5051 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5052 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5053 </p>
5054 !! end
5055
5056 !! test
5057 External links: wiki links within external link (Bug 3695)
5058 !! wikitext
5059 [http://example.com [[wikilink]] embedded in ext link]
5060 !! html/php
5061 <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>
5062 </p>
5063 !! html/parsoid
5064 <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>
5065 !! end
5066
5067 !! test
5068 BUG 787: Links with one slash after the url protocol are invalid
5069 !! wikitext
5070 http:/example.com
5071
5072 [http:/example.com title]
5073 !! html
5074 <p>http:/example.com
5075 </p><p>[http:/example.com title]
5076 </p>
5077 !! end
5078
5079 !! test
5080 Bracketed external links with template-generated invalid target
5081 !! wikitext
5082 [{{echo|http:/example.com}} title]
5083 !! html
5084 <p>[http:/example.com title]
5085 </p>
5086 !! end
5087
5088 !! test
5089 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5090 !! wikitext
5091 ''[http://example.com text'']
5092 [http://example.com '''text]'''
5093 ''Something [http://example.com in italic'']
5094 ''Something [http://example.com mixed''''', even bold]'''
5095 '''''Now [http://example.com both''''']
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5098 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5099 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5100 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5101 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5102 </p>
5103 !! end
5104
5105
5106 !! test
5107 Bug 4781: %26 in URL
5108 !! wikitext
5109 http://www.example.com/?title=AT%26T
5110 !! html/php
5111 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5112 </p>
5113 !! html/parsoid
5114 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5115 !! end
5116
5117 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5118 # % is actually legal in HTML5. Any change in output would need testing though.
5119 !! test
5120 Bug 4781, 5267: %25 in URL
5121 !! wikitext
5122 http://www.example.com/?title=100%25_Bran
5123 !! html/php
5124 <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>
5125 </p>
5126 !! html/parsoid
5127 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5128 !! end
5129
5130 !! test
5131 Bug 4781, 5267: %28, %29 in URL
5132 !! wikitext
5133 http://www.example.com/?title=Ben-Hur_%281959_film%29
5134 !! html/php
5135 <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>
5136 </p>
5137 !! html/parsoid
5138 <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>
5139 !! end
5140
5141
5142 !! test
5143 Bug 4781: %26 in autonumber URL
5144 !! wikitext
5145 [http://www.example.com/?title=AT%26T]
5146 !! html/php
5147 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5148 </p>
5149 !! html/parsoid
5150 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5151 !! end
5152
5153 !! test
5154 Bug 4781, 5267: %26 in autonumber URL
5155 !! wikitext
5156 [http://www.example.com/?title=100%25_Bran]
5157 !! html/php
5158 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5159 </p>
5160 !! html/parsoid
5161 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5162 !! end
5163
5164 !! test
5165 Bug 4781, 5267: %28, %29 in autonumber URL
5166 !! wikitext
5167 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5168 !! html/php
5169 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5170 </p>
5171 !! html/parsoid
5172 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5173 !! end
5174
5175
5176 !! test
5177 Bug 4781: %26 in bracketed URL
5178 !! wikitext
5179 [http://www.example.com/?title=AT%26T link]
5180 !! html/php
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5182 </p>
5183 !! html/parsoid
5184 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5185 !! end
5186
5187 !! test
5188 Bug 4781, 5267: %25 in bracketed URL
5189 !! wikitext
5190 [http://www.example.com/?title=100%25_Bran link]
5191 !! html
5192 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 Bug 4781, 5267: %28, %29 in bracketed URL
5198 !! wikitext
5199 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5200 !! html/php
5201 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5202 </p>
5203 !! html/parsoid
5204 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5205 !! end
5206
5207 !! test
5208 External link containing a period in the anchor. (bug 63947)
5209 !! wikitext
5210 [//foo.org/bar#baz. bang]
5211
5212 [//foo.org/bar. bang]
5213 !! html/php
5214 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5215 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5216 </p>
5217 !! html/parsoid
5218 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5219 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5220 !! end
5221
5222 !! test
5223 External link containing a single quote. (bug 63947)
5224 !! wikitext
5225 [//foo.org/bar'baz]
5226
5227 [//foo.org/bar'baz bang]
5228 !! html/php
5229 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5234 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5235 !! end
5236
5237
5238 !! test
5239 External link containing a period in the anchor. (bug 63947)
5240 !! wikitext
5241 [//foo.org/bar#baz. bang]
5242
5243 [//foo.org/bar. bang]
5244 !! html/php
5245 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5246 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5250 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5251 !! end
5252
5253 !! test
5254 External link containing a single quote. (bug 63947)
5255 !! wikitext
5256 [//foo.org/bar'baz]
5257
5258 [//foo.org/bar'baz bang]
5259 !! html/php
5260 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5261 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5265 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5266 !! end
5267
5268
5269 !! test
5270 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5271 !! wikitext
5272 Some [http://example.com/ pretty ''italics'' and stuff]!
5273 !! html
5274 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5275 </p>
5276 !! end
5277
5278 !! test
5279 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5280 !! wikitext
5281 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5282 !! html
5283 <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>
5284 </p>
5285 !! end
5286
5287 !! test
5288 External link containing double-single-quotes with no space separating the url from text in italics
5289 !! wikitext
5290 [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]].]
5291 !! html/php
5292 <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>
5293 </p>
5294 !! html/php+tidy
5295 <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>
5296 !! html/parsoid
5297 <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>
5298 !! end
5299
5300 !! test
5301 External link with comments in link text
5302 !! wikitext
5303 [http://www.google.com Google <!-- comment -->]
5304 !! html
5305 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5306 </p>
5307 !! end
5308
5309 !! test
5310 URL-encoding in URL functions (single parameter)
5311 !! wikitext
5312 {{localurl:Some page|amp=&}}
5313 !! html
5314 <p>/index.php?title=Some_page&amp;amp=&amp;
5315 </p>
5316 !! end
5317
5318 !! test
5319 URL-encoding in URL functions (multiple parameters)
5320 !! wikitext
5321 {{localurl:Some page|q=?&amp=&}}
5322 !! html
5323 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5324 </p>
5325 !! end
5326
5327 !! test
5328 Brackets in urls
5329 !! wikitext
5330 http://example.com/index.php?foozoid%5B%5D=bar
5331
5332 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5333 !! html/php
5334 <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>
5335 </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>
5336 </p>
5337 !! html/parsoid
5338 <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>
5339
5340 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5341 !! end
5342
5343 !! test
5344 IPv6 urls, autolink format (T23261)
5345 !! wikitext
5346 http://[2404:130:0:1000::187:2]/index.php
5347
5348 Examples from RFC2373, section 2.2:
5349 * http://[1080::8:800:200C:417A]/unicast
5350 * http://[FF01::101]/multicast
5351 * http://[::1]/loopback
5352 * http://[::]/unspecified
5353 * http://[::13.1.68.3]/ipv4compat
5354 * http://[::FFFF:129.144.52.38]/ipv4compat
5355
5356 Examples from RFC 2732, section 2:
5357 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5358 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5359 * http://[3ffe:2a00:100:7031::1]
5360 * http://[1080::8:800:200C:417A]/foo
5361 * http://[::192.9.5.5]/ipng
5362 * http://[::FFFF:129.144.52.38]:80/index.html
5363 * http://[2010:836B:4179::836B:4179]
5364
5365 !! html
5366 <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>
5367 </p><p>Examples from RFC2373, section 2.2:
5368 </p>
5369 <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>
5370 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5371 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5372 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5373 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5374 <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>
5375 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5376 </p>
5377 <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>
5378 <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>
5379 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5380 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5381 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5382 <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>
5383 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5384
5385 !! end
5386
5387 !! test
5388 IPv6 urls, bracketed format (T23261)
5389 !! wikitext
5390 [http://[2404:130:0:1000::187:2]/index.php test]
5391
5392 Examples from RFC2373, section 2.2:
5393 * [http://[1080::8:800:200C:417A] unicast]
5394 * [http://[FF01::101] multicast]
5395 * [http://[::1]/ loopback]
5396 * [http://[::] unspecified]
5397 * [http://[::13.1.68.3] ipv4compat]
5398 * [http://[::FFFF:129.144.52.38] ipv4compat]
5399
5400 Examples from RFC 2732, section 2:
5401 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5402 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5403 * [http://[3ffe:2a00:100:7031::1] 3]
5404 * [http://[1080::8:800:200C:417A]/foo 4]
5405 * [http://[::192.9.5.5]/ipng 5]
5406 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5407 * [http://[2010:836B:4179::836B:4179] 7]
5408
5409 !! html
5410 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5411 </p><p>Examples from RFC2373, section 2.2:
5412 </p>
5413 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5414 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5415 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5416 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5417 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5418 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5419 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5420 </p>
5421 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5422 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5423 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5424 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5425 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5426 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5427 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5428
5429 !! end
5430
5431 !! test
5432 Non-extlinks in brackets
5433 !! wikitext
5434 [foo]
5435 [foo bar]
5436 [foo ''bar'']
5437 [fool's] errand
5438 [fool's errand]
5439 [{{echo|foo}}]
5440 [{{echo|foo}} bar]
5441 [{{echo|foo}} ''bar'']
5442 [{{echo|foo}}l's] errand
5443 [{{echo|foo}}l's errand]
5444 [url={{echo|foo}}]
5445 [url=http://example.com]
5446 !! html
5447 <p>[foo]
5448 [foo bar]
5449 [foo <i>bar</i>]
5450 [fool's] errand
5451 [fool's errand]
5452 [foo]
5453 [foo bar]
5454 [foo <i>bar</i>]
5455 [fool's] errand
5456 [fool's errand]
5457 [url=foo]
5458 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5459 </p>
5460 !! end
5461
5462 !! test
5463 Percent encoding in external links
5464 !! wikitext
5465 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5466 !! html/php
5467 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5468 </p>
5469 !! html/parsoid
5470 <p><a rel="mw:ExtLink"
5471 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5472 !! end
5473
5474 !! test
5475 Use url link syntax for links where the content is equal the link target
5476 !! wikitext
5477 http://example.com
5478 !! html/php
5479 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5480 </p>
5481 !! html/parsoid
5482 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5483 !! end
5484
5485 !! test
5486 Parenthesis in external links, especially URL links
5487 !! wikitext
5488 http://example.com)
5489
5490 http://example.com/test)
5491
5492 http://example.com/(test)
5493
5494 http://example.com/((test)
5495
5496 (http://example.com/(test))
5497
5498 (http://example.com/(test)))))
5499
5500 http://example.com/a)b
5501
5502 [http://example.com) foo]
5503 !! html/php
5504 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5505 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5506 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5507 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5508 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5509 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5510 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5511 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5512 </p>
5513 !! html/parsoid
5514 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5515 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5516 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5517 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5518 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5519 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5520 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5521 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5522 !! end
5523
5524 !! test
5525 Parenthesis in external links, w/ transclusion or comment
5526 !! wikitext
5527 (http://example.com/{{echo|hi}})
5528
5529 (http://example.com<!-- hi -->)
5530 !! html/php
5531 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5532 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5533 </p>
5534 !! html/parsoid
5535 <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>
5536
5537 <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>
5538 !! end
5539
5540 !! test
5541 Serialize <a> tags with invalid link targets as plain text
5542 !! options
5543 parsoid=html2wt
5544 !! html/parsoid
5545 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5546 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5547 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5548 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5549 !! wikitext
5550 text
5551 <nowiki>*</nowiki>text
5552 <nowiki>[[foo]]</nowiki>
5553 <nowiki>*a [[foo]]</nowiki>
5554 !! end
5555
5556 !! test
5557 mw:ExtLink -vs- mw:WikiLink (T94723)
5558 !! options
5559 parsoid=html2wt
5560 !! html/parsoid
5561 <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>
5562 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5563 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5564 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5565 <p>
5566 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5567 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5568 </p>
5569 !! wikitext
5570 [[Foo|Bar]]
5571 [[Foo|Bar]]
5572 [[wikipedia:Foo|Bar]]
5573 [[wikipedia:Foo|Bar]]
5574
5575 [[wikipedia:European_Robin|European Robin]]
5576 [[wikipedia:European_Robin|European Robin]]
5577 !! end
5578
5579 !! test
5580 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5581 !! options
5582 parsoid=wt2wt
5583 !! wikitext
5584 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5585 !! html/parsoid
5586 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5587 !! end
5588
5589
5590 ###
5591 ### Quotes
5592 ###
5593
5594 !! test
5595 Quotes
5596 !! wikitext
5597 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5598
5599 Normal text. '''''Bold italic text.''''' Normal text.
5600 !! html
5601 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5602 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5603 </p>
5604 !! end
5605
5606
5607 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5608 # parser strips. The wikitext contains just the first half of the bold
5609 # quote pair.
5610 !! test
5611 Unclosed and unmatched quotes
5612 !! wikitext
5613 '''''Bold italic text '''with bold deactivated''' in between.'''''
5614
5615 '''''Bold italic text ''with italic deactivated'' in between.'''''
5616
5617 '''Bold text..
5618
5619 ..spanning two paragraphs (should not work).'''
5620
5621 '''Bold tag left open
5622
5623 ''Italic tag left open
5624
5625 Normal text.
5626
5627 <!-- Unmatching number of opening, closing tags: -->
5628 '''This year''''s election ''should'' beat '''last year''''s.
5629
5630 ''Tom'''s car is bigger than ''Susan'''s.
5631
5632 Plain ''italic'''s plain
5633 !! html/php
5634 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5635 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5636 </p><p><b>Bold text..</b>
5637 </p><p>..spanning two paragraphs (should not work).
5638 </p><p><b>Bold tag left open</b>
5639 </p><p><i>Italic tag left open</i>
5640 </p><p>Normal text.
5641 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5642 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5643 </p><p>Plain <i>italic'</i>s plain
5644 </p>
5645 !! html/parsoid
5646 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5647 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5648 </p><p><b>Bold text..</b>
5649 </p><p>..spanning two paragraphs (should not work).<b></b>
5650 </p><p><b>Bold tag left open</b>
5651 </p><p><i>Italic tag left open</i>
5652 </p><p>Normal text.
5653 </p>
5654 <!-- Unmatching number of opening, closing tags: -->
5655 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5656 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5657 </p><p>Plain <i>italic'</i>s plain
5658 </p>
5659 !! end
5660
5661 ###
5662 ### Tables
5663 ###
5664 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5665 ###
5666
5667 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5668 # is the bare minimum required by the spec, see:
5669 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5670 # Parsoid team replies: empty table tags are legal in HTML5
5671 !! test
5672 A table with no data.
5673 !! options
5674 parsoid=wt2html
5675 !! wikitext
5676 {||}
5677 !! html/php
5678
5679 !! html/parsoid
5680 <table></table>
5681
5682 !! end
5683
5684 !! test
5685 A table with stray table end tags on start tag line (wt2html)
5686 !! options
5687 parsoid=wt2html
5688 !! wikitext
5689 {|style="color: red;"|}
5690
5691 {|style="color: red;" |}
5692 |foo
5693 |}
5694
5695 {|style="color: red;"|} id="foo"
5696 |foo
5697 |}
5698
5699 {|style="color: red;" |} id="foo"
5700 |foo
5701 |}
5702 !! html
5703 <table style="color: red;"></table>
5704
5705 <table style="color: red;">
5706 <tbody><tr>
5707 <td>foo</td>
5708 </tr></tbody>
5709 </table>
5710
5711 <table style="color: red;" id="foo">
5712 <tbody><tr>
5713 <td>foo</td>
5714 </tr></tbody>
5715 </table>
5716
5717 <table style="color: red;" id="foo">
5718 <tbody><tr>
5719 <td>foo</td>
5720 </tr></tbody>
5721 </table>
5722
5723 !! end
5724
5725 !! test
5726 A table with no data (take 2)
5727 !! wikitext
5728 {|
5729 |}
5730 !! html/parsoid
5731 <table></table>
5732 !! end
5733
5734 # A table with nothing but a caption is invalid XHTML, we might want to render
5735 # this as <p>caption</p>
5736 # Parsoid team replies: table with only a caption is legal in HTML5
5737 !! test
5738 A table with nothing but a caption
5739 !! wikitext
5740 {|
5741 |+ caption
5742 |}
5743 !! html/php
5744 <table>
5745 <caption> caption
5746 </caption><tr><td></td></tr></table>
5747
5748 !! html/parsoid
5749 <table><caption> caption</caption></table>
5750 !! end
5751
5752 !! test
5753 A table with caption with default-spaced attributes and a table row
5754 !! wikitext
5755 {|
5756 |+ style="color: red;" | caption1
5757 |-
5758 | foo
5759 |}
5760 !! html
5761 <table>
5762 <caption style="color: red;"> caption1
5763 </caption>
5764 <tr>
5765 <td> foo
5766 </td></tr></table>
5767
5768 !! end
5769
5770 !! test
5771 A table with captions with non-default spaced attributes and a table row
5772 !! wikitext
5773 {|
5774 |+style="color: red;"|caption2
5775 |+ style="color: red;"| caption3
5776 |-
5777 | foo
5778 |}
5779 !! html
5780 <table>
5781 <caption style="color: red;">caption2
5782 </caption>
5783 <caption style="color: red;"> caption3
5784 </caption>
5785 <tr>
5786 <td> foo
5787 </td></tr></table>
5788
5789 !! end
5790
5791 !! test
5792 Table td-cell syntax variations
5793 !! wikitext
5794 {|
5795 | foo bar foo | baz
5796 | foo bar foo || baz
5797 | style='color:red;' | baz
5798 | style='color:red;' || baz
5799 |}
5800 !! html
5801 <table>
5802 <tr>
5803 <td> baz
5804 </td>
5805 <td> foo bar foo </td>
5806 <td> baz
5807 </td>
5808 <td style="color:red;"> baz
5809 </td>
5810 <td> style='color:red;' </td>
5811 <td> baz
5812 </td></tr></table>
5813
5814 !! end
5815
5816 !! test
5817 Simple table
5818 !! wikitext
5819 {|
5820 | 1 || 2
5821 |-
5822 | 3 || 4
5823 |}
5824 !! html
5825 <table>
5826 <tr>
5827 <td> 1 </td>
5828 <td> 2
5829 </td></tr>
5830 <tr>
5831 <td> 3 </td>
5832 <td> 4
5833 </td></tr></table>
5834
5835 !! end
5836
5837 !! test
5838 Simple table but with multiple dashes for row wikitext
5839 !! wikitext
5840 {|
5841 | foo
5842 |-----
5843 | bar
5844 |}
5845 !! html
5846 <table>
5847 <tr>
5848 <td> foo
5849 </td></tr>
5850 <tr>
5851 <td> bar
5852 </td></tr></table>
5853
5854 !! end
5855
5856 !! test
5857 Multiplication table
5858 !! wikitext
5859 {| border="1" cellpadding="2"
5860 |+Multiplication table
5861 |-
5862 ! &times; !! 1 !! 2 !! 3
5863 |-
5864 ! 1
5865 | 1 || 2 || 3
5866 |-
5867 ! 2
5868 | 2 || 4 || 6
5869 |-
5870 ! 3
5871 | 3 || 6 || 9
5872 |-
5873 ! 4
5874 | 4 || 8 || 12
5875 |-
5876 ! 5
5877 | 5 || 10 || 15
5878 |}
5879 !! html
5880 <table border="1" cellpadding="2">
5881 <caption>Multiplication table
5882 </caption>
5883 <tr>
5884 <th> &#215; </th>
5885 <th> 1 </th>
5886 <th> 2 </th>
5887 <th> 3
5888 </th></tr>
5889 <tr>
5890 <th> 1
5891 </th>
5892 <td> 1 </td>
5893 <td> 2 </td>
5894 <td> 3
5895 </td></tr>
5896 <tr>
5897 <th> 2
5898 </th>
5899 <td> 2 </td>
5900 <td> 4 </td>
5901 <td> 6
5902 </td></tr>
5903 <tr>
5904 <th> 3
5905 </th>
5906 <td> 3 </td>
5907 <td> 6 </td>
5908 <td> 9
5909 </td></tr>
5910 <tr>
5911 <th> 4
5912 </th>
5913 <td> 4 </td>
5914 <td> 8 </td>
5915 <td> 12
5916 </td></tr>
5917 <tr>
5918 <th> 5
5919 </th>
5920 <td> 5 </td>
5921 <td> 10 </td>
5922 <td> 15
5923 </td></tr></table>
5924
5925 !! end
5926
5927 !! test
5928 Accept "||" in table headings
5929 !! wikitext
5930 {|
5931 !h1 || h2
5932 |}
5933 !! html
5934 <table>
5935 <tr>
5936 <th>h1 </th>
5937 <th> h2
5938 </th></tr></table>
5939
5940 !! end
5941
5942 !! test
5943 Accept "!!" in table data
5944 !! wikitext
5945 {|
5946 | Foo!! ||
5947 |}
5948 !! html
5949 <table>
5950 <tr>
5951 <td> Foo!! </td>
5952 <td>
5953 </td></tr></table>
5954
5955 !! html/parsoid
5956 <table>
5957 <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>
5958 </tbody></table>
5959 !! end
5960
5961 !! test
5962 Accept "||" in indented table headings
5963 !! wikitext
5964 :{|
5965 !h1 || h2
5966 |}
5967 !! html
5968 <dl><dd><table>
5969 <tr>
5970 <th>h1 </th>
5971 <th> h2
5972 </th></tr></table></dd></dl>
5973
5974 !! end
5975
5976 !! test
5977 Accept "!!" in templates
5978 !! wikitext
5979 {|
5980 !a {{echo|b!!c}}
5981 |}
5982 !! html/php
5983 <table>
5984 <tr>
5985 <th>a b</th>
5986 <th>c
5987 </th></tr></table>
5988
5989 !! html/parsoid
5990 <table>
5991 <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>
5992 !! end
5993
5994 !! test
5995 Accept "!!" in table headings after newline
5996 !! wikitext
5997 {|
5998 !a
5999 b!!c
6000 |}
6001 !! html/php
6002 <table>
6003 <tr>
6004 <th>a
6005 <p>b!!c
6006 </p>
6007 </th></tr></table>
6008
6009 !! html/parsoid
6010 <table>
6011 <tbody><tr><th>a
6012 <p>b!!c</p></th></tr>
6013 </tbody></table>
6014 !! end
6015
6016 !! test
6017 Accept "!!" in table data of mixed wikitext / html syntax
6018 !! wikitext
6019 {|
6020 !a
6021 <tr><td>b!!c</td></tr>
6022 |}
6023 !! html+tidy
6024 <table>
6025 <tr>
6026 <th>a</th>
6027 </tr>
6028 <tr>
6029 <td>b!!c</td>
6030 </tr>
6031 </table>
6032 !! html/parsoid
6033 <table>
6034 <tbody><tr><th>a</th></tr>
6035 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6036 </tbody></table>
6037 !! end
6038
6039 !! test
6040 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6041 !! wikitext
6042 {|
6043 !| h1
6044 || a
6045 |}
6046 !! html
6047 <table>
6048 <tr>
6049 <th> h1
6050 </th>
6051 <td> a
6052 </td></tr></table>
6053
6054 !! end
6055
6056 !!test
6057 Accept "| !" at start of line in tables (ignore !-attribute)
6058 !! wikitext
6059 {|
6060 |-
6061 | !style="color:red" | bar
6062 |}
6063 !! html
6064 <table>
6065
6066 <tr>
6067 <td> bar
6068 </td></tr></table>
6069
6070 !!end
6071
6072 !!test
6073 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 +/-
6074 !! wikitext
6075 {|
6076 |-
6077 |style='color:red;'|+1
6078 |style='color:blue;'|-1
6079 |-
6080 | 1 || 2 || 3
6081 | 1 ||+2 ||-3
6082 |-
6083 | +1
6084 | -1
6085 |}
6086 !! html
6087 <table>
6088
6089 <tr>
6090 <td style="color:red;">+1
6091 </td>
6092 <td style="color:blue;">-1
6093 </td></tr>
6094 <tr>
6095 <td> 1 </td>
6096 <td> 2 </td>
6097 <td> 3
6098 </td>
6099 <td> 1 </td>
6100 <td>+2 </td>
6101 <td>-3
6102 </td></tr>
6103 <tr>
6104 <td> +1
6105 </td>
6106 <td> -1
6107 </td></tr></table>
6108
6109 !!end
6110
6111 !! test
6112 Table rowspan
6113 !! wikitext
6114 {| border=1
6115 | Cell 1, row 1
6116 |rowspan=2| Cell 2, row 1 (and 2)
6117 | Cell 3, row 1
6118 |-
6119 | Cell 1, row 2
6120 | Cell 3, row 2
6121 |}
6122 !! html
6123 <table border="1">
6124 <tr>
6125 <td> Cell 1, row 1
6126 </td>
6127 <td rowspan="2"> Cell 2, row 1 (and 2)
6128 </td>
6129 <td> Cell 3, row 1
6130 </td></tr>
6131 <tr>
6132 <td> Cell 1, row 2
6133 </td>
6134 <td> Cell 3, row 2
6135 </td></tr></table>
6136
6137 !! end
6138
6139 !! test
6140 Nested table
6141 !! wikitext
6142 {| border=1
6143 | &alpha;
6144 |
6145 {| bgcolor=#ABCDEF border=2
6146 |nested
6147 |-
6148 |table
6149 |}
6150 |the original table again
6151 |}
6152 !! html
6153 <table border="1">
6154 <tr>
6155 <td> &#945;
6156 </td>
6157 <td>
6158 <table bgcolor="#ABCDEF" border="2">
6159 <tr>
6160 <td>nested
6161 </td></tr>
6162 <tr>
6163 <td>table
6164 </td></tr></table>
6165 </td>
6166 <td>the original table again
6167 </td></tr></table>
6168
6169 !! end
6170
6171 !! test
6172 Invalid attributes in table cell (bug 1830)
6173 !! wikitext
6174 {|
6175 |Cell:|broken
6176 |}
6177 !! html
6178 <table>
6179 <tr>
6180 <td>broken
6181 </td></tr></table>
6182
6183 !! end
6184
6185 !! test
6186 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6187 !! wikitext
6188 {|
6189 | title="foo" |bar
6190 | title="foo<nowiki>|</nowiki>" |bar
6191 | title="foo<nowiki>|</nowiki>" bar
6192 |}
6193 !! html
6194 <table>
6195 <tr>
6196 <td title="foo">bar
6197 </td>
6198 <td title="foo&#124;">bar
6199 </td>
6200 <td> title="foo|" bar
6201 </td></tr></table>
6202
6203 !! end
6204
6205 # The "|}" to close the table is missing from the input, so parsoid's
6206 # *2wt modes will fail.
6207 !! test
6208 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6209 !! options
6210 parsoid=wt2html,html2html
6211 !! wikitext
6212 {|
6213 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6214 !! html/php
6215 <table>
6216 <tr>
6217 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6218 <td>]" onmouseover="alert(document.cookie)"&gt;test
6219 </td>
6220 </tr>
6221 </table>
6222
6223 !! html/parsoid
6224 <table><tbody>
6225 <tr>
6226 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6227 !! end
6228
6229 # FIXME: The php output is broken.
6230 !! test
6231 ! and || in td attributes should not be parsed as <th>/<td>
6232 !! wikitext
6233 {|
6234 | style="color: red !important;" data-contrived="put this here ||" | foo
6235 |}
6236 !! html/php
6237 <table>
6238 <tr>
6239 <td> style="color: red !important;" data-contrived="put this here </td>
6240 <td> foo
6241 </td></tr></table>
6242
6243 !! html/parsoid
6244 <table>
6245 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6246 </tbody></table>
6247 !! end
6248
6249 !! test
6250 Indented table markup mixed with indented pre content (proposed in bug 6200)
6251 !! wikitext
6252 <table>
6253 <tr>
6254 <td>
6255 Text that should be rendered preformatted
6256 </td>
6257 </tr>
6258 </table>
6259 !! html
6260 <table>
6261 <tr>
6262 <td>
6263 <pre>Text that should be rendered preformatted
6264 </pre>
6265 </td>
6266 </tr>
6267 </table>
6268
6269 !! end
6270
6271 !! test
6272 1. Template-generated table cell attributes and cell content
6273 !! wikitext
6274 {|
6275 |{{table_attribs}}
6276 | {{table_attribs}}
6277 || {{table_attribs_5}}
6278 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6279 |align=center {{table_attribs}}
6280 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6281 |}
6282 !! html
6283 <table>
6284 <tr>
6285 <td style="color:red;">Foo
6286 </td>
6287 <td style="color:red;">Foo
6288 </td>
6289 <td> style="color:red;"</td>
6290 <td>Bar
6291 </td>
6292 <td style="color:red;">Foo
6293 </td>
6294 <td align="center" style="color:red;">Foo
6295 </td>
6296 <td align="center" style="color:red;">Foo
6297 </td></tr></table>
6298
6299 !! end
6300
6301 !! test
6302 2. Template-generated table cell attributes and cell content
6303 !! wikitext
6304 {|
6305 |{{table_attribs_2}}
6306 |}
6307 !! html/php
6308 <table>
6309 <tr>
6310 <td style="color:red;">Foo
6311 </td>
6312 <td>Bar</td>
6313 <td>Baz
6314 </td></tr></table>
6315
6316 !! html/parsoid
6317 <table>
6318 <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>
6319 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6320 </tbody></table>
6321 !! end
6322
6323 !! test
6324 3. Template-generated table cell attributes and cell content
6325 !! wikitext
6326 {|
6327 !align=center {{table_header_cells}}
6328 |-
6329 |align=center {{table_cells}}
6330 |}
6331 !! html/php
6332 <table>
6333 <tr>
6334 <th align="center" style="color:red;">Foo</th>
6335 <th style="color:red;"><i>Bar</i></th>
6336 <th style="color:brown;"><i>Foo</i> and Baz
6337 </th></tr>
6338 <tr>
6339 <td align="center" style="color:red;">Foo</td>
6340 <td style="color:red;"><i>Bar</i></td>
6341 <td style="color:brown;"><i>Foo</i> and Baz
6342 </td></tr></table>
6343
6344 !! html/parsoid
6345 <table>
6346 <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>
6347 <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>
6348 </tbody></table>
6349 !! end
6350
6351 !! test
6352 4. Template-generated table cell attributes and cell content inside a templated table
6353 !! wikitext
6354 {{tbl-start}}
6355 !align=center {{table_header_cells}}
6356 |-
6357 |align=center {{table_cells}}
6358 {{tbl-end}}
6359 !! html/php
6360 <table>
6361 <tr>
6362 <th align="center" style="color:red;">Foo</th>
6363 <th style="color:red;"><i>Bar</i></th>
6364 <th style="color:brown;"><i>Foo</i> and Baz
6365 </th></tr>
6366 <tr>
6367 <td align="center" style="color:red;">Foo</td>
6368 <td style="color:red;"><i>Bar</i></td>
6369 <td style="color:brown;"><i>Foo</i> and Baz
6370 </td></tr></table>
6371
6372 !! html/parsoid
6373 <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}}]}'>
6374 <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>
6375 <tr>
6376 <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>
6377 </tbody></table>
6378 !! end
6379
6380 ## Edge case fix to prevent future regressions
6381 !! test
6382 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6383 !! wikitext
6384 {|
6385 |{{table_attribs_7}}
6386 |}
6387 <references />
6388 !! html/parsoid
6389 <table>
6390 <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>
6391 </tbody></table>
6392 <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>
6393 !! end
6394
6395 !! test
6396 Table with row followed by newlines and table heading
6397 !! wikitext
6398 {|
6399 |-
6400
6401 ! foo
6402 |}
6403 !! html
6404 <table>
6405
6406
6407 <tr>
6408 <th> foo
6409 </th></tr></table>
6410
6411 !! end
6412
6413 !! test
6414 Table with empty line following the start tag
6415 !! wikitext
6416 {|
6417
6418 |-
6419 | foo
6420 |}
6421 !! html
6422 <table>
6423
6424
6425 <tr>
6426 <td> foo
6427 </td></tr></table>
6428
6429 !! end
6430
6431 # FIXME: Preserve the attribute properly (with an empty string as value) in
6432 # the PHP parser. Parsoid implements the behavior below.
6433 !! test
6434 Table attributes with empty value
6435 !! wikitext
6436 {|
6437 | style=| hello
6438 |}
6439 !! html/parsoid
6440 <table>
6441 <tbody>
6442 <tr>
6443 <td style=""> hello
6444 </td></tr></tbody></table>
6445
6446 !! end
6447
6448 !! test
6449 Wikitext table with a lot of comments
6450 !! wikitext
6451 {|
6452 <!-- c0 -->
6453 | foo
6454 <!-- c1 -->
6455 |-<!-- c2 -->
6456 <!-- c3 -->
6457 |<!-- c4 -->
6458 <!-- c5 -->
6459 |}
6460 !! html
6461 <table>
6462 <tr>
6463 <td> foo
6464 </td></tr>
6465 <tr>
6466 <td>
6467 </td></tr></table>
6468
6469 !! end
6470
6471 !! test
6472 Wikitext table comments represented in parsoid dom
6473 !! wikitext
6474 {|<!--c1--><!--c2-->
6475 |-<!--c3-->
6476 | x
6477 |}
6478 !! html/php+tidy
6479 <table>
6480 <tr>
6481 <td>x</td>
6482 </tr>
6483 </table>
6484 !! html/parsoid
6485 <table><!--c1--><!--c2-->
6486 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6487 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6488 </tbody></table>
6489 !! end
6490
6491 !! test
6492 Wikitext table with double-line table cell
6493 !! wikitext
6494 {|
6495 |a
6496 b
6497 |}
6498 !! html
6499 <table>
6500 <tr>
6501 <td>a
6502 <p>b
6503 </p>
6504 </td></tr></table>
6505
6506 !! end
6507
6508 !! test
6509 Table cell with a single comment
6510 !! wikitext
6511 {|
6512 | <!-- c1 -->
6513 | a
6514 |}
6515 !! html
6516 <table>
6517 <tr>
6518 <td>
6519 </td>
6520 <td> a
6521 </td></tr></table>
6522
6523 !! end
6524
6525 !! test
6526 Table-cell after a comment-only-empty-line
6527 !! wikitext
6528 {|
6529 |a
6530 <!--c1-->
6531 <!--c2-->| b
6532 |}
6533 !! html
6534 <table>
6535 <tr>
6536 <td>a
6537 </td>
6538 <td> b
6539 </td></tr></table>
6540
6541 !! html/parsoid
6542 <table>
6543 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6544 <!--c1-->
6545 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6546 </tbody></table>
6547
6548 !! end
6549
6550 !! test
6551 Build table with {{!}}
6552 !! wikitext
6553 {{{!}} class="wikitable"
6554 ! header
6555 ! second header
6556 {{!}}- style="color:red;"
6557 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6558 {{!}}}
6559 !! html
6560 <table class="wikitable">
6561 <tr>
6562 <th> header
6563 </th>
6564 <th> second header
6565 </th></tr>
6566 <tr style="color:red;">
6567 <td> data </td>
6568 <td style="color:red;"> second data
6569 </td></tr></table>
6570
6571 !! end
6572
6573 !! test
6574 Build table with pipe as data
6575 !! wikitext
6576 {| class="wikitable"
6577 ! header
6578 ! second header
6579 |- style="color:red;"
6580 | data || style="color:red;" | second data
6581 |-
6582 | style="color:red;" | data with | || style="color:red;" | second data with |
6583 |-
6584 || data with | ||| second data with |
6585 |}
6586 !! html
6587 <table class="wikitable">
6588 <tr>
6589 <th> header
6590 </th>
6591 <th> second header
6592 </th></tr>
6593 <tr style="color:red;">
6594 <td> data </td>
6595 <td style="color:red;"> second data
6596 </td></tr>
6597 <tr>
6598 <td style="color:red;"> data with | </td>
6599 <td style="color:red;"> second data with |
6600 </td></tr>
6601 <tr>
6602 <td> data with | </td>
6603 <td> second data with |
6604 </td></tr></table>
6605
6606 !! end
6607
6608 !! test
6609 Build table with wikilink
6610 !! wikitext
6611 {| class="wikitable"
6612 ! header || second header
6613 |- style="color:red;"
6614 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6615 |-
6616 | data || second data [[Main Page|link|text with pipe]]
6617 |}
6618 !! html
6619 <table class="wikitable">
6620 <tr>
6621 <th> header </th>
6622 <th> second header
6623 </th></tr>
6624 <tr style="color:red;">
6625 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6626 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6627 </td></tr>
6628 <tr>
6629 <td> data </td>
6630 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6631 </td></tr></table>
6632
6633 !! end
6634
6635 # The expected HTML structure in this test is debatable. The PHP parser does
6636 # not parse this kind of table at all. The main focus for Parsoid is on
6637 # round-tripping, so this output is ok for now. TODO: revisit!
6638 !! test
6639 Wikitext table with html-syntax row
6640 !! wikitext
6641 {|
6642 |-
6643 <td>foo</td>
6644 |}
6645 !! html/parsoid
6646 <table>
6647 <tbody>
6648 <tr>
6649 <td>foo</td></tr></tbody></table>
6650 !! end
6651
6652 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6653 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6654 ## PHP parser, which tidy then compounds by fostering the content
6655 ## entirely out of the table. Parsoid recognizes the table context
6656 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6657 ## depends on PHP's treatment of broken table markup!
6658 !! test
6659 Implicit <td> after a |-
6660 !! options
6661 parsoid=wt2html,html2html
6662 !! wikitext
6663 {|
6664 |-
6665 a
6666 |}
6667 !! html/php
6668 <table>
6669
6670 a
6671 </table>
6672
6673 !! html/php+tidy
6674 <p>a</p>
6675 !! html/parsoid
6676 <table>
6677 <tr><td>a</td></tr>
6678 </table>
6679 !! end
6680
6681 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6682 !! test
6683 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6684 !! options
6685 parsoid=wt2html,html2html
6686 !! wikitext
6687 {|
6688 |-
6689 |
6690 a
6691 |-
6692 b
6693 |}
6694 !! html/php
6695 <table>
6696
6697 <tr>
6698 <td>
6699 <pre>a
6700 </pre>
6701 </td></tr>
6702 b
6703 </table>
6704
6705 !! html/php+tidy
6706 <p>b</p>
6707 <table>
6708 <tr>
6709 <td>
6710 <pre>
6711 a
6712 </pre></td>
6713 </tr>
6714 </table>
6715 !! html/parsoid
6716 <table>
6717 <tbody>
6718 <tr><td><pre>a</pre></td></tr>
6719 <tr><td> b</td></tr>
6720 </tbody>
6721 </table>
6722 !! end
6723
6724 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6725 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6726 !! test
6727 Lists should be recognized in an implicit <td> context
6728 !! options
6729 parsoid=wt2html,html2html
6730 !! wikitext
6731 {|
6732 |-
6733 *a
6734 |}
6735 !! html/php
6736 <table>
6737
6738 <ul><li>a</li></ul>
6739 </table>
6740
6741 !! html/php+tidy
6742 <ul>
6743 <li>a</li>
6744 </ul>
6745 !! html/parsoid
6746 <table>
6747 <tr>
6748 <td><ul>
6749 <li>a</li>
6750 </ul></td>
6751 </tr>
6752 </table>
6753 !! end
6754
6755 !! test
6756 Table cells not properly parsed in an implicit-td context
6757 !! wikitext
6758 {|
6759 |-
6760 {{table_attribs_4}} || a || b
6761 |}
6762 !! html/php+tidy
6763 <table>
6764 <tr>
6765 <td style="background-color:#DC241f;" width="10px"></td>
6766 <td>a</td>
6767 <td>b</td>
6768 </tr>
6769 </table>
6770 !! html/parsoid
6771 <table>
6772 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6773 <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>
6774 </tbody></table>
6775 !! end
6776
6777 !! test
6778 Parsoid: Round-trip tables directly followed by content (bug 51219)
6779 !! options
6780 parsoid=wt2html,wt2wt
6781 !! wikitext
6782 {|
6783 |foo
6784 |} bar
6785
6786 {|
6787 |baz
6788 |}<b>quux</b>
6789 !! html+tidy
6790 <table>
6791 <tr>
6792 <td>foo</td>
6793 </tr>
6794 </table>
6795 <p>bar</p>
6796 <table>
6797 <tr>
6798 <td>baz</td>
6799 </tr>
6800 </table>
6801 <p><b>quux</b></p>
6802 !! end
6803
6804 !! test
6805 Parsoid: Default to a newline after tables in new content (bug 51219)
6806 !! options
6807 parsoid=html2wt
6808 !! html/parsoid
6809 <table><tbody>
6810 <tr><td>foo</td></tr></tbody></table> bar
6811 <table><tbody>
6812 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6813 !! wikitext
6814 {|
6815 |foo
6816 |}
6817 <nowiki> </nowiki>bar
6818 {|
6819 |baz
6820 |}
6821 '''quux'''
6822 !! end
6823
6824 !! test
6825 Parsoid: newline inducing block nodes don't suppress <nowiki>
6826 !! options
6827 parsoid=html2wt
6828 !! html/parsoid
6829 a<h1>foo</h1>
6830 !! wikitext
6831 <nowiki> </nowiki>a
6832
6833 = foo =
6834 !! end
6835
6836 !! test
6837 Parsoid: Row-syntax table headings followed by comment & table cells
6838 !! options
6839 parsoid=wt2html,wt2wt
6840 !! wikitext
6841 {|
6842 ! foo || bar
6843 <!-- foo --> || baz || quux
6844 |}
6845 !! html/php
6846 <table>
6847 <tr>
6848 <th> foo </th>
6849 <th> bar
6850 </th>
6851 <td> baz </td>
6852 <td> quux
6853 </td></tr></table>
6854
6855 !! html/parsoid
6856 <table>
6857 <tbody><tr><th> foo </th><th> bar
6858 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6859 </tbody></table>
6860 !! end
6861
6862 !!test
6863 Parsoid: Recover better from broken table attributes
6864 !!options
6865 parsoid=wt2html
6866 !!wikitext
6867 {| class="foo
6868 | class="bar" |
6869 foo
6870 |}
6871 !!html/php+tidy
6872 <table class="foo">
6873 <tr>
6874 <td class="bar">
6875 <p>foo</p>
6876 </td>
6877 </tr>
6878 </table>
6879 !!html/parsoid
6880 <table class="foo">
6881 <tr>
6882 <td class="bar">
6883 <p>foo</p></td></tr>
6884 </tbody></table>
6885 !!end
6886
6887 !! test
6888 Strip unsupported table tags
6889 !! options
6890 parsoid=html2wt
6891 !! html/parsoid
6892 <table>
6893 <thead>
6894 <tr>
6895 <th>Month</th>
6896 <th>Savings</th>
6897 </tr>
6898 </thead>
6899 <tbody>
6900 <tr>
6901 <td>January</td>
6902 <td>$100</td>
6903 </tr>
6904 <tr>
6905 <td>February</td>
6906 <td>$80</td>
6907 </tr>
6908 </tbody>
6909 <tfoot>
6910 <tr>
6911 <td>Sum</td>
6912 <td>$180</td>
6913 </tr>
6914 </tfoot>
6915 </table>
6916 !! wikitext
6917 {|
6918
6919 !Month
6920 !Savings
6921
6922 |January
6923 |$100
6924
6925 |-
6926 |February
6927 |$80
6928
6929 |Sum
6930 |$180
6931
6932 |}
6933 !! end
6934
6935 !!test
6936 Testing serialization after deletion of table cells
6937 !!options
6938 parsoid={
6939 "modes": ["wt2wt", "selser"],
6940 "changes": [
6941 ["#x", "remove"]
6942 ]
6943 }
6944 !!wikitext
6945 {|
6946 !h1 !!h2 !!h3
6947 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6948 |}
6949 !! wikitext/edited
6950 {|
6951 !h1 !!h2 !!h3
6952 |c2 |||c3
6953 |}
6954 !!end
6955
6956 ###
6957 ### Internal links
6958 ###
6959 !! test
6960 Plain link, capitalized
6961 !! wikitext
6962 [[Main Page]]
6963 !! html
6964 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6965 </p>
6966 !! end
6967
6968 !! test
6969 Plain link, uncapitalized
6970 !! wikitext
6971 [[main Page]]
6972 !! html
6973 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6974 </p>
6975 !! end
6976
6977 !! test
6978 Piped link
6979 !! wikitext
6980 [[Main Page|The Main Page]]
6981 !! html
6982 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6983 </p>
6984 !! end
6985
6986 !! test
6987 Piped link with comment in link text
6988 !! wikitext
6989 [[Main Page|The Main<!--front--> Page]]
6990 !! html
6991 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6992 </p>
6993 !! end
6994
6995 !! test
6996 Piped link with multiple pipe characters in link text
6997 !! wikitext
6998 [[Main Page||The|Main|Page|]]
6999 !! html/php
7000 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7001 </p>
7002 !! html/parsoid
7003 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7004 !! end
7005
7006 !! test
7007 Broken link
7008 !! wikitext
7009 [[Zigzagzogzagzig]]
7010 !! html
7011 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7012 </p>
7013 !! end
7014
7015 !! test
7016 Broken link with fragment
7017 !! wikitext
7018 [[Zigzagzogzagzig#zug]]
7019 !! html
7020 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7021 </p>
7022 !! end
7023
7024 !! test
7025 Special page link with fragment
7026 !! wikitext
7027 [[Special:Version#anchor]]
7028 !! html
7029 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7030 </p>
7031 !! end
7032
7033 !! test
7034 Nonexistent special page link with fragment
7035 !! wikitext
7036 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7037 !! html
7038 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7039 </p>
7040 !! end
7041
7042 !! test
7043 Link with prefix
7044 !! wikitext
7045 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7046 !! html
7047 <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>
7048 </p>
7049 !! end
7050
7051 !! test
7052 Link with suffix
7053 !! wikitext
7054 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7055 !! html
7056 <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>!!!
7057 </p>
7058 !! end
7059
7060 !! article
7061 prefixed article
7062 !! text
7063 Some text
7064 !! endarticle
7065
7066 !! test
7067 Bug 43661: Piped links with identical prefixes
7068 !! wikitext
7069 [[prefixed article|prefixed articles with spaces]]
7070
7071 [[prefixed article|prefixed articlesaoeu]]
7072
7073 [[Main Page|Main Page test]]
7074 !! html
7075 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7076 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7077 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7078 </p>
7079 !! end
7080
7081
7082 !! test
7083 Link with HTML entity in suffix / tail
7084 !! wikitext
7085 [[Main Page]]&quot;, [[Main Page]]&#97;
7086 !! html/php
7087 <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;
7088 </p>
7089 !! html/parsoid
7090 <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>
7091 !! end
7092
7093 !! test
7094 Link with 3 brackets
7095 !! wikitext
7096 [[[Main Page]]]
7097 !! html
7098 <p>[[[Main Page]]]
7099 </p>
7100 !! end
7101
7102 !! test
7103 Link with 4 brackets
7104 !! wikitext
7105 [[[[Main Page]]]]
7106 !! html
7107 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7108 </p>
7109 !! end
7110
7111 !! test
7112 Piped link with 3 brackets
7113 !! wikitext
7114 [[[main page|the main page]]]
7115 !! html
7116 <p>[[[main page|the main page]]]
7117 </p>
7118 !! end
7119
7120 !! test
7121 Piped link with extlink-like text
7122 !! wikitext
7123 [[Main Page|[bar]]]
7124 [[Main Page|This is a [bar]]]
7125 !! html/php
7126 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7127 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7128 </p>
7129 !! html/parsoid
7130 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7131 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7132 !! end
7133
7134 !! test
7135 Link with multiple pipes
7136 !! wikitext
7137 [[Main Page|The|Main|Page]]
7138 !! html
7139 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7140 </p>
7141 !! end
7142
7143 # Note that parsoid does not munge anchor text; all non-space
7144 # characters are valid in HTML5 ids.
7145 !! test
7146 Anchor containing a #. (bug 63430)
7147 !! wikitext
7148 [[Main Page#And#Link]]
7149 !! html/php
7150 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7151 </p>
7152 !! html/parsoid
7153 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7154 !! end
7155
7156 !! test
7157 Link to namespaces
7158 !! wikitext
7159 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7160 !! html
7161 <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>
7162 </p>
7163 !! end
7164
7165 !! test
7166 Link with space in namespace
7167 !! wikitext
7168 [[User talk:Foo bar]]
7169 !! html
7170 <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>
7171 </p>
7172 !! end
7173
7174 !! article
7175 MemoryAlpha:AlphaTest
7176 !! text
7177 This is an article in the MemoryAlpha namespace
7178 (which shadows the memoryalpha interwiki link).
7179 !! endarticle
7180
7181 !! test
7182 Namespace takes precedence over interwiki link (bug 51680)
7183 !! wikitext
7184 [[MemoryAlpha:AlphaTest]]
7185 !! html
7186 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7187 </p>
7188 !! end
7189
7190 # The previous test doesn't work correctly in html2*, due to not recognizing the
7191 # link as an internal one. This one checks for the correct behavior.
7192 !! test
7193 Link to namespace preferred over interwiki with correct rel attribute
7194 !! options
7195 parsoid=html2wt,html2html
7196 !! html/parsoid
7197 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7198 !! wikitext
7199 [[MemoryAlpha:AlphaTest]]
7200 !! end
7201
7202 !! test
7203 Piped link to namespace
7204 !! wikitext
7205 [[Meta:Disclaimers|The disclaimers]]
7206 !! html
7207 <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>
7208 </p>
7209 !! end
7210
7211 !! test
7212 Link containing }
7213 !! wikitext
7214 [[Usually caused by a typo (oops}]]
7215 !! html
7216 <p>[[Usually caused by a typo (oops}]]
7217 </p>
7218 !! end
7219
7220 !! article
7221 7% Solution
7222 !! text
7223 Just a test of an article title containing a percent.
7224 !! endarticle
7225
7226 !! test
7227 Link containing % (not as a hex sequence)
7228 !! wikitext
7229 [[7% Solution]]
7230 !! html/php
7231 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7232 </p>
7233 !! html/parsoid
7234 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7235 !! end
7236
7237 # note that the parsoid HTML is identical to the previous test output,
7238 # so the previous test ensures that the html2wt mode will generate the
7239 # "not as a hex sequence" wikitext.
7240 !! test
7241 Link containing % as a single hex sequence interpreted to char
7242 !! options
7243 parsoid=wt2wt,wt2html,html2html
7244 !! wikitext
7245 [[7%25 Solution]]
7246 !! html/php
7247 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7248 </p>
7249 !! html/parsoid
7250 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7251 !!end
7252
7253 !! test
7254 Link containing % as a double hex sequence interpreted to hex sequence
7255 !! wikitext
7256 [[7%2525 Solution]]
7257 !! html
7258 <p>[[7%2525 Solution]]
7259 </p>
7260 !!end
7261
7262 # note that parsoid does not munge anchor text; all non-space
7263 # characters are valid in HTML5 anchors.
7264 !! test
7265 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7266 Example for such a section: == < ==
7267 !! wikitext
7268 [[%23%3c]][[%23%3e]]
7269 !! html/php
7270 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7271 </p>
7272 !! html/parsoid
7273 <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>
7274 !! end
7275
7276 !! test
7277 Link containing "<#" and ">#" as a hex sequences
7278 !! wikitext
7279 [[%3c%23]][[%3e%23]]
7280 !! html
7281 <p>[[%3c%23]][[%3e%23]]
7282 </p>
7283 !! end
7284
7285 !! test
7286 Link containing an equals sign
7287 !! wikitext
7288 [[Special:BookSources/isbn=4-00-026157-6]]
7289 !! html/php
7290 <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>
7291 </p>
7292 !! html/parsoid
7293 <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>
7294 !! end
7295
7296 !! article
7297 Foo~bar
7298 !! text
7299 Just a test of an article title containing a tilde.
7300 !! endarticle
7301
7302 # note that links containing signatures, like [[Foo~~~~]], are
7303 # massaged by the pre-save transform (PST) and so the tildes are never
7304 # seen by the parser.
7305 !! test
7306 Link containing a tilde
7307 !! wikitext
7308 [[Foo~bar]]
7309 !! html/php
7310 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7311 </p>
7312 !! html/parsoid
7313 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7314 !! end
7315
7316 !! test
7317 Link containing double-single-quotes '' (bug 4598)
7318 !! wikitext
7319 [[Lista d''e paise d''o munno]]
7320 !! html/php
7321 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7322 </p>
7323 !! html/parsoid
7324 <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>
7325 !! end
7326
7327 !! test
7328 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7329 !! wikitext
7330 Some [[Link|pretty ''italics'' and stuff]]!
7331 !! html/php
7332 <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>!
7333 </p>
7334 !! html/parsoid
7335 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7336 !! end
7337
7338 !! test
7339 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7340 !! wikitext
7341 ''Some [[Link|pretty ''italics'' and stuff]]!''
7342 !! html
7343 <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>
7344 </p>
7345 !! end
7346
7347 !! test
7348 Link with double quotes in title part (literal) and alternate part (interpreted)
7349 !! wikitext
7350 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7351
7352 [[''Pentecoste'']]
7353
7354 [[''Pentecoste''|Pentecoste]]
7355
7356 [[''Pentecoste''|''Pentecoste'']]
7357 !! html/php
7358 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7359 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7360 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
7361 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
7362 </p>
7363 !! html/parsoid
7364 <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>
7365 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7366 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7367 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7368 !! end
7369
7370 !! test
7371 Broken image links with HTML captions (bug 39700)
7372 !! wikitext
7373 [[File:Nonexistent|<script></script>]]
7374 [[File:Nonexistent|100x100px|<script></script>]]
7375 [[File:Nonexistent|&lt;]]
7376 [[File:Nonexistent|a<i>b</i>c]]
7377 !! html/php
7378 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7379 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7380 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7381 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7382 </p>
7383 !! html/parsoid
7384 <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>
7385 <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>
7386 <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>
7387 <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>
7388 !! end
7389
7390 !! test
7391 Plain link to URL
7392 !! wikitext
7393 [[http://www.example.com]]
7394 !! html/php
7395 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7396 </p>
7397 !! html/parsoid
7398 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7399 !! end
7400
7401 !! test
7402 Plain link to URL with link text
7403 !! wikitext
7404 [[http://www.example.com Link text]]
7405 !! html
7406 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7407 </p>
7408 !! end
7409
7410 !! test
7411 Plain link to protocol-relative URL
7412 !! wikitext
7413 [[//www.example.com]]
7414 !! html/php
7415 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7416 </p>
7417 !! html/parsoid
7418 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7419 !! end
7420
7421 !! test
7422 Plain link to protocol-relative URL with link text
7423 !! wikitext
7424 [[//www.example.com Link text]]
7425 !! html
7426 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7427 </p>
7428 !! end
7429
7430 !! test
7431 Plain link to page with question mark in title
7432 !! wikitext
7433 [[A?b]]
7434
7435 [[A?b|Baz]]
7436 !! html
7437 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7438 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7439 </p>
7440 !! end
7441
7442
7443 # I'm fairly sure the expected result here is wrong.
7444 # We want these to be URL links, not pseudo-pages with URLs for titles....
7445 # However the current output is also pretty screwy.
7446 #
7447 # ----
7448 # I'm changing it to match the current output--it arguably makes more
7449 # sense in the light of the test above. Old expected result was:
7450 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7451 #</p>
7452 # But I think this test is bordering on "garbage in, garbage out" anyway.
7453 # -- wtm
7454 !! test
7455 Piped link to URL
7456 !! wikitext
7457 Piped link to URL: [[http://www.example.com|an example URL]]
7458 !! html/php
7459 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7460 </p>
7461 !! html/parsoid
7462 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7463 !! end
7464
7465 !! test
7466 BUG 2: [[page|http://url/]] should link to page, not http://url/
7467 !! wikitext
7468 [[Main Page|http://url/]]
7469 !! html/php
7470 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7471 </p>
7472 !! html/parsoid
7473 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7474 !! end
7475
7476 # Parsoid does not mark self-links, by design.
7477 !! test
7478 BUG 337: Escaped self-links should be bold
7479 !! options
7480 title=[[Bug462]]
7481 !! wikitext
7482 [[Bu&#103;462]] [[Bug462]]
7483 !! html/php
7484 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7485 </p>
7486 !! html/php+tidy
7487 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7488 !! html/parsoid
7489 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7490 !! end
7491
7492 !! test
7493 Self-link to section should not be bold
7494 !! options
7495 title=[[Main Page]]
7496 !! wikitext
7497 [[Main Page#section]]
7498 !! html
7499 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7500 </p>
7501 !! end
7502
7503 !! article
7504 00
7505 !! text
7506 This is 00.
7507 !! endarticle
7508
7509 !!test
7510 Self-link to numeric title
7511 !!options
7512 title=[[0]]
7513 !! wikitext
7514 [[0]]
7515 !! html
7516 <p><strong class="selflink">0</strong>
7517 </p>
7518 !!end
7519
7520 !!test
7521 Link to numeric-equivalent title
7522 !!options
7523 title=[[0]]
7524 !! wikitext
7525 [[00]]
7526 !! html
7527 <p><a href="/wiki/00" title="00">00</a>
7528 </p>
7529 !!end
7530
7531 !! test
7532 <nowiki> inside a link
7533 !! wikitext
7534 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7535 !! html
7536 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7537 </p>
7538 !! end
7539
7540 !! test
7541 Non-breaking spaces in title
7542 !! wikitext
7543 [[&nbsp; Main &nbsp; Page &nbsp;]]
7544 !! html
7545 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7546 </p>
7547 !!end
7548
7549 !! test
7550 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7551 !! options
7552 language=ca
7553 !! wikitext
7554 '''[[Main Page]]'''
7555 !! html
7556 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7557 </p>
7558 !! end
7559
7560 !! test
7561 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7562 !! options
7563 language=ca
7564 !! wikitext
7565 ''[[Main Page]]''
7566 !! html
7567 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7568 </p>
7569 !! end
7570
7571 !! test
7572 Internal link with en linktrail: no apostrophes (bug 27473)
7573 !! options
7574 language=en
7575 !! wikitext
7576 [[Something]]'nice
7577 !! html
7578 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7579 </p>
7580 !! end
7581
7582 !! test
7583 Internal link with ca linktrail with apostrophes (bug 27473)
7584 !! options
7585 language=ca
7586 !! wikitext
7587 [[Something]]'nice
7588 !! html
7589 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7590 </p>
7591 !! end
7592
7593 !! test
7594 Internal link with kaa linktrail with apostrophes (bug 27473)
7595 !! options
7596 language=kaa
7597 !! wikitext
7598 [[Something]]'nice
7599 !! html
7600 <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>
7601 </p>
7602 !! end
7603
7604 !! test
7605 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7606 !! wikitext
7607 [[User:Foo/Test/63636:Bar|Test]]
7608 !! html/php
7609 <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>
7610 </p>
7611 !! html/parsoid
7612 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7613 !! end
7614
7615 !! test
7616 Purely hash wikilink
7617 !! options
7618 title=[[User:test/123]]
7619 !! wikitext
7620 [[#a|b]]
7621 !! html/php
7622 <p><a href="#a">b</a>
7623 </p>
7624 !! html/parsoid
7625 <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>
7626 !! end
7627
7628 !! test
7629 1. Interaction of linktrail and template encapsulation
7630 !! options
7631 parsoid
7632 !! wikitext
7633 {{echo|[[Foo]]}}l
7634 !! html
7635 <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>
7636 !! end
7637
7638 !! test
7639 2. Interaction of linktrail and template encapsulation
7640 !! options
7641 parsoid
7642 !! wikitext
7643 {{echo|Some [[Fool]]}}s
7644 !! html
7645 <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>
7646 !! end
7647
7648 !! test
7649 3. Interaction of linktrail and template encapsulation
7650 !! options
7651 parsoid
7652 !! wikitext
7653 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7654 !! html
7655 <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>
7656 !! end
7657
7658 !! article
7659 Söfnuður
7660 !! text
7661 Test.
7662 !! endarticle
7663
7664 !! test
7665 Internal link with is link prefix
7666 !! options
7667 language=is
7668 !! wikitext
7669 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7670 !! html
7671 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7672 </p>
7673 !! end
7674
7675 !! article
7676 Mótmælendatrú
7677 !! text
7678 Test.
7679 !! endarticle
7680
7681 !! test
7682 Internal link with is link trail and link prefix
7683 !! options
7684 language=is
7685 !! wikitext
7686 [[mótmælendatrú|xxx]]ar
7687 [[mótmælendatrú]]ar
7688 mótmælenda[[söfnuður]]
7689 mótmælenda[[söfnuður|söfnuðir]]
7690 mótmælenda[[söfnuður|söfnuðir]]xxx
7691 !! html
7692 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7693 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7694 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7695 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7696 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7697 </p>
7698 !! end
7699
7700 !! test
7701 Parsoid link trail escaping
7702 !! options
7703 parsoid=html2wt,html2html
7704 !! html/parsoid
7705 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7706 !! wikitext
7707 [[apple]]<nowiki/>s
7708 !! end
7709
7710 !! test
7711 Parsoid link prefix escaping
7712 !! options
7713 language=is
7714 parsoid=html2wt,html2html
7715 !! html/parsoid
7716 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7717 !! wikitext
7718 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7719 !! end
7720
7721 !! test
7722 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7723 !! wikitext
7724 [[Foo| bar]]
7725
7726 [[Foo| ''bar'']]
7727
7728 [http://wp.org foo]
7729
7730 [http://wp.org ''foo'']
7731 !! html
7732 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7733 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7734 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7735 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7736 </p>
7737 !! end
7738
7739 !! test
7740 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7741 !! options
7742 parsoid
7743 !! wikitext
7744 [[Foo|{{echo|a}} b {{echo|c}}]]
7745 !! html
7746 <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>
7747 !! end
7748
7749 !! test
7750 Link with angle bracket after anchor
7751 !! wikitext
7752 [[Foo#<bar>]]
7753 !! html/php
7754 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7755 </p>
7756 !! html/parsoid
7757 <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>
7758 !! end
7759
7760 ###
7761 ### Interwiki links (see maintenance/interwiki.sql)
7762 ###
7763
7764 !! test
7765 Inline interwiki link
7766 !! options
7767 parsoid=wt2html,wt2wt,html2html
7768 !! wikitext
7769 [[MeatBall:SoftSecurity]]
7770 !! html/php
7771 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7772 </p>
7773 !! html/parsoid
7774 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7775 !! end
7776
7777 !! test
7778 Inline interwiki link with empty title (bug 2372)
7779 !! options
7780 parsoid=wt2html,wt2wt,html2html
7781 !! wikitext
7782 [[MeatBall:]]
7783 !! html/php
7784 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7785 </p>
7786 !! html/parsoid
7787 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7788 !! end
7789
7790 !! test
7791 Interwiki link encoding conversion (bug 1636)
7792 !! wikitext
7793 *[[Wikipedia:ro:Olteni&#0355;a]]
7794 *[[Wikipedia:ro:Olteni&#355;a]]
7795 !! html
7796 <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>
7797 <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>
7798
7799 !! html+tidy
7800 <ul>
7801 <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>
7802 <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>
7803 </ul>
7804 !! end
7805
7806 !! test
7807 Interwiki link with fragment (bug 2130)
7808 !! wikitext
7809 [[MeatBall:SoftSecurity#foo]]
7810 !! html
7811 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7812 </p>
7813 !! end
7814
7815 # Ideally the wikipedia: prefix here should be proto-relative too
7816 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7817 # define the 'en' prefix, and originally the test used 'wikipedia',
7818 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7819 # article.
7820 !! test
7821 Different interwiki prefixes mapping to the same URL
7822 !! wikitext
7823 [[:en:Foo]]
7824
7825 [[:en:Foo|Foo]]
7826
7827 [[wikipedia:Foo]]
7828
7829 [[:wikipedia:Foo|Foo]]
7830
7831 [[wikipedia:en:Foo]]
7832
7833 [[:wikipedia:en:Foo]]
7834
7835 [[ wikiPEdia :Foo]]
7836 !! html/parsoid
7837 <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>
7838
7839 <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>
7840
7841 <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>
7842
7843 <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>
7844
7845 <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>
7846
7847 <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>
7848
7849 <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>
7850 !! end
7851
7852 !! test
7853 Interwiki links that cannot be represented in wiki syntax
7854 !! wikitext
7855 [[meatball:ok]]
7856 [[meatball:ok#foo|ok with fragment]]
7857 [[meatball:ok_as_well?|ok ending with ? mark]]
7858 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7859 [http://de.wikipedia.org/wiki/#foo is just fragment]
7860
7861 !! html/php
7862 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7863 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7864 <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>
7865 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7866 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7867 </p>
7868 !! html/parsoid
7869 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7870 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7871 <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>
7872 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7873 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7874 !! end
7875
7876 !! test
7877 Interwiki links: trail
7878 !! wikitext
7879 [[wikipedia:Foo|Ba]]r
7880 !! html/php
7881 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7882 </p>
7883 !! html/parsoid
7884 <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>
7885 !! end
7886
7887 !! test
7888 Local interwiki link
7889 !! options
7890 parsoid=wt2html,wt2wt,html2html
7891 !! wikitext
7892 [[local:Template:Foo]]
7893 !! html/php
7894 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7895 </p>
7896 !! html/parsoid
7897 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7898 !! end
7899
7900 # Parsoid does not mark self-links, by design.
7901 !! test
7902 Local interwiki link: self-link to current page
7903 !! options
7904 title=[[Main Page]]
7905 parsoid=wt2html,wt2wt,html2html
7906 !! wikitext
7907 [[local:Main Page]]
7908 !! html/php
7909 <p><strong class="selflink">local:Main Page</strong>
7910 </p>
7911 !! html/parsoid
7912 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7913 !! end
7914
7915 !! test
7916 Local interwiki link: prefix only (bug 64167)
7917 !! options
7918 parsoid=wt2html,wt2wt,html2html
7919 !! wikitext
7920 [[local:]]
7921 !! html/php
7922 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7923 </p>
7924 !! html/parsoid
7925 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7926 !! end
7927
7928 !! test
7929 Local interwiki link: with additional interwiki prefix (bug 61357)
7930 !! options
7931 parsoid=wt2html,wt2wt,html2html
7932 !! wikitext
7933 [[local:meatball:Hello]]
7934 !! html/php
7935 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7936 </p>
7937 !! html/parsoid
7938 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7939 !! end
7940
7941 !! test
7942 Multiple local interwiki link prefixes
7943 !! wikitext
7944 [[local:local:local:local:mi:local:Foo]]
7945 !! options
7946 parsoid=wt2html,wt2wt,html2html
7947 !! html/php
7948 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7949 </p>
7950 !! html/parsoid
7951 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7952 !! end
7953
7954 ###
7955 ### Interlanguage links
7956 ### Language links (so that searching for '### language' matches..)
7957 ###
7958
7959 !! test
7960 Interlanguage link
7961 !! options
7962 parsoid=wt2html,wt2wt,html2html
7963 !! wikitext
7964 Blah blah blah
7965 [[zh:Chinese]]
7966 !! html/php
7967 <p>Blah blah blah
7968 </p>
7969 !! html/parsoid
7970 <p>Blah blah blah</p>
7971 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7972 !! end
7973
7974 !! test
7975 Interlanguage link with spacing
7976 !! options
7977 parsoid=wt2html,wt2wt,html2html
7978 !! wikitext
7979 Blah blah blah
7980 [[ zh : Chinese ]]
7981 !! html/php
7982 <p>Blah blah blah
7983 </p>
7984 !! html/parsoid
7985 <p>Blah blah blah</p>
7986 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7987 !! end
7988
7989 !! test
7990 Double interlanguage link
7991 !! options
7992 parsoid=wt2html,wt2wt,html2html
7993 !! wikitext
7994 Blah blah blah
7995 [[es:Spanish]]
7996 [[zh:Chinese]]
7997 !! html/php
7998 <p>Blah blah blah
7999 </p>
8000 !! html/parsoid
8001 <p>Blah blah blah</p>
8002 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8003 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8004 !! end
8005
8006 !! test
8007 Interlanguage link variations
8008 !! options
8009 parsoid=wt2html,wt2wt,html2html
8010 !! wikitext
8011 Blah blah blah
8012 [[ es :Spanish]]
8013 [[ ZH :Chinese]]
8014 [[es:Foo_bar]]
8015 !! html/php
8016 <p>Blah blah blah
8017 </p>
8018 !! html/parsoid
8019 <p>Blah blah blah</p>
8020 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8021 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8022 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8023 !! end
8024
8025 !! test
8026 Space and question mark encoding in interlanguage links (T95473)
8027 !! options
8028 parsoid=wt2html,wt2wt,html2html
8029 !! wikitext
8030 Blah blah blah
8031 [[es:Foo bar?]]
8032 !! html/php
8033 <p>Blah blah blah
8034 </p>
8035 !! html/parsoid
8036 <p>Blah blah blah</p>
8037 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8038 !! end
8039
8040 !! test
8041 Interlanguage link, with prefix links
8042 !! options
8043 language=ln
8044 !! wikitext
8045 Blah blah blah
8046 [[zh:Chinese]]
8047 !! html/php
8048 <p>Blah blah blah
8049 </p>
8050 !! html/parsoid
8051 <p>Blah blah blah</p>
8052 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8053 !! end
8054
8055 !! test
8056 Double interlanguage link, with prefix links (bug 8897)
8057 !! options
8058 language=ln
8059 !! wikitext
8060 Blah blah blah
8061 [[es:Spanish]]
8062 [[zh:Chinese]]
8063 !! html/php
8064 <p>Blah blah blah
8065 </p>
8066 !! html/parsoid
8067 <p>Blah blah blah</p>
8068 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8069 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8070 !! end
8071
8072 !! test
8073 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8074 !! wikitext
8075 Blah blah blah
8076 [[mul:Article]]
8077 !! html/php
8078 <p>Blah blah blah
8079 </p>
8080 !! html/parsoid
8081 <p>Blah blah blah</p>
8082 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8083 !! end
8084
8085 !! test
8086 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8087 !! options
8088 language=ln
8089 !! wikitext
8090 [[WW&nbsp;II]]
8091 !! html
8092 <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>
8093 </p>
8094 !! end
8095
8096 !! test
8097 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8098 !! options
8099 parsoid=html2wt
8100 !! html/parsoid
8101 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8102 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8103 !! wikitext
8104 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8105
8106 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8107 !! end
8108
8109 !! test
8110 Parsoid: handle constructor well
8111 !! wikitext
8112 [[constructor]]
8113
8114 [[constructor:foo]]
8115 !! html/php
8116 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8117 </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>
8118 </p>
8119 !! html/parsoid
8120 <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>
8121
8122 <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>
8123 !! end
8124
8125 !! article
8126 ko:
8127 !! text
8128 Test.
8129 !! endarticle
8130
8131 # Note that `ko` isn't a known interlanguage prefix
8132 !! test
8133 Parsoid: recognize interlanguage links without a target page
8134 !! options
8135 ill
8136 !! wikitext
8137 [[es:]]
8138
8139 [[ko:]]
8140 !! html/php
8141 es:
8142 !! html/parsoid
8143 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8144
8145 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8146 !! end
8147
8148 # Note that `ko` isn't a known interwiki prefix
8149 !! test
8150 Parsoid: recognize interwiki links without a target page
8151 !! options
8152 parsoid=wt2html,wt2wt,html2html
8153 !! wikitext
8154 [[:es:]]
8155
8156 [[:ko:]]
8157 !! html/php
8158 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8159 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8160 </p>
8161 !! html/parsoid
8162 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8163 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8164 !! end
8165
8166 !! test
8167 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8168 !! wikitext
8169 [[mi:Foo]]
8170 !! html/php
8171 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8172 </p>
8173 !! html/parsoid
8174 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8175 !! end
8176
8177 !! test
8178 Interlanguage link with preceding local interwiki link (bug 68085)
8179 !! options
8180 parsoid=wt2html,wt2wt,html2html
8181 !! wikitext
8182 Blah blah blah
8183 [[local:es:Spanish]]
8184 !! html/php
8185 <p>Blah blah blah
8186 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8187 </p>
8188 !! html/parsoid
8189 <p>Blah blah blah
8190 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8191 !! end
8192
8193 !! test
8194 Looks like an interlanguage link, but is actually a local interwiki
8195 !! options
8196 parsoid=wt2html,wt2wt,html2html
8197 !! wikitext
8198 Blah blah blah
8199 [[mi:Template:Foo]]
8200 !! html/php
8201 <p>Blah blah blah
8202 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8203 </p>
8204 !! html/parsoid
8205 <p>Blah blah blah
8206 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8207 !! end
8208
8209 ###
8210 ### Redirects, Parsoid-only
8211 ###
8212
8213 !! test
8214 1. Simple redirect to page
8215 !! wikitext
8216 #REDIRECT [[Main Page]]
8217 !! html/parsoid
8218 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8219 !! end
8220
8221 !! test
8222 2. Other redirect variants
8223 !! wikitext
8224 #REDIRECT [[Main_Page]]
8225 !! html/parsoid
8226 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8227 !! end
8228
8229 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8230 # This tests the Parsoid bail-out code.
8231 !! test
8232 3. Other redirect variants
8233 !! wikitext
8234 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8235 !! html/parsoid
8236 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8237 !! end
8238
8239 !! test
8240 4. Redirect to a templated destination
8241 !! wikitext
8242 #REDIRECT [[{{echo|Foo}}bar]]
8243 !! html/parsoid
8244 <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"}]]}'/>
8245 !! end
8246
8247 !! test
8248 Empty redirect
8249 !! options
8250 parsoid=wt2html,wt2wt
8251 !! wikitext
8252 #REDIRECT [[]]
8253 !! html/parsoid
8254 <ol>
8255 <li>REDIRECT [[]]</li></ol>
8256 !! end
8257
8258 !! test
8259 Optional colon in #REDIRECT
8260 !! options
8261 # the colon is archaic syntax. we support it for wt2html, but we
8262 # don't care that it roundtrips back to the modern syntax.
8263 parsoid=wt2html,html2html
8264 !! wikitext
8265 #REDIRECT:[[Main Page]]
8266 !! html/parsoid
8267 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8268 !! end
8269
8270 !! test
8271 Whitespace in #REDIRECT with optional colon
8272 !! options
8273 # the colon and gratuitous whitespace is archaic syntax. we support
8274 # it for wt2html, but we don't care that it roundtrips back to the
8275 # modern syntax (without extra whitespace)
8276 parsoid=wt2html,html2html
8277 !! wikitext
8278
8279 #REDIRECT
8280 :
8281 [[Main Page]]
8282 !! html/parsoid
8283 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8284 !! end
8285
8286 !! test
8287 Piped link in #REDIRECT
8288 !! options
8289 # content after piped link is ignored. we support this syntax,
8290 # but don't care that the piped link is lost when we roundtrip this.
8291 parsoid=wt2html
8292 !! wikitext
8293 #REDIRECT [[Main Page|bar]]
8294 !! html/parsoid
8295 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8296 !! end
8297
8298 !! test
8299 Redirect to category (T104502)
8300 !! options
8301 parsoid=wt2html,wt2wt
8302 !! wikitext
8303 #REDIRECT [[Category:Foo]]
8304 !! html/parsoid
8305 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8306 !! end
8307
8308 !! test
8309 Redirect to category with URL encoding (T104502)
8310 !! options
8311 parsoid=wt2html
8312 !! wikitext
8313 #REDIRECT [[Category%3AFoo]]
8314 !! html/parsoid
8315 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8316 !! end
8317
8318 !! test
8319 Redirect to category page
8320 !! wikitext
8321 #REDIRECT [[:Category:Foo]]
8322 !! html/parsoid
8323 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8324 !! end
8325
8326 !! test
8327 Redirect to image page (1)
8328 !! wikitext
8329 #REDIRECT [[File:Wiki.png]]
8330 !! html/parsoid
8331 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8332 !! end
8333
8334 !! test
8335 Redirect to image page (2)
8336 !! wikitext
8337 #REDIRECT [[Image:Wiki.png]]
8338 !! html/parsoid
8339 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8340 !! end
8341
8342 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8343 # Next test confirms this.
8344 !! test
8345 Redirect to language (1) (T104918)
8346 !! options
8347 parsoid=wt2html,wt2wt,html2html
8348 !! wikitext
8349 #REDIRECT [[en:File:Wiki.png]]
8350 !! html/parsoid
8351 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8352 !! end
8353
8354 !! test
8355 Redirect to language (2) (T104918)
8356 !! wikitext
8357 #REDIRECT [[:en:File:Wiki.png]]
8358 !! html/parsoid
8359 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8360 !! end
8361
8362 !! test
8363 Redirect to interwiki (T104918)
8364 !! wikitext
8365 #REDIRECT [[meatball:File:Wiki.png]]
8366 !! html/parsoid
8367 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8368 !! end
8369
8370 !! test
8371 Non-English #REDIRECT
8372 !! options
8373 language=is
8374 !! wikitext
8375 #TILVÍSUN [[Main Page]]
8376 !! html/parsoid
8377 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8378 !! end
8379
8380 !! test
8381 Redirect syntax under text isn't considered a redirect
8382 !! wikitext
8383 some text
8384 #redirect [[Main Page]]
8385 !! html/parsoid
8386 <p>some text</p>
8387 <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>
8388 !! end
8389
8390 # FIXME: Should hoist the redirect to the top of the page and ensure there
8391 # is only one.
8392 !! test
8393 New redirect
8394 !! options
8395 parsoid=html2wt
8396 !! html/parsoid
8397 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8398 !! wikitext
8399 Foo
8400 #REDIRECT [[Foo]]
8401 !! end
8402
8403 ##
8404 ## XHTML tidiness
8405 ###
8406
8407 !! test
8408 <br> to <br />
8409 !! wikitext
8410 1<br>2<br />3
8411 !! html
8412 <p>1<br />2<br />3
8413 </p>
8414 !! end
8415
8416 !! test
8417 Broken br tag sanitization
8418 !! wikitext
8419 </br>
8420 !! html/php
8421 <p>&lt;/br&gt;
8422 </p>
8423 !! end
8424
8425 # TODO: Fix html2html mode (bug 51055)!
8426 !! test
8427 Parsoid: Broken br tag recognition
8428 !! options
8429 parsoid=wt2html
8430 !! wikitext
8431 </br>
8432
8433 <br/ >
8434 !! html+tidy
8435 <p><br /></p>
8436 <p><br /></p>
8437 !! end
8438
8439 !! test
8440 Incorrecly removing closing slashes from correctly formed XHTML
8441 !! wikitext
8442 <br style="clear:both;" />
8443 !! html
8444 <p><br style="clear:both;" />
8445 </p>
8446 !! end
8447
8448 !! test
8449 Failing to transform badly formed HTML into correct XHTML
8450 !! wikitext
8451 <br style="clear: left;">
8452 <br style="clear: right;">
8453 <br style="clear: both;">
8454 !! html
8455 <p><br style="clear: left;" />
8456 <br style="clear: right;" />
8457 <br style="clear: both;" />
8458 </p>
8459 !!end
8460
8461 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8462 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8463 !! test
8464 Handling html with a div self-closing tag
8465 !! wikitext
8466 <div title />
8467 <div title/>
8468 <div title/ >
8469 <div title=bar />
8470 <div title=bar/>
8471 <div title=bar/ >
8472 !! html/php
8473 <p>&lt;div title /&gt;
8474 &lt;div title/&gt;
8475 </p>
8476 <div>
8477 <p>&lt;div title=bar /&gt;
8478 &lt;div title=bar/&gt;
8479 </p>
8480 <div title="bar/"></div>
8481 </div>
8482
8483 !! html/parsoid
8484 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8485 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8486 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8487 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8488 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8489 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8490 !! end
8491
8492 !! test
8493 Handling html with a br self-closing tag
8494 !! wikitext
8495 <br title />
8496 <br title/>
8497 <br title/ >
8498 <br title=bar />
8499 <br title=bar/>
8500 <br title=bar/ >
8501 !! html/php
8502 <p><br title="" />
8503 <br title="" />
8504 <br />
8505 <br title="bar" />
8506 <br title="bar" />
8507 <br title="bar/" />
8508 </p>
8509 !! html/parsoid
8510 <p><br title="" />
8511 <br title="" />
8512 <br title="" />
8513 <br title="bar" />
8514 <br title="bar" />
8515 <br title="bar/" />
8516 </p>
8517 !! end
8518
8519 !! test
8520 Horizontal ruler (should it add that extra space?)
8521 !! wikitext
8522 <hr>
8523 <hr >
8524 foo <hr
8525 > bar
8526 !! html+tidy
8527 <hr />
8528 <hr />
8529 <p>foo</p>
8530 <hr />
8531 <p>bar</p>
8532 !! end
8533
8534 !! test
8535 Horizontal ruler -- 4+ dashes render hr
8536 !! wikitext
8537 ----
8538 !! html
8539 <hr />
8540
8541 !! end
8542
8543 !! test
8544 Horizontal ruler -- eats additional dashes on the same line
8545 !! wikitext
8546 ---------
8547 !! html
8548 <hr />
8549
8550 !! end
8551
8552 !! test
8553 Horizontal ruler -- does not collapse dashes on consecutive lines
8554 !! wikitext
8555 ----
8556 ----
8557 !! html
8558 <hr />
8559 <hr />
8560
8561 !! end
8562
8563 !! test
8564 Horizontal ruler -- <4 dashes render as plain text
8565 !! wikitext
8566 ---
8567 !! html
8568 <p>---
8569 </p>
8570 !! end
8571
8572 !! test
8573 Horizontal ruler -- Supports content following dashes on same line
8574 !! wikitext
8575 ---- Foo
8576 !! html
8577 <hr /> Foo
8578
8579 !! html+tidy
8580 <hr />
8581 <p>Foo</p>
8582 !! end
8583
8584 ###
8585 ### Block-level elements
8586 ###
8587 !! test
8588 Common list
8589 !! wikitext
8590 *Common list
8591 * item 2
8592 *item 3
8593 !! html
8594 <ul><li>Common list</li>
8595 <li> item 2</li>
8596 <li>item 3</li></ul>
8597
8598 !! end
8599
8600 !! test
8601 Numbered list
8602 !! wikitext
8603 #Numbered list
8604 #item 2
8605 # item 3
8606 !! html
8607 <ol><li>Numbered list</li>
8608 <li>item 2</li>
8609 <li> item 3</li></ol>
8610
8611 !! end
8612
8613 !! test
8614 Mixed list
8615 !! wikitext
8616 *Mixed list
8617 *# with numbers
8618 ** and bullets
8619 *# and numbers
8620 *bullets again
8621 **bullet level 2
8622 ***bullet level 3
8623 ***#Number on level 4
8624 **bullet level 2
8625 **#Number on level 3
8626 **#Number on level 3
8627 *#number level 2
8628 *Level 1
8629 *** Level 3
8630 #** Level 3, but ordered
8631 !! html
8632 <ul><li>Mixed list
8633 <ol><li> with numbers</li></ol>
8634 <ul><li> and bullets</li></ul>
8635 <ol><li> and numbers</li></ol></li>
8636 <li>bullets again
8637 <ul><li>bullet level 2
8638 <ul><li>bullet level 3
8639 <ol><li>Number on level 4</li></ol></li></ul></li>
8640 <li>bullet level 2
8641 <ol><li>Number on level 3</li>
8642 <li>Number on level 3</li></ol></li></ul>
8643 <ol><li>number level 2</li></ol></li>
8644 <li>Level 1
8645 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8646 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8647
8648 !! end
8649
8650 !! test
8651 Nested lists 1
8652 !! wikitext
8653 *foo
8654 **bar
8655 !! html
8656 <ul><li>foo
8657 <ul><li>bar</li></ul></li></ul>
8658
8659 !! end
8660
8661 !! test
8662 Nested lists 2
8663 !! wikitext
8664 **foo
8665 *bar
8666 !! html
8667 <ul><li><ul><li>foo</li></ul></li>
8668 <li>bar</li></ul>
8669
8670 !! end
8671
8672 !! test
8673 Nested lists 3 (first element empty)
8674 !! wikitext
8675 *
8676 **bar
8677 !! html
8678 <ul><li>
8679 <ul><li>bar</li></ul></li></ul>
8680
8681 !! end
8682
8683 !! test
8684 Nested lists 4 (first element empty)
8685 !! wikitext
8686 **
8687 *bar
8688 !! html
8689 <ul><li><ul><li></li></ul></li>
8690 <li>bar</li></ul>
8691
8692 !! end
8693
8694 !! test
8695 Nested lists 5 (both elements empty)
8696 !! wikitext
8697 **
8698 *
8699 !! html
8700 <ul><li><ul><li></li></ul></li>
8701 <li></li></ul>
8702
8703 !! end
8704
8705 !! test
8706 Nested lists 6 (both elements empty)
8707 !! wikitext
8708 *
8709 **
8710 !! html
8711 <ul><li>
8712 <ul><li></li></ul></li></ul>
8713
8714 !! end
8715
8716 !! test
8717 Nested lists 7 (skip initial nesting levels)
8718 !! wikitext
8719 *** foo
8720 !! html
8721 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8722
8723 !! end
8724
8725 !! test
8726 Nested lists 8 (multiple nesting transitions)
8727 !! wikitext
8728 * foo
8729 *** bar
8730 ** baz
8731 * boo
8732 !! html
8733 <ul><li> foo
8734 <ul><li><ul><li> bar</li></ul></li>
8735 <li> baz</li></ul></li>
8736 <li> boo</li></ul>
8737
8738 !! end
8739
8740 !! test
8741 Nested lists 9 (extension interaction)
8742 !! options
8743 parsoid
8744 !! wikitext
8745 *<references />
8746 !! html/parsoid
8747 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8748 !! end
8749
8750 !! test
8751 1. Lists with start-of-line-transparent tokens before bullets: Comments
8752 !! wikitext
8753 *foo
8754 *<!--cmt-->bar
8755 <!--cmt-->*baz
8756 !! html
8757 <ul><li>foo</li>
8758 <li>bar</li>
8759 <li>baz</li></ul>
8760
8761 !! end
8762
8763 !! test
8764 2. Lists with start-of-line-transparent tokens before bullets: Template close
8765 !! wikitext
8766 *foo {{echo|bar
8767 }}*baz
8768 !! html
8769 <ul><li>foo bar</li>
8770 <li>baz</li></ul>
8771
8772 !! end
8773
8774 !! test
8775 List items are not parsed correctly following a <pre> block (bug 785)
8776 !! wikitext
8777 * <pre>foo</pre>
8778 * <pre>bar</pre>
8779 * zar
8780 !! html/php
8781 <ul><li> <pre>foo</pre></li>
8782 <li> <pre>bar</pre></li>
8783 <li> zar</li></ul>
8784
8785 !! html/parsoid
8786 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8787 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8788 <li> zar</li></ul>
8789 !! end
8790
8791 !! test
8792 List items from template
8793 !! wikitext
8794
8795 {{inner list}}
8796 * item 2
8797
8798 * item 0
8799 {{inner list}}
8800 * item 2
8801
8802 * item 0
8803 * notSOL{{inner list}}
8804 * item 2
8805 !! html
8806 <ul><li> item 1</li>
8807 <li> item 2</li></ul>
8808 <ul><li> item 0</li>
8809 <li> item 1</li>
8810 <li> item 2</li></ul>
8811 <ul><li> item 0</li>
8812 <li> notSOL</li>
8813 <li> item 1</li>
8814 <li> item 2</li></ul>
8815
8816 !! end
8817
8818 !! test
8819 List interrupted by empty line or heading
8820 !! wikitext
8821 * foo
8822
8823 ** bar
8824 == A heading ==
8825 * Another list item
8826 !! html
8827 <ul><li> foo</li></ul>
8828 <ul><li><ul><li> bar</li></ul></li></ul>
8829 <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>
8830 <ul><li> Another list item</li></ul>
8831
8832 !!end
8833
8834 !!test
8835 Multiple list tags generated by templates
8836 !! wikitext
8837 {{echo|<li>}}a
8838 {{echo|<li>}}b
8839 {{echo|<li>}}c
8840 !! html
8841 <li>a
8842 <li>b
8843 <li>c</li>
8844 </li>
8845 </li>
8846
8847 !! html+tidy
8848 <ul>
8849 <li>a</li>
8850 <li>b</li>
8851 <li>c</li>
8852 </ul>
8853 !!end
8854
8855 !!test
8856 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8857 !! wikitext
8858 *a
8859 <!--This line will NOT split the list-->
8860 *b
8861 <!--This line will NOT split the list either-->
8862 *c
8863 <!--foo--> <!----> <!--This line NOT split the list either-->
8864 *d
8865 !! html
8866 <ul><li>a</li>
8867 <li>b</li>
8868 <li>c</li>
8869 <li>d</li></ul>
8870
8871 !!end
8872
8873 !!test
8874 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8875 !! wikitext
8876 *a
8877 <!--This line will NOT split the list-->
8878 *b
8879 <!--This line will NOT split the list either-->
8880 *c
8881 <!--foo--> <!----> <!--This line NOT split the list
8882 either-->
8883 *d
8884 !! html
8885 <ul><li>a</li>
8886 <li>b</li>
8887 <li>c</li>
8888 <li>d</li></ul>
8889
8890 !!end
8891
8892 !!test
8893 Test the li-hack
8894 (The PHP parser relies on Tidy for the hack)
8895 !!options
8896 parsoid=wt2html,wt2wt
8897 !! wikitext
8898 * foo
8899 * <li>li-hack
8900 * {{echo|<li>templated li-hack}}
8901 * <!--foo--> <li> unsupported li-hack with preceding comments
8902
8903 <ul>
8904 <li><li>not a li-hack
8905 </li>
8906 </ul>
8907 !! html+tidy
8908 <ul>
8909 <li>foo</li>
8910 <li>li-hack</li>
8911 <li>templated li-hack</li>
8912 <li>unsupported li-hack with preceding comments</li>
8913 </ul>
8914 <ul>
8915 <li>not a li-hack</li>
8916 </ul>
8917 !!end
8918
8919 !! test
8920 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8921 !! options
8922 parsoid
8923 !! wikitext
8924 # foo
8925 ## bar
8926 * foo
8927 ** bar
8928 : foo
8929 :: bar
8930 !! html
8931 <ol>
8932 <li> foo<ol>
8933 <li> bar</li>
8934 </ol></li>
8935 </ol><ul>
8936 <li> foo<ul>
8937 <li> bar</li>
8938 </ul></li>
8939 </ul><dl>
8940 <dd> foo<dl>
8941 <dd> bar</dd>
8942 </dl></dd>
8943 </dl>
8944 !! end
8945
8946 !! test
8947 Parsoid: Test of whitespace serialization with Templated bullets
8948 !! options
8949 parsoid
8950 !! wikitext
8951 * {{bullet}}
8952 !! html
8953 <ul>
8954 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8955 </ul>
8956 !! end
8957
8958 # ------------------------------------------------------------------------
8959 # The next set of tests are about Parsoid's ability to handle badly nested
8960 # tags (parse, minimize scope of fixup, and roundtrip back)
8961 # ------------------------------------------------------------------------
8962
8963 !! test
8964 Unbalanced closing block tags break a list
8965 (php parser relies on Tidy to fix up)
8966 !! wikitext
8967 <div>
8968 *a</div><div>
8969 *b</div>
8970 !! html+tidy
8971 <div>
8972 <ul>
8973 <li>a</li>
8974 </ul>
8975 </div>
8976 <div>
8977 <ul>
8978 <li>b</li>
8979 </ul>
8980 </div>
8981 !! end
8982
8983 # Parsoid fails this test, but it might be tricky to support properly.
8984 # See bug 68395.
8985 !! test
8986 Unbalanced closing non-block tags don't break a list
8987 (php parser relies on Tidy to fix up)
8988 !! wikitext
8989 <span>
8990 *a</span><span>
8991 *b</span>
8992 !! html/php+tidy
8993 <ul>
8994 <li><span>a</span></li>
8995 <li><span>b</span></li>
8996 </ul>
8997 !! html/parsoid
8998 <span>
8999 <ul>
9000 <li>a<span></span>
9001 </li>
9002 <li>b
9003 </li>
9004 </ul>
9005 </span>
9006 !! end
9007
9008 !! test
9009 Unclosed formatting tags that straddle lists are closed and reopened
9010 (php parser relies on Tidy to fix up)
9011 !! options
9012 parsoid=wt2html,wt2wt,html2html
9013 !! wikitext
9014 # <s> a
9015 # b </s>
9016 !! html/php+tidy
9017 <ol>
9018 <li><s>a</s></li>
9019 <li><s>b</s></li>
9020 </ol>
9021 !! html/parsoid
9022 <ol><li> <s> a</s></li>
9023 <li><s> b </s></li></ol>
9024 !! end
9025
9026 # See bug 68395.
9027 !!test
9028 1. List embedded in a formatting tag
9029 !! wikitext
9030 <small>
9031 * foo
9032 </small>
9033 !! html/php+tidy
9034 <ul>
9035 <li><small>foo</small></li>
9036 </ul>
9037 !! html/parsoid
9038 <small>
9039 <ul>
9040 <li> foo</li>
9041 </ul>
9042 </small>
9043 !!end
9044
9045 ## Ugly Parsoid output here
9046 ## Not sure what the right output is.
9047 !!test
9048 2. List embedded in a formatting tag
9049 !! wikitext
9050 <small>
9051 *a
9052 *b</small>
9053 !! html/php+tidy
9054 <ul>
9055 <li><small>a</small></li>
9056 <li><small>b</small></li>
9057 </ul>
9058 !! html/parsoid
9059 <small></small>
9060 <ul><small>
9061 <li>a</li>
9062 </small>
9063 <li><small>b</small></li>
9064 </ul>
9065 !!end
9066
9067 # Ugly Parsoid and PHP parser output here
9068 # Not sure if we want to make this a test!
9069 #
9070 ## !!test
9071 ## 3. Unclosed formatting tags in list elements
9072 ## !! wikitext
9073 ## *<small>a
9074 ## *<small>b
9075 ## !! html/php+tidy
9076 ## <ul>
9077 ## <li><small>a</small></li>
9078 ## <li><small><small>b</small></small></li>
9079 ## </ul>
9080 ## !! html/parsoid
9081 ## <ul>
9082 ## <li><small>a</small></li>
9083 ## <small>
9084 ## <li><small>b</small></li>
9085 ## </small></ul>
9086 ## !!end
9087
9088 # This is a bug in the PHP parser + tidy combination.
9089 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9090 # and then fostered out of the table by tidy.)
9091 # We believe the Parsoid output to be correct.
9092 !! test
9093 Table with missing opening <tr> tag
9094 !! options
9095 parsoid=wt2html,wt2wt
9096 !! wikitext
9097 <table>
9098 <td>foo</td>
9099 </tr>
9100 </table>
9101 !! html+tidy
9102 <table>
9103 <tr>
9104 <td>foo</td>
9105 </tr>
9106 </table>
9107 !! end
9108
9109 ###
9110 ### Magic Words
9111 ###
9112
9113 # Note that the current date is hard-coded as
9114 # 1970-01-01T00:02:03Z (a Thursday)
9115 # when running parser tests. The timezone is also fixed to GMT, so
9116 # local date will be identical to current date.
9117
9118 !! test
9119 Magic Word: {{CURRENTDAY}}
9120 !! wikitext
9121 {{CURRENTDAY}}
9122 !! html
9123 <p>1
9124 </p>
9125 !! end
9126
9127 !! test
9128 Magic Word: {{CURRENTDAY2}}
9129 !! wikitext
9130 {{CURRENTDAY2}}
9131 !! html
9132 <p>01
9133 </p>
9134 !! end
9135
9136 !! test
9137 Magic Word: {{CURRENTDAYNAME}}
9138 !! wikitext
9139 {{CURRENTDAYNAME}}
9140 !! html
9141 <p>Thursday
9142 </p>
9143 !! end
9144
9145 !! test
9146 Magic Word: {{CURRENTDOW}}
9147 !! wikitext
9148 {{CURRENTDOW}}
9149 !! html
9150 <p>4
9151 </p>
9152 !! end
9153
9154 !! test
9155 Magic Word: {{CURRENTMONTH}}
9156 !! wikitext
9157 {{CURRENTMONTH}}
9158 !! html
9159 <p>01
9160 </p>
9161 !! end
9162
9163 !! test
9164 Magic Word: {{CURRENTMONTH1}}
9165 !! wikitext
9166 {{CURRENTMONTH1}}
9167 !! html
9168 <p>1
9169 </p>
9170 !! end
9171
9172 !! test
9173 Magic Word: {{CURRENTMONTHABBREV}}
9174 !! wikitext
9175 {{CURRENTMONTHABBREV}}
9176 !! html
9177 <p>Jan
9178 </p>
9179 !! end
9180
9181 !! test
9182 Magic Word: {{CURRENTMONTHNAME}}
9183 !! wikitext
9184 {{CURRENTMONTHNAME}}
9185 !! html
9186 <p>January
9187 </p>
9188 !! end
9189
9190 !! test
9191 Magic Word: {{CURRENTMONTHNAMEGEN}}
9192 !! wikitext
9193 {{CURRENTMONTHNAMEGEN}}
9194 !! html
9195 <p>January
9196 </p>
9197 !! end
9198
9199 !! test
9200 Magic Word: {{CURRENTTIME}}
9201 !! wikitext
9202 {{CURRENTTIME}}
9203 !! html
9204 <p>00:02
9205 </p>
9206 !! end
9207
9208 !! test
9209 Magic Word: {{CURRENTHOUR}}
9210 !! wikitext
9211 {{CURRENTHOUR}}
9212 !! html
9213 <p>00
9214 </p>
9215 !! end
9216
9217 !! test
9218 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9219 !! wikitext
9220 {{CURRENTWEEK}}
9221 !! html
9222 <p>1
9223 </p>
9224 !! end
9225
9226 !! test
9227 Magic Word: {{CURRENTYEAR}}
9228 !! wikitext
9229 {{CURRENTYEAR}}
9230 !! html
9231 <p>1970
9232 </p>
9233 !! end
9234
9235 !! test
9236 Magic Word: {{CURRENTTIMESTAMP}}
9237 !! wikitext
9238 {{CURRENTTIMESTAMP}}
9239 !! html
9240 <p>19700101000203
9241 </p>
9242 !! end
9243
9244 !! test
9245 Magic Words LOCAL (UTC)
9246 !! wikitext
9247 * {{LOCALMONTH}}
9248 * {{LOCALMONTH1}}
9249 * {{LOCALMONTHNAME}}
9250 * {{LOCALMONTHNAMEGEN}}
9251 * {{LOCALMONTHABBREV}}
9252 * {{LOCALDAY}}
9253 * {{LOCALDAY2}}
9254 * {{LOCALDAYNAME}}
9255 * {{LOCALYEAR}}
9256 * {{LOCALTIME}}
9257 * {{LOCALHOUR}}
9258 * {{LOCALWEEK}}
9259 * {{LOCALDOW}}
9260 * {{LOCALTIMESTAMP}}
9261 !! html
9262 <ul><li> 01</li>
9263 <li> 1</li>
9264 <li> January</li>
9265 <li> January</li>
9266 <li> Jan</li>
9267 <li> 1</li>
9268 <li> 01</li>
9269 <li> Thursday</li>
9270 <li> 1970</li>
9271 <li> 00:02</li>
9272 <li> 00</li>
9273 <li> 1</li>
9274 <li> 4</li>
9275 <li> 19700101000203</li></ul>
9276
9277 !! end
9278
9279 !! test
9280 Magic Word: {{FULLPAGENAME}}
9281 !! options
9282 title=[[User:Ævar Arnfjörð Bjarmason]]
9283 !! wikitext
9284 {{FULLPAGENAME}}
9285 !! html
9286 <p>User:Ævar Arnfjörð Bjarmason
9287 </p>
9288 !! end
9289
9290 !! test
9291 Magic Word: {{FULLPAGENAMEE}}
9292 !! options
9293 title=[[User:Ævar Arnfjörð Bjarmason]]
9294 !! wikitext
9295 {{FULLPAGENAMEE}}
9296 !! html
9297 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9298 </p>
9299 !! end
9300
9301 !! test
9302 Magic Word: {{TALKSPACE}}
9303 !! options
9304 title=[[User:Ævar Arnfjörð Bjarmason]]
9305 !! wikitext
9306 {{TALKSPACE}}
9307 !! html
9308 <p>User talk
9309 </p>
9310 !! end
9311
9312 !! test
9313 Magic Word: {{TALKSPACE}}, same namespace
9314 !! options
9315 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9316 !! wikitext
9317 {{TALKSPACE}}
9318 !! html
9319 <p>User talk
9320 </p>
9321 !! end
9322
9323 !! test
9324 Magic Word: {{TALKSPACE}}, main namespace
9325 !! options
9326 title=[[Parser Test]]
9327 !! wikitext
9328 {{TALKSPACE}}
9329 !! html
9330 <p>Talk
9331 </p>
9332 !! end
9333
9334 !! test
9335 Magic Word: {{TALKSPACEE}}
9336 !! options
9337 title=[[User:Ævar Arnfjörð Bjarmason]]
9338 !! wikitext
9339 {{TALKSPACEE}}
9340 !! html
9341 <p>User_talk
9342 </p>
9343 !! end
9344
9345 !! test
9346 Magic Word: {{SUBJECTSPACE}}
9347 !! options
9348 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9349 !! wikitext
9350 {{SUBJECTSPACE}}
9351 !! html
9352 <p>User
9353 </p>
9354 !! end
9355
9356 !! test
9357 Magic Word: {{SUBJECTSPACE}}, same namespace
9358 !! options
9359 title=[[User:Ævar Arnfjörð Bjarmason]]
9360 !! wikitext
9361 {{SUBJECTSPACE}}
9362 !! html
9363 <p>User
9364 </p>
9365 !! end
9366
9367 !! test
9368 Magic Word: {{SUBJECTSPACE}}, main namespace
9369 !! options
9370 title=[[Parser Test]]
9371 !! wikitext
9372 {{SUBJECTSPACE}}
9373 !! html
9374
9375 !! end
9376
9377 !! test
9378 Magic Word: {{SUBJECTSPACEE}}
9379 !! options
9380 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9381 !! wikitext
9382 {{SUBJECTSPACEE}}
9383 !! html
9384 <p>User
9385 </p>
9386 !! end
9387
9388 !! test
9389 Magic Word: {{NAMESPACE}}
9390 !! options
9391 title=[[User:Ævar Arnfjörð Bjarmason]]
9392 !! wikitext
9393 {{NAMESPACE}}
9394 !! html
9395 <p>User
9396 </p>
9397 !! end
9398
9399 !! test
9400 Magic Word: {{NAMESPACEE}}
9401 !! options
9402 title=[[User:Ævar Arnfjörð Bjarmason]]
9403 !! wikitext
9404 {{NAMESPACEE}}
9405 !! html
9406 <p>User
9407 </p>
9408 !! end
9409
9410 !! test
9411 Magic Word: {{NAMESPACENUMBER}}
9412 !! options
9413 title=[[User:Ævar Arnfjörð Bjarmason]]
9414 !! wikitext
9415 {{NAMESPACENUMBER}}
9416 !! html
9417 <p>2
9418 </p>
9419 !! end
9420
9421 !! test
9422 Magic Word: {{SUBPAGENAME}}
9423 !! options
9424 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9425 !! wikitext
9426 {{SUBPAGENAME}}
9427 !! html
9428 <p>sub ö
9429 </p>
9430 !! end
9431
9432 !! test
9433 Magic Word: {{SUBPAGENAMEE}}
9434 !! options
9435 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9436 !! wikitext
9437 {{SUBPAGENAMEE}}
9438 !! html
9439 <p>sub_%C3%B6
9440 </p>
9441 !! end
9442
9443 !! test
9444 Magic Word: {{ROOTPAGENAME}}
9445 !! options
9446 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9447 !! wikitext
9448 {{ROOTPAGENAME}}
9449 !! html
9450 <p>Ævar Arnfjörð Bjarmason
9451 </p>
9452 !! end
9453
9454 !! test
9455 Magic Word: {{ROOTPAGENAMEE}}
9456 !! options
9457 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9458 !! wikitext
9459 {{ROOTPAGENAMEE}}
9460 !! html
9461 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9462 </p>
9463 !! end
9464
9465 !! test
9466 Magic Word: {{BASEPAGENAME}}
9467 !! options
9468 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9469 !! wikitext
9470 {{BASEPAGENAME}}
9471 !! html
9472 <p>Ævar Arnfjörð Bjarmason
9473 </p>
9474 !! end
9475
9476 !! test
9477 Magic Word: {{BASEPAGENAMEE}}
9478 !! options
9479 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9480 !! wikitext
9481 {{BASEPAGENAMEE}}
9482 !! html
9483 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9484 </p>
9485 !! end
9486
9487 !! test
9488 Magic Word: {{TALKPAGENAME}}
9489 !! options
9490 title=[[User:Ævar Arnfjörð Bjarmason]]
9491 !! wikitext
9492 {{TALKPAGENAME}}
9493 !! html
9494 <p>User talk:Ævar Arnfjörð Bjarmason
9495 </p>
9496 !! end
9497
9498 !! test
9499 Magic Word: {{TALKPAGENAMEE}}
9500 !! options
9501 title=[[User:Ævar Arnfjörð Bjarmason]]
9502 !! wikitext
9503 {{TALKPAGENAMEE}}
9504 !! html
9505 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9506 </p>
9507 !! end
9508
9509 !! test
9510 Magic Word: {{SUBJECTPAGENAME}}
9511 !! options
9512 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9513 !! wikitext
9514 {{SUBJECTPAGENAME}}
9515 !! html
9516 <p>User:Ævar Arnfjörð Bjarmason
9517 </p>
9518 !! end
9519
9520 !! test
9521 Magic Word: {{SUBJECTPAGENAMEE}}
9522 !! options
9523 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9524 !! wikitext
9525 {{SUBJECTPAGENAMEE}}
9526 !! html
9527 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9528 </p>
9529 !! end
9530
9531 !! test
9532 Magic Word: {{NUMBEROFFILES}}
9533 !! wikitext
9534 {{NUMBEROFFILES}}
9535 !! html
9536 <p>5
9537 </p>
9538 !! end
9539
9540 !! test
9541 Magic Word: {{PAGENAME}}
9542 !! options
9543 title=[[User:Ævar Arnfjörð Bjarmason]]
9544 !! wikitext
9545 {{PAGENAME}}
9546 !! html
9547 <p>Ævar Arnfjörð Bjarmason
9548 </p>
9549 !! end
9550
9551 !! test
9552 Magic Word: {{PAGENAME}} with metacharacters
9553 !! options
9554 title=[['foo & bar = baz']]
9555 !! wikitext
9556 ''{{PAGENAME}}''
9557 !! html/php
9558 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9559 </p>
9560 !! html+tidy
9561 <p><i>'foo &amp; bar = baz'</i></p>
9562 !! end
9563
9564 !! test
9565 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9566 !! options
9567 title=[[*RFC 1234 http://example.com/]]
9568 !! wikitext
9569 {{PAGENAME}}
9570 !! html/php
9571 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9572 </p>
9573 !! html+tidy
9574 <p>*RFC 1234 http://example.com/</p>
9575 !! end
9576
9577 !! test
9578 Magic Word: {{PAGENAMEE}}
9579 !! options
9580 title=[[User:Ævar Arnfjörð Bjarmason]]
9581 !! wikitext
9582 {{PAGENAMEE}}
9583 !! html
9584 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9585 </p>
9586 !! end
9587
9588 !! test
9589 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9590 !! options
9591 title=[[*RFC 1234 http://example.com/]]
9592 !! wikitext
9593 {{PAGENAMEE}}
9594 !! html/php
9595 <p>&#42;RFC_1234_http&#58;//example.com/
9596 </p>
9597 !! html+tidy
9598 <p>*RFC_1234_http://example.com/</p>
9599 !! end
9600
9601 !! test
9602 Magic Word: {{REVISIONID}}
9603 !! wikitext
9604 {{REVISIONID}}
9605 !! html
9606 <p>1337
9607 </p>
9608 !! end
9609
9610 !! test
9611 Magic Word: {{SCRIPTPATH}}
9612 !! wikitext
9613 {{SCRIPTPATH}}
9614 !! html
9615 <p>/
9616 </p>
9617 !! end
9618
9619 !! test
9620 Magic Word: {{STYLEPATH}}
9621 !! wikitext
9622 {{STYLEPATH}}
9623 !! html
9624 <p>/skins
9625 </p>
9626 !! end
9627
9628 !! test
9629 Magic Word: {{SERVER}}
9630 !! wikitext
9631 {{SERVER}}
9632 !! html
9633 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9634 </p>
9635 !! end
9636
9637 !! test
9638 Magic Word: {{SERVERNAME}}
9639 !! wikitext
9640 {{SERVERNAME}}
9641 !! html
9642 <p>example.org
9643 </p>
9644 !! end
9645
9646 !! test
9647 Magic Word: {{SITENAME}}
9648 !! wikitext
9649 {{SITENAME}}
9650 !! html
9651 <p>MediaWiki
9652 </p>
9653 !! end
9654
9655 !! test
9656 Case-sensitive magic words, when cased differently, should just be template transclusions
9657 !! wikitext
9658 {{CurrentMonth}}
9659 {{currentday}}
9660 {{cURreNTweEK}}
9661 {{currentHour}}
9662 !! html
9663 <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>
9664 <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>
9665 <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>
9666 <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>
9667 </p>
9668 !! end
9669
9670 !! test
9671 Case-insensitive magic words should still work with weird casing.
9672 !! wikitext
9673 {{sErVeRNaMe}}
9674 {{LCFirst:AOEU}}
9675 {{ucFIRST:aoeu}}
9676 {{SERver}}
9677 !! html
9678 <p>example.org
9679 aOEU
9680 Aoeu
9681 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9682 </p>
9683 !! end
9684
9685 # From plwiki:PLOS_ONE
9686 !! test
9687 Parsoid: Page property magic word with magic word contents
9688 !! wikitext
9689 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9690 !! html/parsoid
9691 <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>"}]]}'/>
9692 !! end
9693
9694 !! test
9695 Parsoid: Template-generated DISPLAYTITLE
9696 !! wikitext
9697 {{{{echo|DISPLAYTITLE}}:Foo}}
9698 !! html/parsoid
9699 <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}}]}'/>
9700 !! end
9701
9702 !! test
9703 Namespace 1 {{ns:1}}
9704 !! wikitext
9705 {{ns:1}}
9706 !! html
9707 <p>Talk
9708 </p>
9709 !! end
9710
9711 !! test
9712 Namespace 1 {{ns:01}}
9713 !! wikitext
9714 {{ns:01}}
9715 !! html
9716 <p>Talk
9717 </p>
9718 !! end
9719
9720 !! test
9721 Namespace 0 {{ns:0}} (bug 4783)
9722 !! wikitext
9723 {{ns:0}}
9724 !! html
9725
9726 !! end
9727
9728 !! test
9729 Namespace 0 {{ns:00}} (bug 4783)
9730 !! wikitext
9731 {{ns:00}}
9732 !! html
9733
9734 !! end
9735
9736 !! test
9737 Namespace -1 {{ns:-1}}
9738 !! wikitext
9739 {{ns:-1}}
9740 !! html
9741 <p>Special
9742 </p>
9743 !! end
9744
9745 !! test
9746 Namespace User {{ns:User}}
9747 !! wikitext
9748 {{ns:User}}
9749 !! html
9750 <p>User
9751 </p>
9752 !! end
9753
9754 !! test
9755 Namespace User talk {{ns:User_talk}}
9756 !! wikitext
9757 {{ns:User_talk}}
9758 !! html
9759 <p>User talk
9760 </p>
9761 !! end
9762
9763 !! test
9764 Namespace User talk {{ns:uSeR tAlK}}
9765 !! wikitext
9766 {{ns:uSeR tAlK}}
9767 !! html
9768 <p>User talk
9769 </p>
9770 !! end
9771
9772 !! test
9773 Namespace File {{ns:File}}
9774 !! wikitext
9775 {{ns:File}}
9776 !! html
9777 <p>File
9778 </p>
9779 !! end
9780
9781 !! test
9782 Namespace File {{ns:Image}}
9783 !! wikitext
9784 {{ns:Image}}
9785 !! html
9786 <p>File
9787 </p>
9788 !! end
9789
9790 !! test
9791 Namespace (lang=de) Benutzer {{ns:User}}
9792 !! options
9793 language=de
9794 !! wikitext
9795 {{ns:User}}
9796 !! html
9797 <p>Benutzer
9798 </p>
9799 !! end
9800
9801 !! test
9802 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9803 !! options
9804 language=de
9805 !! wikitext
9806 {{ns:3}}
9807 !! html
9808 <p>Benutzer Diskussion
9809 </p>
9810 !! end
9811
9812
9813 !! test
9814 Urlencode
9815 !! wikitext
9816 {{urlencode:hi world?!}}
9817 {{urlencode:hi world?!|WIKI}}
9818 {{urlencode:hi world?!|PATH}}
9819 {{urlencode:hi world?!|QUERY}}
9820 !! html
9821 <p>hi+world%3F%21
9822 hi_world%3F!
9823 hi%20world%3F%21
9824 hi+world%3F%21
9825 </p>
9826 !! end
9827
9828 !! test
9829 Magic Word: prioritize type info over data-parsoid
9830 !! options
9831 parsoid=html2wt
9832 !! html/parsoid
9833 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9834 !! wikitext
9835 __FORCETOC__
9836 !! end
9837
9838 !! test
9839 Magic Word: serialize on separate line (parsoid)
9840 !! options
9841 parsoid=wt2wt,html2wt
9842 !! wikitext
9843 foo
9844 __NOTOC__
9845 bar
9846 !! html/parsoid
9847 foo<meta property="mw:PageProp/notoc"/>bar
9848 !! end
9849
9850 !! test
9851 Magic Word: rt non-english wikis
9852 !! options
9853 parsoid=wt2wt
9854 language=de
9855 !! wikitext
9856 __NOEDITSECTION__
9857 !! html/parsoid
9858 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9859 !! end
9860
9861 !!test
9862 __proto__ is treated as normal wikitext (T105997)
9863 !!wikitext
9864 __proto__
9865 !!html
9866 <p>__proto__
9867 </p>
9868 !!end
9869
9870 ###
9871 ### Magic links
9872 ###
9873 !! test
9874 Magic links: internal link to RFC (bug 479)
9875 !! wikitext
9876 [[RFC 123]]
9877 !! html
9878 <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>
9879 </p>
9880 !! end
9881
9882 !! test
9883 Magic links: RFC (bug 479)
9884 !! wikitext
9885 RFC 822
9886 !! html
9887 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9888 </p>
9889 !! end
9890
9891 !! test
9892 Magic links: RFC (bug 65278)
9893 !! wikitext
9894 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9895 !! html
9896 <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.
9897 </p>
9898 !! end
9899
9900 !! test
9901 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9902 !! wikitext
9903 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9904 RFC
9905 822
9906 !! html
9907 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9908 RFC
9909 822
9910 </p>
9911 !! end
9912
9913 !! test
9914 Magic links: ISBN (bug 1937)
9915 !! wikitext
9916 ISBN 0-306-40615-2
9917 !! html
9918 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9919 </p>
9920 !! end
9921
9922 !! test
9923 Magic links: ISBN (bug 65278)
9924 !! wikitext
9925 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9926 !! html/php
9927 <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.
9928 </p>
9929 !! html/parsoid
9930 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9931 !! end
9932
9933 !! test
9934 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9935 !! wikitext
9936 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9937 ISBN
9938 9780316098113
9939 ISBN 978
9940 0316098113
9941 !! html
9942 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9943 ISBN
9944 9780316098113
9945 ISBN 978
9946 0316098113
9947 </p>
9948 !! end
9949
9950 !! test
9951 Magic links: PMID incorrectly converts space to underscore
9952 !! wikitext
9953 PMID 1234
9954 !! html
9955 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9956 </p>
9957 !! end
9958
9959 !! test
9960 Magic links: PMID (bug 65278)
9961 !! wikitext
9962 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9963 !! html
9964 <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.
9965 </p>
9966 !! end
9967
9968 !! test
9969 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9970 !! wikitext
9971 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9972 PMID
9973 1234
9974 !! html
9975 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9976 PMID
9977 1234
9978 </p>
9979 !! end
9980
9981 ###
9982 ### Templates
9983 ####
9984
9985 !! test
9986 Nonexistent template
9987 !! wikitext
9988 {{thistemplatedoesnotexist}}
9989 !! html
9990 <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>
9991 </p>
9992 !! end
9993
9994 !! test
9995 Template with invalid target containing tags
9996 !! wikitext
9997 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9998 !! html
9999 <p>{{a<b>b</b>|foo|a=b|a = b}}
10000 </p>
10001 !! end
10002
10003 !! test
10004 Template with invalid target containing unclosed tag
10005 !! wikitext
10006 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10007 !! html
10008 <p>{{a<b>|foo|a=b|a = b}}</b>
10009 </p>
10010 !! end
10011
10012 !! test
10013 Template with invalid target containing wikilink
10014 !! wikitext
10015 {{[[Main Page]]}}
10016 !! html/php
10017 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10018 </p>
10019 !! html/parsoid
10020 <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>
10021 !! end
10022
10023 !! test
10024 Template with just whitespace in it, bug #68421
10025 !! wikitext
10026 {{echo|{{ }}}}
10027 !! html/parsoid
10028 <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>
10029 !! end
10030
10031 !! article
10032 Template:test
10033 !! text
10034 This is a test template
10035 !! endarticle
10036
10037 !! test
10038 Simple template
10039 !! wikitext
10040 {{test}}
10041 !! html
10042 <p>This is a test template
10043 </p>
10044 !! end
10045
10046 !! test
10047 Template with explicit namespace
10048 !! wikitext
10049 {{Template:test}}
10050 !! html
10051 <p>This is a test template
10052 </p>
10053 !! end
10054
10055
10056 !! article
10057 Template:paramtest
10058 !! text
10059 This is a test template with parameter {{{param}}}
10060 !! endarticle
10061
10062 !! test
10063 Template parameter
10064 !! wikitext
10065 {{paramtest|param=foo}}
10066 !! html
10067 <p>This is a test template with parameter foo
10068 </p>
10069 !! end
10070
10071 !! article
10072 Template:paramtestnum
10073 !! text
10074 [[{{{1}}}|{{{2}}}]]
10075 !! endarticle
10076
10077 !! test
10078 Template unnamed parameter
10079 !! wikitext
10080 {{paramtestnum|Main Page|the main page}}
10081 !! html
10082 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10083 </p>
10084 !! end
10085
10086 !! article
10087 Template:templatesimple
10088 !! text
10089 (test)
10090 !! endarticle
10091
10092 !! article
10093 Template:templateredirect
10094 !! text
10095 #redirect [[Template:templatesimple]]
10096 !! endarticle
10097
10098 !! article
10099 Template:templateasargtestnum
10100 !! text
10101 {{{{{1}}}}}
10102 !! endarticle
10103
10104 !! article
10105 Template:templateasargtest
10106 !! text
10107 {{template{{{templ}}}}}
10108 !! endarticle
10109
10110 !! article
10111 Template:templateasargtest2
10112 !! text
10113 {{{{{templ}}}}}
10114 !! endarticle
10115
10116 !! test
10117 Template with template name as unnamed argument
10118 !! wikitext
10119 {{templateasargtestnum|templatesimple}}
10120 !! html
10121 <p>(test)
10122 </p>
10123 !! end
10124
10125 !! test
10126 Template with template name as argument
10127 !! wikitext
10128 {{templateasargtest|templ=simple}}
10129 !! html
10130 <p>(test)
10131 </p>
10132 !! end
10133
10134 !! test
10135 Template with template name as argument (2)
10136 !! wikitext
10137 {{templateasargtest2|templ=templatesimple}}
10138 !! html
10139 <p>(test)
10140 </p>
10141 !! end
10142
10143 !! article
10144 Template:templateasargtestdefault
10145 !! text
10146 {{{{{templ|templatesimple}}}}}
10147 !! endarticle
10148
10149 !! article
10150 Template:templa
10151 !! text
10152 '''templ'''
10153 !! endarticle
10154
10155 !! test
10156 Template with default value
10157 !! wikitext
10158 {{templateasargtestdefault}}
10159 !! html
10160 <p>(test)
10161 </p>
10162 !! end
10163
10164 !! test
10165 Template with default value (value set)
10166 !! wikitext
10167 {{templateasargtestdefault|templ=templa}}
10168 !! html
10169 <p><b>templ</b>
10170 </p>
10171 !! end
10172
10173 !! test
10174 Template redirect
10175 !! wikitext
10176 {{templateredirect}}
10177 !! html/php
10178 <p>(test)
10179 </p>
10180 !! html/parsoid
10181 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10182 !! end
10183
10184 !! test
10185 Template with argument in separate line
10186 !! wikitext
10187 {{ templateasargtest |
10188 templ = simple }}
10189 !! html
10190 <p>(test)
10191 </p>
10192 !! end
10193
10194 !! test
10195 Template with complex template as argument
10196 !! wikitext
10197 {{paramtest|
10198 param ={{ templateasargtest |
10199 templ = simple }}}}
10200 !! html
10201 <p>This is a test template with parameter (test)
10202 </p>
10203 !! end
10204
10205 !! test
10206 Template with thumb image (with link in description)
10207 !! wikitext
10208 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10209 !! html/php
10210 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>
10211
10212 !! html+tidy
10213 <p>This is a test template with parameter</p>
10214 <div class="thumb tright">
10215 <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>
10216 <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>
10217 </div>
10218 </div>
10219 !! html/parsoid
10220 <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>
10221 !! end
10222
10223 !! article
10224 Template:complextemplate
10225 !! text
10226 {{{1}}} {{paramtest|
10227 param ={{{param}}}}}
10228 !! endarticle
10229
10230 !! test
10231 Template with complex arguments
10232 !! wikitext
10233 {{complextemplate|
10234 param ={{ templateasargtest |
10235 templ = simple }}|[[Template:complextemplate|link]]}}
10236 !! html
10237 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10238 </p>
10239 !! end
10240
10241 !! test
10242 BUG 553: link with two variables in a piped link
10243 !! wikitext
10244 {|
10245 |[[{{{1}}}|{{{2}}}]]
10246 |}
10247 !! html
10248 <table>
10249 <tr>
10250 <td>[[{{{1}}}|{{{2}}}]]
10251 </td></tr></table>
10252
10253 !! end
10254
10255 !! test
10256 Magic variable as template parameter
10257 !! wikitext
10258 {{paramtest|param={{SITENAME}}}}
10259 !! html
10260 <p>This is a test template with parameter MediaWiki
10261 </p>
10262 !! end
10263
10264 !! article
10265 Template:linktest
10266 !! text
10267 [[{{{param}}}|link]]
10268 !! endarticle
10269
10270 !! test
10271 Template parameter as link source
10272 !! wikitext
10273 {{linktest|param=Main Page}}
10274 !! html
10275 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10276 </p>
10277 !! end
10278
10279 !!article
10280 Template:paramtest2
10281 !! text
10282 including another template, {{paramtest|param={{{arg}}}}}
10283 !! endarticle
10284
10285 !! test
10286 Template passing argument to another template
10287 !! wikitext
10288 {{paramtest2|arg='hmm'}}
10289 !! html
10290 <p>including another template, This is a test template with parameter 'hmm'
10291 </p>
10292 !! end
10293
10294 !! article
10295 Template:Linktest2
10296 !! text
10297 Main Page
10298 !! endarticle
10299
10300 !! test
10301 Template as link source
10302 !! wikitext
10303 [[{{linktest2}}]]
10304
10305 [[{{linktest2}}|Main Page]]
10306
10307 [[{{linktest2}}]]Page
10308 !! html
10309 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10310 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10311 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10312 </p>
10313 !! end
10314
10315
10316 !! article
10317 Template:loop1
10318 !! text
10319 {{loop2}}
10320 !! endarticle
10321
10322 !! article
10323 Template:loop2
10324 !! text
10325 {{loop1}}
10326 !! endarticle
10327
10328 !! test
10329 Template infinite loop
10330 !! wikitext
10331 {{loop1}}
10332 !! html
10333 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10334 </p>
10335 !! end
10336
10337 !! test
10338 Template from main namespace
10339 !! wikitext
10340 {{:Main Page}}
10341 !! html
10342 <p>blah blah
10343 </p>
10344 !! end
10345
10346 !! article
10347 Template:table
10348 !! text
10349 {|
10350 | 1 || 2
10351 |-
10352 | 3 || 4
10353 |}
10354 !! endarticle
10355
10356 !! test
10357 BUG 529: Template with table, not included at beginning of line
10358 !! wikitext
10359 foo {{table}}
10360 !! html
10361 <p>foo
10362 </p>
10363 <table>
10364 <tr>
10365 <td> 1 </td>
10366 <td> 2
10367 </td></tr>
10368 <tr>
10369 <td> 3 </td>
10370 <td> 4
10371 </td></tr></table>
10372
10373 !! end
10374
10375 !! test
10376 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10377 !! wikitext
10378 foo
10379 {{table}}
10380 !! html
10381 <p>foo
10382 </p>
10383 <table>
10384 <tr>
10385 <td> 1 </td>
10386 <td> 2
10387 </td></tr>
10388 <tr>
10389 <td> 3 </td>
10390 <td> 4
10391 </td></tr></table>
10392
10393 !! end
10394
10395 !! test
10396 BUG 41: Template parameters shown as broken links
10397 !! wikitext
10398 {{{parameter}}}
10399 !! html
10400 <p>{{{parameter}}}
10401 </p>
10402 !! end
10403
10404 !! test
10405 Template with targets containing wikilinks
10406 !! wikitext
10407 {{[[foo]]}}
10408
10409 {{[[{{echo|foo}}]]}}
10410
10411 {{{{echo|[[foo}}]]}}
10412 !! html
10413 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10414 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10415 </p><p>{{[[foo}}]]
10416 </p>
10417 !! end
10418
10419 !! article
10420 Template:''
10421 !! text
10422 bar
10423 !! endarticle
10424
10425 !! test
10426 Templates: Double quotes as template target
10427 !! wikitext
10428 foo {{''}} baz
10429 !! html/php
10430 <p>foo bar baz
10431 </p>
10432 !! html/parsoid
10433 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10434 </p>
10435 !! end
10436
10437 !! article
10438 Template:MSGNW test
10439 !! text
10440 ''None'' of '''this''' should be
10441 * interpreted
10442 but rather passed unmodified
10443 {{test}}
10444 <gallery>
10445 File:Foobar.jpg
10446 </gallery>
10447 <!-- comment -->
10448 !! endarticle
10449
10450 # hmm, fix this or just deprecate msgnw and document its behavior?
10451 !! test
10452 msgnw keyword
10453 !! wikitext
10454 {{msgnw:MSGNW test}}
10455 !! html/php
10456 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10457 &#42; interpreted
10458 &#32;but rather passed unmodified
10459 &#123;&#123;test&#125;&#125;
10460 &#60;gallery&#62;
10461 File:Foobar.jpg
10462 &#60;/gallery&#62;
10463 &#60;!-- comment --&#62;
10464 </p>
10465 !! end
10466
10467 !! test
10468 int keyword
10469 !! wikitext
10470 {{int:youhavenewmessages|lots of money|not!}}
10471 !! html
10472 <p>You have lots of money (not!).
10473 </p>
10474 !! end
10475
10476 !! test
10477 int keyword - non-existing message
10478 !! wikitext
10479 {{int:var}}
10480 !! html
10481 <p>&lt;var&gt;
10482 </p>
10483 !! end
10484
10485 !! article
10486 Template:Includes
10487 !! text
10488 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10489 !! endarticle
10490
10491 !! test
10492 <includeonly> and <noinclude> being included
10493 !! wikitext
10494 {{Includes}}
10495 !! html
10496 <p>Foobar
10497 </p>
10498 !! end
10499
10500 !! article
10501 Template:Includes2
10502 !! text
10503 <onlyinclude>Foo</onlyinclude>bar
10504 !! endarticle
10505
10506 !! test
10507 <onlyinclude> being included
10508 !! wikitext
10509 {{Includes2}}
10510 !! html
10511 <p>Foo
10512 </p>
10513 !! end
10514
10515
10516 !! article
10517 Template:Includes3
10518 !! text
10519 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10520 !! endarticle
10521
10522 !! test
10523 <onlyinclude> and <includeonly> being included
10524 !! wikitext
10525 {{Includes3}}
10526 !! html
10527 <p>Foo
10528 </p>
10529 !! end
10530
10531 !! test
10532 <includeonly> and <noinclude> on a page
10533 !! wikitext
10534 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10535 !! html
10536 <p>Foozar
10537 </p>
10538 !! end
10539
10540 !! test
10541 Un-closed <noinclude>
10542 !! wikitext
10543 <noinclude>
10544 !! html
10545 !! end
10546
10547 !! test
10548 <onlyinclude> on a page
10549 !! wikitext
10550 <onlyinclude>Foo</onlyinclude>bar
10551 !! html
10552 <p>Foobar
10553 </p>
10554 !! end
10555
10556 !! test
10557 Un-closed <onlyinclude>
10558 !! wikitext
10559 <onlyinclude>
10560 !! html
10561 !! end
10562
10563 !!test
10564 Self-closed noinclude, includeonly, onlyinclude tags
10565 !! wikitext
10566 <noinclude />
10567 <includeonly />
10568 <onlyinclude />
10569 !! html
10570 <p><br />
10571 </p>
10572 !!end
10573
10574 !!test
10575 Unbalanced includeonly and noinclude tags
10576 !! wikitext
10577 {|
10578 |a</noinclude>
10579 |b</noinclude></noinclude>
10580 |c</noinclude></includeonly>
10581 |d</includeonly></includeonly>
10582 |}
10583 !! html
10584 <table>
10585 <tr>
10586 <td>a
10587 </td>
10588 <td>b
10589 </td>
10590 <td>c&lt;/includeonly&gt;
10591 </td>
10592 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10593 </td></tr></table>
10594
10595 !!end
10596
10597 !! article
10598 Template:Includeonly section
10599 !! text
10600 <includeonly>
10601 ==Includeonly section==
10602 </includeonly>
10603 ==Section T-1==
10604 !!endarticle
10605
10606 !! test
10607 Bug 6563: Edit link generation for section shown by <includeonly>
10608 !! wikitext
10609 {{includeonly section}}
10610 !! html
10611 <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>
10612 <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>
10613
10614 !! end
10615
10616 # Uses same input as the contents of [[Template:Includeonly section]]
10617 !! test
10618 Bug 6563: Section extraction for section shown by <includeonly>
10619 !! options
10620 section=T-2
10621 !! wikitext
10622 <includeonly>
10623 ==Includeonly section==
10624 </includeonly>
10625 ==Section T-2==
10626 !! html
10627 ==Section T-2==
10628 !! end
10629
10630 !! test
10631 Bug 6563: Edit link generation for section suppressed by <includeonly>
10632 !! wikitext
10633 <includeonly>
10634 ==Includeonly section==
10635 </includeonly>
10636 ==Section 1==
10637 !! html
10638 <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>
10639
10640 !! end
10641
10642 !! test
10643 Bug 6563: Section extraction for section suppressed by <includeonly>
10644 !! options
10645 section=1
10646 !! wikitext
10647 <includeonly>
10648 ==Includeonly section==
10649 </includeonly>
10650 ==Section 1==
10651 !! html
10652 ==Section 1==
10653 !! end
10654
10655 !! test
10656 Un-closed <includeonly>
10657 !! wikitext
10658 <includeonly>
10659 !! html
10660 !! end
10661
10662 !! test
10663 Includes and comments at SOL
10664 !! wikitext
10665 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10666
10667 <noinclude>
10668 some
10669 </noinclude>* stuff
10670 * here
10671
10672 <includeonly>can have stuff</includeonly>=== here ===
10673
10674 !! html/php
10675 <h2><span class="mw-headline" id="hu">hu</span></h2>
10676 <p>some
10677 </p>
10678 <ul><li> stuff</li>
10679 <li> here</li></ul>
10680 <h3><span class="mw-headline" id="here">here</span></h3>
10681
10682 !! html/parsoid
10683 <!-- 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>
10684
10685 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10686 <p>some</p>
10687 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10688 <li> here</li></ul>
10689
10690 <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>
10691
10692 !! end
10693
10694 # TODO: test with DOM fragment reuse!
10695 !! test
10696 Parsoid: DOM fragment reuse
10697 !! options
10698 parsoid=wt2wt,wt2html
10699 !! wikitext
10700 a{{echo|b<table></table>c}}d
10701
10702 a{{echo|b
10703 <table></table>
10704 c}}d
10705
10706 {{echo|a
10707
10708 <table></table>
10709
10710 b}}
10711 !! html
10712 <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>
10713
10714 <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">
10715 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10716 </span><p about="#mwt2">cd</p>
10717
10718 <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">
10719
10720 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10721
10722 </span><p about="#mwt3">b</p>
10723 !! end
10724
10725 !! test
10726 Parsoid: Merge double tds (T52603)
10727 !! options
10728 parsoid
10729 !! wikitext
10730 {|
10731 |{{echo|{{!}} foo}}
10732 |}
10733 !! html
10734 <table><tbody>
10735 <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>
10736 </tbody></table>
10737 !! end
10738
10739 !! test
10740 Parsoid: Merge double tds in nested transclusion content (T52603)
10741 !! options
10742 parsoid
10743 !! wikitext
10744 {{echo|<div>}}
10745 {|
10746 |{{echo|{{!}} foo}}
10747 |}
10748 {{echo|</div>}}
10749 !! html
10750 <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}}]}'>
10751 <table><tbody>
10752 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10753 </tbody></table>
10754 </div>
10755 !! end
10756
10757 ###
10758 ### <includeonly> and <noinclude> in attributes
10759 ###
10760 !!test
10761 0. includeonly around the entire attribute
10762 !! wikitext
10763 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10764 !! html
10765 <p><span id="v2">bar</span>
10766 </p>
10767 !!end
10768
10769 !!test
10770 1. includeonly in html attr key
10771 !! wikitext
10772 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10773 !! html
10774 <p><span id="foo">bar</span>
10775 </p>
10776 !!end
10777
10778 !!test
10779 2. includeonly in html attr value
10780 !! wikitext
10781 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10782 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10783 !! html
10784 <p><span id="v1">bar</span>
10785 <span id="v1">bar</span>
10786 </p>
10787 !!end
10788
10789 !!test
10790 3. includeonly in part of an attr value
10791 !! wikitext
10792 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10793 !! html
10794 <p><span style="color:red;">bar</span>
10795 </p>
10796 !!end
10797
10798 !!test
10799 4. includeonly in table attributes
10800 !! wikitext
10801 {|
10802 |- <noinclude>
10803 |-
10804 |a
10805 </noinclude>
10806 |- <includeonly>
10807 |-
10808 |b
10809 </includeonly>
10810 |}
10811 !! html
10812 <table>
10813
10814
10815 <tr>
10816 <td>a
10817 </td></tr>
10818 </table>
10819
10820 !!end
10821
10822 ###
10823 ### Token Stream Patcher tests
10824 ###
10825 ### These tests won't always pass wt2wt and other modes because
10826 ### on serialization, the table will be output on a new line.
10827 ### For now, we are blacklisting them, and using this to test selser.
10828 ###
10829
10830 !!test
10831 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10832 !!options
10833 parsoid=wt2html,wt2wt
10834 !!wikitext
10835 {{echo|}}{| width = '100%'
10836 |foo
10837 |}
10838 !!html/parsoid
10839 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10840 <tbody><tr><td>foo</td></tr>
10841 </tbody></table>
10842 !!end
10843
10844 !!test
10845 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10846 !!options
10847 parsoid=wt2html,wt2wt
10848 !!wikitext
10849 <includeonly>a</includeonly>{| {{{b}}}
10850 |c
10851 |}
10852 !!html/parsoid
10853 <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}}}":""}}'>
10854 <tbody><tr><td>c</td></tr>
10855 </tbody></table>
10856
10857 !!end
10858
10859 ###
10860 ### Testing parsing of templates where a template arg
10861 ### has the same name as the template itself.
10862 ###
10863
10864 !! article
10865 Template:quote
10866 !! text
10867 {{{quote|{{{1}}}}}}
10868 !! endarticle
10869
10870 !!test
10871 Templates: Template Name/Arg clash: 1. Use of positional param
10872 !! wikitext
10873 {{quote|foo}}
10874 !! html
10875 <p>foo
10876 </p>
10877 !!end
10878
10879 !!test
10880 Templates: Template Name/Arg clash: 2. Use of named param
10881 !! wikitext
10882 {{quote|quote=foo}}
10883 !! html
10884 <p>foo
10885 </p>
10886 !!end
10887
10888 !!test
10889 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10890 !! wikitext
10891 {{quote|quote}}
10892 !! html
10893 <p>quote
10894 </p>
10895 !!end
10896
10897 ###
10898 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10899 ###
10900
10901 !!test
10902 Templates: 1. Simple use
10903 !! wikitext
10904 {{echo|Foo}}
10905 !! html
10906 <p>Foo
10907 </p>
10908 !!end
10909
10910 !!test
10911 Templates: 2. Inside a block tag
10912 !! wikitext
10913 <div>{{echo|Foo}}</div>
10914 <blockquote>{{echo|Foo}}</blockquote>
10915 !! html
10916 <div>Foo</div>
10917 <blockquote>Foo</blockquote>
10918
10919 !! html+tidy
10920 <div>Foo</div>
10921 <blockquote>
10922 <p>Foo</p>
10923 </blockquote>
10924 !!end
10925
10926 !!test
10927 Templates: P-wrapping: 1a. Templates on consecutive lines
10928 !! wikitext
10929 {{echo|Foo}}
10930 {{echo|bar}}
10931 !! html
10932 <p>Foo
10933 bar
10934 </p>
10935 !!end
10936
10937 !!test
10938 Templates: P-wrapping: 1b. Templates on consecutive lines
10939 !! wikitext
10940 Foo
10941
10942 {{echo|bar}}
10943 {{echo|baz}}
10944 !! html
10945 <p>Foo
10946 </p><p>bar
10947 baz
10948 </p>
10949 !!end
10950
10951 !!test
10952 Templates: P-wrapping: 1c. Templates on consecutive lines
10953 !! wikitext
10954 {{echo|Foo}}
10955 {{echo|bar}} <div>baz</div>
10956 !! html
10957 <p>Foo
10958 </p>
10959 bar <div>baz</div>
10960
10961 !! html+tidy
10962 <p>Foo</p>
10963 <p>bar</p>
10964 <div>baz</div>
10965 !! end
10966
10967 !!test
10968 Templates: P-wrapping: 1d. Template preceded by comment-only line
10969 !!options
10970 parsoid
10971 !! wikitext
10972 <!-- foo -->
10973 {{echo|Bar}}
10974 !! html
10975 <!-- foo -->
10976
10977 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10978 !!end
10979
10980 !!test
10981 Templates: Inline Text: 1. Multiple template uses
10982 !! wikitext
10983 {{echo|Foo}}bar{{echo|baz}}
10984 !! html
10985 <p>Foobarbaz
10986 </p>
10987 !!end
10988
10989 !!test
10990 Templates: Inline Text: 2. Back-to-back template uses
10991 !! wikitext
10992 {{echo|Foo}}{{echo|bar}}
10993 !! html
10994 <p>Foobar
10995 </p>
10996 !!end
10997
10998 !!test
10999 Templates: Block Tags: 1. Multiple template uses
11000 !! wikitext
11001 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11002 !! html
11003 <div>Foo</div><div>bar</div><div>baz</div>
11004
11005 !!end
11006
11007 !!test
11008 Templates: Block Tags: 2. Back-to-back template uses
11009 !! wikitext
11010 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11011 !! html
11012 <div>Foo</div><div>bar</div>
11013
11014 !!end
11015
11016 # This is an edge case relating to paragraph wrapping.
11017 !!test
11018 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11019 !! wikitext
11020 {{echo|a
11021 b</p>}}
11022 !! html/parsoid
11023 <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
11024 b</p>
11025 !!end
11026
11027 !!test
11028 Templates: Links: 1. Simple example
11029 !! wikitext
11030 {{echo|[[Foo|bar]]}}
11031 !! html
11032 <p><a href="/wiki/Foo" title="Foo">bar</a>
11033 </p>
11034 !!end
11035
11036 !!test
11037 Templates: Links: 2. Generation of link href
11038 !! wikitext
11039 [[{{echo|Foo}}|bar]]
11040 !! html
11041 <p><a href="/wiki/Foo" title="Foo">bar</a>
11042 </p>
11043 !!end
11044
11045 !!test
11046 Templates: Links: 3. Generation of part of a link href
11047 !! wikitext
11048 [[Fo{{echo|o}}|bar]]
11049
11050 [[Foo{{echo|bar}}]]
11051
11052 [[Foo{{echo|bar}}baz]]
11053
11054 [[Foo{{echo|bar}}|bar]]
11055
11056 [[:Foo{{echo|bar}}]]
11057
11058 [[:Foo{{echo|bar}}|bar]]
11059 !! html
11060 <p><a href="/wiki/Foo" title="Foo">bar</a>
11061 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11062 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11063 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11064 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11065 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11066 </p>
11067 !!end
11068
11069 !!test
11070 Templates: Links: 4. Multiple templates generating link href
11071 !! wikitext
11072 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11073 !! html
11074 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11075 </p>
11076 !!end
11077
11078 !!test
11079 Templates: Links: 5. Generation of link text
11080 !! wikitext
11081 [[Foo|{{echo|bar}}]]
11082 !! html
11083 <p><a href="/wiki/Foo" title="Foo">bar</a>
11084 </p>
11085 !!end
11086
11087 !!test
11088 Templates: Links: 5. Nested templates (only outermost template should be marked)
11089 !! wikitext
11090 {{echo|[[{{echo|Foo}}|bar]]}}
11091 !! html
11092 <p><a href="/wiki/Foo" title="Foo">bar</a>
11093 </p>
11094 !!end
11095
11096 !!test
11097 Templates: HTML Tag: 1. Generation of HTML attr. key
11098 !! wikitext
11099 <div {{echo|style}}="color:red;">foo</div>
11100 !! html
11101 <div style="color:red;">foo</div>
11102
11103 !!end
11104
11105 !!test
11106 Templates: HTML Tag: 2. Generation of HTML attr. value
11107 !! wikitext
11108 <div style={{echo|'color:red;'}}>foo</div>
11109 !! html
11110 <div style="color:red;">foo</div>
11111
11112 !!end
11113
11114 !!test
11115 Templates: HTML Tag: 3. Generation of HTML attr key and value
11116 !! wikitext
11117 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11118 !! html
11119 <div style="color:red;">foo</div>
11120
11121 !!end
11122
11123 !!test
11124 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11125 !! wikitext
11126 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11127 !! html
11128 <div title="This is a long title with just one piece templated">foo</div>
11129
11130 !!end
11131
11132 !!test
11133 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11134 !! wikitext
11135 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11136 !! html
11137 <div title="This is a long title with just one piece templated">foo</div>
11138
11139 !!end
11140
11141 !!test
11142 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11143 !! wikitext
11144 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11145 !! html
11146 <div title="This is a long title with just one piece templated">foo</div>
11147
11148 !!end
11149
11150 # SSS FIXME: While it is great we added support for all this,
11151 # do we want to make this part of the spec? Maybe we want to
11152 # deprecate this kind of usage in the future?
11153 !!test
11154 Templates: HTML Tag: 7. Generation of partial attribute key string
11155 !! wikitext
11156 <div st{{echo|yle}}="color:red;">foo</div>
11157 !! html
11158 <div style="color:red;">foo</div>
11159
11160 !!end
11161
11162 !! test
11163 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11164 !! wikitext
11165 <div {{echo|1=id="v1"}}>bar</div>
11166 !! html
11167 <div id="v1">bar</div>
11168
11169 !!end
11170
11171 !! test
11172 Templates: HTML Tag: 9. Multiple template-generated attributes
11173 !! wikitext
11174 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11175 !! html
11176 <div id="v1" title="foo">bar</div>
11177
11178 !!end
11179
11180 !! test
11181 Templates: Support for templates generating attributes and content
11182 !! wikitext
11183 {| {{mixed_attr_content_template}}
11184 |-
11185 |bar
11186 |}
11187 !! html/php
11188 <table style="color:red;" title="T48811">
11189
11190 <tr>
11191 <td>foo
11192 </td></tr>
11193 <tr>
11194 <td>bar
11195 </td></tr></table>
11196
11197 !! html/parsoid
11198 <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|}"]}'>
11199 <tbody><tr>
11200 <td>foo</td></tr>
11201 <tr>
11202 <td>bar</td></tr>
11203 </tbody></table>
11204 !!end
11205
11206 !! test
11207 1. Entities and nowikis inside templated attributes should be handled correctly
11208 !! wikitext
11209 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11210 !! html/php
11211 <div style="background:#f9f9f9;">foo</div>
11212
11213 !! html/parsoid
11214 <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>
11215 !! end
11216
11217 !! test
11218 2. Entities and nowikis inside templated attributes should be handled correctly
11219 !! wikitext
11220 {|
11221 |{{table_attribs_3}}
11222 |}
11223 !! html/php
11224 <table>
11225 <tr>
11226 <td style="background:#f9f9f9;">Foo
11227 </td></tr></table>
11228
11229 !! html/parsoid
11230 <table>
11231 <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>
11232 </tbody></table>
11233 !! end
11234
11235 !! test
11236 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11237 !! wikitext
11238 {{tbl-start}}
11239 |{{table_attribs_3}}
11240 {{tbl-end}}
11241 !! html/php
11242 <table>
11243 <tr>
11244 <td style="background:#f9f9f9;">Foo
11245 </td></tr></table>
11246
11247 !! html/parsoid
11248 <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}}]}'>
11249 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11250 </tbody></table>
11251 !! end
11252
11253 # T107622
11254 !! test
11255 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11256 !! wikitext
11257 {|
11258 | {{table_attribs_6}} hi
11259 |}
11260 !! html/php
11261 <table>
11262 <tr>
11263 <td style="background: red;"> hi
11264 </td></tr></table>
11265
11266 !! html/parsoid
11267 <table>
11268 <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>
11269 </tbody></table>
11270 !! end
11271
11272 !!test
11273 Templates: HTML Tables: 1. Generating start of a HTML table
11274 !! wikitext
11275 {{echo|<table><tr><td>foo</td>}}</tr></table>
11276 !! html
11277 <table><tr><td>foo</td></tr></table>
11278
11279 !!end
11280
11281 !!test
11282 Templates: HTML Tables: 2a. Generating middle of a HTML table
11283 !! wikitext
11284 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11285 !! html
11286 <table><tr><td>foo</td></tr></table>
11287
11288 !!end
11289
11290 !!test
11291 Templates: HTML Tables: 2b. Generating middle of a HTML table
11292 !! wikitext
11293 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11294 !! html
11295 <table><tr><td>foo</td></tr></table>
11296
11297 !!end
11298
11299 !!test
11300 Templates: HTML Tables: 3. Generating end of a HTML table
11301 !! wikitext
11302 <table><tr>{{echo|<td>foo</td></tr></table>}}
11303 !! html
11304 <table><tr><td>foo</td></tr></table>
11305
11306 !!end
11307
11308 !!test
11309 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11310 !! wikitext
11311 {{echo|<table>}}<tr><td>foo</td></tr></table>
11312 !! html
11313 <table><tr><td>foo</td></tr></table>
11314
11315 !!end
11316
11317 !!test
11318 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11319 !! wikitext
11320 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11321 !! html
11322 <table><tr><td>foo</td></tr></table>
11323
11324 !!end
11325
11326 !!test
11327 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11328 !! wikitext
11329 <table><tr>{{echo|<td>}}foo</td></tr></table>
11330 !! html
11331 <table><tr><td>foo</td></tr></table>
11332
11333 !!end
11334
11335 !!test
11336 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11337 !! wikitext
11338 <table><tr><td>foo{{echo|</td>}}</tr></table>
11339 !! html
11340 <table><tr><td>foo</td></tr></table>
11341
11342 !!end
11343
11344 !!test
11345 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11346 !! wikitext
11347 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11348 !! html
11349 <table><tr><td>foo</td></tr></table>
11350
11351 !!end
11352
11353 !!test
11354 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11355 !! wikitext
11356 <table><tr><td>foo</td></tr>{{echo|</table>}}
11357 !! html
11358 <table><tr><td>foo</td></tr></table>
11359
11360 !!end
11361
11362 !!test
11363 Templates: HTML Tables: 5. Proper fostering of categories from inside
11364 !!options
11365 parsoid=wt2html,wt2wt
11366 !! wikitext
11367 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11368 <!--Two categories (Bug 50330)-->
11369 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11370 !! html
11371 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11372 <!--Two categories (Bug 50330)-->
11373 <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>
11374 !!end
11375
11376 !!test
11377 Templates: Wiki Tables: 1a. Fostering of entire template content
11378 !! wikitext
11379 {|
11380 {{echo|a}}
11381 |}
11382 !! html
11383 <table>
11384 a
11385 <tr><td></td></tr></table>
11386
11387 !! html+tidy
11388 <p>a</p>
11389 <table>
11390 <tr>
11391 <td></td>
11392 </tr>
11393 </table>
11394 !! end
11395
11396 !!test
11397 Templates: Wiki Tables: 1b. Fostering of entire template content
11398 !! wikitext
11399 {|
11400 {{echo|<div>}}
11401 foo
11402 {{echo|</div>}}
11403 |}
11404 !! html
11405 <table>
11406 <div>
11407 <p>foo
11408 </p>
11409 </div>
11410 <tr><td></td></tr></table>
11411
11412 !! html+tidy
11413 <div>
11414 <p>foo</p>
11415 </div>
11416 <table>
11417 <tr>
11418 <td></td>
11419 </tr>
11420 </table>
11421 !! end
11422
11423 !!test
11424 Templates: Wiki Tables: 2. Fostering of partial template content
11425 !! wikitext
11426 {|
11427 {{echo|a
11428 <div>b</div>}}
11429 |}
11430 !! html
11431 <table>
11432 a
11433 <div>b</div>
11434 <tr><td></td></tr></table>
11435
11436 !! html+tidy
11437 <p>a</p>
11438 <div>b</div>
11439 <table>
11440 <tr>
11441 <td></td>
11442 </tr>
11443 </table>
11444 !! end
11445
11446 !!test
11447 Templates: Wiki Tables: 3. td-content via multiple templates
11448 !! wikitext
11449 {|
11450 {{echo|{{pipe}}a}}{{echo|b}}
11451 |}
11452 !! html
11453 <table>
11454 <tr>
11455 <td>ab
11456 </td></tr></table>
11457
11458 !!end
11459
11460 !!test
11461 Templates: Wiki Tables: 4. Templated tags, no content
11462 !! wikitext
11463 {{tbl-start}}
11464 {{tbl-end}}
11465 !! html
11466 <table>
11467 <tr><td></td></tr></table>
11468
11469 !!end
11470
11471 !!test
11472 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11473 !! wikitext
11474 {{tbl-start}}
11475 |foo
11476 {{tbl-end}}
11477 !! html
11478 <table>
11479 <tr>
11480 <td>foo
11481 </td></tr></table>
11482
11483 !!end
11484
11485 !!test
11486 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11487 !! wikitext
11488 {{tbl-start}}
11489 {{!}}foo
11490 {{tbl-end}}
11491 !! html
11492 <table>
11493 <tr>
11494 <td>foo
11495 </td></tr></table>
11496
11497 !!end
11498
11499 ## This test case is very specific to Parsoid's internals
11500 ## and is hence only tested for Parsoid's code. Parsoid uses
11501 ## a <meta> marker tag for <ref> tags and they are expanded
11502 ## much later. We are verifying that this <meta> tag usage
11503 ## doesn't prevent foster parenting.
11504 !!test
11505 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11506 !!wikitext
11507 {{PartialTable}}<ref>foo</ref>
11508 |}
11509
11510 <references />
11511 !!html/parsoid
11512 <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">
11513 <tbody>
11514 </tbody></table>
11515
11516 <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>
11517 !!end
11518
11519 !! test
11520 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11521 !! wikitext
11522 {{echo|
11523 {{{!}}
11524 {{!}}-}}
11525 <onlyinclude>
11526 |foo
11527 </onlyinclude>
11528 {{!}}}
11529 !! html/parsoid
11530 <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{{!}}}"]}'>
11531 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11532 <tbody><tr>
11533
11534 <td>foo
11535 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11536 </tbody></table>
11537 !! end
11538
11539 !!test
11540 Templates: Lists: Multi-line list-items via templates
11541 !! wikitext
11542 *{{echo|a {{nonexistent|
11543 unused}}}}
11544 *{{echo|b {{nonexistent|
11545 unused}}}}
11546 !! html
11547 <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>
11548 <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>
11549
11550 !!end
11551
11552 !!test
11553 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11554 !! wikitext
11555 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11556 !! html
11557 <p><i>ab</i>c<i>d</i>e
11558 </p>
11559 !!end
11560
11561 !!test
11562 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11563 (PHP parser generates misnested html)
11564 !! wikitext
11565 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11566 !! html/parsoid
11567 <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>
11568 !!end
11569
11570 !!test
11571 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11572 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11573 !! options
11574 parsoid=wt2html,wt2wt
11575 !! wikitext
11576 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11577 !! html
11578 <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>
11579 <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>
11580 <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>
11581 !!end
11582
11583 !!test
11584 Templates: Ugly nesting: 4. Divs opened/closed across templates
11585 !! wikitext
11586 a<div>b{{echo|c</div>d}}e
11587 !! html
11588 a<div>bc</div>de
11589
11590 !! html+tidy
11591 <p>a</p>
11592 <div>bc</div>
11593 <p>de</p>
11594 !! end
11595
11596 !!test
11597 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11598 (Parsoid-centric)
11599 !! options
11600 parsoid
11601 !! wikitext
11602 {|
11603 |{{echo|foo</table>}}
11604 |bar
11605 |}
11606 !! html
11607 <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|}"]}'>
11608
11609 <tbody>
11610 <tr>
11611 <td>foo</td></tr></tbody></table><span about="#mwt1">
11612 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11613 |}</span>
11614 !!end
11615
11616 !!test
11617 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11618 (Parsoid-centric)
11619 !! options
11620 parsoid
11621 !! wikitext
11622 <table>
11623 <tr>
11624 <td>
11625 <table>
11626 <tr>
11627 <td>1. {{echo|foo </table>}}</td>
11628 <td> bar </td>
11629 <td>2. {{echo|baz </table>}}</td>
11630 </tr>
11631 <tr>
11632 <td>abc</td>
11633 </tr>
11634 </table>
11635 </td>
11636 </tr>
11637 <tr>
11638 <td>xyz</td>
11639 </tr>
11640 </table>
11641 !! html
11642 <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>"]}'>
11643 <tbody><tr>
11644 <td>
11645 <table>
11646 <tbody><tr>
11647 <td>1. foo </td></tr></tbody></table></td>
11648 <td> bar </td>
11649 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11650 </span><span about="#mwt2">
11651 </span><span about="#mwt2">
11652 </span><span about="#mwt2">abc</span><span about="#mwt2">
11653 </span><span about="#mwt2">
11654 </span><span about="#mwt2">
11655 </span><span about="#mwt2">
11656 </span><span about="#mwt2">
11657 </span><span about="#mwt2">
11658 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11659 </span><span about="#mwt2">
11660 </span>
11661 !!end
11662
11663 !! test
11664 Templates: Ugly templates: 3. newline-only template parameter
11665 !! wikitext
11666 foo {{echo|
11667 }}
11668 !! html
11669 <p>foo
11670 </p>
11671 !! end
11672
11673 # This looks like a bug: a single newline triggers p/br for some reason.
11674 !! test
11675 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11676 !! wikitext
11677 {{echo|
11678 }}
11679 !! html
11680 <p><br />
11681 </p>
11682 !! end
11683
11684 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11685 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11686 !! test
11687 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11688 !! wikitext
11689 {{echo|<table>}}
11690 {{echo|<div>foo}}
11691 {{echo|</table>}}
11692 !! html/parsoid
11693 <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
11694 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11695 </table>
11696 !! end
11697
11698 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11699 # that are "identical" and generate nesting cycles in the algorithm
11700 !! test
11701 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11702 !! wikitext
11703 {{echo|<table><tr><td><table>}}
11704 {{echo|<div>}}
11705 {{echo|</div>}}
11706 !! html/parsoid
11707 <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"}'>
11708 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11709 </table></td></tr></tbody></table>
11710 !! end
11711
11712 !!test
11713 Parser Functions: 1. Simple example
11714 !! wikitext
11715 {{uc:foo}}
11716 !! html
11717 <p>FOO
11718 </p>
11719 !!end
11720
11721 !!test
11722 Parser Functions: 2. Nested use (only outermost should be marked up)
11723 !! wikitext
11724 {{uc:{{lc:FOO}}}}
11725 !! html
11726 <p>FOO
11727 </p>
11728 !!end
11729
11730 ###
11731 ### Pre-save transform tests
11732 ###
11733 !! test
11734 pre-save transform: subst:
11735 !! options
11736 pst
11737 !! wikitext
11738 {{subst:test}}
11739 !! html/php
11740 This is a test template
11741 !! end
11742
11743 !! test
11744 pre-save transform: normal template
11745 !! options
11746 pst
11747 !! wikitext
11748 {{test}}
11749 !! html/php
11750 {{test}}
11751 !! end
11752
11753 !! test
11754 pre-save transform: nonexistent template
11755 !! options
11756 pst
11757 !! wikitext
11758 {{thistemplatedoesnotexist}}
11759 !! html/php
11760 {{thistemplatedoesnotexist}}
11761 !! end
11762
11763 !! test
11764 pre-save transform: subst magic variables
11765 !! options
11766 pst
11767 !! wikitext
11768 {{subst:SITENAME}}
11769 !! html/php
11770 MediaWiki
11771 !! end
11772
11773 # This is bug 89, which I fixed. -- wtm
11774 !! test
11775 pre-save transform: subst: templates with parameters
11776 !! options
11777 pst
11778 !! wikitext
11779 {{subst:paramtest|param="something else"}}
11780 !! html/php
11781 This is a test template with parameter "something else"
11782 !! end
11783
11784 !! article
11785 Template:nowikitest
11786 !! text
11787 <nowiki>'''not wiki'''</nowiki>
11788 !! endarticle
11789
11790 !! test
11791 pre-save transform: nowiki in subst (bug 1188)
11792 !! options
11793 pst
11794 !! wikitext
11795 {{subst:nowikitest}}
11796 !! html/php
11797 <nowiki>'''not wiki'''</nowiki>
11798 !! end
11799
11800 !! article
11801 Template:commenttest
11802 !! text
11803 This template has <!-- a comment --> in it.
11804 !! endarticle
11805
11806 !! test
11807 pre-save transform: comment in subst (bug 1936)
11808 !! options
11809 pst
11810 !! wikitext
11811 {{subst:commenttest}}
11812 !! html/php
11813 This template has <!-- a comment --> in it.
11814 !! end
11815
11816 !! test
11817 pre-save transform: unclosed tag
11818 !! options
11819 pst noxml
11820 !! wikitext
11821 <nowiki>'''not wiki'''
11822 !! html/php
11823 <nowiki>'''not wiki'''
11824 !! end
11825
11826 !! test
11827 pre-save transform: mixed tag case
11828 !! options
11829 pst noxml
11830 !! wikitext
11831 <NOwiki>'''not wiki'''</noWIKI>
11832 !! html/php
11833 <NOwiki>'''not wiki'''</noWIKI>
11834 !! end
11835
11836 !! test
11837 pre-save transform: unclosed comment in <nowiki>
11838 !! options
11839 pst noxml
11840 !! wikitext
11841 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11842 !! html/php
11843 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11844 !!end
11845
11846 # Leading @ in this template definition works around a limitation
11847 # in parsoid's parserTests which otherwise strips the <span> from the
11848 # result (confusing it for a template wrapper)
11849 !! article
11850 Template:dangerous
11851 !!text
11852 @<span onmouseover="alert('crap')">Oh no</span>
11853 !!endarticle
11854
11855 !!test
11856 (confirming safety of fix for subst bug 1936)
11857 !! wikitext
11858 {{Template:dangerous}}
11859 !! html
11860 <p>@<span>Oh no</span>
11861 </p>
11862 !! end
11863
11864 !! test
11865 pre-save transform: comment containing gallery (bug 5024)
11866 !! options
11867 pst
11868 !! wikitext
11869 <!-- <gallery>data</gallery> -->
11870 !! html/php
11871 <!-- <gallery>data</gallery> -->
11872 !!end
11873
11874 !! test
11875 pre-save transform: comment containing extension
11876 !! options
11877 pst
11878 !! wikitext
11879 <!-- <tag>data</tag> -->
11880 !! html/php
11881 <!-- <tag>data</tag> -->
11882 !!end
11883
11884 !! test
11885 pre-save transform: comment containing nowiki
11886 !! options
11887 pst
11888 !! wikitext
11889 <!-- <nowiki>data</nowiki> -->
11890 !! html/php
11891 <!-- <nowiki>data</nowiki> -->
11892 !!end
11893
11894 !! test
11895 pre-save transform: <noinclude> in subst (bug 3298)
11896 !! options
11897 pst
11898 !! wikitext
11899 {{subst:Includes}}
11900 !! html/php
11901 Foobar
11902 !! end
11903
11904 !! test
11905 pre-save transform: <onlyinclude> in subst (bug 3298)
11906 !! options
11907 pst
11908 !! wikitext
11909 {{subst:Includes2}}
11910 !! html/php
11911 Foo
11912 !! end
11913
11914 !! article
11915 Template:SubstTest
11916 !!text
11917 {{<includeonly>subst:</includeonly>Includes}}
11918 !! endarticle
11919
11920 !! article
11921 Template:SafeSubstTest
11922 !! text
11923 {{<includeonly>safesubst:</includeonly>Includes}}
11924 !! endarticle
11925
11926 !! test
11927 bug 22297: safesubst: works during PST
11928 !! options
11929 pst
11930 !! wikitext
11931 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11932 !! html/php
11933 FoobarFoobar
11934 !! end
11935
11936 !! test
11937 bug 22297: safesubst: works during normal parse
11938 !! wikitext
11939 {{SafeSubstTest}}
11940 !! html
11941 <p>Foobar
11942 </p>
11943 !! end
11944
11945 !! test
11946 subst: does not work during normal parse
11947 !! wikitext
11948 {{SubstTest}}
11949 !! html
11950 <p>{{subst:Includes}}
11951 </p>
11952 !! end
11953
11954 !! test
11955 pre-save transform: context links ("pipe trick")
11956 !! options
11957 pst
11958 !! wikitext
11959 [[Article (context)|]]
11960 [[Bar:Article|]]
11961 [[:Bar:Article|]]
11962 [[Bar:Article (context)|]]
11963 [[:Bar:Article (context)|]]
11964 [[|Article]]
11965 [[|Article (context)]]
11966 [[Bar:X (Y) Z|]]
11967 [[:Bar:X (Y) Z|]]
11968 !! html/php
11969 [[Article (context)|Article]]
11970 [[Bar:Article|Article]]
11971 [[:Bar:Article|Article]]
11972 [[Bar:Article (context)|Article]]
11973 [[:Bar:Article (context)|Article]]
11974 [[Article]]
11975 [[Article (context)]]
11976 [[Bar:X (Y) Z|X (Y) Z]]
11977 [[:Bar:X (Y) Z|X (Y) Z]]
11978 !! end
11979
11980 !! test
11981 pre-save transform: context links ("pipe trick") with interwiki prefix
11982 !! options
11983 pst
11984 !! wikitext
11985 [[interwiki:Article|]]
11986 [[:interwiki:Article|]]
11987 [[interwiki:Bar:Article|]]
11988 [[:interwiki:Bar:Article|]]
11989 !! html/php
11990 [[interwiki:Article|Article]]
11991 [[:interwiki:Article|Article]]
11992 [[interwiki:Bar:Article|Bar:Article]]
11993 [[:interwiki:Bar:Article|Bar:Article]]
11994 !! end
11995
11996 !! test
11997 pre-save transform: context links ("pipe trick") with parens in title
11998 !! options
11999 pst title=[[Somearticle (context)]]
12000 !! wikitext
12001 [[|Article]]
12002 !! html/php
12003 [[Article (context)|Article]]
12004 !! end
12005
12006 !! test
12007 pre-save transform: context links ("pipe trick") with comma in title
12008 !! options
12009 pst title=[[Someplace, Somewhere]]
12010 !! wikitext
12011 [[|Otherplace]]
12012 [[Otherplace, Elsewhere|]]
12013 [[Otherplace, Elsewhere, Anywhere|]]
12014 !! html/php
12015 [[Otherplace, Somewhere|Otherplace]]
12016 [[Otherplace, Elsewhere|Otherplace]]
12017 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12018 !! end
12019
12020 !! test
12021 pre-save transform: context links ("pipe trick") with parens and comma
12022 !! options
12023 pst title=[[Someplace (IGNORED), Somewhere]]
12024 !! wikitext
12025 [[|Otherplace]]
12026 [[Otherplace (place), Elsewhere|]]
12027 !! html/php
12028 [[Otherplace, Somewhere|Otherplace]]
12029 [[Otherplace (place), Elsewhere|Otherplace]]
12030 !! end
12031
12032 !! test
12033 pre-save transform: context links ("pipe trick") with comma and parens
12034 !! options
12035 pst title=[[Who, me? (context)]]
12036 !! wikitext
12037 [[|Yes, you.]]
12038 [[Me, Myself, and I (1937 song)|]]
12039 !! html/php
12040 [[Yes, you. (context)|Yes, you.]]
12041 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12042 !! end
12043
12044 !! test
12045 pre-save transform: context links ("pipe trick") with namespace
12046 !! options
12047 pst title=[[Ns:Somearticle]]
12048 !! wikitext
12049 [[|Article]]
12050 !! html/php
12051 [[Ns:Article|Article]]
12052 !! end
12053
12054 !! test
12055 pre-save transform: context links ("pipe trick") with namespace and parens
12056 !! options
12057 pst title=[[Ns:Somearticle (context)]]
12058 !! wikitext
12059 [[|Article]]
12060 !! html/php
12061 [[Ns:Article (context)|Article]]
12062 !! end
12063
12064 !! test
12065 pre-save transform: context links ("pipe trick") with namespace and comma
12066 !! options
12067 pst title=[[Ns:Somearticle, Context, Whatever]]
12068 !! wikitext
12069 [[|Article]]
12070 !! html/php
12071 [[Ns:Article, Context, Whatever|Article]]
12072 !! end
12073
12074 !! test
12075 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12076 !! options
12077 pst title=[[Ns:Somearticle, Context (context)]]
12078 !! wikitext
12079 [[|Article]]
12080 !! html/php
12081 [[Ns:Article (context)|Article]]
12082 !! end
12083
12084 !! test
12085 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12086 !! options
12087 pst title=[[Ns:Somearticle (IGNORED), Context]]
12088 !! wikitext
12089 [[|Article]]
12090 !! html/php
12091 [[Ns:Article, Context|Article]]
12092 !! end
12093
12094 !! test
12095 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12096 !! options
12097 pst
12098 !! wikitext
12099 [[Article(context)|]]
12100 [[Bar:Article(context)|]]
12101 [[:Bar:Article(context)|]]
12102 [[|Article(context)]]
12103 [[Bar:X(Y)Z|]]
12104 [[:Bar:X(Y)Z|]]
12105 !! html/php
12106 [[Article(context)|Article]]
12107 [[Bar:Article(context)|Article]]
12108 [[:Bar:Article(context)|Article]]
12109 [[Article(context)]]
12110 [[Bar:X(Y)Z|X(Y)Z]]
12111 [[:Bar:X(Y)Z|X(Y)Z]]
12112 !! end
12113
12114 !! test
12115 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12116 !! options
12117 pst
12118 !! wikitext
12119 [[Article (context)|]]
12120 [[Bar:Article (context)|]]
12121 [[:Bar:Article (context)|]]
12122 [[|Article (context)]]
12123 [[Bar:X (Y) Z|]]
12124 [[:Bar:X (Y) Z|]]
12125 !! html/php
12126 [[Article (context)|Article]]
12127 [[Bar:Article (context)|Article]]
12128 [[:Bar:Article (context)|Article]]
12129 [[Article (context)]]
12130 [[Bar:X (Y) Z|X (Y) Z]]
12131 [[:Bar:X (Y) Z|X (Y) Z]]
12132 !! end
12133
12134 !! test
12135 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12136 !! options
12137 pst
12138 !! wikitext
12139 [[Article(context)|]]
12140 [[Bar:Article(context)|]]
12141 [[:Bar:Article(context)|]]
12142 [[|Article(context)]]
12143 [[Bar:X(Y)Z|]]
12144 [[:Bar:X(Y)Z|]]
12145 !! html/php
12146 [[Article(context)|Article]]
12147 [[Bar:Article(context)|Article]]
12148 [[:Bar:Article(context)|Article]]
12149 [[Article(context)]]
12150 [[Bar:X(Y)Z|X(Y)Z]]
12151 [[:Bar:X(Y)Z|X(Y)Z]]
12152 !! end
12153
12154 !! test
12155 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12156 !! options
12157 pst
12158 !! wikitext
12159 [[Article (context), context|]]
12160 [[Article (context),context|]]
12161 [[Bar:Article (context), context|]]
12162 [[Bar:Article (context),context|]]
12163 [[:Bar:Article (context), context|]]
12164 [[:Bar:Article (context),context|]]
12165 !! html/php
12166 [[Article (context), context|Article]]
12167 [[Article (context),context|Article]]
12168 [[Bar:Article (context), context|Article]]
12169 [[Bar:Article (context),context|Article]]
12170 [[:Bar:Article (context), context|Article]]
12171 [[:Bar:Article (context),context|Article]]
12172 !! end
12173
12174 !! test
12175 pre-save transform: trim trailing empty lines
12176 !! options
12177 pst
12178 !! wikitext
12179 Empty lines are trimmed
12180
12181
12182
12183
12184 !! html/php
12185 Empty lines are trimmed
12186 !! end
12187
12188 !! test
12189 pre-save transform: Signature expansion
12190 !! options
12191 pst
12192 !! wikitext
12193 * ~~~
12194 * <noinclude>~~~</noinclude>
12195 * <includeonly>~~~</includeonly>
12196 * <onlyinclude>~~~</onlyinclude>
12197 !! html/php
12198 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12199 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12200 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12201 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12202 !! end
12203
12204
12205 !! test
12206 pre-save transform: Signature expansion in nowiki tags (bug 93)
12207 !! options
12208 pst disabled
12209 !! wikitext
12210 Shall not expand:
12211
12212 <nowiki>~~~~</nowiki>
12213
12214 <includeonly><nowiki>~~~~</nowiki></includeonly>
12215
12216 <noinclude><nowiki>~~~~</nowiki></noinclude>
12217
12218 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12219
12220 {{subst:Foo}} shall be converted to FOO
12221
12222 As well as inside noinclude/onlyinclude
12223 <noinclude>{{subst:Foo}}</noinclude>
12224 <onlyinclude>{{subst:Foo}}</onlyinclude>
12225
12226 But not inside includeonly
12227 <includeonly>{{subst:Foo}}</includeonly>
12228 !! html/php
12229 Shall not expand:
12230
12231 <nowiki>~~~~</nowiki>
12232
12233 <includeonly><nowiki>~~~~</nowiki></includeonly>
12234
12235 <noinclude><nowiki>~~~~</nowiki></noinclude>
12236
12237 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12238
12239 FOO shall be converted to FOO
12240
12241 As well as inside noinclude/onlyinclude
12242 <noinclude>FOO</noinclude>
12243 <onlyinclude>FOO</onlyinclude>
12244
12245 But not inside includeonly
12246 <includeonly>{{subst:Foo}}</includeonly>
12247 !! end
12248
12249 !! test
12250 Parsoid: Recognize nowiki with trailing space in tags
12251 !! options
12252 parsoid=wt2html
12253 !! wikitext
12254 <nowiki ><div>[[foo]]</nowiki >
12255
12256 a<nowiki / >b
12257
12258 c<nowiki />d
12259
12260 e<nowiki/ >f
12261 !! html
12262 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12263 <p>ab</p>
12264 <p>cd</p>
12265 <p>ef</p>
12266 !! end
12267
12268 !! test
12269 Parsoid: Recognize nowiki with odd capitalization
12270 !! options
12271 parsoid=wt2html
12272 !! wikitext
12273 <noWikI ><div>[[foo]]</Nowiki >
12274 !! html
12275 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12276 !! end
12277
12278
12279 !! test
12280 Parsoid: Escape nowiki with trailing space in tags
12281 !! options
12282 parsoid=html2wt
12283 !! html/parsoid
12284 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12285 <p>a&lt;nowiki /&gt;b</p>
12286 <p>c&lt;nowiki/ &gt;d</p>
12287 !! wikitext
12288 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12289
12290 a&lt;nowiki /&gt;b
12291
12292 c&lt;nowiki/ &gt;d
12293 !! end
12294
12295 !! test
12296 Parsoid: Escape weird noWikI capitalizations
12297 !! options
12298 parsoid=html2wt
12299 !! html/parsoid
12300 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12301 !! wikitext
12302 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12303 !! end
12304
12305 ###
12306 ### Message transform tests
12307 ###
12308 !! test
12309 message transform: magic variables
12310 !! options
12311 msg
12312 !! wikitext
12313 {{SITENAME}}
12314 !! html
12315 MediaWiki
12316 !! end
12317
12318 !! test
12319 message transform: should not transform wiki markup
12320 !! options
12321 msg
12322 !! wikitext
12323 ''test''
12324 !! html
12325 ''test''
12326 !! end
12327
12328 !! test
12329 message transform: <noinclude> in transcluded template (bug 4926)
12330 !! options
12331 msg
12332 !! wikitext
12333 {{Includes}}
12334 !! html
12335 Foobar
12336 !! end
12337
12338 !! test
12339 message transform: <onlyinclude> in transcluded template (bug 4926)
12340 !! options
12341 msg
12342 !! wikitext
12343 {{Includes2}}
12344 !! html
12345 Foo
12346 !! end
12347
12348 !! test
12349 {{#special:}} page name, known
12350 !! options
12351 msg
12352 !! wikitext
12353 {{#special:Recentchanges}}
12354 !! html
12355 Special:RecentChanges
12356 !! end
12357
12358 !! test
12359 {{#special:}} page name with subpage, known
12360 !! options
12361 msg
12362 !! wikitext
12363 {{#special:Recentchanges/param}}
12364 !! html
12365 Special:RecentChanges/param
12366 !! end
12367
12368 !! test
12369 {{#special:}} page name, unknown
12370 !! options
12371 msg
12372 !! wikitext
12373 {{#special:foobar nonexistent}}
12374 !! html
12375 Special:Foobar nonexistent
12376 !! end
12377
12378 !! test
12379 {{#speciale:}} page name, known
12380 !! options
12381 msg
12382 !! wikitext
12383 {{#speciale:Recentchanges}}
12384 !! html
12385 Special:RecentChanges
12386 !! end
12387
12388 !! test
12389 {{#speciale:}} page name with subpage, known
12390 !! options
12391 msg
12392 !! wikitext
12393 {{#speciale:Recentchanges/param}}
12394 !! html
12395 Special:RecentChanges/param
12396 !! end
12397
12398 !! test
12399 {{#speciale:}} page name, unknown
12400 !! options
12401 msg
12402 !! wikitext
12403 {{#speciale:foobar nonexistent}}
12404 !! html
12405 Special:Foobar_nonexistent
12406 !! end
12407
12408 ###
12409 ### Images
12410 ###
12411 ### For Parsoid-specific tests, see
12412 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12413
12414 !! test
12415 Simple image
12416 !! options
12417 parsoid=wt2html,wt2wt,html2html
12418 !! wikitext
12419 [[Image:foobar.jpg]]
12420 !! html/php
12421 <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>
12422 </p>
12423 !! html/parsoid
12424 <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>
12425 !! end
12426
12427 !! test
12428 Simple image (using File: namespace, now canonical)
12429 !! wikitext
12430 [[File:Foobar.jpg]]
12431 !! html/php
12432 <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>
12433 </p>
12434 !! html/parsoid
12435 <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>
12436 !! end
12437
12438 !! test
12439 Right-aligned image
12440 !! wikitext
12441 [[File:Foobar.jpg|right]]
12442 !! html/php
12443 <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>
12444
12445 !! html/parsoid
12446 <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>
12447 !! end
12448
12449 !! test
12450 Image with caption
12451 !! wikitext
12452 [[File:Foobar.jpg|right|Caption text]]
12453 !! html/php
12454 <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>
12455
12456 !! html/parsoid
12457 <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>
12458 !! end
12459
12460 !! test
12461 Image with caption, bug 53312 #1
12462 !! wikitext
12463 [[File:Foobar.jpg|right|Caption page stuff]]
12464 !! html/php
12465 <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>
12466
12467 !! html/parsoid
12468 <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>
12469 !! end
12470
12471 !! test
12472 Image with caption, bug 53312 #2
12473 !! wikitext
12474 [[File:Foobar.jpg|right|Caption page=]]
12475 !! html/php
12476 <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>
12477
12478 !! html/parsoid
12479 <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>
12480 !! end
12481
12482 !! test
12483 Image with caption, bug 53312 #3
12484 !! wikitext
12485 [[File:Foobar.jpg|right|Caption page=stuff]]
12486 !! html/php
12487 <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>
12488
12489 !! html/parsoid
12490 <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>
12491 !! end
12492
12493 !! test
12494 Allow empty links in image captions (Bug 60753)
12495 !! options
12496 thumbsize=220
12497 !! wikitext
12498 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12499 [[]]
12500 [[Link2]]
12501 ]]
12502 !! html/php
12503 <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>
12504
12505 !! html/parsoid
12506 <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>
12507 [[]]
12508 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12509 </figcaption></figure>
12510 !! end
12511
12512 !! test
12513 Titles in unlinked images (T23454)
12514 !! wikitext
12515 [[File:Foobar.jpg|link=|stuff]]
12516 !! html/php
12517 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12518 </p>
12519 !! end
12520
12521 !! test
12522 Link with empty target
12523 !! wikitext
12524 [[]]
12525 !! html
12526 <p>[[]]
12527 </p>
12528 !! end
12529
12530 !! test
12531 Image with link trail
12532 !! wikitext
12533 Linktrails should not work for images: [[File:Foobar.jpg]]s
12534 !! html/php
12535 <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
12536 </p>
12537 !! html/parsoid
12538 <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>
12539 !! end
12540
12541 !! test
12542 Image with empty attribute
12543 !! options
12544 parsoid=wt2html,wt2wt,html2html
12545 !! wikitext
12546 [[File:Foobar.jpg|right||Caption text]]
12547 !! html/php
12548 <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>
12549
12550 !! html/parsoid
12551 <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>
12552 !! end
12553
12554 !! test
12555 1. Block image with individual attributes from templates
12556 !! wikitext
12557 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12558 !! html/php
12559 <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>
12560
12561 !! html/parsoid
12562 <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>
12563 !! end
12564
12565 !! test
12566 2. Block Image with individual attributes from templates
12567 !! wikitext
12568 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12569 !! html/php
12570 <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>
12571
12572 !! html/parsoid
12573 <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>
12574 !! end
12575
12576 !! test
12577 3. Inline image with individual attributes from templates
12578 !! wikitext
12579 [[File:Foobar.jpg|{{echo|50px}}]]
12580 !! html/php
12581 <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>
12582 </p>
12583 !! html/parsoid
12584 <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>
12585 !! end
12586
12587 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12588 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12589 !! test
12590 Image with multiple attributes from the same template
12591 !! wikitext
12592 [[File:Foobar.jpg|{{image_attribs}}]]
12593 !! html/php
12594 <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>
12595
12596 !! html/parsoid
12597 <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>
12598 !! end
12599
12600 !! test
12601 Image with link tails
12602 !! options
12603 thumbsize=220
12604 !! wikitext
12605 123[[File:Foobar.jpg]]456
12606 123[[File:Foobar.jpg|right]]456
12607 123[[File:Foobar.jpg|thumb]]456
12608 !! html/php
12609 <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
12610 </p>
12611 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
12612 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
12613
12614 !! html/php+tidy
12615 <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>
12616 <p>123</p>
12617 <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>
12618 <p>456 123</p>
12619 <div class="thumb tright">
12620 <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>
12621 <div class="thumbcaption">
12622 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12623 </div>
12624 </div>
12625 </div>
12626 <p>456</p>
12627 !! html/parsoid
12628 <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>
12629 <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>
12630 <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>
12631 !! end
12632
12633 !! test
12634 Image with multiple captions -- only last one is accepted
12635 !! wikitext
12636 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12637 !! html/php
12638 <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>
12639
12640 !! html/parsoid
12641 <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>
12642 !! end
12643
12644 !! test
12645 Image with multiple widths -- use last
12646 !! wikitext
12647 [[File:Foobar.jpg|200px|300px|caption]]
12648 !! html/php
12649 <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>
12650 </p>
12651 !! html/parsoid
12652 <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>
12653 !! end
12654
12655 !! test
12656 Image with multiple alignments -- use first (bug 48664)
12657 !! options
12658 thumbsize=220
12659 !! wikitext
12660 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12661
12662 [[File:Foobar.jpg|middle|text-top|caption]]
12663 !! html/php
12664 <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>
12665 <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>
12666 </p>
12667 !! html/parsoid
12668 <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>
12669 <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>
12670 !! end
12671
12672 !! test
12673 Image with width attribute at different positions
12674 !! wikitext
12675 [[File:Foobar.jpg|200px|right|Caption]]
12676 [[File:Foobar.jpg|right|200px|Caption]]
12677 [[File:Foobar.jpg|right|Caption|200px]]
12678 !! html/php
12679 <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>
12680 <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>
12681 <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>
12682
12683 !! html/parsoid
12684 <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>
12685 <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>
12686 <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>
12687 !! end
12688
12689 # a sad bit of backward-compatibility
12690 !! test
12691 Image with size specified with pxpx (bug 13500, 51628)
12692 !! options
12693 parsoid=wt2html,wt2wt,html2html
12694 !! wikitext
12695 [[File:Foobar.jpg|20pxpx]]
12696 [[File:Foobar.jpg|200x20pxpx]]
12697 !! html/php
12698 <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>
12699 <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>
12700 </p>
12701 !! html/parsoid
12702 <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>
12703 !! end
12704
12705 !! test
12706 Image with link parameter, wiki target
12707 !! wikitext
12708 [[File:Foobar.jpg|link=Main Page]]
12709 !! html/php
12710 <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>
12711 </p>
12712 !! html/parsoid
12713 <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>
12714 !! end
12715
12716 # parsoid bug 49293 (part 1)
12717 !! test
12718 Image with link parameter, URL target
12719 !! wikitext
12720 [[File:Foobar.jpg|link=http://example.com/]]
12721 !! html/php
12722 <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>
12723 </p>
12724 !! html/parsoid
12725 <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>
12726 !! end
12727
12728 # parsoid bug 49293 (part 2)
12729 !! test
12730 Image with link parameter, protocol-less URL target
12731 !! wikitext
12732 [[File:Foobar.jpg|link=//example.com/]]
12733 !! html/php
12734 <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>
12735 </p>
12736 !! html/parsoid
12737 <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>
12738 !! end
12739
12740 !! test
12741 Escaping non-block captions (T107435)
12742 !! options
12743 parsoid={
12744 "modes": ["wt2wt"],
12745 "changes": [
12746 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12747 ]
12748 }
12749 !! wikitext
12750 [[Image:Foobar.jpg|caption]]
12751 !! wikitext/edited
12752 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12753 !! end
12754
12755 !! test
12756 Image with link parameter, wgExternalLinkTarget
12757 !! wikitext
12758 [[Image:foobar.jpg|link=http://example.com/]]
12759 !! config
12760 wgExternalLinkTarget='foobar'
12761 !! html
12762 <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>
12763 </p>
12764 !! end
12765
12766 !! test
12767 Image with link parameter, wgNoFollowLinks set to false
12768 !! wikitext
12769 [[Image:foobar.jpg|link=http://example.com/]]
12770 !! config
12771 wgNoFollowLinks=false
12772 !! html
12773 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12774 </p>
12775 !! end
12776
12777 !! test
12778 Image with link parameter, wgNoFollowDomainExceptions
12779 !! wikitext
12780 [[Image:foobar.jpg|link=http://example.com/]]
12781 !! config
12782 wgNoFollowDomainExceptions='example.com'
12783 !! html
12784 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12785 </p>
12786 !! end
12787
12788 !! test
12789 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12790 !! wikitext
12791 [[Image:foobar.jpg|link=http://example.com/|Title]]
12792 !! config
12793 wgExternalLinkTarget='foobar'
12794 !! html
12795 <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>
12796 </p>
12797 !! end
12798
12799 !! test
12800 Image with empty link parameter
12801 !! wikitext
12802 [[File:Foobar.jpg|link=]]
12803 !! html/php
12804 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12805 </p>
12806 !! html/parsoid
12807 <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>
12808 !! end
12809
12810 !! test
12811 Image with link parameter (wiki target) and unnamed parameter
12812 !! wikitext
12813 [[File:Foobar.jpg|link=Main_Page|Title]]
12814 !! html/php
12815 <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>
12816 </p>
12817 !! html/parsoid
12818 <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>
12819 !! end
12820
12821 !! test
12822 Image with link parameter (URL target) and unnamed parameter
12823 !! wikitext
12824 [[File:Foobar.jpg|link=http://example.com/|Title]]
12825 !! html/php
12826 <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>
12827 </p>
12828 !! html/parsoid
12829 <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>
12830 !! end
12831
12832 !! test
12833 Thumbnail image with link parameter
12834 !! options
12835 thumbsize=220
12836 parsoid=wt2html,wt2wt,html2html
12837 !! wikitext
12838 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12839 !! html/php
12840 <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>
12841
12842 !! html/parsoid
12843 <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>
12844 !! end
12845
12846 !! test
12847 Manually-specified thumbnail image
12848 !! options
12849 thumbsize=220
12850 !! wikitext
12851 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12852 !! html/php
12853 <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>
12854
12855 !! html/parsoid
12856 <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>
12857 !! end
12858
12859 !! test
12860 Manually-specified thumbnail image with explicit link to wiki page
12861 !! options
12862 thumbsize=220
12863 parsoid=wt2html,wt2wt,html2html
12864 !! wikitext
12865 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12866 !! html/php
12867 <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>
12868
12869 !! html/parsoid
12870 <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>
12871 !! end
12872
12873 !! test
12874 Manually-specified thumbnail image with explicit link to url
12875 !! options
12876 thumbsize=220
12877 parsoid=wt2html,wt2wt,html2html
12878 !! wikitext
12879 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12880 !! html/php
12881 <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>
12882
12883 !! html/parsoid
12884 <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>
12885 !! end
12886
12887 !! test
12888 Manually-specified thumbnail image with explicit no link
12889 !! options
12890 thumbsize=220
12891 parsoid=wt2html,wt2wt,html2html
12892 !! wikitext
12893 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12894 !! html/php
12895 <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>
12896
12897 !! html/parsoid
12898 <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>
12899 !! end
12900
12901 !! test
12902 Manually-specified thumbnail image with explicit link and alt text
12903 !! options
12904 thumbsize=220
12905 parsoid=wt2html,wt2wt,html2html
12906 !! wikitext
12907 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12908 !! html/php
12909 <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>
12910
12911 !! html/parsoid
12912 <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>
12913 !! end
12914
12915 !! test
12916 Image with frame and link
12917 !! options
12918 parsoid=wt2html,wt2wt,html2html
12919 !! wikitext
12920 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12921 !! html/php
12922 <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>
12923
12924 !! html/parsoid
12925 <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>
12926 !! end
12927
12928 !! test
12929 Image with frame and link and explicit alt
12930 !! options
12931 parsoid=wt2html,wt2wt,html2html
12932 !! wikitext
12933 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12934 !! html/php
12935 <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>
12936
12937 !! html/parsoid
12938 <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>
12939 !! end
12940
12941 !! test
12942 Image with wiki markup in implicit alt
12943 !! wikitext
12944 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12945
12946 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12947 !! html/php
12948 <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>
12949 </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>
12950 </p>
12951 !! html/parsoid
12952 <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>
12953 <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>
12954 !! end
12955
12956 !! test
12957 Alt image option should handle most kinds of wikitext without barfing
12958 !! wikitext
12959 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12960 !! html/php
12961 <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>
12962
12963 !! html/parsoid
12964 <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>
12965 !! end
12966
12967 ###################
12968 # Conflicting image format options.
12969 # First option specified should 'win'.
12970 # All three cases in each test should be identical.
12971
12972 !! test
12973 Image with 'frameless' first.
12974 !! options
12975 parsoid=wt2html,wt2wt,html2html
12976 !! wikitext
12977 [[File:Foobar.jpg|frameless|caption]]
12978
12979 [[File:Foobar.jpg|frameless|frame|caption]]
12980
12981 [[File:Foobar.jpg|frameless|thumb|caption]]
12982 !! html/php
12983 <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>
12984 </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>
12985 </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>
12986 </p>
12987 !! html/parsoid
12988 <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>
12989 <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>
12990 <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>
12991 !! end
12992
12993 !! test
12994 Image with 'frame' first.
12995 !! options
12996 parsoid=wt2html,wt2wt,html2html
12997 !! wikitext
12998 [[File:Foobar.jpg|frame|caption]]
12999 [[File:Foobar.jpg|frame|frameless|caption]]
13000 [[File:Foobar.jpg|frame|thumb|caption]]
13001 !! html/php
13002 <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>
13003 <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>
13004 <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>
13005
13006 !! html/parsoid
13007 <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>
13008 <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>
13009 <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>
13010 !! end
13011
13012 !! test
13013 Image with 'thumb' first.
13014 !! options
13015 parsoid=wt2html,wt2wt,html2html
13016 !! wikitext
13017 [[File:Foobar.jpg|thumb|caption]]
13018 [[File:Foobar.jpg|thumb|frameless|caption]]
13019 [[File:Foobar.jpg|thumb|frame|caption]]
13020 !! html/php
13021 <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>
13022 <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>
13023 <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>
13024
13025 !! html/parsoid
13026 <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>
13027 <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>
13028 <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>
13029 !! end
13030
13031 ###################
13032 # Image sizing.
13033 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13034 # and https://phabricator.wikimedia.org/T64258
13035 # Foobar has actual size of 1941x220
13036 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13037 # a scalable format.
13038 # 2. Framed images always ignore size options; always render at default size.
13039 # 3. "Unspecified format" and border are the only types which can be
13040 # enlarged.
13041
13042 !! test
13043 Image: "unspecified format" and border enlarge
13044 !! options
13045 parsoid=wt2html,wt2wt,html2html
13046 !! wikitext
13047 [[File:Foobar.jpg|2000px]]
13048
13049 [[File:Foobar.jpg|border|2000px]]
13050 !! html/php
13051 <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>
13052 </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>
13053 </p>
13054 !! html/parsoid
13055 <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>
13056 <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>
13057 !! end
13058
13059 !! test
13060 Image: "unspecified format" and border reduce
13061 !! options
13062 parsoid=wt2html,wt2wt,html2html
13063 !! wikitext
13064 [[File:Foobar.jpg|1000px]]
13065
13066 [[File:Foobar.jpg|border|1000px]]
13067 !! html/php
13068 <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>
13069 </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>
13070 </p>
13071 !! html/parsoid
13072 <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>
13073 <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>
13074 !! end
13075
13076 !! test
13077 Image: thumbs reduce
13078 !! options
13079 parsoid=wt2html,wt2wt,html2html
13080 !! wikitext
13081 [[File:Foobar.jpg|thumb|50px]]
13082 !! html/php
13083 <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>
13084
13085 !! html/parsoid
13086 <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>
13087 !! end
13088
13089 !! test
13090 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13091 !! options
13092 parsoid=wt2html,wt2wt,html2html
13093 !! wikitext
13094 [[File:Foobar.jpg|thumb|2000px]]
13095
13096 [[File:Foobar.svg|thumb|2000px]]
13097 !! html/php
13098 <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>
13099 <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>
13100
13101 !! html/parsoid
13102 <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>
13103 <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>
13104 !! end
13105
13106 !! test
13107 Image: frameless can reduce in size
13108 !! options
13109 parsoid=wt2html,wt2wt,html2html
13110 !! wikitext
13111 [[File:Foobar.jpg|frameless|50px]]
13112 !! html/php
13113 <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>
13114 </p>
13115 !! html/parsoid
13116 <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>
13117 !! end
13118
13119 !! test
13120 Image: bitmap frameless can't be enlarged past original size, but vector can
13121 !! options
13122 parsoid=wt2html,wt2wt,html2html
13123 !! wikitext
13124 [[File:Foobar.jpg|frameless|2000px]]
13125
13126 [[File:Foobar.svg|frameless|2000px]]
13127 !! html/php
13128 <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>
13129 </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>
13130 </p>
13131 !! html/parsoid
13132 <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>
13133 <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>
13134 !! end
13135
13136 !! test
13137 Image: framed images are always unscaled.
13138 !! options
13139 parsoid=wt2html,wt2wt,html2html
13140 !! wikitext
13141 [[File:Foobar.jpg|frame]]
13142
13143 [[File:Foobar.jpg|frame|50px]]
13144
13145 [[File:Foobar.jpg|frame|50x50px]]
13146
13147 [[File:Foobar.jpg|frame|2000px]]
13148 !! html/php
13149 <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>
13150 <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>
13151 <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>
13152 <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>
13153
13154 !! html/parsoid
13155 <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>
13156 <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>
13157 <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>
13158 <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>
13159 !! end
13160
13161 ###################
13162
13163 !! test
13164 Link to image page- image page normally doesn't exists, hence edit link
13165 Add test with existing image page
13166 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13167 !! wikitext
13168 [[:Image:test]]
13169 !! html
13170 <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>
13171 </p>
13172 !! end
13173
13174 !! test
13175 bug 18784 Link to non-existent image page with caption should use caption as link text
13176 !! wikitext
13177 [[:Image:test|caption]]
13178 !! html
13179 <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>
13180 </p>
13181 !! end
13182
13183 !! test
13184 Frameless image caption with a free URL
13185 !! wikitext
13186 [[File:Foobar.jpg|http://example.com]]
13187 !! html/php
13188 <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>
13189 </p>
13190 !! html/parsoid
13191 <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>
13192 !! end
13193
13194 !! test
13195 Thumbnail image caption with a free URL
13196 !! options
13197 thumbsize=220
13198 !! wikitext
13199 [[File:Foobar.jpg|thumb|http://example.com]]
13200 !! html/php
13201 <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>
13202
13203 !! html/parsoid
13204 <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>
13205 !! end
13206
13207 !! test
13208 Thumbnail image caption with a free URL and explicit alt
13209 !! options
13210 thumbsize=220
13211 parsoid=wt2html,wt2wt,html2html
13212 !! wikitext
13213 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13214 !! html/php
13215 <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>
13216
13217 !! html/parsoid
13218 <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>
13219 !! end
13220
13221 !! test
13222 SVG thumbnails with no language set
13223 !! options
13224 !! wikitext
13225 [[File:Foobar.svg|thumb|caption]]
13226 !! html/php
13227 <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>
13228
13229 !! html/parsoid
13230 <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>
13231 !! end
13232
13233 !! test
13234 SVG thumbnails with language de
13235 !! options
13236 parsoid=wt2html,wt2wt,html2html
13237 !! wikitext
13238 [[File:Foobar.svg|thumb|caption|lang=de]]
13239 !! html/php
13240 <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>
13241
13242 !! html/parsoid
13243 <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>
13244 !! end
13245
13246 !! test
13247 SVG thumbnails with invalid language code
13248 !! options
13249 parsoid=wt2html,wt2wt,html2html
13250 !! wikitext
13251 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13252 !! html/php
13253 <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>
13254
13255 !! html/parsoid
13256 <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>
13257 !! end
13258
13259 !! test
13260 BUG 1887: A ISBN with a thumbnail
13261 !! wikitext
13262 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13263 !! html/php
13264 <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>
13265
13266 !! html/parsoid
13267 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
13268 !! end
13269
13270 !! test
13271 BUG 1887: A RFC with a thumbnail
13272 !! wikitext
13273 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13274 !! html/php
13275 <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>
13276
13277 !! html/parsoid
13278 <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>
13279 !! end
13280
13281 !! test
13282 BUG 1887: A mailto link with a thumbnail
13283 !! wikitext
13284 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13285 !! html/php
13286 <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>
13287
13288 !! html/parsoid
13289 <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>
13290 !! end
13291
13292 # Pending resolution to bug 368
13293 !! test
13294 BUG 648: Frameless image caption with a link
13295 !! wikitext
13296 [[File:Foobar.jpg|text with a [[link]] in it]]
13297 !! html/php
13298 <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>
13299 </p>
13300 !! html/parsoid
13301 <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>
13302 !! end
13303
13304 !! test
13305 BUG 648: Frameless image caption with a link (suffix)
13306 !! wikitext
13307 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13308 !! html/php
13309 <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>
13310 </p>
13311 !! html/parsoid
13312 <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>
13313 !! end
13314
13315 !! test
13316 BUG 648: Frameless image caption with an interwiki link
13317 !! wikitext
13318 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13319 !! html/php
13320 <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>
13321 </p>
13322 !! html/parsoid
13323 <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>
13324 !! end
13325
13326 !! test
13327 BUG 648: Frameless image caption with a piped interwiki link
13328 !! wikitext
13329 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13330 !! html/php
13331 <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>
13332 </p>
13333 !! html/parsoid
13334 <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>
13335 !! end
13336
13337 !! test
13338 T107474: Frameless image caption with <nowiki>
13339 !! wikitext
13340 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13341 !! html/parsoid
13342 <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>
13343 !! end
13344
13345 !! test
13346 Escape HTML special chars in image alt text
13347 !! wikitext
13348 [[File:Foobar.jpg|& < > "]]
13349 !! html/php
13350 <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>
13351 </p>
13352 !! html/parsoid
13353 <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>
13354 !! end
13355
13356 !! test
13357 BUG 499: Alt text should have &#1234;, not &amp;1234;
13358 !! wikitext
13359 [[File:Foobar.jpg|&#9792;]]
13360 !! html/php
13361 <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>
13362 </p>
13363 !! html/parsoid
13364 <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>
13365 !! end
13366
13367 !! test
13368 Broken image caption with link
13369 !! options
13370 parsoid=wt2html,wt2wt,html2html
13371 !! wikitext
13372 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13373 !! html/php
13374 <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.
13375 </p>
13376 !! html/parsoid
13377 <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>
13378 !! end
13379
13380 !! test
13381 Image caption containing another image
13382 !! wikitext
13383 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13384 !! html/php
13385 <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>
13386
13387 !! html/parsoid
13388 <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>
13389 !! end
13390
13391 !! test
13392 Image: caption containing a newline
13393 !! wikitext
13394 [[File:Foobar.jpg|This
13395 *is some text]]
13396 !! html/php
13397 <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>
13398 </p>
13399 !! html/parsoid
13400 <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>
13401 !!end
13402
13403 !!test
13404 Image: caption containing leading space
13405 (The leading space should not trigger nowiki escaping in wt2wt mode)
13406 !! wikitext
13407 [[File:Foobar.jpg|thumb| bar]]
13408 !! html/php
13409 <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>
13410
13411 !! html/parsoid
13412 <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>
13413 !!end
13414
13415 !! test
13416 Image: caption containing a table
13417 !! options
13418 parsoid=wt2html,wt2wt,html2html
13419 !! wikitext
13420 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13421 {|
13422 ! Foo !! Bar
13423 |-
13424 | Foo1 || Bar1
13425 |}
13426 and some more text.]]
13427 !! html/php
13428 <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>
13429
13430 !! html/parsoid
13431 <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
13432 <table>
13433 <tbody>
13434 <tr><th>Foo </th><th>Bar</th></tr>
13435 <tr>
13436 <td>Foo1 </td>
13437 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13438 !! end
13439
13440 !! test
13441 Bug 3090: External links other than http: in image captions
13442 !! wikitext
13443 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13444 !! html/php
13445 <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>
13446
13447 !! html/parsoid
13448 <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>
13449 !! end
13450
13451 !! test
13452 Custom class
13453 !! options
13454 parsoid=wt2html,wt2wt,html2html
13455 !! wikitext
13456 [[Image:foobar.jpg|a|class=b]]
13457 !! html/php
13458 <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>
13459 </p>
13460 !! html/parsoid
13461 <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>
13462 !! end
13463
13464 !! test
13465 Localized image handling (1).
13466 !! options
13467 parsoid=wt2html,wt2wt,html2html
13468 language=es
13469 !! wikitext
13470 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13471 !! html/php
13472 <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>
13473
13474 !! html/parsoid
13475 <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>
13476 !! end
13477
13478 !! test
13479 Localized image handling (2).
13480 !! options
13481 thumbsize=220
13482 parsoid=wt2html,wt2wt,html2html
13483 language=es
13484 !! wikitext
13485 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13486 !! html/php
13487 <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>
13488
13489 !! html/parsoid
13490 <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>
13491 !! end
13492
13493 !! test
13494 "border", "frameless" and "class" attributes on an image.
13495 !! options
13496 thumbsize=220
13497 parsoid=wt2html,wt2wt,html2html
13498 !! wikitext
13499 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13500 !! html/php
13501 <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>
13502 </p>
13503 !! html/parsoid
13504 <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>
13505 !! end
13506
13507 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13508 !! test
13509 Invalid image attributes (bug 62500)
13510 !! options
13511 thumbsize=220
13512 parsoid=wt2html,wt2wt,html2html
13513 !! wikitext
13514 [[File:Foobar.jpg|thumb|float|left|caption]]
13515
13516 [[File:Foobar.jpg|thumb|righ|caption]]
13517
13518 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13519 !! html/php
13520 <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>
13521 <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>
13522 <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>
13523
13524 !! html/parsoid
13525 <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>
13526 <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>
13527 <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>
13528 !! end
13529
13530 !! article
13531 File:Barfoo.jpg
13532 !! text
13533 #REDIRECT [[File:Barfoo.jpg]]
13534 !! endarticle
13535
13536 # FIXME: Parsoid should run this test -- but we'd need to teach the
13537 # mockAPI about the redirected Barfoo.jpg image.
13538 !! test
13539 Redirected image
13540 !! wikitext
13541 [[Image:Barfoo.jpg]]
13542 !! html/php
13543 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13544 </p>
13545 !! end
13546
13547 !! test
13548 Missing image with uploads disabled
13549 !! options
13550 wgEnableUploads=0
13551 !! wikitext
13552 [[File:Foobaz.jpg]]
13553 !! html/php
13554 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13555 </p>
13556 !! html/parsoid
13557 <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>
13558 !! end
13559
13560 # Parsoid-specific testing for images
13561 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13562 # Currently imperfect due to a flaw in the Parsoid testrunner
13563 # Work in progress
13564 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13565 # image tests.
13566
13567 !! test
13568 Parsoid-specific image handling - simple image with size and middle alignment
13569 !! wikitext
13570 [[File:Foobar.jpg|middle|50px]]
13571 !! html/parsoid
13572 <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>
13573 !! end
13574
13575 !! test
13576 Parsoid-specific image handling - simple image with size, middle alignment,
13577 non-standard namespace alias
13578 !! options
13579 parsoid=wt2wt,wt2html,html2html
13580 !! wikitext
13581 [[Image:Foobar.jpg|middle|50px]]
13582 !! html/parsoid
13583 <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>
13584 !! end
13585
13586 !! test
13587 Parsoid-specific image handling - simple image with size and middle alignment
13588 (existing content)
13589 !! wikitext
13590 [[File:Foobar.jpg|50px|middle]]
13591 !! html/parsoid
13592 <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>
13593 !! end
13594
13595 !! test
13596 Parsoid-specific image handling - simple image with size and middle alignment
13597 and non-standard namespace name
13598 !! options
13599 parsoid=wt2html,wt2wt,html2html
13600 !! wikitext
13601 [[Image:Foobar.jpg|50px|middle]]
13602 !! html/parsoid
13603 <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>
13604 !! end
13605
13606 !! test
13607 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13608 !! wikitext
13609 [[File:Foobar.jpg|500x10px|baseline|caption]]
13610 !! html/parsoid
13611 <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>
13612 !! end
13613
13614 !! test
13615 Parsoid-specific image handling - simple image with border and size spec
13616 !! wikitext
13617 [[File:Foobar.jpg|50px|border|caption]]
13618 !! html/parsoid
13619 <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>
13620 !! end
13621
13622 !! test
13623 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13624 !! wikitext
13625 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13626 !! html/parsoid
13627 <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>
13628 !! end
13629
13630 !! test
13631 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13632 (existing content)
13633 !! wikitext
13634 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13635 !! html/parsoid
13636 <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>
13637 !! end
13638
13639 !! test
13640 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13641 !! wikitext
13642 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13643 !! html/parsoid
13644 <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>
13645 !! end
13646
13647 !! test
13648 Parsoid-specific image handling - thumbnail with specific size, halign,
13649 valign, and caption (existing content)
13650 !! wikitext
13651 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13652 !! html/parsoid
13653 <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>
13654 !! end
13655
13656 !! test
13657 Parsoid-specific image handling - framed image with specific size and caption
13658 (size is ignored)
13659 !! options
13660 parsoid=wt2html,wt2wt,html2html
13661 !! wikitext
13662 [[File:Foobar.jpg|frame|500x50px|caption]]
13663 !! html/parsoid
13664 <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>
13665 !! end
13666
13667 !! test
13668 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13669 (size is ignored)
13670 !! options
13671 parsoid=wt2html,wt2wt,html2html
13672 !! wikitext
13673 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13674 !! html/parsoid
13675 <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>
13676 !! end
13677
13678 !! test
13679 Parsoid-specific image handling - frameless image with specific size, border, and caption
13680 !! wikitext
13681 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13682 !! html/parsoid
13683 <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>
13684 !! end
13685
13686 !! test
13687 Parsoid-specific image handling - simple image with a formatted caption
13688 !! wikitext
13689 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13690 !! html/parsoid
13691 <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>
13692 !! end
13693
13694 !! test
13695 Parsoid-specific image handling - caption with a template in it
13696 !! wikitext
13697 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13698 !! html/parsoid
13699 <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>
13700 !! end
13701
13702 !! test
13703 Parsoid-specific image handling - caption with unbalanced tags in it
13704 !! options
13705 parsoid=wt2html,wt2wt,html2html
13706 !! wikitext
13707 foo
13708 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13709 bar
13710 !! html/parsoid
13711 <p>foo</p>
13712 <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>
13713 <p>bar</p>
13714 !! end
13715
13716 !! test
13717 Parsoid-specific image handling - empty caption (1)
13718 !! options
13719 parsoid=wt2html,wt2wt
13720 !! wikitext
13721 [[File:Foobar.jpg|thumb|]]
13722 !! html/parsoid
13723 <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>
13724 !! end
13725
13726 # empty captions don't get serialized unless we're in the "round trip" case
13727 !! test
13728 Parsoid-specific image handling - empty caption (2)
13729 !! options
13730 parsoid=html2wt
13731 !! html/parsoid
13732 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13733 <a href="./File:Foobar.jpg">
13734 <img resource="./File:Foobar.jpg"
13735 src="//example.com/images/3/3a/Foobar.jpg"
13736 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13737 height="25" width="220"/>
13738 </a>
13739 <figcaption></figcaption>
13740 </figure>
13741 !! wikitext
13742 [[File:Foobar.jpg|thumb]]
13743 !! end
13744
13745 !! test
13746 Parsoid-specific image handling - whitespace caption
13747 !! wikitext
13748 [[File:Foobar.jpg|thumb| ]]
13749 !! html/parsoid
13750 <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>
13751 !! end
13752
13753 !! test
13754 Parsoid-specific image handling - lang option
13755 !! wikitext
13756 foo
13757 [[File:Foobar.svg|lang=de|caption]]
13758 bar
13759 !! html/parsoid
13760 <p>foo
13761 <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>
13762 bar</p>
13763 !! end
13764
13765 ## Edge case bug in Parsoid
13766 !! test
13767 T93580: Templated <ref> inside images
13768 !! wikitext
13769 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13770
13771 <references />
13772 !! html/parsoid
13773 <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>
13774
13775 <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>
13776 !! end
13777
13778 ###
13779 ### Subpages
13780 ###
13781 !! article
13782 Subpage test/subpage
13783 !! text
13784 foo
13785 !! endarticle
13786
13787 !! test
13788 Subpage link
13789 !! options
13790 subpage title=[[Subpage test]]
13791 !! wikitext
13792 [[/subpage]]
13793 !! html
13794 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13795 </p>
13796 !! end
13797
13798 !! test
13799 Subpage noslash link
13800 !! options
13801 subpage title=[[Subpage test]]
13802 !! wikitext
13803 [[/subpage/]]
13804 !! html
13805 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13806 </p>
13807 !! end
13808
13809 !! article
13810 Subpage test/1/2/subpage
13811 !! text
13812 blah
13813 !! endarticle
13814
13815 !! test
13816 Relative subpage noslash link
13817 !! options
13818 parsoid=wt2wt,wt2html,html2html
13819 subpage title=[[Subpage test/1/2/3/4]]
13820 !! wikitext
13821 [[../../subpage/]]
13822
13823 [[../../subpage]]
13824 !! html/php
13825 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13826 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13827 </p>
13828 !! html/parsoid
13829 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13830 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13831 !! end
13832
13833 !! test
13834 Parsoid: dot-slash prefixed wikilinks
13835 !! wikitext
13836 [[./foo]]
13837
13838 [[././bar]]
13839
13840 [[././baz/]]
13841 !! html/php
13842 <p>[[./foo]]
13843 </p><p>[[././bar]]
13844 </p><p>[[././baz/]]
13845 </p>
13846 !! html/parsoid
13847 <p>[[./foo]]
13848 </p><p>[[././bar]]
13849 </p><p>[[././baz/]]
13850 </p>
13851 !! end
13852
13853 !! test
13854 Render invalid page names as plain text (bug 51090)
13855 !! wikitext
13856 [[./../foo|bar]]
13857 [[foo�|bar]]
13858 [[foo/.|bar]]
13859 [[foo/..|bar]]
13860 [[foo~~~bar]]
13861 [[foo>bar]]
13862 [[foo[bar]]
13863 [[.]]
13864 [[..]]
13865 [[foo././bar]]
13866
13867 [[{{echo|./../foo}}|bar]]
13868 [[{{echo|foo/.}}|bar]]
13869 [[{{echo|foo/..}}|bar]]
13870 [[{{echo|foo~~~~bar}}]]
13871 [[{{echo|foo>bar}}]]
13872 [[{{echo|foo././bar}}]]
13873 [[{{echo|foo{bar}}]]
13874 [[{{echo|foo}bar}}]]
13875 [[{{echo|foo[bar}}]]
13876 [[{{echo|foo]bar}}]]
13877 [[{{echo|foo<bar}}]]
13878 !!html/php
13879 <p>[[./../foo|bar]]
13880 [[foo�|bar]]
13881 [[foo/.|bar]]
13882 [[foo/..|bar]]
13883 [[foo~~~bar]]
13884 [[foo&gt;bar]]
13885 [[foo[bar]]
13886 [[.]]
13887 [[..]]
13888 [[foo././bar]]
13889 </p><p>[[./../foo|bar]]
13890 [[foo/.|bar]]
13891 [[foo/..|bar]]
13892 [[foo~~~~bar]]
13893 [[foo&gt;bar]]
13894 [[foo././bar]]
13895 [[foo{bar]]
13896 [[foo}bar]]
13897 [[foo[bar]]
13898 [[foo]bar]]
13899 [[foo&lt;bar]]
13900 </p>
13901 !!html/parsoid
13902 <p>[[./../foo|bar]]
13903 [[foo�|bar]]
13904 [[foo/.|bar]]
13905 [[foo/..|bar]]
13906 [[foo~~~bar]]
13907 [[foo>bar]]
13908 [[foo[bar]]
13909 [[.]]
13910 [[..]]
13911 [[foo././bar]]</p>
13912
13913 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13914 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13915 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13916 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13917 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13918 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13919 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13920 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13921 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13922 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13923 [[<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>
13924 !!end
13925
13926 !! test
13927 Disabled subpages
13928 !! wikitext
13929 [[/subpage]]
13930 !! html
13931 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13932 </p>
13933 !! end
13934
13935 !! test
13936 BUG 561: {{/Subpage}}
13937 !! options
13938 subpage title=[[Page]]
13939 !! wikitext
13940 {{/Subpage}}
13941 !! html
13942 <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>
13943 </p>
13944 !! end
13945
13946 ###
13947 ### Categories
13948 ###
13949 !! article
13950 Category:MediaWiki User's Guide
13951 !! text
13952 blah
13953 !! endarticle
13954
13955 !! test
13956 Link to category
13957 !! wikitext
13958 [[:Category:MediaWiki User's Guide]]
13959 !! html
13960 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13961 </p>
13962 !! end
13963
13964 !! test
13965 Simple category
13966 !! options
13967 cat
13968 !! wikitext
13969 [[Category:MediaWiki User's Guide]]
13970 !! html
13971 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13972 !! end
13973
13974 !! test
13975 PAGESINCATEGORY invalid title fatal (r33546 fix)
13976 !! wikitext
13977 {{PAGESINCATEGORY:<bogus>}}
13978 !! html
13979 <p>0
13980 </p>
13981 !! end
13982
13983 !! test
13984 Category with different sort key
13985 !! options
13986 cat
13987 !! wikitext
13988 [[Category:MediaWiki User's Guide|Foo]]
13989 !! html
13990 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13991 !! end
13992
13993 !! test
13994 Category with identical sort key
13995 !! options
13996 cat
13997 !! wikitext
13998 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13999 !! html
14000 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14001 !! end
14002
14003 !! test
14004 Category with empty sort key
14005 !! options
14006 cat
14007 pst
14008 !! wikitext
14009 [[Category:MediaWiki User's Guide|]]
14010 !! html
14011 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14012 !! end
14013
14014 !! test
14015 Category with empty sort key and parentheses
14016 !! options
14017 cat
14018 pst
14019 !! wikitext
14020 [[Category:Foo (bar)|]]
14021 !! html
14022 [[Category:Foo (bar)|Foo]]
14023 !! end
14024
14025 !! test
14026 Category with link tail
14027 !! options
14028 cat
14029 pst
14030 !! wikitext
14031 123[[Category:Foo]]456
14032 !! html
14033 123[[Category:Foo]]456
14034 !! end
14035
14036 !! test
14037 Category with template
14038 !! options
14039 cat
14040 pst
14041 !! wikitext
14042 [[Category:{{echo|Foo}}]]
14043 !! html
14044 [[Category:{{echo|Foo}}]]
14045 !! end
14046
14047 !! test
14048 Category with template in sort key
14049 !! options
14050 cat
14051 pst
14052 !! wikitext
14053 [[Category:Foo|{{echo|Bar}}]]
14054 !! html
14055 [[Category:Foo|{{echo|Bar}}]]
14056 !! end
14057
14058 !! test
14059 Category with template in sort key and title
14060 !! options
14061 cat
14062 pst
14063 !! wikitext
14064 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14065 !! html
14066 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14067 !! end
14068
14069 !! test
14070 Category / paragraph interactions
14071 !! wikitext
14072 Foo [[Category:Baz]] Bar
14073
14074 Foo [[Category:Baz]]
14075 Bar
14076
14077 Foo
14078 [[Category:Baz]]
14079 Bar
14080
14081 Foo
14082 [[Category:Baz]] Bar
14083
14084 Foo
14085 [[Category:Baz]]
14086 [[Category:Baz]]
14087 [[Category:Baz]]
14088 Bar
14089
14090 [[Category:Baz]]
14091 [[Category:Baz]]
14092 [[Category:Baz]]
14093
14094 [[Category:Baz]]
14095 {{echo|[[Category:Baz]]}}
14096 [[Category:Baz]]
14097 !! html
14098 <p>Foo Bar
14099 </p><p>Foo
14100 Bar
14101 </p><p>Foo
14102 Bar
14103 </p><p>Foo Bar
14104 </p><p>Foo
14105 Bar
14106 </p>
14107 !! end
14108
14109 ## The whitespace on the empty line is part of the test. Please do not delete
14110 !! test
14111 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14112 !! options
14113 parsoid=wt2html,wt2wt
14114 !! wikitext
14115 This
14116
14117 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14118
14119 {{echo|[[Category:Foo]] and so should this!}}
14120 !! html
14121 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14122 </p>
14123 !! html/parsoid
14124 <p>This
14125
14126 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14127
14128 <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>
14129 !! end
14130
14131 ## Parsoid will not try to wt2wt this while preserving newlines because
14132 ## it suppresses excess newlines within list items -- and we don't want to
14133 ## introduce a special case just for categories, which is, in reality somewhat
14134 ## odd behavior -- categories are unlikely to be used in list items like this
14135 ## in top-level pages and are only likely to show up in template-generated
14136 ## list items where this RT-ing is a non-issue.
14137 ##
14138 ## The whitespace on the empty line is part of the test. Please do not delete
14139 !! test
14140 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14141 !! options
14142 parsoid=wt2html
14143 !! wikitext
14144 * This
14145
14146 [[Category:Foo]] and this should be part of the same list item
14147 * So should this
14148
14149 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14150 !! html
14151 <ul><li>This and this should be part of the same list item</li>
14152 <li>So should this and this should be part of the same list item</li></ul>
14153 !! html/parsoid
14154 <ul>
14155 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14156 <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>
14157 </ul>
14158 !! end
14159
14160 ## Newlines and categories that follow the last item of a list
14161 ## are treated differently because this (list followed by categories)
14162 ## is an extremely common pattern on wikis.
14163 !! test
14164 3. Categories and newlines: newline suppression for last list item should RT properly
14165 !! wikitext
14166 * a
14167 * b
14168
14169 [[Category:Foo]]
14170
14171 [[Category:Bar]]
14172 [[Category:Baz]]
14173 !! html/parsoid
14174 <ul><li> a</li>
14175 <li> b</li></ul>
14176
14177 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14178
14179 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14180 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14181 !! end
14182
14183 !! test
14184 4. Categories and newlines: newline suppression for last list item should RT properly
14185 !! wikitext
14186 * a
14187 **** b
14188
14189 [[Category:Foo]]
14190 !! html/parsoid
14191 <ul><li> a
14192 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14193
14194 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14195 !! end
14196
14197 ## only wt2html for this to make sure the algo only applies to the rightmost path
14198 !! test
14199 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14200 !! options
14201 parsoid=wt2html
14202 !! wikitext
14203 * a
14204 ** b
14205 [[Category:Foo]]
14206 * c
14207 ** d
14208 [[Category:Foo]]
14209 !! html/parsoid
14210 <ul><li> a
14211 <ul><li> b
14212 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14213 <li> c
14214 <ul><li> d</li></ul></li></ul>
14215 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14216 !! end
14217
14218 !! test
14219 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14220 !! wikitext
14221 * a [[Category:Foo]]
14222 !! html/parsoid
14223 <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>
14224 !! end
14225
14226 # This test also demonstrates because of newline+category tunneling
14227 # through the list hander, template wrapping doesn't expand to the
14228 # containing list when the list item swallows the category.
14229 !! test
14230 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14231 !! wikitext
14232 * {{echo|a
14233 [[Category:Foo]]}}
14234 !! html/parsoid
14235 <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">
14236 </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>
14237 !! end
14238
14239 !! test
14240 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14241 !! wikitext
14242 * a
14243
14244 {{echo|[[Category:Foo]]
14245 [[Category:Bar]]}}
14246 [[Category:Baz]]
14247 !! html/parsoid
14248 <ul><li> a</li></ul>
14249
14250 <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">
14251 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14252 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14253 !! end
14254
14255 !! test
14256 Parsoid: Serialize link to category page with colon escape
14257 !! options
14258 parsoid
14259 !! wikitext
14260
14261 [[:Category:Foo]]
14262 [[:Category:Foo|Bar]]
14263 !! html
14264 <p>
14265 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14266 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14267 </p>
14268 !! end
14269
14270 # html2wt localizes the "Category" namespace.
14271 # XXX the <link> element needs an empty data-parsoid attribute, or
14272 # else the html2html test fails because spaces are inserted.
14273 !! test
14274 Link prefix/suffixes aren't applied to category links
14275 !! options
14276 parsoid=wt2html,wt2wt,html2html
14277 language=is
14278 !! wikitext
14279 x[[Category:Foo]]y
14280 !! html/php
14281 <p>xy
14282 </p>
14283 !! html/parsoid
14284 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14285 !! end
14286
14287 !! test
14288 Parsoid: Serialize link to file page with colon escape
14289 !! options
14290 parsoid
14291 !! wikitext
14292
14293 [[:File:Foo.png]]
14294 [[:File:Foo.png|Bar]]
14295 !! html
14296 <p>
14297 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14298 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14299 </p>
14300 !! end
14301
14302 !! test
14303 Parsoid: Serialize a genuine category link without colon escape
14304 !! options
14305 parsoid
14306 !! wikitext
14307 [[Category:Foo]]
14308 [[Category:Foo|Bar]]
14309 !! html
14310 <link rel="mw:PageProp/Category" href="./Category:Foo">
14311 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14312 !! end
14313
14314 !! test
14315 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14316 !! options
14317 parsoid=html2wt
14318 !! html/parsoid
14319 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14320 !! wikitext
14321 [[Category:Toxine bactérienne]]
14322 !! end
14323
14324 !! test
14325 Parsoid: Defaultsort
14326 !! wikitext
14327 {{DEFAULTSORT:Foo}}
14328 !! html/parsoid
14329 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14330 !! end
14331
14332 !! test
14333 Parsoid: Defaultsort (template-generated)
14334 !! wikitext
14335 {{{{echo|DEFAULTSORT}}:Foo}}
14336 !! html/parsoid
14337 <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}}]}'/>
14338 !! end
14339
14340 ###
14341 ### Inter-language links
14342 ###
14343 !! test
14344 Interlanguage links
14345 !! options
14346 ill
14347 !! wikitext
14348 [[es:Alimento]]
14349 [[fr:Nourriture]]
14350 [[zh:食品]]
14351 !! html/php
14352 es:Alimento fr:Nourriture zh:食品
14353 !! html/parsoid
14354 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14355 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14356 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14357 !! end
14358
14359 !! test
14360 Duplicate interlanguage links (bug 24502)
14361 !! options
14362 ill
14363 !! wikitext
14364 [[es:1]]
14365 [[es:2]]
14366 [[fr:1]]
14367 [[fr:2]]
14368 !! html/php
14369 es:1 fr:1
14370 !! html/parsoid
14371 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14372 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14373 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14374 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14375 !! end
14376
14377 ###
14378 ### Sections
14379 ###
14380 !! test
14381 Basic section headings
14382 !! wikitext
14383 == Headline 1 ==
14384 Some text
14385
14386 ==Headline 2==
14387 More
14388 ===Smaller headline===
14389 Blah blah
14390 !! html
14391 <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>
14392 <p>Some text
14393 </p>
14394 <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>
14395 <p>More
14396 </p>
14397 <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>
14398 <p>Blah blah
14399 </p>
14400 !! end
14401
14402 !! test
14403 Section headings with TOC
14404 !! wikitext
14405 == Headline 1 ==
14406 === Subheadline 1 ===
14407 ===== Skipping a level =====
14408 ====== Skipping a level ======
14409
14410 == Headline 2 ==
14411 Some text
14412 ===Another headline===
14413 !! html
14414 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14415 <ul>
14416 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14417 <ul>
14418 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14419 <ul>
14420 <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>
14421 <ul>
14422 <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>
14423 </ul>
14424 </li>
14425 </ul>
14426 </li>
14427 </ul>
14428 </li>
14429 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14430 <ul>
14431 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14432 </ul>
14433 </li>
14434 </ul>
14435 </div>
14436
14437 <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>
14438 <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>
14439 <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>
14440 <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>
14441 <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>
14442 <p>Some text
14443 </p>
14444 <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>
14445
14446 !! end
14447
14448 !! test
14449 TOC anchors don't collide
14450 !! wikitext
14451 __FORCETOC__
14452 == Headline 2 ==
14453 == Headline ==
14454 == Headline 2 ==
14455 == Headline ==
14456 !! html/php
14457 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14458 <ul>
14459 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14460 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14461 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14462 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14463 </ul>
14464 </div>
14465
14466 <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>
14467 <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>
14468 <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>
14469 <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>
14470
14471 !! end
14472
14473 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14474 !! test
14475 Handling of sections up to level 6 and beyond
14476 !! wikitext
14477 = Level 1 Heading=
14478 == Level 2 Heading==
14479 === Level 3 Heading===
14480 ==== Level 4 Heading====
14481 ===== Level 5 Heading=====
14482 ====== Level 6 Heading======
14483 ======= Level 7 Heading=======
14484 ======== Level 8 Heading========
14485 ========= Level 9 Heading=========
14486 ========== Level 10 Heading==========
14487 !! html
14488 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14489 <ul>
14490 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14491 <ul>
14492 <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>
14493 <ul>
14494 <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>
14495 <ul>
14496 <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>
14497 <ul>
14498 <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>
14499 <ul>
14500 <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>
14501 <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>
14502 <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>
14503 <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>
14504 <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>
14505 </ul>
14506 </li>
14507 </ul>
14508 </li>
14509 </ul>
14510 </li>
14511 </ul>
14512 </li>
14513 </ul>
14514 </li>
14515 </ul>
14516 </div>
14517
14518 <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>
14519 <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>
14520 <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>
14521 <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>
14522 <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>
14523 <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>
14524 <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>
14525 <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>
14526 <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>
14527 <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>
14528
14529 !! end
14530
14531 !! test
14532 TOC regression (T11764)
14533 !! wikitext
14534 == title 1 ==
14535 === title 1.1 ===
14536 ==== title 1.1.1 ====
14537 === title 1.2 ===
14538 == title 2 ==
14539 === title 2.1 ===
14540 !! html
14541 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14542 <ul>
14543 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14544 <ul>
14545 <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>
14546 <ul>
14547 <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>
14548 </ul>
14549 </li>
14550 <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>
14551 </ul>
14552 </li>
14553 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14554 <ul>
14555 <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>
14556 </ul>
14557 </li>
14558 </ul>
14559 </div>
14560
14561 <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>
14562 <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>
14563 <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>
14564 <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>
14565 <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>
14566 <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>
14567
14568 !! end
14569
14570 !! test
14571 TOC for heading containing <span id="..."></span> (T96153)
14572 !! wikitext
14573 __FORCETOC__
14574 ==<span id="old-anchor"></span>New title==
14575 !! html/php
14576 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14577 <ul>
14578 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14579 </ul>
14580 </div>
14581
14582 <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>
14583
14584 !! end
14585
14586 !! test
14587 TOC with wgMaxTocLevel=3 (bug 6204)
14588 !! options
14589 wgMaxTocLevel=3
14590 !! wikitext
14591 == title 1 ==
14592 === title 1.1 ===
14593 ==== title 1.1.1 ====
14594 === title 1.2 ===
14595 == title 2 ==
14596 === title 2.1 ===
14597 !! html
14598 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14599 <ul>
14600 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14601 <ul>
14602 <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>
14603 <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>
14604 </ul>
14605 </li>
14606 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14607 <ul>
14608 <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>
14609 </ul>
14610 </li>
14611 </ul>
14612 </div>
14613
14614 <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>
14615 <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>
14616 <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>
14617 <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>
14618 <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>
14619 <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>
14620
14621 !! end
14622
14623 !! test
14624 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14625 !! options
14626 wgMaxTocLevel=3
14627 !! wikitext
14628 ==Section 1==
14629 ===Section 1.1===
14630 ====Section 1.1.1====
14631 ====Section 1.1.1.1====
14632 ==Section 2==
14633 !! html
14634 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14635 <ul>
14636 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14637 <ul>
14638 <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>
14639 </ul>
14640 </li>
14641 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14642 </ul>
14643 </div>
14644
14645 <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>
14646 <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>
14647 <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>
14648 <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>
14649 <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>
14650
14651 !! end
14652
14653
14654 !! test
14655 Resolving duplicate section names
14656 !! wikitext
14657 == Foo bar ==
14658 == Foo bar ==
14659 !! html
14660 <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>
14661 <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>
14662
14663 !! end
14664
14665 !! test
14666 Resolving duplicate section names with differing case (bug 10721)
14667 !! wikitext
14668 == Foo bar ==
14669 == Foo Bar ==
14670 !! html
14671 <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>
14672 <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>
14673
14674 !! end
14675
14676 !! article
14677 Template:sections
14678 !! text
14679 ===Section 1===
14680 ==Section 2==
14681 !! endarticle
14682
14683 !! test
14684 Template with sections, __NOTOC__
14685 !! wikitext
14686 __NOTOC__
14687 ==Section 0==
14688 {{sections}}
14689 ==Section 4==
14690 !! html
14691 <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>
14692 <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>
14693 <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>
14694 <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>
14695
14696 !! end
14697
14698 !! test
14699 __NOEDITSECTION__ keyword
14700 !! wikitext
14701 __NOEDITSECTION__
14702 ==Section 1==
14703 ==Section 2==
14704 !! html
14705 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14706 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14707
14708 !! end
14709
14710 !! test
14711 Link inside a section heading
14712 !! wikitext
14713 ==Section with a [[Main Page|link]] in it==
14714 !! html
14715 <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>
14716
14717 !! end
14718
14719 !! test
14720 TOC regression (T14077)
14721 !! wikitext
14722 __TOC__
14723 == title 1 ==
14724 === title 1.1 ===
14725 == title 2 ==
14726 !! html
14727 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14728 <ul>
14729 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14730 <ul>
14731 <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>
14732 </ul>
14733 </li>
14734 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14735 </ul>
14736 </div>
14737
14738 <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>
14739 <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>
14740 <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>
14741
14742 !! end
14743
14744 !! test
14745 BUG 1219 URL next to image (good)
14746 !! wikitext
14747 http://example.com [[File:Foobar.jpg]]
14748 !! html/php
14749 <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>
14750 </p>
14751 !! html/parsoid
14752 <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>
14753 !!end
14754
14755 !! test
14756 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14757 !! wikitext
14758 ===
14759 The line above must have a trailing space!
14760 === <!--
14761 --> <!-- -->
14762 But just in case it doesn't...
14763 !! html
14764 <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>
14765 <p>The line above must have a trailing space!
14766 </p>
14767 <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>
14768 <p>But just in case it doesn't...
14769 </p>
14770 !! end
14771
14772 !! test
14773 Header with special characters (bug 25462)
14774 !! wikitext
14775 The tooltips shall not show entities to the user (ie. be double escaped)
14776
14777 == text > text ==
14778 section 1
14779
14780 == text < text ==
14781 section 2
14782
14783 == text & text ==
14784 section 3
14785
14786 == text ' text ==
14787 section 4
14788
14789 == text " text ==
14790 section 5
14791 !! html
14792 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14793 </p>
14794 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14795 <ul>
14796 <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>
14797 <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>
14798 <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>
14799 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14800 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14801 </ul>
14802 </div>
14803
14804 <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>
14805 <p>section 1
14806 </p>
14807 <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>
14808 <p>section 2
14809 </p>
14810 <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>
14811 <p>section 3
14812 </p>
14813 <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>
14814 <p>section 4
14815 </p>
14816 <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>
14817 <p>section 5
14818 </p>
14819 !! end
14820
14821 !! test
14822 Header with space, plus and underscore as entity
14823 !! wikitext
14824 Id should not contain + for spaces
14825
14826 == Space between Text ==
14827 section 1
14828
14829 == Space-Entity&#32;between&#32;Text ==
14830 section 2
14831
14832 == Plus+between+Text ==
14833 section 3
14834
14835 == Plus-Entity&#43;between&#43;Text ==
14836 section 4
14837
14838 == Underscore_between_Text ==
14839 section 5
14840
14841 == Underscore-Entity&#95;between&#95;Text ==
14842 section 6
14843
14844 [[#Space between Text]]
14845 [[#Space-Entity&#32;between&#32;Text]]
14846 [[#Plus+between+Text]]
14847 [[#Plus-Entity&#43;between&#43;Text]]
14848 [[#Underscore_between_Text]]
14849 [[#Underscore-Entity&#95;between&#95;Text]]
14850 !! html
14851 <p>Id should not contain + for spaces
14852 </p>
14853 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14854 <ul>
14855 <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>
14856 <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>
14857 <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>
14858 <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>
14859 <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>
14860 <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>
14861 </ul>
14862 </div>
14863
14864 <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>
14865 <p>section 1
14866 </p>
14867 <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>
14868 <p>section 2
14869 </p>
14870 <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>
14871 <p>section 3
14872 </p>
14873 <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>
14874 <p>section 4
14875 </p>
14876 <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>
14877 <p>section 5
14878 </p>
14879 <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>
14880 <p>section 6
14881 </p><p><a href="#Space_between_Text">#Space between Text</a>
14882 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14883 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14884 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14885 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14886 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14887 </p>
14888 !! end
14889
14890 !! test
14891 Headers with excess '=' characters
14892 (Are similar tests necessary beyond the 1st level?)
14893 !! wikitext
14894 =foo==
14895 ==foo=
14896 =''italic'' heading==
14897 ==''italic'' heading=
14898 !! html
14899 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14900 <ul>
14901 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14902 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14903 <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>
14904 <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>
14905 </ul>
14906 </div>
14907
14908 <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>
14909 <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>
14910 <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>
14911 <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>
14912
14913 !! end
14914
14915 !! test
14916 HTML headers vs TOC (bug 23393)
14917 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14918 !! wikitext
14919 <h1>Header 1</h1>
14920 == Header 1.1 ==
14921 == Header 1.2 ==
14922
14923 <h1>Header 2
14924 </h1>
14925 == Header 2.1 ==
14926 == Header 2.2 ==
14927 __NOEDITSECTION__
14928 !! html
14929 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14930 <ul>
14931 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14932 <ul>
14933 <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>
14934 <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>
14935 </ul>
14936 </li>
14937 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14938 <ul>
14939 <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>
14940 <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>
14941 </ul>
14942 </li>
14943 </ul>
14944 </div>
14945
14946 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14947 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14948 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14949 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14950 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14951 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14952
14953 !! end
14954
14955 !! test
14956 Single-line or multiline-comments can follow headings
14957 !! options
14958 parsoid=wt2html,wt2wt
14959 !! wikitext
14960 ==foo==<!---->
14961 ==bar==<!--c1-->
14962 ==baz==<!--
14963 c2
14964 c3-->
14965 !! html
14966 <h2><span class="mw-headline" id="foo">foo</span></h2>
14967 <h2><span class="mw-headline" id="bar">bar</span></h2>
14968 <h2><span class="mw-headline" id="baz">baz</span></h2>
14969
14970 !! end
14971
14972 !! test
14973 BUG 1219 URL next to image (broken)
14974 !! wikitext
14975 http://example.com[[File:Foobar.jpg]]
14976 !! html/php
14977 <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>
14978 </p>
14979 !! html/parsoid
14980 <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>
14981 !!end
14982
14983 !! test
14984 Bug 1186 news: in the middle of text
14985 !! wikitext
14986 http://en.wikinews.org/wiki/Wikinews:Workplace
14987 !! html
14988 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14989 </p>
14990 !!end
14991
14992
14993 !! test
14994 Namespaced link must have a title
14995 !! wikitext
14996 [[Project:]]
14997 !! html
14998 <p>[[Project:]]
14999 </p>
15000 !!end
15001
15002 !! test
15003 Namespaced link must have a title (bad fragment version)
15004 !! wikitext
15005 [[Project:#fragment]]
15006 !! html
15007 <p>[[Project:#fragment]]
15008 </p>
15009 !!end
15010
15011
15012 ###
15013 ### HTML tags and HTML attributes
15014 ###
15015
15016 !! test
15017 div with no attributes
15018 !! wikitext
15019 <div>HTML rocks</div>
15020 !! html
15021 <div>HTML rocks</div>
15022
15023 !! end
15024
15025 !! test
15026 div with double-quoted attribute
15027 !! wikitext
15028 <div id="rock">HTML rocks</div>
15029 !! html
15030 <div id="rock">HTML rocks</div>
15031
15032 !! end
15033
15034 !! test
15035 div with single-quoted attribute
15036 !! wikitext
15037 <div id='rock'>HTML rocks</div>
15038 !! html
15039 <div id="rock">HTML rocks</div>
15040
15041 !! end
15042
15043 !! test
15044 div with unquoted attribute
15045 !! wikitext
15046 <div id=rock>HTML rocks</div>
15047 !! html
15048 <div id="rock">HTML rocks</div>
15049
15050 !! end
15051
15052 !! test
15053 div with illegal double attributes
15054 !! wikitext
15055 <div id="a" id="b">HTML rocks</div>
15056 !! html
15057 <div id="b">HTML rocks</div>
15058
15059 !!end
15060
15061 # FIXME: produce empty string instead of "class" in the PHP parser, following
15062 # the HTML5 spec.
15063 !! test
15064 div with empty attribute value, space before equals
15065 !! options
15066 parsoid
15067 !! wikitext
15068 <div class =>HTML rocks</div>
15069 !! html
15070 <div class="">HTML rocks</div>
15071
15072 !! end
15073
15074 !! test
15075 div with multiple empty attribute values
15076 !! options
15077 parsoid
15078 !! wikitext
15079 <div id= title=>HTML rocks</div>
15080 !! html
15081 <div id="" title="">HTML rocks</div>
15082
15083 !! end
15084
15085 !! test
15086 table with multiple empty attribute values
15087 !! options
15088 parsoid
15089 !! wikitext
15090 {| title= id=
15091 | hi
15092 |}
15093 !! html
15094 <table title="" id="">
15095 <tbody><tr><td> hi</td></tr>
15096 </tbody></table>
15097 !! end
15098
15099 !! test
15100 div with braces in attribute value
15101 !! wikitext
15102 <div title="{}">Foo</div>
15103 !! html/php
15104 <div title="&#123;}">Foo</div>
15105
15106 !! html/parsoid
15107 <div title="{}">Foo</div>
15108 !! end
15109
15110 # This it very inconsistent in the PHP parser: it returns
15111 # class="class" if there is a space between the name and the equal sign (see
15112 # 'div with empty attribute value, space before equals'), but strips the
15113 # attribute completely if the space is missing. We hope that not much content
15114 # depends on this, so are implementing the behavior below in Parsoid for
15115 # consistencies' sake.
15116 # FIXME: fix this behavior in the PHP parser?
15117 !! test
15118 div with empty attribute value, no space before equals
15119 !! options
15120 parsoid=wt2html,html2html
15121 !! wikitext
15122 <div class=>HTML rocks</div>
15123 !! html/php
15124 <div>HTML rocks</div>
15125
15126 !! html/parsoid
15127 <div class="">HTML rocks</div>
15128 !! end
15129
15130 !! test
15131 HTML multiple attributes correction
15132 !! wikitext
15133 <p class="error" class="awesome">Awesome!</p>
15134 !! html
15135 <p class="awesome">Awesome!</p>
15136
15137 !!end
15138
15139 !! test
15140 Table multiple attributes correction
15141 !! wikitext
15142 {|
15143 !+ class="error" class="awesome"| status
15144 |}
15145 !! html
15146 <table>
15147 <tr>
15148 <th class="awesome"> status
15149 </th></tr></table>
15150
15151 !!end
15152
15153 !! test
15154 DIV IN UPPERCASE
15155 !! wikitext
15156 <DIV ID="x">HTML ROCKS</DIV>
15157 !! html
15158 <div id="x">HTML ROCKS</div>
15159
15160 !!end
15161
15162 !! test
15163 Non-ASCII pseudo-tags are rendered as text
15164 !! wikitext
15165 <khyô>
15166 !! html
15167 <p>&lt;khyô&gt;
15168 </p>
15169 !! end
15170
15171 !! test
15172 Pseudo-tag with URL 'name' renders as url link
15173 !! wikitext
15174 <http://example.com/>
15175 !! html
15176 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15177 </p>
15178 !! end
15179
15180 !! test
15181 text with amp in the middle of nowhere
15182 !! wikitext
15183 Remember AT&T?
15184 !! html
15185 <p>Remember AT&amp;T?
15186 </p>
15187 !! end
15188
15189 !! test
15190 text with character entity: eacute
15191 !! wikitext
15192 I always thought &eacute; was a cute letter.
15193 !! html
15194 <p>I always thought &#233; was a cute letter.
15195 </p>
15196 !! html+tidy
15197 <p>I always thought é was a cute letter.</p>
15198 !! end
15199
15200 !! test
15201 text with entity-escaped character entity-like string: eacute
15202 !! wikitext
15203 I always thought &amp;eacute; was a cute letter.
15204 !! html
15205 <p>I always thought &amp;eacute; was a cute letter.
15206 </p>
15207 !! end
15208
15209 !! test
15210 text with undefined character entity: xacute
15211 !! wikitext
15212 I always thought &xacute; was a cute letter.
15213 !! html
15214 <p>I always thought &amp;xacute; was a cute letter.
15215 </p>
15216 !! end
15217
15218 !! test
15219 HTML5 tags
15220 !! wikitext
15221 <data value="5">five</data>
15222 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15223 <mark>This highlighted text</mark>
15224 !! html
15225 <p><data value="5">five</data>
15226 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15227 <mark>This highlighted text</mark>
15228 </p>
15229 !! end
15230
15231 !! test
15232 HTML tag with leading space is parsed as text
15233 !! wikitext
15234 < div>foo< /div>
15235 !! html
15236 <p>&lt; div&gt;foo&lt; /div&gt;
15237 </p>
15238 !! end
15239
15240 ###
15241 ### Nesting tests (see bug 41545, 50604, 51081)
15242 ###
15243
15244 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15245 # Note that html2wt is considerably more difficult if we use <b> in
15246 # the test case, instead of <big>
15247 !! test
15248 Ensure that HTML adoption agency algorithm is properly implemented.
15249 !! wikitext
15250 <big>X<big>Y</big>Z</big>
15251 !! html
15252 <p><big>X<big>Y</big>Z</big>
15253 </p>
15254 !! end
15255
15256 # This was bug 41545 in the PHP parser.
15257 # Note that tidy doesn't handle this correctly.
15258 !! test
15259 Nesting of <kbd>
15260 !! wikitext
15261 <kbd>X<kbd>Y</kbd>Z</kbd>
15262 !! html
15263 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15264 </p>
15265 !! end
15266
15267 # The following cases were bug 51081 in the PHP parser.
15268 # Note that there are some other nestable tags (b, i, etc) which are
15269 # not covered; see bug 51081 for discussion.
15270
15271 # Note that tidy doesn't handle this correctly.
15272 !! test
15273 Nesting of <em>
15274 !! wikitext
15275 <em>X<em>Y</em>Z</em>
15276 !! html
15277 <p><em>X<em>Y</em>Z</em>
15278 </p>
15279 !! end
15280
15281 # Note that tidy doesn't handle this correctly.
15282 !! test
15283 Nesting of <strong>
15284 !! wikitext
15285 <strong>X<strong>Y</strong>Z</strong>
15286 !! html
15287 <p><strong>X<strong>Y</strong>Z</strong>
15288 </p>
15289 !! end
15290
15291 !! test
15292 Nesting of <q>
15293 !! wikitext
15294 <q>X<q>Y</q>Z</q>
15295 !! html+tidy
15296 <p><q>X<q>Y</q>Z</q></p>
15297 !! end
15298
15299 # Note that tidy doesn't handle this correctly.
15300 !! test
15301 Nesting of <ruby>
15302 !! wikitext
15303 <ruby>X<ruby>Y</ruby>Z</ruby>
15304 !! html
15305 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15306 </p>
15307 !! end
15308
15309 # Note that tidy doesn't handle this correctly.
15310 !! test
15311 Nesting of <bdo>
15312 !! wikitext
15313 <bdo>X<bdo>Y</bdo>Z</bdo>
15314 !! html
15315 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15316 </p>
15317 !! end
15318
15319
15320 ###
15321 ### Media links
15322 ###
15323
15324 !! test
15325 Media link
15326 !! wikitext
15327 [[Media:Foobar.jpg]]
15328 !! html
15329 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15330 </p>
15331 !! end
15332
15333 !! test
15334 Media link with text
15335 !! wikitext
15336 [[Media:Foobar.jpg|A neat file to look at]]
15337 !! html
15338 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15339 </p>
15340 !! end
15341
15342 # FIXME: this is still bad HTML tag nesting
15343 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15344 !! test
15345 Media link with nasty text
15346 !! wikitext
15347 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15348 !! html
15349 <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>
15350
15351 !! html+tidy
15352 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15353 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15354 !! end
15355
15356 !! test
15357 Media link to nonexistent file (bug 1702)
15358 !! wikitext
15359 [[Media:No such.jpg]]
15360 !! html
15361 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15362 </p>
15363 !! end
15364
15365 !! test
15366 Image link to nonexistent file (bug 1850 - good)
15367 !! wikitext
15368 [[File:No_such.jpg]]
15369 !! html/php
15370 <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>
15371 </p>
15372 !! html/parsoid
15373 <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>
15374 !! end
15375
15376 !! test
15377 :Image link to nonexistent file (bug 1850 - bad)
15378 !! wikitext
15379 [[:Image:No such.jpg]]
15380 !! html/php
15381 <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>
15382 </p>
15383 !! html/parsoid
15384 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15385 !! end
15386
15387
15388
15389 !! test
15390 Character reference normalization in link text (bug 1938)
15391 !! wikitext
15392 [[Main Page|this&that]]
15393 !! html
15394 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15395 </p>
15396 !!end
15397
15398 !! article
15399 אַ
15400 !! text
15401 Test for unicode normalization
15402
15403 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15404 !! endarticle
15405
15406 !! test
15407 (bug 19451) Links should refer to the normalized form.
15408 !! wikitext
15409 [[&#xFB2E;]]
15410 [[&#x5d0;&#x5b7;]]
15411 [[&#x5d0;ַ]]
15412 [[א&#x5b7;]]
15413 [[אַ]]
15414 !! html
15415 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15416 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15417 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15418 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15419 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15420 </p>
15421 !! end
15422
15423 !! test
15424 Empty attribute crash test (bug 2067)
15425 !! wikitext
15426 <font color="">foo</font>
15427 !! html
15428 <p><font color="">foo</font>
15429 </p>
15430 !! end
15431
15432 !! test
15433 Empty attribute crash test single-quotes (bug 2067)
15434 !! wikitext
15435 <font color=''>foo</font>
15436 !! html
15437 <p><font color="">foo</font>
15438 </p>
15439 !! end
15440
15441 !! test
15442 Attribute test: equals, then nothing
15443 !! wikitext
15444 <font color=>foo</font>
15445 !! html
15446 <p><font>foo</font>
15447 </p>
15448 !! end
15449
15450 !! test
15451 Attribute test: unquoted value
15452 !! wikitext
15453 <font color=x>foo</font>
15454 !! html
15455 <p><font color="x">foo</font>
15456 </p>
15457 !! end
15458
15459 !! test
15460 Attribute test: unquoted but illegal value (hash)
15461 !! wikitext
15462 <font color=#x>foo</font>
15463 !! html
15464 <p><font color="#x">foo</font>
15465 </p>
15466 !! end
15467
15468 # Parsoid does not serialize to empty attribute syntax,
15469 # so wt2wt and html2wt cases are skipped
15470 !! test
15471 Attribute test: no value (T54330)
15472 !! options
15473 parsoid=wt2html,html2html
15474 !! wikitext
15475 <font color>foo</font>
15476 !! html/php
15477 <p><font color="">foo</font>
15478 </p>
15479 !! html/parsoid
15480 <p><font color="">foo</font></p>
15481 !! end
15482
15483 !! test
15484 Bug 2095: link with three closing brackets
15485 !! wikitext
15486 [[Main Page]]]
15487 !! html/php
15488 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15489 </p>
15490 !! html/parsoid
15491 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15492 !! end
15493
15494 !! test
15495 Bug 2095: link with pipe and three closing brackets
15496 !! wikitext
15497 [[Main Page|link]]]
15498 !! html/php
15499 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15500 </p>
15501 !! html/parsoid
15502 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15503 !! end
15504
15505 !! test
15506 Bug 2095: link with pipe and three closing brackets, version 2
15507 !! wikitext
15508 [[Main Page|[http://example.com/]]]
15509 !! html/php
15510 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15511 </p>
15512 !! html/parsoid
15513 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15514 !! end
15515
15516
15517 ###
15518 ### Safety
15519 ###
15520
15521 !! article
15522 Template:Dangerous attribute
15523 !! text
15524 " onmouseover="alert(document.cookie)
15525 !! endarticle
15526
15527 !! article
15528 Template:Dangerous style attribute
15529 !! text
15530 border-size: expression(alert(document.cookie))
15531 !! endarticle
15532
15533 !! article
15534 Template:Div style
15535 !! text
15536 <div style="float: right; {{{1}}}">Magic div</div>
15537 !! endarticle
15538
15539 !! test
15540 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15541 !! wikitext
15542 <div title="{{test}}"></div>
15543 !! html
15544 <div title="This is a test template"></div>
15545
15546 !! end
15547
15548 # Parsoid has enough context to handle this case
15549 !! test
15550 Bug 2304: HTML attribute safety (dangerous template; 2309)
15551 !! wikitext
15552 <div title="{{dangerous attribute}}"></div>
15553 !! html/php
15554 <div title=""></div>
15555
15556 !! html/parsoid
15557 <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>
15558 !! end
15559
15560 !! test
15561 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15562 !! wikitext
15563 <div style="{{dangerous style attribute}}"></div>
15564 !! html
15565 <div style="/* insecure input */"></div>
15566
15567 !! end
15568
15569 !! test
15570 Bug 2304: HTML attribute safety (safe parameter; 2309)
15571 !! wikitext
15572 {{div style|width: 200px}}
15573 !! html
15574 <div style="float: right; width: 200px">Magic div</div>
15575
15576 !! end
15577
15578 !! test
15579 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15580 !! wikitext
15581 {{div style|width: expression(alert(document.cookie))}}
15582 !! html
15583 <div style="/* insecure input */">Magic div</div>
15584
15585 !! end
15586
15587 !! test
15588 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15589 !! wikitext
15590 {{div style|"><script>alert(document.cookie)</script>}}
15591 !! html
15592 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15593
15594 !! end
15595
15596 !! test
15597 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15598 !! wikitext
15599 {{div style|" ><script>alert(document.cookie)</script>}}
15600 !! html
15601 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15602
15603 !! end
15604
15605 !! test
15606 Bug 2304: HTML attribute safety (link)
15607 !! wikitext
15608 <div title="[[Main Page]]"></div>
15609 !! html
15610 <div title="&#91;&#91;Main Page]]"></div>
15611
15612 !! end
15613
15614 !! test
15615 Bug 2304: HTML attribute safety (italics)
15616 !! wikitext
15617 <div title="''foobar''"></div>
15618 !! html
15619 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15620
15621 !! end
15622
15623 !! test
15624 Bug 2304: HTML attribute safety (bold)
15625 !! wikitext
15626 <div title="'''foobar'''"></div>
15627 !! html
15628 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15629
15630 !! end
15631
15632
15633 !! test
15634 Bug 2304: HTML attribute safety (ISBN)
15635 !! wikitext
15636 <div title="ISBN 1234567890"></div>
15637 !! html
15638 <div title="&#73;SBN 1234567890"></div>
15639
15640 !! end
15641
15642 !! test
15643 Bug 2304: HTML attribute safety (RFC)
15644 !! wikitext
15645 <div title="RFC 1234"></div>
15646 !! html
15647 <div title="&#82;FC 1234"></div>
15648
15649 !! end
15650
15651 !! test
15652 Bug 2304: HTML attribute safety (PMID)
15653 !! wikitext
15654 <div title="PMID 1234567890"></div>
15655 !! html
15656 <div title="&#80;MID 1234567890"></div>
15657
15658 !! end
15659
15660 !! test
15661 Bug 2304: HTML attribute safety (web link)
15662 !! wikitext
15663 <div title="http://example.com/"></div>
15664 !! html
15665 <div title="http&#58;//example.com/"></div>
15666
15667 !! end
15668
15669 !! test
15670 Bug 2304: HTML attribute safety (named web link)
15671 !! wikitext
15672 <div title="[http://example.com/ link]"></div>
15673 !! html
15674 <div title="&#91;http&#58;//example.com/ link]"></div>
15675
15676 !! end
15677
15678 !! test
15679 Bug 3244: HTML attribute safety (extension; safe)
15680 !! wikitext
15681 <div style="<nowiki>background:blue</nowiki>"></div>
15682 !! html
15683 <div style="background:blue"></div>
15684
15685 !! end
15686
15687 !! test
15688 Bug 3244: HTML attribute safety (extension; unsafe)
15689 !! wikitext
15690 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15691 !! html
15692 <div style="/* insecure input */"></div>
15693
15694 !! end
15695
15696 # More MSIE fun discovered by Tom Gilder
15697
15698 !! test
15699 MSIE CSS safety test: spurious slash
15700 !! wikitext
15701 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15702 !! html
15703 <div style="/* insecure input */">evil</div>
15704
15705 !! end
15706
15707 !! test
15708 MSIE CSS safety test: hex code
15709 !! wikitext
15710 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15711 !! html
15712 <div style="/* insecure input */">evil</div>
15713
15714 !! end
15715
15716 !! test
15717 MSIE CSS safety test: comment in url
15718 !! wikitext
15719 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15720 !! html
15721 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15722
15723 !! end
15724
15725 !! test
15726 MSIE CSS safety test: comment in expression
15727 !! wikitext
15728 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15729 !! html
15730 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15731
15732 !! end
15733
15734 !! test
15735 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15736 !! wikitext
15737 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15738 !! html
15739 <p style="/* invalid control char */">A</p>
15740
15741 !! end
15742
15743 !! test
15744 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15745 !! wikitext
15746 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15747 <div style="top:EXPRESSION(alert())">B</div>
15748 !! html
15749 <p style="/* insecure input */">A</p>
15750 <div style="/* insecure input */">B</div>
15751
15752 !! end
15753
15754 !! test
15755 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15756 !! wikitext
15757 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15758 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15759 !! html
15760 <div style="/* insecure input */">A</div>
15761 <p style="/* insecure input */">B</p>
15762
15763 !! end
15764
15765 !! test
15766 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15767 !! wikitext
15768 <div style="background-image:url⁽javascript:alert())">A</div>
15769 <div style="background-image:url₍javascript:alert())">B</div>
15770 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15771 !! html
15772 <div style="/* insecure input */">A</div>
15773 <div style="/* insecure input */">B</div>
15774 <p style="/* insecure input */">C</p>
15775
15776 !! end
15777
15778 !! test
15779 Opera -o-link CSS
15780 !! wikitext
15781 <div
15782 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;"
15783 style="-o-link:attr(title);-o-link-source:current">X</div>
15784 !! html
15785 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15786
15787 !! end
15788
15789 !! test
15790 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15791 !! wikitext
15792 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15793 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15794 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15795 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15796 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15797 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15798 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15799 !! html
15800 <p style="/* insecure input */">A</p>
15801 <p style="/* insecure input */">B</p>
15802 <p style="/* insecure input */">C</p>
15803 <p style="/* insecure input */">D</p>
15804 <p style="/* insecure input */">E</p>
15805 <p style="/* insecure input */">F</p>
15806 <p style="/* insecure input */">G</p>
15807
15808 !! end
15809
15810 !! test
15811 Table attribute legitimate extension
15812 !! wikitext
15813 {|
15814 !+ style="<nowiki>color:blue</nowiki>"| status
15815 |}
15816 !! html
15817 <table>
15818 <tr>
15819 <th style="color:blue"> status
15820 </th></tr></table>
15821
15822 !!end
15823
15824 !! test
15825 Table attribute safety
15826 !! wikitext
15827 {|
15828 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15829 |}
15830 !! html
15831 <table>
15832 <tr>
15833 <th style="/* insecure input */"> status
15834 </th></tr></table>
15835
15836 !! end
15837
15838 !! test
15839 CSS line continuation 1
15840 !! wikitext
15841 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15842 !! html
15843 <div style="/* insecure input */"></div>
15844
15845 !! end
15846
15847 !! test
15848 CSS line continuation 2
15849 !! wikitext
15850 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15851 !! html
15852 <div style="/* invalid control char */"></div>
15853
15854 !! end
15855
15856 !! article
15857 Template:Identity
15858 !! text
15859 {{{1}}}
15860 !! endarticle
15861
15862 !! test
15863 Expansion of multi-line templates in attribute values (bug 6255)
15864 !! wikitext
15865 <div style="background: {{identity|#00FF00}}">-</div>
15866 !! html
15867 <div style="background: #00FF00">-</div>
15868
15869 !! end
15870
15871
15872 !! test
15873 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15874 !! wikitext
15875 <div style="background:
15876 #00FF00">-</div>
15877 !! html/php
15878 <div style="background: #00FF00">-</div>
15879
15880 !! html/parsoid
15881 <div style="background:
15882 #00FF00">-</div>
15883 !! end
15884
15885 !! test
15886 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15887 !! wikitext
15888 <div style="background: &#10;#00FF00">-</div>
15889 !! html
15890 <div style="background: &#10;#00FF00">-</div>
15891
15892 !! end
15893
15894 !! test
15895 evil <math>-wiki-tags without Extension:Math enabled
15896 !! wikitext
15897 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15898 !! html+tidy
15899 <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>
15900 !! end
15901
15902 ###
15903 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15904 ###
15905 !! test
15906 Parser hook: empty input
15907 !! wikitext
15908 <tag></tag>
15909 !! html/php
15910 <pre>
15911 ''
15912 array (
15913 )
15914 </pre>
15915
15916 !! end
15917
15918 !! test
15919 Parser hook: empty input using terminated empty elements
15920 !! wikitext
15921 <tag/>
15922 !! html/php
15923 <pre>
15924 NULL
15925 array (
15926 )
15927 </pre>
15928
15929 !! end
15930
15931 !! test
15932 Parser hook: empty input using terminated empty elements (space before)
15933 !! wikitext
15934 <tag />
15935 !! html/php
15936 <pre>
15937 NULL
15938 array (
15939 )
15940 </pre>
15941
15942 !! end
15943
15944 !! test
15945 Parser hook: basic input
15946 !! wikitext
15947 <tag>input</tag>
15948 !! html/php
15949 <pre>
15950 'input'
15951 array (
15952 )
15953 </pre>
15954
15955 !! end
15956
15957
15958 !! test
15959 Parser hook: case insensitive
15960 !! wikitext
15961 <TAG>input</TAG>
15962 !! html/php
15963 <pre>
15964 'input'
15965 array (
15966 )
15967 </pre>
15968
15969 !! end
15970
15971
15972 !! test
15973 Parser hook: case insensitive, redux
15974 !! wikitext
15975 <TaG>input</TAg>
15976 !! html/php
15977 <pre>
15978 'input'
15979 array (
15980 )
15981 </pre>
15982
15983 !! end
15984
15985 !! test
15986 Parser hook: nested tags
15987 !! options
15988 noxml
15989 !! wikitext
15990 <tag><tag></tag></tag>
15991 !! html/php
15992 <pre>
15993 '<tag>'
15994 array (
15995 )
15996 </pre>&lt;/tag&gt;
15997
15998 !! end
15999
16000 !! test
16001 Parser hook: basic arguments
16002 !! wikitext
16003 <tag width=200 height = "100" depth = '50' square></tag>
16004 !! html/php
16005 <pre>
16006 ''
16007 array (
16008 'width' => '200',
16009 'height' => '100',
16010 'depth' => '50',
16011 'square' => '',
16012 )
16013 </pre>
16014
16015 !! end
16016
16017 !! test
16018 Parser hook: argument containing a forward slash (bug 5344)
16019 !! wikitext
16020 <tag filename='/tmp/bla'></tag>
16021 !! html/php
16022 <pre>
16023 ''
16024 array (
16025 'filename' => '/tmp/bla',
16026 )
16027 </pre>
16028
16029 !! end
16030
16031 !! test
16032 Parser hook: empty input using terminated empty elements (bug 2374)
16033 !! wikitext
16034 <tag foo=bar/>text
16035 !! html/php
16036 <pre>
16037 NULL
16038 array (
16039 'foo' => 'bar',
16040 )
16041 </pre>text
16042
16043 !! end
16044
16045 # </tag> should be output literally since there is no matching tag that begins it
16046 !! test
16047 Parser hook: basic arguments using terminated empty elements (bug 2374)
16048 !! wikitext
16049 <tag width=200 height = "100" depth = '50' square/>
16050 other stuff
16051 </tag>
16052 !! html/php
16053 <pre>
16054 NULL
16055 array (
16056 'width' => '200',
16057 'height' => '100',
16058 'depth' => '50',
16059 'square' => '',
16060 )
16061 </pre>
16062 <p>other stuff
16063 &lt;/tag&gt;
16064 </p>
16065 !! end
16066
16067 ###
16068 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16069 ###
16070
16071 !! test
16072 Parser hook: static parser hook not inside a comment
16073 !! wikitext
16074 <statictag>hello, world</statictag>
16075 <statictag action=flush/>
16076 !! html/php
16077 <p>hello, world
16078 </p>
16079 !! end
16080
16081
16082 !! test
16083 Parser hook: static parser hook inside a comment
16084 !! wikitext
16085 <!-- <statictag>hello, world</statictag> -->
16086 <statictag action=flush/>
16087 !! html/php
16088 <p><br />
16089 </p>
16090 !! end
16091
16092 # Nested template calls; this case was broken by Parser.php rev 1.506,
16093 # since reverted.
16094
16095 !! article
16096 Template:One-parameter
16097 !! text
16098 (My parameter is: {{{1}}})
16099 !! endarticle
16100
16101 !! article
16102 Template:Map-one-parameter
16103 !! text
16104 {{{{{1}}}|{{{2}}}}}
16105 !! endarticle
16106
16107 !! test
16108 Nested template calls
16109 !! wikitext
16110 {{Map-one-parameter|One-parameter|param}}
16111 !! html
16112 <p>(My parameter is: param)
16113 </p>
16114 !! end
16115
16116
16117 ###
16118 ### Sanitizer
16119 ###
16120
16121 # HTML+Tidy effectively strips out the empty tags completely
16122 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16123 # which Tidy would have done for the PHP parser had there been content inside it.
16124 !! test
16125 Sanitizer: Closing of open tags
16126 !! wikitext
16127 <s></s><table></table>
16128 !! html
16129 <s></s><table></table>
16130
16131 !! html/parsoid
16132 <p><s></s></p><table></table>
16133 !! end
16134
16135 !! test
16136 Sanitizer: Closing of open but not closed tags
16137 !! wikitext
16138 <s>foo
16139 !! html
16140 <p><s>foo</s>
16141 </p>
16142 !! end
16143
16144 !! test
16145 Sanitizer: Closing of closed but not open tags
16146 !! options
16147 parsoid=wt2html
16148 !! wikitext
16149 </s>
16150 !! html/php+tidy
16151 !! html/parsoid
16152 !! end
16153
16154 !! test
16155 Sanitizer: Closing of closed but not open table tags
16156 !! options
16157 parsoid=wt2html
16158 !! wikitext
16159 Table not started</td></tr></table>
16160 !! html/php+tidy
16161 <p>Table not started</p>
16162 !! html/parsoid
16163 <p>Table not started</p>
16164 !! end
16165
16166 !! test
16167 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16168 !! wikitext
16169 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16170 !! html
16171 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16172 </p>
16173 !! end
16174
16175 # In HTML5, the restrictions are that id must contain at least one character,
16176 # and must not contain any space characters.
16177 !! test
16178 Sanitizer: Validating the contents of the id attribute (bug 4515)
16179 !! options
16180 disabled
16181 !! wikitext
16182 <br id="" /><br id="a space" />
16183 !! html
16184 Something ...
16185 !! end
16186
16187 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16188 !! test
16189 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16190 !! options
16191 disabled
16192 !! wikitext
16193 <br id="foo" /><br id="foo" />
16194 !! html
16195 Something need to be done. foo-2 ?
16196 !! end
16197
16198 !! test
16199 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16200 !! wikitext
16201 <div itemscope>
16202 <meta itemprop="hello" content="world">
16203 <meta http-equiv="refresh" content="5">
16204 <meta itemprop="hello" http-equiv="refresh" content="5">
16205 <link itemprop="hello" href="{{SERVER}}">
16206 <link rel="stylesheet" href="{{SERVER}}">
16207 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16208 </div>
16209 !! html
16210 <div itemscope="">
16211 <p> <meta itemprop="hello" content="world" />
16212 &lt;meta http-equiv="refresh" content="5"&gt;
16213 <meta itemprop="hello" content="5" />
16214 </p>
16215 <link itemprop="hello" href="http&#58;//example.org" />
16216 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16217 <link itemprop="hello" href="http&#58;//example.org" />
16218 </div>
16219
16220 !! end
16221
16222 !! test
16223 Language converter: output gets cut off unexpectedly (bug 5757)
16224 !! options
16225 language=zh
16226 !! wikitext
16227 this bit is safe: }-
16228
16229 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16230
16231 then we get cut off here: }-
16232
16233 all additional text is vanished
16234 !! html
16235 <p>this bit is safe: }-
16236 </p><p>but if we add a conversion instance: xxx
16237 </p><p>then we get cut off here: }-
16238 </p><p>all additional text is vanished
16239 </p>
16240 !! end
16241
16242 !! test
16243 Self closed html pairs (bug 5487)
16244 !! options
16245 !! wikitext
16246 <center><font id="bug" />Centered text</center>
16247 <div><font id="bug2" />In div text</div>
16248 !! html
16249 <center>&lt;font id="bug" /&gt;Centered text</center>
16250 <div>&lt;font id="bug2" /&gt;In div text</div>
16251
16252 !! end
16253
16254 #
16255 #
16256 #
16257
16258 !! test
16259 Punctuation: nbsp before exclamation
16260 !! wikitext
16261 C'est grave !
16262 !! html
16263 <p>C'est grave&#160;!
16264 </p>
16265 !! end
16266
16267 !! test
16268 Punctuation: CSS !important (bug 11874)
16269 !! wikitext
16270 <div style="width:50% !important">important</div>
16271 !! html
16272 <div style="width:50% !important">important</div>
16273
16274 !!end
16275
16276 !! test
16277 Punctuation: CSS ! important (bug 11874; with space after)
16278 !! wikitext
16279 <div style="width:50% ! important">important</div>
16280 !! html
16281 <div style="width:50% ! important">important</div>
16282
16283 !!end
16284
16285 !! test
16286 HTML bullet list, closed tags (bug 5497)
16287 !! wikitext
16288 <ul>
16289 <li>One</li>
16290 <li>Two</li>
16291 </ul>
16292 !! html/php
16293 <ul>
16294 <li>One</li>
16295 <li>Two</li>
16296 </ul>
16297
16298 !! html/parsoid
16299 <ul data-parsoid='{"stx":"html"}'>
16300 <li data-parsoid='{"stx":"html"}'>One</li>
16301 <li data-parsoid='{"stx":"html"}'>Two</li>
16302 </ul>
16303
16304 !! end
16305
16306 !! test
16307 HTML bullet list, unclosed tags (bug 5497)
16308 !! wikitext
16309 <ul>
16310 <li>One
16311 <li>Two
16312 </ul>
16313 !! html/php+tidy
16314 <ul>
16315 <li>One</li>
16316 <li>Two</li>
16317 </ul>
16318 !! html/parsoid
16319 <ul data-parsoid='{"stx":"html"}'>
16320 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16321 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16322 </ul>
16323
16324 !! end
16325
16326 !! test
16327 HTML ordered list, closed tags (bug 5497)
16328 !! wikitext
16329 <ol>
16330 <li>One</li>
16331 <li>Two</li>
16332 </ol>
16333 !! html/php
16334 <ol>
16335 <li>One</li>
16336 <li>Two</li>
16337 </ol>
16338
16339 !! html/parsoid
16340 <ol data-parsoid='{"stx":"html"}'>
16341 <li data-parsoid='{"stx":"html"}'>One</li>
16342 <li data-parsoid='{"stx":"html"}'>Two</li>
16343 </ol>
16344
16345 !! end
16346
16347 !! test
16348 HTML ordered list, unclosed tags (bug 5497)
16349 !! options
16350 !! wikitext
16351 <ol>
16352 <li>One
16353 <li>Two
16354 </ol>
16355 !! html/php+tidy
16356 <ol>
16357 <li>One</li>
16358 <li>Two</li>
16359 </ol>
16360 !! html/parsoid
16361 <ol data-parsoid='{"stx":"html"}'>
16362 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16363 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16364 </ol>
16365
16366 !! end
16367
16368 !! test
16369 HTML nested bullet list, closed tags (bug 5497)
16370 !! wikitext
16371 <ul>
16372 <li>One</li>
16373 <li>Two:
16374 <ul>
16375 <li>Sub-one</li>
16376 <li>Sub-two</li>
16377 </ul>
16378 </li>
16379 </ul>
16380 !! html
16381 <ul>
16382 <li>One</li>
16383 <li>Two:
16384 <ul>
16385 <li>Sub-one</li>
16386 <li>Sub-two</li>
16387 </ul>
16388 </li>
16389 </ul>
16390
16391 !! end
16392
16393 !! test
16394 HTML nested bullet list, open tags (bug 5497)
16395 !! wikitext
16396 <ul>
16397 <li>One
16398 <li>Two:
16399 <ul>
16400 <li>Sub-one
16401 <li>Sub-two
16402 </ul>
16403 </ul>
16404 !! html/php+tidy
16405 <ul>
16406 <li>One</li>
16407 <li>Two:
16408 <ul>
16409 <li>Sub-one</li>
16410 <li>Sub-two</li>
16411 </ul>
16412 </li>
16413 </ul>
16414 !! html/parsoid
16415 <ul>
16416 <li>One
16417 </li>
16418 <li>Two:
16419 <ul>
16420 <li>Sub-one
16421 </li>
16422 <li>Sub-two
16423 </li>
16424 </ul>
16425 </li>
16426 </ul>
16427
16428 !! end
16429
16430 !! test
16431 HTML nested ordered list, closed tags (bug 5497)
16432 !! wikitext
16433 <ol>
16434 <li>One</li>
16435 <li>Two:
16436 <ol>
16437 <li>Sub-one</li>
16438 <li>Sub-two</li>
16439 </ol>
16440 </li>
16441 </ol>
16442 !! html
16443 <ol>
16444 <li>One</li>
16445 <li>Two:
16446 <ol>
16447 <li>Sub-one</li>
16448 <li>Sub-two</li>
16449 </ol>
16450 </li>
16451 </ol>
16452
16453 !! end
16454
16455 !! test
16456 HTML nested ordered list, open tags (bug 5497)
16457 !! wikitext
16458 <ol>
16459 <li>One
16460 <li>Two:
16461 <ol>
16462 <li>Sub-one
16463 <li>Sub-two
16464 </ol>
16465 </ol>
16466 !! html/php
16467 <ol>
16468 <li>One
16469 <li>Two:
16470 <ol>
16471 <li>Sub-one
16472 <li>Sub-two
16473 </ol>
16474 </ol>
16475
16476 !! html/parsoid
16477 <ol>
16478 <li>One
16479 </li>
16480 <li>Two:
16481 <ol>
16482 <li>Sub-one
16483 </li>
16484 <li>Sub-two
16485 </li>
16486 </ol>
16487 </li>
16488 </ol>
16489
16490 !! end
16491
16492 !! test
16493 HTML ordered list item with parameters oddity
16494 !! wikitext
16495 <ol><li id="fragment">One</li>
16496 </ol>
16497 !! html
16498 <ol><li id="fragment">One</li>
16499 </ol>
16500
16501 !! end
16502
16503 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16504 !!test
16505 bug 5918: autonumbering
16506 !! wikitext
16507 [http://first/] [http://second] [ftp://ftp]
16508
16509 ftp://inlineftp
16510
16511 [mailto:enclosed@mail.tld With target]
16512
16513 [mailto:enclosed@mail.tld]
16514
16515 mailto:inline@mail.tld
16516 !! html/php
16517 <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>
16518 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16519 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16520 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16521 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16522 </p>
16523 !! html/parsoid
16524 <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>
16525 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16526 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16527 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16528 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16529 !! end
16530
16531
16532 #
16533 # Security and HTML correctness
16534 # From Nick Jenkins' fuzz testing
16535 #
16536
16537 !! test
16538 Fuzz testing: Parser13
16539 !! wikitext
16540 {|
16541 | http://a|
16542 !! html
16543 <table>
16544 <tr>
16545 <td>
16546 </td>
16547 </tr>
16548 </table>
16549
16550 !! end
16551
16552 !! test
16553 Fuzz testing: Parser14
16554 !! wikitext
16555 == onmouseover= ==
16556 http://__TOC__
16557 !! html
16558 <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>
16559 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16560 <ul>
16561 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16562 </ul>
16563 </div>
16564
16565
16566 !! html+tidy
16567 <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>
16568 <p>http://</p>
16569 <div id="toc" class="toc">
16570 <div id="toctitle">
16571 <h2>Contents</h2>
16572 </div>
16573 <ul>
16574 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16575 </ul>
16576 </div>
16577 <p></p>
16578 !! end
16579
16580 !! test
16581 Fuzz testing: Parser14-table
16582 !! wikitext
16583 ==a==
16584 {| STYLE=__TOC__
16585 !! html
16586 <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>
16587 <table style="&#95;_TOC&#95;_">
16588 <tr><td></td></tr>
16589 </table>
16590
16591 !! html+tidy
16592 <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>
16593 <table style="__TOC__">
16594 <tr>
16595 <td></td>
16596 </tr>
16597 </table>
16598 !! end
16599
16600 # Known to produce bogus xml (extra </td>)
16601 !! test
16602 Fuzz testing: Parser16
16603 !! options
16604 noxml
16605 !! wikitext
16606 {|
16607 !https://||||||
16608 !! html
16609 <table>
16610 <tr>
16611 <th>https://</th>
16612 <th></th>
16613 <th></th>
16614 <th>
16615 </td>
16616 </tr>
16617 </table>
16618
16619 !! html+tidy
16620 <table>
16621 <tr>
16622 <th>https://</th>
16623 <th></th>
16624 <th></th>
16625 <th></th>
16626 </tr>
16627 </table>
16628 !! end
16629
16630 !! test
16631 Fuzz testing: Parser21
16632 !! wikitext
16633 {|
16634 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16635 |
16636 !! html
16637 <table>
16638 <tr>
16639 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16640 </th>
16641 <td>
16642 </td>
16643 </tr>
16644 </table>
16645
16646 !! end
16647
16648 !! test
16649 Fuzz testing: Parser22
16650 !! wikitext
16651 http://===r:::https://b
16652
16653 {|
16654 !! html
16655 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16656 </p>
16657 <table>
16658 <tr><td></td></tr>
16659 </table>
16660
16661 !! end
16662
16663 # Known to produce bad XML for now
16664 !! test
16665 Fuzz testing: Parser24
16666 !! options
16667 noxml
16668 !! wikitext
16669 {|
16670 {{{|
16671 <u CLASS=
16672 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16673 <br style="onmouseover='alert(document.cookie);' " />
16674
16675 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16676 |
16677 !! html
16678 <table>
16679 {{{|
16680 <u class="&#124;">}}}} &gt;
16681 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16682
16683 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16684 <tr>
16685 <td></u>
16686 </td>
16687 </tr>
16688 </table>
16689
16690 !! end
16691
16692 # Note: the current result listed for this is not what the original one was,
16693 # but the original bug was JavaScript injection, which is fixed in any case.
16694 # It's not clear that the original result listed was any more correct than the
16695 # current one. Original result:
16696 # <p>{{{|
16697 # </p>
16698 # <li class="&#124;&#124;">
16699 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16700 !!test
16701 Fuzz testing: Parser25 (bug 6055)
16702 !! wikitext
16703 {{{
16704 |
16705 <LI CLASS=||
16706 >
16707 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16708 !! html
16709 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16710 </p>
16711 !! end
16712
16713 !!test
16714 Fuzz testing: URL adjacent extension (with space, clean)
16715 !! wikitext
16716 http://example.com <nowiki>junk</nowiki>
16717 !! html/php
16718 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16719 </p>
16720 !! html/parsoid
16721 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16722 !! end
16723
16724 !!test
16725 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16726 !! wikitext
16727 http://example.com<nowiki>junk</nowiki>
16728 !! html/php
16729 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16730 </p>
16731 !! html/parsoid
16732 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16733 !! end
16734
16735 !!test
16736 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16737 !! wikitext
16738 http://example.com<pre>junk</pre>
16739 !! html/php
16740 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16741
16742 !! html/php+tidy
16743 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16744 <pre>
16745 junk
16746 </pre>
16747 !! html/parsoid
16748 <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>
16749 !!end
16750
16751 !!test
16752 Fuzz testing: image with bogus manual thumbnail
16753 !! wikitext
16754 [[Image:foobar.jpg|thumbnail= ]]
16755 !! html/php
16756 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16757
16758 !! html/parsoid
16759 <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>
16760 !!end
16761
16762 !! test
16763 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16764 !! wikitext
16765 <pre dir="&#10;"></pre>
16766 !! html
16767 <pre dir="&#10;"></pre>
16768
16769 !! end
16770
16771 !! test
16772 Parsing optional HTML elements (Bug 6171)
16773 !! options
16774 !! wikitext
16775 <table>
16776 <tr>
16777 <td> Some tabular data</td>
16778 <td> More tabular data ...
16779 <td> And yet som tabular data</td>
16780 </tr>
16781 </table>
16782 !! html
16783 <table>
16784 <tr>
16785 <td> Some tabular data</td>
16786 <td> More tabular data ...
16787 </td><td> And yet som tabular data</td>
16788 </tr>
16789 </table>
16790
16791 !! end
16792
16793 !! test
16794 Correct handling of <td>, <tr> (Bug 6171)
16795 !! options
16796 !! wikitext
16797 <table>
16798 <tr>
16799 <td> Some tabular data</td>
16800 <td> More tabular data ...</td>
16801 <td> And yet som tabular data</td>
16802 </tr>
16803 </table>
16804 !! html
16805 <table>
16806 <tr>
16807 <td> Some tabular data</td>
16808 <td> More tabular data ...</td>
16809 <td> And yet som tabular data</td>
16810 </tr>
16811 </table>
16812
16813 !! end
16814
16815
16816 !! test
16817 Parsing crashing regression (fr:JavaScript)
16818 !! wikitext
16819 </body></x>
16820 !! html
16821 <p>&lt;/body&gt;&lt;/x&gt;
16822 </p>
16823 !! end
16824
16825 !! test
16826 Inline wiki vs wiki block nesting
16827 !! wikitext
16828 '''Bold paragraph
16829
16830 New wiki paragraph
16831 !! html
16832 <p><b>Bold paragraph</b>
16833 </p><p>New wiki paragraph
16834 </p>
16835 !! end
16836
16837 # FIXME: The current php output is documented
16838 # and desired output is the parsoid target.
16839 !! test
16840 Inline HTML vs wiki block nesting
16841 !! wikitext
16842 <b>Bold paragraph
16843
16844 New wiki paragraph
16845 !! html/php
16846 <p><b>Bold paragraph
16847 </p><p>New wiki paragraph</b>
16848 </p>
16849 !! html/parsoid
16850 <p><b>Bold paragraph</b>
16851 </p><p>New wiki paragraph
16852 </p>
16853 !! end
16854
16855 # Original result was this:
16856 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16857 # </p>
16858 # While that might be marginally more intuitive, maybe, the six-apostrophe
16859 # construct is clearly pathological and the result stated here (which is what
16860 # the parser actually does) is about as reasonable as anything.
16861 !!test
16862 Mixing markup for italics and bold
16863 !! options
16864 !! wikitext
16865 '''bold''''''bold''bolditalics'''''
16866 !! html
16867 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16868 </p>
16869 !! end
16870
16871
16872 !! article
16873 Xyzzyx
16874 !! text
16875 Article for special page transclusion test
16876 !! endarticle
16877
16878 !! test
16879 Special page transclusion
16880 !! options
16881 !! wikitext
16882 {{Special:Prefixindex/Xyzzyx}}
16883 !! html
16884 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16885
16886 !! end
16887
16888 !! test
16889 Special page transclusion twice (bug 5021)
16890 !! options
16891 !! wikitext
16892 {{Special:Prefixindex/Xyzzyx}}
16893 {{Special:Prefixindex/Xyzzyx}}
16894 !! html
16895 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16896 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16897
16898 !! end
16899
16900 !! test
16901 Transclusion of default MediaWiki message
16902 !! wikitext
16903 {{MediaWiki:Mainpage}}
16904 !! html
16905 <p>Main Page
16906 </p>
16907 !! end
16908
16909 !! test
16910 Transclusion of nonexistent MediaWiki message
16911 !! wikitext
16912 {{MediaWiki:Mainpagexxx}}
16913 !! html
16914 <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>
16915 </p>
16916 !! end
16917
16918 !! test
16919 Transclusion of MediaWiki message with underscore
16920 !! wikitext
16921 {{MediaWiki:history_short}}
16922 !! html
16923 <p>History
16924 </p>
16925 !! end
16926
16927 !! test
16928 Transclusion of MediaWiki message with space
16929 !! wikitext
16930 {{MediaWiki:history short}}
16931 !! html
16932 <p>History
16933 </p>
16934 !! end
16935
16936 !! test
16937 Invalid header with following text
16938 !! wikitext
16939 = x = y
16940 !! html
16941 <p>= x = y
16942 </p>
16943 !! end
16944
16945
16946 !! test
16947 Section extraction test (section 0)
16948 !! options
16949 section=0
16950 !! wikitext
16951 start
16952 ==a==
16953 ===aa===
16954 ====aaa====
16955 ==b==
16956 ===ba===
16957 ===bb===
16958 ====bba====
16959 ===bc===
16960 ==c==
16961 ===ca===
16962 !! html/php
16963 start
16964 !! end
16965
16966 !! test
16967 Section extraction test (section 1)
16968 !! options
16969 section=1
16970 !! wikitext
16971 start
16972 ==a==
16973 ===aa===
16974 ====aaa====
16975 ==b==
16976 ===ba===
16977 ===bb===
16978 ====bba====
16979 ===bc===
16980 ==c==
16981 ===ca===
16982 !! html/php
16983 ==a==
16984 ===aa===
16985 ====aaa====
16986 !! end
16987
16988 !! test
16989 Section extraction test (section 2)
16990 !! options
16991 section=2
16992 !! wikitext
16993 start
16994 ==a==
16995 ===aa===
16996 ====aaa====
16997 ==b==
16998 ===ba===
16999 ===bb===
17000 ====bba====
17001 ===bc===
17002 ==c==
17003 ===ca===
17004 !! html/php
17005 ===aa===
17006 ====aaa====
17007 !! end
17008
17009 !! test
17010 Section extraction test (section 3)
17011 !! options
17012 section=3
17013 !! wikitext
17014 start
17015 ==a==
17016 ===aa===
17017 ====aaa====
17018 ==b==
17019 ===ba===
17020 ===bb===
17021 ====bba====
17022 ===bc===
17023 ==c==
17024 ===ca===
17025 !! html/php
17026 ====aaa====
17027 !! end
17028
17029 !! test
17030 Section extraction test (section 4)
17031 !! options
17032 section=4
17033 !! wikitext
17034 start
17035 ==a==
17036 ===aa===
17037 ====aaa====
17038 ==b==
17039 ===ba===
17040 ===bb===
17041 ====bba====
17042 ===bc===
17043 ==c==
17044 ===ca===
17045 !! html/php
17046 ==b==
17047 ===ba===
17048 ===bb===
17049 ====bba====
17050 ===bc===
17051 !! end
17052
17053 !! test
17054 Section extraction test (section 5)
17055 !! options
17056 section=5
17057 !! wikitext
17058 start
17059 ==a==
17060 ===aa===
17061 ====aaa====
17062 ==b==
17063 ===ba===
17064 ===bb===
17065 ====bba====
17066 ===bc===
17067 ==c==
17068 ===ca===
17069 !! html/php
17070 ===ba===
17071 !! end
17072
17073 !! test
17074 Section extraction test (section 6)
17075 !! options
17076 section=6
17077 !! wikitext
17078 start
17079 ==a==
17080 ===aa===
17081 ====aaa====
17082 ==b==
17083 ===ba===
17084 ===bb===
17085 ====bba====
17086 ===bc===
17087 ==c==
17088 ===ca===
17089 !! html/php
17090 ===bb===
17091 ====bba====
17092 !! end
17093
17094 !! test
17095 Section extraction test (section 7)
17096 !! options
17097 section=7
17098 !! wikitext
17099 start
17100 ==a==
17101 ===aa===
17102 ====aaa====
17103 ==b==
17104 ===ba===
17105 ===bb===
17106 ====bba====
17107 ===bc===
17108 ==c==
17109 ===ca===
17110 !! html/php
17111 ====bba====
17112 !! end
17113
17114 !! test
17115 Section extraction test (section 8)
17116 !! options
17117 section=8
17118 !! wikitext
17119 start
17120 ==a==
17121 ===aa===
17122 ====aaa====
17123 ==b==
17124 ===ba===
17125 ===bb===
17126 ====bba====
17127 ===bc===
17128 ==c==
17129 ===ca===
17130 !! html/php
17131 ===bc===
17132 !! end
17133
17134 !! test
17135 Section extraction test (section 9)
17136 !! options
17137 section=9
17138 !! wikitext
17139 start
17140 ==a==
17141 ===aa===
17142 ====aaa====
17143 ==b==
17144 ===ba===
17145 ===bb===
17146 ====bba====
17147 ===bc===
17148 ==c==
17149 ===ca===
17150 !! html/php
17151 ==c==
17152 ===ca===
17153 !! end
17154
17155 !! test
17156 Section extraction test (section 10)
17157 !! options
17158 section=10
17159 !! wikitext
17160 start
17161 ==a==
17162 ===aa===
17163 ====aaa====
17164 ==b==
17165 ===ba===
17166 ===bb===
17167 ====bba====
17168 ===bc===
17169 ==c==
17170 ===ca===
17171 !! html/php
17172 ===ca===
17173 !! end
17174
17175 !! test
17176 Section extraction test (nonexistent section 11)
17177 !! options
17178 section=11
17179 !! wikitext
17180 start
17181 ==a==
17182 ===aa===
17183 ====aaa====
17184 ==b==
17185 ===ba===
17186 ===bb===
17187 ====bba====
17188 ===bc===
17189 ==c==
17190 ===ca===
17191 !! html/php
17192 !! end
17193
17194 !! test
17195 Section extraction test with bogus heading (section 1)
17196 !! options
17197 section=1
17198 !! wikitext
17199 ==a==
17200 ==bogus== not a legal section
17201 ==b==
17202 !! html/php
17203 ==a==
17204 ==bogus== not a legal section
17205 !! end
17206
17207 !! test
17208 Section extraction test with bogus heading (section 2)
17209 !! options
17210 section=2
17211 !! wikitext
17212 ==a==
17213 ==bogus== not a legal section
17214 ==b==
17215 !! html/php
17216 ==b==
17217 !! end
17218
17219 !! test
17220 Section extraction test with comment after heading (section 1)
17221 !! options
17222 section=1
17223 !! wikitext
17224 ==a==
17225 ==b== <!-- -->
17226 ==c==
17227 !! html/php
17228 ==a==
17229 !! end
17230
17231 !! test
17232 Section extraction test with comment after heading (section 2)
17233 !! options
17234 section=2
17235 !! wikitext
17236 ==a==
17237 ==b== <!-- -->
17238 ==c==
17239 !! html/php
17240 ==b== <!-- -->
17241 !! end
17242
17243 !! test
17244 Section extraction test with bogus <nowiki> heading (section 1)
17245 !! options
17246 section=1
17247 !! wikitext
17248 ==a==
17249 ==bogus== <nowiki>not a legal section</nowiki>
17250 ==b==
17251 !! html/php
17252 ==a==
17253 ==bogus== <nowiki>not a legal section</nowiki>
17254 !! end
17255
17256 !! test
17257 Section extraction test with bogus <nowiki> heading (section 2)
17258 !! options
17259 section=2
17260 !! wikitext
17261 ==a==
17262 ==bogus== <nowiki>not a legal section</nowiki>
17263 ==b==
17264 !! html/php
17265 ==b==
17266 !! end
17267
17268 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17269 # instead of respecting commented sections
17270 !! test
17271 Section extraction prefixed by comment (section 1)
17272 !! options
17273 section=1
17274 !! wikitext
17275 <!-- -->==sec1==
17276 ==sec2==
17277 !! html/php
17278 ==sec2==
17279 !!end
17280
17281 !! test
17282 Section extraction prefixed by comment (section 2)
17283 !! options
17284 section=2
17285 !! wikitext
17286 <!-- -->==sec1==
17287 ==sec2==
17288 !! html/php
17289
17290 !!end
17291
17292 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17293 # instead of respecting HTML-style headings
17294 !! test
17295 Section extraction, mixed wiki and html (section 1)
17296 !! options
17297 section=1
17298 !! wikitext
17299 <h2>unmarked</h2>
17300 unmarked
17301 ==1==
17302 one
17303 ==2==
17304 two
17305 !! html/php
17306 ==1==
17307 one
17308 !! end
17309
17310 !! test
17311 Section extraction, mixed wiki and html (section 2)
17312 !! options
17313 section=2
17314 !! wikitext
17315 <h2>unmarked</h2>
17316 unmarked
17317 ==1==
17318 one
17319 ==2==
17320 two
17321 !! html/php
17322 ==2==
17323 two
17324 !! end
17325
17326
17327 # Formerly testing for bug 3342
17328 !! test
17329 Section extraction, heading surrounded by <noinclude>
17330 !! options
17331 section=1
17332 !! wikitext
17333 <noinclude>==unmarked==</noinclude>
17334 ==marked==
17335 !! html/php
17336 ==marked==
17337 !!end
17338
17339 # Test behavior of bug 19910
17340 !! test
17341 Sectiion with all-equals
17342 !! options
17343 section=2
17344 !! wikitext
17345 ===
17346 The line above must have a trailing space
17347 === <!--
17348 --> <!-- -->
17349 But just in case it doesn't...
17350 !! html/php
17351 === <!--
17352 --> <!-- -->
17353 But just in case it doesn't...
17354 !! end
17355
17356 !! test
17357 Section replacement test (section 0)
17358 !! options
17359 replace=0,"xxx"
17360 !! wikitext
17361 start
17362 ==a==
17363 ===aa===
17364 ====aaa====
17365 ==b==
17366 ===ba===
17367 ===bb===
17368 ====bba====
17369 ===bc===
17370 ==c==
17371 ===ca===
17372 !! html/php
17373 xxx
17374
17375 ==a==
17376 ===aa===
17377 ====aaa====
17378 ==b==
17379 ===ba===
17380 ===bb===
17381 ====bba====
17382 ===bc===
17383 ==c==
17384 ===ca===
17385 !! end
17386
17387 !! test
17388 Section replacement test (section 1)
17389 !! options
17390 replace=1,"xxx"
17391 !! wikitext
17392 start
17393 ==a==
17394 ===aa===
17395 ====aaa====
17396 ==b==
17397 ===ba===
17398 ===bb===
17399 ====bba====
17400 ===bc===
17401 ==c==
17402 ===ca===
17403 !! html/php
17404 start
17405 xxx
17406
17407 ==b==
17408 ===ba===
17409 ===bb===
17410 ====bba====
17411 ===bc===
17412 ==c==
17413 ===ca===
17414 !! end
17415
17416 !! test
17417 Section replacement test (section 2)
17418 !! options
17419 replace=2,"xxx"
17420 !! wikitext
17421 start
17422 ==a==
17423 ===aa===
17424 ====aaa====
17425 ==b==
17426 ===ba===
17427 ===bb===
17428 ====bba====
17429 ===bc===
17430 ==c==
17431 ===ca===
17432 !! html/php
17433 start
17434 ==a==
17435 xxx
17436
17437 ==b==
17438 ===ba===
17439 ===bb===
17440 ====bba====
17441 ===bc===
17442 ==c==
17443 ===ca===
17444 !! end
17445
17446 !! test
17447 Section replacement test (section 3)
17448 !! options
17449 replace=3,"xxx"
17450 !! wikitext
17451 start
17452 ==a==
17453 ===aa===
17454 ====aaa====
17455 ==b==
17456 ===ba===
17457 ===bb===
17458 ====bba====
17459 ===bc===
17460 ==c==
17461 ===ca===
17462 !! html/php
17463 start
17464 ==a==
17465 ===aa===
17466 xxx
17467
17468 ==b==
17469 ===ba===
17470 ===bb===
17471 ====bba====
17472 ===bc===
17473 ==c==
17474 ===ca===
17475 !! end
17476
17477 !! test
17478 Section replacement test (section 4)
17479 !! options
17480 replace=4,"xxx"
17481 !! wikitext
17482 start
17483 ==a==
17484 ===aa===
17485 ====aaa====
17486 ==b==
17487 ===ba===
17488 ===bb===
17489 ====bba====
17490 ===bc===
17491 ==c==
17492 ===ca===
17493 !! html/php
17494 start
17495 ==a==
17496 ===aa===
17497 ====aaa====
17498 xxx
17499
17500 ==c==
17501 ===ca===
17502 !! end
17503
17504 !! test
17505 Section replacement test (section 5)
17506 !! options
17507 replace=5,"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 ==a==
17523 ===aa===
17524 ====aaa====
17525 ==b==
17526 xxx
17527
17528 ===bb===
17529 ====bba====
17530 ===bc===
17531 ==c==
17532 ===ca===
17533 !! end
17534
17535 !! test
17536 Section replacement test (section 6)
17537 !! options
17538 replace=6,"xxx"
17539 !! wikitext
17540 start
17541 ==a==
17542 ===aa===
17543 ====aaa====
17544 ==b==
17545 ===ba===
17546 ===bb===
17547 ====bba====
17548 ===bc===
17549 ==c==
17550 ===ca===
17551 !! html/php
17552 start
17553 ==a==
17554 ===aa===
17555 ====aaa====
17556 ==b==
17557 ===ba===
17558 xxx
17559
17560 ===bc===
17561 ==c==
17562 ===ca===
17563 !! end
17564
17565 !! test
17566 Section replacement test (section 7)
17567 !! options
17568 replace=7,"xxx"
17569 !! wikitext
17570 start
17571 ==a==
17572 ===aa===
17573 ====aaa====
17574 ==b==
17575 ===ba===
17576 ===bb===
17577 ====bba====
17578 ===bc===
17579 ==c==
17580 ===ca===
17581 !! html/php
17582 start
17583 ==a==
17584 ===aa===
17585 ====aaa====
17586 ==b==
17587 ===ba===
17588 ===bb===
17589 xxx
17590
17591 ===bc===
17592 ==c==
17593 ===ca===
17594 !! end
17595
17596 !! test
17597 Section replacement test (section 8)
17598 !! options
17599 replace=8,"xxx"
17600 !! wikitext
17601 start
17602 ==a==
17603 ===aa===
17604 ====aaa====
17605 ==b==
17606 ===ba===
17607 ===bb===
17608 ====bba====
17609 ===bc===
17610 ==c==
17611 ===ca===
17612 !! html/php
17613 start
17614 ==a==
17615 ===aa===
17616 ====aaa====
17617 ==b==
17618 ===ba===
17619 ===bb===
17620 ====bba====
17621 xxx
17622
17623 ==c==
17624 ===ca===
17625 !!end
17626
17627 !! test
17628 Section replacement test (section 9)
17629 !! options
17630 replace=9,"xxx"
17631 !! wikitext
17632 start
17633 ==a==
17634 ===aa===
17635 ====aaa====
17636 ==b==
17637 ===ba===
17638 ===bb===
17639 ====bba====
17640 ===bc===
17641 ==c==
17642 ===ca===
17643 !! html/php
17644 start
17645 ==a==
17646 ===aa===
17647 ====aaa====
17648 ==b==
17649 ===ba===
17650 ===bb===
17651 ====bba====
17652 ===bc===
17653 xxx
17654 !! end
17655
17656 !! test
17657 Section replacement test (section 10)
17658 !! options
17659 replace=10,"xxx"
17660 !! wikitext
17661 start
17662 ==a==
17663 ===aa===
17664 ====aaa====
17665 ==b==
17666 ===ba===
17667 ===bb===
17668 ====bba====
17669 ===bc===
17670 ==c==
17671 ===ca===
17672 !! html/php
17673 start
17674 ==a==
17675 ===aa===
17676 ====aaa====
17677 ==b==
17678 ===ba===
17679 ===bb===
17680 ====bba====
17681 ===bc===
17682 ==c==
17683 xxx
17684 !! end
17685
17686 !! test
17687 Section replacement test with initial whitespace (bug 13728)
17688 !! options
17689 replace=2,"xxx"
17690 !! wikitext
17691 Preformatted initial line
17692 ==a==
17693 ===a===
17694 !! html/php
17695 Preformatted initial line
17696 ==a==
17697 xxx
17698 !! end
17699
17700
17701 !! test
17702 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17703 !! options
17704 section=1
17705 !! wikitext
17706 ==a==
17707 a
17708 !! html/php
17709 ==a==
17710 a
17711 !! end
17712
17713 !! test
17714 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17715 !! options
17716 section=1
17717 !! wikitext
17718 ==a==
17719 a
17720 !! html/php
17721 ==a==
17722 a
17723 !! end
17724
17725
17726 !! test
17727 Section extraction, <pre> around bogus header (bug 10309)
17728 !! options
17729 noxml section=2
17730 !! wikitext
17731 == Section One ==
17732 <pre>
17733 =======
17734 </pre>
17735
17736 == Section Two ==
17737 stuff
17738 !! html/php
17739 == Section Two ==
17740 stuff
17741 !! end
17742
17743 !! test
17744 Section replacement, <pre> around bogus header (bug 10309)
17745 !! options
17746 noxml replace=2,"xxx"
17747 !! wikitext
17748 == Section One ==
17749 <pre>
17750 =======
17751 </pre>
17752
17753 == Section Two ==
17754 stuff
17755 !! html/php
17756 == Section One ==
17757 <pre>
17758 =======
17759 </pre>
17760
17761 xxx
17762 !! end
17763
17764
17765 !! test
17766 Handling of &#x0A; in URLs
17767 !! wikitext
17768 ** irc://&#x0A;a
17769 !! html/php
17770 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17771
17772 !! html/parsoid
17773 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17774 a">irc://
17775 a</a></li></ul></li></ul>
17776 !! end
17777
17778 !! test
17779 Handling of %0A in URLs
17780 !! wikitext
17781 ** irc://%0Aa
17782 !! html/php
17783 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17784
17785 !! html/parsoid
17786 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17787 !! end
17788
17789
17790 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17791 !! test
17792 5 quotes, code coverage +1 line
17793 !! options
17794 parsoid=wt2html
17795 !! wikitext
17796 '''''
17797 !! html/php
17798 !! html/parsoid
17799 <p><b><i></i></b></p>
17800 !! end
17801
17802 # same html as previous, but wikitext adjusted to match parsoid html2wt
17803 # note that wt2html and html2html will put the <i> before the <b>
17804 !! test
17805 5 quotes, code coverage +1 line w/ nowiki (1)
17806 !! options
17807 parsoid=wt2wt,html2wt
17808 !! wikitext
17809 '''''<nowiki/>'''''
17810 !! html/php
17811 <p><i></i>
17812 </p>
17813 !! html/parsoid
17814 <p><b><i></i></b></p>
17815 !! end
17816
17817 # same as previous, just swapping the <i> and <b>
17818 !! test
17819 5 quotes, code coverage +1 line w/ nowiki (2)
17820 !! wikitext
17821 '''''<nowiki/>'''''
17822 !! html/php
17823 <p><i></i>
17824 </p>
17825 !! html/parsoid
17826 <p><i><b></b></i></p>
17827 !! end
17828
17829 !! test
17830 Special:Search page linking.
17831 !! wikitext
17832 {{Special:search}}
17833 !! html
17834 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17835 </p>
17836 !! end
17837
17838 !! test
17839 {{!}} is a magic word
17840 !! wikitext
17841 {{!}} is a magic word there and {{!}} is still a magic word here
17842 !! html/php
17843 <p>| is a magic word there and | is still a magic word here
17844 </p>
17845 !! html/parsoid
17846 <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>
17847 !! end
17848
17849 !! test
17850 Say the magic word
17851 !! options
17852 title=[[Parser test]]
17853 !! wikitext
17854 * {{PAGENAME}}
17855 * {{PAGENAMEE}}
17856 * {{FULLPAGENAME}}
17857 * {{FULLPAGENAMEE}}
17858 * {{BASEPAGENAME}}
17859 * {{BASEPAGENAMEE}}
17860 * {{SUBPAGENAME}}
17861 * {{SUBPAGENAMEE}}
17862 * {{ROOTPAGENAME}}
17863 * {{ROOTPAGENAMEE}}
17864 * {{TALKPAGENAME}}
17865 * {{TALKPAGENAMEE}}
17866 * {{SUBJECTPAGENAME}}
17867 * {{SUBJECTPAGENAMEE}}
17868 * {{NAMESPACEE}}
17869 * {{NAMESPACE}}
17870 * {{NAMESPACENUMBER}}
17871 * {{TALKSPACE}}
17872 * {{TALKSPACEE}}
17873 * {{SUBJECTSPACE}}
17874 * {{SUBJECTSPACEE}}
17875 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17876 !! html
17877 <ul><li> Parser test</li>
17878 <li> Parser_test</li>
17879 <li> Parser test</li>
17880 <li> Parser_test</li>
17881 <li> Parser test</li>
17882 <li> Parser_test</li>
17883 <li> Parser test</li>
17884 <li> Parser_test</li>
17885 <li> Parser test</li>
17886 <li> Parser_test</li>
17887 <li> Talk:Parser test</li>
17888 <li> Talk:Parser_test</li>
17889 <li> Parser test</li>
17890 <li> Parser_test</li>
17891 <li> </li>
17892 <li> </li>
17893 <li> 0</li>
17894 <li> Talk</li>
17895 <li> Talk</li>
17896 <li> </li>
17897 <li> </li>
17898 <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>
17899
17900 !! end
17901 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17902
17903 !! test
17904 Gallery
17905 !! wikitext
17906 <gallery>
17907 image1.png |
17908 image2.gif|||||
17909
17910 image3|
17911 image4 |300px| centre
17912 image5.svg| http://///////
17913 [[x|xx]]]]
17914 * image6
17915 </gallery>
17916 !! html
17917 <ul class="gallery mw-gallery-traditional">
17918 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17919 <div class="thumb" style="height: 150px;">Image1.png</div>
17920 <div class="gallerytext">
17921 </div>
17922 </div></li>
17923 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17924 <div class="thumb" style="height: 150px;">Image2.gif</div>
17925 <div class="gallerytext">
17926 <p>||||
17927 </p>
17928 </div>
17929 </div></li>
17930 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17931 <div class="thumb" style="height: 150px;">Image3</div>
17932 <div class="gallerytext">
17933 </div>
17934 </div></li>
17935 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17936 <div class="thumb" style="height: 150px;">Image4</div>
17937 <div class="gallerytext">
17938 <p>300px| centre
17939 </p>
17940 </div>
17941 </div></li>
17942 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17943 <div class="thumb" style="height: 150px;">Image5.svg</div>
17944 <div class="gallerytext">
17945 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17946 </p>
17947 </div>
17948 </div></li>
17949 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17950 <div class="thumb" style="height: 150px;">* image6</div>
17951 <div class="gallerytext">
17952 </div>
17953 </div></li>
17954 </ul>
17955
17956 !! end
17957
17958 !! test
17959 Gallery (with options)
17960 !! wikitext
17961 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17962 File:Nonexistent.jpg|caption
17963 File:Nonexistent.jpg
17964 image:foobar.jpg|some '''caption''' [[Main Page]]
17965 image:foobar.jpg
17966 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17967 </gallery>
17968 !! html
17969 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17970 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17971 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17972 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17973 <div class="gallerytext">
17974 <p>caption
17975 </p>
17976 </div>
17977 </div></li>
17978 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17979 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17980 <div class="gallerytext">
17981 </div>
17982 </div></li>
17983 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17984 <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>
17985 <div class="gallerytext">
17986 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17987 </p>
17988 </div>
17989 </div></li>
17990 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17991 <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>
17992 <div class="gallerytext">
17993 </div>
17994 </div></li>
17995 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17996 <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>
17997 <div class="gallerytext">
17998 <p>Blabla|blabla.
17999 </p>
18000 </div>
18001 </div></li>
18002 </ul>
18003
18004 !! end
18005
18006 !! test
18007 Gallery with link that has fragment
18008 !! wikitext
18009 <gallery>
18010 image:foobar.jpg|link=Main_Page
18011 image:foobar.jpg|link=Main_Page#section
18012 image:foobar.jpg|link=Main Page#section|caption
18013 </gallery>
18014 !! html
18015 <ul class="gallery mw-gallery-traditional">
18016 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18017 <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>
18018 <div class="gallerytext">
18019 </div>
18020 </div></li>
18021 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18022 <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>
18023 <div class="gallerytext">
18024 </div>
18025 </div></li>
18026 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18027 <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>
18028 <div class="gallerytext">
18029 <p>caption
18030 </p>
18031 </div>
18032 </div></li>
18033 </ul>
18034
18035 !! end
18036
18037 !! test
18038 Gallery with wikitext inside caption
18039 !! wikitext
18040 <gallery>
18041 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18042 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18043 </gallery>
18044 !! html
18045 <ul class="gallery mw-gallery-traditional">
18046 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18047 <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>
18048 <div class="gallerytext">
18049 <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>
18050 </p>
18051 </div>
18052 </div></li>
18053 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18054 <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>
18055 <div class="gallerytext">
18056 <p>This is a test template
18057 </p>
18058 </div>
18059 </div></li>
18060 </ul>
18061
18062 !! end
18063
18064 !! test
18065 gallery (with showfilename option)
18066 !! wikitext
18067 <gallery showfilename>
18068 File:Nonexistent.jpg|caption
18069 File:Nonexistent.jpg
18070 image:foobar.jpg|some '''caption''' [[Main Page]]
18071 File:Foobar.jpg
18072 </gallery>
18073 !! html
18074 <ul class="gallery mw-gallery-traditional">
18075 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18076 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18077 <div class="gallerytext">
18078 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18079 caption
18080 </p>
18081 </div>
18082 </div></li>
18083 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18084 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18085 <div class="gallerytext">
18086 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18087 </p>
18088 </div>
18089 </div></li>
18090 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18091 <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>
18092 <div class="gallerytext">
18093 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18094 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18095 </p>
18096 </div>
18097 </div></li>
18098 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18099 <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>
18100 <div class="gallerytext">
18101 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18102 </p>
18103 </div>
18104 </div></li>
18105 </ul>
18106
18107 !! end
18108
18109 !! test
18110 Gallery (with namespace-less filenames)
18111 !! wikitext
18112 <gallery>
18113 File:Nonexistent.jpg
18114 Nonexistent.jpg
18115 image:foobar.jpg
18116 foobar.jpg
18117 </gallery>
18118 !! html
18119 <ul class="gallery mw-gallery-traditional">
18120 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18121 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18122 <div class="gallerytext">
18123 </div>
18124 </div></li>
18125 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18126 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18127 <div class="gallerytext">
18128 </div>
18129 </div></li>
18130 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18131 <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>
18132 <div class="gallerytext">
18133 </div>
18134 </div></li>
18135 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18136 <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>
18137 <div class="gallerytext">
18138 </div>
18139 </div></li>
18140 </ul>
18141
18142 !! end
18143
18144 !! test
18145 HTML Hex character encoding (spells the word "JavaScript")
18146 !! options
18147 parsoid=wt2html,wt2wt,html2html
18148 !! wikitext
18149 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18150 !! html/php
18151 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18152 </p>
18153 !! html/php+tidy
18154 <p>JavaScript</p>
18155 !! html/parsoid
18156 <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>
18157 !! end
18158
18159 !! test
18160 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18161 !! wikitext
18162 &#xsee;&#XSEE;
18163 !! html/php
18164 <p>&amp;#xsee;&amp;#XSEE;
18165 </p>
18166 !! html/parsoid
18167 <p>&amp;#xsee;&amp;#XSEE;</p>
18168 !! end
18169
18170 !! test
18171 HTML Hex character encoding mixed case
18172 !! options
18173 parsoid=wt2html,wt2wt,html2html
18174 !! wikitext
18175 &#xEE;&#Xee;
18176 !! html/php
18177 <p>&#xee;&#xee;
18178 </p>
18179 !! html/php+tidy
18180 <p>îî</p>
18181 !! html/parsoid
18182 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18183 !! end
18184
18185 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18186 # Note that U+000C (form feed) is not a valid XML character, so
18187 # it is banned even though allowed in HTML5.
18188 !! test
18189 Illegal character references (T106578)
18190 !! wikitext
18191 ; Null: &#00;
18192 ; FF: &#xC;
18193 ; CR: &#xD;
18194 ; Control (low): &#8;
18195 ; Control (high): &#x7F; &#x9F;
18196 ; Surrogate: &#xD83D;&#xDCA9;
18197 ; This is an okay astral character: &#x1F4A9;
18198 !! html+tidy
18199 <dl>
18200 <dt>Null</dt>
18201 <dd>&amp;#00;</dd>
18202 <dt>FF</dt>
18203 <dd>&amp;#xC;</dd>
18204 <dt>CR</dt>
18205 <dd>&amp;#xD;</dd>
18206 <dt>Control (low)</dt>
18207 <dd>&amp;#8;</dd>
18208 <dt>Control (high)</dt>
18209 <dd>&amp;#x7F; &amp;#x9F;</dd>
18210 <dt>Surrogate</dt>
18211 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18212 <dt>This is an okay astral character</dt>
18213 <dd>💩</dd>
18214 </dl>
18215 !! end
18216
18217 !! test
18218 __FORCETOC__ override
18219 !! wikitext
18220 __NEWSECTIONLINK__
18221 __FORCETOC__
18222 !! html/php
18223 <p><br />
18224 </p>
18225 !! end
18226
18227 !! test
18228 ISBN code coverage
18229 !! wikitext
18230 ISBN 978-0-1234-56&#x20;789
18231 !! html
18232 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18233 </p>
18234 !! html+tidy
18235 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18236 !! html/parsoid
18237 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18238 !! end
18239
18240 !! test
18241 ISBN followed by 5 spaces
18242 !! wikitext
18243 ISBN
18244 !! html
18245 <p>ISBN
18246 </p>
18247 !! end
18248
18249 !! test
18250 Double ISBN
18251 !! wikitext
18252 ISBN ISBN 1234567890
18253 !! html/php
18254 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18255 </p>
18256 !! html/parsoid
18257 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18258 !! end
18259
18260 # Uppercase X and lowercase x as well
18261 !! test
18262 ISBN with an X
18263 !! wikitext
18264 ISBN 3-462-04561-X
18265 ISBN 3-462-04561-x
18266 ISBN 080442957X
18267 ISBN 080442957x
18268 ISBN 978080442957X
18269 ISBN 978080442957x
18270 !! html/php
18271 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18272 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18273 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18274 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18275 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18276 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18277 </p>
18278 !! html/parsoid
18279 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18280 <a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18281 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18282 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18283 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18284 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18285 !! end
18286
18287 !! test
18288 ISBN with empty prefix (parsoid test)
18289 !! wikitext
18290 ISBN 1234567890
18291 !! html/php
18292 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18293 </p>
18294 !! html/parsoid
18295 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
18296 !! end
18297
18298 !! test
18299 Bug 22905: <abbr> followed by ISBN followed by </a>
18300 !! wikitext
18301 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18302 !! html/php
18303 <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>
18304 </p>
18305 !! html/parsoid
18306 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18307 !! end
18308
18309 !! test
18310 Double RFC
18311 !! wikitext
18312 RFC RFC 1234
18313 !! html
18314 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18315 </p>
18316 !! end
18317
18318 !! test
18319 Double RFC with a wiki link
18320 !! wikitext
18321 RFC [[RFC 1234]]
18322 !! html
18323 <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>
18324 </p>
18325 !! end
18326
18327 !! test
18328 RFC code coverage
18329 !! wikitext
18330 RFC 983&#x20;987
18331 !! html
18332 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18333 </p>
18334 !! html+tidy
18335 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18336 !! end
18337
18338 !! test
18339 Centre-aligned image
18340 !! wikitext
18341 [[Image:foobar.jpg|centre]]
18342 !! html
18343 <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>
18344
18345 !!end
18346
18347 !! test
18348 None-aligned image
18349 !! wikitext
18350 [[Image:foobar.jpg|none]]
18351 !! html
18352 <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>
18353
18354 !!end
18355
18356 !! test
18357 Width + Height sized image (using px) (height is ignored)
18358 !! wikitext
18359 [[Image:foobar.jpg|640x480px]]
18360 !! html
18361 <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>
18362 </p>
18363 !!end
18364
18365 !! test
18366 Width-sized image (using px, no following whitespace)
18367 !! wikitext
18368 [[Image:foobar.jpg|640px]]
18369 !! html
18370 <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>
18371 </p>
18372 !!end
18373
18374 !! test
18375 Width-sized image (using px, with following whitespace - test regression from r39467)
18376 !! wikitext
18377 [[Image:foobar.jpg|640px ]]
18378 !! html
18379 <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>
18380 </p>
18381 !!end
18382
18383 !! test
18384 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18385 !! wikitext
18386 [[Image:foobar.jpg| 640px]]
18387 !! html
18388 <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>
18389 </p>
18390 !!end
18391
18392 !! test
18393 Image with page parameter
18394 !! options
18395 djvu
18396 !! wikitext
18397 [[File:LoremIpsum.djvu|page=2]]
18398 !! html/php
18399 <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>
18400 </p>
18401 !! html/parsoid
18402 <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>
18403 !! end
18404
18405 !! test
18406 Another italics / bold test
18407 !! wikitext
18408 ''' ''x'
18409 !! html
18410 <pre>'<i> </i>x'
18411 </pre>
18412 !!end
18413
18414 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18415 !! test
18416 dt/dd/dl test
18417 !! wikitext
18418 :;;;::
18419 !! html/php
18420 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18421
18422 !! html/parsoid
18423 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18424
18425 !!end
18426
18427
18428 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18429 !! test
18430 Images with the "|" character in the comment
18431 !! wikitext
18432 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18433 !! html/php
18434 <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>
18435
18436 !! html/parsoid
18437 <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>
18438 !! end
18439
18440 !! test
18441 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18442 !! wikitext
18443 <html><script>alert(1);</script></html>
18444 !! html
18445 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18446 </p>
18447 !! end
18448
18449 !! test
18450 HTML with raw HTML ($wgRawHtml==true)
18451 !! options
18452 wgRawHtml=1
18453 !! wikitext
18454 <html><script>alert(1);</script></html>
18455 !! html
18456 <p><script>alert(1);</script>
18457 </p>
18458 !! end
18459
18460 !! test
18461 Parents of subpages, one level up
18462 !! options
18463 subpage title=[[Subpage test/L1/L2/L3]]
18464 !! wikitext
18465 [[../|L2]]
18466 !! html
18467 <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>
18468 </p>
18469 !! end
18470
18471
18472 !! test
18473 Parents of subpages, one level up, not named
18474 !! options
18475 subpage title=[[Subpage test/L1/L2/L3]]
18476 !! wikitext
18477 [[../]]
18478 !! html
18479 <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>
18480 </p>
18481 !! end
18482
18483
18484
18485 !! test
18486 Parents of subpages, two levels up
18487 !! options
18488 subpage title=[[Subpage test/L1/L2/L3]]
18489 !! wikitext
18490 [[../../|L1]]2
18491
18492 [[../../|L1]]l
18493 !! html
18494 <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
18495 </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>
18496 </p>
18497 !! end
18498
18499 !! test
18500 Parents of subpages, two levels up, without trailing slash or name.
18501 !! options
18502 subpage title=[[Subpage test/L1/L2/L3]]
18503 !! wikitext
18504 [[../..]]
18505 !! html
18506 <p>[[../..]]
18507 </p>
18508 !! end
18509
18510 !! test
18511 Parents of subpages, two levels up, with lots of extra trailing slashes.
18512 !! options
18513 subpage title=[[Subpage test/L1/L2/L3]]
18514 !! wikitext
18515 [[../../////]]
18516 !! html
18517 <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>
18518 </p>
18519 !! end
18520
18521 !! article
18522 Subpage test/L1/L2/L3Sibling
18523 !! text
18524 Sibling article
18525 !! endarticle
18526
18527 !! test
18528 Transclusion of a sibling page (one level up)
18529 !! options
18530 subpage title=[[Subpage test/L1/L2/L3]]
18531 !! wikitext
18532 {{../L3Sibling}}
18533 !! html
18534 <p>Sibling article
18535 </p>
18536 !! end
18537
18538 !! test
18539 Transclusion of a child page
18540 !! options
18541 subpage title=[[Subpage test/L1/L2]]
18542 !! wikitext
18543 {{/L3Sibling}}
18544 !! html
18545 <p>Sibling article
18546 </p>
18547 !! end
18548
18549 !! test
18550 Non-transclusion because of too many up levels
18551 !! options
18552 subpage title=[[Subpage test/L1/L2/L3]]
18553 !! wikitext
18554 {{../../../../More than parent}}
18555 !! html
18556 <p>{{../../../../More than parent}}
18557 </p>
18558 !! end
18559
18560 !! test
18561 Definition list code coverage
18562 !! wikitext
18563 ; title : def
18564 ; title : def
18565 ;title: def
18566 !! html/php
18567 <dl><dt> title &#160;</dt>
18568 <dd> def</dd>
18569 <dt> title&#160;</dt>
18570 <dd> def</dd>
18571 <dt>title</dt>
18572 <dd> def</dd></dl>
18573
18574 !! html/parsoid
18575 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18576 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18577 <dt>title</dt><dd> def</dd></dl>
18578 !! end
18579
18580 !! test
18581 Don't fall for the self-closing div
18582 !! wikitext
18583 <div>hello world</div/>
18584 !! html
18585 <div>hello world</div>
18586
18587 !! end
18588
18589 !! test
18590 MSGNW magic word
18591 !! wikitext
18592 {{MSGNW:msg}}
18593 !! html/php
18594 <p>&#91;&#91;:Template:Msg&#93;&#93;
18595 </p>
18596 !! end
18597
18598 !! test
18599 RAW magic word
18600 !! wikitext
18601 {{RAW:QUERTY}}
18602 !! html
18603 <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>
18604 </p>
18605 !! end
18606
18607 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18608 !! test
18609 Always escape literal '>' in output, not just after '<'
18610 !! wikitext
18611 ><>
18612 !! html
18613 <p>&gt;&lt;&gt;
18614 </p>
18615 !! end
18616
18617 !! test
18618 Template caching
18619 !! wikitext
18620 {{Test}}
18621 {{Test}}
18622 !! html
18623 <p>This is a test template
18624 This is a test template
18625 </p>
18626 !! end
18627
18628
18629 !! article
18630 MediaWiki:Fake
18631 !! text
18632 ==header==
18633 !! endarticle
18634
18635 !! test
18636 Inclusion of !userCanEdit() content
18637 !! wikitext
18638 {{MediaWiki:Fake}}
18639 !! html
18640 <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>
18641
18642 !! end
18643
18644
18645 !! test
18646 Out-of-order TOC heading levels
18647 !! wikitext
18648 ==2==
18649 ======6======
18650 ===3===
18651 =1=
18652 =====5=====
18653 ==2==
18654 !! html
18655 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18656 <ul>
18657 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18658 <ul>
18659 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18660 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18661 </ul>
18662 </li>
18663 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18664 <ul>
18665 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18666 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18667 </ul>
18668 </li>
18669 </ul>
18670 </div>
18671
18672 <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>
18673 <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>
18674 <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>
18675 <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>
18676 <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>
18677 <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>
18678
18679 !! end
18680
18681
18682 !! test
18683 ISBN with a dummy number
18684 !! wikitext
18685 ISBN ---
18686 !! html
18687 <p>ISBN ---
18688 </p>
18689 !! end
18690
18691
18692 !! test
18693 ISBN with space-delimited number
18694 !! wikitext
18695 ISBN 92 9017 032 8
18696 !! html
18697 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18698 </p>
18699 !! end
18700
18701
18702 !! test
18703 ISBN with multiple spaces, no number
18704 !! wikitext
18705 ISBN foo
18706 !! html
18707 <p>ISBN foo
18708 </p>
18709 !! end
18710
18711
18712 !! test
18713 ISBN length
18714 !! wikitext
18715 ISBN 123456789
18716
18717 ISBN 1234567890
18718
18719 ISBN 12345678901
18720 !! html
18721 <p>ISBN 123456789
18722 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18723 </p><p>ISBN 12345678901
18724 </p>
18725 !! end
18726
18727
18728 !! test
18729 ISBN with trailing year (bug 8110)
18730 !! wikitext
18731 ISBN 1-234-56789-0 - 2006
18732
18733 ISBN 1 234 56789 0 - 2006
18734 !! html
18735 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18736 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18737 </p>
18738 !! end
18739
18740
18741 !! test
18742 anchorencode
18743 !! wikitext
18744 {{anchorencode:foo bar©#%n}}
18745 !! html
18746 <p>foo_bar.C2.A9.23.25n
18747 </p>
18748 !! end
18749
18750 !! test
18751 anchorencode trims spaces
18752 !! wikitext
18753 {{anchorencode: __pretty__please__}}
18754 !! html
18755 <p>pretty_please
18756 </p>
18757 !! end
18758
18759 !! test
18760 anchorencode deals with links
18761 !! wikitext
18762 {{anchorencode: [[hello|world]] [[hi]]}}
18763 !! html
18764 <p>world_hi
18765 </p>
18766 !! end
18767
18768 !! test
18769 anchorencode deals with templates
18770 !! wikitext
18771 {{anchorencode: {{Foo}} }}
18772 !! html
18773 <p>FOO
18774 </p>
18775 !! end
18776
18777 !! test
18778 anchorencode encodes like the TOC generator: (bug 18431)
18779 !! wikitext
18780 === _ +:.3A%3A&&amp;]] ===
18781 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18782 __NOEDITSECTION__
18783 !! html
18784 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18785 <p>.2B:.3A.253A.26.26.5D.5D
18786 </p>
18787 !! end
18788
18789 !! test
18790 Bug 6200: blockquotes and paragraph formatting
18791 !! wikitext
18792 <blockquote>
18793 foo
18794 </blockquote>
18795
18796 bar
18797
18798 baz
18799 !! html
18800 <blockquote>
18801 <p>foo
18802 </p>
18803 </blockquote>
18804 <p>bar
18805 </p>
18806 <pre>baz
18807 </pre>
18808 !! end
18809
18810 !! test
18811 Bug 8293: Use of center tag ruins paragraph formatting
18812 !! wikitext
18813 <center>
18814 foo
18815 </center>
18816
18817 bar
18818
18819 baz
18820 !! html
18821 <center>
18822 <p>foo
18823 </p>
18824 </center>
18825 <p>bar
18826 </p>
18827 <pre>baz
18828 </pre>
18829 !! end
18830
18831 !!test
18832 Parsing of overlapping (improperly nested) inline html tags
18833 !! wikitext
18834 <span><s>x</span></s>
18835 !! html/php
18836 <p><span><s>x&lt;/span&gt;</s></span>
18837 </p>
18838 !! html/parsoid
18839 <p><span><s>x</s></span>
18840 </p>
18841 !!end
18842
18843 ###
18844 ### Language variants related tests
18845 ###
18846 !! test
18847 Self-link in language variants
18848 !! options
18849 title=[[Dunav]] language=sr
18850 !! wikitext
18851 Both [[Dunav]] and [[Дунав]] are names for this river.
18852 !! html
18853 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18854 </p>
18855 !!end
18856
18857 !! article
18858 Дуна
18859 !! text
18860 content
18861 !! endarticle
18862
18863 !! test
18864 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18865 !! options
18866 title=[[Duna]] language=sr
18867 !! wikitext
18868 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18869 !! html
18870 <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.
18871 </p>
18872 !! end
18873
18874 !! test
18875 Link to a section of a variant of this title shouldn't be parsed as self-link
18876 !! options
18877 title=[[Duna]] language=sr
18878 !! wikitext
18879 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18880 !! html
18881 <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.
18882 </p>
18883 !! end
18884
18885 !! test
18886 Link to pages in language variants
18887 !! options
18888 language=sr
18889 !! wikitext
18890 Main Page can be written as [[Маин Паге]]
18891 !! html
18892 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18893 </p>
18894 !!end
18895
18896
18897 !! test
18898 Multiple links to pages in language variants
18899 !! options
18900 language=sr
18901 !! wikitext
18902 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18903 !! html
18904 <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>.
18905 </p>
18906 !!end
18907
18908
18909 !! test
18910 Simple template in language variants
18911 !! options
18912 language=sr
18913 !! wikitext
18914 {{тест}}
18915 !! html
18916 <p>This is a test template
18917 </p>
18918 !! end
18919
18920
18921 !! test
18922 Template with explicit namespace in language variants
18923 !! options
18924 language=sr
18925 !! wikitext
18926 {{Template:тест}}
18927 !! html
18928 <p>This is a test template
18929 </p>
18930 !! end
18931
18932
18933 !! test
18934 Basic test for template parameter in language variants
18935 !! options
18936 language=sr
18937 !! wikitext
18938 {{парамтест|param=foo}}
18939 !! html
18940 <p>This is a test template with parameter foo
18941 </p>
18942 !! end
18943
18944
18945 !! test
18946 Simple category in language variants
18947 !! options
18948 language=sr cat
18949 !! wikitext
18950 [[Category:МедиаWики Усер'с Гуиде]]
18951 !! html
18952 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
18953 !! end
18954
18955
18956 !! article
18957 Category:分类
18958 !! text
18959 blah
18960 !! endarticle
18961
18962 !! article
18963 Category:分類
18964 !! text
18965 blah
18966 !! endarticle
18967
18968 !! test
18969 Don't convert blue categorylinks to another variant (bug 33210)
18970 !! options
18971 language=zh cat
18972 !! wikitext
18973 [[A]][[Category:分类]]
18974 !! html
18975 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18976 !! end
18977
18978
18979 !! test
18980 Stripping -{}- tags (language variants)
18981 !! options
18982 language=sr
18983 !! wikitext
18984 Latin proverb: -{Ne nuntium necare}-
18985 !! html
18986 <p>Latin proverb: Ne nuntium necare
18987 </p>
18988 !! end
18989
18990
18991 !! test
18992 Prevent conversion with -{}- tags (language variants)
18993 !! options
18994 language=sr variant=sr-ec
18995 !! wikitext
18996 Latinski: -{Ne nuntium necare}-
18997 !! html
18998 <p>Латински: Ne nuntium necare
18999 </p>
19000 !! end
19001
19002
19003 !! test
19004 Prevent conversion of text with -{}- tags (language variants)
19005 !! options
19006 language=sr variant=sr-ec
19007 !! wikitext
19008 Latinski: -{Ne nuntium necare}-
19009 !! html
19010 <p>Латински: Ne nuntium necare
19011 </p>
19012 !! end
19013
19014
19015 !! test
19016 Prevent conversion of links with -{}- tags (language variants)
19017 !! options
19018 language=sr variant=sr-ec
19019 !! wikitext
19020 -{[[Main Page]]}-
19021 !! html
19022 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19023 </p>
19024 !! end
19025
19026
19027 !! test
19028 -{}- tags within headlines (within html for parserConvert())
19029 !! options
19030 language=sr variant=sr-ec
19031 !! wikitext
19032 == -{Naslov}- ==
19033 !! html
19034 <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>
19035
19036 !! end
19037
19038
19039 !! test
19040 Explicit definition of language variant alternatives
19041 !! options
19042 language=zh variant=zh-tw
19043 !! wikitext
19044 -{zh:China;zh-tw:Taiwan}-, not China
19045 !! html
19046 <p>Taiwan, not China
19047 </p>
19048 !! end
19049
19050
19051 !! test
19052 Conversion around HTML tags
19053 !! options
19054 language=sr variant=sr-ec
19055 !! wikitext
19056 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19057 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19058 !! html
19059 <p>
19060 <span title="ЛаCтин">ски</span>
19061 </p>
19062 !! end
19063
19064
19065 !! test
19066 Explicit session-wise language variant mapping (A flag and - flag)
19067 !! options
19068 language=zh variant=zh-tw
19069 !! wikitext
19070 Taiwan is not China.
19071 But -{A|zh:China;zh-tw:Taiwan}- is China,
19072 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19073 and -{China}- is China.
19074 !! html
19075 <p>Taiwan is not China.
19076 But Taiwan is Taiwan,
19077 (This should be stripped!)
19078 and China is China.
19079 </p>
19080 !! end
19081
19082 !! test
19083 Explicit session-wise language variant mapping (H flag for hide)
19084 !! options
19085 language=zh variant=zh-tw
19086 !! wikitext
19087 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19088 Taiwan is China.
19089 !! html
19090 <p>(This should be stripped!)
19091 Taiwan is Taiwan.
19092 </p>
19093 !! end
19094
19095 !! test
19096 Adding explicit conversion rule for title (T flag)
19097 !! options
19098 language=zh variant=zh-tw showtitle
19099 !! wikitext
19100 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19101 !! html
19102 Taiwan
19103 <p>Should be stripped!
19104 </p>
19105 !! end
19106
19107 !! test
19108 Testing that changing the language variant here in the tests actually works
19109 !! options
19110 language=zh variant=zh showtitle
19111 !! wikitext
19112 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19113 !! html
19114 China
19115 <p>Should be stripped!
19116 </p>
19117 !! end
19118
19119 !! test
19120 Recursive conversion of alt and title attrs shouldn't clear converter state
19121 !! options
19122 language=zh variant=zh-cn showtitle
19123 !! wikitext
19124 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19125 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19126 !! html
19127 China
19128 <p>
19129 Should be stripped<span title="Exclamation">!</span>
19130 </p>
19131 !! end
19132
19133 !! test
19134 Bug 24072: more test on conversion rule for title
19135 !! options
19136 language=zh variant=zh-tw showtitle
19137 !! wikitext
19138 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19139 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19140 !! html
19141 Taiwan
19142 <p>This should be stripped!
19143 This won't take interferes with the title rule.
19144 </p>
19145 !! end
19146
19147 !! test
19148 Partly disable title conversion if variant == main language code
19149 !! options
19150 language=zh variant=zh title=[[ZH]] showtitle
19151 !! wikitext
19152 -{T|zh-cn:CN;zh-tw:TW}-
19153 !! html
19154 ZH
19155 <p>
19156 </p>
19157 !! end
19158
19159 !! test
19160 Partly disable title conversion if variant == main language code, more
19161 !! options
19162 language=zh variant=zh title=[[ZH]] showtitle
19163 !! wikitext
19164 -{T|TW}-
19165 !! html
19166 ZH
19167 <p>
19168 </p>
19169 !! end
19170
19171 !! test
19172 Raw output of variant escape tags (R flag)
19173 !! options
19174 language=zh variant=zh-tw
19175 !! wikitext
19176 Raw: -{R|zh:China;zh-tw:Taiwan}-
19177 !! html
19178 <p>Raw: zh:China;zh-tw:Taiwan
19179 </p>
19180 !! end
19181
19182 !! test
19183 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19184 !! options
19185 language=zh variant=zh-cn
19186 !! input
19187 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19188 !! result
19189 <p>0
19190 </p>
19191 !! end
19192
19193 !! test
19194 Conversion rules from [numeric-only string] to [something else] (T48634)
19195 !! options
19196 language=zh variant=zh-cn
19197 !! input
19198 -{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
19199 !! result
19200 <p>D12345EE12345
19201 </p>
19202 !! end
19203
19204 !! test
19205 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19206 !! options
19207 language=zh variant=zh-cn
19208 !! input
19209 -{H|zh-cn:foo;zh-tw:;}-foobar
19210 !! result
19211 <p>foobar
19212 </p>
19213 !! end
19214
19215 !! test
19216 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19217 !! options
19218 language=zh variant=zh-cn
19219 !! input
19220 -{H|=>zh-cn:foo;}-foobar
19221 !! result
19222 <p>foobar
19223 </p>
19224 !! end
19225
19226 !! test
19227 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19228 !! options
19229 language=zh variant=zh-cn
19230 !! input
19231 -{H|}-foobar
19232 !! result
19233 <p>foobar
19234 </p>
19235 !! end
19236
19237 !! test
19238 Nested using of manual convert syntax
19239 !! options
19240 language=zh variant=zh-hk
19241 !! wikitext
19242 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19243 !! html
19244 <p>Nested: Hello Hong Kong!
19245 </p>
19246 !! end
19247
19248 !! test
19249 Proper conversion of text in external links
19250 !! options
19251 language=sr variant=sr-ec
19252 !! wikitext
19253 http://www.google.com
19254 gopher://www.google.com
19255 [http://www.google.com http://www.google.com]
19256 [gopher://www.google.com gopher://www.google.com]
19257 [https://www.google.com irc://www.google.com]
19258 [ftp://www.google.com www.google.com/ftp://dir]
19259 [//www.google.com www.google.com]
19260 !! html
19261 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19262 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19263 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19264 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19265 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19266 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19267 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19268 </p>
19269 !! end
19270
19271 !! test
19272 Do not convert roman numbers to language variants
19273 !! options
19274 language=sr variant=sr-ec
19275 !! wikitext
19276 Fridrih IV je car.
19277 !! html
19278 <p>Фридрих IV је цар.
19279 </p>
19280 !! end
19281
19282 !! test
19283 Unclosed language converter markup "-{"
19284 !! options
19285 language=sr
19286 !! wikitext
19287 -{T|hello
19288 !! html
19289 <p>-{T|hello
19290 </p>
19291 !! end
19292
19293 !! test
19294 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19295 !! options
19296 language=sr
19297 !! wikitext
19298 -{R|=&gt;}-
19299 !! html
19300 <p>=&gt;
19301 </p>
19302 !!end
19303
19304 !! test
19305 Don't break link parsing if language converter markup is in the caption.
19306 !! options
19307 language=sr variant=sr-ec
19308 !! wikitext
19309 [[Main Page|-{R|main page}-]]
19310 !! html
19311 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19312 </p>
19313 !! end
19314
19315 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19316 !! test
19317 Don't break image parsing if language converter markup is in the caption.
19318 !! options
19319 language=sr
19320 !! wikitext
19321 [[File:Foobar.jpg|-{R|caption}-]]
19322 !! html/parsoid
19323 <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>
19324 </p>
19325 !! end
19326
19327 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19328 !! test
19329 Don't break list handling if language converter markup is in the item.
19330 !! options
19331 language=zh variant=zh-cn
19332 !! wikitext
19333 ;-{zh-cn:AAA;zh-tw:BBB}-
19334 !! html/php
19335 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19336
19337 !! html/parsoid
19338 <dl><dt>AAA
19339 </dt></dl>
19340 !! end
19341
19342 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19343 !! test
19344 Don't break table handling if language converter markup is in the cell.
19345 !! options
19346 language=sr variant=sr-ec
19347 !! wikitext
19348 {|
19349 |-
19350 | -{R|B}-
19351 |}
19352 !! html/php
19353 <table>
19354
19355 <tr>
19356 <td>Б}-
19357 </td></tr></table>
19358
19359 !! html/parsoid
19360 <table>
19361
19362 <tr>
19363 <td> B
19364 </td></tr></table>
19365
19366 !! end
19367
19368 !! test
19369 Bug 529: Uncovered bullet
19370 !! wikitext
19371 * Foo {{bullet}}
19372 !! html
19373 <ul><li> Foo </li>
19374 <li> Bar</li></ul>
19375
19376 !! end
19377
19378 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19379 # Templates in Wikipedia rely on this behavior, as tidy has always been
19380 # enabled there. These tests are normally run *without* tidy, so specify the
19381 # full output here.
19382 # To test realistic parsing behavior, apply a tidy-like transformation to both
19383 # the expected output and your parser's output.
19384 !! test
19385 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19386 !! wikitext
19387 ******* Foo {{bullet}}
19388 !! html
19389 <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>
19390 <li> Bar</li></ul>
19391
19392 !! end
19393
19394 !! test
19395 Bug 529: Uncovered table already at line-start
19396 !! wikitext
19397 x
19398
19399 {{table}}
19400 y
19401 !! html
19402 <p>x
19403 </p>
19404 <table>
19405 <tr>
19406 <td> 1 </td>
19407 <td> 2
19408 </td></tr>
19409 <tr>
19410 <td> 3 </td>
19411 <td> 4
19412 </td></tr></table>
19413 <p>y
19414 </p>
19415 !! end
19416
19417 !! test
19418 Bug 529: Uncovered bullet in parser function result
19419 !! wikitext
19420 * Foo {{lc:{{bullet}} }}
19421 !! html
19422 <ul><li> Foo </li>
19423 <li> bar</li></ul>
19424
19425 !! end
19426
19427 !! test
19428 Bug 5678: Double-parsed template argument
19429 !! wikitext
19430 {{lc:{{{1}}}|hello}}
19431 !! html
19432 <p>{{{1}}}
19433 </p>
19434 !! end
19435
19436 !! test
19437 Bug 5678: Double-parsed template invocation
19438 !! wikitext
19439 {{lc:{{paramtest {{!}} param = hello }} }}
19440 !! html
19441 <p>{{paramtest | param = hello }}
19442 </p>
19443 !! end
19444
19445 !! test
19446 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19447 !! options
19448 language=cs
19449 title=[[Main Page]]
19450 !! wikitext
19451 {{PRVNÍVELKÉ:ěščř}}
19452 {{prvnívelké:ěščř}}
19453 {{PRVNÍMALÉ:ěščř}}
19454 {{prvnímalé:ěščř}}
19455 {{MALÁ:ěščř}}
19456 {{malá:ěščř}}
19457 {{VELKÁ:ěščř}}
19458 {{velká:ěščř}}
19459 !! html
19460 <p>Ěščř
19461 Ěščř
19462 ěščř
19463 ěščř
19464 ěščř
19465 ěščř
19466 ĚŠČŘ
19467 ĚŠČŘ
19468 </p>
19469 !! end
19470
19471 !! test
19472 Morwen/13: Unclosed link followed by heading
19473 !! wikitext
19474 [[link
19475 ==heading==
19476 !! html
19477 <p>[[link
19478 </p>
19479 <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>
19480
19481 !! end
19482
19483 !! test
19484 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19485 !! wikitext
19486 {{foo|
19487 =heading=
19488 !! html
19489 <p>{{foo|
19490 </p>
19491 <h1><span class="mw-headline" id="heading">heading</span></h1>
19492
19493 !! end
19494
19495 !! test
19496 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19497 !! wikitext
19498 {{foo|
19499 ==heading==
19500 !! html
19501 <p>{{foo|
19502 </p>
19503 <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>
19504
19505 !! end
19506
19507 !! test
19508 Tildes in comments
19509 !! options
19510 pst
19511 !! wikitext
19512 <!-- ~~~~ -->
19513 !! html
19514 <!-- ~~~~ -->
19515 !! end
19516
19517 !! test
19518 Paragraphs inside divs (no extra line breaks)
19519 !! wikitext
19520 <div>Line one
19521
19522 Line two</div>
19523 !! html
19524 <div>Line one
19525 Line two</div>
19526
19527 !! end
19528
19529 !! test
19530 Paragraphs inside divs (extra line break on open)
19531 !! wikitext
19532 <div>
19533 Line one
19534
19535 Line two</div>
19536 !! html
19537 <div>
19538 <p>Line one
19539 </p>
19540 Line two</div>
19541
19542 !! end
19543
19544 !! test
19545 Paragraphs inside divs (extra line break on close)
19546 !! wikitext
19547 <div>Line one
19548
19549 Line two
19550 </div>
19551 !! html
19552 <div>Line one
19553 <p>Line two
19554 </p>
19555 </div>
19556
19557 !! end
19558
19559 !! test
19560 Paragraphs inside divs (extra line break on open and close)
19561 !! wikitext
19562 <div>
19563 Line one
19564
19565 Line two
19566 </div>
19567 !! html
19568 <div>
19569 <p>Line one
19570 </p><p>Line two
19571 </p>
19572 </div>
19573
19574 !! end
19575
19576 !! test
19577 Nesting tags, paragraphs on lines which begin with <div>
19578 !! wikitext
19579 <div></div><strong>A
19580 B</strong>
19581 !! html/php+tidy
19582 <p><strong>A</strong></p>
19583 <p><strong>B</strong></p>
19584 !! html/parsoid
19585 <div></div>
19586 <p><strong>A
19587 B</strong>
19588 </p>
19589 !! end
19590
19591 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19592 !! test
19593 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19594 !! wikitext
19595 <blockquote>Line one
19596
19597 Line two</blockquote>
19598 !! html
19599 <blockquote>Line one
19600 Line two</blockquote>
19601
19602 !! html+tidy
19603 <blockquote>
19604 <p>Line one Line two</p>
19605 </blockquote>
19606 !! end
19607
19608 !! test
19609 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19610 !! wikitext
19611 <blockquote>
19612 Line one
19613
19614 Line two</blockquote>
19615 !! html
19616 <blockquote>
19617 <p>Line one
19618 </p>
19619 Line two</blockquote>
19620
19621 !! html+tidy
19622 <blockquote>
19623 <p>Line one</p>
19624 Line two</blockquote>
19625 !! end
19626
19627 !! test
19628 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19629 !! wikitext
19630 <blockquote>Line one
19631
19632 Line two
19633 </blockquote>
19634 !! html
19635 <blockquote>Line one
19636 <p>Line two
19637 </p>
19638 </blockquote>
19639
19640 !! html+tidy
19641 <blockquote>
19642 <p>Line one</p>
19643 <p>Line two</p>
19644 </blockquote>
19645 !! end
19646
19647 !! test
19648 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19649 !! wikitext
19650 <blockquote>
19651 Line one
19652
19653 Line two
19654 </blockquote>
19655 !! html
19656 <blockquote>
19657 <p>Line one
19658 </p><p>Line two
19659 </p>
19660 </blockquote>
19661
19662 !! html+tidy
19663 <blockquote>
19664 <p>Line one</p>
19665 <p>Line two</p>
19666 </blockquote>
19667 !! end
19668
19669 !! test
19670 Paragraphs inside blockquotes/divs (no extra line breaks)
19671 !! wikitext
19672 <blockquote><div>Line one
19673
19674 Line two</div></blockquote>
19675 !! html
19676 <blockquote><div>Line one
19677 Line two</div></blockquote>
19678
19679 !! end
19680
19681 !! test
19682 Paragraphs inside blockquotes/divs (extra line break on open)
19683 !! wikitext
19684 <blockquote><div>
19685 Line one
19686
19687 Line two</div></blockquote>
19688 !! html
19689 <blockquote><div>
19690 <p>Line one
19691 </p>
19692 Line two</div></blockquote>
19693
19694 !! end
19695
19696 !! test
19697 Paragraphs inside blockquotes/divs (extra line break on close)
19698 !! wikitext
19699 <blockquote><div>Line one
19700
19701 Line two
19702 </div></blockquote>
19703 !! html
19704 <blockquote><div>Line one
19705 <p>Line two
19706 </p>
19707 </div></blockquote>
19708
19709 !! end
19710
19711 !! test
19712 Paragraphs inside blockquotes/divs (extra line break on open and close)
19713 !! wikitext
19714 <blockquote><div>
19715 Line one
19716
19717 Line two
19718 </div></blockquote>
19719 !! html
19720 <blockquote><div>
19721 <p>Line one
19722 </p><p>Line two
19723 </p>
19724 </div></blockquote>
19725
19726 !! end
19727
19728 !! test
19729 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19730 !! options
19731 wgLinkHolderBatchSize=0
19732 !! wikitext
19733 [[meatball:1]]
19734 [[meatball:2]]
19735 [[meatball:3]]
19736 !! html
19737 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19738 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19739 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19740 </p>
19741 !! end
19742
19743 !! test
19744 Free external link invading image caption
19745 !! wikitext
19746 [[Image:Foobar.jpg|thumb|http://x|hello]]
19747 !! html
19748 <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>
19749
19750 !! end
19751
19752 !! test
19753 Bug 15196: localised external link numbers
19754 !! options
19755 language=fa
19756 !! wikitext
19757 [http://en.wikipedia.org/]
19758 !! html/php
19759 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19760 </p>
19761 !! html/parsoid
19762 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19763 !! end
19764
19765 !! test
19766 Multibyte character in padleft
19767 !! wikitext
19768 {{padleft:-Hello|7|Æ}}
19769 !! html
19770 <p>Æ-Hello
19771 </p>
19772 !! end
19773
19774 !! test
19775 Multibyte character in padright
19776 !! wikitext
19777 {{padright:Hello-|7|Æ}}
19778 !! html
19779 <p>Hello-Æ
19780 </p>
19781 !! end
19782
19783 !!test
19784 formatdate parser function
19785 !! wikitext
19786 {{#formatdate:2009-03-24}}
19787 !! html
19788 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19789 </p>
19790 !! end
19791
19792 !!test
19793 formatdate parser function, with default format
19794 !! wikitext
19795 {{#formatdate:2009-03-24|mdy}}
19796 !! html
19797 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19798 </p>
19799 !! end
19800
19801 !! test
19802 Spacing of numbers in formatted dates
19803 !! wikitext
19804 {{#formatdate:January 15}}
19805 !! html
19806 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19807 </p>
19808 !! end
19809
19810 !! test
19811 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
19812 !! options
19813 language=nl title=[[MediaWiki:Common.css]]
19814 !! wikitext
19815 {{#formatdate:2009-03-24|dmy}}
19816 !! html
19817 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19818 </p>
19819 !! end
19820
19821 #
19822 #
19823 #
19824
19825 #
19826 # Edit comments
19827 #
19828
19829 !! test
19830 Edit comment with link
19831 !! options
19832 comment
19833 !! wikitext
19834 I like the [[Main Page]] a lot
19835 !! html
19836 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19837 !!end
19838
19839 !! test
19840 Edit comment with link and link text
19841 !! options
19842 comment
19843 !! wikitext
19844 I like the [[Main Page|best pages]] a lot
19845 !! html
19846 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19847 !!end
19848
19849 !! test
19850 Edit comment with link and link text with suffix
19851 !! options
19852 comment
19853 !! wikitext
19854 I like the [[Main Page|best page]]s a lot
19855 !! html
19856 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19857 !!end
19858
19859 !! test
19860 Edit comment with section link (non-local, eg in history list)
19861 !! options
19862 comment title=[[Main Page]]
19863 !! wikitext
19864 /* External links */ removed bogus entries
19865 !! html
19866 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19867 !!end
19868
19869 !! test
19870 Edit comment with section link and text before it (non-local, eg in history list)
19871 !! options
19872 comment title=[[Main Page]]
19873 !! wikitext
19874 pre-comment text /* External links */ removed bogus entries
19875 !! html
19876 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>
19877 !!end
19878
19879 !! test
19880 Edit comment with section link (local, eg in diff view)
19881 !! options
19882 comment local title=[[Main Page]]
19883 !! wikitext
19884 /* External links */ removed bogus entries
19885 !! html
19886 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19887 !!end
19888
19889 !! test
19890 Edit comment with subpage link (bug 14080)
19891 !! options
19892 comment
19893 subpage
19894 title=[[Subpage test]]
19895 !! wikitext
19896 Poked at a [[/subpage]] here...
19897 !! html
19898 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19899 !!end
19900
19901 !! test
19902 Edit comment with subpage link and link text (bug 14080)
19903 !! options
19904 comment
19905 subpage
19906 title=[[Subpage test]]
19907 !! wikitext
19908 Poked at a [[/subpage|neat little page]] here...
19909 !! html
19910 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19911 !!end
19912
19913 !! test
19914 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19915 !! options
19916 comment
19917 title=[[Subpage test]]
19918 !! wikitext
19919 Poked at a [[/subpage]] here...
19920 !! html
19921 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...
19922 !!end
19923
19924 !! test
19925 Edit comment with bare anchor link (local, as on diff)
19926 !! options
19927 comment
19928 local
19929 title=[[Main Page]]
19930 !! wikitext
19931 [[#section]]
19932 !! html
19933 <a href="#section">#section</a>
19934 !! end
19935
19936 !! test
19937 Edit comment with bare anchor link (non-local, as on history)
19938 !! options
19939 comment
19940 title=[[Main Page]]
19941 !! wikitext
19942 [[#section]]
19943 !! html
19944 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19945 !! end
19946
19947 !! test
19948 Anchor starting with underscore
19949 !! wikitext
19950 [[#_ref|One]]
19951 !! html
19952 <p><a href="#_ref">One</a>
19953 </p>
19954 !! end
19955
19956 !! test
19957 Id starting with underscore
19958 !! wikitext
19959 <div id="_ref"></div>
19960 !! html
19961 <div id="_ref"></div>
19962
19963 !! end
19964
19965 !! test
19966 Space normalisation on autocomment (bug 22784)
19967 !! options
19968 comment
19969 title=[[Main Page]]
19970 !! wikitext
19971 /* __hello__world__ */
19972 !! html
19973 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19974 !! end
19975
19976 !! test
19977 percent-encoding and + signs in comments (Bug 26410)
19978 !! options
19979 comment
19980 !! wikitext
19981 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19982 !! html/php
19983 <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>
19984 !! end
19985
19986 # Parsoid doesn't support this yet: see bug 73581
19987 # but it *should* omit the 'src' attribute if the image is bad.
19988 # PHP side of tests was disabled in
19989 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19990 # because of issues in the PHP parserTests infrastructure
19991 # (but the output below is indeed what the PHP side emits)
19992 !! test
19993 Bad images - basic functionality
19994 !! wikitext
19995 [[File:Bad.jpg]]
19996 !! DISABLED/html/php
19997 !! html/parsoid
19998 <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>
19999 !! end
20000
20001 !! test
20002 Bad images - bug 16039: text after bad image disappears
20003 !! wikitext
20004 Foo bar
20005 [[File:Bad.jpg]]
20006 Bar foo
20007 !! DISABLED/html/php
20008 <p>Foo bar
20009 </p><p>Bar foo
20010 </p>
20011 !! html/parsoid
20012 <p>Foo bar
20013 <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>
20014 Bar foo</p>
20015 !! end
20016
20017 !! test
20018 Verify that displaytitle works (bug #22501) no displaytitle
20019 !! options
20020 showtitle
20021 !! config
20022 wgAllowDisplayTitle=true
20023 wgRestrictDisplayTitle=false
20024 !! wikitext
20025 this is not the the title
20026 !! html/php
20027 Parser test
20028 <p>this is not the the title
20029 </p>
20030 !! end
20031
20032 !! test
20033 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20034 !! options
20035 showtitle
20036 title=[[Screen]]
20037 !! config
20038 wgAllowDisplayTitle=true
20039 wgRestrictDisplayTitle=false
20040 !! wikitext
20041 this is not the the title
20042 {{DISPLAYTITLE:whatever}}
20043 !! html/php
20044 whatever
20045 <p>this is not the the title
20046 </p>
20047 !! end
20048
20049 !! test
20050 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20051 !! options
20052 showtitle
20053 title=[[Screen]]
20054 !! config
20055 wgAllowDisplayTitle=true
20056 wgRestrictDisplayTitle=true
20057 !! wikitext
20058 this is not the the title
20059 {{DISPLAYTITLE:whatever}}
20060 !! html/php
20061 Screen
20062 <p>this is not the the title
20063 </p>
20064 !! end
20065
20066 !! test
20067 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20068 !! options
20069 showtitle
20070 title=[[Screen]]
20071 !! config
20072 wgAllowDisplayTitle=true
20073 wgRestrictDisplayTitle=true
20074 !! wikitext
20075 this is not the the title
20076 {{DISPLAYTITLE:screen}}
20077 !! html/php
20078 screen
20079 <p>this is not the the title
20080 </p>
20081 !! end
20082
20083 !! test
20084 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20085 !! options
20086 showtitle
20087 title=[[Screen]]
20088 !! config
20089 wgAllowDisplayTitle=false
20090 !! wikitext
20091 this is not the the title
20092 {{DISPLAYTITLE:screen}}
20093 !! html/php
20094 Screen
20095 <p>this is not the the title
20096 <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>
20097 </p>
20098 !! end
20099
20100 !! test
20101 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20102 !! options
20103 showtitle
20104 title=[[Screen]]
20105 !! config
20106 wgAllowDisplayTitle=false
20107 !! wikitext
20108 this is not the the title
20109 !! html/php
20110 Screen
20111 <p>this is not the the title
20112 </p>
20113 !! end
20114
20115 !! test
20116 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20117 !! options
20118 showtitle
20119 title=[[Screen]]
20120 !! config
20121 wgAllowDisplayTitle=true
20122 wgRestrictDisplayTitle=true
20123 !! wikitext
20124 this is not the the title
20125 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20126 !! html/php
20127 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20128 <p>this is not the the title
20129 </p>
20130 !! end
20131
20132 !! test
20133 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20134 !! options
20135 showtitle
20136 title=[[Screen]]
20137 !! config
20138 wgAllowDisplayTitle=true
20139 wgRestrictDisplayTitle=true
20140 !! wikitext
20141 this is not the the title
20142 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20143 !! html/php
20144 <span style="color: red;">s</span>creen
20145 <p>this is not the the title
20146 </p>
20147 !! end
20148
20149 !! test
20150 Page status indicators: Empty name is invalid
20151 !! options
20152 showindicators
20153 !! wikitext
20154 <indicator name=" "></indicator>
20155 <indicator></indicator>
20156 !! html
20157 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20158 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20159 </p>
20160 !! end
20161
20162 !! test
20163 Page status indicators: Weird syntaxes that are okay
20164 !! options
20165 showindicators
20166 !! wikitext
20167 <indicator name="empty" />
20168 <indicator name="name"></indicator>
20169 !! html
20170 empty=
20171 name=
20172 <p><br />
20173 </p>
20174 !! end
20175
20176 !! test
20177 Page status indicators: Torture test
20178 !! options
20179 showindicators
20180 !! wikitext
20181 <indicator name="01">hello world</indicator>
20182 <indicator name="02">[[Main Page]]</indicator>
20183 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20184 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20185 <indicator name="05">* foo
20186 * bar</indicator>
20187 <indicator name="06"><nowiki>foo</nowiki></indicator>
20188 <indicator name="07"> Preformatted</indicator>
20189 <indicator name="08"><div>Broken tag</indicator>
20190 <indicator name="09">{| class=wikitable
20191 | cell
20192 |}</indicator>
20193 <indicator name="10">Two
20194
20195 paragraphs</indicator>
20196 !! html
20197 01=hello world
20198 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20199 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" />
20200 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>
20201 05=<ul><li> foo</li>
20202 <li> bar</li></ul>
20203
20204 06=foo
20205 07=<pre>Preformatted
20206 </pre>
20207 08=<div>Broken tag</div>
20208
20209 09=<table class="wikitable">
20210 <tr>
20211 <td> cell
20212 </td></tr></table>
20213
20214 10=<p>Two
20215 </p><p>paragraphs
20216 </p>
20217 <p><br />
20218 </p><p><br />
20219 </p><p><br />
20220 </p><p><br />
20221 </p><p><br />
20222 </p>
20223 !! end
20224
20225 !! test
20226 preload: check <noinclude> and <includeonly>
20227 !! options
20228 preload
20229 !! wikitext
20230 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20231 !! html/php
20232 Hello kind world.
20233 !! end
20234
20235 !! test
20236 preload: check <onlyinclude>
20237 !! options
20238 preload
20239 !! wikitext
20240 Goodbye <onlyinclude>Hello world</onlyinclude>
20241 !! html/php
20242 Hello world
20243 !! end
20244
20245 !! test
20246 preload: can pass tags through if we want to
20247 !! options
20248 preload
20249 !! wikitext
20250 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20251 !! html/php
20252 <includeonly>Hello world</includeonly>
20253 !! end
20254
20255 !! test
20256 preload: check that it doesn't try to do tricks
20257 !! options
20258 preload
20259 !! wikitext
20260 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20261 !! html/php
20262 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20263 !! end
20264
20265 !! test
20266 Play a bit with r67090 and bug 3158
20267 !! wikitext
20268 <div style="width:50% !important">&nbsp;</div>
20269 <div style="width:50%&nbsp;!important">&nbsp;</div>
20270 <div style="width:50%&#160;!important">&nbsp;</div>
20271 <div style="border : solid;">&nbsp;</div>
20272 !! html/php
20273 <div style="width:50% !important">&#160;</div>
20274 <div style="width:50% !important">&#160;</div>
20275 <div style="width:50% !important">&#160;</div>
20276 <div style="border&#160;: solid;">&#160;</div>
20277
20278 !! html/parsoid
20279 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20280 <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>
20281 <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>
20282 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20283
20284 !! end
20285
20286 !! test
20287 HTML5 data attributes
20288 !! wikitext
20289 <span data-foo="bar">Baz</span>
20290 <p data-abc-def_hij="">Quuz</p>
20291 !! html
20292 <p><span data-foo="bar">Baz</span>
20293 </p>
20294 <p data-abc-def_hij="">Quuz</p>
20295
20296 !! end
20297
20298 !! test
20299 percent-encoding and + signs in internal links (Bug 26410)
20300 !! wikitext
20301 [[User:+%]] [[Page+title%]]
20302 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20303 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20304 [[%33%45]] [[%33%45+]]
20305 !! html/php
20306 <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>
20307 <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>
20308 <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>
20309 <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>
20310 </p>
20311 !! html/parsoid
20312 <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>
20313 <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>
20314 <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>
20315 <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>
20316 !! end
20317
20318 !! test
20319 Special characters in embedded file links (bug 27679)
20320 !! wikitext
20321 [[File:Contains & ampersand.jpg]]
20322 [[File:Does not exist.jpg|Title with & ampersand]]
20323 !! html/php
20324 <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>
20325 <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>
20326 </p>
20327 !! html/parsoid
20328 <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>
20329 <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>
20330 !! end
20331
20332 !! test
20333 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20334 !! wikitext
20335 Text&apos;s been normalized?
20336 !! html
20337 <p>Text&#39;s been normalized?
20338 </p>
20339 !! end
20340
20341 !! test
20342 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20343 !! wikitext
20344 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20345 !! html
20346 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20347 </p>
20348 !! end
20349
20350 !! test
20351 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20352 !! wikitext
20353 [http://www.example.org/ ideograms]
20354 !! html
20355 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20356 </p>
20357 !! end
20358
20359 !! test
20360 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20361 !! wikitext
20362 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20363 !! html
20364 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20365 </p>
20366 !! end
20367
20368 !! article
20369 Mediawiki:loop1
20370 !! text
20371 {{Identical|A}}
20372 !! endarticle
20373
20374 !! article
20375 Mediawiki:loop2
20376 !! text
20377 {{Identical|B}}
20378 !! endarticle
20379
20380 !! article
20381 Template:Identical
20382 !! text
20383 {{int:loop1}}
20384 {{int:loop2}}
20385 !! endarticle
20386
20387 !! test
20388 Bug 31098 Template which includes system messages which includes the template
20389 !! wikitext
20390 {{Identical}}
20391 !! html
20392 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20393 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20394 </p>
20395 !! end
20396
20397 !! test
20398 Bug31490 Turkish: ucfirst 'blah'
20399 !! options
20400 language=tr
20401 !! wikitext
20402 {{ucfirst:blah}}
20403 !! html
20404 <p>Blah
20405 </p>
20406 !! end
20407
20408 !! test
20409 Bug31490 Turkish: ucfirst 'ix'
20410 !! options
20411 language=tr
20412 !! wikitext
20413 {{ucfirst:ix}}
20414 !! html
20415 <p>İx
20416 </p>
20417 !! end
20418
20419 !! test
20420 Bug31490 Turkish: lcfirst 'BLAH'
20421 !! options
20422 language=tr
20423 !! wikitext
20424 {{lcfirst:BLAH}}
20425 !! html
20426 <p>bLAH
20427 </p>
20428 !! end
20429
20430 !! test
20431 Bug31490 Turkish: ucfırst (with a dotless i)
20432 !! options
20433 language=tr
20434 !! wikitext
20435 {{ucfırst:blah}}
20436 !! html
20437 <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>
20438 </p>
20439 !! end
20440
20441 !! test
20442 Bug31490 ucfırst (with a dotless i) with English language
20443 !! options
20444 language=en
20445 !! wikitext
20446 {{ucfırst:blah}}
20447 !! html
20448 <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>
20449 </p>
20450 !! end
20451
20452 !! test
20453 Bug 26375: TOC with italics
20454 !! options
20455 title=[[Main Page]]
20456 !! wikitext
20457 __TOC__
20458 == ''Lost'' episodes ==
20459 !! html
20460 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20461 <ul>
20462 <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>
20463 </ul>
20464 </div>
20465
20466 <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>
20467
20468 !! end
20469
20470 !! test
20471 Bug 26375: TOC with bold
20472 !! options
20473 title=[[Main Page]]
20474 !! wikitext
20475 __TOC__
20476 == '''should be bold''' then normal text ==
20477 !! html
20478 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20479 <ul>
20480 <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>
20481 </ul>
20482 </div>
20483
20484 <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>
20485
20486 !! end
20487
20488 !! test
20489 Bug 33845: Headings become cursive in TOC when they contain an image
20490 !! options
20491 title=[[Main Page]]
20492 !! wikitext
20493 __TOC__
20494 == Image [[Image:foobar.jpg]] ==
20495 !! html
20496 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20497 <ul>
20498 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20499 </ul>
20500 </div>
20501
20502 <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>
20503
20504 !! end
20505
20506 !! test
20507 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20508 !! options
20509 title=[[Main Page]]
20510 !! wikitext
20511 __TOC__
20512 == <blockquote>Quote</blockquote> ==
20513 !! html
20514 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20515 <ul>
20516 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20517 </ul>
20518 </div>
20519
20520 <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>
20521
20522 !! html+tidy
20523 <p></p>
20524 <div id="toc" class="toc">
20525 <div id="toctitle">
20526 <h2>Contents</h2>
20527 </div>
20528 <ul>
20529 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20530 </ul>
20531 </div>
20532 <p></p>
20533 <h2><span class="mw-headline" id="Quote"></span></h2>
20534 <blockquote>
20535 <p><span class="mw-headline" id="Quote">Quote</span></p>
20536 </blockquote>
20537 <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>
20538 !! end
20539
20540 !! test
20541 Unclosed tags in TOC
20542 !! options
20543 title=[[Main Page]]
20544 !! wikitext
20545 __TOC__
20546 == Proof: 2 < 3 ==
20547 <small>Hanc marginis exiguitas non caperet.</small>
20548 QED
20549 !! html
20550 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20551 <ul>
20552 <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>
20553 </ul>
20554 </div>
20555
20556 <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>
20557 <p><small>Hanc marginis exiguitas non caperet.</small>
20558 QED
20559 </p>
20560 !! end
20561
20562 !! test
20563 Multiple tags in TOC
20564 !! wikitext
20565 __TOC__
20566 == <i>Foo</i> <b>Bar</b> ==
20567
20568 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20569 !! html
20570 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20571 <ul>
20572 <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>
20573 <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>
20574 </ul>
20575 </div>
20576
20577 <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>
20578 <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>
20579
20580 !! html+tidy
20581 <p></p>
20582 <div id="toc" class="toc">
20583 <div id="toctitle">
20584 <h2>Contents</h2>
20585 </div>
20586 <ul>
20587 <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>
20588 <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>
20589 </ul>
20590 </div>
20591 <p></p>
20592 <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>
20593 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20594 <blockquote>
20595 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20596 </blockquote>
20597 <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>
20598 !! end
20599
20600 !! test
20601 Tags with parameters in TOC
20602 !! wikitext
20603 __TOC__
20604 == <sup class="in-h2">Hello</sup> ==
20605
20606 == <sup class="a > b">Evilbye</sup> ==
20607 !! html
20608 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20609 <ul>
20610 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20611 <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>
20612 </ul>
20613 </div>
20614
20615 <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>
20616 <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>
20617
20618 !! end
20619
20620 !! test
20621 span tags with directionality in TOC
20622 !! wikitext
20623 __TOC__
20624 == <span dir="ltr">C++</span> ==
20625
20626 == <span dir="rtl">זבנג!</span> ==
20627
20628 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20629
20630 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20631
20632 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20633 !! html
20634 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20635 <ul>
20636 <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>
20637 <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>
20638 <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>
20639 <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>
20640 <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>
20641 </ul>
20642 </div>
20643
20644 <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>
20645 <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>
20646 <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>
20647 <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>
20648 <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>
20649
20650 !! end
20651
20652 !! test
20653 Bug 72884: bdi element in ToC
20654 !! wikitext
20655 __TOC__
20656 == <bdi>test</bdi> ==
20657 !! html
20658 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20659 <ul>
20660 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20661 </ul>
20662 </div>
20663
20664 <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>
20665
20666 !! end
20667
20668 # Note that the html output does not have the <p></p>, but the
20669 # html+tidy output *does*. This is because the empty <p></p> is
20670 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20671 !! test
20672 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20673 !! wikitext
20674 __TOC__
20675 == x ==
20676 !! html
20677 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20678 <ul>
20679 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20680 </ul>
20681 </div>
20682
20683 <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>
20684
20685 !! html+tidy
20686 <p></p>
20687 <div id="toc" class="toc">
20688 <div id="toctitle">
20689 <h2>Contents</h2>
20690 </div>
20691 <ul>
20692 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20693 </ul>
20694 </div>
20695 <p></p>
20696 <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>
20697 !! end
20698
20699 !! article
20700 MediaWiki:Bug32057
20701 !! text
20702 == {{int:headline_sample}} ==
20703 !! endarticle
20704
20705 !! test
20706 Bug 32057: Title needed when expanding <h> nodes.
20707 !! options
20708 title=[[Main Page]]
20709 !! wikitext
20710 {{int:Bug32057}}
20711 !! html
20712 <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>
20713
20714 !! end
20715
20716 !! test
20717 Strip marker in urlencode
20718 !! wikitext
20719 {{urlencode:x<nowiki/>y}}
20720 {{urlencode:x<nowiki/>y|wiki}}
20721 {{urlencode:x<nowiki/>y|path}}
20722 {{urlencode:x<pre id="one">two</pre>y}}
20723 !! html
20724 <p>xy
20725 xy
20726 xy
20727 xy
20728 </p>
20729 !! end
20730
20731 !! test
20732 Strip marker in lc
20733 !! wikitext
20734 {{lc:x<nowiki/>y}}
20735 !! html
20736 <p>xy
20737 </p>
20738 !! end
20739
20740 !! test
20741 Strip marker in uc
20742 !! wikitext
20743 {{uc:x<nowiki/>y}}
20744 !! html
20745 <p>XY
20746 </p>
20747 !! end
20748
20749 !! test
20750 Strip marker in formatNum
20751 !! wikitext
20752 {{formatnum:1<nowiki/>2}}
20753 {{formatnum:1<nowiki/>2|R}}
20754 !! html
20755 <p>12
20756 12
20757 </p>
20758 !! end
20759
20760 !! test
20761 Check noCommafy in formatNum
20762 !! options
20763 language=be-tarask
20764 !! wikitext
20765 {{formatnum:123456.78}}
20766 {{formatnum:123456.78|NOSEP}}
20767 !! html
20768 <p>123 456,78
20769 123456.78
20770 </p>
20771 !! end
20772
20773 !! test
20774 Wrong option for formatNum (bug 56199)
20775 !! wikitext
20776 {{formatnum:1,234.56|Random}}
20777 {{formatnum:1,234.56|EVERYTHING}}
20778 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20779 !! html
20780 <p>1,234.56
20781 1,234.56
20782 1,234.56
20783 </p>
20784 !! end
20785
20786 !! test
20787 Strip marker in grammar
20788 !! options
20789 language=fi
20790 !! wikitext
20791 {{grammar:elative|foo<nowiki/>bar}}
20792 !! html
20793 <p>foobarista
20794 </p>
20795 !! end
20796
20797 !! test
20798 Strip marker in padleft
20799 !! wikitext
20800 {{padleft:|2|x<nowiki/>y}}
20801 !! html
20802 <p>xy
20803 </p>
20804 !! end
20805
20806 !! test
20807 Strip marker in padright
20808 !! wikitext
20809 {{padright:|2|x<nowiki/>y}}
20810 !! html
20811 <p>xy
20812 </p>
20813 !! end
20814
20815 !! test
20816 Strip marker in anchorencode
20817 !! wikitext
20818 {{anchorencode:x<nowiki/>y}}
20819 !! html
20820 <p>xy
20821 </p>
20822 !! end
20823
20824 !! test
20825 nowiki inside link inside heading (bug 18295)
20826 !! wikitext
20827 ==[[foo|x<nowiki>y</nowiki>z]]==
20828 !! html
20829 <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>
20830
20831 !! end
20832
20833 !! test
20834 new support for bdi element (bug 31817)
20835 !! wikitext
20836 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20837 !! html
20838 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20839
20840 !!end
20841
20842 !! test
20843 Ignore pipe between table row attributes
20844 !! wikitext
20845 {|
20846 | quux
20847 |- id=foo | style='color: red'
20848 | bar
20849 |}
20850 !! html
20851 <table>
20852 <tr>
20853 <td> quux
20854 </td></tr>
20855 <tr id="foo" style="color: red">
20856 <td> bar
20857 </td></tr></table>
20858
20859 !! end
20860
20861 !!test
20862 Gallery override link with WikiLink (bug 34852)
20863 !! wikitext
20864 <gallery>
20865 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20866 </gallery>
20867 !! html
20868 <ul class="gallery mw-gallery-traditional">
20869 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20870 <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>
20871 <div class="gallerytext">
20872 <p>caption
20873 </p>
20874 </div>
20875 </div></li>
20876 </ul>
20877
20878 !! end
20879
20880 !!test
20881 Gallery override link with absolute external link (bug 34852)
20882 !! wikitext
20883 <gallery>
20884 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20885 </gallery>
20886 !! html
20887 <ul class="gallery mw-gallery-traditional">
20888 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20889 <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>
20890 <div class="gallerytext">
20891 <p>caption
20892 </p>
20893 </div>
20894 </div></li>
20895 </ul>
20896
20897 !! end
20898
20899 !!test
20900 Gallery override link with malicious javascript (bug 34852)
20901 !! wikitext
20902 <gallery>
20903 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20904 </gallery>
20905 !! html
20906 <ul class="gallery mw-gallery-traditional">
20907 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20908 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20909 <div class="gallerytext">
20910 <p>caption
20911 </p>
20912 </div>
20913 </div></li>
20914 </ul>
20915
20916 !! end
20917
20918 !!test
20919 Gallery with invalid title as link (bug 43964)
20920 !! wikitext
20921 <gallery>
20922 File:foobar.jpg|link=<
20923 </gallery>
20924 !! html
20925 <ul class="gallery mw-gallery-traditional">
20926 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20927 <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>
20928 <div class="gallerytext">
20929 </div>
20930 </div></li>
20931 </ul>
20932
20933 !! end
20934
20935 !!test
20936 Language parser function
20937 !! wikitext
20938 {{#language:ar}}
20939 !! html
20940 <p>العربية
20941 </p>
20942 !! end
20943
20944 !!test
20945 Padleft and padright as substr
20946 !! wikitext
20947 {{padleft:|3|abcde}}
20948 {{padright:|3|abcde}}
20949 !! html
20950 <p>abc
20951 abc
20952 </p>
20953 !! end
20954
20955 !!test
20956 Special parser function
20957 !! wikitext
20958 {{#special:RandomPage}}
20959 {{#special:BaDtItLe}}
20960 {{#special:Foobar}}
20961 !! html
20962 <p>Special:Random
20963 Special:Badtitle
20964 Special:Foobar
20965 </p>
20966 !! end
20967
20968 !!test
20969 Bug 34939 - Case insensitive link parsing ([HttP://])
20970 !! wikitext
20971 [HttP://MediaWiki.Org/]
20972 !! html/php
20973 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20974 </p>
20975 !! html/parsoid
20976 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20977 !! end
20978
20979 !!test
20980 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20981 !! wikitext
20982 [HttP://MediaWiki.Org/ MediaWiki]
20983 !! html
20984 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20985 </p>
20986 !! end
20987
20988 !!test
20989 Bug 34939 - Case insensitive link parsing (HttP://)
20990 !! wikitext
20991 HttP://MediaWiki.Org/
20992 !! html/php
20993 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20994 </p>
20995 !! html/parsoid
20996 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20997 !! end
20998
20999 !!test
21000 Disable TOC
21001 !! options
21002 notoc
21003 !! wikitext
21004 Lead
21005 == Section 1 ==
21006 == Section 2 ==
21007 == Section 3 ==
21008 == Section 4 ==
21009 == Section 5 ==
21010 !! html
21011 <p>Lead
21012 </p>
21013
21014 <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>
21015 <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>
21016 <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>
21017 <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>
21018 <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>
21019
21020 !! end
21021
21022
21023 ###
21024 ### Parsoid-specific tests
21025 ### Parsoid-PHP parser incompatibilities
21026 ###
21027 !!test
21028 1. SOL-sensitive wikitext tokens as template-args
21029 !!options
21030 parsoid=wt2html,wt2wt
21031 !! wikitext
21032 {{echo|*a}}
21033 {{echo|#a}}
21034 {{echo|:a}}
21035 !! html
21036 <span about="#mwt1" typeof="mw:Transclusion">
21037 </span><ul about="#mwt1"><li>a</li>
21038 </ul>
21039 <span about="#mwt2" typeof="mw:Transclusion">
21040 </span><ol about="#mwt2"><li>a</li>
21041 </ol>
21042 <span about="#mwt3" typeof="mw:Transclusion">
21043 </span><dl about="#mwt3"><dd>a</dd>
21044 </dl>
21045 !!end
21046
21047 #### -----------------------------------------------------------------
21048 #### Parsoid-specific functionality tests
21049 #### -----------------------------------------------------------------
21050
21051 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21052 # We know wt2wt will fail, but we expect selser to pass.
21053 # Due to the nature of our testing, wt2wt and selser tests will enter the
21054 # blacklist and we'll catch selser regressions based on changes to the
21055 # blacklist entries for selser tests.
21056 !! test
21057 1. Bad treebuilder fixup of formatting elt is cleaned up
21058 !! options
21059 parsoid=wt2html,wt2wt
21060 !! wikitext
21061 {|
21062 |
21063 <small>
21064 [[Image:Foobar.jpg|right|Test]]
21065 </small>
21066 |}
21067 !! html/parsoid
21068 <table>
21069 <tbody><tr><td>
21070 <small>
21071 <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>
21072 </small>
21073 </td></tr>
21074 </tbody></table>
21075 !! end
21076
21077 !! test
21078 2. Bad treebuilder fixup of formatting elt is cleaned up
21079 !! options
21080 parsoid=wt2html,wt2wt
21081 !! wikitext
21082 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21083
21084 <small>[[Image:Foobar.jpg|right|300px]]</small>
21085 !! html/parsoid
21086
21087 <p><b>foo</b></p>
21088 <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>
21089 <p><b>bar</b></p>
21090 <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>
21091 !! end
21092
21093 !! test
21094 3. Bad treebuilder fixup of formatting elt is cleaned up
21095 !! options
21096 parsoid=wt2html,wt2wt
21097 !! wikitext
21098 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21099 !! html/parsoid
21100 <p><small><b>foo</b></small></p>
21101 <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>
21102 <p><small><b>bar</b></small></p>
21103 !! end
21104
21105 !! test
21106 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21107 !! options
21108 parsoid=wt2html,wt2wt
21109 !! wikitext
21110 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21111 !! html/parsoid
21112 <p><b><small></small></b></p>
21113 <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>
21114 <p></p>
21115 !! end
21116
21117 #### ----------------------------------------------------------------
21118 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21119 #### tags. Parsoid's output for these tags differs from that of the
21120 #### PHP parser.
21121 #### ----------------------------------------------------------------
21122
21123 !!test
21124 Ref: 1. ref-location should be replaced with an index span
21125 !!options
21126 parsoid
21127 !! wikitext
21128 A <ref>foo</ref>
21129 B <ref name="x">foo</ref>
21130 C <ref name="y" />
21131 <references />
21132 !! html
21133 <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>
21134 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>
21135 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>
21136 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21137 <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>
21138 <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>
21139 <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>
21140 </ol>
21141 !!end
21142
21143 !!test
21144 Ref: 2. ref-tags with identical names should all get the same index
21145 !!options
21146 parsoid
21147 !! wikitext
21148 A <ref name="x">foo</ref>
21149 B <ref name="x" />
21150 <references />
21151 !! html
21152 <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>
21153 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>
21154 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21155 <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>
21156 </ol>
21157 !!end
21158
21159 !!test
21160 Ref: 3. spaces in ref-names should be ignored
21161 !!options
21162 parsoid
21163 !! wikitext
21164 A <ref name="x">foo</ref>
21165 B <ref name=" x " />
21166 C <ref name= x />
21167 <references />
21168 !! html
21169 <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>
21170 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>
21171 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>
21172 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21173 <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>
21174 </ol>
21175 !!end
21176
21177 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21178 !!test
21179 Ref: 4. 'constructor' should be accepted as a valid ref-name
21180 !!options
21181 parsoid
21182 !! wikitext
21183 A <ref name="constructor">foo</ref>
21184 <references />
21185 !! html
21186 <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>
21187 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21188 <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>
21189 </ol>
21190 !!end
21191
21192 !!test
21193 Ref: 5. body should accept generic wikitext
21194 !!options
21195 parsoid
21196 !! wikitext
21197 A <ref>
21198 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21199 </ref>
21200
21201 <references />
21202 !! html
21203 <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>
21204
21205 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21206 <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>
21207 </span></li>
21208 </ol>
21209 !!end
21210
21211 !!test
21212 Ref: 6. indent-pres should not be output in ref-body
21213 !!options
21214 parsoid
21215 !! wikitext
21216 A <ref>
21217 foo
21218 bar
21219 baz
21220 </ref>
21221
21222 <references />
21223 !! html
21224 <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>
21225
21226 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21227 <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
21228 bar
21229 baz
21230 </span></li>
21231 </ol>
21232 !!end
21233
21234 !!test
21235 Ref: 7. No p-wrapping in ref-body
21236 !!options
21237 parsoid
21238 !! wikitext
21239 A <ref>
21240 foo
21241
21242 bar
21243
21244
21245 baz
21246
21247
21248
21249 booz
21250 </ref>
21251
21252 <references />
21253 !! html
21254 <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>
21255
21256 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21257 <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
21258
21259 bar
21260
21261
21262 baz
21263
21264
21265
21266 booz
21267 </span></li>
21268 </ol>
21269 !!end
21270
21271 !!test
21272 Ref: 8. transclusion wikitext has lower precedence
21273 !!options
21274 parsoid
21275 !! wikitext
21276 A <ref> foo {{echo|</ref> B C}}
21277
21278 <references />
21279 !! html
21280 <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>
21281 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21282 <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>
21283 </ol>
21284 !!end
21285
21286 !!test
21287 Ref: 9. unclosed comments should not leak out of ref-body
21288 !!options
21289 parsoid
21290 !! wikitext
21291 A <ref> foo <!--</ref> B C
21292 <references />
21293 !! html
21294 <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>
21295 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21296 <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>
21297 </ol>
21298 !!end
21299
21300 !!test
21301 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21302 !!options
21303 parsoid
21304 !! wikitext
21305 A <ref> <b> foo </ref> B C
21306
21307 <references />
21308 !! html
21309 <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>
21310
21311
21312 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21313 <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>
21314 </ol>
21315 !!end
21316
21317 !!test
21318 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21319 !!options
21320 parsoid
21321 !! wikitext
21322 A <ref>foo</ref> B
21323 C <ref>bar</ref> D
21324 <references />
21325 !! html
21326 <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
21327 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>
21328 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21329 <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>
21330 <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>
21331 </ol>
21332 !!end
21333
21334 !!test
21335 Ref: 12. ref-tags act as trailing newline migration barrier
21336 !! wikitext
21337 <!--the newline at the end of this line moves out of the p tag-->a
21338
21339 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21340 <ref />
21341
21342 c
21343 <references />
21344 !! html/parsoid
21345 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21346
21347
21348 <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>
21349 <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>
21350
21351 <p>c</p>
21352 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21353 <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>
21354 <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>
21355 !!end
21356
21357 !!test
21358 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21359 !!options
21360 parsoid
21361 !! wikitext
21362 <ref>foo</ref> A
21363 <ref>bar
21364 </ref> B
21365 <references />
21366 !! html
21367 <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
21368 <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>
21369 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21370 <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>
21371 <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
21372 </span></li>
21373 </ol>
21374 !!end
21375
21376 !!test
21377 Ref: 14. A nested ref-tag should be emitted as plain text
21378 !!options
21379 parsoid
21380 !! wikitext
21381 <ref>foo <ref>bar</ref> baz</ref>
21382
21383 <references />
21384 !! html
21385 <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>
21386 </p>
21387 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21388 <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>
21389 </ol>
21390 !!end
21391
21392 !!test
21393 Ref: 15. ref-tags with identical names should get identical indexes
21394 !!options
21395 parsoid
21396 !! wikitext
21397 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21398 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21399
21400 <references />
21401 !! html
21402 <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>
21403 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>
21404
21405 <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>
21406 </ol>
21407 !!end
21408
21409 ## We don't bother wt2wt-ing non-standard whitespace
21410 !!test
21411 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21412 !!options
21413 parsoid=wt2html
21414 !! wikitext
21415 A <ref >foo</ref >
21416
21417 <references />
21418 !! html
21419 <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>
21420 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21421 <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>
21422 !!end
21423
21424 !!test
21425 Ref: 17. Generate valid HTML5 id/about attributes
21426 !!options
21427 parsoid
21428 !!wikitext
21429 <ref name="a b">foo</ref>
21430
21431 <references />
21432 !!html
21433 <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>
21434 </p>
21435
21436 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21437 <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>
21438 </ol>
21439 !!end
21440
21441 !!test
21442 Ref: 18. T58916: Extension attributes should be parsed as plain text
21443 !!options
21444 parsoid
21445 !!wikitext
21446 <ref name="{{echo|a}}">foo</ref>
21447
21448 <references />
21449 !!html
21450 <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>
21451 </p>
21452
21453 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21454 <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>
21455 </ol>
21456 !!end
21457
21458 !!test
21459 Ref: 19. ref-tags with identical name encodings should get identical indexes
21460 !!options
21461 parsoid
21462 !! wikitext
21463 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21464
21465 <references />
21466 !! html
21467 <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>
21468 </p>
21469 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21470 <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>
21471 </ol>
21472 !!end
21473
21474 !!test
21475 Ref: 20. ref-tags with identical names but different content should keep it
21476 !!options
21477 parsoid
21478 !! wikitext
21479 A <ref name="foo">Foo one</ref>
21480 B <ref name="foo">Foo two</ref>
21481 C <ref name="foo" />
21482
21483 <references />
21484 !! html
21485 <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>
21486 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>
21487 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>
21488
21489 <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>
21490 </ol>
21491 !!end
21492
21493 !!test
21494 References: 1. references tag without any refs should be handled properly
21495 !! wikitext
21496 <references />
21497 !! html/parsoid
21498 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21499 !!end
21500
21501 !!test
21502 References: 2. references tag with group only outputs references from that group
21503 !! wikitext
21504 A <ref group="a">foo</ref>
21505 B <ref group="b">bar</ref>
21506 C <ref>baz</ref>
21507
21508 <references group="a" />
21509 <references />
21510 <references group="b" />
21511 !! html/parsoid
21512 <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>
21513 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>
21514 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>
21515
21516 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21517 <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>
21518 </ol>
21519 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21520 <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>
21521 </ol>
21522 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21523 <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>
21524 </ol>
21525 !!end
21526
21527 !!test
21528 References: 3. ref list should be cleared after processing references
21529 !! wikitext
21530 A <ref>foo</ref>
21531
21532 <references />
21533
21534 B <ref>bar</ref>
21535
21536 <references />
21537 !! html/parsoid
21538 <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>
21539
21540 <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>
21541 </ol>
21542
21543 <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>
21544
21545 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21546 <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>
21547 </ol>
21548 !!end
21549
21550 !!test
21551 References: 4. only referenced group should be cleared after processing references
21552 !! wikitext
21553 A <ref group="a">afoo</ref>
21554 B <ref>bfoo</ref>
21555
21556 <references group="a" />
21557
21558 C <ref>cfoo</ref>
21559
21560 <references />
21561 !! html/parsoid
21562 <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>
21563 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>
21564
21565 <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>
21566 </ol>
21567
21568 <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>
21569
21570 <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>
21571 </ol>
21572 !!end
21573
21574 !!test
21575 References: 5. ref tags in references should be processed while ignoring all other content
21576 !! wikitext
21577 A <ref name="a" />
21578 B <ref name="b">bar</ref>
21579
21580 <references>
21581 <ref name="a">foo</ref>
21582 This should just get lost.
21583 </references>
21584 !! html/parsoid
21585 <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>
21586 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>
21587
21588
21589 <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>
21590 </ol>
21591 !!end
21592
21593 !!test
21594 References: 6. <references /> from a transclusion
21595 !! wikitext
21596 <ref>Foo</ref> {{echo|<references />}}
21597 !! html/parsoid
21598 <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>
21599 </ol>
21600 !!end
21601
21602 !! test
21603 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21604 !! wikitext
21605 A <ref>foo bar for a</ref>
21606 B <ref group="X" name="b" />
21607
21608 <references />
21609
21610 <references group="X">
21611 <ref name="b">foo</ref>
21612 </references>
21613 !! html/parsoid
21614 <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>
21615 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>
21616 </p>
21617
21618 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21619 <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>
21620 </ol>
21621
21622 <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"}}'>
21623 <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>
21624 </ol>
21625 !! end
21626
21627 !! test
21628 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21629 !! wikitext
21630 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21631 <references />
21632 !! html/parsoid
21633 <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>
21634 <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>
21635 </ol>
21636 !!end
21637
21638 # This test only works in wt2html now as the <references /> are always generated
21639 # unless selser is active. Once T72722 is fixed, we should add a changes test
21640 # here to ensure that unrelated changes don't add the new <references /> in
21641 # wt2wt.
21642 !! test
21643 References: 9. Generate missing references list at the end
21644 !! wikitext
21645 A <ref>foo</ref>
21646 B <ref group="inexistent">bar</ref>
21647 !! html/parsoid
21648 <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>
21649 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21650 <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>
21651 </ol>
21652 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21653 <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>
21654 </ol>
21655 !! end
21656
21657 !! test
21658 References: 10. New <references/> shouldn't be added for unrelated edits.
21659 !! options
21660 parsoid={
21661 "modes": ["selser"],
21662 "changes": [["#x", "remove"]],
21663 "selser": "noauto"
21664 }
21665 !! wikitext
21666 Unrelated text<span id="x"> that's going to disappear</span>.
21667 A <ref>foo</ref>
21668 !! wikitext/edited
21669 Unrelated text.
21670 A <ref>foo</ref>
21671 !!end
21672
21673 !! test
21674 Entities in ref name
21675 !! wikitext
21676 <ref name="test &amp; me">hi</ref>
21677 <references />
21678 !! html/parsoid
21679 <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>
21680 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21681 <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>
21682 </ol>
21683 !! end
21684
21685 # This test is wt2html only because we're permitting the serializer to produce
21686 # dirty diffs, normalizing the unclosed references to the self-closed version.
21687 !! test
21688 Generate references for unclosed references tag
21689 !! options
21690 parsoid=wt2html
21691 !! wikitext
21692 a<ref>foo</ref>
21693
21694 <references>
21695 !! html/parsoid
21696 <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>
21697 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21698 <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>
21699 !! end
21700
21701 !! test
21702 New reference serializes on its own line
21703 !! options
21704 parsoid=wt2wt,html2wt
21705 !! wikitext
21706 foo
21707 <references />
21708 !! html/parsoid
21709 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21710 !! end
21711
21712 #### ----------------------------------------------------------------
21713 #### Parsoid-only testing of Parsoid's impl of LST
21714 #### Not implemented yet, see
21715 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21716 #### ----------------------------------------------------------------
21717
21718 !!test
21719 LST Sections: 1. Simple section start and end
21720 !! wikitext
21721 <section begin="2011-05-16" />
21722 <section end="2014-04-10 (MW 1.23wmf22)" />
21723 !! html/parsoid
21724 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21725 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21726 !! end
21727
21728 #--------- Test stripping of empty nodes in template content ----------
21729 !!test
21730 Empty LI and TR nodes should be stripped from template content
21731 !!wikitext
21732 {{EmptyLITest}}
21733 {{EmptyTRTest}}
21734 !!html/parsoid
21735 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21736 <li>a</li>
21737 <li>b</li>
21738 </ul>
21739 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21740 <tbody>
21741 <tr>
21742 <td>foo</td>
21743 </tr>
21744 <tr>
21745 <td>bar</td>
21746 </tr>
21747 </tbody>
21748 </table>
21749 !!end
21750
21751 !!test
21752 Empty LI and TR nodes should not be stripped from top-level content
21753 !!wikitext
21754 * a
21755 *
21756 * b
21757 {|
21758 |-
21759 |-
21760 |foo
21761 |}
21762 !!html/parsoid
21763 <ul>
21764 <li> a</li>
21765 <li></li>
21766 <li> b</li>
21767 </ul>
21768 <table>
21769 <tbody>
21770 <tr></tr>
21771 <tr>
21772 <td>foo</td>
21773 </tr>
21774 </tbody>
21775 </table>
21776 !!end
21777
21778 !!test
21779 Empty TR nodes should not be stripped if they have any attributes set
21780 !!wikitext
21781 {{EmptyTRWithHTMLAttrTest}}
21782 !!html/parsoid
21783 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21784 <tr align="center"></tr>
21785 <tr><td>foo</td></tr>
21786 <tr align="center"></tr>
21787 <tr><td>bar</td></tr>
21788 </table>
21789 !!end
21790
21791 #### ----------------------------------------------------------------
21792 #### The following section of tests are primarily to test
21793 #### wikitext escaping capabilities of Parsoid. Given that
21794 #### escaping can be done any number of ways, the wikitext (input)
21795 #### is always adjusted to reflect how Parsoid adds nowiki
21796 #### escape tags.
21797 ####
21798 #### We are marking several tests as parsoid-only since the
21799 #### HTML in the result section is different from what the
21800 #### PHP parser generates for it.
21801 #### ----------------------------------------------------------------
21802
21803
21804 #### --------------- Headings ---------------
21805 #### 0. Unnested
21806 #### 1. Nested inside html <h1>=foo=</h1>
21807 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21808 #### 3. Nested inside html with wikitext split by html tags
21809 #### 4. No escape needed
21810 #### 5. Empty headings <h1></h1>
21811 #### 6. Heading chars in SOL context
21812 #### ----------------------------------------
21813 !! test
21814 Headings: 0. Unnested
21815 !! options
21816 parsoid
21817 !! wikitext
21818 <nowiki>=foo=</nowiki>
21819
21820 <nowiki> =foo= </nowiki>
21821 <!--cmt-->
21822 <nowiki>=foo=</nowiki>
21823
21824 =foo''a''<nowiki>=</nowiki>
21825 !! html
21826 <p><span typeof="mw:Nowiki">=foo=</span></p>
21827
21828 <p><span typeof="mw:Nowiki"> =foo= </span>
21829 <!--cmt-->
21830 <span typeof="mw:Nowiki">=foo=</span></p>
21831
21832 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21833 !!end
21834
21835 # New headings and existing headings are handled differently
21836 !! test
21837 Headings: 1. Nested inside html
21838 !! options
21839 parsoid=html2wt
21840 !! html/parsoid
21841 <h1>=foo=</h1>
21842 <h2>=foo=</h2>
21843 <h3>=foo=</h3>
21844
21845 <h1 data-parsoid=''>=foo=</h1>
21846 <h2 data-parsoid=''>=foo=</h2>
21847 <h3 data-parsoid=''>=foo=</h3>
21848 <h4 data-parsoid=''>=foo=</h4>
21849 <h5 data-parsoid=''>=foo=</h5>
21850 <h6 data-parsoid=''>=foo=</h6>
21851 !! wikitext
21852 = =foo= =
21853
21854 == =foo= ==
21855
21856 === =foo= ===
21857
21858 =<nowiki>=foo=</nowiki>=
21859 ==<nowiki>=foo=</nowiki>==
21860 ===<nowiki>=foo=</nowiki>===
21861 ====<nowiki>=foo=</nowiki>====
21862 =====<nowiki>=foo=</nowiki>=====
21863 ======<nowiki>=foo=</nowiki>======
21864
21865 !!end
21866
21867 !! test
21868 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21869 !! options
21870 parsoid=html2wt
21871 !! html/parsoid
21872 <h1>foo</h1>*bar
21873 <h1>foo</h1>=bar
21874 <h1>foo</h1>=bar=
21875 !! wikitext
21876 = foo =
21877 <nowiki>*</nowiki>bar
21878
21879 = foo =
21880 =bar
21881
21882 = foo =
21883 <nowiki>=bar=</nowiki>
21884 !!end
21885
21886 !! test
21887 Headings: 3. Nested inside html with wikitext split by html tags
21888 !! options
21889 parsoid=html2wt,wt2wt
21890 !! wikitext
21891 = ='''bold'''<nowiki>foo=</nowiki> =
21892 !! html/parsoid
21893 <h1>=<b>bold</b>foo=</h1>
21894 !!end
21895
21896 !! test
21897 Headings: 4a. No escaping needed (testing just h1 and h2)
21898 !! wikitext
21899 = =foo =
21900
21901 = foo= =
21902
21903 = =foo= =
21904
21905 = =foo= bar =
21906
21907 == =foo ==
21908
21909 == foo= ==
21910
21911 = = =
21912
21913 = ''=''foo= =
21914 !! html/parsoid
21915 <h1>=foo</h1>
21916 <h1>foo=</h1>
21917 <h1> =foo= </h1>
21918 <h1>=foo= bar</h1>
21919 <h2>=foo</h2>
21920 <h2>foo=</h2>
21921 <h1>=</h1>
21922 <h1><i>=</i>foo=</h1>
21923 !!end
21924
21925 !! test
21926 Headings: 4b. No escaping needed (inside p-tags)
21927 !! options
21928 parsoid=html2wt
21929 !! html/parsoid
21930 <p>===
21931 =foo= x
21932 =foo= <s></s>
21933 </p>
21934 !! wikitext
21935 ===
21936 =foo= x
21937 =foo= <s></s>
21938 !!end
21939
21940 !! test
21941 Headings: 5. Empty headings
21942 !! wikitext
21943 =<nowiki/>=
21944
21945 ==<nowiki/>==
21946
21947 ===<nowiki/>===
21948
21949 ====<nowiki/>====
21950
21951 =====<nowiki/>=====
21952
21953 ======<nowiki/>======
21954 !! html/parsoid
21955 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21956
21957 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21958
21959 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21960
21961 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21962
21963 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21964
21965 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21966 !!end
21967
21968 !! test
21969 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21970 !! wikitext
21971 <nowiki>=a=</nowiki>
21972
21973 <nowiki>=a=</nowiki>
21974
21975 <nowiki>=a=</nowiki>
21976
21977 <nowiki>=a=</nowiki>
21978 !! html/php
21979 <p>=a=
21980 </p><p>=a=
21981 </p><p>=a=
21982 </p><p>=a=
21983 </p>
21984 !! html/parsoid
21985 <p><span typeof="mw:Nowiki">=a=</span></p>
21986
21987 <p><span typeof="mw:Nowiki">=a=</span></p>
21988
21989 <p><span typeof="mw:Nowiki">=a=</span></p>
21990
21991 <p><span typeof="mw:Nowiki">=a=</span></p>
21992 !!end
21993
21994 !! test
21995 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21996 !! wikitext
21997 <nowiki>=a=
21998 b</nowiki>
21999
22000 <nowiki>=a=
22001 b</nowiki>
22002
22003 <nowiki>=a=
22004 b</nowiki>
22005
22006 <nowiki>=a=
22007 b</nowiki>
22008 !! html/php
22009 <p>=a=
22010 b
22011 </p><p>=a=
22012 b
22013 </p><p>=a=
22014 b
22015 </p><p>=a=
22016 b
22017 </p>
22018 !! html/parsoid
22019 <p><span typeof="mw:Nowiki">=a=
22020 b</span></p>
22021
22022 <p><span typeof="mw:Nowiki">=a=
22023 b</span></p>
22024
22025 <p><span typeof="mw:Nowiki">=a=
22026 b</span></p>
22027
22028 <p><span typeof="mw:Nowiki">=a=
22029 b</span></p>
22030 !!end
22031
22032 !! test
22033 Headings: 6c. Heading chars in SOL context (leading newline break)
22034 !! wikitext
22035 a
22036 <nowiki>=b=</nowiki>
22037 !! html/php
22038 <p>a
22039 =b=
22040 </p>
22041 !! html/parsoid
22042 <p>a
22043 <span typeof="mw:Nowiki">=b=</span>
22044 !!end
22045
22046 !! test
22047 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22048 !! wikitext
22049 <!--c0--><nowiki>=a=</nowiki>
22050
22051 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22052 !! html/php
22053 <p>=a=
22054 </p><p>=a=
22055 </p>
22056 !! html/parsoid
22057 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
22058
22059 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
22060 !!end
22061
22062 !! test
22063 Headings: 6d. Heading chars in SOL context (No escaping needed)
22064 !! options
22065 parsoid=html2wt
22066 !! html/parsoid
22067 =a=<div>b</div>
22068 !! wikitext
22069 =a=<div>b</div>
22070 !!end
22071
22072 !! test
22073 Headings: 7. Insert a newline between new content and headings
22074 !! options
22075 parsoid=html2wt
22076 !! html/parsoid
22077 <h2>NEW</h2>
22078 <p>new</p>
22079 <h2 data-parsoid='{}'>A</h2>
22080 <p data-parsoid='{}'>a</p>
22081 !! wikitext
22082 == NEW ==
22083 new
22084
22085 ==A==
22086 a
22087
22088 !! end
22089
22090 #### --------------- Lists ---------------
22091 #### 0. Outside nests (*foo, etc.)
22092 #### 1. Nested inside html <ul><li>*foo</li></ul>
22093 #### 2. Inside definition lists
22094 #### 3. Only bullets at start should be escaped
22095 #### 4. No escapes needed
22096 #### 5. No unnecessary escapes
22097 #### 6. Escape bullets in SOL position
22098 #### 7. Escape bullets in a multi-line context
22099 #### ----------------------------------------
22100
22101 !! test
22102 Lists: 0. Outside nests
22103 !! wikitext
22104 <nowiki>*</nowiki>foo
22105
22106 <nowiki>#</nowiki>foo
22107
22108 <nowiki>;Foo:</nowiki>bar
22109 !! html/php
22110 <p>*foo
22111 </p><p>#foo
22112 </p><p>;Foo:bar
22113 </p>
22114 !! html/parsoid
22115 <p><span typeof="mw:Nowiki">*</span>foo</p>
22116
22117 <p><span typeof="mw:Nowiki">#</span>foo</p>
22118
22119 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
22120 !!end
22121
22122 !! test
22123 Lists: 1. Nested inside html
22124 !! wikitext
22125 *<nowiki>*foo</nowiki>
22126
22127 *<nowiki>#foo</nowiki>
22128
22129 *<nowiki>:foo</nowiki>
22130
22131 *<nowiki>;foo</nowiki>
22132
22133 #<nowiki>*foo</nowiki>
22134
22135 #<nowiki>#foo</nowiki>
22136
22137 #<nowiki>:foo</nowiki>
22138
22139 #<nowiki>;foo</nowiki>
22140 !! html
22141 <ul><li>*foo</li></ul>
22142 <ul><li>#foo</li></ul>
22143 <ul><li>:foo</li></ul>
22144 <ul><li>;foo</li></ul>
22145 <ol><li>*foo</li></ol>
22146 <ol><li>#foo</li></ol>
22147 <ol><li>:foo</li></ol>
22148 <ol><li>;foo</li></ol>
22149
22150 !!end
22151
22152 !! test
22153 Lists: 2. Inside definition lists
22154 !! wikitext
22155 ;<nowiki>;foo</nowiki>
22156
22157 ;<nowiki>:foo</nowiki>
22158
22159 ;<nowiki>:foo</nowiki>
22160 :bar
22161
22162 :<nowiki>:foo</nowiki>
22163 !! html
22164 <dl><dt>;foo</dt></dl>
22165 <dl><dt>:foo</dt></dl>
22166 <dl><dt>:foo</dt>
22167 <dd>bar</dd></dl>
22168 <dl><dd>:foo</dd></dl>
22169
22170 !!end
22171
22172 !! test
22173 Lists: 3. Only bullets at start of text should be escaped
22174 !! wikitext
22175 *<nowiki>*foo*bar</nowiki>
22176
22177 *<nowiki>*foo</nowiki>''it''*bar
22178 !! html
22179 <ul><li>*foo*bar</li></ul>
22180 <ul><li>*foo<i>it</i>*bar</li></ul>
22181
22182 !!end
22183
22184 !! test
22185 Lists: 4. No escapes needed
22186 !! options
22187 parsoid
22188 !! wikitext
22189 *foo*bar
22190
22191 *''foo''*bar
22192
22193 *[[Foo]]: bar
22194
22195 *[[Foo]]*bar
22196 !! html
22197 <ul>
22198 <li>foo*bar
22199 </li>
22200 </ul>
22201 <ul>
22202 <li><i>foo</i>*bar
22203 </li>
22204 </ul>
22205 <ul>
22206 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22207 </li>
22208 </ul>
22209 <ul>
22210 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22211 </li>
22212 </ul>
22213 !!end
22214
22215 !! test
22216 Lists: 5. No unnecessary escapes
22217 !! wikitext
22218 * bar <span><nowiki>[[foo]]</nowiki></span>
22219
22220 * =bar <span><nowiki>[[foo]]</nowiki></span>
22221
22222 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22223
22224 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22225
22226 * =bar <span>foo]]</span>=
22227
22228 * <s></s>: a
22229
22230 * ''* foo''
22231 !! html
22232 <ul><li> bar <span>[[foo]]</span></li></ul>
22233 <ul><li> =bar <span>[[foo]]</span></li></ul>
22234 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22235 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22236 <ul><li> =bar <span>foo]]</span>=</li></ul>
22237 <ul><li> <s></s>: a</li></ul>
22238 <ul><li> <i>* foo</i></li></ul>
22239
22240 !!end
22241
22242 !! test
22243 Lists: 6. Escape bullets in SOL position
22244 !! options
22245 parsoid=html2wt
22246 !! html/parsoid
22247 <p><!--cmt-->*foo</p>
22248 !! wikitext
22249 <!--cmt--><nowiki>*</nowiki>foo
22250 !!end
22251
22252 !! test
22253 Lists: 7. Escape bullets in a multi-line context
22254 !! wikitext
22255 a
22256 <nowiki>*</nowiki>b
22257 !! html
22258 <p>a
22259 *b
22260 </p>
22261 !!end
22262
22263 !! test
22264 Lists: 8. Escape colons only if not present in tags
22265 !! options
22266 parsoid=html2wt
22267 !! html/parsoid
22268 <dl><dt>a:b<i>c:d</i></dt></dl>
22269 !! wikitext
22270 ; <nowiki>a:b</nowiki>''c:d''
22271 !! end
22272
22273 #### --------------- HRs ---------------
22274 #### 1. Single line
22275 #### -----------------------------------
22276
22277 !! test
22278 HRs: 1. Single line
22279 !! wikitext
22280 ----<nowiki>----</nowiki>
22281 ----=foo=
22282 ----*foo
22283 !! html+tidy
22284 <hr />
22285 <p>----</p>
22286 <hr />
22287 <p>=foo=</p>
22288 <hr />
22289 <p>*foo</p>
22290 !! end
22291
22292 #### --------------- Tables ---------------
22293 #### 1a. Simple example
22294 #### 1b. No escaping needed (!foo)
22295 #### 1c. No escaping needed (|foo)
22296 #### 1d. No escaping needed (|}foo)
22297 ####
22298 #### 2a. Nested in td (<td>foo|bar</td>)
22299 #### 2b. Nested in td (<td>foo||bar</td>)
22300 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22301 ####
22302 #### 3a. Nested in th (<th>foo!bar</th>)
22303 #### 3b. Nested in th (<th>foo!!bar</th>)
22304 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22305 ####
22306 #### 4a. Escape -
22307 #### 4b. Escape +
22308 #### 4c. No escaping needed
22309 #### --------------------------------------
22310
22311 !! test
22312 Tables: 1a. Simple example
22313 !! wikitext
22314 <nowiki>{|
22315 |}</nowiki>
22316 !! html
22317 <p>{|
22318 |}
22319 </p>
22320 !! end
22321
22322 !! test
22323 Tables: 1b. No escaping needed
22324 !! wikitext
22325 !foo
22326 !! html
22327 <p>!foo
22328 </p>
22329 !! end
22330
22331 !! test
22332 Tables: 1c. No escaping needed
22333 !! wikitext
22334 |foo
22335 !! html
22336 <p>|foo
22337 </p>
22338 !! end
22339
22340 !! test
22341 Tables: 1d. No escaping needed
22342 !! wikitext
22343 |}foo
22344 !! html
22345 <p>|}foo
22346 </p>
22347 !! end
22348
22349 !! test
22350 Tables: 2a. Nested in td
22351 !! options
22352 parsoid=html2wt
22353 !! html/parsoid
22354 <table><tbody><tr>
22355 <td>foo|bar</td></tr>
22356 <tr><td>x<div>a|b</div></td>
22357 </tbody></table>
22358 !! wikitext
22359 {|
22360 |<nowiki>foo|bar</nowiki>
22361 |-
22362 |x<div><nowiki>a|b</nowiki></div>
22363 |}
22364 !! html/php+tidy
22365 <table>
22366 <tr>
22367 <td>foo|bar</td>
22368 </tr>
22369 <tr>
22370 <td>x
22371 <div>a|b</div>
22372 </td>
22373 </tr>
22374 </table>
22375 !! end
22376
22377 !! test
22378 Tables: 2b. Nested in td
22379 !! options
22380 parsoid=html2wt
22381 !! html/parsoid
22382 <table><tbody><tr>
22383 <td>foo||bar</td>
22384 <td>a<i>b||c</i></td>
22385 <td>a<i><div>b||c</div></i></td>
22386 </tr></tbody></table>
22387 !! wikitext
22388 {|
22389 |<nowiki>foo||bar</nowiki>
22390 |a''<nowiki>b||c</nowiki>''
22391 |a''<div><nowiki>b||c</nowiki></div>''
22392 |}
22393 !! html/php
22394 <table>
22395 <tr>
22396 <td>foo||bar
22397 </td>
22398 <td>a<i>b||c</i>
22399 </td>
22400 <td>a<i><div>b||c</div></i>
22401 </td></tr></table>
22402
22403 !! end
22404
22405 !! test
22406 Tables: 2c. Nested in td -- no escaping needed
22407 !! wikitext
22408 {|
22409
22410 |foo!!bar
22411 |}
22412 !! html/*
22413 <table>
22414
22415 <tr>
22416 <td>foo!!bar
22417 </td></tr></table>
22418
22419 !! end
22420
22421 !! test
22422 Tables: 3a. Nested in th
22423 !! wikitext
22424 {|
22425
22426 !foo!bar
22427 |}
22428 !! html/*
22429 <table>
22430
22431 <tr>
22432 <th>foo!bar
22433 </th></tr></table>
22434
22435 !! end
22436
22437 !! test
22438 Tables: 3b. Nested in th
22439 !! options
22440 parsoid=html2wt
22441 !! html/parsoid
22442 <table><tbody>
22443 <tr><th>foo!!bar</th>
22444 <th><i>foo|bar</i></th>
22445 <th><i>foo!!bar</i></th>
22446 <th><i><span>foo!!bar</span></i></th>
22447 </tr></tbody></table>
22448 !! wikitext
22449 {|
22450 !<nowiki>foo!!bar</nowiki>
22451 !''<nowiki>foo|bar</nowiki>''
22452 !''<nowiki>foo!!bar</nowiki>''
22453 !''<span><nowiki>foo!!bar</nowiki></span>''
22454 |}
22455 !! html/php
22456 <table>
22457 <tr>
22458 <th>foo!!bar
22459 </th>
22460 <th><i>foo|bar</i>
22461 </th>
22462 <th><i>foo!!bar</i>
22463 </th>
22464 <th><i><span>foo!!bar</span></i>
22465 </th></tr></table>
22466
22467 !! end
22468
22469 !! test
22470 Tables: 3c. Nested in th
22471 !! options
22472 parsoid=html2wt
22473 !! html/parsoid
22474 <table><tbody>
22475 <tr><th>foo||bar</th>
22476 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22477 </tr></tbody></table>
22478 !! wikitext
22479 {|
22480 !<nowiki>foo||bar</nowiki>
22481 !<nowiki>foo||bar</nowiki>
22482 |}
22483 !! html/php
22484 <table>
22485 <tr>
22486 <th>foo||bar
22487 </th>
22488 <th>foo||bar
22489 </th></tr></table>
22490
22491 !! end
22492
22493 !! test
22494 Tables: 4a. Escape -
22495 !! options
22496 parsoid=html2wt
22497 !! html/*
22498 <table>
22499
22500 <tr>
22501 <th>-bar
22502 </th></tr>
22503 <tr>
22504 <td>-bar
22505 </td></tr></table>
22506
22507 !! wikitext
22508 {|
22509
22510 !-bar
22511
22512 |-
22513 |<nowiki>-bar</nowiki>
22514 |}
22515 !! end
22516
22517 !! test
22518 Tables: 4b. Escape +
22519 !! options
22520 parsoid=html2wt
22521 !! html/*
22522 <table>
22523
22524 <tr>
22525 <th>+bar
22526 </th></tr>
22527 <tr>
22528 <td>+bar
22529 </td></tr></table>
22530
22531 !! wikitext
22532 {|
22533
22534 !+bar
22535
22536 |-
22537 |<nowiki>+bar</nowiki>
22538 |}
22539 !! end
22540
22541 !! test
22542 Tables: 4c. No escaping needed
22543 !! wikitext
22544 {|
22545 |foo-bar
22546 |foo+bar
22547 |-
22548 |''foo''-bar
22549 |''foo''+bar
22550 |-
22551 |foo
22552 bar|baz
22553 +bar
22554 -bar
22555 |-
22556 |x
22557 <div>a|b</div>
22558 |}
22559 !! html/php
22560 <table>
22561 <tr>
22562 <td>foo-bar
22563 </td>
22564 <td>foo+bar
22565 </td></tr>
22566 <tr>
22567 <td><i>foo</i>-bar
22568 </td>
22569 <td><i>foo</i>+bar
22570 </td></tr>
22571 <tr>
22572 <td>foo
22573 <p>bar|baz
22574 +bar
22575 -bar
22576 </p>
22577 </td></tr>
22578 <tr>
22579 <td>x
22580 <div>a|b</div>
22581 </td></tr></table>
22582
22583 !! html/parsoid
22584 <table><tbody>
22585 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22586 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22587 <tr><td>foo
22588 <p>bar|baz
22589 +bar
22590 -bar</p></td></tr>
22591 <tr><td>x
22592 <div>a|b</div></td>
22593 </tbody></table>
22594 !! end
22595
22596 !! test
22597 Tables: 4d. No escaping needed
22598 !! wikitext
22599 {|
22600 |[[Foo]]-bar
22601 ||+1
22602 ||-2
22603 |}
22604 !! html/php
22605 <table>
22606 <tr>
22607 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22608 </td>
22609 <td>+1
22610 </td>
22611 <td>-2
22612 </td></tr></table>
22613
22614 !! html/parsoid
22615 <table>
22616 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22617 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22618 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22619 </tbody></table>
22620 !! end
22621
22622 !! test
22623 Tables: Digest broken attributes on table and tr tag
22624 !! options
22625 parsoid=wt2html
22626 !! wikitext
22627 {| || |} ++
22628 |- || || ++ --
22629 |- > [
22630 |}
22631 !! html
22632 <table>
22633 <tbody>
22634 <tr></tr>
22635 <tr></tr>
22636 </tbody></table>
22637 !! end
22638
22639 !! test
22640 T97430: Don't emit empty nowiki pairs around marker meta tags
22641 !! options
22642 parsoid=html2wt
22643 !! html/parsoid
22644 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22645 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22646 !! wikitext
22647 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22648 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22649 !! end
22650
22651 !! test
22652 Unclosed xmlish element in table line shouldn't eat end delimiters
22653 !! wikitext
22654 {|
22655 | <foo
22656 | bar>
22657 |}
22658 !! html/php
22659 <table>
22660 <tr>
22661 <td> &lt;foo
22662 </td>
22663 <td> bar&gt;
22664 </td></tr></table>
22665
22666 !! html/parsoid
22667 <table>
22668 <tbody><tr><td> &lt;foo</td>
22669 <td> bar></td></tr>
22670 </tbody></table>
22671 !! end
22672
22673 #### --------------- Links ----------------
22674 #### 1. Quote marks in link text
22675 #### 2. Wikilinks: Escapes needed
22676 #### 3. Wikilinks: No escapes needed
22677 #### 4. Extlinks: Escapes needed
22678 #### 5. Extlinks: No escapes needed
22679 #### --------------------------------------
22680 !! test
22681 Links 1. WikiLinks: No escapes needed
22682 !! wikitext
22683 [[Foo|Foo''boo'']]
22684 [[Foo|[Foobar]]]
22685 [[Foo|x [Foobar] x]]
22686 !! html/php
22687 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22688 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22689 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22690 </p>
22691 !! html/parsoid
22692 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22693 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22694 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22695 !! end
22696
22697 !! test
22698 Links 2. WikiLinks: Escapes needed
22699 !! options
22700 parsoid=html2wt
22701 !! html/parsoid
22702 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22703 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22704 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22705 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22706 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22707 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22708 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22709 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22710 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22711 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22712 !! wikitext
22713 [[Foo|<nowiki>Foobar]</nowiki>]]
22714 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22715 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22716 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22717 [[Foo|<nowiki>|Bar</nowiki>]]
22718 [[Foo|<nowiki>]]bar</nowiki>]]
22719 [[Foo|<nowiki>[[bar</nowiki>]]
22720 [[Foo|<nowiki>x [[ y</nowiki>]]
22721 [[Foo|<nowiki>x ]] y</nowiki>]]
22722 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22723 !! html/php
22724 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22725 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22726 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22727 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22728 <a href="/wiki/Foo" title="Foo">|Bar</a>
22729 <a href="/wiki/Foo" title="Foo">]]bar</a>
22730 <a href="/wiki/Foo" title="Foo">[[bar</a>
22731 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22732 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22733 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22734 </p>
22735 !! end
22736
22737 !! test
22738 Links 3. WikiLinks: No escapes needed
22739 !! wikitext
22740 [[Foo|[Foobar]]
22741 [[Foo|foo|bar]]
22742 !! html/php
22743 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22744 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22745 </p>
22746 !! html/parsoid
22747 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22748 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22749 !! end
22750
22751 !! test
22752 Links 4. ExtLinks: Escapes needed
22753 !! options
22754 parsoid=html2wt
22755 !! html/parsoid
22756 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22757 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22758 <p>[http://google.com]</p>
22759 <p>[http://google.com google]</p>
22760 !! wikitext
22761 [http://google.com <nowiki>[google]</nowiki>]
22762 [http://google.com <nowiki>google]</nowiki>]
22763
22764 <nowiki>[http://google.com]</nowiki>
22765
22766 <nowiki>[http://google.com google]</nowiki>
22767
22768 !! html/php
22769 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22770 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22771 </p><p>[http://google.com]
22772 </p><p>[http://google.com google]
22773 </p>
22774 !! end
22775
22776 !! test
22777 Links 5. ExtLinks: No escapes needed
22778 !! wikitext
22779 [http://google.com [google]
22780 !! html/php
22781 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22782 </p>
22783 !! html/parsoid
22784 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22785 !! end
22786
22787 !! test
22788 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22789 !! html/parsoid
22790 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22791 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22792 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22793 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22794 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22795 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22796 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22797 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22798 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22799 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22800 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22801 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22802 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22803 </p>
22804 !! wikitext
22805 x<nowiki/>http://example.com<nowiki/>y
22806 http://example.com<nowiki/>?x
22807 http://example.com<nowiki/>&x
22808 http://example.com<nowiki/>'x
22809 http://example.com<nowiki/>,x
22810 http://example.com<nowiki/>.x
22811 http://example.com<nowiki/>;x
22812 http://example.com<nowiki/>:x
22813 http://example.com<nowiki/>;x
22814 http://example.com<nowiki/>!x
22815 http://example.com<nowiki/>=x
22816 http://example.com<nowiki/>(x)
22817 http://example.com(x<nowiki/>)
22818 !! end
22819
22820 !! test
22821 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22822 !! html/parsoid
22823 <p>x
22824 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22825 y
22826 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22827 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22828 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22829 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22830 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22831 </p>
22832 !! wikitext
22833 x
22834 http://example.com
22835 y
22836 "http://example.com"
22837 (http://example.com)
22838 (http://example.com) foo
22839 http://example.com,
22840 http://example.com, foo
22841 !! html/php
22842 <p>x
22843 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22844 y
22845 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22846 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22847 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22848 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22849 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22850 </p>
22851 !! end
22852
22853 !! test
22854 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22855 !! html/parsoid
22856 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22857 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22858 !! wikitext
22859 http://example.com.,;:!?\
22860 -http://example.com:
22861 !! html/php
22862 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22863 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22864 </p>
22865 !! end
22866
22867 !! test
22868 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22869 !! html/parsoid
22870 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22871 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22872 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22873 !! wikitext
22874 RFC 123<nowiki/>4
22875 RFC 123<nowiki/>y
22876 X<nowiki/>RFC 123<nowiki/>y
22877 !! end
22878
22879 !! test
22880 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22881 !! html/parsoid
22882 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22883 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22884 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22885 </p>
22886 !! wikitext
22887 RFC 123?foo
22888 RFC 123&foo
22889 -RFC 123-
22890 !! html/php
22891 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22892 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22893 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22894 </p>
22895 !! end
22896
22897 !! test
22898 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22899 !! html/parsoid
22900 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22901 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22902 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22903 !! wikitext
22904 PMID 123<nowiki/>4
22905 PMID 123<nowiki/>y
22906 X<nowiki/>PMID 123<nowiki/>y
22907 !! end
22908
22909 !! test
22910 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22911 !! html/parsoid
22912 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22913 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22914 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22915 </p>
22916 !! wikitext
22917 PMID 123?foo
22918 PMID 123&foo
22919 -PMID 123-
22920 !! html/php
22921 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22922 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22923 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22924 </p>
22925 !! end
22926
22927 !! test
22928 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22929 !! html/parsoid
22930 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22931 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22932 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22933 </p>
22934 !! wikitext
22935 ISBN 1234567890<nowiki/>1
22936 ISBN 1234567890<nowiki/>x
22937 a<nowiki/>ISBN 1234567890<nowiki/>b
22938 !! end
22939
22940 !! test
22941 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22942 !! html/parsoid
22943 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22944 !! wikitext
22945 -ISBN 1234567890's
22946 !! html/php
22947 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22948 </p>
22949 !! end
22950
22951 !! test
22952 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22953 !! options
22954 parsoid=html2wt
22955 !! html/*
22956 <p>this is not a link: http://example.com
22957 </p>
22958 !! wikitext
22959 <nowiki>this is not a link: http://example.com</nowiki>
22960 !! end
22961
22962 !! test
22963 Links 15. Link trails can't become link prefixes.
22964 !! options
22965 language=is
22966 !! wikitext
22967 [[Söfnuður]]-[[00]]
22968 !! html/php
22969 <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>
22970 </p>
22971 !! html/parsoid
22972 <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>
22973 !! end
22974
22975 #### --------------- Quotes ---------------
22976 #### 1. Quotes inside <b> and <i>
22977 #### 2. Link fragments separated by <i> and <b> tags
22978 #### 3. Link fragments inside <i> and <b>
22979 #### 4. No escaping needed
22980 #### --------------------------------------
22981 !! test
22982 1a. Quotes inside <b> and <i>
22983 !! options
22984 parsoid=html2wt,wt2wt
22985 !! wikitext
22986 ''<nowiki/>'foo'''
22987 ''<nowiki>''foo''</nowiki>''
22988 ''<nowiki>'''foo'''</nowiki>''
22989 ''foo''<nowiki/>'s
22990 '''<nowiki/>'foo''''
22991 '''<nowiki>''foo''</nowiki>'''
22992 '''<nowiki>'''foo'''</nowiki>'''
22993 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22994 '''foo'''<nowiki/>'s
22995 '''foo''
22996 ''foo''<nowiki/>'
22997 ''foo'''<nowiki/>'
22998 '''foo''<nowiki/>'
22999 ''''foo'''
23000 '''foo'''<nowiki/>'
23001 ''''foo'''<nowiki/>'
23002 ''fools'<span> errand</span>''
23003 ''<span>fool</span>'s errand''
23004 '<nowiki/>''foo'' bar '''baz''
23005 a|!*#-:;+-~[]{}b'''x''
23006 !! html/*
23007 <p><i>'foo'</i>
23008 <i>''foo''</i>
23009 <i>'''foo'''</i>
23010 <i>foo</i>'s
23011 <b>'foo'</b>
23012 <b>''foo''</b>
23013 <b>'''foo'''</b>
23014 <b>foo'<i>bar'</i>baz</b>
23015 <b>foo</b>'s
23016 '<i>foo</i>
23017 <i>foo</i>'
23018 <i>foo'</i>'
23019 '<i>foo</i>'
23020 '<b>foo</b>
23021 <b>foo</b>'
23022 '<b>foo</b>'
23023 <i>fools'<span> errand</span></i>
23024 <i><span>fool</span>'s errand</i>
23025 '<i>foo</i> bar '<i>baz</i>
23026 a|!*#-:;+-~[]{}b'<i>x</i>
23027 </p>
23028 !! end
23029
23030 !! test
23031 1b. Quotes inside <b> and <i> with other tags on same line
23032 !! options
23033 parsoid=html2wt,wt2wt
23034 !! wikitext
23035 '''a'' foo ''[[bar]]''
23036 ''a''' foo ''[[bar]]''
23037 ''a''' foo '''{{echo|[[bar]]}}'''
23038 [[foo]] x'''[[bar]]''
23039 '''foo'' <ref>test</ref>
23040 '''foo'' <div title="name">test</div>
23041 '''foo'' and <br> bar
23042 <references />
23043 !! html
23044 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23045 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23046 <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>
23047 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23048 '<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>
23049 '<i>foo</i> <div title="name">test</div>
23050 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23051 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23052 <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>
23053 </ol>
23054 !! end
23055
23056 !! test
23057 2. Link fragments separated by <i> and <b> tags
23058 !! wikitext
23059 [[''foo''<nowiki>hello]]</nowiki>
23060
23061 [['''foo'''<nowiki>hello]]</nowiki>
23062 !! html
23063 <p>[[<i>foo</i>hello]]
23064 </p><p>[[<b>foo</b>hello]]
23065 </p>
23066 !! end
23067
23068 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23069 # this is one of the shortcomings of this format
23070 !! test
23071 3. Link fragments inside <i> and <b>
23072 !! wikitext
23073 ''[[foo''<nowiki>]]</nowiki>
23074
23075 '''[[foo'''<nowiki>]]</nowiki>
23076 !! html
23077 <p><i>[[foo</i>]]
23078 </p><p><b>[[foo</b>]]
23079 </p>
23080 !! end
23081
23082 !! test
23083 4. No escaping needed
23084 !! wikitext
23085 '<span>''bar''</span>'
23086 '<span>'''bar'''</span>'
23087 'a:b'foo
23088 !! html
23089 <p>'<span><i>bar</i></span>'
23090 '<span><b>bar</b></span>'
23091 'a:b'foo
23092 </p>
23093 !! end
23094
23095 #### ----------- Paragraphs ---------------
23096 #### 1. No unnecessary escapes
23097 #### --------------------------------------
23098
23099 !! test
23100 1. No unnecessary escapes
23101 !! wikitext
23102 bar <span><nowiki>[[foo]]</nowiki></span>
23103
23104 =bar <span><nowiki>[[foo]]</nowiki></span>
23105
23106 [[bar <span><nowiki>[[foo]]</nowiki></span>
23107
23108 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23109
23110 =bar <span>foo]]</span><nowiki>=</nowiki>
23111 !! html
23112 <p>bar <span>[[foo]]</span>
23113 </p><p>=bar <span>[[foo]]</span>
23114 </p><p>[[bar <span>[[foo]]</span>
23115 </p><p>]]bar <span>[[foo]]</span>
23116 </p><p>=bar <span>foo]]</span>=
23117 </p>
23118 !!end
23119
23120 #### ----------------------- PRE --------------------------
23121 #### 1. Leading whitespace in SOL context should be escaped
23122 #### ------------------------------------------------------
23123 !! test
23124 1. Leading whitespace in SOL context should be escaped
23125 !! options
23126 parsoid
23127 !! wikitext
23128 <nowiki> </nowiki>a
23129
23130 <nowiki> </nowiki> a
23131
23132 <nowiki> </nowiki>a(tab)
23133
23134 <nowiki> </nowiki> a
23135 <!--cmt-->
23136 <nowiki> </nowiki> a
23137
23138 a
23139 <nowiki> </nowiki>b
23140
23141 a
23142 <nowiki> </nowiki>b
23143
23144 a
23145 <nowiki> </nowiki> b
23146 !! html
23147 <p> a</p>
23148 <p> a</p>
23149 <p> a(tab)</p>
23150 <p> a</p>
23151 <p><!--cmt--> a</p>
23152 <p>a
23153 b</p>
23154 <p>a
23155 b</p>
23156 <p>a
23157 b</p>
23158 !! end
23159
23160 !! test
23161 2. Leading whitespace in non-indent-pre contexts should not be escaped
23162 !! options
23163 parsoid
23164 !! wikitext
23165 foo <ref>''a''
23166 b</ref>
23167 <references />
23168 !! html
23169 <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>
23170 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23171 <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>
23172 b</span></li>
23173 </ol>
23174 !! end
23175
23176 !! test
23177 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23178 !! options
23179 parsoid
23180 !! wikitext
23181 <blockquote>
23182 a
23183 <span>b</span>
23184 c
23185 </blockquote>
23186 !! html
23187 <blockquote>
23188 <p>
23189 a
23190 <span>b</span>
23191 c</p>
23192 </blockquote>
23193 !! end
23194
23195 !! test
23196 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23197 !! options
23198 parsoid
23199 !! wikitext
23200 [[File:Foobar.jpg|thumb|caption]]
23201 !! html/parsoid
23202 <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>
23203 !! end
23204
23205 !! test
23206 5. Nowiki escaping should account for indent-pres
23207 !! options
23208 parsoid=html2wt
23209 !! html/parsoid
23210 <pre>==foo==</pre>
23211 !! wikitext
23212 ==foo==
23213 !! end
23214
23215 !!test
23216 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23217 !! options
23218 parsoid
23219 !! wikitext
23220 * foo
23221 * bar
23222 !! html
23223 <pre>
23224 * foo
23225 * bar
23226 </pre>
23227 !! end
23228
23229 #### --------------- Behavior Switches --------------------
23230
23231 !! test
23232 1. Valid behavior switches should be escaped
23233 !! options
23234 parsoid=html2wt
23235 !! html/parsoid
23236 __TOC__
23237 <i>__TOC__</i>
23238 !! wikitext
23239 <nowiki>__TOC__</nowiki>
23240 ''<nowiki>__TOC__</nowiki>''
23241 !! end
23242
23243 !! test
23244 2. Invalid behavior switches should not be escaped
23245 !! options
23246 parsoid=html2wt
23247 !! html/parsoid
23248 __TOO__
23249 __|__
23250 !! wikitext
23251 __TOO__
23252 __|__
23253 !! end
23254
23255 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23256 !! test
23257 Behavior switches should be SOL-transparent
23258 !! wikitext
23259 __TOC__
23260
23261 <!-- this one's bogus -->
23262 __TOO__
23263
23264 __TOC__ foo
23265
23266 __TOC__ bar
23267 !! html/parsoid
23268 <meta property="mw:PageProp/toc" />
23269
23270 <!-- this one's bogus -->
23271 <pre>__TOO__</pre>
23272
23273 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23274
23275 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23276 !! end
23277
23278 #### --------------- HTML tags ---------------
23279 #### 1. a tags
23280 #### 2. other tags
23281 #### 3. multi-line html tag
23282 #### 4. extension tags
23283 #### -----------------------------------------
23284 !! test
23285 1. a tags
23286 !! options
23287 parsoid
23288 !! wikitext
23289 <a href="http://google.com">google</a>
23290 !! html
23291 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23292 !! end
23293
23294 !! test
23295 2. other tags
23296 !! wikitext
23297 * <nowiki><div>foo</div></nowiki>
23298 * <nowiki><div style="color:red">foo</div></nowiki>
23299 * <nowiki><td></nowiki>
23300 !! html
23301 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23302 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23303 <li> &lt;td&gt;</li></ul>
23304
23305 !! end
23306
23307 !! test
23308 3. multi-line html tag
23309 !! wikitext
23310 <nowiki><div
23311 >foo</div
23312 ></nowiki>
23313 !! html
23314 <p>&lt;div
23315 &gt;foo&lt;/div
23316 &gt;
23317 </p>
23318 !! end
23319
23320 !! test
23321 4. extension tags
23322 !! wikitext
23323 <nowiki><ref>foo</ref></nowiki>
23324
23325 <nowiki><ref>bar</nowiki>
23326
23327 baz<nowiki></ref></nowiki>
23328 !! html
23329 <p>&lt;ref&gt;foo&lt;/ref&gt;
23330 </p><p>&lt;ref&gt;bar
23331 </p><p>baz&lt;/ref&gt;
23332 </p>
23333 !! end
23334
23335 #### --------------- Others ---------------
23336 !! test
23337 Escaping nowikis
23338 !! wikitext
23339 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23340 !! html
23341 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23342 </p>
23343 !! end
23344
23345 ## The quote-char in the input is necessary for triggering the bug
23346 !! test
23347 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23348 !! options
23349 parsoid=wt2wt,html2wt
23350 !! wikitext
23351 foo's bar :
23352 !! html
23353 <p>foo's bar :</p>
23354 !! end
23355
23356 !! test
23357
23358 Tag-like HTML structures are passed through as text
23359 !! wikitext
23360 <x y>
23361
23362 <x.y>
23363
23364 <x-y>
23365
23366 1>2
23367
23368 x<y
23369
23370 a>b
23371
23372 1<d e>f
23373 !! html
23374 <p>&lt;x y&gt;
23375 </p><p>&lt;x.y&gt;
23376 </p><p>&lt;x-y&gt;
23377 </p><p>1&gt;2
23378 </p><p>x&lt;y
23379 </p><p>a&gt;b
23380 </p><p>1&lt;d e&gt;f
23381 </p>
23382 !! end
23383
23384 !! test
23385 HTML tag with necessary entities in attributes
23386 !! wikitext
23387 <span title="&amp;amp;">foo</span>
23388 !! html
23389 <p><span title="&amp;amp;">foo</span>
23390 </p>
23391 !! end
23392
23393 !! test
23394 HTML tag with 'unnecessary' entity encoding in attributes
23395 !! wikitext
23396 <span title="&amp;">foo</span>
23397 !! html
23398 <p><span title="&amp;">foo</span>
23399 </p>
23400 !! end
23401
23402 !! test
23403 HTML tag with broken attribute value quoting
23404 !! wikitext
23405 <span title="Hello world>Foo</span>
23406 !! html/php
23407 <p><span title="Hello world">Foo</span>
23408 </p>
23409 !! html/parsoid
23410 <p><span title="Hello world">Foo</span>
23411 </p>
23412 !! end
23413
23414 !! test
23415 Table with broken attribute value quoting
23416 !! wikitext
23417 {|
23418 | title="Hello world|Foo
23419 |}
23420 !! html/php
23421 <table>
23422 <tr>
23423 <td title="Hello world">Foo
23424 </td></tr></table>
23425
23426 !! html/parsoid
23427 <table>
23428 <tr>
23429 <td title="Hello world">Foo
23430 </td></tr></table>
23431
23432 !! end
23433
23434 !! test
23435 Table with broken attribute value quoting on consecutive lines
23436 !! wikitext
23437 {|
23438 | title="Hello world|Foo
23439 | style="color:red|Bar
23440 |}
23441 !! html/php
23442 <table>
23443 <tr>
23444 <td title="Hello world">Foo
23445 </td>
23446 <td style="color:red">Bar
23447 </td></tr></table>
23448
23449 !! html/parsoid
23450 <table><tbody>
23451 <tr>
23452 <td title="Hello world">Foo
23453 </td><td style="color: red">Bar
23454 </td></tr></tbody></table>
23455
23456 !! end
23457
23458 !! test
23459 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23460 !! options
23461 parsoid
23462 !! wikitext
23463 {{}}
23464 !! html
23465 {{}}
23466 !! end
23467
23468 !! test
23469 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23470 !! options
23471 parsoid
23472 !! wikitext
23473 }}{{
23474 !! html
23475 }}{{
23476 !! end
23477
23478 !!test
23479 Accept empty td cell attribute
23480 !! wikitext
23481 {|
23482 | align="center" | foo || |
23483 |}
23484 !! html
23485 <table>
23486 <tr>
23487 <td align="center"> foo </td>
23488 <td>
23489 </td></tr></table>
23490
23491 !!end
23492
23493 !!test
23494 Non-empty attributes in th-cells
23495 !! wikitext
23496 {|
23497 ! Foo !! style="color: red" | Bar
23498 |}
23499 !! html
23500 <table>
23501 <tr>
23502 <th> Foo </th>
23503 <th style="color: red"> Bar
23504 </th></tr></table>
23505
23506 !!end
23507
23508 !!test
23509 Accept empty attributes in th-cells
23510 !! wikitext
23511 {|
23512 !| foo !!| bar
23513 |}
23514 !! html
23515 <table>
23516 <tr>
23517 <th> foo </th>
23518 <th> bar
23519 </th></tr></table>
23520
23521 !!end
23522
23523 !!test
23524 Empty table rows go away
23525 !! wikitext
23526 {|
23527 | Hello
23528 | there
23529 |- class="foo"
23530 |-
23531 |}
23532 !! html
23533 <table>
23534 <tr>
23535 <td> Hello
23536 </td>
23537 <td> there
23538 </td></tr>
23539
23540 </table>
23541
23542 !! end
23543
23544 ###
23545 ### Parsoid-centric tests for testing RTing of inter-element separators
23546 ### Edge cases not tested by existing parser tests and specific to
23547 ### Parsoid-specific serialization strategies.
23548 ###
23549
23550 !!test
23551 RT-ed inter-element separators should be valid separators
23552 !! wikitext
23553 {|
23554 |- [[foo]]
23555 |}
23556 !! html
23557 <table>
23558
23559 </table>
23560
23561 !!end
23562
23563 # Parsoid-only since PHP parser relies on Tidy for correct output
23564 !!test
23565 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23566 !!options
23567 parsoid
23568 !! wikitext
23569 {|
23570 |<small>foo
23571 bar
23572 |}
23573
23574 {|
23575 |<small>foo<small>
23576 |}
23577 !! html
23578 <table>
23579 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23580 <p>bar</p></small></td></tr>
23581 </tbody></table>
23582
23583 <table>
23584 <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>
23585 </tbody></table>
23586 !!end
23587
23588 # Note that the "style" attribute is really a template parameter here.
23589 # The = would have to be {{=}} if you wanted the literal.
23590 !!test
23591 Empty TD followed by TD with tpl-generated attribute
23592 !! wikitext
23593 {|
23594 |-
23595 |
23596 |{{echo|style='color:red'}}|foo
23597 |}
23598 !! html
23599 <table>
23600
23601 <tr>
23602 <td>
23603 </td>
23604 <td>foo
23605 </td></tr></table>
23606
23607 !!end
23608
23609 !!test
23610 Indented table with an empty td
23611 !! wikitext
23612 {|
23613 |-
23614 |
23615 |foo
23616 |}
23617 !! html
23618 <table>
23619
23620 <tr>
23621 <td>
23622 </td>
23623 <td>foo
23624 </td></tr></table>
23625
23626 !!end
23627
23628 ## We have some newline diffs RT-ing this edge case
23629 ## and it is not important enough -- we seem to be emitting
23630 ## at most 2 newlines after a </tr> and this is unrelated to
23631 ## the issue from T85627 that this is testing.
23632 !!test
23633 Indented table with blank lines in between (T85627)
23634 !! options
23635 parsoid=wt2html
23636 !! wikitext
23637 {|
23638 |foo
23639
23640
23641 |}
23642 !! html
23643 <table>
23644
23645 <tr>
23646 <td>foo
23647 </td></tr></table>
23648
23649 !!end
23650
23651 !!test
23652 Indented block & table
23653 !! wikitext
23654 <div>foo</div>
23655 {|
23656 |foo
23657 |}
23658 !! html/php
23659 <div>foo</div>
23660 <table>
23661 <tr>
23662 <td>foo
23663 </td></tr></table>
23664
23665 !! html/parsoid
23666 <div data-parsoid='{"stx":"html"}'>foo</div>
23667 <table><tbody>
23668 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23669 </tbody></table>
23670 !!end
23671
23672 !! test
23673 Indent and comment before table row
23674 !! wikitext
23675 {|
23676 <!--hi-->|-
23677 | there
23678 |}
23679 !! html/php
23680 <table>
23681
23682 <tr>
23683 <td> there
23684 </td></tr></table>
23685
23686 !! html/parsoid
23687 <table>
23688 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23689 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23690 </tbody></table>
23691 !! end
23692
23693 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23694 !!test
23695 Empty TR followed by a template-generated TR
23696 !!options
23697 parsoid
23698 !! wikitext
23699 {|
23700 |-
23701 {{echo|<tr><td>foo</td></tr>}}
23702 |}
23703 !! html
23704 <table>
23705 <tbody>
23706 <tr></tr>
23707 <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}}]}'>
23708 <td>foo</td></tr>
23709 </tbody></table>
23710 !!end
23711
23712 ## PHP and parsoid output differ for this, and since this is primarily
23713 ## for testing Parsoid's serializer, marking this Parsoid only
23714 !!test
23715 Empty TR followed by mixed-ws-comment line should RT correctly
23716 !!options
23717 parsoid
23718 !! wikitext
23719 {|
23720 |-
23721 <!--c-->
23722 |-
23723 <!--c--> <!--d-->
23724 |}
23725 !! html
23726 <table>
23727 <tbody>
23728 <tr></tr>
23729 <!--c-->
23730 <tr>
23731 <!--c--> </tr><!--d-->
23732 </tbody></table>
23733
23734 !!end
23735
23736 !!test
23737 Multi-line image caption generated by templates with/without trailing newlines
23738 !! wikitext
23739 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23740 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23741 !! html/parsoid
23742 <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>
23743 <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>
23744 !!end
23745
23746 !! test
23747 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23748 !! options
23749 parsoid=html2wt
23750 !! html/parsoid
23751 <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>
23752
23753 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23754 !! wikitext
23755 <includeonly>foo</includeonly>
23756 new para
23757
23758 [[Category:Foo]]
23759
23760 = new heading =
23761 !! end
23762
23763 ## PHP emits broken html for this, and since this is primarily
23764 ## a Parsoid serializer test, marking this Parsoid only
23765 !!test
23766 Improperly nested inline or quotes tags with whitespace in between
23767 !! wikitext
23768 <span> <s>x</span> </s>
23769 ''' ''x''' ''
23770 !! html/parsoid
23771 <p><span> <s>x</s></span><s> </s>
23772 <b> <i>x</i></b><i> </i>
23773 </p>
23774 !!end
23775
23776 !!test
23777 Encapsulate protected attributes from wt
23778 !! wikitext
23779 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23780 !! html/parsoid
23781 <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>
23782 </body>
23783 !!end
23784
23785 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23786 ## Having nested or stray pre tags results in the attempt to add duplicates,
23787 ## causing an assertion fail. This test tries to prevent that situation.
23788 !!test
23789 Ensure ParagraphWrapper can deal with stray closing pre tags
23790 !!options
23791 parsoid=wt2html
23792 !! wikitext
23793 plain text</pre>
23794 !! html/parsoid
23795 plain text
23796 !!end
23797
23798 !!test
23799 1. Ensure fostered text content is wrapped in element nodes
23800 !!options
23801 parsoid=wt2html
23802 !! wikitext
23803 <table>hi</table><table>ho</table>
23804 !! html/parsoid
23805 <p>hi</p>
23806 <table></table>
23807 <p>ho</p>
23808 <table></table>
23809 !!end
23810
23811 !!test
23812 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23813 !!options
23814 parsoid=wt2html,wt2wt
23815 !! wikitext
23816 <table>
23817 <tr> || ||
23818 <td> a
23819 </table>
23820 !! html/parsoid
23821 <p> || ||
23822 </p><table>
23823 <tbody><tr><td> a</td></tr>
23824 </tbody></table>
23825 !!end
23826
23827 !!test
23828 Encapsulation properly handles null DSR information from foster box
23829 !!options
23830 parsoid=wt2html,wt2wt
23831 !! wikitext
23832 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23833 !! html/parsoid
23834 <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>
23835 !!end
23836
23837 !!test
23838 1. Encapsulate foster-parented transclusion content
23839 !!options
23840 parsoid=wt2wt,wt2html
23841 !! wikitext
23842 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23843 !! html/parsoid
23844 <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>
23845 <tbody>
23846 <tr>
23847 <td>bar</td>
23848 </tr>
23849 </tbody>
23850 </table>
23851 !!end
23852
23853 !!test
23854 2. Encapsulate foster-parented transclusion content
23855 !!options
23856 parsoid=wt2wt,wt2html
23857 !! wikitext
23858 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23859 !! html/parsoid
23860 <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>
23861 <table>
23862 <tbody>
23863 <tr>
23864 <td>bar</td>
23865 </tr>
23866 </tbody>
23867 </table>
23868 !!end
23869
23870 !!test
23871 3. Encapsulate foster-parented transclusion content
23872 !!options
23873 parsoid=wt2wt,wt2html
23874 !! wikitext
23875 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23876 !! html/parsoid
23877 <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;]}">
23878 <p>foo</p>
23879 </div>
23880 <table>
23881 <tbody>
23882 <tr>
23883 <td>bar</td>
23884 </tr>
23885 </tbody>
23886 </table>
23887 !!end
23888
23889 !!test
23890 4. Encapsulate foster-parented transclusion content
23891 !!options
23892 parsoid=wt2wt,wt2html
23893 !! wikitext
23894 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23895 !! html/parsoid
23896 <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;]}">
23897 <p>foo</p>
23898 </div>
23899 <table>
23900 <tbody>
23901 <tr>
23902 <td>bar</td>
23903 </tr>
23904 </tbody>
23905 </table>
23906 !!end
23907
23908 !!test
23909 5. Encapsulate foster-parented transclusion content
23910 !!options
23911 parsoid=wt2wt,wt2html
23912 !! wikitext
23913 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23914 !! html/parsoid
23915 <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>
23916 <table>
23917 <tbody>
23918 <tr>
23919 <td>
23920 <div>
23921 <p>foo</p>
23922 </div>
23923 </td>
23924 </tr>
23925 </tbody>
23926 </table>
23927 !!end
23928
23929 !!test
23930 6. Encapsulate foster-parented transclusion content
23931 !!options
23932 parsoid=wt2wt,wt2html
23933 !! wikitext
23934 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23935 !! html/parsoid
23936 <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>
23937 <table>
23938 <tbody>
23939 <tr>
23940 <td>
23941 <div>
23942 <p>foo</p>
23943 </div>
23944 </td>
23945 </tr>
23946 </tbody>
23947 </table>
23948 <p>ok</p>
23949 !!end
23950
23951 !!test
23952 7. Encapsulate foster-parented transclusion content
23953 !!options
23954 parsoid=wt2wt,wt2html
23955 !! wikitext
23956 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23957 !! html/parsoid
23958 <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>
23959 <table>
23960 <tbody>
23961 <tr>
23962 <td>bar</td>
23963 </tr>
23964 </tbody>
23965 </table>
23966 !!end
23967
23968 # Note that the wt is broken on purpose: the = should be {{=}} if you
23969 # don't want it to be a template parameter key.
23970 !!test
23971 8. Encapsulate foster-parented transclusion content
23972 !!options
23973 parsoid=wt2wt,wt2html
23974 !! wikitext
23975 {{echo|a
23976 }}{|{{echo|style='color:red'}}
23977 |-
23978 |b
23979 |}
23980 !! html/parsoid
23981 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23982 <span> </span>
23983 <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>
23984 <table>
23985 <tbody>
23986 <tr>
23987 <td>b</td>
23988 </tr>
23989 </tbody>
23990 </table>
23991 !!end
23992
23993 !!test
23994 9. Encapsulate foster-parented transclusion content
23995 !!options
23996 parsoid=wt2wt,wt2html
23997 !! wikitext
23998 <table>{{echo|hi</table>hello}}
23999 !! html/parsoid
24000 <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>
24001 !!end
24002
24003 !!test
24004 Table in fosterable position
24005 !!options
24006 parsoid=wt2html,wt2wt
24007 !! wikitext
24008 {{OpenTable}}
24009 <div>
24010 {|
24011 |}
24012 </div>
24013 |}
24014 !! html/parsoid
24015 <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">
24016 </span>
24017 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24018
24019 <table>
24020 </table>
24021 !!end
24022
24023 # Parsoid only for bug 64747
24024 !! test
24025 Properly encapsulate empty-content transclusions in fosterable positions
24026 !! wikitext
24027 <table>
24028 {{#if:|
24029 <td>foo</td>
24030 }}
24031 </table>
24032 !! html/parsoid
24033 <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":["","","",""]}]]}'>
24034
24035 </table>
24036 !! end
24037
24038 !!test
24039 Support <object> element with .data attribute
24040 !!options
24041 parsoid=html2wt
24042 !! html/parsoid
24043 <object data="test.swf"></object>
24044 !! wikitext
24045 <object data="test.swf"></object>
24046 !!end
24047
24048 !! test
24049 Don't block XML namespace declaration
24050 !! wikitext
24051 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24052 !! html/php
24053 <p><span>MediaWiki</span>
24054 </p>
24055 !! html/parsoid
24056 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24057 !! end
24058
24059 # -----------------------------------------------------------------
24060 # The following section of tests are primarily to spec requirements
24061 # around serialization of new/edited content.
24062 #
24063 # All these tests are marked Parsoid html2wt and html2html only
24064 # ----------------------------------------------------------------
24065
24066 # 'mi' is a localinterwiki prefix as well as a language
24067 !! test
24068 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24069 !! options
24070 parsoid=html2wt
24071 !! html/parsoid
24072 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24073 !! wikitext
24074 [[Foo]]
24075 !! end
24076
24077 # See T93839
24078 !! test
24079 New wikilinks should be serialized properly
24080 !! options
24081 parsoid=html2wt
24082 !! html/parsoid
24083 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24084 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24085 !! wikitext
24086 [[Foo]]
24087 [[Foo]]
24088 !! end
24089
24090 !! test
24091 New wiki links (href variations)
24092 !! options
24093 parsoid=html2wt
24094 !! html/parsoid
24095 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24096 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24097 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24098 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24099 !! wikitext
24100 [[Foo_bar]]
24101 [[Foo_bar]]
24102 [[Foo_bar]]
24103 [[Toxine bactérienne]]
24104 !! end
24105
24106 !! test
24107 New wiki links (content string variations)
24108 !! options
24109 parsoid=html2wt
24110 !! html/parsoid
24111 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24112 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24113 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24114 !! wikitext
24115 [[Foo_bar]]
24116 [[Foo bar]]
24117 [[Foo_bar|./Foo_bar]]
24118 !! end
24119
24120 !! test
24121 New category links (href variations)
24122 !! options
24123 parsoid=html2wt
24124 !! html/parsoid
24125 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24126 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24127 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24128 !! wikitext
24129 [[Category:Toxine bactérienne]]
24130 [[Category:Toxine bactérienne]]
24131 [[Category:Toxine bactérienne]]
24132 !! end
24133
24134 !! test
24135 New sol transparent links don't need indent-pre nowiki protection
24136 !! options
24137 parsoid=html2wt
24138 language=de
24139 !! html/parsoid
24140 <link rel="mw:PageProp/redirect" href="./Main_Page">
24141 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24142 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24143 !! wikitext
24144 #WEITERLEITUNG [[Main Page]]
24145 <!-- this is good --> [[Category:Good]]
24146 <!-- this is great --> [[Kategorie:Great]]
24147 !! end
24148
24149 !! test
24150 New interlanguage links (href variations)
24151 !! options
24152 parsoid=html2wt
24153 !! html/parsoid
24154 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24155 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24156 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24157 !! wikitext
24158 [[es:Toxine bactérienne]]
24159 [[es:Toxine_bactérienne]]
24160 [[es:Toxine_bactérienne]]
24161 !! end
24162
24163 !! test
24164 Image: Modifying size of an image (1)
24165 !! options
24166 parsoid={
24167 "modes": ["wt2wt"],
24168 "changes": [
24169 ["img[height]", "attr", "height", "22"],
24170 ["img[width]", "attr", "width", "200"]
24171 ]
24172 }
24173 !! wikitext
24174 [[Image:Foobar.jpg|230x230px]]
24175 !! wikitext/edited
24176 [[Image:Foobar.jpg|200x200px]]
24177 !!end
24178
24179 !! test
24180 Image: Modifying size of an image (2)
24181 !! options
24182 parsoid={
24183 "modes": ["wt2wt"],
24184 "changes": [
24185 ["img[height]", "attr", "height", "100"],
24186 ["img[width]", "attr", "width", "500"]
24187 ]
24188 }
24189 !! wikitext
24190 [[Image:Foobar.jpg|230x230px]]
24191 !! wikitext/edited
24192 [[Image:Foobar.jpg|500x500px]]
24193 !!end
24194
24195 # Change in size is ignored so long as class='mw-default-size'
24196 !! test
24197 Image: Modifying size of an image (3)
24198 !! options
24199 parsoid={
24200 "modes": ["wt2wt"],
24201 "changes": [
24202 ["figure[class]", "removeClass", "mw-default-size"],
24203 ["figure img", "attr", "height", "19"],
24204 ["figure img", "attr", "width", "170"]
24205 ]
24206 }
24207 !! wikitext
24208 [[Image:Foobar.jpg|thumb]]
24209 !! wikitext/edited
24210 [[Image:Foobar.jpg|thumb|170x170px]]
24211 !!end
24212
24213 !! test
24214 Image: Modifying alignment of an image (bug 48665)
24215 !! options
24216 parsoid={
24217 "modes": ["wt2wt"],
24218 "changes": [
24219 ["figure[class]", "removeClass", "mw-halign-right"],
24220 ["figure[class]", "addClass", "mw-halign-left"]
24221 ]
24222 }
24223 !! wikitext
24224 [[Image:Foobar.jpg|thumb|caption|right]]
24225 !! wikitext/edited
24226 [[Image:Foobar.jpg|thumb|caption|left]]
24227 !! end
24228
24229 !! test
24230 Image: Modifying mw-default-size of an frameless image (bug 62805)
24231 !! options
24232 parsoid={
24233 "modes": ["wt2wt"],
24234 "changes": [
24235 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24236 ]
24237 }
24238 !! wikitext
24239 [[Image:Foobar.jpg|frameless|right]]
24240 !! wikitext/edited
24241 [[Image:Foobar.jpg|frameless|right|220x220px]]
24242 !! end
24243
24244 !! test
24245 Image: Modifying valign of an image (bug 49221)
24246 !! options
24247 parsoid={
24248 "modes": ["wt2wt"],
24249 "changes": [
24250 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24251 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24252 ]
24253 }
24254 !! wikitext
24255 [[File:Foobar.jpg|20px|middle]]
24256 !! wikitext/edited
24257 [[File:Foobar.jpg|20px|text-top]]
24258 !! end
24259
24260 !! test
24261 Image: Modifying alt attribute of an image (bug 56400)
24262 !! options
24263 parsoid={
24264 "modes": ["wt2wt"],
24265 "changes": [
24266 ["img[alt]", "attr", "alt", "some alternate edited text"]
24267 ]
24268 }
24269 !! wikitext
24270 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24271 !! wikitext/edited
24272 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24273 !!end
24274
24275 !! test
24276 Image: Modifying caption of an image
24277 !! options
24278 parsoid={
24279 "modes": ["wt2wt"],
24280 "changes": [
24281 ["figcaption", "text", "new caption"]
24282 ]
24283 }
24284 !! wikitext
24285 [[Image:Foobar.jpg|thumb|original caption]]
24286 !! wikitext/edited
24287 [[Image:Foobar.jpg|thumb|new caption]]
24288 !!end
24289
24290 !! test
24291 Image: empty alt attribute (bug 48924)
24292 !! options
24293 parsoid
24294 !! wikitext
24295 [[File:Foobar.jpg|thumb|alt=|bar]]
24296 !! html
24297 <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>
24298 !! end
24299
24300 !! test
24301 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24302 !! options
24303 parsoid=html2wt
24304 language=ar
24305 disabled
24306 !! html/parsoid
24307 <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>
24308 !! wikitext
24309 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24310 !! end
24311
24312 !! test
24313 Image: Block level image should have \n before and after
24314 !! wikitext
24315 123
24316 [[File:Foobar.jpg|right|thumb|150x150px]]
24317 456
24318 !! html/parsoid
24319 <p>123</p>
24320 <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>
24321 <p>456</p>
24322 !!end
24323
24324 !! test
24325 Image: New block level image should have \n before and after (existing content)
24326 !! wikitext
24327 123
24328 [[File:Foobar.jpg|right|thumb|150x150px]]
24329 456
24330 !! html/parsoid
24331 <p>123</p>
24332 <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>
24333 <p>456</p>
24334 !!end
24335
24336 !! test
24337 Image: upright option (parsoid)
24338 !! wikitext
24339 [[File:Foobar.jpg|thumb|upright|caption]]
24340 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24341 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24342 !! html/parsoid
24343 <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>
24344 <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>
24345 <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>
24346 !!end
24347
24348 !! test
24349 Image: upright option is ignored on inline and frame images (parsoid)
24350 !! wikitext
24351 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24352 !! html/parsoid
24353 <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>
24354 !!end
24355
24356 !! test
24357 Image: from basic HTML (1)
24358 !! options
24359 parsoid=html2wt
24360 !! html/parsoid
24361 <span typeof="mw:Image">
24362 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24363 </span>
24364 !! wikitext
24365 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24366 !! end
24367
24368 !! test
24369 Image: from basic HTML (2)
24370 !! options
24371 parsoid=html2wt
24372 !! html/parsoid
24373 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24374 !! wikitext
24375 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24376 !! end
24377
24378 !! test
24379 Image: from basic HTML (3)
24380 !! options
24381 parsoid=html2wt
24382 !! html/parsoid
24383 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24384 !! wikitext
24385 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24386 !! end
24387
24388 !! test
24389 Image: from basic HTML (4)
24390 !! options
24391 parsoid=html2wt
24392 !! html/parsoid
24393 <img src="./File:Foobar.jpg">
24394 !! wikitext
24395 [[File:Foobar.jpg|link=]]
24396 !! end
24397
24398 !! test
24399 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24400 !! options
24401 parsoid=html2wt
24402 !! html/parsoid
24403 <ul>
24404 <li><p>foo</p></li>
24405 </ul>
24406 !! wikitext
24407 * foo
24408 !! end
24409
24410 !! test
24411 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24412 !! options
24413 parsoid=html2wt
24414 !! html/parsoid
24415 <ul> <li>foo</li></ul>
24416 !! wikitext
24417 * foo
24418 !! end
24419
24420 !! test
24421 Don't strip leading whitespace when handling indent-pre suppressing tags
24422 !! options
24423 parsoid=html2wt
24424 !! html/parsoid
24425 <table>
24426 <tr><td> indented row</td></tr>
24427 </table>
24428 <blockquote><p>
24429 <b>This is very bold of you!</b>
24430 </p>
24431 <table><tr><td>
24432 indented cell (no pre-wrapping!)
24433 </td></tr></table>
24434 </blockquote>
24435 <p>foo</p>
24436 <div>bar</div>
24437 !! wikitext
24438 {|
24439 | indented row
24440 |}
24441 <blockquote>
24442 '''This is very bold of you!'''
24443
24444 {|
24445 |
24446 indented cell (no pre-wrapping!)
24447 |}
24448 </blockquote>
24449 foo
24450 <div>bar</div>
24451 !! end
24452
24453 !! test
24454 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24455 !! options
24456 parsoid=html2wt
24457 !! html/parsoid
24458 <p>foo</p>
24459 <span>bar</span>
24460
24461 <span>foo2
24462 </span>bar2
24463
24464 <div>foo</div>
24465 <span>bar</span>
24466
24467 <div>
24468 <span>foo</span>
24469 </div>
24470 !! wikitext
24471 foo
24472 <nowiki> </nowiki><span>bar</span>
24473
24474 <span>foo2
24475 <nowiki> </nowiki></span>bar2
24476
24477 <div>foo</div>
24478 <nowiki> </nowiki><span>bar</span>
24479
24480 <div>
24481 <nowiki> </nowiki><span>foo</span>
24482 </div>
24483 !! end
24484
24485 !! test
24486 Lists: Dont insert newlines in a serialized list item.
24487 !! options
24488 parsoid=html2wt
24489 !! html/parsoid
24490 <ul><li>a<br>b</li><li>c</li></ul>
24491 !! wikitext
24492 * a<br>b
24493 * c
24494 !! end
24495
24496 !! test
24497 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24498 !! options
24499 parsoid={
24500 "modes": ["html2wt"],
24501 "scrubWikitext": false
24502 }
24503 !! html/parsoid
24504 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24505 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24506
24507 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24508 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24509
24510 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24511
24512 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24513 !! wikitext
24514 == hello there [[Category:A1]] ==
24515
24516 == [[Category:A2]] hi pal ==
24517
24518 == <!--foo--> [[Category:A3]] how goes it ==
24519
24520 == it goes well [[Category:A4]] <!--bar--> ==
24521
24522 ==howdy [[Category:A5]] ==
24523
24524 == __TOC__ ok ==
24525 !! end
24526
24527 !! test
24528 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24529 !! options
24530 parsoid={
24531 "modes": ["html2wt"],
24532 "scrubWikitext": true
24533 }
24534 !! html/parsoid
24535 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24536 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24537
24538 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24539 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24540
24541 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24542 !! wikitext
24543 == hello there ==
24544 [[Category:A1]]
24545 [[Category:A2]]
24546
24547 == hi pal ==
24548
24549 <!--foo--> [[Category:A3]]
24550
24551 == how goes it ==
24552
24553 == it goes well ==
24554 [[Category:A4]] <!--bar-->
24555
24556 __TOC__
24557
24558 == ok ==
24559 !! end
24560
24561 !! test
24562 Headings: Don't hoist metas that come from templates
24563 !! options
24564 parsoid={
24565 "modes": ["html2wt"],
24566 "scrubWikitext": true
24567 }
24568 !! html/parsoid
24569 <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>
24570 !! wikitext
24571 == {{echo|foo [[Category:Foo]]}} ==
24572 !! end
24573
24574 !! test
24575 Headings: Category in ref isn't hoisted
24576 !! options
24577 parsoid={
24578 "modes": ["html2wt"],
24579 "scrubWikitext": true
24580 }
24581 !! html/parsoid
24582 <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>
24583
24584 <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>
24585 !! wikitext
24586 == foo <ref>bar
24587 [[Category:Baz]] </ref> ==
24588
24589 <references />
24590 !! end
24591
24592 !! test
24593 Parsoid: Serialize positional parameters with = in them as named parameter
24594 !! options
24595 parsoid=html2wt
24596 !! html/parsoid
24597 <p about="#mwt1" typeof="mw:Transclusion"
24598 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24599
24600 <p about="#mwt1" typeof="mw:Transclusion"
24601 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24602
24603 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24604 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24605 <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>
24606 !! wikitext
24607 {{echo|1 = f=oo}}
24608
24609 {{echo|1 = f=oo|2 = bar}}
24610
24611 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24612 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24613 {{echo|<nowiki>f=oo</nowiki>|bar}}
24614 !! end
24615
24616 !! test
24617 Parsoid: Serialize positional parameters with = in extlink as named parameter
24618 !! options
24619 parsoid=html2wt
24620 !! html/parsoid
24621 <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>
24622 !! wikitext
24623 {{echo|1 = http://stuff?is=ok}}
24624 !! end
24625
24626 !! test
24627 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24628 !! options
24629 parsoid=html2wt
24630 !! html/parsoid
24631 <div>a<p>b</p></div>
24632 <div>a
24633 <p>b</p></div>
24634 <div>
24635 a
24636 <p>b</p></div>
24637 !! wikitext
24638 <div>a
24639 b
24640 </div>
24641 <div>a
24642 b
24643 </div>
24644 <div>
24645 a
24646
24647 b
24648 </div>
24649 !! end
24650
24651 !! test
24652 Substrings resembling wikitext in hrefs should not get nowiki escapes
24653 !! options
24654 parsoid=html2wt
24655 !! html/parsoid
24656 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24657 !! wikitext
24658 [[Foo''bar''baz]]
24659 !! end
24660
24661 !! test
24662 Enforce single-line context in the serializer
24663 !! options
24664 parsoid=html2wt
24665 !! html/parsoid
24666 <h2>testing
24667 123</h2>
24668
24669 <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">
24670 </span><span about="#mwt1">you</span> </h2>
24671
24672 <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>
24673
24674 <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
24675 there</span></li></ol>
24676
24677 <ul><li>asd
24678 sdf</li></ul>
24679
24680 <ul><li>foo
24681 bar
24682 baz</li>
24683 <li>foo <b>bar</b>
24684 baz</li></ul>
24685
24686 <dl><dt>hi
24687 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24688 ho</dd></dl>
24689
24690 <dl><dd> <table>
24691 <tbody><tr><td> ha
24692 ha
24693 ha</td></tr>
24694 </tbody></table></dd></dl>
24695 !! wikitext
24696 == testing 123 ==
24697
24698 == hi {{bogus|there
24699 you}} ==
24700
24701 == foo <ref>hello
24702 there</ref> ==
24703
24704 <references />
24705
24706 * asd sdf
24707
24708 * foo bar baz
24709 * foo '''bar''' baz
24710
24711 ; hi ho : hi ho
24712
24713 : {|
24714 | ha
24715 ha
24716 ha
24717 |}
24718 !! end
24719
24720 !! test
24721 Serialize new placeholder space without spans
24722 !! options
24723 parsoid=html2wt
24724 !! html/parsoid
24725 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24726
24727 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24728
24729 <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>
24730 !! wikitext
24731 foo : bar
24732
24733 foo : bar
24734
24735 <ref>foo : bar</ref>ok
24736 !! end
24737
24738
24739 #-----------------------
24740 # Tag minimization tests
24741 #-----------------------
24742
24743 !! test
24744 1. I/B quote minimization: wikitext-only tags should be combined
24745 !! options
24746 parsoid=html2wt
24747 !! html/parsoid
24748 <p><i>A</i><i>B</i></p>
24749 <p><b>A</b><b>B</b></p>
24750 <p><i>A</i><b><i>B</i></b></p>
24751 <p><b>A</b><i><b>B</b></i></p>
24752 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24753 <p><i><b>A</b></i><i><b>B</b></i></p>
24754 <p><i><b>A</b></i><b><i>B</i></b></p>
24755 <p><b><i>A</i></b><i><b>B</b></i></p>
24756 !! wikitext
24757 ''AB''
24758
24759 '''AB'''
24760
24761 ''A'''B'''''
24762
24763 '''A''B'''''
24764
24765 '''A''BC''D'''
24766
24767 '''''AB'''''
24768
24769 '''''AB'''''
24770
24771 '''''AB'''''
24772 !! end
24773
24774 !! test
24775 2. I/B quote minimization: wikitext and html tags should not be combined
24776 !! options
24777 parsoid=html2wt
24778 !! html/parsoid
24779 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24780 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24781 !! wikitext
24782 ''A''<i>B</i>
24783
24784 ''A''<nowiki/>'''<i>B</i>'''
24785 !! end
24786
24787 !! test
24788 3. I/B quote minimization: templated content stops minimization
24789 !! options
24790 parsoid=html2wt
24791 !! html/parsoid
24792 <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>
24793 <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>
24794 !! wikitext
24795 ''A''{{echo|''B''}}
24796
24797 ''A''{{echo|'''''B'''''}}
24798 !! end
24799
24800 !! test
24801 4. I/B quote minimization: new content should be mimimized with adjacent old content
24802 !! options
24803 parsoid=html2wt
24804 !! html/parsoid
24805 <p><i>A</i><i>B</i></p>
24806 <p><b>A</b><b>B</b></p>
24807 <p><i>A</i><b><i>B</i></b></p>
24808 !! wikitext
24809 ''AB''
24810
24811 '''AB'''
24812
24813 ''A'''B'''''
24814 !! end
24815
24816 !! test
24817 5a. Merge adjacent quote nodes if they've been edited
24818 !! options
24819 parsoid={
24820 "modes": ["wt2wt", "selser"],
24821 "changes": [
24822 ["p", "contents", "remove", ":contains('b')"]
24823 ]
24824 }
24825 !! wikitext
24826 ''a''b''c''
24827 !! wikitext/edited
24828 ''ac''
24829 !! end
24830
24831 !! test
24832 5b. Merge adjacent quote nodes if they've been edited
24833 !! options
24834 parsoid={
24835 "modes": ["wt2wt", "selser"],
24836 "changes": [
24837 ["#x", "remove"]
24838 ]
24839 }
24840 !! wikitext
24841 ''a''<span id="x">b</span>''c''
24842 !! wikitext/edited
24843 ''ac''
24844 !! end
24845
24846 !! test
24847 1. Merge adjacent link nodes as long as at least one element is new
24848 !! options
24849 parsoid={
24850 "modes": ["html2wt"],
24851 "scrubWikitext": true
24852 }
24853 !! html/parsoid
24854 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24855 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24856 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24857 !! wikitext
24858 [[Football]]
24859 [[Football]]
24860 [[Football|Foot]][[Football|ball]]
24861 !! end
24862
24863 !! test
24864 2. Merge adjacent link nodes and enable additional normalizations
24865 !! options
24866 parsoid={
24867 "modes": ["html2wt"],
24868 "scrubWikitext": true
24869 }
24870 !! html/parsoid
24871 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24872 !! wikitext
24873 [[Football|''Football'']]
24874 !! end
24875
24876 !! test
24877 3. Don't merge adjacent link nodes if scrubWikitext is false
24878 !! options
24879 parsoid={
24880 "modes": ["html2wt"],
24881 "scrubWikitext": false
24882 }
24883 !! html/parsoid
24884 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24885 !! wikitext
24886 [[Football|Foot]][[Football|ball]]
24887 !! end
24888
24889 #------------------------------
24890 # End of tag minimization tests
24891 #------------------------------
24892
24893 !!test
24894 Bug 54262: New entities
24895 !! options
24896 parsoid=html2wt
24897 !! html/parsoid
24898 <span typeof="mw:Entity">&nbsp;</span>
24899 !! wikitext
24900 &nbsp;
24901 !! end
24902
24903 ## Note that there is no wikitext output for 'unknownproperty' ##
24904 ## Unknown magic words are silently dropped ##
24905
24906 !! test
24907 Magic words
24908 !! options
24909 parsoid=html2wt
24910 !! html/parsoid
24911 <meta property='mw:PageProp/toc' />
24912 <meta property='mw:PageProp/notoc' />
24913 <meta property='mw:PageProp/forcetoc' />
24914 <meta property='mw:PageProp/index' />
24915 <meta property='mw:PageProp/noindex' />
24916 <meta property='mw:PageProp/nogallery' />
24917 <meta property='mw:PageProp/noeditsection' />
24918 <meta property='mw:PageProp/notitleconvert' />
24919 <meta property='mw:PageProp/nocontentconvert' />
24920 <meta property='mw:PageProp/unknownproperty' />
24921 !! wikitext
24922 __TOC__
24923 __NOTOC__
24924 __FORCETOC__
24925 __INDEX__
24926 __NOINDEX__
24927 __NOGALLERY__
24928 __NOEDITSECTION__
24929 __NOTITLECONVERT__
24930 __NOCONTENTCONVERT__
24931 !! end
24932
24933 !! test
24934 Consecutive <pre>s should not get merged
24935 !! options
24936 parsoid=html2wt,html2html
24937 !! html/parsoid
24938 <pre>a</pre><pre>b</pre>
24939
24940 <pre>c
24941 </pre><pre>
24942 d</pre>
24943
24944 <pre>e
24945
24946 </pre><pre>
24947
24948 f</pre>
24949 !! wikitext
24950 a
24951
24952 b
24953
24954 c
24955
24956 d
24957
24958 e
24959
24960
24961
24962 f
24963 !! end
24964
24965 !! test
24966 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24967 !! options
24968 parsoid=html2wt
24969 !! html/parsoid
24970 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24971 !! wikitext
24972 [[Special:BookSources/1234567890|ISBN 1234567895]]
24973 !! end
24974
24975 !! test
24976 Edited RFC links not serializable as RFC links should serialize as extlinks
24977 !! options
24978 parsoid=html2wt
24979 !! html/parsoid
24980 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24981 !! wikitext
24982 [//tools.ietf.org/html/rfc123 New RFC]
24983 !! end
24984
24985 !! test
24986 Edited PMID links not serializable as PMID links should serialize as extlinks
24987 !! options
24988 parsoid=html2wt
24989 !! html/parsoid
24990 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24991 !! wikitext
24992 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24993 !! end
24994
24995 !! test
24996 WTS of autolinks with trailing/surrounding context
24997 !! options
24998 parsoid=html2wt
24999 !! html/parsoid
25000 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25001 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25002 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25003 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25004 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25005 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25006 !! wikitext
25007 http://cscott.net<nowiki/>'''foo'''
25008
25009 http://cscott.net<b>foo</b>
25010
25011 '''http://cscott.net<nowiki/>'''
25012
25013 '''http://cscott.net '''
25014
25015 '''http://cscott.net<nowiki/>x'''
25016
25017 http://cscott.net<nowiki/>x
25018 !! end
25019
25020 !! test
25021 WTS of autolinks with nowikis (round-trip)
25022 !! wikitext
25023 x<nowiki/>http://cscott.net<nowiki/>x
25024 !! html/parsoid
25025 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25026 !! end
25027
25028 # this is the "easy" test because it leaves in place all the
25029 # data-parsoid information indicating this is an autolink
25030 !! test
25031 WTS of autolinks with escapes (editing)
25032 !! options
25033 parsoid={
25034 "modes": ["wt2wt"],
25035 "changes": [
25036 [ "meta", "remove" ]
25037 ]
25038 }
25039 !! wikitext
25040 x<nowiki/>http://cscott.net<nowiki/>x
25041 !! wikitext/edited
25042 x<nowiki/>http://cscott.net<nowiki/>x
25043 !! end
25044
25045 !! test
25046 WTS of edited autolink-like text (T103364)
25047 !! options
25048 parsoid={
25049 "modes": ["wt2wt"],
25050 "changes": [
25051 [ "span[typeof]", "removeAttr", "typeof" ]
25052 ]
25053 }
25054 !! wikitext
25055 Not a link: <nowiki>http://example.com</nowiki>.
25056 !! wikitext/edited
25057 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25058 !! end
25059
25060 !! test
25061 WTS of newly-authored autolink-like text (T103364)
25062 !! options
25063 parsoid=html2wt
25064 !! html/parsoid
25065 <p>http://example.com is not a link.</p>
25066 !! wikitext
25067 <nowiki>http://example.com is not a link.</nowiki>
25068 !! end
25069
25070 !! test
25071 WTS of autolink-like text after an autolink (T108563)
25072 !! options
25073 parsoid=html2wt
25074 !! html/parsoid
25075 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25076 !! wikitext
25077 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25078 !! end
25079
25080 !! test
25081 Edited Redirect link should emit a non-piped wikitext link
25082 !! options
25083 parsoid=html2wt
25084 !! html/parsoid
25085 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25086 !! wikitext
25087 #REDIRECT [[Bar]]
25088 !! end
25089
25090 !! test
25091 T75121: Infer extension name from typeOf if data-mw is not present
25092 !! options
25093 parsoid=html2wt
25094 !! html/parsoid
25095 <div typeOf="mw:Extension/foo"></div>
25096 !! wikitext
25097 <foo />
25098 !! end
25099
25100 # Note that the <p> wrapping isn't present in PHP parser output
25101 # The important thing for this test is that P-wrapping doesn't
25102 # interfere with the <nowiki> protection for leading - in <td>
25103 # (which isn't necessary for <th>).
25104 !! test
25105 T88318: p-wrapped dash in table.
25106 !! options
25107 parsoid=html2wt,wt2wt
25108 !! html/parsoid
25109 <table><tbody>
25110 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25111 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25112 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25113 </tbody></table>
25114 !! wikitext
25115 {|
25116 !-
25117 !-
25118 |-
25119 |<nowiki>-</nowiki>
25120 |<nowiki>- </nowiki>
25121 |-
25122 |<small>-</small>
25123 |<br>
25124 -
25125 |<br>
25126 -
25127 |}
25128 !! html/php+tidy
25129 <table>
25130 <tr>
25131 <th>-</th>
25132 <th>-</th>
25133 </tr>
25134 <tr>
25135 <td>-</td>
25136 <td>-</td>
25137 </tr>
25138 <tr>
25139 <td><small>-</small></td>
25140 <td><br />
25141 <p>-</p>
25142 </td>
25143 <td><br />
25144 <p>-</p>
25145 </td>
25146 </tr>
25147 </table>
25148 !! end
25149
25150 !! test
25151 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25152 !! options
25153 parsoid=html2wt
25154 !! html/parsoid
25155 <table id='mwAb'>
25156 <td id='mwAc'>foo</td>
25157 <td id='serialize-this'>bar</td>
25158 </table>
25159 !! wikitext
25160 {|
25161 |foo
25162 | id="serialize-this" |bar
25163 |}
25164 !! end
25165
25166 !! test
25167 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25168 !! options
25169 parsoid=html2wt
25170 !! html/parsoid
25171 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25172 !! wikitext
25173 <div id="hello">ok</div>
25174 !! end
25175
25176 !! test
25177 WTS change modes
25178 !! options
25179 parsoid={
25180 "modes": ["wt2wt"],
25181 "changes": [
25182 [ "#xyz", "before", "<b>before</b> stuff " ],
25183 [ "#xyz", "after", " stuff <i>after</i>" ],
25184 [ "#xyz", "html", "x <b>y</b> z" ]
25185 ]
25186 }
25187 !! wikitext
25188 <span id="xyz">hello</span>
25189 !! wikitext/edited
25190 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25191 !! end
25192
25193 !! test
25194 Never serialize a-tag as html, regardless of what data-parsoid has to say
25195 !! options
25196 parsoid=html2wt
25197 !! html/parsoid
25198 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25199 !! wikitext
25200 [[Foo]]
25201 !! end
25202
25203 ## SSS FIXME: This is broken output nevertheless.
25204 ## What might be a reasonable non-broken output for this?
25205 ## This is an edge case unlikely to be seen in production
25206 ## that I am not wasting more time on this right now.
25207 !! test
25208 Never serialize a-tag as html, no matter what attributes it has
25209 !! options
25210 parsoid=html2wt
25211 !! html/parsoid
25212 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25213 !! wikitext
25214 [http://boo.org http://boohoo.org]
25215 !! end
25216
25217 # Misnested is an indication that selser can reuse the source but these have
25218 # shown to sneak through on occasion. See T101768.
25219 # The original wikitext here is: [http://test.com [[one]] two three]
25220 !! test
25221 Strip span tags added to mark as misnested
25222 !! options
25223 parsoid=html2wt
25224 !! html/parsoid
25225 <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>
25226 !! wikitext
25227 [http://test.com][[one]] two three
25228 !! end
25229
25230 # --------------------------------------------
25231 # Tests spec'ing wikitext serialization norms |
25232 # --------------------------------------------
25233
25234 !! test
25235 Lists: Add space after bullets
25236 !! options
25237 parsoid=html2wt
25238 !! html/parsoid
25239 <ul>
25240 <li>foo</li>
25241 <li> bar</li>
25242 <li><span> baz</span></li>
25243 </ul>
25244 !! wikitext
25245 * foo
25246 * bar
25247 * <span> baz</span>
25248 !! end
25249
25250 !! test
25251 1. Headings: Add space before/after == (T53744)
25252 !! options
25253 parsoid=html2wt
25254 !! html/parsoid
25255 <h2>foo</h2>
25256 <h2> bar</h2>
25257 <h2>baz </h2>
25258 <h2><span> baz</span></h2>
25259 !! wikitext
25260 == foo ==
25261
25262 == bar ==
25263
25264 == baz ==
25265
25266 == <span> baz</span> ==
25267 !! end
25268
25269 !! test
25270 2. Headings: Add space before/after == even after hoisted content
25271 !! options
25272 parsoid={
25273 "modes": ["html2wt"],
25274 "scrubWikitext": true
25275 }
25276 !! html/parsoid
25277 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25278 !! wikitext
25279 [[Category:A2]]
25280
25281 == ok ==
25282 !! end
25283
25284 !! test
25285 1. Headings: suppress newly created empty headings
25286 !! options
25287 parsoid={
25288 "modes": ["html2wt"],
25289 "scrubWikitext": true
25290 }
25291 !! html/parsoid
25292 <h2></h2>
25293 !! wikitext
25294 !! end
25295
25296 !! test
25297 2. Headings: don't suppress empty headings if scrubWikitext is false
25298 !! options
25299 parsoid=html2wt
25300 !! html/parsoid
25301 <h2></h2>
25302 !! wikitext
25303 ==<nowiki/>==
25304 !! end
25305
25306 !! test
25307 3. Headings: suppress empty headings on edits
25308 !! options
25309 parsoid={
25310 "modes": ["selser"],
25311 "scrubWikitext": true,
25312 "changes": [
25313 [ "#x", "remove"]
25314 ]
25315 }
25316 !! wikitext
25317 ==<span id="x">foo</span>==
25318 !! wikitext/edited
25319 !! end
25320
25321 !! test
25322 1. WT Quote Tags: suppress newly created empty style tags
25323 !! options
25324 parsoid={
25325 "modes": ["html2wt"],
25326 "scrubWikitext": true
25327 }
25328 !! html/parsoid
25329 <i></i><b></b>
25330 !! wikitext
25331 !! end
25332
25333 !! test
25334 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25335 !! options
25336 parsoid=html2wt
25337 !! html/parsoid
25338 <i></i><b></b>
25339 !! wikitext
25340 ''<nowiki/>'''''<nowiki/>'''
25341 !! end
25342
25343 !! test
25344 3. WT Quote Tags: suppress empty style tags on edits
25345 !! options
25346 parsoid={
25347 "modes": ["selser"],
25348 "scrubWikitext": true,
25349 "changes": [
25350 [ "#x", "remove"]
25351 ]
25352 }
25353 !! wikitext
25354 '''<span id="x">foo</span>'''
25355 !! wikitext/edited
25356 !! end
25357
25358 !! test
25359 1. Anchors: suppress newly created empty anchors
25360 !! options
25361 parsoid={
25362 "modes": ["html2wt"],
25363 "scrubWikitext": true
25364 }
25365 !! html/parsoid
25366 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25367 !! wikitext
25368 !! end
25369
25370 !! test
25371 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25372 !! options
25373 parsoid={
25374 "modes": ["html2wt"],
25375 "scrubWikitext": false
25376 }
25377 !! html/parsoid
25378 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25379 !! wikitext
25380 [[Test|<nowiki/>]]
25381 !! end
25382
25383 !! test
25384 3. Anchors: suppress empty anchors on edits
25385 !! options
25386 parsoid={
25387 "modes": ["selser"],
25388 "scrubWikitext": true,
25389 "changes": [
25390 [ "#x", "remove"]
25391 ]
25392 }
25393 !! wikitext
25394 [[Test|<span id="x">foo</span>]]
25395 !! wikitext/edited
25396 !! end
25397
25398 !! test
25399 3a. Anchors: do not suppress numbered extlinks
25400 !! options
25401 parsoid={
25402 "modes": ["wt2wt"],
25403 "scrubWikitext": true
25404 }
25405 !! wikitext
25406 [http://foo.com]
25407 !! html/parsoid
25408 <a rel="mw:ExtLink" href="http://foo.com"></a>
25409 !! end
25410
25411 !! test
25412 3b. Anchors: do not suppress numbered extlinks
25413 !! options
25414 parsoid={
25415 "modes": ["wt2wt"],
25416 "scrubWikitext": true,
25417 "changes": [
25418 [ "#x", "remove"]
25419 ]
25420 }
25421 !! wikitext
25422 [http://foo.com <span id="x">foo</span>]
25423 !! wikitext/edited
25424 [http://foo.com]
25425 !! end
25426
25427 !!test
25428 Normalizations should be restricted to edited content
25429 !!options
25430 parsoid={
25431 "modes": ["selser"],
25432 "scrubWikitext": true,
25433 "changes": [
25434 [ "h1", "before", "<i></i>"]
25435 ]
25436 }
25437 !!wikitext
25438 a
25439 = =
25440 b
25441 !!wikitext/edited
25442 a
25443 = =
25444 b
25445 !!end
25446
25447 !! test
25448 1. Multiple normalizations (html2wt)
25449 !! options
25450 parsoid={
25451 "modes": ["html2wt"],
25452 "scrubWikitext": true
25453 }
25454 !! html
25455 <h2><i></i></h2>
25456 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25457 </a><b><i></i></b>x</p>
25458 !! wikitext
25459
25460 [[foo]]
25461 x
25462
25463 !! end
25464
25465 !! test
25466 2. Multiple normalizations (selser)
25467 !! options
25468 parsoid={
25469 "modes": ["selser"],
25470 "scrubWikitext": true,
25471 "changes": [
25472 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25473 ]
25474 }
25475 !! wikitext
25476 <span id="x">foo</span>
25477 !! wikitext/edited
25478 <span id="x">foo</span>
25479
25480 x
25481 !! end
25482
25483 !! test
25484 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25485 !! options
25486 parsoid={
25487 "modes": ["html2wt"],
25488 "scrubWikitext": true
25489 }
25490 !! html/parsoid
25491 <p> hi</p>
25492 <p> hello</p>
25493 !! wikitext
25494 hi
25495
25496 hello
25497 !! end
25498
25499 !! test
25500 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25501 !! options
25502 parsoid=html2wt
25503 !! html/parsoid
25504 <p> hi</p>
25505 <p> hello</p>
25506 !! wikitext
25507 <nowiki> </nowiki>hi
25508
25509 <nowiki> </nowiki> hello
25510 !! end
25511
25512 !! test
25513 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25514 !! options
25515 parsoid={
25516 "modes": ["html2wt"],
25517 "scrubWikitext": true
25518 }
25519 !! html/parsoid
25520 <p>Foo
25521 bar
25522 baz</p>
25523
25524 <table><tr><td>Foo
25525 bar
25526 baz bang</td></tr></table>
25527
25528 <p><!--boo--> foo
25529 bar</p>
25530
25531 <p> foo
25532 bar<span>boo</span></p>
25533 !! wikitext
25534 Foo
25535 bar
25536 baz
25537
25538 {|
25539 |Foo
25540 bar
25541 baz bang
25542 |}
25543
25544 <!--boo-->foo
25545 bar
25546
25547 foo
25548 bar<span>boo</span>
25549 !! end
25550
25551 !! test
25552 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25553 !! options
25554 parsoid={
25555 "modes": ["selser"],
25556 "scrubWikitext": true,
25557 "changes": [
25558 [ "p", "html", " a\n b" ]
25559 ]
25560 }
25561 !! wikitext
25562 xyz
25563 !! wikitext/edited
25564 a
25565 b
25566 !! end
25567
25568 !! test
25569 1. New links that end in spaces
25570 !! options
25571 parsoid={
25572 "modes": ["html2wt"],
25573 "scrubWikitext": false
25574 }
25575 !! html/parsoid
25576 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25577 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25578 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25579 !! wikitext
25580 [[Berlin ]]<nowiki/>is the capital of Germany.
25581
25582 [[Foo ]]'''bar'''
25583
25584 [[Boston ]] is a city.
25585 !! end
25586
25587 !! test
25588 2. New links that end in spaces
25589 !! options
25590 parsoid={
25591 "modes": ["html2wt"],
25592 "scrubWikitext": true
25593 }
25594 !! html/parsoid
25595 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25596 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25597 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25598 !! wikitext
25599 [[Berlin]] is the capital of Germany.
25600
25601 [[Foo]] '''bar'''
25602
25603 [[Boston]] is a city.
25604 !! end
25605
25606 !! test
25607 1. Table cells with escapable prefixes
25608 !! options
25609 parsoid={
25610 "modes": ["html2wt"],
25611 "scrubWikitext": false
25612 }
25613 !! html
25614 <table>
25615 <tr><td>a</td></tr>
25616 <tr><td>-</td></tr>
25617 <tr><td>+</td></tr>
25618 </table>
25619 !! wikitext
25620 {|
25621 |a
25622 |-
25623 |<nowiki>-</nowiki>
25624 |-
25625 |<nowiki>+</nowiki>
25626 |}
25627 !! end
25628
25629 !! test
25630 2. Table cells with escapable prefixes
25631 !! options
25632 parsoid={
25633 "modes": ["html2wt"],
25634 "scrubWikitext": true
25635 }
25636 !! html
25637 <table>
25638 <tr><td>a</td></tr>
25639 <tr><td>-</td></tr>
25640 <tr><td>+</td></tr>
25641 </table>
25642 !! wikitext
25643 {|
25644 |a
25645 |-
25646 | -
25647 |-
25648 | +
25649 |}
25650 !! end
25651
25652 !! test
25653 3a. Table cells with escapable prefixes after edits
25654 !! options
25655 parsoid={
25656 "modes": ["selser"],
25657 "scrubWikitext": true,
25658 "changes": [
25659 [ "table tbody tr:first-child td:first-child", "remove"]
25660 ]
25661 }
25662 !! wikitext
25663 {|
25664 |a||-
25665 |}
25666 !! wikitext/edited
25667 {|
25668 | -
25669 |}
25670 !! end
25671
25672 !! test
25673 3b. Table cells with escapable prefixes after edits
25674 !! options
25675 parsoid={
25676 "modes": ["selser"],
25677 "scrubWikitext": true,
25678 "changes": [
25679 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25680 [ "#x", "remove" ]
25681 ]
25682 }
25683 !! wikitext
25684 {|
25685 |pqr
25686 |<span id="x">foo</span>+
25687 |}
25688 !! wikitext/edited
25689 {|
25690 | -
25691 | +
25692 |}
25693 !! end
25694
25695 # FIXME: This test will fail because
25696 # normalization doesn't realize that the id attribute
25697 # will eliminate the escapable scenario
25698 !! test
25699 4a. Table cells without escapable prefixes after edits
25700 !! options
25701 parsoid={
25702 "modes": ["selser"],
25703 "scrubWikitext": true,
25704 "changes": [
25705 [ "#x", "html", "-" ]
25706 ]
25707 }
25708 !! wikitext
25709 {|
25710 | id="x" |abcd
25711 |}
25712 !! wikitext/edited
25713 {|
25714 | id="x" |-
25715 |}
25716 !! end
25717
25718 ## This tests normalizer's ability to discriminate between
25719 ## cells having identical content.
25720 !! test
25721 4b. Table cells without escapable prefixes after edits
25722 !! options
25723 parsoid={
25724 "modes": ["selser"],
25725 "scrubWikitext": true,
25726 "changes": [
25727 [ "td", "html", "-" ]
25728 ]
25729 }
25730 !! wikitext
25731 {|
25732 |a||b
25733 |}
25734 !! wikitext/edited
25735 {|
25736 | -||-
25737 |}
25738 !! end
25739
25740 ## This tests normalizer's ability to not be tripped by
25741 ## comments (and whitespace)
25742 !! test
25743 4c. Table cells without escapable prefixes after edits
25744 !! options
25745 parsoid={
25746 "modes": ["selser"],
25747 "scrubWikitext": true,
25748 "changes": [
25749 [ "table tbody tr td:first-child", "remove" ]
25750 ]
25751 }
25752 !! wikitext
25753 {|
25754 |-
25755 <!--foo--> |a||-
25756 |}
25757 !! wikitext/edited
25758 {|
25759 |-
25760 <!--foo--> | -
25761 |}
25762 !! end
25763
25764 ## This tests normalizer's ability to handle HTML cells
25765 !! test
25766 4d. Table cells without escapable prefixes after edits
25767 !! options
25768 parsoid={
25769 "modes": ["selser"],
25770 "scrubWikitext": true,
25771 "changes": [
25772 [ "td", "html", "-" ]
25773 ]
25774 }
25775 !! wikitext
25776 <table>
25777 <tr><td>a</td></tr>
25778 </table>
25779 !! wikitext/edited
25780 <table>
25781 <tr><td>-</td></tr>
25782 </table>
25783 !! end
25784
25785 # ---------------------------------------------------
25786 # End of tests spec'ing wikitext serialization norms |
25787 # ---------------------------------------------------
25788
25789 # -----------------------------------------------------------------
25790 # End of section for Parsoid-only html2wt tests for serialization
25791 # of new content
25792 # -----------------------------------------------------------------
25793
25794 # -----------------------------------------------------------------
25795 # The following section of tests are primarily to spec behavior of
25796 # the selective serializer. All these tests have manual selser
25797 # changes. The automated selser changes for all tests handle the
25798 # wide variation of changes, but these tests here capture specs
25799 # deterministically.
25800 # ----------------------------------------------------------------
25801
25802 ## T90517
25803 !! test
25804 Selser: New comments should not be lost
25805 !! options
25806 parsoid={
25807 "modes": ["selser"],
25808 "changes": [
25809 [ "#a", "after", "<!--c1-->" ],
25810 [ "#b", "before", "<!--c2-->" ]
25811 ]
25812 }
25813 !! wikitext
25814 <span id="a">a</span>
25815
25816 <span id="b">b</span>
25817 !! wikitext/edited
25818 <span id="a">a</span><!--c1-->
25819
25820 <!--c2--><span id="b">b</span>
25821 !! end
25822
25823 ## T89383
25824 !! test
25825 Selser: Check for validity of DSR before using it
25826 !! options
25827 parsoid={
25828 "modes": ["selser"],
25829 "changes": [
25830 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
25831 ]
25832 }
25833 !! wikitext
25834 <span id="a">a</span>
25835 !! wikitext/edited
25836 {{DISPLAYTITLE:foo}}
25837 <span id="a">a</span>
25838 !! end
25839
25840 !! test
25841 1. DOMDiff: Changes to <ref> content should be looked up using id
25842 !! options
25843 parsoid={
25844 "modes": ["selser"],
25845 "changes": [
25846 ["#X", "after", "bar"],
25847 ["#Y", "after", "baz"]
25848 ]
25849 }
25850 !! wikitext
25851 X <ref><span id="X">foo</span></ref>
25852 Y <ref name="a" />
25853 <references>
25854 <ref name="a"><span id="Y">foo</span></ref>
25855 </references>
25856 !! wikitext/edited
25857 X <ref><span id="X">foo</span>bar</ref>
25858 Y <ref name="a" />
25859 <references>
25860 <ref name="a"><span id="Y">foo</span>baz</ref>
25861 </references>
25862 !! end
25863
25864 !! test
25865 2. DOMDiff: Changes to <ref> content should be looked up using id
25866 !! options
25867 parsoid={
25868 "modes": ["selser"],
25869 "changes": [
25870 ["#Z", "after", "bar"]
25871 ]
25872 }
25873 !! wikitext
25874 A <ref>foo bar for a</ref>
25875 B <ref group="X" name="b" />
25876
25877 <references />
25878
25879 <references group="X">
25880 <ref name="b"><span id="Z">foo</span></ref>
25881 </references>
25882 !! wikitext/edited
25883 A <ref>foo bar for a</ref>
25884 B <ref group="X" name="b" />
25885
25886 <references />
25887
25888 <references group="X">
25889 <ref name="b"><span id="Z">foo</span>bar</ref>
25890 </references>
25891 !! end