Merge "Move style to mediawiki.special.changeslist.enhanced.css"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
604 !! html
605 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !! end
679
680
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !! end
739
740
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !! end
823
824
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,2+3)
843 !! wikitext
844 '''''foo'''''
845 !! html/*
846 <p><i><b>foo</b></i>
847 </p>
848 !! end
849
850 !! test
851 Italics and bold: 5-quote opening sequence: (5,3)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 '''''foo'''
856 !! html/*
857 <p><i><b>foo</b></i>
858 </p>
859 !!end
860
861 # same html as previous, but wikitext adjusted to match parsoid html2wt
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,3+2)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !! end
870
871 !! test
872 Italics and bold: 5-quote opening sequence: (5,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 '''''foo''''
877 !! html/*
878 <p><i><b>foo'</b></i>
879 </p>
880 !!end
881
882 !! test
883 Italics and bold: 5-quote opening sequence: (5,5)
884 !! wikitext
885 '''''foo'''''
886 !! html
887 <p><i><b>foo</b></i>
888 </p>
889 !!end
890
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,6)
893 !! wikitext
894 '''''foo''''''
895 !! html/*
896 <p><i><b>foo'</b></i>
897 </p>
898 !! end
899
900 ###
901 ### multiple quote sequences in a line
902 ###
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2)
905 !! options
906 parsoid=wt2html
907 !! wikitext
908 ''foo''''bar''
909 !! html/*
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !!end
913
914
915 # same html as previous, but wikitext adjusted to match parsoid html2wt
916 !! test
917 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
918 !! wikitext
919 ''foo'<nowiki/>'''bar'''''
920 !! html
921 <p><i>foo'<b>bar</b></i>
922 </p>
923 !! end
924
925
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 ''foo''''bar'''
932 !! html/*
933 <p><i>foo'<b>bar</b></i>
934 </p>
935 !!end
936
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
941 !! wikitext
942 ''foo'<nowiki/>'''bar'''''
943 !! html
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,4)
951 !! options
952 parsoid=wt2html
953 !! wikitext
954 ''foo''''bar''''
955 !! html/*
956 <p><i>foo'<b>bar'</b></i>
957 </p>
958 !!end
959
960
961 # same html as previous, but wikitext adjusted to match parsoid html2wt
962 !! test
963 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
964 !! wikitext
965 ''foo'<nowiki/>'''bar'<nowiki/>'''''
966 !! html
967 <p><i>foo'<b>bar'</b></i>
968 </p>
969 !! end
970
971
972 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
973 !! test
974 Italics and bold: multiple quote sequences: (3,4,2)
975 !! options
976 parsoid=wt2html
977 !! wikitext
978 '''foo''''bar''
979 !! html/php
980 <p><b>foo'</b>bar
981 </p>
982 !! html/parsoid
983 <p><b>foo'</b>bar<i></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
990 !! options
991 parsoid
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
999 </p>
1000 !! end
1001
1002
1003 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1004 !! test
1005 Italics and bold: multiple quote sequences: (3,4,3)
1006 !! options
1007 parsoid=wt2html
1008 !! wikitext
1009 '''foo''''bar'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b>foo'</b>bar<b></b>
1015 </p>
1016 !!end
1017
1018 # same html as previous, but wikitext adjusted to match parsoid html2wt
1019 !! test
1020 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1021 !! wikitext
1022 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1028 </p>
1029 !! end
1030
1031 ###
1032 ### other quote tests
1033 ###
1034 !! test
1035 Italics and bold: other quote tests: (2,3,5)
1036 !! wikitext
1037 ''this is about '''foo's family'''''
1038 !! html
1039 <p><i>this is about <b>foo's family</b></i>
1040 </p>
1041 !!end
1042
1043
1044 !! test
1045 Italics and bold: other quote tests: (2,(3,3),2)
1046 !! wikitext
1047 ''this is about '''foo's''' family''
1048 !! html
1049 <p><i>this is about <b>foo's</b> family</i>
1050 </p>
1051 !!end
1052
1053
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3,2)
1056 !! options
1057 parsoid=wt2html
1058 !! wikitext
1059 '''this is about ''foo'''s family''
1060 !! html/*
1061 <p><b>this is about <i>foo</i></b><i>s family</i>
1062 </p>
1063 !!end
1064
1065
1066 # same html as previous, but wikitext adjusted to match parsoid html2wt
1067 !! test
1068 Italics and bold: other quote tests: (3,2,3+2+2,2)
1069 !! wikitext
1070 '''this is about ''foo'''''<nowiki/>''s family''
1071 !! html
1072 <p><b>this is about <i>foo</i></b><i>s family</i>
1073 </p>
1074 !! end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (3,2,3,3)
1079 !! wikitext
1080 '''this is about ''foo'''s family'''
1081 !! html/*
1082 <p>'<i>this is about </i>foo<b>s family</b>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,(2,2),3)
1089 !! wikitext
1090 '''this is about ''foo's'' family'''
1091 !! html
1092 <p><b>this is about <i>foo's</i> family</b>
1093 </p>
1094 !!end
1095
1096
1097 !! test
1098 Italicized possessive
1099 !! wikitext
1100 The ''[[Main Page]]'''s talk page.
1101 !! html/php
1102 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1103 </p>
1104 !! html/parsoid
1105 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1106 !! end
1107
1108 !! test
1109 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1110 (Requires tidy for PHP parser output to be fixed up)
1111 !! options
1112 parsoid=wt2html,wt2wt
1113 !! wikitext
1114 {|
1115 !''a!!''b
1116 |''a||''b
1117 |}
1118 !! html/php+tidy
1119 <table>
1120 <tr>
1121 <th><i>a</i></th>
1122 <th><i>b</i></th>
1123 <td><i>a</i></td>
1124 <td><i>b</i></td>
1125 </tr>
1126 </table>
1127 !! html/parsoid
1128 <table>
1129 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1130 <td><i>a</i></td><td><i>b</i></td></tr>
1131 </tbody></table>
1132 !! end
1133
1134 ###
1135 ### Non-html5 tags
1136 ###
1137
1138 !! test
1139 Non-html5 tags should be accepted
1140 !! wikitext
1141 <center>''foo''</center>
1142 <big>''foo''</big>
1143 <font>''foo''</font>
1144 <strike>''foo''</strike>
1145 <tt>''foo''</tt>
1146 !! html
1147 <center><i>foo</i></center>
1148 <p><big><i>foo</i></big>
1149 <font><i>foo</i></font>
1150 <strike><i>foo</i></strike>
1151 <tt><i>foo</i></tt>
1152 </p>
1153 !! end
1154
1155 !! test
1156 <wbr> is valid wikitext (bug 52468)
1157 !! wikitext
1158 <wbr>
1159 !! html
1160 <p><wbr />
1161 </p>
1162 !! end
1163
1164 # <strike> is HTML4, <s> is HTML4/5.
1165 !! test
1166 <s> or <strike> for strikethrough
1167 !! wikitext
1168 <strike>strike</strike>
1169
1170 <s>s</s>
1171 !! html
1172 <p><strike>strike</strike>
1173 </p><p><s>s</s>
1174 </p>
1175 !! end
1176
1177 ## a not permitted
1178 ## i,b,br omitted
1179 !! test
1180 Text-level semantic html elements in wikitext
1181 !! wikitext
1182 <em>text</em>
1183 <strong>text</strong>
1184 <small>text</small>
1185 <s>text</s>
1186 <cite>text</cite>
1187 <q>text</q>
1188 <dfn>text</dfn>
1189 <abbr>text</abbr>
1190 <data>text</data>
1191 <time>text</time>
1192 <code>text</code>
1193 <var>text</var>
1194 <samp>text</samp>
1195 <kbd>text</kbd>
1196 <sub>text</sub>
1197 <u>text</u>
1198 <mark>text</mark>
1199 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1200 <bdi>text</bdi>
1201 <bdo>text</bdo>
1202 <span>text</span>
1203 <wbr />
1204 !! html
1205 <p><em>text</em>
1206 <strong>text</strong>
1207 <small>text</small>
1208 <s>text</s>
1209 <cite>text</cite>
1210 <q>text</q>
1211 <dfn>text</dfn>
1212 <abbr>text</abbr>
1213 <data>text</data>
1214 <time>text</time>
1215 <code>text</code>
1216 <var>text</var>
1217 <samp>text</samp>
1218 <kbd>text</kbd>
1219 <sub>text</sub>
1220 <u>text</u>
1221 <mark>text</mark>
1222 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1223 <bdi>text</bdi>
1224 <bdo>text</bdo>
1225 <span>text</span>
1226 <wbr />
1227 </p>
1228 !! end
1229
1230 # test cases taken from
1231 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1232 !! test
1233 Ruby markup (W3C-style)
1234 !! wikitext
1235 ; Mono-ruby for individual base characters
1236 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1237 ; Group ruby
1238 : <ruby>今日<rt>きょう</rt></ruby>
1239 ; Jukugo ruby
1240 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1241 ; Inline ruby
1242 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1243 ; Double-sided ruby
1244 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1245 <ruby>
1246 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1247 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1248 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1249 </ruby>
1250 !! html
1251 <dl><dt> Mono-ruby for individual base characters</dt>
1252 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1253 <dt> Group ruby</dt>
1254 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1255 <dt> Jukugo ruby</dt>
1256 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1257 <dt> Inline ruby</dt>
1258 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1259 <dt> Double-sided ruby</dt>
1260 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1261 <p><ruby>
1262 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1263 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1264 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1265 </ruby>
1266 </p>
1267 !! end
1268
1269 # The next two test different paths in the sanitizer.
1270 !! test
1271 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1272 !! wikitext
1273 <blockquote|>a</blockquote>
1274
1275 <b→> doesn't terminate </b→>
1276
1277 <bä> doesn't terminate </bä>
1278
1279 <boo> doesn't terminate </boo>
1280
1281 <s.foo> doesn't terminate </s.foo>
1282
1283 <sub-ID#1>
1284 !! html
1285 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1286 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1287 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1288 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1289 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1290 </p><p>&lt;sub-ID#1&gt;
1291 </p>
1292 !! end
1293
1294 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1295 # If the non-word-character tag made it through the sanitizer, tidy
1296 # would munge it up.
1297 !! test
1298 Non-word characters don't terminate tag names + tidy
1299 !! wikitext
1300 <blockquote|>a</blockquote>
1301
1302 <b→> doesn't terminate </b→>
1303
1304 <bä> doesn't terminate </bä>
1305
1306 <boo> doesn't terminate </boo>
1307
1308 <s.foo> doesn't terminate </s.foo>
1309
1310 <sub-ID#1>
1311 !! html+tidy
1312 <p>&lt;blockquote|&gt;a</p>
1313 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1314 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1315 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1316 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1317 <p>&lt;sub-ID#1&gt;</p>
1318 !! end
1319
1320 ###
1321 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1322 ### This checks that HTML5 tags (with non-word characters in the tag
1323 ### name) make it safely through the parser -- the Sanitizer will
1324 ### munge them later, as it should.
1325 ###
1326 !! test
1327 Non-word characters are valid in extension tags (T19663)
1328 !! wikitext
1329 <tåg>tåg</tåg>
1330 !! html/php
1331 <pre>
1332 'tåg'
1333 array (
1334 )
1335 </pre>
1336
1337 !! end
1338
1339 !! test
1340 Isolated close tags should be treated as literal text (bug 52760)
1341 !! options
1342 parsoid=wt2html
1343 !! wikitext
1344 </b>
1345
1346 <s.foo>s</s>
1347 !! html/php+tidy
1348 <p>&lt;s.foo&gt;s</p>
1349 !! html/parsoid
1350 <p>&lt;s.foo&gt;s</p>
1351 !! end
1352
1353 ###
1354 ### Special characters
1355 ###
1356
1357 !! test
1358 Bare pipe character (bug 52363)
1359 !! wikitext
1360 |
1361 !! html
1362 <p>|
1363 </p>
1364 !! end
1365
1366 !! test
1367 Bare pipe character from a template (bug 52363)
1368 !! wikitext
1369 {{pipe}}
1370 !! html
1371 <p>|
1372 </p>
1373 !! end
1374
1375 ###
1376 ### <nowiki> test cases
1377 ###
1378
1379 !! test
1380 <nowiki> unordered list
1381 !! wikitext
1382 <nowiki>* This is not an unordered list item.</nowiki>
1383 !! html/php
1384 <p>* This is not an unordered list item.
1385 </p>
1386 !! html/parsoid
1387 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1388 !! end
1389
1390 !! test
1391 <nowiki> spacing
1392 !! wikitext
1393 <nowiki>Lorem ipsum dolor
1394
1395 sed abit.
1396 sed nullum.
1397
1398 :and a colon
1399 </nowiki>
1400 !! html/php
1401 <p>Lorem ipsum dolor
1402
1403 sed abit.
1404 sed nullum.
1405
1406 :and a colon
1407
1408 </p>
1409 !! html/parsoid
1410 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </span></p>
1417 !! end
1418
1419 !! test
1420 nowiki 3
1421 !! wikitext
1422 :There is not nowiki.
1423 :There is <nowiki>nowiki</nowiki>.
1424
1425 #There is not nowiki.
1426 #There is <nowiki>nowiki</nowiki>.
1427
1428 *There is not nowiki.
1429 *There is <nowiki>nowiki</nowiki>.
1430 !! html/php
1431 <dl><dd>There is not nowiki.</dd>
1432 <dd>There is nowiki.</dd></dl>
1433 <ol><li>There is not nowiki.</li>
1434 <li>There is nowiki.</li></ol>
1435 <ul><li>There is not nowiki.</li>
1436 <li>There is nowiki.</li></ul>
1437
1438 !! html/parsoid
1439 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1440 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1441
1442 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1443 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1444
1445 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1447 !! end
1448
1449 !! test
1450 Entities inside <nowiki>
1451 !! wikitext
1452 <nowiki>&lt;</nowiki>
1453 !! html
1454 <p>&lt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 Entities inside template parameters
1460 !! wikitext
1461 {{echo|&ndash;}}
1462 !! html/php+tidy
1463 <p>–</p>
1464 !! html/parsoid
1465 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1466 !! end
1467
1468 !! test
1469 Properly escape nowiki when combined with other wiki markup
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <p>* &lt;/nowiki&gt; tag</p>
1474 !! wikitext
1475 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1476 !! end
1477
1478 !! test
1479 T93824: Put escaped HTML tags inside nowiki
1480 !! options
1481 parsoid=html2wt
1482 !! html/parsoid
1483 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1484 !! wikitext
1485 <nowiki><h2>foo</h2></nowiki>
1486 !! end
1487
1488 !! test
1489 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1490 !! options
1491 parsoid=html2wt
1492 !! html/parsoid
1493 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1494 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1495 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1496 !! wikitext
1497 This text: L'[[Foo]]
1498 This text: L<nowiki>''</nowiki>[[Foo]]
1499 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1500 !! end
1501
1502 # This test fails because wikitext whitespace is not normalized before comparing.
1503 !! test
1504 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1505 !! options
1506 parsoid=html2wt
1507 !! html/parsoid
1508 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1509 </p>
1510 !! wikitext
1511 This text : L<nowiki>''</nowiki>[[Foo]]
1512 !! end
1513
1514 # This test and the next one are html2wt only as they test that incorrect wikitext
1515 # passed in template arguments gets escaped or wrapped in nowikis where required.
1516 !! test
1517 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1522 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1523 !! wikitext
1524 {{echo|foo{{!}}bar}}
1525 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1526 !! end
1527
1528 !! test
1529 T53961: Output correct nowikis in template arguments
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1534 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1535 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1536 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1538 !! wikitext
1539 {{echo|a [ b}}
1540 {{echo|a <nowiki>}}</nowiki> b}}
1541 {{echo|<nowiki>a [[ b</nowiki>}}
1542 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1543 {{echo|a <nowiki>}</nowiki>}}
1544 !! end
1545
1546 !! test
1547 Cases where "!!" needs nowiki protection
1548 !! options
1549 parsoid=html2wt
1550 !! html/parsoid
1551 <table>
1552 <tr><th>this needs protection !! here</th></tr>
1553 </table>
1554
1555 <table>
1556 <tr><th>this does not need
1557 protection !! here</th></tr>
1558 </table>
1559 !! wikitext
1560 {|
1561 !<nowiki>this needs protection !! here</nowiki>
1562 |}
1563
1564 {|
1565 !this does not need
1566 protection !! here
1567 |}
1568 !! end
1569
1570 ###
1571 ### Comments
1572 ###
1573 !! test
1574 Comments and Indent-Pre
1575 !! wikitext
1576 <!-- comment 1 --> asdf
1577
1578 <!-- comment 1 --> asdf
1579 <!-- comment 2 -->
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->xyz
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 --> xyz
1586 !! html
1587 <pre>asdf
1588 </pre>
1589 <pre>asdf
1590 </pre>
1591 <pre>asdf
1592 </pre>
1593 <p>xyz
1594 </p>
1595 <pre>asdf
1596 xyz
1597 </pre>
1598 !! end
1599
1600 !! test
1601 Comment test 2a
1602 !! wikitext
1603 asdf
1604 <!-- comment 1 -->
1605 jkl
1606 !! html
1607 <p>asdf
1608 jkl
1609 </p>
1610 !! end
1611
1612 !! test
1613 Comment test 2b
1614 !! wikitext
1615 asdf
1616 <!-- comment 1 -->
1617
1618 jkl
1619 !! html
1620 <p>asdf
1621 </p><p>jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 3
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630 <!-- comment 2 -->
1631 jkl
1632 !! html
1633 <p>asdf
1634 jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 4
1640 !! wikitext
1641 asdf<!-- comment 1 -->jkl
1642 !! html
1643 <p>asdfjkl
1644 </p>
1645 !! end
1646
1647 !! test
1648 Comment spacing
1649 !! wikitext
1650 a
1651 <!-- foo --> b <!-- bar -->
1652 c
1653 !! html
1654 <p>a
1655 </p>
1656 <pre> b
1657 </pre>
1658 <p>c
1659 </p>
1660 !! end
1661
1662 !! test
1663 Comment whitespace
1664 !! wikitext
1665 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1666 !! html
1667
1668 !! end
1669
1670 !! test
1671 Comment semantics and delimiters
1672 !! wikitext
1673 <!-- --><!----><!-----><!------>
1674 !! html/php
1675
1676 !! html/parsoid
1677 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1678 !! end
1679
1680 !! test
1681 Comment semantics and delimiters, redux
1682 !! wikitext
1683 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1684 -- foo -- funky huh? ... -->
1685 !! html/php
1686
1687 !! html/parsoid
1688 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1689 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1690 !! end
1691
1692 !! test
1693 Comment semantics and delimiters: directors cut
1694 !! wikitext
1695 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1696 everything starting with < followed by !-- until the first -- and > we see,
1697 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1698 -->-->
1699 !! html/php
1700 <p>--&gt;
1701 </p>
1702 !! html/parsoid
1703 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1704 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1705 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1706 --><p>--></p>
1707 !! end
1708
1709 !! test
1710 Comment semantics: nesting
1711 !! wikitext
1712 <!--<!-- no, we're not going to do anything fancy here -->-->
1713 !! html/php
1714 <p>--&gt;
1715 </p>
1716 !! html/parsoid
1717 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1718 !! end
1719
1720 # Parsoid closes the unclosed comment, even if it means a slight
1721 # round-trip diff.
1722 !! test
1723 Comment semantics: unclosed comment at end
1724 !! options
1725 parsoid=wt2html,html2html
1726 !! wikitext
1727 <!--This comment will run out to the end of the document
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!--This comment will run out to the end of the document-->
1732 !! end
1733
1734 !! test
1735 Comment semantics: normalize comments to play nice with XML and browsers
1736 !! wikitext
1737 <!-- Browsers --!> think this is closed -->
1738 <!--> This would normally be text -->
1739 <!---> As would this -->
1740 <!-- XML doesn't like trailing dashes -------->
1741 <!-- Nor doubled hyphens -- anywhere in the data -->
1742 But this is not a comment.
1743 !! html/php
1744 <p>But this is not a comment.
1745 </p>
1746 !! html/parsoid
1747 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1748 <!--&#x3E; This would normally be text -->
1749 <!--&#x2D;&#x3E; As would this -->
1750 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1751 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1752 <p>But this is not a comment.</p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: round-trip even text which contains encoded -->
1757 !! wikitext
1758 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1759 !! html/parsoid
1760 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1761 !! end
1762
1763 !! test
1764 Comment in template title
1765 !! wikitext
1766 {{f<!---->oo}}
1767 !! html
1768 <p>FOO
1769 </p>
1770 !! end
1771
1772 !! test
1773 Comment on its own line post-expand
1774 !! wikitext
1775 a
1776 {{blank}}<!---->
1777 b
1778 !! html
1779 <p>a
1780 </p><p>b
1781 </p>
1782 !! end
1783
1784 !! test
1785 Comment on its own line post-expand with non-significant whitespace
1786 !! wikitext
1787 a
1788 {{blank}} <!---->
1789 b
1790 !! html
1791 <p>a
1792 </p><p>b
1793 </p>
1794 !! end
1795
1796 !! test
1797 Multiple comments should still parse as SOL-transparent
1798 !! options
1799 parsoid=wt2html,wt2wt
1800 !! wikitext
1801 <!--c1-->*a
1802 <!--c2--><!--c3--><!--c4-->*b
1803 !! html/php
1804 <ul><li>a</li>
1805 <li>b</li></ul>
1806
1807 !! html/parsoid
1808 <!--c1--><ul>
1809 <li>a
1810 </li>
1811 <!--c2--><!--c3--><!--c4-->
1812 <li>b
1813 </li>
1814 </ul>
1815 !! end
1816
1817 ###
1818 ### paragraph wrapping tests
1819 ###
1820 !! test
1821 No block tags
1822 !! wikitext
1823 a
1824
1825 b
1826 !! html
1827 <p>a
1828 </p><p>b
1829 </p>
1830 !! end
1831
1832 !! test
1833 Block tag on one line (<div>)
1834 !! wikitext
1835 a <div>foo</div>
1836
1837 b
1838 !! html
1839 a <div>foo</div>
1840 <p>b
1841 </p>
1842 !! html+tidy
1843 <p>a</p>
1844 <div>foo</div>
1845 <p>b</p>
1846 !! end
1847
1848 !! test
1849 Block tag on one line (<blockquote>)
1850 !! wikitext
1851 a <blockquote>foo</blockquote>
1852
1853 b
1854 !! html
1855 a <blockquote>foo</blockquote>
1856 <p>b
1857 </p>
1858 !! html+tidy
1859 <p>a</p>
1860 <blockquote>
1861 <p>foo</p>
1862 </blockquote>
1863 <p>b</p>
1864 !! end
1865
1866 !! test
1867 Block tag on both lines (<div>)
1868 !! wikitext
1869 a <div>foo</div>
1870
1871 b <div>foo</div>
1872 !! html
1873 a <div>foo</div>
1874 b <div>foo</div>
1875
1876 !! html+tidy
1877 <p>a</p>
1878 <div>foo</div>
1879 <p>b</p>
1880 <div>foo</div>
1881 !! end
1882
1883 !! test
1884 Block tag on both lines (<blockquote>)
1885 !! wikitext
1886 a <blockquote>foo</blockquote>
1887
1888 b <blockquote>foo</blockquote>
1889 !! html
1890 a <blockquote>foo</blockquote>
1891 b <blockquote>foo</blockquote>
1892
1893 !! html+tidy
1894 <p>a</p>
1895 <blockquote>
1896 <p>foo</p>
1897 </blockquote>
1898 <p>b</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 !! end
1903
1904 !! test
1905 Multiple lines without block tags
1906 !! wikitext
1907 <div>foo</div> a
1908 b
1909 c
1910 d<!--foo--> e
1911 x <div>foo</div> z
1912 !! html
1913 <div>foo</div> a
1914 <p>b
1915 c
1916 d e
1917 </p>
1918 x <div>foo</div> z
1919
1920 !! html+tidy
1921 <div>foo</div>
1922 <p>a</p>
1923 <p>b c d e</p>
1924 <p>x</p>
1925 <div>foo</div>
1926 <p>z</p>
1927 !! end
1928
1929 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1930 # So, we have a separate section for Parsoid. We don't want
1931 # to mimic this stripping behavior in Parsoid. It affects
1932 # editing experience and also requires us to maintain additional
1933 # info for RT-ing.
1934 !! test
1935 Empty lines between lines with block tags
1936 !! wikitext
1937 <div></div>
1938
1939
1940 <div></div>a
1941
1942 b
1943 <div>a</div>b
1944
1945 <div>b</div>d
1946
1947
1948 <div>e</div>
1949 !! html
1950 <div></div>
1951 <p><br />
1952 </p>
1953 <div></div>a
1954 <p>b
1955 </p>
1956 <div>a</div>b
1957 <div>b</div>d
1958 <p><br />
1959 </p>
1960 <div>e</div>
1961
1962 !! html+tidy
1963 <p><br /></p>
1964 <p>a</p>
1965 <p>b</p>
1966 <div>a</div>
1967 <p>b</p>
1968 <div>b</div>
1969 <p>d</p>
1970 <p><br /></p>
1971 <div>e</div>
1972 !! html/parsoid
1973 <div data-parsoid='{"stx":"html"}'></div>
1974
1975 <p><br /></p>
1976 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1977
1978 <p>b</p>
1979 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1980
1981 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1982
1983 <p><br /></p>
1984 <div data-parsoid='{"stx":"html"}'>e</div>
1985 !! end
1986
1987 ## PHP parser emits output which is broken
1988 !! test
1989 Unclosed HTML p-tags should be handled properly
1990 !! wikitext
1991 <div><p>foo</div>
1992 a
1993
1994 b
1995 !! html/php+tidy
1996 <div>
1997 <p>foo</p>
1998 </div>
1999 <p>a</p>
2000 <p>b</p>
2001 !! html/parsoid
2002 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! end
2006
2007 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2008 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2009 ## them for now.
2010 !! test
2011 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2012 !! options
2013 parsoid=wt2html
2014 !! wikitext
2015 a [[Category:A1]] [[Category:A2]]
2016 [[Category:A3]]
2017 [[Category:A4]]
2018 !! html/parsoid
2019 <p>a</p>
2020 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2021 !! end
2022
2023 !! test
2024 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 [[Category:A1]]a
2029 !! html/parsoid
2030 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2031 !! end
2032
2033 ###
2034 ### Preformatted text
2035 ###
2036 !! test
2037 Preformatted text
2038 !! wikitext
2039 This is some
2040 Preformatted text
2041 With ''italic''
2042 And '''bold'''
2043 And a [[Main Page|link]]
2044 !! html
2045 <pre>This is some
2046 Preformatted text
2047 With <i>italic</i>
2048 And <b>bold</b>
2049 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2050 </pre>
2051 !! end
2052
2053 !! test
2054 Tabs don't trigger preformatted text
2055 !! wikitext
2056 This is not
2057 preformatted text.
2058 This is preformatted text.
2059 So is this.
2060 !! html/php
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! html/parsoid
2068 <p> This is not
2069 preformatted text.</p>
2070 <pre>This is preformatted text.
2071 So is this.</pre>
2072 !! end
2073
2074 !! test
2075 Space before tab needs nowiki pre protection
2076 !! options
2077 parsoid=html2wt
2078 !! html/parsoid
2079 <p> a</p>
2080 !! wikitext
2081 <nowiki> </nowiki> a
2082 !! end
2083
2084 !! test
2085 Ident preformatting with inline content
2086 !! wikitext
2087 a
2088 ''b''
2089 !! html
2090 <pre>a
2091 <i>b</i>
2092 </pre>
2093 !! end
2094
2095 !! test
2096 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2097 !! wikitext
2098 <pre><nowiki>
2099 <b>
2100 <cite>
2101 <em>
2102 </nowiki></pre>
2103 !! html
2104 <pre>
2105 &lt;b&gt;
2106 &lt;cite&gt;
2107 &lt;em&gt;
2108 </pre>
2109
2110 !! end
2111
2112 !! test
2113 Regression with preformatted in <center>
2114 !! wikitext
2115 <center>
2116 Blah
2117 </center>
2118 !! html
2119 <center>
2120 <pre>Blah
2121 </pre>
2122 </center>
2123
2124 !! end
2125
2126 !! test
2127 Bug 52763: Preformatted in <blockquote>
2128 !! wikitext
2129 <blockquote>
2130 Blah
2131 {|
2132 |
2133 indented cell (no pre-wrapping!)
2134 |}
2135 </blockquote>
2136 !! html
2137 <blockquote>
2138 <p> Blah
2139 </p>
2140 <table>
2141 <tr>
2142 <td>
2143 <p> indented cell (no pre-wrapping!)
2144 </p>
2145 </td></tr></table>
2146 </blockquote>
2147
2148 !! end
2149
2150 !! test
2151 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2152 !! wikitext
2153 <blockquote>
2154 Foo
2155
2156 Bar
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo
2161 </p><p>Bar
2162 </p>
2163 </blockquote>
2164
2165 !! end
2166
2167 !! test
2168 Bug 15491: <ins>/<del> in blockquote
2169 !! wikitext
2170 <blockquote>
2171 Foo <del>bar</del> <ins>baz</ins> quux
2172 </blockquote>
2173 !! html
2174 <blockquote>
2175 <p>Foo <del>bar</del> <ins>baz</ins> quux
2176 </p>
2177 </blockquote>
2178
2179 !! end
2180
2181 # Note that the p-wrapping is newline sensitive, which could be
2182 # considered a bug: tidy will wrap only the 'Foo' in the example
2183 # below in a <p> tag. (see comment 23-25 of bug #6200)
2184 !! test
2185 Bug 15491: <ins>/<del> in blockquote (2)
2186 !! wikitext
2187 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2188 </blockquote>
2189 !! html
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192
2193 !! html+tidy
2194 <blockquote>
2195 <p>Foo</p>
2196 <del>bar</del> <ins>baz</ins> quux</blockquote>
2197 !! end
2198
2199 !! test
2200 <pre> with attributes (bug 3202)
2201 !! wikitext
2202 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2203 !! html
2204 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2205
2206 !! end
2207
2208 !! test
2209 <pre> with width attribute (bug 3202)
2210 !! wikitext
2211 <pre width="8">Narrow screen goodies</pre>
2212 !! html
2213 <pre width="8">Narrow screen goodies</pre>
2214
2215 !! end
2216
2217 !! test
2218 <pre> with forbidden attribute (bug 3202)
2219 !! wikitext
2220 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2221 !! html
2222 <pre width="8">Narrow screen goodies</pre>
2223
2224 !! end
2225
2226 !! test
2227 Entities inside <pre>
2228 !! wikitext
2229 <pre>&lt;</pre>
2230 !! html
2231 <pre>&lt;</pre>
2232
2233 !! end
2234
2235 !! test
2236 <pre> with forbidden attribute values (bug 3202)
2237 !! wikitext
2238 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2239 !! html
2240 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2241
2242 !! end
2243
2244 !! test
2245 <nowiki> inside <pre> (bug 13238)
2246 !! wikitext
2247 <pre>
2248 <nowiki>
2249 </pre>
2250 <pre>
2251 <nowiki></nowiki>
2252 </pre>
2253 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2254 !! html
2255 <pre>
2256 &lt;nowiki&gt;
2257 </pre>
2258 <pre>
2259
2260 </pre>
2261 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2262
2263 !! end
2264
2265 !! test
2266 <nowiki> and <pre> preference (first one wins)
2267 !! wikitext
2268 <pre>
2269 <nowiki>
2270 </pre>
2271 </nowiki>
2272 </pre>
2273
2274 <nowiki>
2275 <pre>
2276 <nowiki>
2277 </pre>
2278 </nowiki>
2279 </pre>
2280
2281 !! html/php
2282 <pre>
2283 &lt;nowiki&gt;
2284 </pre>
2285 <p>&lt;/nowiki&gt;
2286 &lt;/pre&gt;
2287 </p><p>
2288 &lt;pre&gt;
2289 &lt;nowiki&gt;
2290 &lt;/pre&gt;
2291
2292 &lt;/pre&gt;
2293 </p>
2294 !! html/parsoid
2295 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2296 </pre>
2297 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2298 &lt;/pre></p>
2299
2300 <p><span typeof="mw:Nowiki">
2301 &lt;pre>
2302 &lt;nowiki>
2303 &lt;/pre>
2304 </span>
2305 &lt;/pre></p>
2306 !! end
2307
2308 !! test
2309 </pre> inside nowiki
2310 !! wikitext
2311 <nowiki></pre></nowiki>
2312 !! html
2313 <p>&lt;/pre&gt;
2314 </p>
2315 !! end
2316
2317 # Parsoid doesn't strip empty tags, like Tidy does.
2318 !! test
2319 Empty pre; pre inside other HTML tags (bug 54946)
2320 !! options
2321 parsoid=wt2html,wt2wt
2322 !! wikitext
2323 a
2324
2325 <div><pre>
2326 foo
2327 </pre></div>
2328 <pre></pre>
2329 !! html/php
2330 <p>a
2331 </p>
2332 <div><pre>
2333 foo
2334 </pre></div>
2335 <pre></pre>
2336
2337 !! html/php+tidy
2338 <p>a</p>
2339 <div>
2340 <pre>
2341 foo
2342 </pre></div>
2343 !! html/parsoid
2344 <p>a</p>
2345
2346 <div><pre>foo
2347 </pre></div>
2348 <pre></pre>
2349 !! end
2350
2351 !! test
2352 HTML pre followed by indent-pre
2353 !! wikitext
2354 <pre>foo</pre>
2355 bar
2356 !! html
2357 <pre>foo</pre>
2358 <pre>bar
2359 </pre>
2360 !! end
2361
2362 # Note that tidy removes the empty <p> tags from the start and end.
2363 # Parsoid does not, by design.
2364 !!test
2365 Block tag pre
2366 !! wikitext
2367 <p><pre>foo</pre></p>
2368 !! html/php+tidy
2369 <pre>
2370 foo
2371 </pre>
2372 !! html/parsoid
2373 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2374 !!end
2375
2376 !!test
2377 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2378 !! wikitext
2379 {{echo|}}
2380 !! html
2381
2382 !!end
2383
2384 !!test
2385 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2386 !! wikitext
2387 {{echo|
2388 foo}}
2389 !! html
2390 <p>foo
2391 </p>
2392 !!end
2393
2394 !! test
2395 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2396 !! wikitext
2397 {{echo|a
2398 b}}
2399 !! html
2400 <pre>a
2401 </pre>
2402 <p>b
2403 </p>
2404 !!end
2405
2406 !! test
2407 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2408 !! wikitext
2409 {{echo|a
2410 b
2411 c
2412 d
2413 e
2414 }}
2415 !! html
2416 <pre>a
2417 </pre>
2418 <p>b
2419 c
2420 </p>
2421 <pre>d
2422 </pre>
2423 <p>e
2424 </p>
2425 !!end
2426
2427 !!test
2428 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2429 !! wikitext
2430 {{echo| foo}}
2431
2432 {{echo| foo}}{{echo| bar}}
2433
2434 {{echo| foo}}
2435 {{echo| bar}}
2436
2437 {{echo|<!--cmt--> foo}}
2438
2439 <!--cmt-->{{echo| foo}}
2440
2441 {{echo|{{echo| }}bar}}
2442 !! html
2443 <pre>foo
2444 </pre>
2445 <pre>foo bar
2446 </pre>
2447 <pre>foo
2448 bar
2449 </pre>
2450 <pre>foo
2451 </pre>
2452 <pre>foo
2453 </pre>
2454 <pre>bar
2455 </pre>
2456 !!end
2457
2458 !! test
2459 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2460 !! wikitext
2461 {{echo| }}a
2462
2463 {{echo|
2464 }}a
2465
2466 {{echo|
2467 b}}
2468
2469 {{echo|a
2470 }}b
2471
2472 {{echo|a
2473 }} b
2474 !! html
2475 <pre>a
2476 </pre>
2477 <p><br />
2478 </p>
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>b
2484 </pre>
2485 <p>a
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 !!end
2494
2495 !! test
2496 Pres with newline attributes
2497 !! wikitext
2498 <pre class="one
2499 two">hi</pre>
2500 !! html/php
2501 <pre class="one two">hi</pre>
2502
2503 !! html/parsoid
2504 <pre class="one
2505 two" data-parsoid='{"stx":"html"}'>hi</pre>
2506 !! end
2507
2508 !! test
2509 Things that look like <pre> tags aren't treated as such
2510 !! wikitext
2511 Barack Obama <President> of the United States
2512 <President></President>
2513 !! html
2514 <p>Barack Obama &lt;President&gt; of the United States
2515 &lt;President&gt;&lt;/President&gt;
2516 </p>
2517 !! end
2518
2519 ## PHP parser discards the "<pre " string
2520 !! test
2521 Handle broken pre-like tags (bug 64025)
2522 !! options
2523 parsoid=wt2html
2524 !! wikitext
2525 {{echo|<pre <pre>x</pre>}}
2526
2527 <table><pre </table>
2528 !! html/php
2529 <pre>x</pre>
2530 <table><pre></pre></table>
2531
2532 !! html/parsoid
2533 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2534
2535
2536 <p>&lt;pre </p>
2537
2538 <table></table>
2539 !! end
2540
2541 !! test
2542 Parsoid: handle pre with space after attribute
2543 !! options
2544 parsoid=wt2html
2545 !! wikitext
2546 <pre style="width:50%;" >{{echo|foo}}</pre>
2547 !! html/php
2548 <pre style="width:50%;">{{echo|foo}}</pre>
2549
2550 !! html/parsoid
2551 <pre style="width:50%;">{{echo|foo}}</pre>
2552 !! end
2553
2554 # TODO / maybe: fix wt2wt for this
2555 !! test
2556 Parsoid: Don't paragraph-wrap fosterable content
2557 !! options
2558 parsoid=wt2html
2559 !! wikitext
2560 {|
2561 <td></td>
2562 <td></td>
2563
2564
2565
2566 |}
2567 !! html
2568 <table>
2569
2570 <tbody>
2571 <tr>
2572 <td></td>
2573
2574 <td></td></tr>
2575
2576
2577
2578 </tbody></table>
2579 !! end
2580
2581 !! test
2582 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2583 !! options
2584 parsoid=wt2html
2585 !! wikitext
2586 {|
2587 <td>
2588 <td>
2589 </td>
2590
2591
2592
2593 |}
2594 !! html
2595 <table>
2596
2597 <tbody>
2598 <tr>
2599 <td></td>
2600
2601 <td>
2602 </td></tr>
2603
2604
2605
2606 </tbody></table>
2607 !! end
2608
2609
2610 #--------------------------------------------------------------------
2611 # Transclusion parameter whitespace stripping tests
2612 # Behavior is different for positional and named parameters
2613 #--------------------------------------------------------------------
2614 !! test
2615 Templates: Strip leading and trailing whitespace from named-param values
2616 !! wikitext
2617 {{echo|1= a }}
2618
2619 {{echo|1= {{echo|b}} }}
2620
2621 {{echo| 1 =
2622 c }}
2623
2624 {{echo| 1 =
2625 * d
2626 }}
2627 !! html
2628 <p>a
2629 </p><p>b
2630 </p><p>c
2631 </p>
2632 <ul><li> d</li></ul>
2633
2634 !! end
2635
2636 !! test
2637 Templates: Don't strip whitespace from positional-param values
2638 !! wikitext
2639 {{echo|a }}
2640
2641 {{echo|{{echo|b}} }}
2642
2643 {{echo| c
2644 }}
2645
2646 {{echo| {{echo|d}}
2647 }}
2648
2649 {{echo|
2650 e}}
2651
2652 {{echo|
2653 * f}}
2654
2655 {{echo|
2656 }}g
2657 !! html
2658 <p>a
2659 </p><p>b
2660 </p>
2661 <pre>c
2662 </pre>
2663 <p><br />
2664 </p>
2665 <pre>d
2666 </pre>
2667 <p><br />
2668 </p>
2669 <pre>e
2670 </pre>
2671 <p><br />
2672 </p>
2673 <ul><li> f</li></ul>
2674 <p><br />
2675 </p>
2676 <pre>g
2677 </pre>
2678 !! end
2679
2680 !! test
2681 Templates: Handle empty comment-and-ws-only lines correctly
2682 !! wikitext
2683 {{echo|foo
2684 <!--should be ignored-->
2685 <!--should be ignored as well-->
2686 bar}}
2687 !! html
2688 <p>foo
2689 bar
2690 </p>
2691 !! end
2692
2693 !! test
2694 Templates: Handle comments in the target
2695 !! wikitext
2696 {{echo
2697 <!-- should be ignored -->
2698 |foo}}
2699
2700 {{echo<!-- should be ignored -->
2701 |foo}}
2702
2703 {{echo<!-- should be ignored -->|foo}}
2704
2705 {{<!-- should be ignored -->echo|foo}}
2706 !!html/parsoid
2707 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2708
2709 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2710
2711 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2712
2713 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2714 !!end
2715
2716 !! test
2717 Templates: Handle comments in parameter names (bug 67657)
2718 !! wikitext
2719 {{echo|1
2720 <!-- should be ignored -->
2721 =foo}}
2722
2723 {{echo|
2724 <!-- should be ignored -->
2725 1 = foo}}
2726
2727 {{echo|1<!-- should be ignored --> = foo}}
2728
2729 {{echo|<!-- should be ignored -->1 = foo}}
2730 !!html/parsoid
2731 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2732
2733 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2734
2735 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2736
2737 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2738 !!end
2739
2740 !! test
2741 Templates: Other wikitext in parameter names (bug 67657)
2742 !! wikitext
2743 {{echo|''1''=foo}}
2744 !!html/parsoid
2745 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2746 !!html/php
2747 <p>{{{1}}}
2748 </p>
2749 !!end
2750
2751 #--------------------------------------------------------------------
2752 # Transclusion parameter escaping tests
2753 #--------------------------------------------------------------------
2754 !! test
2755 Templates: Parsoid parameter escaping test 1
2756 !! wikitext
2757 {{echo|[foo]|{{echo|[bar]}}}}
2758 !! html/php+tidy
2759 <p>[foo]</p>
2760 !! html/parsoid
2761 <p about="#mwt1" typeof="mw:Transclusion"
2762 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2763 !! end
2764
2765 !! test
2766 Parsoid: Pipes in external links in template parameter
2767 !! wikitext
2768 {{echo|[{{echo|http://example.com}} link]}}
2769 !! html/php+tidy
2770 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2771 !! html/parsoid
2772 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2773 !! end
2774
2775 !! test
2776 Parsoid: pipe in transclusion parameter
2777 !! wikitext
2778 {{echo|http://foo.com/a&#124;b}}
2779 !! html/php+tidy
2780 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2781 !! html/parsoid
2782 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2783 typeof="mw:Transclusion"
2784 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in external link target and content in template parameter
2789 !! options
2790 parsoid=html2wt,wt2wt
2791 !! wikitext
2792 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2793 !! html/php+tidy
2794 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2795 !! html/parsoid
2796 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2797 typeof="mw:Transclusion"
2798 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2799 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2800 !! end
2801
2802 !! test
2803 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2804 !! options
2805 parsoid
2806 !! wikitext
2807 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2808 !! html
2809 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2810 !! end
2811
2812 !! test
2813 Templates: Don't escape already nowiki-escaped text in template parameters
2814 !! options
2815 parsoid=html2wt,wt2wt
2816 !! wikitext
2817 {{echo|foo<nowiki>|</nowiki>bar}}
2818 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2819 {{echo|<nowiki></nowiki>}}
2820 !! html/php+tidy
2821 <p>foo|bar &lt;div&gt;</p>
2822 !! html/parsoid
2823 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2824 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2825 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2826 </p>
2827 !! end
2828
2829 ## Bug 52824
2830 !! test
2831 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|{{echo|1=bar}}}}
2836 !! html/php+tidy
2837 <p>bar</p>
2838 !! html/parsoid
2839 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2840 !! end
2841
2842 ## Bug 56733
2843 !! test
2844 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2845 !! wikitext
2846 {{echo|a : b}}
2847 !! html/php+tidy
2848 <p>a&#160;: b</p>
2849 !! html/parsoid
2850 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2851 !! end
2852
2853 ## Bug T73412
2854 !! test
2855 Templates: Preserve blank parameter names
2856 !! wikitext
2857 {{echo|=foo}}
2858 !! html/php+tidy
2859 <p>{{{1}}}</p>
2860 !! html/parsoid
2861 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2862 !! end
2863
2864 !! test
2865 Templates: Preserve blank parameter names in other positions
2866 !! wikitext
2867 {{blank_param|bar|=foo}}
2868 !! html/php+tidy
2869 <p>bar foo</p>
2870 !! html/parsoid
2871 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2872 foo</p>
2873 !! end
2874
2875 ###
2876 ### Parsoid-centric tests for testing RT edge cases for pre
2877 ###
2878
2879 !!test
2880 1a. Indent-Pre and Comments
2881 !! wikitext
2882 a
2883 <!--a-->
2884 c
2885 !! html
2886 <pre>a
2887 </pre>
2888 <p>c
2889 </p>
2890 !!end
2891
2892 !!test
2893 1b. Indent-Pre and Comments
2894 !! wikitext
2895 a
2896 <!--a-->
2897 c
2898 !! html
2899 <pre>a
2900 </pre>
2901 <p>c
2902 </p>
2903 !!end
2904
2905 !!test
2906 1c. Indent-Pre and Comments
2907 !! wikitext
2908 <!--a--> a
2909
2910 <!--a--> a
2911 !! html
2912 <pre> a
2913 </pre>
2914 <pre> a
2915 </pre>
2916 !!end
2917
2918 !!test
2919 1d. Indent-Pre and Comments
2920 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2921 !! wikitext
2922 <!--a--> a
2923
2924 <!--b-->b
2925 !! html
2926 <pre>a
2927 </pre>
2928 <pre>b
2929 </pre>
2930 !!end
2931
2932 !!test
2933 2a. Indent-Pre and tables
2934 !! wikitext
2935 {|
2936 |-
2937 !h1!!h2
2938 |foo||bar
2939 |}
2940 !! html
2941 <table>
2942
2943 <tr>
2944 <th>h1</th>
2945 <th>h2
2946 </th>
2947 <td>foo</td>
2948 <td>bar
2949 </td></tr></table>
2950
2951 !!end
2952
2953 !!test
2954 2b. Indent-Pre and tables
2955 !! wikitext
2956 {|
2957 |-
2958 |foo
2959 |}
2960 !! html
2961 <table>
2962
2963 <tr>
2964 <td>foo
2965 </td></tr></table>
2966
2967 !!end
2968
2969 !!test
2970 2c. Indent-Pre and tables (bug 42252)
2971 !! wikitext
2972 {|
2973 |+ foo
2974 ! | bar
2975 |}
2976 !! html
2977 <table>
2978 <caption> foo
2979 </caption>
2980 <tr>
2981 <th> bar
2982 </th></tr></table>
2983
2984 !!end
2985
2986 !!test
2987 2d. Indent-Pre and tables
2988 !! wikitext
2989 a
2990 {|
2991 | b
2992 |}
2993 !! html/php
2994 <pre>a
2995 </pre>
2996 <table>
2997 <tr>
2998 <td> b
2999 </td></tr></table>
3000
3001 !! html/parsoid
3002 <pre>a</pre>
3003 <table>
3004 <tbody><tr><td> b</td></tr>
3005 </tbody></table>
3006 !!end
3007
3008 !!test
3009 2e. Indent-Pre and table-line syntax
3010 !! wikitext
3011 a
3012 | b
3013 | c
3014 !! html/php
3015 <pre>a
3016 | b
3017 | c
3018 </pre>
3019 !!end
3020
3021 !!test
3022 2f. Indent-pre started by table-line syntax
3023 !! wikitext
3024 a
3025 | b
3026 | c
3027 !! html/php
3028 <p>a
3029 </p>
3030 <pre>| b
3031 | c
3032 </pre>
3033 !! html/parsoid
3034 <p>a</p>
3035 <pre>
3036 | b
3037 | c</pre>
3038 !!end
3039
3040 !!test
3041 3a. Indent-Pre and block tags (single-line html)
3042 !! wikitext
3043 a <p> foo </p>
3044 b <div> foo </div>
3045 c <blockquote> foo </blockquote>
3046 <span> foo </span>
3047 !! html
3048 a <p> foo </p>
3049 b <div> foo </div>
3050 c <blockquote> foo </blockquote>
3051 <pre><span> foo </span>
3052 </pre>
3053 !! html/parsoid
3054 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3055 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3056 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3057 <pre><span> foo </span>
3058 </pre>
3059 !! html+tidy
3060 <p>a</p>
3061 <p>foo</p>
3062 <p>b</p>
3063 <div>foo</div>
3064 <p>c</p>
3065 <blockquote>
3066 <p>foo</p>
3067 </blockquote>
3068 <pre>
3069 <span> foo </span>
3070 </pre>
3071 !! end
3072
3073 !!test
3074 3b. Indent-Pre and block tags (multi-line html)
3075 !! wikitext
3076 a <span>foo</span>
3077 b <div> foo </div>
3078 !! html
3079 <pre>a <span>foo</span>
3080 </pre>
3081 b <div> foo </div>
3082
3083 !! html/parsoid
3084 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3085 b <div data-parsoid='{"stx":"html"}'> foo </div>
3086 !! html+tidy
3087 <pre>
3088 a <span>foo</span>
3089 </pre>
3090 <p>b</p>
3091 <div>foo</div>
3092 !!end
3093
3094 !!test
3095 3c. Indent-Pre and block tags (pre-content on separate line)
3096 !! wikitext
3097 <p>
3098 foo
3099 </p>
3100
3101 <div>
3102 foo
3103 </div>
3104
3105 <center>
3106 foo
3107 </center>
3108
3109 <blockquote>
3110 foo
3111 </blockquote>
3112
3113 <blockquote>
3114 <pre>
3115 foo
3116 </pre>
3117 </blockquote>
3118
3119 <table><tr><td>
3120 foo
3121 </td></tr></table>
3122
3123 <ul><li>
3124 foo
3125 </li></ul>
3126
3127 !! html
3128 <p>
3129 foo
3130 </p>
3131 <div>
3132 <pre>foo
3133 </pre>
3134 </div>
3135 <center>
3136 <pre>foo
3137 </pre>
3138 </center>
3139 <blockquote>
3140 <p> foo
3141 </p>
3142 </blockquote>
3143 <blockquote>
3144 <pre>
3145 foo
3146 </pre>
3147 </blockquote>
3148 <table><tr><td>
3149 <pre>foo
3150 </pre>
3151 </td></tr></table>
3152 <ul><li>
3153 foo
3154 </li></ul>
3155
3156 !!end
3157
3158 !!test
3159 4. Indent-Pre and extension tags
3160 !! wikitext
3161 a <gallery>
3162 File:foobar.jpg
3163 </gallery>
3164 !! html
3165 a <ul class="gallery mw-gallery-traditional">
3166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3167 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3168 <div class="gallerytext">
3169 </div>
3170 </div></li>
3171 </ul>
3172
3173 !! html+tidy
3174 <p>a</p>
3175 <ul class="gallery mw-gallery-traditional">
3176 <li class="gallerybox" style="width: 155px">
3177 <div style="width: 155px">
3178 <div class="thumb" style="width: 150px;">
3179 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3180 </div>
3181 <div class="gallerytext"></div>
3182 </div>
3183 </li>
3184 </ul>
3185 !!end
3186
3187 !! test
3188 Table wikitext syntax outside wiki-tables
3189 !! wikitext
3190 a
3191 ! not a table heading
3192 |- not a table row
3193 | not a table cell
3194 | class="foo bar" | baz
3195 b
3196 |}
3197 |-
3198 c
3199 !! html
3200 <p>a
3201 ! not a table heading
3202 |- not a table row
3203 | not a table cell
3204 | class="foo bar" | baz
3205 b
3206 |}
3207 |-
3208 c
3209 </p>
3210 !! end
3211
3212 !!test
3213 Render paragraphs when indent-pre is suppressed in blocklevels
3214 !! wikitext
3215 <blockquote>
3216 foo
3217
3218 bar
3219 </blockquote>
3220 !! html
3221 <blockquote>
3222 <p> foo
3223 </p><p> bar
3224 </p>
3225 </blockquote>
3226
3227 !!end
3228
3229 !!test
3230 4. Multiple spaces at start-of-line
3231 !! wikitext
3232 <p> foo </p>
3233 foo
3234 {|
3235 |foo
3236 |}
3237 !! html
3238 <p> foo </p>
3239 <pre> foo
3240 </pre>
3241 <table>
3242 <tr>
3243 <td>foo
3244 </td></tr></table>
3245
3246 !!end
3247
3248 ## NOTE: the leading white-space chars on empty line are significant
3249 !! test
3250 5a. White-space in indent-pre
3251 !! wikitext
3252 a<br />
3253
3254 b
3255 !! html
3256 <pre>a<br />
3257
3258 b
3259 </pre>
3260 !! end
3261
3262 ## NOTE: the leading white-space chars on empty line are significant
3263 !! test
3264 5b. White-space in indent-pre
3265 !! wikitext
3266 a
3267
3268 b
3269
3270
3271 c
3272 !! html
3273 <pre>a
3274
3275 b
3276
3277
3278 c
3279 </pre>
3280 !! end
3281
3282 !! test
3283 5c. White-space in indent-pre
3284 !! wikitext
3285 ''a''
3286 ''b''
3287 ''c''
3288 !! html
3289 <pre><i>a</i>
3290 <i>b</i>
3291 <i>c</i>
3292 </pre>
3293 !! end
3294
3295 !! test
3296 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3297 !! wikitext
3298 a
3299
3300 <!-- continue -->
3301 b
3302
3303 c
3304
3305 d
3306 !! html
3307 <pre>a
3308
3309 b
3310 </pre>
3311 <pre>c
3312
3313 </pre>
3314 <p>d
3315 </p>
3316 !! end
3317
3318 !! test
3319 7a. Indent-pre and category links
3320 !! options
3321 parsoid=wt2html,wt2wt
3322 !! wikitext
3323 [[Category:foo]] <!-- No pre-wrapping -->
3324 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3325 !! html/php+tidy
3326 !! html/parsoid
3327 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3328 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3329 !! end
3330
3331 !! test
3332 7b. Indent-pre and category links
3333 !! options
3334 parsoid=wt2html,wt2wt
3335 !! wikitext
3336 [[Category:foo]] a
3337 [[Category:foo]] {{echo|b}}
3338 !! html
3339 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3340 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3341 !! end
3342
3343 !! test
3344 Indent-Pre: Newlines in comments shouldn't affect sol state
3345 !! wikitext
3346 a <!--
3347 foo
3348 --> b
3349 !! html/php+tidy
3350 <p>a b</p>
3351 !! html/parsoid
3352 <p>a <!--
3353 foo
3354 --> b</p>
3355 !! end
3356
3357 ###
3358 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3359 ###
3360
3361 !!test
3362 HTML-pre: 1. embedded newlines
3363 !! wikitext
3364 <pre>foo</pre>
3365
3366 <pre>
3367 foo
3368 </pre>
3369
3370 <pre>
3371
3372 foo
3373 </pre>
3374
3375 <pre>
3376
3377
3378 foo
3379 </pre>
3380 !! html/php+tidy
3381 <pre>
3382 foo
3383 </pre>
3384 <pre>
3385 foo
3386 </pre>
3387 <pre>
3388
3389 foo
3390 </pre>
3391 <pre>
3392
3393
3394 foo
3395 </pre>
3396 !! html/parsoid
3397 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3398
3399 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3400 foo
3401 </pre>
3402
3403 <pre data-parsoid='{"stx":"html"}'>
3404
3405 foo
3406 </pre>
3407
3408 <pre data-parsoid='{"stx":"html"}'>
3409
3410
3411 foo
3412 </pre>
3413 !!end
3414
3415 !! test
3416 HTML-pre: big spaces
3417 !! wikitext
3418 <pre>
3419
3420
3421
3422
3423 haha
3424
3425
3426
3427
3428 haha
3429
3430
3431
3432
3433 </pre>
3434 !! html/php+tidy
3435 <pre>
3436
3437
3438
3439
3440 haha
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 </pre>
3451 !! html/parsoid
3452 <pre data-parsoid='{"stx":"html"}'>
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 </pre>
3468 !! end
3469
3470 !!test
3471 HTML-pre: 2: indented text
3472 !! wikitext
3473 <pre>
3474 foo
3475 </pre>
3476 !! html
3477 <pre>
3478 foo
3479 </pre>
3480
3481 !!end
3482
3483 !!test
3484 HTML-pre: 3: other wikitext
3485 !! wikitext
3486 <pre>
3487 * foo
3488 # bar
3489 = no-h =
3490 '' no-italic ''
3491 [[ NoLink ]]
3492 </pre>
3493 !! html/php
3494 <pre>
3495 * foo
3496 # bar
3497 = no-h =
3498 '' no-italic ''
3499 [[ NoLink ]]
3500 </pre>
3501
3502 !! html/parsoid
3503 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3504 # bar
3505 = no-h =
3506 '' no-italic ''
3507 [[ NoLink ]]
3508 </pre>
3509 !!end
3510
3511 ###
3512 ### Definition lists
3513 ###
3514 !! test
3515 Simple definition
3516 !! wikitext
3517 ; name : Definition
3518 !! html
3519 <dl><dt> name&#160;</dt>
3520 <dd> Definition</dd></dl>
3521
3522 !! end
3523
3524 !! test
3525 Definition list for indentation only
3526 !! wikitext
3527 : Indented text
3528 !! html
3529 <dl><dd> Indented text</dd></dl>
3530
3531 !! end
3532
3533 !! test
3534 Definition list with no space
3535 !! wikitext
3536 ;name:Definition
3537 !! html
3538 <dl><dt>name</dt>
3539 <dd>Definition</dd></dl>
3540
3541 !!end
3542
3543 !! test
3544 Definition list with URL link
3545 !! wikitext
3546 ; http://example.com/ : definition
3547 !! html
3548 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3549 <dd> definition</dd></dl>
3550
3551 !! end
3552
3553 !! test
3554 Definition list with bracketed URL link
3555 !! wikitext
3556 ;[http://www.example.com/ Example]:Something about it
3557 !! html
3558 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3559 <dd>Something about it</dd></dl>
3560
3561 !! end
3562
3563 !! test
3564 Definition list with wikilink containing colon
3565 !! wikitext
3566 ; [[Help:FAQ]]: The least-read page on Wikipedia
3567 !! html
3568 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3569 <dd> The least-read page on Wikipedia</dd></dl>
3570
3571 !! end
3572
3573 # At Brion's and JeLuF's insistence... :)
3574 !! test
3575 Definition list with news link containing colon
3576 !! wikitext
3577 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3578 !! html/php
3579 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3580 <dd> This isn't even a real newsgroup!</dd></dl>
3581
3582 !! html/parsoid
3583 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3584 !! end
3585
3586 !! test
3587 Malformed definition list with colon
3588 !! wikitext
3589 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3590 !! html
3591 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3592
3593 !! end
3594
3595 !! test
3596 Definition lists: colon in external link text
3597 !! wikitext
3598 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3599 !! html
3600 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3601 <dd> OK, I made that up</dd></dl>
3602
3603 !! end
3604
3605 !! test
3606 Definition lists: colon in HTML attribute
3607 !! wikitext
3608 ;<b style="display: inline">bold</b>
3609 !! html
3610 <dl><dt><b style="display: inline">bold</b></dt></dl>
3611
3612 !! end
3613
3614 !! test
3615 Definition lists: self-closed tag
3616 !! wikitext
3617 ;one<br/>two : two-line fun
3618 !! html
3619 <dl><dt>one<br />two&#160;</dt>
3620 <dd> two-line fun</dd></dl>
3621
3622 !! end
3623
3624 !! test
3625 Bug 11748: Literal closing tags
3626 !! wikitext
3627 <dl>
3628 <dt>test 1</dt>
3629 <dd>test test test test test</dd>
3630 <dt>test 2</dt>
3631 <dd>test test test test test</dd>
3632 </dl>
3633 !! html
3634 <dl>
3635 <dt>test 1</dt>
3636 <dd>test test test test test</dd>
3637 <dt>test 2</dt>
3638 <dd>test test test test test</dd>
3639 </dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3645 !! wikitext
3646 <ul><li>
3647 ; term : description
3648 * unordered
3649 </li></ul>
3650 !! html
3651 <ul><li>
3652 <dl><dt> term&#160;</dt>
3653 <dd> description</dd></dl>
3654 <ul><li> unordered</li></ul>
3655 </li></ul>
3656
3657 !! end
3658
3659 !! test
3660
3661 Definition list with empty definition and following paragraph
3662 !! wikitext
3663 ; term:
3664 Paragraph text
3665 !! html
3666 <dl><dt> term</dt>
3667 <dd></dd></dl>
3668 <p>Paragraph text
3669 </p>
3670 !! end
3671
3672 !! test
3673 Nested definition lists using html syntax
3674 !! wikitext
3675 <dl><dt>x</dt>
3676 <dd>a</dd>
3677 <dd>b</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition Lists: No nesting: Multiple dd's
3683 !! wikitext
3684 ;x
3685 :a
3686 :b
3687 !! html
3688 <dl><dt>x</dt>
3689 <dd>a</dd>
3690 <dd>b</dd></dl>
3691
3692 !! end
3693
3694 !! test
3695 Definition Lists: Indentation: Regular
3696 !! wikitext
3697 :i1
3698 ::i2
3699 :::i3
3700 !! html
3701 <dl><dd>i1
3702 <dl><dd>i2
3703 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3704
3705 !! end
3706
3707 !! test
3708 Definition Lists: Indentation: Missing 1st level
3709 !! wikitext
3710 ::i2
3711 :::i3
3712 !! html
3713 <dl><dd><dl><dd>i2
3714 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition Lists: Indentation: Multi-level indent
3720 !! wikitext
3721 :::i3
3722 !! html
3723 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3724
3725 !! end
3726
3727 !! test
3728 Definition Lists: Hacky use to indent tables
3729 !! wikitext
3730 ::{|
3731 |foo
3732 |bar
3733 |}
3734 this text
3735 should be left alone
3736 !! html
3737 <dl><dd><dl><dd><table>
3738 <tr>
3739 <td>foo
3740 </td>
3741 <td>bar
3742 </td></tr></table></dd></dl></dd></dl>
3743 <p>this text
3744 should be left alone
3745 </p>
3746 !! end
3747
3748 !! test
3749 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3750 !! wikitext
3751 <!-- foo -->
3752 ::{|
3753 |foo
3754 |bar
3755 |}<!-- bar -->
3756 this text
3757 should be left alone
3758 !! html/parsoid
3759 <!-- foo -->
3760 <dl><dd><dl><dd><table><tr>
3761 <td>foo</td>
3762 <td>bar</td>
3763 </tr></table><!-- bar --></dd></dl></dd></dl>
3764 <p>this text
3765 should be left alone</p>
3766 !! end
3767
3768 !! test
3769 Definition Lists: Hacky use to indent tables, with comment before table
3770 !! wikitext
3771 ::<!-- foo -->{|
3772 |foo
3773 |}
3774 !! html/parsoid
3775 <dl><dd><dl><dd><!-- foo --><table><tr>
3776 <td>foo</td>
3777 </tr></table></dd></dl></dd></dl>
3778 !! end
3779
3780 # The trailing whitespace in this test is to catch a regression in
3781 # Parsoid after T54473.
3782 !! test
3783 Definition Lists: Hacky use to indent tables (WS-insensitive)
3784 !! wikitext
3785 : {|
3786 |a
3787 |}
3788 !! html/php
3789 <dl><dd><table>
3790 <tr>
3791 <td>a
3792 </td></tr></table></dd></dl>
3793
3794 !! html/parsoid
3795 <dl><dd> <table>
3796 <tbody><tr><td>a</td></tr>
3797 </tbody></table> </dd></dl>
3798 !! end
3799
3800 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3801 ## as an empty dt item. It also ignores all but the last ";" when followed
3802 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3803 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3804 ## ";"s.
3805 ##
3806 ## Ex: ";;t2 ::d2" is transformed into:
3807 ##
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>
3811 ## <dl>
3812 ## <dt></dt>
3813 ## <dd>d2</dd>
3814 ## </dl>
3815 ## </dd>
3816 ## </dl>
3817 ##
3818 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3819 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3820 ##
3821 ## <dl>
3822 ## <dt>
3823 ## <dl>
3824 ## <dt>t2 </dt>
3825 ## <dd>:d2</dd>
3826 ## </dl>
3827 ## </dt>
3828 ## </dl>
3829 ##
3830 ## All Parsoid only definition list tests have this difference.
3831 ##
3832 ## See also: https://phabricator.wikimedia.org/T8569
3833 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3834
3835 !! test
3836 Table / list interaction: indented table with lists in table contents
3837 !! wikitext
3838 :{|
3839 |-
3840 | a
3841 * b
3842 |-
3843 | c
3844 * d
3845 |}
3846 !! html
3847 <dl><dd><table>
3848
3849 <tr>
3850 <td> a
3851 <ul><li> b</li></ul>
3852 </td></tr>
3853 <tr>
3854 <td> c
3855 <ul><li> d</li></ul>
3856 </td></tr></table></dd></dl>
3857
3858 !! end
3859
3860 !!test
3861 Table / list interaction: lists nested in tables nested in indented lists
3862 !! wikitext
3863 :{|
3864 |
3865 :a
3866 :b
3867 |
3868 *c
3869 *d
3870 |}
3871
3872 *e
3873 *f
3874 !! html
3875 <dl><dd><table>
3876 <tr>
3877 <td>
3878 <dl><dd>a</dd>
3879 <dd>b</dd></dl>
3880 </td>
3881 <td>
3882 <ul><li>c</li>
3883 <li>d</li></ul>
3884 </td></tr></table></dd></dl>
3885 <ul><li>e</li>
3886 <li>f</li></ul>
3887
3888 !!end
3889
3890 !! test
3891 Definition Lists: Nesting: Multi-level (Parsoid only)
3892 !! options
3893 parsoid
3894 !! wikitext
3895 ;t1 :d1
3896 ;;t2 ::d2
3897 ;;;t3 :::d3
3898 !! html
3899 <dl>
3900 <dt>t1 </dt>
3901 <dd>d1</dd>
3902 <dt>
3903 <dl>
3904 <dt>t2 </dt>
3905 <dd>:d2</dd>
3906 <dt>
3907 <dl>
3908 <dt>t3 </dt>
3909 <dd>::d3</dd>
3910 </dl>
3911 </dt>
3912 </dl>
3913 </dt>
3914 </dl>
3915
3916
3917 !! end
3918
3919
3920 !! test
3921 Definition Lists: Nesting: Test 2 (Parsoid only)
3922 !! wikitext
3923 ;t1
3924 ::d2
3925 !! html/php+tidy
3926 <dl>
3927 <dt>t1</dt>
3928 <dd>
3929 <dl>
3930 <dd>d2</dd>
3931 </dl>
3932 </dd>
3933 </dl>
3934 !! html/parsoid
3935 <dl>
3936 <dt>t1</dt>
3937 <dd>
3938 <dl>
3939 <dd>d2</dd>
3940 </dl>
3941 </dd>
3942 </dl>
3943
3944 !! end
3945
3946
3947 !! test
3948 Definition Lists: Nesting: Test 3 (Parsoid only)
3949 !! wikitext
3950 :;t1
3951 ::::d2
3952 !! html/php+tidy
3953 <dl>
3954 <dd>
3955 <dl>
3956 <dt>t1</dt>
3957 <dd>
3958 <dl>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 !! html/parsoid
3970 <dl>
3971 <dd>
3972 <dl>
3973 <dt>t1</dt>
3974 <dd>
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dd>d2</dd>
3979 </dl>
3980 </dd>
3981 </dl>
3982 </dd>
3983 </dl>
3984 </dd>
3985 </dl>
3986
3987 !! end
3988
3989
3990 !! test
3991 Definition Lists: Nesting: Test 4
3992 !! wikitext
3993 ::;t3
3994 :::d3
3995 !! html
3996 <dl><dd><dl><dd><dl><dt>t3</dt>
3997 <dd>d3</dd></dl></dd></dl></dd></dl>
3998
3999 !! end
4000
4001
4002 ## The Parsoid team believes the following three test exposes a
4003 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4004 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4005 ## It also exposes a "misfeature" in tidy, which doesn't like
4006 ## <dl> tags with a single <dt> child; it converts the <dt> into
4007 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4008 !! test
4009 Definition Lists: Mixed Lists: Test 1
4010 !! wikitext
4011 :;* foo
4012 ::* bar
4013 :; baz
4014 !! html/php
4015 <dl><dd><dl><dt><ul><li> foo</li>
4016 <li> bar</li></ul></dt></dl>
4017 <dl><dt> baz</dt></dl></dd></dl>
4018
4019 !! html/php+tidy
4020 <dl>
4021 <dd>
4022 <dl>
4023 <dd>
4024 <ul>
4025 <li>foo</li>
4026 <li>bar</li>
4027 </ul>
4028 </dd>
4029 </dl>
4030 <dl>
4031 <dt>baz</dt>
4032 </dl>
4033 </dd>
4034 </dl>
4035 !! html/parsoid
4036 <dl>
4037 <dd><dl>
4038 <dt><ul>
4039 <li> foo
4040 </li>
4041 </ul></dt>
4042 <dd><ul>
4043 <li> bar
4044 </li>
4045 </ul></dd>
4046 <dt> baz</dt>
4047 </dl></dd>
4048 </dl>
4049 !! end
4050
4051 !! test
4052 Definition Lists: Mixed Lists: Test 2
4053 !! wikitext
4054 *: d1
4055 *: d2
4056 !! html
4057 <ul><li><dl><dd> d1</dd>
4058 <dd> d2</dd></dl></li></ul>
4059
4060 !! end
4061
4062
4063 !! test
4064 Definition Lists: Mixed Lists: Test 3
4065 !! wikitext
4066 *::: d1
4067 *::: d2
4068 !! html
4069 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4070 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4071
4072 !! end
4073
4074
4075 !! test
4076 Definition Lists: Mixed Lists: Test 4
4077 !! wikitext
4078 *;d1 :d2
4079 *;d3 :d4
4080 !! html
4081 <ul><li><dl><dt>d1&#160;</dt>
4082 <dd>d2</dd>
4083 <dt>d3&#160;</dt>
4084 <dd>d4</dd></dl></li></ul>
4085
4086 !! end
4087
4088
4089 !! test
4090 Definition Lists: Mixed Lists: Test 5
4091 !! wikitext
4092 *:d1
4093 *:: d2
4094 !! html
4095 <ul><li><dl><dd>d1
4096 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4097
4098 !! end
4099
4100
4101 !! test
4102 Definition Lists: Mixed Lists: Test 6
4103 !! wikitext
4104 #*:d1
4105 #*::: d3
4106 !! html
4107 <ol><li><ul><li><dl><dd>d1
4108 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4109
4110 !! end
4111
4112
4113 !! test
4114 Definition Lists: Mixed Lists: Test 7
4115 !! wikitext
4116 :* d1
4117 :* d2
4118 !! html
4119 <dl><dd><ul><li> d1</li>
4120 <li> d2</li></ul></dd></dl>
4121
4122 !! end
4123
4124
4125 !! test
4126 Definition Lists: Mixed Lists: Test 8
4127 !! wikitext
4128 :* d1
4129 ::* d2
4130 !! html
4131 <dl><dd><ul><li> d1</li></ul>
4132 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4133
4134 !! end
4135
4136
4137 !! test
4138 Definition Lists: Mixed Lists: Test 9
4139 !! wikitext
4140 *;foo :bar
4141 !! html
4142 <ul><li><dl><dt>foo&#160;</dt>
4143 <dd>bar</dd></dl></li></ul>
4144
4145 !! end
4146
4147
4148 !! test
4149 Definition Lists: Mixed Lists: Test 10
4150 !! wikitext
4151 *#;foo :bar
4152 !! html
4153 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4154 <dd>bar</dd></dl></li></ol></li></ul>
4155
4156 !! end
4157
4158 # The Parsoid team disagrees with the PHP parser's seemingly-random
4159 # rules regarding dd/dt on the next two tests. Parsoid is more
4160 # consistent, and recognizes the shared nesting and keeps the
4161 # still-open tags around until the nesting is complete.
4162 # (And tidy again converts <dt> to <dd> before 'bar'.)
4163
4164 !! test
4165 Definition Lists: Mixed Lists: Test 11
4166 !! wikitext
4167 *#*#;*;;foo :bar
4168 *#*#;boo :baz
4169 !! html/php
4170 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4171 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4172 <dl><dt>boo&#160;</dt>
4173 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4174
4175 !! html/php+tidy
4176 <ul>
4177 <li>
4178 <ol>
4179 <li>
4180 <ul>
4181 <li>
4182 <ol>
4183 <li>
4184 <dl>
4185 <dt>foo&#160;</dt>
4186 <dd>
4187 <ul>
4188 <li>
4189 <dl>
4190 <dd>
4191 <dl>
4192 <dt>bar</dt>
4193 </dl>
4194 </dd>
4195 </dl>
4196 </li>
4197 </ul>
4198 </dd>
4199 </dl>
4200 <dl>
4201 <dt>boo&#160;</dt>
4202 <dd>baz</dd>
4203 </dl>
4204 </li>
4205 </ol>
4206 </li>
4207 </ul>
4208 </li>
4209 </ol>
4210 </li>
4211 </ul>
4212 !! html/parsoid
4213 <ul>
4214 <li>
4215 <ol>
4216 <li>
4217 <ul>
4218 <li>
4219 <ol>
4220 <li>
4221 <dl>
4222 <dt>
4223 <ul>
4224 <li>
4225 <dl>
4226 <dt>
4227 <dl>
4228 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4229 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4230 </dl></dt>
4231 </dl></li>
4232 </ul></dt>
4233 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4234 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4235 </dl></li>
4236 </ol></li>
4237 </ul></li>
4238 </ol></li>
4239 </ul>
4240 !! end
4241
4242
4243 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4244 # From whitelist:
4245 # * The test is wrong, there are two colons where there should be :;
4246 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4247 !! test
4248 Definition Lists: Weird Ones: Test 1
4249 !! wikitext
4250 *#;*::;; foo : bar (who uses this?)
4251 !! html/php
4252 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4253 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4254
4255 !! html/php+tidy
4256 <ul>
4257 <li>
4258 <ol>
4259 <li>
4260 <dl>
4261 <dt>foo&#160;</dt>
4262 <dd>
4263 <ul>
4264 <li>
4265 <dl>
4266 <dd>
4267 <dl>
4268 <dd>
4269 <dl>
4270 <dd>
4271 <dl>
4272 <dt>bar (who uses this?)</dt>
4273 </dl>
4274 </dd>
4275 </dl>
4276 </dd>
4277 </dl>
4278 </dd>
4279 </dl>
4280 </li>
4281 </ul>
4282 </dd>
4283 </dl>
4284 </li>
4285 </ol>
4286 </li>
4287 </ul>
4288 !! html/parsoid
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dd>
4299 <dl>
4300 <dd>
4301 <dl>
4302 <dt>
4303 <dl>
4304 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4305 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4306 </dl></dt>
4307 </dl></dd>
4308 </dl></dd>
4309 </dl></li>
4310 </ul></dt>
4311 </dl></li>
4312 </ol></li>
4313 </ul>
4314 !! end
4315
4316 !! test
4317 Definition Lists: colons occurring in tags
4318 !! wikitext
4319 ;a:b
4320 ;'''a:b'''
4321 ;<i>a:b</i>
4322 ;<span>a:b</span>
4323 ;<div>a:b</div>
4324 ;<div>a
4325 :b</div>
4326 ;{{echo|a:b}}
4327 ;{{echo|''a:b''}}
4328 ;;;''a:b''
4329 !! html+tidy
4330 <dl>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><b>a:b</b></dt>
4334 <dt><i>a:b</i></dt>
4335 <dt><span>a:b</span></dt>
4336 <dd>
4337 <div>a:b</div>
4338 </dd>
4339 <dd>
4340 <div>a
4341 <dl>
4342 <dd>b</dd>
4343 </dl>
4344 </div>
4345 </dd>
4346 <dt>a</dt>
4347 <dd>b</dd>
4348 <dt><i>a:b</i></dt>
4349 </dl>
4350 <dl>
4351 <dd>
4352 <dl>
4353 <dd>
4354 <dl>
4355 <dt><i>a:b</i></dt>
4356 </dl>
4357 </dd>
4358 </dl>
4359 </dd>
4360 </dl>
4361 !! html/parsoid
4362 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4363 <dt><b>a:b</b></dt>
4364 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4365 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4366 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4367 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4368 <dd>b</dd>
4369 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4370 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4371 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4372 !! end
4373
4374 !! test
4375 Definition Lists: colons and tables 1
4376 !! wikitext
4377 :{|
4378 | x
4379 |}
4380 :{|
4381 | y
4382 |}
4383 !! html
4384 <dl><dd><table>
4385 <tr>
4386 <td> x
4387 </td></tr></table></dd></dl>
4388 <dl><dd><table>
4389 <tr>
4390 <td> y
4391 </td></tr></table></dd></dl>
4392
4393 !! end
4394
4395 # Parsoid's output (as documented below) differs from php's in this case.
4396 # This is probably a bug. If we fixup parsoid to match php's output, the
4397 # above test should pass and the below test case can be removed. It is
4398 # unclear which output is more desirable.
4399
4400 !! test
4401 Definition Lists: colons and tables 2
4402 !! wikitext
4403 :{|
4404 | x
4405 |}
4406 :{|
4407 | y
4408 |}
4409 !! html/parsoid
4410 <dl><dd><table>
4411 <tr>
4412 <td> x
4413 </td></tr></table></dd>
4414 <dd><table>
4415 <tr>
4416 <td> y
4417 </td></tr></table></dd></dl>
4418 !! end
4419
4420 !! test
4421 Definition Lists: template interaction
4422 !! wikitext
4423 ::{{definition_list}}
4424
4425 :one
4426 ::{{definition_list}}
4427 :::two
4428 :::three
4429 ::four
4430 !! html/parsoid
4431 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4432 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4433
4434 <dl><dd data-parsoid='{}'>one
4435 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4436 </span><dd about="#mwt2">two
4437 <dl><dd>two</dd>
4438 <dd>three</dd></dl></dd>
4439 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4440 !! end
4441
4442
4443 ###
4444 ### External links
4445 ###
4446 !! test
4447 External links: non-bracketed
4448 !! wikitext
4449 Non-bracketed: http://example.com
4450 !! html
4451 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4452 </p>
4453 !! end
4454
4455 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4456 !! test
4457 External links: numbered
4458 !! wikitext
4459 Numbered: [http://example.com]
4460 Numbered: [http://example.net]
4461 Numbered: [http://example.com]
4462 !! html/php
4463 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4464 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4465 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4466 </p>
4467 !! html/parsoid
4468 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4469 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4470 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4471 !!end
4472
4473 !! test
4474 External links: specified text
4475 !! wikitext
4476 Specified text: [http://example.com link]
4477 !! html
4478 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4479 </p>
4480 !!end
4481
4482 !! test
4483 External links: trail
4484 !! wikitext
4485 Linktrails should not work for external links: [http://example.com link]s
4486 !! html
4487 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4488 </p>
4489 !! end
4490
4491 !! test
4492 External links: dollar sign in URL
4493 !! wikitext
4494 http://example.com/1$2345
4495 !! html
4496 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4497 </p>
4498 !! end
4499
4500 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4501 !! test
4502 External links: dollar sign in URL (autonumber)
4503 !! wikitext
4504 [http://example.com/1$2345]
4505 !! html/php
4506 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4507 </p>
4508 !! html/parsoid
4509 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4510 !!end
4511
4512 !! test
4513 External links: open square bracket forbidden in URL (bug 4377)
4514 !! options
4515 parsoid=wt2html,wt2wt,html2html
4516 !! wikitext
4517 http://example.com/1[2345
4518 !! html/php
4519 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4520 </p>
4521 !! html/parsoid
4522 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4523 !! end
4524
4525 !! test
4526 External links: open square bracket forbidden in URL (named) (bug 4377)
4527 !! options
4528 parsoid=wt2html,html2html
4529 !! wikitext
4530 [http://example.com/1[2345]
4531 !! html/php
4532 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4533 </p>
4534 !! html/parsoid
4535 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4536 !!end
4537
4538 # parsoid adds a space before the link name
4539 !! test
4540 External links: open square bracket forbidden in URL (named) (bug 4377)
4541 Parsoid variant.
4542 !! wikitext
4543 [http://example.com/1 [2345]
4544 !! html
4545 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4546 </p>
4547 !!end
4548
4549 !! test
4550 External links: nowiki in URL link text (bug 6230)
4551 !! wikitext
4552 [http://example.com/ <nowiki>''example site''</nowiki>]
4553 !! html
4554 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4555 </p>
4556 !! end
4557
4558 !! test
4559 External links: newline forbidden in text (bug 6230 regression check)
4560 !! wikitext
4561 [http://example.com/ first
4562 second]
4563 !! html
4564 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4565 second]
4566 </p>
4567 !!end
4568
4569 !! test
4570 External links: Pipe char between url and text
4571 !! wikitext
4572 [http://example.com | link]
4573 !! html
4574 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4575 </p>
4576 !!end
4577
4578 !! test
4579 External links: protocol-relative URL in brackets
4580 !! wikitext
4581 [//example.com/ Test]
4582 !! html
4583 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4584 </p>
4585 !! end
4586
4587 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4588 !! test
4589 External links: protocol-relative URL in brackets without text
4590 !! wikitext
4591 [//example.com]
4592 !! html/php
4593 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4594 </p>
4595 !! html/parsoid
4596 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4597 !! end
4598
4599 !! test
4600 External links: protocol-relative URL in free text is left alone
4601 !! wikitext
4602 //example.com/Foo
4603 !! html
4604 <p>//example.com/Foo
4605 </p>
4606 !!end
4607
4608 !! test
4609 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4610 !! wikitext
4611 foo//example.com/Foo
4612 !! html
4613 <p>foo//example.com/Foo
4614 </p>
4615 !! end
4616
4617 !! test
4618 External links: with no contents
4619 !! wikitext
4620 [http://en.wikipedia.org/wiki/Foo]
4621
4622 [[wikipedia:Foo|Bar]]
4623
4624 [[wikipedia:Foo|<span>Bar</span>]]
4625 !! html/php
4626 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4627 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4628 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4629 </p>
4630 !! html/parsoid
4631 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4632 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4633 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4634 !! end
4635
4636 !! test
4637 External links: Free with trailing punctuation
4638 !! wikitext
4639 http://example.com,
4640 http://example.com;
4641 http://example.com\
4642 http://example.com.
4643 http://example.com:
4644 http://example.com!
4645 http://example.com?
4646 http://example.com)
4647 http://example.com/url_with_(brackets)
4648 (http://example.com/url_without_brackets)
4649 http://example.com/url_with_entity&nbsp;
4650 http://example.com/url_with_entity&#xA0;
4651 http://example.com/url_with_entity&#160;
4652 http://example.com/url_with_entity&lt;
4653 http://example.com/url_with_entity&#x3C;
4654 http://example.com/url_with_entity&#60;
4655 !! html/php
4656 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4657 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4658 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4659 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4660 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4661 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4662 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4663 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4664 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4665 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4666 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4667 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4668 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4669 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4670 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4671 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4672 </p>
4673 !! html/parsoid
4674 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4675 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4676 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4677 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4678 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4679 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4680 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4681 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4682 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4683 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4684 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4685 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4686 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4687 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4688 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4689 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4690 !! end
4691
4692 !! test
4693 External links: Lone protocols are never linked (T105697)
4694 !! wikitext
4695 http://
4696 http://;
4697 (http://)
4698 bitcoin:
4699 bitcoin:;
4700 (bitcoin:)
4701 !! html
4702 <p>http://
4703 http://;
4704 (http://)
4705 bitcoin:
4706 bitcoin:;
4707 (bitcoin:)
4708 </p>
4709 !! end
4710
4711 !! test
4712 External links: No preceding word characters allowed (bug 65278)
4713 !! wikitext
4714 NOPEhttp://example.com
4715 N0http://example.com
4716 ok:http://example.com
4717 ok-http://example.com
4718 !! html
4719 <p>NOPEhttp://example.com
4720 N0http://example.com
4721 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4722 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4723 </p>
4724 !! end
4725
4726 !! test
4727 External image
4728 !! wikitext
4729 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4730 !! html
4731 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4732 </p>
4733 !! end
4734
4735 !! test
4736 External image from https
4737 !! wikitext
4738 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4739 !! html
4740 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4741 </p>
4742 !! end
4743
4744 !! test
4745 External image (when not allowed)
4746 !! options
4747 wgAllowExternalImages=0
4748 !! wikitext
4749 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4750 !! html
4751 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4752 </p>
4753 !! end
4754
4755 !! test
4756 Link to non-http image, no img tag
4757 !! wikitext
4758 Link to non-http image, no img tag: ftp://example.com/test.jpg
4759 !! html
4760 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4761 </p>
4762 !! end
4763
4764 !! test
4765 External links: terminating separator
4766 !! wikitext
4767 Terminating separator: http://example.com/thing,
4768 !! html
4769 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4770 </p>
4771 !! end
4772
4773 !! test
4774 External links: intervening separator
4775 !! wikitext
4776 Intervening separator: http://example.com/1,2,3
4777 !! html
4778 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4779 </p>
4780 !! end
4781
4782 !! test
4783 External links: old bug with URL in query
4784 !! wikitext
4785 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4786 !! html
4787 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4788 </p>
4789 !! end
4790
4791 !! test
4792 External links: old URL-in-URL bug, mixed protocols
4793 !! wikitext
4794 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4795 !! html
4796 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4797 </p>
4798 !!end
4799
4800 !! test
4801 External links: URL in text
4802 !! wikitext
4803 URL in text: [http://example.com http://example.com]
4804 !! html
4805 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4806 </p>
4807 !! end
4808
4809 !! test
4810 External links: Clickable images
4811 !! wikitext
4812 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4813 !! html/php
4814 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4815 </p>
4816 !! html/parsoid
4817 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4818 !! end
4819
4820 !! test
4821 External links: raw ampersand
4822 !! wikitext
4823 Old &amp; use: http://x&y
4824 !! html
4825 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4826 </p>
4827 !! end
4828
4829 !! test
4830 External links: encoded ampersand
4831 !! wikitext
4832 Old &amp; use: http://x&amp;y
4833 !! html/php
4834 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4835 </p>
4836 !! html/parsoid
4837 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4838 !! end
4839
4840 !! test
4841 External links: encoded equals (bug 6102)
4842 !! wikitext
4843 http://example.com/?foo&#61;bar
4844 !! html/php
4845 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4846 </p>
4847 !! html/parsoid
4848 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4849 !! end
4850
4851 ##
4852 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4853 ## does it number them. As discussed in bug 53505, we can identify
4854 ## autonumbered links via CSS.
4855 ##
4856
4857 !! test
4858 External links: [raw ampersand]
4859 !! wikitext
4860 Old &amp; use: [http://x&y]
4861 !! html/php
4862 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4863 </p>
4864 !! html/parsoid
4865 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4866 !! end
4867
4868 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4869 # mode will return the [raw ampersand] wikitext
4870 !! test
4871 External links: [encoded ampersand]
4872 !! options
4873 parsoid=wt2html,wt2wt,html2html
4874 !! wikitext
4875 Old &amp; use: [http://x&amp;y]
4876 !! html/php
4877 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4878 </p>
4879 !! html/parsoid
4880 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4881 !! end
4882
4883 !! test
4884 External links: [raw equals]
4885 !! wikitext
4886 [http://example.com/?foo=bar]
4887 !! html/php
4888 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4889 </p>
4890 !! html/parsoid
4891 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4892 !! end
4893
4894 # note that parsoid html is identical to [raw equals] case; so html2wt
4895 # mode will return the [raw equals] wikitext
4896 !! test
4897 External links: [encoded equals] (bug 6102)
4898 !! options
4899 parsoid=wt2html,wt2wt,html2html
4900 !! wikitext
4901 [http://example.com/?foo&#61;bar]
4902 !! html/php
4903 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4907 !! end
4908
4909 # xxx parsoid strips the IDN character, so the round-trip tests will
4910 # obviously fail and are disabled. --cscott
4911 !! test
4912 External links: [IDN ignored character reference in hostname; strip it right off]
4913 !! options
4914 parsoid=wt2html,wt2wt,html2html
4915 !! wikitext
4916 [http://e&zwnj;xample.com/]
4917 !! html/php
4918 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4919 </p>
4920 !! html/parsoid
4921 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4922 !! end
4923
4924 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4925 # Where an external link could easily circumvent the sanitization of the text of
4926 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4927 # test demands a higher standard. That's a bit strange.
4928 #
4929 # Example:
4930 #
4931 # http://e‌xample.com -> [http://example.com|http://example.com]
4932 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4933 #
4934 # The first example is sanitized, but the second is not. Any security benefits
4935 # from this production are trivial to circumvent. Either remove this test and
4936 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4937 # the test accordingly.
4938 #
4939 # All our love,
4940 # The Parsoid team.
4941 # xxx parsoid strips the IDN character, so the round-trip tests will
4942 # obviously fail and are disabled. --cscott
4943 !! test
4944 External links: IDN ignored character reference in hostname; strip it right off
4945 !! options
4946 parsoid=wt2html,html2html
4947 !! wikitext
4948 http://e&zwnj;xample.com/
4949 !! html/php
4950 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4951 </p>
4952 !! html/parsoid
4953 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4954 !! end
4955
4956 !! test
4957 External links: www.jpeg.org (bug 554)
4958 !! wikitext
4959 http://www.jpeg.org
4960 !! html
4961 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4962 </p>
4963 !! end
4964
4965 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4966 !! test
4967 External links: URL within URL (original bug 2)
4968 !! wikitext
4969 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4970 !! html/php
4971 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4972 </p>
4973 !! html/parsoid
4974 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4975 !! end
4976
4977 !! test
4978 BUG 361: URL inside bracketed URL
4979 !! wikitext
4980 [http://www.example.com/foo http://www.example.com/bar]
4981 !! html
4982 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4983 </p>
4984 !! end
4985
4986 !! test
4987 BUG 361: URL within URL, not bracketed
4988 !! wikitext
4989 http://www.example.com/foo?=http://www.example.com/bar
4990 !! html
4991 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
4992 </p>
4993 !! end
4994
4995 !! test
4996 BUG 289: ">"-token in URL-tail
4997 !! wikitext
4998 http://www.example.com/<hello>
4999 !! html
5000 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5001 </p>
5002 !!end
5003
5004 !! test
5005 BUG 289: literal ">"-token in URL-tail
5006 !! wikitext
5007 http://www.example.com/<b>html</b>
5008 !! html/php
5009 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5010 </p>
5011 !! html/parsoid
5012 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5013 !! end
5014
5015 !! test
5016 BUG 289: ">"-token in bracketed URL
5017 !! wikitext
5018 [http://www.example.com/<hello> stuff]
5019 !! html
5020 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5021 </p>
5022 !!end
5023
5024 !! test
5025 BUG 289: literal ">"-token in bracketed URL
5026 !! wikitext
5027 [http://www.example.com/<b>html</b> stuff]
5028 !! html
5029 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5030 </p>
5031 !!end
5032
5033 !! test
5034 BUG 289: literal double quote at end of URL
5035 !! wikitext
5036 http://www.example.com/"hello"
5037 !! html
5038 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5039 </p>
5040 !!end
5041
5042 !! test
5043 BUG 289: literal double quote in bracketed URL
5044 !! wikitext
5045 [http://www.example.com/"hello" stuff]
5046 !! html
5047 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5048 </p>
5049 !!end
5050
5051 !! test
5052 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5053 !! wikitext
5054 [http://www.example.com test]
5055 !! html
5056 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5057 </p>
5058 !! end
5059
5060 !! test
5061 External links: link text with spaces
5062 !! wikitext
5063 [http://www.example.com a b c]
5064 [http://www.example.com ''a'' ''b'']
5065 !! html
5066 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5067 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5068 </p>
5069 !! end
5070
5071 !! test
5072 External links: wiki links within external link (Bug 3695)
5073 !! wikitext
5074 [http://example.com [[wikilink]] embedded in ext link]
5075 !! html/php
5076 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5077 </p>
5078 !! html/parsoid
5079 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5080 !! end
5081
5082 !! test
5083 BUG 787: Links with one slash after the url protocol are invalid
5084 !! wikitext
5085 http:/example.com
5086
5087 [http:/example.com title]
5088 !! html
5089 <p>http:/example.com
5090 </p><p>[http:/example.com title]
5091 </p>
5092 !! end
5093
5094 !! test
5095 Bracketed external links with template-generated invalid target
5096 !! wikitext
5097 [{{echo|http:/example.com}} title]
5098 !! html
5099 <p>[http:/example.com title]
5100 </p>
5101 !! end
5102
5103 !! test
5104 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5105 !! wikitext
5106 ''[http://example.com text'']
5107 [http://example.com '''text]'''
5108 ''Something [http://example.com in italic'']
5109 ''Something [http://example.com mixed''''', even bold]'''
5110 '''''Now [http://example.com both''''']
5111 !! html
5112 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5113 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5114 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5115 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5116 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5117 </p>
5118 !! end
5119
5120
5121 !! test
5122 Bug 4781: %26 in URL
5123 !! wikitext
5124 http://www.example.com/?title=AT%26T
5125 !! html/php
5126 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5127 </p>
5128 !! html/parsoid
5129 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5130 !! end
5131
5132 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5133 # % is actually legal in HTML5. Any change in output would need testing though.
5134 !! test
5135 Bug 4781, 5267: %25 in URL
5136 !! wikitext
5137 http://www.example.com/?title=100%25_Bran
5138 !! html/php
5139 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5140 </p>
5141 !! html/parsoid
5142 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5143 !! end
5144
5145 !! test
5146 Bug 4781, 5267: %28, %29 in URL
5147 !! wikitext
5148 http://www.example.com/?title=Ben-Hur_%281959_film%29
5149 !! html/php
5150 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5151 </p>
5152 !! html/parsoid
5153 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5154 !! end
5155
5156
5157 !! test
5158 Bug 4781: %26 in autonumber URL
5159 !! wikitext
5160 [http://www.example.com/?title=AT%26T]
5161 !! html/php
5162 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5163 </p>
5164 !! html/parsoid
5165 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5166 !! end
5167
5168 !! test
5169 Bug 4781, 5267: %26 in autonumber URL
5170 !! wikitext
5171 [http://www.example.com/?title=100%25_Bran]
5172 !! html/php
5173 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5174 </p>
5175 !! html/parsoid
5176 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5177 !! end
5178
5179 !! test
5180 Bug 4781, 5267: %28, %29 in autonumber URL
5181 !! wikitext
5182 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5183 !! html/php
5184 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5185 </p>
5186 !! html/parsoid
5187 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5188 !! end
5189
5190
5191 !! test
5192 Bug 4781: %26 in bracketed URL
5193 !! wikitext
5194 [http://www.example.com/?title=AT%26T link]
5195 !! html/php
5196 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5197 </p>
5198 !! html/parsoid
5199 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5200 !! end
5201
5202 !! test
5203 Bug 4781, 5267: %25 in bracketed URL
5204 !! wikitext
5205 [http://www.example.com/?title=100%25_Bran link]
5206 !! html
5207 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5208 </p>
5209 !! end
5210
5211 !! test
5212 Bug 4781, 5267: %28, %29 in bracketed URL
5213 !! wikitext
5214 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5215 !! html/php
5216 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5217 </p>
5218 !! html/parsoid
5219 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5220 !! end
5221
5222 !! test
5223 External link containing a period in the anchor. (bug 63947)
5224 !! wikitext
5225 [//foo.org/bar#baz. bang]
5226
5227 [//foo.org/bar. bang]
5228 !! html/php
5229 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5234 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5235 !! end
5236
5237 !! test
5238 External link containing a single quote. (bug 63947)
5239 !! wikitext
5240 [//foo.org/bar'baz]
5241
5242 [//foo.org/bar'baz bang]
5243 !! html/php
5244 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5245 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5246 </p>
5247 !! html/parsoid
5248 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5249 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5250 !! end
5251
5252 !! test
5253 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5254 !! wikitext
5255 Some [http://example.com/ pretty ''italics'' and stuff]!
5256 !! html
5257 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5258 </p>
5259 !! end
5260
5261 !! test
5262 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5263 !! wikitext
5264 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5265 !! html
5266 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5267 </p>
5268 !! end
5269
5270 !! test
5271 External link containing double-single-quotes with no space separating the url from text in italics
5272 !! wikitext
5273 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5274 !! html/php
5275 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5276 </p>
5277 !! html/php+tidy
5278 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5281 !! end
5282
5283 !! test
5284 External link with comments in link text
5285 !! wikitext
5286 [http://www.google.com Google <!-- comment -->]
5287 !! html/php
5288 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5289 </p>
5290 !! html/parsoid
5291 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5292 !! end
5293
5294 !! test
5295 External link to bare IPv4 address
5296 !! wikitext
5297 [http://192.168.0.1 Link]
5298 !! html/php
5299 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5300 </p>
5301 !! html/parsoid
5302 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5303 !! end
5304
5305 !! test
5306 URL-encoding in URL functions (single parameter)
5307 !! wikitext
5308 {{localurl:Some page|amp=&}}
5309 !! html
5310 <p>/index.php?title=Some_page&amp;amp=&amp;
5311 </p>
5312 !! end
5313
5314 !! test
5315 URL-encoding in URL functions (multiple parameters)
5316 !! wikitext
5317 {{localurl:Some page|q=?&amp=&}}
5318 !! html
5319 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5320 </p>
5321 !! end
5322
5323 !! test
5324 Brackets in urls
5325 !! wikitext
5326 http://example.com/index.php?foozoid%5B%5D=bar
5327
5328 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5329 !! html/php
5330 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5331 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5332 </p>
5333 !! html/parsoid
5334 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5335
5336 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5337 !! end
5338
5339 !! test
5340 IPv6 urls, autolink format (T23261)
5341 !! wikitext
5342 http://[2404:130:0:1000::187:2]/index.php
5343
5344 Examples from RFC 2373, section 2.2:
5345 * http://[1080::8:800:200C:417A]/unicast
5346 * http://[FF01::101]/multicast
5347 * http://[::1]/loopback
5348 * http://[::]/unspecified
5349 * http://[::13.1.68.3]/ipv4compat
5350 * http://[::FFFF:129.144.52.38]/ipv4compat
5351
5352 Examples from RFC 2732, section 2:
5353 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5354 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5355 * http://[3ffe:2a00:100:7031::1]
5356 * http://[1080::8:800:200C:417A]/foo
5357 * http://[::192.9.5.5]/ipng
5358 * http://[::FFFF:129.144.52.38]:80/index.html
5359 * http://[2010:836B:4179::836B:4179]
5360
5361 !! html/php
5362 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5363 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5364 </p>
5365 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5366 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5367 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5368 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5369 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5370 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5371 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5372 </p>
5373 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5374 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5375 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5376 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5377 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5378 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5379 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5380
5381 !! html/parsoid
5382 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5383
5384 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5385 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5386 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5387 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5388 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5389 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5390 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5391
5392 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5393 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5394 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5395 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5396 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5397 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5398 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5399 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5400 !! end
5401
5402 !! test
5403 IPv6 urls, bracketed format (T23261)
5404 !! wikitext
5405 [http://[2404:130:0:1000::187:2]/index.php test]
5406
5407 Examples from RFC 2373, section 2.2:
5408 * [http://[1080::8:800:200C:417A] unicast]
5409 * [http://[FF01::101] multicast]
5410 * [http://[::1]/ loopback]
5411 * [http://[::] unspecified]
5412 * [http://[::13.1.68.3] ipv4compat]
5413 * [http://[::FFFF:129.144.52.38] ipv4compat]
5414
5415 Examples from RFC 2732, section 2:
5416 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5417 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5418 * [http://[3ffe:2a00:100:7031::1] 3]
5419 * [http://[1080::8:800:200C:417A]/foo 4]
5420 * [http://[::192.9.5.5]/ipng 5]
5421 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5422 * [http://[2010:836B:4179::836B:4179] 7]
5423
5424 !! html/php
5425 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5426 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5427 </p>
5428 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5429 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5430 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5431 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5432 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5433 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5434 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5435 </p>
5436 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5437 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5438 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5439 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5440 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5441 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5442 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5443
5444 !! html/parsoid
5445 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5446
5447 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5448 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5449 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5450 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5451 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5452 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5453 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5454
5455 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5456 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5461 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5462 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5463 !! end
5464
5465 !! test
5466 Non-extlinks in brackets
5467 !! wikitext
5468 [foo]
5469 [foo bar]
5470 [foo ''bar'']
5471 [fool's] errand
5472 [fool's errand]
5473 [{{echo|foo}}]
5474 [{{echo|foo}} bar]
5475 [{{echo|foo}} ''bar'']
5476 [{{echo|foo}}l's] errand
5477 [{{echo|foo}}l's errand]
5478 [url={{echo|foo}}]
5479 [url=http://example.com]
5480 [http:// bare protocols don't count]
5481 !! html/php
5482 <p>[foo]
5483 [foo bar]
5484 [foo <i>bar</i>]
5485 [fool's] errand
5486 [fool's errand]
5487 [foo]
5488 [foo bar]
5489 [foo <i>bar</i>]
5490 [fool's] errand
5491 [fool's errand]
5492 [url=foo]
5493 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5494 [http:// bare protocols don't count]
5495 </p>
5496 !! html/parsoid
5497 <p>[foo]
5498 [foo bar]
5499 [foo <i>bar</i>]
5500 [fool's] errand
5501 [fool's errand]
5502 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5503 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5504 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5505 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5506 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5507 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5508 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5509 [http:// bare protocols don't count]</p>
5510 !! end
5511
5512 !! test
5513 Percent encoding in external links
5514 !! wikitext
5515 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5516 !! html/php
5517 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5518 </p>
5519 !! html/parsoid
5520 <p><a rel="mw:ExtLink"
5521 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5522 !! end
5523
5524 !! test
5525 Use url link syntax for links where the content is equal the link target
5526 !! wikitext
5527 http://example.com
5528 !! html/php
5529 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5530 </p>
5531 !! html/parsoid
5532 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5533 !! end
5534
5535 !! test
5536 Parenthesis in external links, especially URL links
5537 !! wikitext
5538 http://example.com)
5539
5540 http://example.com/test)
5541
5542 http://example.com/(test)
5543
5544 http://example.com/((test)
5545
5546 (http://example.com/(test))
5547
5548 (http://example.com/(test)))))
5549
5550 http://example.com/a)b
5551
5552 [http://example.com) foo]
5553 !! html/php
5554 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5555 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5556 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5557 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5558 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5559 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5560 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5561 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5562 </p>
5563 !! html/parsoid
5564 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5565 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5566 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5567 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5568 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5569 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5570 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5571 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5572 !! end
5573
5574 !! test
5575 Parenthesis in external links, w/ transclusion or comment
5576 !! wikitext
5577 (http://example.com/{{echo|hi}})
5578
5579 (http://example.com<!-- hi -->)
5580 !! html/php
5581 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5582 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5583 </p>
5584 !! html/parsoid
5585 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5586
5587 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5588 !! end
5589
5590 !! test
5591 Serialize <a> tags with invalid link targets as plain text
5592 !! options
5593 parsoid=html2wt
5594 !! html/parsoid
5595 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5596 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5597 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5598 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5599 !! wikitext
5600 text
5601 <nowiki>*</nowiki>text
5602 <nowiki>[[foo]]</nowiki>
5603 <nowiki>*a [[foo]]</nowiki>
5604 !! end
5605
5606 !! test
5607 mw:ExtLink -vs- mw:WikiLink (T94723)
5608 !! options
5609 parsoid=html2wt
5610 !! html/parsoid
5611 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5612 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5613 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5614 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5615 <p>
5616 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5617 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5618 </p>
5619 !! wikitext
5620 [[Foo|Bar]]
5621 [[Foo|Bar]]
5622 [[wikipedia:Foo|Bar]]
5623 [[wikipedia:Foo|Bar]]
5624
5625 [[wikipedia:European_Robin|European Robin]]
5626 [[wikipedia:European_Robin|European Robin]]
5627 !! end
5628
5629 !! test
5630 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5631 !! options
5632 parsoid=wt2wt
5633 !! wikitext
5634 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5635 !! html/parsoid
5636 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5637 !! end
5638
5639
5640 ###
5641 ### Quotes
5642 ###
5643
5644 !! test
5645 Quotes
5646 !! wikitext
5647 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5648
5649 Normal text. '''''Bold italic text.''''' Normal text.
5650 !! html
5651 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5652 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5653 </p>
5654 !! end
5655
5656
5657 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5658 # parser strips. The wikitext contains just the first half of the bold
5659 # quote pair.
5660 !! test
5661 Unclosed and unmatched quotes
5662 !! wikitext
5663 '''''Bold italic text '''with bold deactivated''' in between.'''''
5664
5665 '''''Bold italic text ''with italic deactivated'' in between.'''''
5666
5667 '''Bold text..
5668
5669 ..spanning two paragraphs (should not work).'''
5670
5671 '''Bold tag left open
5672
5673 ''Italic tag left open
5674
5675 Normal text.
5676
5677 <!-- Unmatching number of opening, closing tags: -->
5678 '''This year''''s election ''should'' beat '''last year''''s.
5679
5680 ''Tom'''s car is bigger than ''Susan'''s.
5681
5682 Plain ''italic'''s plain
5683 !! html/php
5684 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5685 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5686 </p><p><b>Bold text..</b>
5687 </p><p>..spanning two paragraphs (should not work).
5688 </p><p><b>Bold tag left open</b>
5689 </p><p><i>Italic tag left open</i>
5690 </p><p>Normal text.
5691 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5692 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5693 </p><p>Plain <i>italic'</i>s plain
5694 </p>
5695 !! html/parsoid
5696 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5697 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5698 </p><p><b>Bold text..</b>
5699 </p><p>..spanning two paragraphs (should not work).<b></b>
5700 </p><p><b>Bold tag left open</b>
5701 </p><p><i>Italic tag left open</i>
5702 </p><p>Normal text.
5703 </p>
5704 <!-- Unmatching number of opening, closing tags: -->
5705 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5706 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5707 </p><p>Plain <i>italic'</i>s plain
5708 </p>
5709 !! end
5710
5711 ###
5712 ### Tables
5713 ###
5714 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5715 ###
5716
5717 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5718 # is the bare minimum required by the spec, see:
5719 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5720 # Parsoid team replies: empty table tags are legal in HTML5
5721 !! test
5722 A table with no data.
5723 !! options
5724 parsoid=wt2html
5725 !! wikitext
5726 {||}
5727 !! html/php
5728
5729 !! html/parsoid
5730 <table></table>
5731
5732 !! end
5733
5734 !! test
5735 A table with stray table end tags on start tag line (wt2html)
5736 !! options
5737 parsoid=wt2html
5738 !! wikitext
5739 {|style="color: red;"|}
5740
5741 {|style="color: red;" |}
5742 |foo
5743 |}
5744
5745 {|style="color: red;"|} id="foo"
5746 |foo
5747 |}
5748
5749 {|style="color: red;" |} id="foo"
5750 |foo
5751 |}
5752 !! html
5753 <table style="color: red;"></table>
5754
5755 <table style="color: red;">
5756 <tbody><tr>
5757 <td>foo</td>
5758 </tr></tbody>
5759 </table>
5760
5761 <table style="color: red;" id="foo">
5762 <tbody><tr>
5763 <td>foo</td>
5764 </tr></tbody>
5765 </table>
5766
5767 <table style="color: red;" id="foo">
5768 <tbody><tr>
5769 <td>foo</td>
5770 </tr></tbody>
5771 </table>
5772
5773 !! end
5774
5775 !! test
5776 A table with no data (take 2)
5777 !! wikitext
5778 {|
5779 |}
5780 !! html/parsoid
5781 <table></table>
5782 !! end
5783
5784 # A table with nothing but a caption is invalid XHTML, we might want to render
5785 # this as <p>caption</p>
5786 # Parsoid team replies: table with only a caption is legal in HTML5
5787 !! test
5788 A table with nothing but a caption
5789 !! wikitext
5790 {|
5791 |+ caption
5792 |}
5793 !! html/php
5794 <table>
5795 <caption> caption
5796 </caption><tr><td></td></tr></table>
5797
5798 !! html/parsoid
5799 <table><caption> caption</caption></table>
5800 !! end
5801
5802 !! test
5803 A table with caption with default-spaced attributes and a table row
5804 !! wikitext
5805 {|
5806 |+ style="color: red;" | caption1
5807 |-
5808 | foo
5809 |}
5810 !! html
5811 <table>
5812 <caption style="color: red;"> caption1
5813 </caption>
5814 <tr>
5815 <td> foo
5816 </td></tr></table>
5817
5818 !! end
5819
5820 !! test
5821 A table with captions with non-default spaced attributes and a table row
5822 !! wikitext
5823 {|
5824 |+style="color: red;"|caption2
5825 |+ style="color: red;"| caption3
5826 |-
5827 | foo
5828 |}
5829 !! html
5830 <table>
5831 <caption style="color: red;">caption2
5832 </caption>
5833 <caption style="color: red;"> caption3
5834 </caption>
5835 <tr>
5836 <td> foo
5837 </td></tr></table>
5838
5839 !! end
5840
5841 !! test
5842 Table td-cell syntax variations
5843 !! wikitext
5844 {|
5845 | foo bar foo | baz
5846 | foo bar foo || baz
5847 | style='color:red;' | baz
5848 | style='color:red;' || baz
5849 |}
5850 !! html
5851 <table>
5852 <tr>
5853 <td> baz
5854 </td>
5855 <td> foo bar foo </td>
5856 <td> baz
5857 </td>
5858 <td style="color:red;"> baz
5859 </td>
5860 <td> style='color:red;' </td>
5861 <td> baz
5862 </td></tr></table>
5863
5864 !! end
5865
5866 !! test
5867 Simple table
5868 !! wikitext
5869 {|
5870 | 1 || 2
5871 |-
5872 | 3 || 4
5873 |}
5874 !! html
5875 <table>
5876 <tr>
5877 <td> 1 </td>
5878 <td> 2
5879 </td></tr>
5880 <tr>
5881 <td> 3 </td>
5882 <td> 4
5883 </td></tr></table>
5884
5885 !! end
5886
5887 !! test
5888 Simple table but with multiple dashes for row wikitext
5889 !! wikitext
5890 {|
5891 | foo
5892 |-----
5893 | bar
5894 |}
5895 !! html
5896 <table>
5897 <tr>
5898 <td> foo
5899 </td></tr>
5900 <tr>
5901 <td> bar
5902 </td></tr></table>
5903
5904 !! end
5905
5906 !! test
5907 Multiplication table
5908 !! wikitext
5909 {| border="1" cellpadding="2"
5910 |+Multiplication table
5911 |-
5912 ! &times; !! 1 !! 2 !! 3
5913 |-
5914 ! 1
5915 | 1 || 2 || 3
5916 |-
5917 ! 2
5918 | 2 || 4 || 6
5919 |-
5920 ! 3
5921 | 3 || 6 || 9
5922 |-
5923 ! 4
5924 | 4 || 8 || 12
5925 |-
5926 ! 5
5927 | 5 || 10 || 15
5928 |}
5929 !! html
5930 <table border="1" cellpadding="2">
5931 <caption>Multiplication table
5932 </caption>
5933 <tr>
5934 <th> &#215; </th>
5935 <th> 1 </th>
5936 <th> 2 </th>
5937 <th> 3
5938 </th></tr>
5939 <tr>
5940 <th> 1
5941 </th>
5942 <td> 1 </td>
5943 <td> 2 </td>
5944 <td> 3
5945 </td></tr>
5946 <tr>
5947 <th> 2
5948 </th>
5949 <td> 2 </td>
5950 <td> 4 </td>
5951 <td> 6
5952 </td></tr>
5953 <tr>
5954 <th> 3
5955 </th>
5956 <td> 3 </td>
5957 <td> 6 </td>
5958 <td> 9
5959 </td></tr>
5960 <tr>
5961 <th> 4
5962 </th>
5963 <td> 4 </td>
5964 <td> 8 </td>
5965 <td> 12
5966 </td></tr>
5967 <tr>
5968 <th> 5
5969 </th>
5970 <td> 5 </td>
5971 <td> 10 </td>
5972 <td> 15
5973 </td></tr></table>
5974
5975 !! end
5976
5977 !! test
5978 Accept "||" in table headings
5979 !! wikitext
5980 {|
5981 !h1 || h2
5982 |}
5983 !! html
5984 <table>
5985 <tr>
5986 <th>h1 </th>
5987 <th> h2
5988 </th></tr></table>
5989
5990 !! end
5991
5992 !! test
5993 Accept "!!" in table data
5994 !! wikitext
5995 {|
5996 | Foo!! ||
5997 |}
5998 !! html
5999 <table>
6000 <tr>
6001 <td> Foo!! </td>
6002 <td>
6003 </td></tr></table>
6004
6005 !! html/parsoid
6006 <table>
6007 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6008 </tbody></table>
6009 !! end
6010
6011 !! test
6012 Accept "||" in indented table headings
6013 !! wikitext
6014 :{|
6015 !h1 || h2
6016 |}
6017 !! html
6018 <dl><dd><table>
6019 <tr>
6020 <th>h1 </th>
6021 <th> h2
6022 </th></tr></table></dd></dl>
6023
6024 !! end
6025
6026 !! test
6027 Accept "!!" in templates
6028 !! wikitext
6029 {|
6030 !a {{echo|b!!c}}
6031 |}
6032 !! html/php
6033 <table>
6034 <tr>
6035 <th>a b</th>
6036 <th>c
6037 </th></tr></table>
6038
6039 !! html/parsoid
6040 <table>
6041 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6042 !! end
6043
6044 !! test
6045 Accept "!!" in table headings after newline
6046 !! wikitext
6047 {|
6048 !a
6049 b!!c
6050 |}
6051 !! html/php
6052 <table>
6053 <tr>
6054 <th>a
6055 <p>b!!c
6056 </p>
6057 </th></tr></table>
6058
6059 !! html/parsoid
6060 <table>
6061 <tbody><tr><th>a
6062 <p>b!!c</p></th></tr>
6063 </tbody></table>
6064 !! end
6065
6066 !! test
6067 Accept "!!" in table data of mixed wikitext / html syntax
6068 !! wikitext
6069 {|
6070 !a
6071 <tr><td>b!!c</td></tr>
6072 |}
6073 !! html+tidy
6074 <table>
6075 <tr>
6076 <th>a</th>
6077 </tr>
6078 <tr>
6079 <td>b!!c</td>
6080 </tr>
6081 </table>
6082 !! html/parsoid
6083 <table>
6084 <tbody><tr><th>a</th></tr>
6085 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6086 </tbody></table>
6087 !! end
6088
6089 !! test
6090 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6091 !! wikitext
6092 {|
6093 !| h1
6094 || a
6095 |}
6096 !! html
6097 <table>
6098 <tr>
6099 <th> h1
6100 </th>
6101 <td> a
6102 </td></tr></table>
6103
6104 !! end
6105
6106 !!test
6107 Accept "| !" at start of line in tables (ignore !-attribute)
6108 !! wikitext
6109 {|
6110 |-
6111 | !style="color:red" | bar
6112 |}
6113 !! html
6114 <table>
6115
6116 <tr>
6117 <td> bar
6118 </td></tr></table>
6119
6120 !!end
6121
6122 !!test
6123 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6124 !! wikitext
6125 {|
6126 |-
6127 |style='color:red;'|+1
6128 |style='color:blue;'|-1
6129 |-
6130 | 1 || 2 || 3
6131 | 1 ||+2 ||-3
6132 |-
6133 | +1
6134 | -1
6135 |}
6136 !! html
6137 <table>
6138
6139 <tr>
6140 <td style="color:red;">+1
6141 </td>
6142 <td style="color:blue;">-1
6143 </td></tr>
6144 <tr>
6145 <td> 1 </td>
6146 <td> 2 </td>
6147 <td> 3
6148 </td>
6149 <td> 1 </td>
6150 <td>+2 </td>
6151 <td>-3
6152 </td></tr>
6153 <tr>
6154 <td> +1
6155 </td>
6156 <td> -1
6157 </td></tr></table>
6158
6159 !!end
6160
6161 !! test
6162 Table rowspan
6163 !! wikitext
6164 {| border=1
6165 | Cell 1, row 1
6166 |rowspan=2| Cell 2, row 1 (and 2)
6167 | Cell 3, row 1
6168 |-
6169 | Cell 1, row 2
6170 | Cell 3, row 2
6171 |}
6172 !! html
6173 <table border="1">
6174 <tr>
6175 <td> Cell 1, row 1
6176 </td>
6177 <td rowspan="2"> Cell 2, row 1 (and 2)
6178 </td>
6179 <td> Cell 3, row 1
6180 </td></tr>
6181 <tr>
6182 <td> Cell 1, row 2
6183 </td>
6184 <td> Cell 3, row 2
6185 </td></tr></table>
6186
6187 !! end
6188
6189 !! test
6190 Nested table
6191 !! wikitext
6192 {| border=1
6193 | &alpha;
6194 |
6195 {| bgcolor=#ABCDEF border=2
6196 |nested
6197 |-
6198 |table
6199 |}
6200 |the original table again
6201 |}
6202 !! html
6203 <table border="1">
6204 <tr>
6205 <td> &#945;
6206 </td>
6207 <td>
6208 <table bgcolor="#ABCDEF" border="2">
6209 <tr>
6210 <td>nested
6211 </td></tr>
6212 <tr>
6213 <td>table
6214 </td></tr></table>
6215 </td>
6216 <td>the original table again
6217 </td></tr></table>
6218
6219 !! end
6220
6221 !! test
6222 Invalid attributes in table cell (bug 1830)
6223 !! wikitext
6224 {|
6225 |Cell:|broken
6226 |}
6227 !! html
6228 <table>
6229 <tr>
6230 <td>broken
6231 </td></tr></table>
6232
6233 !! end
6234
6235 !! test
6236 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6237 !! wikitext
6238 {|
6239 | title="foo" |bar
6240 | title="foo<nowiki>|</nowiki>" |bar
6241 | title="foo<nowiki>|</nowiki>" bar
6242 |}
6243 !! html
6244 <table>
6245 <tr>
6246 <td title="foo">bar
6247 </td>
6248 <td title="foo&#124;">bar
6249 </td>
6250 <td> title="foo|" bar
6251 </td></tr></table>
6252
6253 !! end
6254
6255 # The "|}" to close the table is missing from the input, so parsoid's
6256 # *2wt modes will fail.
6257 !! test
6258 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6259 !! options
6260 parsoid=wt2html,html2html
6261 !! wikitext
6262 {|
6263 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6264 !! html/php
6265 <table>
6266 <tr>
6267 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6268 <td>]" onmouseover="alert(document.cookie)"&gt;test
6269 </td>
6270 </tr>
6271 </table>
6272
6273 !! html/parsoid
6274 <table><tbody>
6275 <tr>
6276 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6277 !! end
6278
6279 # FIXME: The php output is broken.
6280 !! test
6281 ! and || in td attributes should not be parsed as <th>/<td>
6282 !! wikitext
6283 {|
6284 | style="color: red !important;" data-contrived="put this here ||" | foo
6285 |}
6286 !! html/php
6287 <table>
6288 <tr>
6289 <td> style="color: red !important;" data-contrived="put this here </td>
6290 <td> foo
6291 </td></tr></table>
6292
6293 !! html/parsoid
6294 <table>
6295 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6296 </tbody></table>
6297 !! end
6298
6299 !! test
6300 Indented table markup mixed with indented pre content (proposed in bug 6200)
6301 !! wikitext
6302 <table>
6303 <tr>
6304 <td>
6305 Text that should be rendered preformatted
6306 </td>
6307 </tr>
6308 </table>
6309 !! html
6310 <table>
6311 <tr>
6312 <td>
6313 <pre>Text that should be rendered preformatted
6314 </pre>
6315 </td>
6316 </tr>
6317 </table>
6318
6319 !! end
6320
6321 !! test
6322 1. Template-generated table cell attributes and cell content
6323 !! wikitext
6324 {|
6325 |{{table_attribs}}
6326 | {{table_attribs}}
6327 || {{table_attribs_5}}
6328 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6329 |align=center {{table_attribs}}
6330 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6331 |}
6332 !! html
6333 <table>
6334 <tr>
6335 <td style="color:red;">Foo
6336 </td>
6337 <td style="color:red;">Foo
6338 </td>
6339 <td> style="color:red;"</td>
6340 <td>Bar
6341 </td>
6342 <td style="color:red;">Foo
6343 </td>
6344 <td align="center" style="color:red;">Foo
6345 </td>
6346 <td align="center" style="color:red;">Foo
6347 </td></tr></table>
6348
6349 !! end
6350
6351 !! test
6352 2. Template-generated table cell attributes and cell content
6353 !! wikitext
6354 {|
6355 |{{table_attribs_2}}
6356 |}
6357 !! html/php
6358 <table>
6359 <tr>
6360 <td style="color:red;">Foo
6361 </td>
6362 <td>Bar</td>
6363 <td>Baz
6364 </td></tr></table>
6365
6366 !! html/parsoid
6367 <table>
6368 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6369 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6370 </tbody></table>
6371 !! end
6372
6373 !! test
6374 3. Template-generated table cell attributes and cell content
6375 !! wikitext
6376 {|
6377 !align=center {{table_header_cells}}
6378 |-
6379 |align=center {{table_cells}}
6380 |}
6381 !! html/php
6382 <table>
6383 <tr>
6384 <th align="center" style="color:red;">Foo</th>
6385 <th style="color:red;"><i>Bar</i></th>
6386 <th style="color:brown;"><i>Foo</i> and Baz
6387 </th></tr>
6388 <tr>
6389 <td align="center" style="color:red;">Foo</td>
6390 <td style="color:red;"><i>Bar</i></td>
6391 <td style="color:brown;"><i>Foo</i> and Baz
6392 </td></tr></table>
6393
6394 !! html/parsoid
6395 <table>
6396 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6397 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6398 </tbody></table>
6399 !! end
6400
6401 !! test
6402 4. Template-generated table cell attributes and cell content inside a templated table
6403 !! wikitext
6404 {{tbl-start}}
6405 !align=center {{table_header_cells}}
6406 |-
6407 |align=center {{table_cells}}
6408 {{tbl-end}}
6409 !! html/php
6410 <table>
6411 <tr>
6412 <th align="center" style="color:red;">Foo</th>
6413 <th style="color:red;"><i>Bar</i></th>
6414 <th style="color:brown;"><i>Foo</i> and Baz
6415 </th></tr>
6416 <tr>
6417 <td align="center" style="color:red;">Foo</td>
6418 <td style="color:red;"><i>Bar</i></td>
6419 <td style="color:brown;"><i>Foo</i> and Baz
6420 </td></tr></table>
6421
6422 !! html/parsoid
6423 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6424 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6425 <tr>
6426 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6427 </tbody></table>
6428 !! end
6429
6430 ## Edge case fix to prevent future regressions
6431 !! test
6432 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6433 !! wikitext
6434 {|
6435 |{{table_attribs_7}}
6436 |}
6437 <references />
6438 !! html/parsoid
6439 <table>
6440 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6441 </tbody></table>
6442 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6443 !! end
6444
6445 !! test
6446 Table with row followed by newlines and table heading
6447 !! wikitext
6448 {|
6449 |-
6450
6451 ! foo
6452 |}
6453 !! html
6454 <table>
6455
6456
6457 <tr>
6458 <th> foo
6459 </th></tr></table>
6460
6461 !! end
6462
6463 !! test
6464 Table with empty line following the start tag
6465 !! wikitext
6466 {|
6467
6468 |-
6469 | foo
6470 |}
6471 !! html
6472 <table>
6473
6474
6475 <tr>
6476 <td> foo
6477 </td></tr></table>
6478
6479 !! end
6480
6481 # FIXME: Preserve the attribute properly (with an empty string as value) in
6482 # the PHP parser. Parsoid implements the behavior below.
6483 !! test
6484 Table attributes with empty value
6485 !! wikitext
6486 {|
6487 | style=| hello
6488 |}
6489 !! html/parsoid
6490 <table>
6491 <tbody>
6492 <tr>
6493 <td style=""> hello
6494 </td></tr></tbody></table>
6495
6496 !! end
6497
6498 !! test
6499 Wikitext table with a lot of comments
6500 !! wikitext
6501 {|
6502 <!-- c0 -->
6503 | foo
6504 <!-- c1 -->
6505 |-<!-- c2 -->
6506 <!-- c3 -->
6507 |<!-- c4 -->
6508 <!-- c5 -->
6509 |}
6510 !! html
6511 <table>
6512 <tr>
6513 <td> foo
6514 </td></tr>
6515 <tr>
6516 <td>
6517 </td></tr></table>
6518
6519 !! end
6520
6521 !! test
6522 Wikitext table comments represented in parsoid dom
6523 !! wikitext
6524 {|<!--c1--><!--c2-->
6525 |-<!--c3-->
6526 | x
6527 |}
6528 !! html/php+tidy
6529 <table>
6530 <tr>
6531 <td>x</td>
6532 </tr>
6533 </table>
6534 !! html/parsoid
6535 <table><!--c1--><!--c2-->
6536 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6537 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6538 </tbody></table>
6539 !! end
6540
6541 !! test
6542 Wikitext table with double-line table cell
6543 !! wikitext
6544 {|
6545 |a
6546 b
6547 |}
6548 !! html
6549 <table>
6550 <tr>
6551 <td>a
6552 <p>b
6553 </p>
6554 </td></tr></table>
6555
6556 !! end
6557
6558 !! test
6559 Table cell with a single comment
6560 !! wikitext
6561 {|
6562 | <!-- c1 -->
6563 | a
6564 |}
6565 !! html
6566 <table>
6567 <tr>
6568 <td>
6569 </td>
6570 <td> a
6571 </td></tr></table>
6572
6573 !! end
6574
6575 !! test
6576 Table-cell after a comment-only-empty-line
6577 !! wikitext
6578 {|
6579 |a
6580 <!--c1-->
6581 <!--c2-->| b
6582 |}
6583 !! html
6584 <table>
6585 <tr>
6586 <td>a
6587 </td>
6588 <td> b
6589 </td></tr></table>
6590
6591 !! html/parsoid
6592 <table>
6593 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6594 <!--c1-->
6595 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6596 </tbody></table>
6597
6598 !! end
6599
6600 !! test
6601 Build table with {{!}}
6602 !! wikitext
6603 {{{!}} class="wikitable"
6604 ! header
6605 ! second header
6606 {{!}}- style="color:red;"
6607 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6608 {{!}}}
6609 !! html
6610 <table class="wikitable">
6611 <tr>
6612 <th> header
6613 </th>
6614 <th> second header
6615 </th></tr>
6616 <tr style="color:red;">
6617 <td> data </td>
6618 <td style="color:red;"> second data
6619 </td></tr></table>
6620
6621 !! end
6622
6623 !! test
6624 Build table with pipe as data
6625 !! wikitext
6626 {| class="wikitable"
6627 ! header
6628 ! second header
6629 |- style="color:red;"
6630 | data || style="color:red;" | second data
6631 |-
6632 | style="color:red;" | data with | || style="color:red;" | second data with |
6633 |-
6634 || data with | ||| second data with |
6635 |}
6636 !! html
6637 <table class="wikitable">
6638 <tr>
6639 <th> header
6640 </th>
6641 <th> second header
6642 </th></tr>
6643 <tr style="color:red;">
6644 <td> data </td>
6645 <td style="color:red;"> second data
6646 </td></tr>
6647 <tr>
6648 <td style="color:red;"> data with | </td>
6649 <td style="color:red;"> second data with |
6650 </td></tr>
6651 <tr>
6652 <td> data with | </td>
6653 <td> second data with |
6654 </td></tr></table>
6655
6656 !! end
6657
6658 !! test
6659 Build table with wikilink
6660 !! wikitext
6661 {| class="wikitable"
6662 ! header || second header
6663 |- style="color:red;"
6664 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6665 |-
6666 | data || second data [[Main Page|link|text with pipe]]
6667 |}
6668 !! html
6669 <table class="wikitable">
6670 <tr>
6671 <th> header </th>
6672 <th> second header
6673 </th></tr>
6674 <tr style="color:red;">
6675 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6676 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6677 </td></tr>
6678 <tr>
6679 <td> data </td>
6680 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6681 </td></tr></table>
6682
6683 !! end
6684
6685 # The expected HTML structure in this test is debatable. The PHP parser does
6686 # not parse this kind of table at all. The main focus for Parsoid is on
6687 # round-tripping, so this output is ok for now. TODO: revisit!
6688 !! test
6689 Wikitext table with html-syntax row
6690 !! wikitext
6691 {|
6692 |-
6693 <td>foo</td>
6694 |}
6695 !! html/parsoid
6696 <table>
6697 <tbody>
6698 <tr>
6699 <td>foo</td></tr></tbody></table>
6700 !! end
6701
6702 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6703 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6704 ## PHP parser, which tidy then compounds by fostering the content
6705 ## entirely out of the table. Parsoid recognizes the table context
6706 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6707 ## depends on PHP's treatment of broken table markup!
6708 !! test
6709 Implicit <td> after a |-
6710 !! options
6711 parsoid=wt2html,html2html
6712 !! wikitext
6713 {|
6714 |-
6715 a
6716 |}
6717 !! html/php
6718 <table>
6719
6720 a
6721 </table>
6722
6723 !! html/php+tidy
6724 <p>a</p>
6725 !! html/parsoid
6726 <table>
6727 <tr><td>a</td></tr>
6728 </table>
6729 !! end
6730
6731 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6732 !! test
6733 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6734 !! options
6735 parsoid=wt2html,html2html
6736 !! wikitext
6737 {|
6738 |-
6739 |
6740 a
6741 |-
6742 b
6743 |}
6744 !! html/php
6745 <table>
6746
6747 <tr>
6748 <td>
6749 <pre>a
6750 </pre>
6751 </td></tr>
6752 b
6753 </table>
6754
6755 !! html/php+tidy
6756 <p>b</p>
6757 <table>
6758 <tr>
6759 <td>
6760 <pre>
6761 a
6762 </pre></td>
6763 </tr>
6764 </table>
6765 !! html/parsoid
6766 <table>
6767 <tbody>
6768 <tr><td><pre>a</pre></td></tr>
6769 <tr><td> b</td></tr>
6770 </tbody>
6771 </table>
6772 !! end
6773
6774 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6775 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6776 !! test
6777 Lists should be recognized in an implicit <td> context
6778 !! options
6779 parsoid=wt2html,html2html
6780 !! wikitext
6781 {|
6782 |-
6783 *a
6784 |}
6785 !! html/php
6786 <table>
6787
6788 <ul><li>a</li></ul>
6789 </table>
6790
6791 !! html/php+tidy
6792 <ul>
6793 <li>a</li>
6794 </ul>
6795 !! html/parsoid
6796 <table>
6797 <tr>
6798 <td><ul>
6799 <li>a</li>
6800 </ul></td>
6801 </tr>
6802 </table>
6803 !! end
6804
6805 !! test
6806 Table cells not properly parsed in an implicit-td context
6807 !! wikitext
6808 {|
6809 |-
6810 {{table_attribs_4}} || a || b
6811 |}
6812 !! html/php+tidy
6813 <table>
6814 <tr>
6815 <td style="background-color:#DC241f;" width="10px"></td>
6816 <td>a</td>
6817 <td>b</td>
6818 </tr>
6819 </table>
6820 !! html/parsoid
6821 <table>
6822 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6823 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6824 </tbody></table>
6825 !! end
6826
6827 !! test
6828 Parsoid: Round-trip tables directly followed by content (bug 51219)
6829 !! options
6830 parsoid=wt2html,wt2wt
6831 !! wikitext
6832 {|
6833 |foo
6834 |} bar
6835
6836 {|
6837 |baz
6838 |}<b>quux</b>
6839 !! html+tidy
6840 <table>
6841 <tr>
6842 <td>foo</td>
6843 </tr>
6844 </table>
6845 <p>bar</p>
6846 <table>
6847 <tr>
6848 <td>baz</td>
6849 </tr>
6850 </table>
6851 <p><b>quux</b></p>
6852 !! end
6853
6854 !! test
6855 Parsoid: Default to a newline after tables in new content (bug 51219)
6856 !! options
6857 parsoid=html2wt
6858 !! html/parsoid
6859 <table><tbody>
6860 <tr><td>foo</td></tr></tbody></table> bar
6861 <table><tbody>
6862 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6863 !! wikitext
6864 {|
6865 |foo
6866 |}
6867 <nowiki> </nowiki>bar
6868 {|
6869 |baz
6870 |}
6871 '''quux'''
6872 !! end
6873
6874 !! test
6875 Parsoid: newline inducing block nodes don't suppress <nowiki>
6876 !! options
6877 parsoid=html2wt
6878 !! html/parsoid
6879 a<h1>foo</h1>
6880 !! wikitext
6881 <nowiki> </nowiki>a
6882
6883 = foo =
6884 !! end
6885
6886 !! test
6887 Parsoid: Row-syntax table headings followed by comment & table cells
6888 !! options
6889 parsoid=wt2html,wt2wt
6890 !! wikitext
6891 {|
6892 ! foo || bar
6893 <!-- foo --> || baz || quux
6894 |}
6895 !! html/php
6896 <table>
6897 <tr>
6898 <th> foo </th>
6899 <th> bar
6900 </th>
6901 <td> baz </td>
6902 <td> quux
6903 </td></tr></table>
6904
6905 !! html/parsoid
6906 <table>
6907 <tbody><tr><th> foo </th><th> bar
6908 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6909 </tbody></table>
6910 !! end
6911
6912 !!test
6913 Parsoid: Recover better from broken table attributes
6914 !!options
6915 parsoid=wt2html
6916 !!wikitext
6917 {| class="foo
6918 | class="bar" |
6919 foo
6920 |}
6921 !!html/php+tidy
6922 <table class="foo">
6923 <tr>
6924 <td class="bar">
6925 <p>foo</p>
6926 </td>
6927 </tr>
6928 </table>
6929 !!html/parsoid
6930 <table class="foo">
6931 <tr>
6932 <td class="bar">
6933 <p>foo</p></td></tr>
6934 </tbody></table>
6935 !!end
6936
6937 !! test
6938 Strip unsupported table tags
6939 !! options
6940 parsoid=html2wt
6941 !! html/parsoid
6942 <table>
6943 <thead>
6944 <tr>
6945 <th>Month</th>
6946 <th>Savings</th>
6947 </tr>
6948 </thead>
6949 <tbody>
6950 <tr>
6951 <td>January</td>
6952 <td>$100</td>
6953 </tr>
6954 <tr>
6955 <td>February</td>
6956 <td>$80</td>
6957 </tr>
6958 </tbody>
6959 <tfoot>
6960 <tr>
6961 <td>Sum</td>
6962 <td>$180</td>
6963 </tr>
6964 </tfoot>
6965 </table>
6966 !! wikitext
6967 {|
6968
6969 !Month
6970 !Savings
6971
6972 |January
6973 |$100
6974
6975 |-
6976 |February
6977 |$80
6978
6979 |Sum
6980 |$180
6981
6982 |}
6983 !! end
6984
6985 !!test
6986 Testing serialization after deletion of table cells
6987 !!options
6988 parsoid={
6989 "modes": ["wt2wt", "selser"],
6990 "changes": [
6991 ["#x", "remove"]
6992 ]
6993 }
6994 !!wikitext
6995 {|
6996 !h1 !!h2 !!h3
6997 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6998 |}
6999 !! wikitext/edited
7000 {|
7001 !h1 !!h2 !!h3
7002 |c2 |||c3
7003 |}
7004 !!end
7005
7006 ###
7007 ### Internal links
7008 ###
7009 !! test
7010 Plain link, capitalized
7011 !! wikitext
7012 [[Main Page]]
7013 !! html
7014 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7015 </p>
7016 !! end
7017
7018 !! test
7019 Plain link, uncapitalized
7020 !! wikitext
7021 [[main Page]]
7022 !! html
7023 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7024 </p>
7025 !! end
7026
7027 !! test
7028 Piped link
7029 !! wikitext
7030 [[Main Page|The Main Page]]
7031 !! html
7032 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7033 </p>
7034 !! end
7035
7036 !! test
7037 Piped link with comment in link text
7038 !! wikitext
7039 [[Main Page|The Main<!--front--> Page]]
7040 !! html
7041 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7042 </p>
7043 !! end
7044
7045 !! test
7046 Piped link with multiple pipe characters in link text
7047 !! wikitext
7048 [[Main Page||The|Main|Page|]]
7049 !! html/php
7050 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7051 </p>
7052 !! html/parsoid
7053 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7054 !! end
7055
7056 !! test
7057 Broken link
7058 !! wikitext
7059 [[Zigzagzogzagzig]]
7060 !! html
7061 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7062 </p>
7063 !! end
7064
7065 !! test
7066 Broken link with fragment
7067 !! wikitext
7068 [[Zigzagzogzagzig#zug]]
7069 !! html
7070 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7071 </p>
7072 !! end
7073
7074 !! test
7075 Special page link with fragment
7076 !! wikitext
7077 [[Special:Version#anchor]]
7078 !! html
7079 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7080 </p>
7081 !! end
7082
7083 !! test
7084 Nonexistent special page link with fragment
7085 !! wikitext
7086 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7087 !! html
7088 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7089 </p>
7090 !! end
7091
7092 !! test
7093 Link with prefix
7094 !! wikitext
7095 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7096 !! html
7097 <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>
7098 </p>
7099 !! end
7100
7101 !! test
7102 Link with suffix
7103 !! wikitext
7104 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7105 !! html
7106 <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>!!!
7107 </p>
7108 !! end
7109
7110 !! article
7111 prefixed article
7112 !! text
7113 Some text
7114 !! endarticle
7115
7116 !! test
7117 Bug 43661: Piped links with identical prefixes
7118 !! wikitext
7119 [[prefixed article|prefixed articles with spaces]]
7120
7121 [[prefixed article|prefixed articlesaoeu]]
7122
7123 [[Main Page|Main Page test]]
7124 !! html
7125 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7126 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7127 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7128 </p>
7129 !! end
7130
7131
7132 !! test
7133 Link with HTML entity in suffix / tail
7134 !! wikitext
7135 [[Main Page]]&quot;, [[Main Page]]&#97;
7136 !! html/php
7137 <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;
7138 </p>
7139 !! html/parsoid
7140 <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>
7141 !! end
7142
7143 !! test
7144 Link with 3 brackets
7145 !! wikitext
7146 [[[Main Page]]]
7147 !! html
7148 <p>[[[Main Page]]]
7149 </p>
7150 !! end
7151
7152 !! test
7153 Link with 4 brackets
7154 !! wikitext
7155 [[[[Main Page]]]]
7156 !! html
7157 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7158 </p>
7159 !! end
7160
7161 !! test
7162 Piped link with 3 brackets
7163 !! wikitext
7164 [[[main page|the main page]]]
7165 !! html
7166 <p>[[[main page|the main page]]]
7167 </p>
7168 !! end
7169
7170 !! test
7171 Piped link with extlink-like text
7172 !! wikitext
7173 [[Main Page|[bar]]]
7174 [[Main Page|This is a [bar]]]
7175 !! html/php
7176 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7177 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7178 </p>
7179 !! html/parsoid
7180 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7181 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7182 !! end
7183
7184 !! test
7185 Link with multiple pipes
7186 !! wikitext
7187 [[Main Page|The|Main|Page]]
7188 !! html
7189 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7190 </p>
7191 !! end
7192
7193 # Note that parsoid does not munge anchor text; all non-space
7194 # characters are valid in HTML5 ids.
7195 !! test
7196 Anchor containing a #. (bug 63430)
7197 !! wikitext
7198 [[Main Page#And#Link]]
7199 !! html/php
7200 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7201 </p>
7202 !! html/parsoid
7203 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7204 !! end
7205
7206 !! test
7207 Link to namespaces
7208 !! wikitext
7209 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7210 !! html
7211 <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>
7212 </p>
7213 !! end
7214
7215 !! test
7216 Link with space in namespace
7217 !! wikitext
7218 [[User talk:Foo bar]]
7219 !! html
7220 <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>
7221 </p>
7222 !! end
7223
7224 !! article
7225 MemoryAlpha:AlphaTest
7226 !! text
7227 This is an article in the MemoryAlpha namespace
7228 (which shadows the memoryalpha interwiki link).
7229 !! endarticle
7230
7231 !! test
7232 Namespace takes precedence over interwiki link (bug 51680)
7233 !! wikitext
7234 [[MemoryAlpha:AlphaTest]]
7235 !! html
7236 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7237 </p>
7238 !! end
7239
7240 # The previous test doesn't work correctly in html2*, due to not recognizing the
7241 # link as an internal one. This one checks for the correct behavior.
7242 !! test
7243 Link to namespace preferred over interwiki with correct rel attribute
7244 !! options
7245 parsoid=html2wt,html2html
7246 !! html/parsoid
7247 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7248 !! wikitext
7249 [[MemoryAlpha:AlphaTest]]
7250 !! end
7251
7252 !! test
7253 Piped link to namespace
7254 !! wikitext
7255 [[Meta:Disclaimers|The disclaimers]]
7256 !! html
7257 <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>
7258 </p>
7259 !! end
7260
7261 !! test
7262 Link containing }
7263 !! wikitext
7264 [[Usually caused by a typo (oops}]]
7265 !! html
7266 <p>[[Usually caused by a typo (oops}]]
7267 </p>
7268 !! end
7269
7270 !! article
7271 7% Solution
7272 !! text
7273 Just a test of an article title containing a percent.
7274 !! endarticle
7275
7276 !! test
7277 Link containing % (not as a hex sequence)
7278 !! wikitext
7279 [[7% Solution]]
7280 !! html/php
7281 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7282 </p>
7283 !! html/parsoid
7284 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7285 !! end
7286
7287 # note that the parsoid HTML is identical to the previous test output,
7288 # so the previous test ensures that the html2wt mode will generate the
7289 # "not as a hex sequence" wikitext.
7290 !! test
7291 Link containing % as a single hex sequence interpreted to char
7292 !! options
7293 parsoid=wt2wt,wt2html,html2html
7294 !! wikitext
7295 [[7%25 Solution]]
7296 !! html/php
7297 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7298 </p>
7299 !! html/parsoid
7300 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7301 !!end
7302
7303 !! test
7304 Link containing % as a double hex sequence interpreted to hex sequence
7305 !! wikitext
7306 [[7%2525 Solution]]
7307 !! html
7308 <p>[[7%2525 Solution]]
7309 </p>
7310 !!end
7311
7312 # note that parsoid does not munge anchor text; all non-space
7313 # characters are valid in HTML5 anchors.
7314 !! test
7315 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7316 Example for such a section: == < ==
7317 !! wikitext
7318 [[%23%3c]][[%23%3e]]
7319 !! html/php
7320 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7321 </p>
7322 !! html/parsoid
7323 <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>
7324 !! end
7325
7326 !! test
7327 Link containing "<#" and ">#" as a hex sequences
7328 !! wikitext
7329 [[%3c%23]][[%3e%23]]
7330 !! html
7331 <p>[[%3c%23]][[%3e%23]]
7332 </p>
7333 !! end
7334
7335 !! test
7336 Link containing an equals sign
7337 !! wikitext
7338 [[Special:BookSources/isbn=4-00-026157-6]]
7339 !! html/php
7340 <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>
7341 </p>
7342 !! html/parsoid
7343 <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>
7344 !! end
7345
7346 !! article
7347 Foo~bar
7348 !! text
7349 Just a test of an article title containing a tilde.
7350 !! endarticle
7351
7352 # note that links containing signatures, like [[Foo~~~~]], are
7353 # massaged by the pre-save transform (PST) and so the tildes are never
7354 # seen by the parser.
7355 !! test
7356 Link containing a tilde
7357 !! wikitext
7358 [[Foo~bar]]
7359 !! html/php
7360 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7361 </p>
7362 !! html/parsoid
7363 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7364 !! end
7365
7366 !! test
7367 Link containing double-single-quotes '' (bug 4598)
7368 !! wikitext
7369 [[Lista d''e paise d''o munno]]
7370 !! html/php
7371 <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>
7372 </p>
7373 !! html/parsoid
7374 <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>
7375 !! end
7376
7377 !! test
7378 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7379 !! wikitext
7380 Some [[Link|pretty ''italics'' and stuff]]!
7381 !! html/php
7382 <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>!
7383 </p>
7384 !! html/parsoid
7385 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7386 !! end
7387
7388 !! test
7389 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7390 !! wikitext
7391 ''Some [[Link|pretty ''italics'' and stuff]]!''
7392 !! html
7393 <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>
7394 </p>
7395 !! end
7396
7397 !! test
7398 Link with double quotes in title part (literal) and alternate part (interpreted)
7399 !! wikitext
7400 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7401
7402 [[''Pentecoste'']]
7403
7404 [[''Pentecoste''|Pentecoste]]
7405
7406 [[''Pentecoste''|''Pentecoste'']]
7407 !! html/php
7408 <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>
7409 </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>
7410 </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>
7411 </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>
7412 </p>
7413 !! html/parsoid
7414 <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>
7415 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7416 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7417 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7418 !! end
7419
7420 !! test
7421 Broken image links with HTML captions (bug 39700)
7422 !! wikitext
7423 [[File:Nonexistent|<script></script>]]
7424 [[File:Nonexistent|100x100px|<script></script>]]
7425 [[File:Nonexistent|&lt;]]
7426 [[File:Nonexistent|a<i>b</i>c]]
7427 !! html/php
7428 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7429 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7430 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7431 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7432 </p>
7433 !! html/parsoid
7434 <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>
7435 <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>
7436 <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>
7437 <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>
7438 !! end
7439
7440 !! test
7441 Plain link to URL
7442 !! wikitext
7443 [[http://www.example.com]]
7444 !! html/php
7445 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7446 </p>
7447 !! html/parsoid
7448 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7449 !! end
7450
7451 !! test
7452 Plain link to URL with link text
7453 !! wikitext
7454 [[http://www.example.com Link text]]
7455 !! html
7456 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7457 </p>
7458 !! end
7459
7460 !! test
7461 Plain link to protocol-relative URL
7462 !! wikitext
7463 [[//www.example.com]]
7464 !! html/php
7465 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7466 </p>
7467 !! html/parsoid
7468 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7469 !! end
7470
7471 !! test
7472 Plain link to protocol-relative URL with link text
7473 !! wikitext
7474 [[//www.example.com Link text]]
7475 !! html
7476 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7477 </p>
7478 !! end
7479
7480 !! test
7481 Plain link to page with question mark in title
7482 !! wikitext
7483 [[A?b]]
7484
7485 [[A?b|Baz]]
7486 !! html
7487 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7488 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7489 </p>
7490 !! end
7491
7492
7493 # I'm fairly sure the expected result here is wrong.
7494 # We want these to be URL links, not pseudo-pages with URLs for titles....
7495 # However the current output is also pretty screwy.
7496 #
7497 # ----
7498 # I'm changing it to match the current output--it arguably makes more
7499 # sense in the light of the test above. Old expected result was:
7500 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7501 #</p>
7502 # But I think this test is bordering on "garbage in, garbage out" anyway.
7503 # -- wtm
7504 !! test
7505 Piped link to URL
7506 !! wikitext
7507 Piped link to URL: [[http://www.example.com|an example URL]]
7508 !! html/php
7509 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7510 </p>
7511 !! html/parsoid
7512 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7513 !! end
7514
7515 !! test
7516 BUG 2: [[page|http://url/]] should link to page, not http://url/
7517 !! wikitext
7518 [[Main Page|http://url/]]
7519 !! html/php
7520 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7521 </p>
7522 !! html/parsoid
7523 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7524 !! end
7525
7526 # Parsoid does not mark self-links, by design.
7527 !! test
7528 BUG 337: Escaped self-links should be bold
7529 !! options
7530 title=[[Bug462]]
7531 !! wikitext
7532 [[Bu&#103;462]] [[Bug462]]
7533 !! html/php
7534 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7535 </p>
7536 !! html/php+tidy
7537 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7538 !! html/parsoid
7539 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7540 !! end
7541
7542 !! test
7543 Self-link to section should not be bold
7544 !! options
7545 title=[[Main Page]]
7546 !! wikitext
7547 [[Main Page#section]]
7548 !! html
7549 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7550 </p>
7551 !! end
7552
7553 !! article
7554 00
7555 !! text
7556 This is 00.
7557 !! endarticle
7558
7559 !!test
7560 Self-link to numeric title
7561 !!options
7562 title=[[0]]
7563 !! wikitext
7564 [[0]]
7565 !! html
7566 <p><strong class="selflink">0</strong>
7567 </p>
7568 !!end
7569
7570 !!test
7571 Link to numeric-equivalent title
7572 !!options
7573 title=[[0]]
7574 !! wikitext
7575 [[00]]
7576 !! html
7577 <p><a href="/wiki/00" title="00">00</a>
7578 </p>
7579 !!end
7580
7581 !! test
7582 <nowiki> inside a link
7583 !! wikitext
7584 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7585 !! html
7586 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7587 </p>
7588 !! end
7589
7590 !! test
7591 Non-breaking spaces in title
7592 !! wikitext
7593 [[&nbsp; Main &nbsp; Page &nbsp;]]
7594 !! html
7595 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7596 </p>
7597 !!end
7598
7599 !! test
7600 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7601 !! options
7602 language=ca
7603 !! wikitext
7604 '''[[Main Page]]'''
7605 !! html
7606 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7607 </p>
7608 !! end
7609
7610 !! test
7611 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7612 !! options
7613 language=ca
7614 !! wikitext
7615 ''[[Main Page]]''
7616 !! html
7617 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7618 </p>
7619 !! end
7620
7621 !! test
7622 Internal link with en linktrail: no apostrophes (bug 27473)
7623 !! options
7624 language=en
7625 !! wikitext
7626 [[Something]]'nice
7627 !! html
7628 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7629 </p>
7630 !! end
7631
7632 !! test
7633 Internal link with ca linktrail with apostrophes (bug 27473)
7634 !! options
7635 language=ca
7636 !! wikitext
7637 [[Something]]'nice
7638 !! html
7639 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7640 </p>
7641 !! end
7642
7643 !! test
7644 Internal link with kaa linktrail with apostrophes (bug 27473)
7645 !! options
7646 language=kaa
7647 !! wikitext
7648 [[Something]]'nice
7649 !! html
7650 <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>
7651 </p>
7652 !! end
7653
7654 !! test
7655 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7656 !! wikitext
7657 [[User:Foo/Test/63636:Bar|Test]]
7658 !! html/php
7659 <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>
7660 </p>
7661 !! html/parsoid
7662 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7663 !! end
7664
7665 !! test
7666 Purely hash wikilink
7667 !! options
7668 title=[[User:test/123]]
7669 !! wikitext
7670 [[#a|b]]
7671 !! html/php
7672 <p><a href="#a">b</a>
7673 </p>
7674 !! html/parsoid
7675 <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>
7676 !! end
7677
7678 !! test
7679 1. Interaction of linktrail and template encapsulation
7680 !! options
7681 parsoid
7682 !! wikitext
7683 {{echo|[[Foo]]}}l
7684 !! html
7685 <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>
7686 !! end
7687
7688 !! test
7689 2. Interaction of linktrail and template encapsulation
7690 !! options
7691 parsoid
7692 !! wikitext
7693 {{echo|Some [[Fool]]}}s
7694 !! html
7695 <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>
7696 !! end
7697
7698 !! test
7699 3. Interaction of linktrail and template encapsulation
7700 !! options
7701 parsoid
7702 !! wikitext
7703 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7704 !! html
7705 <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>
7706 !! end
7707
7708 !! article
7709 Söfnuður
7710 !! text
7711 Test.
7712 !! endarticle
7713
7714 !! test
7715 Internal link with is link prefix
7716 !! options
7717 language=is
7718 !! wikitext
7719 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7720 !! html
7721 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7722 </p>
7723 !! end
7724
7725 !! article
7726 Mótmælendatrú
7727 !! text
7728 Test.
7729 !! endarticle
7730
7731 !! test
7732 Internal link with is link trail and link prefix
7733 !! options
7734 language=is
7735 !! wikitext
7736 [[mótmælendatrú|xxx]]ar
7737 [[mótmælendatrú]]ar
7738 mótmælenda[[söfnuður]]
7739 mótmælenda[[söfnuður|söfnuðir]]
7740 mótmælenda[[söfnuður|söfnuðir]]xxx
7741 !! html
7742 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7743 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7744 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7745 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7746 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7747 </p>
7748 !! end
7749
7750 !! test
7751 Parsoid link trail escaping
7752 !! options
7753 parsoid=html2wt,html2html
7754 !! html/parsoid
7755 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7756 !! wikitext
7757 [[apple]]<nowiki/>s
7758 !! end
7759
7760 !! test
7761 Parsoid link prefix escaping
7762 !! options
7763 language=is
7764 parsoid=html2wt,html2html
7765 !! html/parsoid
7766 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7767 !! wikitext
7768 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7769 !! end
7770
7771 !! test
7772 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7773 !! wikitext
7774 [[Foo| bar]]
7775
7776 [[Foo| ''bar'']]
7777
7778 [http://wp.org foo]
7779
7780 [http://wp.org ''foo'']
7781 !! html
7782 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7783 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7784 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7785 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7786 </p>
7787 !! end
7788
7789 !! test
7790 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7791 !! options
7792 parsoid
7793 !! wikitext
7794 [[Foo|{{echo|a}} b {{echo|c}}]]
7795 !! html
7796 <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>
7797 !! end
7798
7799 !! test
7800 Link with angle bracket after anchor
7801 !! wikitext
7802 [[Foo#<bar>]]
7803 !! html/php
7804 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7805 </p>
7806 !! html/parsoid
7807 <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>
7808 !! end
7809
7810 ###
7811 ### Interwiki links (see maintenance/interwiki.sql)
7812 ###
7813
7814 !! test
7815 Inline interwiki link
7816 !! options
7817 parsoid=wt2html,wt2wt,html2html
7818 !! wikitext
7819 [[MeatBall:SoftSecurity]]
7820 !! html/php
7821 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7822 </p>
7823 !! html/parsoid
7824 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7825 !! end
7826
7827 !! test
7828 Inline interwiki link with empty title (bug 2372)
7829 !! options
7830 parsoid=wt2html,wt2wt,html2html
7831 !! wikitext
7832 [[MeatBall:]]
7833 !! html/php
7834 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7835 </p>
7836 !! html/parsoid
7837 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7838 !! end
7839
7840 !! test
7841 Interwiki link encoding conversion (bug 1636)
7842 !! wikitext
7843 *[[Wikipedia:ro:Olteni&#0355;a]]
7844 *[[Wikipedia:ro:Olteni&#355;a]]
7845 !! html
7846 <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>
7847 <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>
7848
7849 !! html+tidy
7850 <ul>
7851 <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>
7852 <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>
7853 </ul>
7854 !! end
7855
7856 !! test
7857 Interwiki link with fragment (bug 2130)
7858 !! wikitext
7859 [[MeatBall:SoftSecurity#foo]]
7860 !! html
7861 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7862 </p>
7863 !! end
7864
7865 # Ideally the wikipedia: prefix here should be proto-relative too
7866 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7867 # define the 'en' prefix, and originally the test used 'wikipedia',
7868 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7869 # article.
7870 !! test
7871 Different interwiki prefixes mapping to the same URL
7872 !! wikitext
7873 [[:en:Foo]]
7874
7875 [[:en:Foo|Foo]]
7876
7877 [[wikipedia:Foo]]
7878
7879 [[:wikipedia:Foo|Foo]]
7880
7881 [[wikipedia:en:Foo]]
7882
7883 [[:wikipedia:en:Foo]]
7884
7885 [[ wikiPEdia :Foo]]
7886 !! html/parsoid
7887 <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>
7888
7889 <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>
7890
7891 <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>
7892
7893 <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>
7894
7895 <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>
7896
7897 <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>
7898
7899 <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>
7900 !! end
7901
7902 !! test
7903 Interwiki links that cannot be represented in wiki syntax
7904 !! wikitext
7905 [[meatball:ok]]
7906 [[meatball:ok#foo|ok with fragment]]
7907 [[meatball:ok_as_well?|ok ending with ? mark]]
7908 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7909 [http://de.wikipedia.org/wiki/#foo is just fragment]
7910
7911 !! html/php
7912 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7913 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7914 <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>
7915 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7916 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7917 </p>
7918 !! html/parsoid
7919 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7920 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7921 <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>
7922 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7923 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7924 !! end
7925
7926 !! test
7927 Interwiki links: trail
7928 !! wikitext
7929 [[wikipedia:Foo|Ba]]r
7930 !! html/php
7931 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7932 </p>
7933 !! html/parsoid
7934 <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>
7935 !! end
7936
7937 !! test
7938 Local interwiki link
7939 !! options
7940 parsoid=wt2html,wt2wt,html2html
7941 !! wikitext
7942 [[local:Template:Foo]]
7943 !! html/php
7944 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7945 </p>
7946 !! html/parsoid
7947 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7948 !! end
7949
7950 # Parsoid does not mark self-links, by design.
7951 !! test
7952 Local interwiki link: self-link to current page
7953 !! options
7954 title=[[Main Page]]
7955 parsoid=wt2html,wt2wt,html2html
7956 !! wikitext
7957 [[local:Main Page]]
7958 !! html/php
7959 <p><strong class="selflink">local:Main Page</strong>
7960 </p>
7961 !! html/parsoid
7962 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7963 !! end
7964
7965 !! test
7966 Local interwiki link: prefix only (bug 64167)
7967 !! options
7968 parsoid=wt2html,wt2wt,html2html
7969 !! wikitext
7970 [[local:]]
7971 !! html/php
7972 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7973 </p>
7974 !! html/parsoid
7975 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7976 !! end
7977
7978 !! test
7979 Local interwiki link: with additional interwiki prefix (bug 61357)
7980 !! options
7981 parsoid=wt2html,wt2wt,html2html
7982 !! wikitext
7983 [[local:meatball:Hello]]
7984 !! html/php
7985 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7986 </p>
7987 !! html/parsoid
7988 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7989 !! end
7990
7991 !! test
7992 Multiple local interwiki link prefixes
7993 !! wikitext
7994 [[local:local:local:local:mi:local:Foo]]
7995 !! options
7996 parsoid=wt2html,wt2wt,html2html
7997 !! html/php
7998 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7999 </p>
8000 !! html/parsoid
8001 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8002 !! end
8003
8004 ###
8005 ### Interlanguage links
8006 ### Language links (so that searching for '### language' matches..)
8007 ###
8008
8009 !! test
8010 Interlanguage link
8011 !! options
8012 parsoid=wt2html,wt2wt,html2html
8013 !! wikitext
8014 Blah blah blah
8015 [[zh:Chinese]]
8016 !! html/php
8017 <p>Blah blah blah
8018 </p>
8019 !! html/parsoid
8020 <p>Blah blah blah</p>
8021 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8022 !! end
8023
8024 !! test
8025 Interlanguage link with spacing
8026 !! options
8027 parsoid=wt2html,wt2wt,html2html
8028 !! wikitext
8029 Blah blah blah
8030 [[ zh : Chinese ]]
8031 !! html/php
8032 <p>Blah blah blah
8033 </p>
8034 !! html/parsoid
8035 <p>Blah blah blah</p>
8036 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8037 !! end
8038
8039 !! test
8040 Double interlanguage link
8041 !! options
8042 parsoid=wt2html,wt2wt,html2html
8043 !! wikitext
8044 Blah blah blah
8045 [[es:Spanish]]
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://es.wikipedia.org/wiki/Spanish"/>
8053 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8054 !! end
8055
8056 !! test
8057 Interlanguage link variations
8058 !! options
8059 parsoid=wt2html,wt2wt,html2html
8060 !! wikitext
8061 Blah blah blah
8062 [[ es :Spanish]]
8063 [[ ZH :Chinese]]
8064 [[es:Foo_bar]]
8065 !! html/php
8066 <p>Blah blah blah
8067 </p>
8068 !! html/parsoid
8069 <p>Blah blah blah</p>
8070 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8071 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8072 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8073 !! end
8074
8075 !! test
8076 Space and question mark encoding in interlanguage links (T95473)
8077 !! options
8078 parsoid=wt2html,wt2wt,html2html
8079 !! wikitext
8080 Blah blah blah
8081 [[es:Foo bar?]]
8082 !! html/php
8083 <p>Blah blah blah
8084 </p>
8085 !! html/parsoid
8086 <p>Blah blah blah</p>
8087 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8088 !! end
8089
8090 !! test
8091 Interlanguage link, with prefix links
8092 !! options
8093 language=ln
8094 !! wikitext
8095 Blah blah blah
8096 [[zh:Chinese]]
8097 !! html/php
8098 <p>Blah blah blah
8099 </p>
8100 !! html/parsoid
8101 <p>Blah blah blah</p>
8102 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8103 !! end
8104
8105 !! test
8106 Double interlanguage link, with prefix links (bug 8897)
8107 !! options
8108 language=ln
8109 !! wikitext
8110 Blah blah blah
8111 [[es:Spanish]]
8112 [[zh:Chinese]]
8113 !! html/php
8114 <p>Blah blah blah
8115 </p>
8116 !! html/parsoid
8117 <p>Blah blah blah</p>
8118 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8119 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8120 !! end
8121
8122 !! test
8123 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8124 !! wikitext
8125 Blah blah blah
8126 [[mul:Article]]
8127 !! html/php
8128 <p>Blah blah blah
8129 </p>
8130 !! html/parsoid
8131 <p>Blah blah blah</p>
8132 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8133 !! end
8134
8135 !! test
8136 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8137 !! options
8138 language=ln
8139 !! wikitext
8140 [[WW&nbsp;II]]
8141 !! html
8142 <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>
8143 </p>
8144 !! end
8145
8146 !! test
8147 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8148 !! options
8149 parsoid=html2wt
8150 !! html/parsoid
8151 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8152 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8153 !! wikitext
8154 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8155
8156 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8157 !! end
8158
8159 !! test
8160 Parsoid: handle constructor well
8161 !! wikitext
8162 [[constructor]]
8163
8164 [[constructor:foo]]
8165 !! html/php
8166 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8167 </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>
8168 </p>
8169 !! html/parsoid
8170 <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>
8171
8172 <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>
8173 !! end
8174
8175 !! article
8176 ko:
8177 !! text
8178 Test.
8179 !! endarticle
8180
8181 # Note that `ko` isn't a known interlanguage prefix
8182 !! test
8183 Parsoid: recognize interlanguage links without a target page
8184 !! options
8185 ill
8186 !! wikitext
8187 [[es:]]
8188
8189 [[ko:]]
8190 !! html/php
8191 es:
8192 !! html/parsoid
8193 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8194
8195 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8196 !! end
8197
8198 # Note that `ko` isn't a known interwiki prefix
8199 !! test
8200 Parsoid: recognize interwiki links without a target page
8201 !! options
8202 parsoid=wt2html,wt2wt,html2html
8203 !! wikitext
8204 [[:es:]]
8205
8206 [[:ko:]]
8207 !! html/php
8208 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8209 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8210 </p>
8211 !! html/parsoid
8212 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8213 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8214 !! end
8215
8216 !! test
8217 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8218 !! wikitext
8219 [[mi:Foo]]
8220 !! html/php
8221 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8222 </p>
8223 !! html/parsoid
8224 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8225 !! end
8226
8227 !! test
8228 Interlanguage link with preceding local interwiki link (bug 68085)
8229 !! options
8230 parsoid=wt2html,wt2wt,html2html
8231 !! wikitext
8232 Blah blah blah
8233 [[local:es:Spanish]]
8234 !! html/php
8235 <p>Blah blah blah
8236 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8237 </p>
8238 !! html/parsoid
8239 <p>Blah blah blah
8240 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8241 !! end
8242
8243 !! test
8244 Looks like an interlanguage link, but is actually a local interwiki
8245 !! options
8246 parsoid=wt2html,wt2wt,html2html
8247 !! wikitext
8248 Blah blah blah
8249 [[mi:Template:Foo]]
8250 !! html/php
8251 <p>Blah blah blah
8252 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8253 </p>
8254 !! html/parsoid
8255 <p>Blah blah blah
8256 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8257 !! end
8258
8259 ###
8260 ### Redirects, Parsoid-only
8261 ###
8262
8263 !! test
8264 1. Simple redirect to page
8265 !! wikitext
8266 #REDIRECT [[Main Page]]
8267 !! html/parsoid
8268 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8269 !! end
8270
8271 !! test
8272 2. Other redirect variants
8273 !! wikitext
8274 #REDIRECT [[Main_Page]]
8275 !! html/parsoid
8276 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8277 !! end
8278
8279 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8280 # This tests the Parsoid bail-out code.
8281 !! test
8282 3. Other redirect variants
8283 !! wikitext
8284 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8285 !! html/parsoid
8286 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8287 !! end
8288
8289 !! test
8290 4. Redirect to a templated destination
8291 !! wikitext
8292 #REDIRECT [[{{echo|Foo}}bar]]
8293 !! html/parsoid
8294 <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"}]]}'/>
8295 !! end
8296
8297 !! test
8298 Empty redirect
8299 !! options
8300 parsoid=wt2html,wt2wt
8301 !! wikitext
8302 #REDIRECT [[]]
8303 !! html/parsoid
8304 <ol>
8305 <li>REDIRECT [[]]</li></ol>
8306 !! end
8307
8308 !! test
8309 Optional colon in #REDIRECT
8310 !! options
8311 # the colon is archaic syntax. we support it for wt2html, but we
8312 # don't care that it roundtrips back to the modern syntax.
8313 parsoid=wt2html,html2html
8314 !! wikitext
8315 #REDIRECT:[[Main Page]]
8316 !! html/parsoid
8317 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8318 !! end
8319
8320 !! test
8321 Whitespace in #REDIRECT with optional colon
8322 !! options
8323 # the colon and gratuitous whitespace is archaic syntax. we support
8324 # it for wt2html, but we don't care that it roundtrips back to the
8325 # modern syntax (without extra whitespace)
8326 parsoid=wt2html,html2html
8327 !! wikitext
8328
8329 #REDIRECT
8330 :
8331 [[Main Page]]
8332 !! html/parsoid
8333 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8334 !! end
8335
8336 !! test
8337 Piped link in #REDIRECT
8338 !! options
8339 # content after piped link is ignored. we support this syntax,
8340 # but don't care that the piped link is lost when we roundtrip this.
8341 parsoid=wt2html
8342 !! wikitext
8343 #REDIRECT [[Main Page|bar]]
8344 !! html/parsoid
8345 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8346 !! end
8347
8348 !! test
8349 Redirect to category (T104502)
8350 !! options
8351 parsoid=wt2html,wt2wt
8352 !! wikitext
8353 #REDIRECT [[Category:Foo]]
8354 !! html/parsoid
8355 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8356 !! end
8357
8358 !! test
8359 Redirect to category with URL encoding (T104502)
8360 !! options
8361 parsoid=wt2html
8362 !! wikitext
8363 #REDIRECT [[Category%3AFoo]]
8364 !! html/parsoid
8365 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8366 !! end
8367
8368 !! test
8369 Redirect to category page
8370 !! wikitext
8371 #REDIRECT [[:Category:Foo]]
8372 !! html/parsoid
8373 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8374 !! end
8375
8376 !! test
8377 Redirect to image page (1)
8378 !! wikitext
8379 #REDIRECT [[File:Wiki.png]]
8380 !! html/parsoid
8381 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8382 !! end
8383
8384 !! test
8385 Redirect to image page (2)
8386 !! wikitext
8387 #REDIRECT [[Image:Wiki.png]]
8388 !! html/parsoid
8389 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8390 !! end
8391
8392 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8393 # Next test confirms this.
8394 !! test
8395 Redirect to language (1) (T104918)
8396 !! options
8397 parsoid=wt2html,wt2wt,html2html
8398 !! wikitext
8399 #REDIRECT [[en:File:Wiki.png]]
8400 !! html/parsoid
8401 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8402 !! end
8403
8404 !! test
8405 Redirect to language (2) (T104918)
8406 !! wikitext
8407 #REDIRECT [[:en:File:Wiki.png]]
8408 !! html/parsoid
8409 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8410 !! end
8411
8412 !! test
8413 Redirect to interwiki (T104918)
8414 !! wikitext
8415 #REDIRECT [[meatball:File:Wiki.png]]
8416 !! html/parsoid
8417 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8418 !! end
8419
8420 !! test
8421 Non-English #REDIRECT
8422 !! options
8423 language=is
8424 !! wikitext
8425 #TILVÍSUN [[Main Page]]
8426 !! html/parsoid
8427 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8428 !! end
8429
8430 !! test
8431 Redirect syntax under text isn't considered a redirect
8432 !! wikitext
8433 some text
8434 #redirect [[Main Page]]
8435 !! html/parsoid
8436 <p>some text</p>
8437 <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>
8438 !! end
8439
8440 # FIXME: Should hoist the redirect to the top of the page and ensure there
8441 # is only one.
8442 !! test
8443 New redirect
8444 !! options
8445 parsoid=html2wt
8446 !! html/parsoid
8447 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8448 !! wikitext
8449 Foo
8450 #REDIRECT [[Foo]]
8451 !! end
8452
8453 ##
8454 ## XHTML tidiness
8455 ###
8456
8457 !! test
8458 <br> to <br />
8459 !! wikitext
8460 1<br>2<br />3
8461 !! html
8462 <p>1<br />2<br />3
8463 </p>
8464 !! end
8465
8466 !! test
8467 Broken br tag sanitization
8468 !! wikitext
8469 </br>
8470 !! html/php
8471 <p>&lt;/br&gt;
8472 </p>
8473 !! end
8474
8475 # TODO: Fix html2html mode (bug 51055)!
8476 !! test
8477 Parsoid: Broken br tag recognition
8478 !! options
8479 parsoid=wt2html
8480 !! wikitext
8481 </br>
8482
8483 <br/ >
8484 !! html+tidy
8485 <p><br /></p>
8486 <p><br /></p>
8487 !! end
8488
8489 !! test
8490 Incorrecly removing closing slashes from correctly formed XHTML
8491 !! wikitext
8492 <br style="clear:both;" />
8493 !! html
8494 <p><br style="clear:both;" />
8495 </p>
8496 !! end
8497
8498 !! test
8499 Failing to transform badly formed HTML into correct XHTML
8500 !! wikitext
8501 <br style="clear: left;">
8502 <br style="clear: right;">
8503 <br style="clear: both;">
8504 !! html
8505 <p><br style="clear: left;" />
8506 <br style="clear: right;" />
8507 <br style="clear: both;" />
8508 </p>
8509 !!end
8510
8511 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8512 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8513 !! test
8514 Handling html with a div self-closing tag
8515 !! wikitext
8516 <div title />
8517 <div title/>
8518 <div title/ >
8519 <div title=bar />
8520 <div title=bar/>
8521 <div title=bar/ >
8522 !! html/php
8523 <p>&lt;div title /&gt;
8524 &lt;div title/&gt;
8525 </p>
8526 <div>
8527 <p>&lt;div title=bar /&gt;
8528 &lt;div title=bar/&gt;
8529 </p>
8530 <div title="bar/"></div>
8531 </div>
8532
8533 !! html/parsoid
8534 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8535 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8536 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8537 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8538 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8539 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8540 !! end
8541
8542 !! test
8543 Handling html with a br self-closing tag
8544 !! wikitext
8545 <br title />
8546 <br title/>
8547 <br title/ >
8548 <br title=bar />
8549 <br title=bar/>
8550 <br title=bar/ >
8551 !! html/php
8552 <p><br title="" />
8553 <br title="" />
8554 <br />
8555 <br title="bar" />
8556 <br title="bar" />
8557 <br title="bar/" />
8558 </p>
8559 !! html/parsoid
8560 <p><br title="" />
8561 <br title="" />
8562 <br title="" />
8563 <br title="bar" />
8564 <br title="bar" />
8565 <br title="bar/" />
8566 </p>
8567 !! end
8568
8569 !! test
8570 Horizontal ruler (should it add that extra space?)
8571 !! wikitext
8572 <hr>
8573 <hr >
8574 foo <hr
8575 > bar
8576 !! html+tidy
8577 <hr />
8578 <hr />
8579 <p>foo</p>
8580 <hr />
8581 <p>bar</p>
8582 !! end
8583
8584 !! test
8585 Horizontal ruler -- 4+ dashes render hr
8586 !! wikitext
8587 ----
8588 !! html
8589 <hr />
8590
8591 !! end
8592
8593 !! test
8594 Horizontal ruler -- eats additional dashes on the same line
8595 !! wikitext
8596 ---------
8597 !! html
8598 <hr />
8599
8600 !! end
8601
8602 !! test
8603 Horizontal ruler -- does not collapse dashes on consecutive lines
8604 !! wikitext
8605 ----
8606 ----
8607 !! html
8608 <hr />
8609 <hr />
8610
8611 !! end
8612
8613 !! test
8614 Horizontal ruler -- <4 dashes render as plain text
8615 !! wikitext
8616 ---
8617 !! html
8618 <p>---
8619 </p>
8620 !! end
8621
8622 !! test
8623 Horizontal ruler -- Supports content following dashes on same line
8624 !! wikitext
8625 ---- Foo
8626 !! html
8627 <hr /> Foo
8628
8629 !! html+tidy
8630 <hr />
8631 <p>Foo</p>
8632 !! end
8633
8634 ###
8635 ### Block-level elements
8636 ###
8637 !! test
8638 Common list
8639 !! wikitext
8640 *Common list
8641 * item 2
8642 *item 3
8643 !! html
8644 <ul><li>Common list</li>
8645 <li> item 2</li>
8646 <li>item 3</li></ul>
8647
8648 !! end
8649
8650 !! test
8651 Numbered list
8652 !! wikitext
8653 #Numbered list
8654 #item 2
8655 # item 3
8656 !! html
8657 <ol><li>Numbered list</li>
8658 <li>item 2</li>
8659 <li> item 3</li></ol>
8660
8661 !! end
8662
8663 !! test
8664 Mixed list
8665 !! wikitext
8666 *Mixed list
8667 *# with numbers
8668 ** and bullets
8669 *# and numbers
8670 *bullets again
8671 **bullet level 2
8672 ***bullet level 3
8673 ***#Number on level 4
8674 **bullet level 2
8675 **#Number on level 3
8676 **#Number on level 3
8677 *#number level 2
8678 *Level 1
8679 *** Level 3
8680 #** Level 3, but ordered
8681 !! html
8682 <ul><li>Mixed list
8683 <ol><li> with numbers</li></ol>
8684 <ul><li> and bullets</li></ul>
8685 <ol><li> and numbers</li></ol></li>
8686 <li>bullets again
8687 <ul><li>bullet level 2
8688 <ul><li>bullet level 3
8689 <ol><li>Number on level 4</li></ol></li></ul></li>
8690 <li>bullet level 2
8691 <ol><li>Number on level 3</li>
8692 <li>Number on level 3</li></ol></li></ul>
8693 <ol><li>number level 2</li></ol></li>
8694 <li>Level 1
8695 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8696 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8697
8698 !! end
8699
8700 !! test
8701 Nested lists 1
8702 !! wikitext
8703 *foo
8704 **bar
8705 !! html
8706 <ul><li>foo
8707 <ul><li>bar</li></ul></li></ul>
8708
8709 !! end
8710
8711 !! test
8712 Nested lists 2
8713 !! wikitext
8714 **foo
8715 *bar
8716 !! html
8717 <ul><li><ul><li>foo</li></ul></li>
8718 <li>bar</li></ul>
8719
8720 !! end
8721
8722 !! test
8723 Nested lists 3 (first element empty)
8724 !! wikitext
8725 *
8726 **bar
8727 !! html
8728 <ul><li>
8729 <ul><li>bar</li></ul></li></ul>
8730
8731 !! end
8732
8733 !! test
8734 Nested lists 4 (first element empty)
8735 !! wikitext
8736 **
8737 *bar
8738 !! html
8739 <ul><li><ul><li></li></ul></li>
8740 <li>bar</li></ul>
8741
8742 !! end
8743
8744 !! test
8745 Nested lists 5 (both elements empty)
8746 !! wikitext
8747 **
8748 *
8749 !! html
8750 <ul><li><ul><li></li></ul></li>
8751 <li></li></ul>
8752
8753 !! end
8754
8755 !! test
8756 Nested lists 6 (both elements empty)
8757 !! wikitext
8758 *
8759 **
8760 !! html
8761 <ul><li>
8762 <ul><li></li></ul></li></ul>
8763
8764 !! end
8765
8766 !! test
8767 Nested lists 7 (skip initial nesting levels)
8768 !! wikitext
8769 *** foo
8770 !! html
8771 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8772
8773 !! end
8774
8775 !! test
8776 Nested lists 8 (multiple nesting transitions)
8777 !! wikitext
8778 * foo
8779 *** bar
8780 ** baz
8781 * boo
8782 !! html
8783 <ul><li> foo
8784 <ul><li><ul><li> bar</li></ul></li>
8785 <li> baz</li></ul></li>
8786 <li> boo</li></ul>
8787
8788 !! end
8789
8790 !! test
8791 Nested lists 9 (extension interaction)
8792 !! options
8793 parsoid
8794 !! wikitext
8795 *<references />
8796 !! html/parsoid
8797 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8798 !! end
8799
8800 !! test
8801 1. Lists with start-of-line-transparent tokens before bullets: Comments
8802 !! wikitext
8803 *foo
8804 *<!--cmt-->bar
8805 <!--cmt-->*baz
8806 !! html
8807 <ul><li>foo</li>
8808 <li>bar</li>
8809 <li>baz</li></ul>
8810
8811 !! end
8812
8813 !! test
8814 2. Lists with start-of-line-transparent tokens before bullets: Template close
8815 !! wikitext
8816 *foo {{echo|bar
8817 }}*baz
8818 !! html
8819 <ul><li>foo bar</li>
8820 <li>baz</li></ul>
8821
8822 !! end
8823
8824 !! test
8825 List items are not parsed correctly following a <pre> block (bug 785)
8826 !! wikitext
8827 * <pre>foo</pre>
8828 * <pre>bar</pre>
8829 * zar
8830 !! html/php
8831 <ul><li> <pre>foo</pre></li>
8832 <li> <pre>bar</pre></li>
8833 <li> zar</li></ul>
8834
8835 !! html/parsoid
8836 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8837 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8838 <li> zar</li></ul>
8839 !! end
8840
8841 !! test
8842 List items from template
8843 !! wikitext
8844
8845 {{inner list}}
8846 * item 2
8847
8848 * item 0
8849 {{inner list}}
8850 * item 2
8851
8852 * item 0
8853 * notSOL{{inner list}}
8854 * item 2
8855 !! html
8856 <ul><li> item 1</li>
8857 <li> item 2</li></ul>
8858 <ul><li> item 0</li>
8859 <li> item 1</li>
8860 <li> item 2</li></ul>
8861 <ul><li> item 0</li>
8862 <li> notSOL</li>
8863 <li> item 1</li>
8864 <li> item 2</li></ul>
8865
8866 !! end
8867
8868 !! test
8869 List interrupted by empty line or heading
8870 !! wikitext
8871 * foo
8872
8873 ** bar
8874 == A heading ==
8875 * Another list item
8876 !! html
8877 <ul><li> foo</li></ul>
8878 <ul><li><ul><li> bar</li></ul></li></ul>
8879 <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>
8880 <ul><li> Another list item</li></ul>
8881
8882 !!end
8883
8884 !!test
8885 Multiple list tags generated by templates
8886 !! wikitext
8887 {{echo|<li>}}a
8888 {{echo|<li>}}b
8889 {{echo|<li>}}c
8890 !! html
8891 <li>a
8892 <li>b
8893 <li>c</li>
8894 </li>
8895 </li>
8896
8897 !! html+tidy
8898 <ul>
8899 <li>a</li>
8900 <li>b</li>
8901 <li>c</li>
8902 </ul>
8903 !!end
8904
8905 !!test
8906 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8907 !! wikitext
8908 *a
8909 <!--This line will NOT split the list-->
8910 *b
8911 <!--This line will NOT split the list either-->
8912 *c
8913 <!--foo--> <!----> <!--This line NOT split the list either-->
8914 *d
8915 !! html
8916 <ul><li>a</li>
8917 <li>b</li>
8918 <li>c</li>
8919 <li>d</li></ul>
8920
8921 !!end
8922
8923 !!test
8924 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8925 !! wikitext
8926 *a
8927 <!--This line will NOT split the list-->
8928 *b
8929 <!--This line will NOT split the list either-->
8930 *c
8931 <!--foo--> <!----> <!--This line NOT split the list
8932 either-->
8933 *d
8934 !! html
8935 <ul><li>a</li>
8936 <li>b</li>
8937 <li>c</li>
8938 <li>d</li></ul>
8939
8940 !!end
8941
8942 !!test
8943 Test the li-hack
8944 (The PHP parser relies on Tidy for the hack)
8945 !!options
8946 parsoid=wt2html,wt2wt
8947 !! wikitext
8948 * foo
8949 * <li>li-hack
8950 * {{echo|<li>templated li-hack}}
8951 * <!--foo--> <li> unsupported li-hack with preceding comments
8952
8953 <ul>
8954 <li><li>not a li-hack
8955 </li>
8956 </ul>
8957 !! html+tidy
8958 <ul>
8959 <li>foo</li>
8960 <li>li-hack</li>
8961 <li>templated li-hack</li>
8962 <li>unsupported li-hack with preceding comments</li>
8963 </ul>
8964 <ul>
8965 <li>not a li-hack</li>
8966 </ul>
8967 !!end
8968
8969 !! test
8970 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8971 !! options
8972 parsoid
8973 !! wikitext
8974 # foo
8975 ## bar
8976 * foo
8977 ** bar
8978 : foo
8979 :: bar
8980 !! html
8981 <ol>
8982 <li> foo<ol>
8983 <li> bar</li>
8984 </ol></li>
8985 </ol><ul>
8986 <li> foo<ul>
8987 <li> bar</li>
8988 </ul></li>
8989 </ul><dl>
8990 <dd> foo<dl>
8991 <dd> bar</dd>
8992 </dl></dd>
8993 </dl>
8994 !! end
8995
8996 !! test
8997 Parsoid: Test of whitespace serialization with Templated bullets
8998 !! options
8999 parsoid
9000 !! wikitext
9001 * {{bullet}}
9002 !! html
9003 <ul>
9004 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9005 </ul>
9006 !! end
9007
9008 # ------------------------------------------------------------------------
9009 # The next set of tests are about Parsoid's ability to handle badly nested
9010 # tags (parse, minimize scope of fixup, and roundtrip back)
9011 # ------------------------------------------------------------------------
9012
9013 !! test
9014 Unbalanced closing block tags break a list
9015 (php parser relies on Tidy to fix up)
9016 !! wikitext
9017 <div>
9018 *a</div><div>
9019 *b</div>
9020 !! html+tidy
9021 <div>
9022 <ul>
9023 <li>a</li>
9024 </ul>
9025 </div>
9026 <div>
9027 <ul>
9028 <li>b</li>
9029 </ul>
9030 </div>
9031 !! end
9032
9033 # Parsoid fails this test, but it might be tricky to support properly.
9034 # See bug 68395.
9035 !! test
9036 Unbalanced closing non-block tags don't break a list
9037 (php parser relies on Tidy to fix up)
9038 !! wikitext
9039 <span>
9040 *a</span><span>
9041 *b</span>
9042 !! html/php+tidy
9043 <ul>
9044 <li><span>a</span></li>
9045 <li><span>b</span></li>
9046 </ul>
9047 !! html/parsoid
9048 <span>
9049 <ul>
9050 <li>a<span></span>
9051 </li>
9052 <li>b
9053 </li>
9054 </ul>
9055 </span>
9056 !! end
9057
9058 !! test
9059 Unclosed formatting tags that straddle lists are closed and reopened
9060 (php parser relies on Tidy to fix up)
9061 !! options
9062 parsoid=wt2html,wt2wt,html2html
9063 !! wikitext
9064 # <s> a
9065 # b </s>
9066 !! html/php+tidy
9067 <ol>
9068 <li><s>a</s></li>
9069 <li><s>b</s></li>
9070 </ol>
9071 !! html/parsoid
9072 <ol><li> <s> a</s></li>
9073 <li><s> b </s></li></ol>
9074 !! end
9075
9076 # See bug 68395.
9077 !!test
9078 1. List embedded in a formatting tag
9079 !! wikitext
9080 <small>
9081 * foo
9082 </small>
9083 !! html/php+tidy
9084 <ul>
9085 <li><small>foo</small></li>
9086 </ul>
9087 !! html/parsoid
9088 <small>
9089 <ul>
9090 <li> foo</li>
9091 </ul>
9092 </small>
9093 !!end
9094
9095 ## Ugly Parsoid output here
9096 ## Not sure what the right output is.
9097 !!test
9098 2. List embedded in a formatting tag
9099 !! wikitext
9100 <small>
9101 *a
9102 *b</small>
9103 !! html/php+tidy
9104 <ul>
9105 <li><small>a</small></li>
9106 <li><small>b</small></li>
9107 </ul>
9108 !! html/parsoid
9109 <small></small>
9110 <ul><small>
9111 <li>a</li>
9112 </small>
9113 <li><small>b</small></li>
9114 </ul>
9115 !!end
9116
9117 # Ugly Parsoid and PHP parser output here
9118 # Not sure if we want to make this a test!
9119 #
9120 ## !!test
9121 ## 3. Unclosed formatting tags in list elements
9122 ## !! wikitext
9123 ## *<small>a
9124 ## *<small>b
9125 ## !! html/php+tidy
9126 ## <ul>
9127 ## <li><small>a</small></li>
9128 ## <li><small><small>b</small></small></li>
9129 ## </ul>
9130 ## !! html/parsoid
9131 ## <ul>
9132 ## <li><small>a</small></li>
9133 ## <small>
9134 ## <li><small>b</small></li>
9135 ## </small></ul>
9136 ## !!end
9137
9138 # This is a bug in the PHP parser + tidy combination.
9139 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9140 # and then fostered out of the table by tidy.)
9141 # We believe the Parsoid output to be correct.
9142 !! test
9143 Table with missing opening <tr> tag
9144 !! options
9145 parsoid=wt2html,wt2wt
9146 !! wikitext
9147 <table>
9148 <td>foo</td>
9149 </tr>
9150 </table>
9151 !! html+tidy
9152 <table>
9153 <tr>
9154 <td>foo</td>
9155 </tr>
9156 </table>
9157 !! end
9158
9159 ###
9160 ### Magic Words
9161 ###
9162
9163 # Note that the current date is hard-coded as
9164 # 1970-01-01T00:02:03Z (a Thursday)
9165 # when running parser tests. The timezone is also fixed to GMT, so
9166 # local date will be identical to current date.
9167
9168 !! test
9169 Magic Word: {{CURRENTDAY}}
9170 !! wikitext
9171 {{CURRENTDAY}}
9172 !! html
9173 <p>1
9174 </p>
9175 !! end
9176
9177 !! test
9178 Magic Word: {{CURRENTDAY2}}
9179 !! wikitext
9180 {{CURRENTDAY2}}
9181 !! html
9182 <p>01
9183 </p>
9184 !! end
9185
9186 !! test
9187 Magic Word: {{CURRENTDAYNAME}}
9188 !! wikitext
9189 {{CURRENTDAYNAME}}
9190 !! html
9191 <p>Thursday
9192 </p>
9193 !! end
9194
9195 !! test
9196 Magic Word: {{CURRENTDOW}}
9197 !! wikitext
9198 {{CURRENTDOW}}
9199 !! html
9200 <p>4
9201 </p>
9202 !! end
9203
9204 !! test
9205 Magic Word: {{CURRENTMONTH}}
9206 !! wikitext
9207 {{CURRENTMONTH}}
9208 !! html
9209 <p>01
9210 </p>
9211 !! end
9212
9213 !! test
9214 Magic Word: {{CURRENTMONTH1}}
9215 !! wikitext
9216 {{CURRENTMONTH1}}
9217 !! html
9218 <p>1
9219 </p>
9220 !! end
9221
9222 !! test
9223 Magic Word: {{CURRENTMONTHABBREV}}
9224 !! wikitext
9225 {{CURRENTMONTHABBREV}}
9226 !! html
9227 <p>Jan
9228 </p>
9229 !! end
9230
9231 !! test
9232 Magic Word: {{CURRENTMONTHNAME}}
9233 !! wikitext
9234 {{CURRENTMONTHNAME}}
9235 !! html
9236 <p>January
9237 </p>
9238 !! end
9239
9240 !! test
9241 Magic Word: {{CURRENTMONTHNAMEGEN}}
9242 !! wikitext
9243 {{CURRENTMONTHNAMEGEN}}
9244 !! html
9245 <p>January
9246 </p>
9247 !! end
9248
9249 !! test
9250 Magic Word: {{CURRENTTIME}}
9251 !! wikitext
9252 {{CURRENTTIME}}
9253 !! html
9254 <p>00:02
9255 </p>
9256 !! end
9257
9258 !! test
9259 Magic Word: {{CURRENTHOUR}}
9260 !! wikitext
9261 {{CURRENTHOUR}}
9262 !! html
9263 <p>00
9264 </p>
9265 !! end
9266
9267 !! test
9268 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9269 !! wikitext
9270 {{CURRENTWEEK}}
9271 !! html
9272 <p>1
9273 </p>
9274 !! end
9275
9276 !! test
9277 Magic Word: {{CURRENTYEAR}}
9278 !! wikitext
9279 {{CURRENTYEAR}}
9280 !! html
9281 <p>1970
9282 </p>
9283 !! end
9284
9285 !! test
9286 Magic Word: {{CURRENTTIMESTAMP}}
9287 !! wikitext
9288 {{CURRENTTIMESTAMP}}
9289 !! html
9290 <p>19700101000203
9291 </p>
9292 !! end
9293
9294 !! test
9295 Magic Words LOCAL (UTC)
9296 !! wikitext
9297 * {{LOCALMONTH}}
9298 * {{LOCALMONTH1}}
9299 * {{LOCALMONTHNAME}}
9300 * {{LOCALMONTHNAMEGEN}}
9301 * {{LOCALMONTHABBREV}}
9302 * {{LOCALDAY}}
9303 * {{LOCALDAY2}}
9304 * {{LOCALDAYNAME}}
9305 * {{LOCALYEAR}}
9306 * {{LOCALTIME}}
9307 * {{LOCALHOUR}}
9308 * {{LOCALWEEK}}
9309 * {{LOCALDOW}}
9310 * {{LOCALTIMESTAMP}}
9311 !! html
9312 <ul><li> 01</li>
9313 <li> 1</li>
9314 <li> January</li>
9315 <li> January</li>
9316 <li> Jan</li>
9317 <li> 1</li>
9318 <li> 01</li>
9319 <li> Thursday</li>
9320 <li> 1970</li>
9321 <li> 00:02</li>
9322 <li> 00</li>
9323 <li> 1</li>
9324 <li> 4</li>
9325 <li> 19700101000203</li></ul>
9326
9327 !! end
9328
9329 !! test
9330 Magic Word: {{FULLPAGENAME}}
9331 !! options
9332 title=[[User:Ævar Arnfjörð Bjarmason]]
9333 !! wikitext
9334 {{FULLPAGENAME}}
9335 !! html
9336 <p>User:Ævar Arnfjörð Bjarmason
9337 </p>
9338 !! end
9339
9340 !! test
9341 Magic Word: {{FULLPAGENAMEE}}
9342 !! options
9343 title=[[User:Ævar Arnfjörð Bjarmason]]
9344 !! wikitext
9345 {{FULLPAGENAMEE}}
9346 !! html
9347 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9348 </p>
9349 !! end
9350
9351 !! test
9352 Magic Word: {{TALKSPACE}}
9353 !! options
9354 title=[[User:Ævar Arnfjörð Bjarmason]]
9355 !! wikitext
9356 {{TALKSPACE}}
9357 !! html
9358 <p>User talk
9359 </p>
9360 !! end
9361
9362 !! test
9363 Magic Word: {{TALKSPACE}}, same namespace
9364 !! options
9365 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9366 !! wikitext
9367 {{TALKSPACE}}
9368 !! html
9369 <p>User talk
9370 </p>
9371 !! end
9372
9373 !! test
9374 Magic Word: {{TALKSPACE}}, main namespace
9375 !! options
9376 title=[[Parser Test]]
9377 !! wikitext
9378 {{TALKSPACE}}
9379 !! html
9380 <p>Talk
9381 </p>
9382 !! end
9383
9384 !! test
9385 Magic Word: {{TALKSPACEE}}
9386 !! options
9387 title=[[User:Ævar Arnfjörð Bjarmason]]
9388 !! wikitext
9389 {{TALKSPACEE}}
9390 !! html
9391 <p>User_talk
9392 </p>
9393 !! end
9394
9395 !! test
9396 Magic Word: {{SUBJECTSPACE}}
9397 !! options
9398 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9399 !! wikitext
9400 {{SUBJECTSPACE}}
9401 !! html
9402 <p>User
9403 </p>
9404 !! end
9405
9406 !! test
9407 Magic Word: {{SUBJECTSPACE}}, same namespace
9408 !! options
9409 title=[[User:Ævar Arnfjörð Bjarmason]]
9410 !! wikitext
9411 {{SUBJECTSPACE}}
9412 !! html
9413 <p>User
9414 </p>
9415 !! end
9416
9417 !! test
9418 Magic Word: {{SUBJECTSPACE}}, main namespace
9419 !! options
9420 title=[[Parser Test]]
9421 !! wikitext
9422 {{SUBJECTSPACE}}
9423 !! html
9424
9425 !! end
9426
9427 !! test
9428 Magic Word: {{SUBJECTSPACEE}}
9429 !! options
9430 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9431 !! wikitext
9432 {{SUBJECTSPACEE}}
9433 !! html
9434 <p>User
9435 </p>
9436 !! end
9437
9438 !! test
9439 Magic Word: {{NAMESPACE}}
9440 !! options
9441 title=[[User:Ævar Arnfjörð Bjarmason]]
9442 !! wikitext
9443 {{NAMESPACE}}
9444 !! html
9445 <p>User
9446 </p>
9447 !! end
9448
9449 !! test
9450 Magic Word: {{NAMESPACEE}}
9451 !! options
9452 title=[[User:Ævar Arnfjörð Bjarmason]]
9453 !! wikitext
9454 {{NAMESPACEE}}
9455 !! html
9456 <p>User
9457 </p>
9458 !! end
9459
9460 !! test
9461 Magic Word: {{NAMESPACENUMBER}}
9462 !! options
9463 title=[[User:Ævar Arnfjörð Bjarmason]]
9464 !! wikitext
9465 {{NAMESPACENUMBER}}
9466 !! html
9467 <p>2
9468 </p>
9469 !! end
9470
9471 !! test
9472 Magic Word: {{SUBPAGENAME}}
9473 !! options
9474 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9475 !! wikitext
9476 {{SUBPAGENAME}}
9477 !! html
9478 <p>sub ö
9479 </p>
9480 !! end
9481
9482 !! test
9483 Magic Word: {{SUBPAGENAMEE}}
9484 !! options
9485 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9486 !! wikitext
9487 {{SUBPAGENAMEE}}
9488 !! html
9489 <p>sub_%C3%B6
9490 </p>
9491 !! end
9492
9493 !! test
9494 Magic Word: {{ROOTPAGENAME}}
9495 !! options
9496 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9497 !! wikitext
9498 {{ROOTPAGENAME}}
9499 !! html
9500 <p>Ævar Arnfjörð Bjarmason
9501 </p>
9502 !! end
9503
9504 !! test
9505 Magic Word: {{ROOTPAGENAMEE}}
9506 !! options
9507 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9508 !! wikitext
9509 {{ROOTPAGENAMEE}}
9510 !! html
9511 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9512 </p>
9513 !! end
9514
9515 !! test
9516 Magic Word: {{BASEPAGENAME}}
9517 !! options
9518 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9519 !! wikitext
9520 {{BASEPAGENAME}}
9521 !! html
9522 <p>Ævar Arnfjörð Bjarmason
9523 </p>
9524 !! end
9525
9526 !! test
9527 Magic Word: {{BASEPAGENAMEE}}
9528 !! options
9529 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9530 !! wikitext
9531 {{BASEPAGENAMEE}}
9532 !! html
9533 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9534 </p>
9535 !! end
9536
9537 !! test
9538 Magic Word: {{TALKPAGENAME}}
9539 !! options
9540 title=[[User:Ævar Arnfjörð Bjarmason]]
9541 !! wikitext
9542 {{TALKPAGENAME}}
9543 !! html
9544 <p>User talk:Ævar Arnfjörð Bjarmason
9545 </p>
9546 !! end
9547
9548 !! test
9549 Magic Word: {{TALKPAGENAMEE}}
9550 !! options
9551 title=[[User:Ævar Arnfjörð Bjarmason]]
9552 !! wikitext
9553 {{TALKPAGENAMEE}}
9554 !! html
9555 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9556 </p>
9557 !! end
9558
9559 !! test
9560 Magic Word: {{SUBJECTPAGENAME}}
9561 !! options
9562 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9563 !! wikitext
9564 {{SUBJECTPAGENAME}}
9565 !! html
9566 <p>User:Ævar Arnfjörð Bjarmason
9567 </p>
9568 !! end
9569
9570 !! test
9571 Magic Word: {{SUBJECTPAGENAMEE}}
9572 !! options
9573 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9574 !! wikitext
9575 {{SUBJECTPAGENAMEE}}
9576 !! html
9577 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9578 </p>
9579 !! end
9580
9581 !! test
9582 Magic Word: {{NUMBEROFFILES}}
9583 !! wikitext
9584 {{NUMBEROFFILES}}
9585 !! html
9586 <p>5
9587 </p>
9588 !! end
9589
9590 !! test
9591 Magic Word: {{PAGENAME}}
9592 !! options
9593 title=[[User:Ævar Arnfjörð Bjarmason]]
9594 !! wikitext
9595 {{PAGENAME}}
9596 !! html
9597 <p>Ævar Arnfjörð Bjarmason
9598 </p>
9599 !! end
9600
9601 !! test
9602 Magic Word: {{PAGENAME}} with metacharacters
9603 !! options
9604 title=[['foo & bar = baz']]
9605 !! wikitext
9606 ''{{PAGENAME}}''
9607 !! html/php
9608 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9609 </p>
9610 !! html+tidy
9611 <p><i>'foo &amp; bar = baz'</i></p>
9612 !! end
9613
9614 !! test
9615 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9616 !! options
9617 title=[[*RFC 1234 http://example.com/]]
9618 !! wikitext
9619 {{PAGENAME}}
9620 !! html/php
9621 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9622 </p>
9623 !! html+tidy
9624 <p>*RFC 1234 http://example.com/</p>
9625 !! end
9626
9627 !! test
9628 Magic Word: {{PAGENAMEE}}
9629 !! options
9630 title=[[User:Ævar Arnfjörð Bjarmason]]
9631 !! wikitext
9632 {{PAGENAMEE}}
9633 !! html
9634 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9635 </p>
9636 !! end
9637
9638 !! test
9639 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9640 !! options
9641 title=[[*RFC 1234 http://example.com/]]
9642 !! wikitext
9643 {{PAGENAMEE}}
9644 !! html/php
9645 <p>&#42;RFC_1234_http&#58;//example.com/
9646 </p>
9647 !! html+tidy
9648 <p>*RFC_1234_http://example.com/</p>
9649 !! end
9650
9651 !! test
9652 Magic Word: {{REVISIONID}}
9653 !! wikitext
9654 {{REVISIONID}}
9655 !! html
9656 <p>1337
9657 </p>
9658 !! end
9659
9660 !! test
9661 Magic Word: {{SCRIPTPATH}}
9662 !! wikitext
9663 {{SCRIPTPATH}}
9664 !! html
9665 <p>/
9666 </p>
9667 !! end
9668
9669 !! test
9670 Magic Word: {{STYLEPATH}}
9671 !! wikitext
9672 {{STYLEPATH}}
9673 !! html
9674 <p>/skins
9675 </p>
9676 !! end
9677
9678 !! test
9679 Magic Word: {{SERVER}}
9680 !! wikitext
9681 {{SERVER}}
9682 !! html
9683 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9684 </p>
9685 !! end
9686
9687 !! test
9688 Magic Word: {{SERVERNAME}}
9689 !! wikitext
9690 {{SERVERNAME}}
9691 !! html
9692 <p>example.org
9693 </p>
9694 !! end
9695
9696 !! test
9697 Magic Word: {{SITENAME}}
9698 !! wikitext
9699 {{SITENAME}}
9700 !! html
9701 <p>MediaWiki
9702 </p>
9703 !! end
9704
9705 !! test
9706 Case-sensitive magic words, when cased differently, should just be template transclusions
9707 !! wikitext
9708 {{CurrentMonth}}
9709 {{currentday}}
9710 {{cURreNTweEK}}
9711 {{currentHour}}
9712 !! html
9713 <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>
9714 <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>
9715 <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>
9716 <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>
9717 </p>
9718 !! end
9719
9720 !! test
9721 Case-insensitive magic words should still work with weird casing.
9722 !! wikitext
9723 {{sErVeRNaMe}}
9724 {{LCFirst:AOEU}}
9725 {{ucFIRST:aoeu}}
9726 {{SERver}}
9727 !! html
9728 <p>example.org
9729 aOEU
9730 Aoeu
9731 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9732 </p>
9733 !! end
9734
9735 # From plwiki:PLOS_ONE
9736 !! test
9737 Parsoid: Page property magic word with magic word contents
9738 !! wikitext
9739 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9740 !! html/parsoid
9741 <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>"}]]}'/>
9742 !! end
9743
9744 !! test
9745 Parsoid: Template-generated DISPLAYTITLE
9746 !! wikitext
9747 {{{{echo|DISPLAYTITLE}}:Foo}}
9748 !! html/parsoid
9749 <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}}]}'/>
9750 !! end
9751
9752 !! test
9753 Namespace 1 {{ns:1}}
9754 !! wikitext
9755 {{ns:1}}
9756 !! html
9757 <p>Talk
9758 </p>
9759 !! end
9760
9761 !! test
9762 Namespace 1 {{ns:01}}
9763 !! wikitext
9764 {{ns:01}}
9765 !! html
9766 <p>Talk
9767 </p>
9768 !! end
9769
9770 !! test
9771 Namespace 0 {{ns:0}} (bug 4783)
9772 !! wikitext
9773 {{ns:0}}
9774 !! html
9775
9776 !! end
9777
9778 !! test
9779 Namespace 0 {{ns:00}} (bug 4783)
9780 !! wikitext
9781 {{ns:00}}
9782 !! html
9783
9784 !! end
9785
9786 !! test
9787 Namespace -1 {{ns:-1}}
9788 !! wikitext
9789 {{ns:-1}}
9790 !! html
9791 <p>Special
9792 </p>
9793 !! end
9794
9795 !! test
9796 Namespace User {{ns:User}}
9797 !! wikitext
9798 {{ns:User}}
9799 !! html
9800 <p>User
9801 </p>
9802 !! end
9803
9804 !! test
9805 Namespace User talk {{ns:User_talk}}
9806 !! wikitext
9807 {{ns:User_talk}}
9808 !! html
9809 <p>User talk
9810 </p>
9811 !! end
9812
9813 !! test
9814 Namespace User talk {{ns:uSeR tAlK}}
9815 !! wikitext
9816 {{ns:uSeR tAlK}}
9817 !! html
9818 <p>User talk
9819 </p>
9820 !! end
9821
9822 !! test
9823 Namespace File {{ns:File}}
9824 !! wikitext
9825 {{ns:File}}
9826 !! html
9827 <p>File
9828 </p>
9829 !! end
9830
9831 !! test
9832 Namespace File {{ns:Image}}
9833 !! wikitext
9834 {{ns:Image}}
9835 !! html
9836 <p>File
9837 </p>
9838 !! end
9839
9840 !! test
9841 Namespace (lang=de) Benutzer {{ns:User}}
9842 !! options
9843 language=de
9844 !! wikitext
9845 {{ns:User}}
9846 !! html
9847 <p>Benutzer
9848 </p>
9849 !! end
9850
9851 !! test
9852 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9853 !! options
9854 language=de
9855 !! wikitext
9856 {{ns:3}}
9857 !! html
9858 <p>Benutzer Diskussion
9859 </p>
9860 !! end
9861
9862
9863 !! test
9864 Urlencode
9865 !! wikitext
9866 {{urlencode:hi world?!}}
9867 {{urlencode:hi world?!|WIKI}}
9868 {{urlencode:hi world?!|PATH}}
9869 {{urlencode:hi world?!|QUERY}}
9870 !! html
9871 <p>hi+world%3F%21
9872 hi_world%3F!
9873 hi%20world%3F%21
9874 hi+world%3F%21
9875 </p>
9876 !! end
9877
9878 !! test
9879 Magic Word: prioritize type info over data-parsoid
9880 !! options
9881 parsoid=html2wt
9882 !! html/parsoid
9883 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9884 !! wikitext
9885 __FORCETOC__
9886 !! end
9887
9888 !! test
9889 Magic Word: serialize on separate line (parsoid)
9890 !! options
9891 parsoid=wt2wt,html2wt
9892 !! wikitext
9893 foo
9894 __NOTOC__
9895 bar
9896 !! html/parsoid
9897 foo<meta property="mw:PageProp/notoc"/>bar
9898 !! end
9899
9900 !! test
9901 Magic Word: rt non-english wikis
9902 !! options
9903 parsoid=wt2wt
9904 language=de
9905 !! wikitext
9906 __NOEDITSECTION__
9907 !! html/parsoid
9908 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9909 !! end
9910
9911 !!test
9912 __proto__ is treated as normal wikitext (T105997)
9913 !!wikitext
9914 __proto__
9915 !!html
9916 <p>__proto__
9917 </p>
9918 !!end
9919
9920 ###
9921 ### Magic links
9922 ###
9923 !! test
9924 Magic links: internal link to RFC (bug 479)
9925 !! wikitext
9926 [[RFC 123]]
9927 !! html/php
9928 <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>
9929 </p>
9930 !! html/parsoid
9931 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
9932 !! end
9933
9934 !! test
9935 Magic links: RFC (bug 479)
9936 !! wikitext
9937 RFC 822
9938 !! html/php
9939 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9940 </p>
9941 !! html/parsoid
9942 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
9943 !! end
9944
9945 !! test
9946 Magic links: RFC (bug 65278)
9947 !! wikitext
9948 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9949 !! html/php
9950 <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.
9951 </p>
9952 !! html/parsoid
9953 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
9954 !! end
9955
9956 !! test
9957 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9958 !! wikitext
9959 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9960 RFC
9961 822
9962 !! html/php
9963 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9964 RFC
9965 822
9966 </p>
9967 !! html/parsoid
9968 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
9969 RFC
9970 822</p>
9971 !! end
9972
9973 !! test
9974 Magic links: ISBN (bug 1937)
9975 !! wikitext
9976 ISBN 0-306-40615-2
9977 !! html/php
9978 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9979 </p>
9980 !! html/parsoid
9981 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
9982 !! end
9983
9984 !! test
9985 Magic links: ISBN (bug 65278)
9986 !! wikitext
9987 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9988 !! html/php
9989 <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.
9990 </p>
9991 !! html/parsoid
9992 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9993 !! end
9994
9995 !! test
9996 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9997 !! wikitext
9998 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9999 ISBN
10000 9780316098113
10001 ISBN 978
10002 0316098113
10003 !! html/php
10004 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10005 ISBN
10006 9780316098113
10007 ISBN 978
10008 0316098113
10009 </p>
10010 !! html/parsoid
10011 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10012 ISBN
10013 9780316098113
10014 ISBN 978
10015 0316098113</p>
10016 !! end
10017
10018 !! test
10019 Magic links: PMID incorrectly converts space to underscore
10020 !! wikitext
10021 PMID 1234
10022 !! html/php
10023 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10024 </p>
10025 !! html/parsoid
10026 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10027 !! end
10028
10029 !! test
10030 Magic links: PMID (bug 65278)
10031 !! wikitext
10032 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10033 !! html/php
10034 <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.
10035 </p>
10036 !! html/parsoid
10037 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10038 !! end
10039
10040 !! test
10041 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10042 !! wikitext
10043 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10044 PMID
10045 1234
10046 !! html/php
10047 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10048 PMID
10049 1234
10050 </p>
10051 !! html/parsoid
10052 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10053 PMID
10054 1234</p>
10055 !! end
10056
10057 ###
10058 ### Templates
10059 ####
10060
10061 !! test
10062 Nonexistent template
10063 !! wikitext
10064 {{thistemplatedoesnotexist}}
10065 !! html
10066 <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>
10067 </p>
10068 !! end
10069
10070 !! test
10071 Template with invalid target containing tags
10072 !! wikitext
10073 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10074 !! html
10075 <p>{{a<b>b</b>|foo|a=b|a = b}}
10076 </p>
10077 !! end
10078
10079 !! test
10080 Template with invalid target containing unclosed tag
10081 !! wikitext
10082 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10083 !! html
10084 <p>{{a<b>|foo|a=b|a = b}}</b>
10085 </p>
10086 !! end
10087
10088 !! test
10089 Template with invalid target containing wikilink
10090 !! wikitext
10091 {{[[Main Page]]}}
10092 !! html/php
10093 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10094 </p>
10095 !! html/parsoid
10096 <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>
10097 !! end
10098
10099 !! test
10100 Template with just whitespace in it, bug #68421
10101 !! wikitext
10102 {{echo|{{ }}}}
10103 !! html/parsoid
10104 <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>
10105 !! end
10106
10107 !! article
10108 Template:test
10109 !! text
10110 This is a test template
10111 !! endarticle
10112
10113 !! test
10114 Simple template
10115 !! wikitext
10116 {{test}}
10117 !! html
10118 <p>This is a test template
10119 </p>
10120 !! end
10121
10122 !! test
10123 Template with explicit namespace
10124 !! wikitext
10125 {{Template:test}}
10126 !! html
10127 <p>This is a test template
10128 </p>
10129 !! end
10130
10131
10132 !! article
10133 Template:paramtest
10134 !! text
10135 This is a test template with parameter {{{param}}}
10136 !! endarticle
10137
10138 !! test
10139 Template parameter
10140 !! wikitext
10141 {{paramtest|param=foo}}
10142 !! html
10143 <p>This is a test template with parameter foo
10144 </p>
10145 !! end
10146
10147 !! article
10148 Template:paramtestnum
10149 !! text
10150 [[{{{1}}}|{{{2}}}]]
10151 !! endarticle
10152
10153 !! test
10154 Template unnamed parameter
10155 !! wikitext
10156 {{paramtestnum|Main Page|the main page}}
10157 !! html
10158 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10159 </p>
10160 !! end
10161
10162 !! article
10163 Template:templatesimple
10164 !! text
10165 (test)
10166 !! endarticle
10167
10168 !! article
10169 Template:templateredirect
10170 !! text
10171 #redirect [[Template:templatesimple]]
10172 !! endarticle
10173
10174 !! article
10175 Template:templateasargtestnum
10176 !! text
10177 {{{{{1}}}}}
10178 !! endarticle
10179
10180 !! article
10181 Template:templateasargtest
10182 !! text
10183 {{template{{{templ}}}}}
10184 !! endarticle
10185
10186 !! article
10187 Template:templateasargtest2
10188 !! text
10189 {{{{{templ}}}}}
10190 !! endarticle
10191
10192 !! test
10193 Template with template name as unnamed argument
10194 !! wikitext
10195 {{templateasargtestnum|templatesimple}}
10196 !! html
10197 <p>(test)
10198 </p>
10199 !! end
10200
10201 !! test
10202 Template with template name as argument
10203 !! wikitext
10204 {{templateasargtest|templ=simple}}
10205 !! html
10206 <p>(test)
10207 </p>
10208 !! end
10209
10210 !! test
10211 Template with template name as argument (2)
10212 !! wikitext
10213 {{templateasargtest2|templ=templatesimple}}
10214 !! html
10215 <p>(test)
10216 </p>
10217 !! end
10218
10219 !! article
10220 Template:templateasargtestdefault
10221 !! text
10222 {{{{{templ|templatesimple}}}}}
10223 !! endarticle
10224
10225 !! article
10226 Template:templa
10227 !! text
10228 '''templ'''
10229 !! endarticle
10230
10231 !! test
10232 Template with default value
10233 !! wikitext
10234 {{templateasargtestdefault}}
10235 !! html
10236 <p>(test)
10237 </p>
10238 !! end
10239
10240 !! test
10241 Template with default value (value set)
10242 !! wikitext
10243 {{templateasargtestdefault|templ=templa}}
10244 !! html
10245 <p><b>templ</b>
10246 </p>
10247 !! end
10248
10249 !! test
10250 Template redirect
10251 !! wikitext
10252 {{templateredirect}}
10253 !! html/php
10254 <p>(test)
10255 </p>
10256 !! html/parsoid
10257 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10258 !! end
10259
10260 !! test
10261 Template with argument in separate line
10262 !! wikitext
10263 {{ templateasargtest |
10264 templ = simple }}
10265 !! html
10266 <p>(test)
10267 </p>
10268 !! end
10269
10270 !! test
10271 Template with complex template as argument
10272 !! wikitext
10273 {{paramtest|
10274 param ={{ templateasargtest |
10275 templ = simple }}}}
10276 !! html
10277 <p>This is a test template with parameter (test)
10278 </p>
10279 !! end
10280
10281 !! test
10282 Template with thumb image (with link in description)
10283 !! wikitext
10284 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10285 !! html/php
10286 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>
10287
10288 !! html+tidy
10289 <p>This is a test template with parameter</p>
10290 <div class="thumb tright">
10291 <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>
10292 <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>
10293 </div>
10294 </div>
10295 !! html/parsoid
10296 <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>
10297 !! end
10298
10299 !! article
10300 Template:complextemplate
10301 !! text
10302 {{{1}}} {{paramtest|
10303 param ={{{param}}}}}
10304 !! endarticle
10305
10306 !! test
10307 Template with complex arguments
10308 !! wikitext
10309 {{complextemplate|
10310 param ={{ templateasargtest |
10311 templ = simple }}|[[Template:complextemplate|link]]}}
10312 !! html
10313 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10314 </p>
10315 !! end
10316
10317 !! test
10318 BUG 553: link with two variables in a piped link
10319 !! wikitext
10320 {|
10321 |[[{{{1}}}|{{{2}}}]]
10322 |}
10323 !! html
10324 <table>
10325 <tr>
10326 <td>[[{{{1}}}|{{{2}}}]]
10327 </td></tr></table>
10328
10329 !! end
10330
10331 !! test
10332 Magic variable as template parameter
10333 !! wikitext
10334 {{paramtest|param={{SITENAME}}}}
10335 !! html
10336 <p>This is a test template with parameter MediaWiki
10337 </p>
10338 !! end
10339
10340 !! article
10341 Template:linktest
10342 !! text
10343 [[{{{param}}}|link]]
10344 !! endarticle
10345
10346 !! test
10347 Template parameter as link source
10348 !! wikitext
10349 {{linktest|param=Main Page}}
10350 !! html
10351 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10352 </p>
10353 !! end
10354
10355 !!article
10356 Template:paramtest2
10357 !! text
10358 including another template, {{paramtest|param={{{arg}}}}}
10359 !! endarticle
10360
10361 !! test
10362 Template passing argument to another template
10363 !! wikitext
10364 {{paramtest2|arg='hmm'}}
10365 !! html
10366 <p>including another template, This is a test template with parameter 'hmm'
10367 </p>
10368 !! end
10369
10370 !! article
10371 Template:Linktest2
10372 !! text
10373 Main Page
10374 !! endarticle
10375
10376 !! test
10377 Template as link source
10378 !! wikitext
10379 [[{{linktest2}}]]
10380
10381 [[{{linktest2}}|Main Page]]
10382
10383 [[{{linktest2}}]]Page
10384 !! html
10385 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10386 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10387 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10388 </p>
10389 !! end
10390
10391
10392 !! article
10393 Template:loop1
10394 !! text
10395 {{loop2}}
10396 !! endarticle
10397
10398 !! article
10399 Template:loop2
10400 !! text
10401 {{loop1}}
10402 !! endarticle
10403
10404 !! test
10405 Template infinite loop
10406 !! wikitext
10407 {{loop1}}
10408 !! html
10409 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10410 </p>
10411 !! end
10412
10413 !! test
10414 Template from main namespace
10415 !! wikitext
10416 {{:Main Page}}
10417 !! html
10418 <p>blah blah
10419 </p>
10420 !! end
10421
10422 !! article
10423 Template:table
10424 !! text
10425 {|
10426 | 1 || 2
10427 |-
10428 | 3 || 4
10429 |}
10430 !! endarticle
10431
10432 !! test
10433 BUG 529: Template with table, not included at beginning of line
10434 !! wikitext
10435 foo {{table}}
10436 !! html
10437 <p>foo
10438 </p>
10439 <table>
10440 <tr>
10441 <td> 1 </td>
10442 <td> 2
10443 </td></tr>
10444 <tr>
10445 <td> 3 </td>
10446 <td> 4
10447 </td></tr></table>
10448
10449 !! end
10450
10451 !! test
10452 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10453 !! wikitext
10454 foo
10455 {{table}}
10456 !! html
10457 <p>foo
10458 </p>
10459 <table>
10460 <tr>
10461 <td> 1 </td>
10462 <td> 2
10463 </td></tr>
10464 <tr>
10465 <td> 3 </td>
10466 <td> 4
10467 </td></tr></table>
10468
10469 !! end
10470
10471 !! test
10472 BUG 41: Template parameters shown as broken links
10473 !! wikitext
10474 {{{parameter}}}
10475 !! html
10476 <p>{{{parameter}}}
10477 </p>
10478 !! end
10479
10480 !! test
10481 Template with targets containing wikilinks
10482 !! wikitext
10483 {{[[foo]]}}
10484
10485 {{[[{{echo|foo}}]]}}
10486
10487 {{{{echo|[[foo}}]]}}
10488 !! html
10489 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10490 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10491 </p><p>{{[[foo}}]]
10492 </p>
10493 !! end
10494
10495 !! article
10496 Template:''
10497 !! text
10498 bar
10499 !! endarticle
10500
10501 !! test
10502 Templates: Double quotes as template target
10503 !! wikitext
10504 foo {{''}} baz
10505 !! html/php
10506 <p>foo bar baz
10507 </p>
10508 !! html/parsoid
10509 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10510 </p>
10511 !! end
10512
10513 !! article
10514 Template:MSGNW test
10515 !! text
10516 ''None'' of '''this''' should be
10517 * interpreted
10518 but rather passed unmodified
10519 {{test}}
10520 <gallery>
10521 File:Foobar.jpg
10522 </gallery>
10523 <!-- comment -->
10524 !! endarticle
10525
10526 # hmm, fix this or just deprecate msgnw and document its behavior?
10527 !! test
10528 msgnw keyword
10529 !! wikitext
10530 {{msgnw:MSGNW test}}
10531 !! html/php
10532 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10533 &#42; interpreted
10534 &#32;but rather passed unmodified
10535 &#123;&#123;test&#125;&#125;
10536 &#60;gallery&#62;
10537 File:Foobar.jpg
10538 &#60;/gallery&#62;
10539 &#60;!-- comment --&#62;
10540 </p>
10541 !! end
10542
10543 !! test
10544 int keyword
10545 !! wikitext
10546 {{int:youhavenewmessages|lots of money|not!}}
10547 !! html
10548 <p>You have lots of money (not!).
10549 </p>
10550 !! end
10551
10552 !! test
10553 int keyword - non-existing message
10554 !! wikitext
10555 {{int:var}}
10556 !! html
10557 <p>&lt;var&gt;
10558 </p>
10559 !! end
10560
10561 !! article
10562 Template:Includes
10563 !! text
10564 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10565 !! endarticle
10566
10567 !! test
10568 <includeonly> and <noinclude> being included
10569 !! wikitext
10570 {{Includes}}
10571 !! html
10572 <p>Foobar
10573 </p>
10574 !! end
10575
10576 !! article
10577 Template:Includes2
10578 !! text
10579 <onlyinclude>Foo</onlyinclude>bar
10580 !! endarticle
10581
10582 !! test
10583 <onlyinclude> being included
10584 !! wikitext
10585 {{Includes2}}
10586 !! html
10587 <p>Foo
10588 </p>
10589 !! end
10590
10591
10592 !! article
10593 Template:Includes3
10594 !! text
10595 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10596 !! endarticle
10597
10598 !! test
10599 <onlyinclude> and <includeonly> being included
10600 !! wikitext
10601 {{Includes3}}
10602 !! html
10603 <p>Foo
10604 </p>
10605 !! end
10606
10607 !! test
10608 <includeonly> and <noinclude> on a page
10609 !! wikitext
10610 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10611 !! html
10612 <p>Foozar
10613 </p>
10614 !! end
10615
10616 !! test
10617 Un-closed <noinclude>
10618 !! wikitext
10619 <noinclude>
10620 !! html
10621 !! end
10622
10623 !! test
10624 <onlyinclude> on a page
10625 !! wikitext
10626 <onlyinclude>Foo</onlyinclude>bar
10627 !! html
10628 <p>Foobar
10629 </p>
10630 !! end
10631
10632 !! test
10633 Un-closed <onlyinclude>
10634 !! wikitext
10635 <onlyinclude>
10636 !! html
10637 !! end
10638
10639 !!test
10640 Self-closed noinclude, includeonly, onlyinclude tags
10641 !! wikitext
10642 <noinclude />
10643 <includeonly />
10644 <onlyinclude />
10645 !! html
10646 <p><br />
10647 </p>
10648 !!end
10649
10650 !!test
10651 Unbalanced includeonly and noinclude tags
10652 !! wikitext
10653 {|
10654 |a</noinclude>
10655 |b</noinclude></noinclude>
10656 |c</noinclude></includeonly>
10657 |d</includeonly></includeonly>
10658 |}
10659 !! html
10660 <table>
10661 <tr>
10662 <td>a
10663 </td>
10664 <td>b
10665 </td>
10666 <td>c&lt;/includeonly&gt;
10667 </td>
10668 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10669 </td></tr></table>
10670
10671 !!end
10672
10673 !! article
10674 Template:Includeonly section
10675 !! text
10676 <includeonly>
10677 ==Includeonly section==
10678 </includeonly>
10679 ==Section T-1==
10680 !!endarticle
10681
10682 !! test
10683 Bug 6563: Edit link generation for section shown by <includeonly>
10684 !! wikitext
10685 {{includeonly section}}
10686 !! html
10687 <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>
10688 <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>
10689
10690 !! end
10691
10692 # Uses same input as the contents of [[Template:Includeonly section]]
10693 !! test
10694 Bug 6563: Section extraction for section shown by <includeonly>
10695 !! options
10696 section=T-2
10697 !! wikitext
10698 <includeonly>
10699 ==Includeonly section==
10700 </includeonly>
10701 ==Section T-2==
10702 !! html
10703 ==Section T-2==
10704 !! end
10705
10706 !! test
10707 Bug 6563: Edit link generation for section suppressed by <includeonly>
10708 !! wikitext
10709 <includeonly>
10710 ==Includeonly section==
10711 </includeonly>
10712 ==Section 1==
10713 !! html
10714 <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>
10715
10716 !! end
10717
10718 !! test
10719 Bug 6563: Section extraction for section suppressed by <includeonly>
10720 !! options
10721 section=1
10722 !! wikitext
10723 <includeonly>
10724 ==Includeonly section==
10725 </includeonly>
10726 ==Section 1==
10727 !! html
10728 ==Section 1==
10729 !! end
10730
10731 !! test
10732 Un-closed <includeonly>
10733 !! wikitext
10734 <includeonly>
10735 !! html
10736 !! end
10737
10738 !! test
10739 Includes and comments at SOL
10740 !! wikitext
10741 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10742
10743 <noinclude>
10744 some
10745 </noinclude>* stuff
10746 * here
10747
10748 <includeonly>can have stuff</includeonly>=== here ===
10749
10750 !! html/php
10751 <h2><span class="mw-headline" id="hu">hu</span></h2>
10752 <p>some
10753 </p>
10754 <ul><li> stuff</li>
10755 <li> here</li></ul>
10756 <h3><span class="mw-headline" id="here">here</span></h3>
10757
10758 !! html/parsoid
10759 <!-- 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>
10760
10761 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10762 <p>some</p>
10763 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10764 <li> here</li></ul>
10765
10766 <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>
10767
10768 !! end
10769
10770 # TODO: test with DOM fragment reuse!
10771 !! test
10772 Parsoid: DOM fragment reuse
10773 !! options
10774 parsoid=wt2wt,wt2html
10775 !! wikitext
10776 a{{echo|b<table></table>c}}d
10777
10778 a{{echo|b
10779 <table></table>
10780 c}}d
10781
10782 {{echo|a
10783
10784 <table></table>
10785
10786 b}}
10787 !! html
10788 <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>
10789
10790 <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">
10791 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10792 </span><p about="#mwt2">cd</p>
10793
10794 <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">
10795
10796 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10797
10798 </span><p about="#mwt3">b</p>
10799 !! end
10800
10801 !! test
10802 Parsoid: Merge double tds (T52603)
10803 !! options
10804 parsoid
10805 !! wikitext
10806 {|
10807 |{{echo|{{!}} foo}}
10808 |}
10809 !! html
10810 <table><tbody>
10811 <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>
10812 </tbody></table>
10813 !! end
10814
10815 !! test
10816 Parsoid: Merge double tds in nested transclusion content (T52603)
10817 !! options
10818 parsoid
10819 !! wikitext
10820 {{echo|<div>}}
10821 {|
10822 |{{echo|{{!}} foo}}
10823 |}
10824 {{echo|</div>}}
10825 !! html
10826 <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}}]}'>
10827 <table><tbody>
10828 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10829 </tbody></table>
10830 </div>
10831 !! end
10832
10833 ###
10834 ### <includeonly> and <noinclude> in attributes
10835 ###
10836 !!test
10837 0. includeonly around the entire attribute
10838 !! wikitext
10839 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10840 !! html
10841 <p><span id="v2">bar</span>
10842 </p>
10843 !!end
10844
10845 !!test
10846 1. includeonly in html attr key
10847 !! wikitext
10848 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10849 !! html
10850 <p><span id="foo">bar</span>
10851 </p>
10852 !!end
10853
10854 !!test
10855 2. includeonly in html attr value
10856 !! wikitext
10857 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10858 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10859 !! html
10860 <p><span id="v1">bar</span>
10861 <span id="v1">bar</span>
10862 </p>
10863 !!end
10864
10865 !!test
10866 3. includeonly in part of an attr value
10867 !! wikitext
10868 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10869 !! html
10870 <p><span style="color:red;">bar</span>
10871 </p>
10872 !!end
10873
10874 !!test
10875 4. includeonly in table attributes
10876 !! wikitext
10877 {|
10878 |- <noinclude>
10879 |-
10880 |a
10881 </noinclude>
10882 |- <includeonly>
10883 |-
10884 |b
10885 </includeonly>
10886 |}
10887 !! html
10888 <table>
10889
10890
10891 <tr>
10892 <td>a
10893 </td></tr>
10894 </table>
10895
10896 !!end
10897
10898 ###
10899 ### Token Stream Patcher tests
10900 ###
10901 ### These tests won't always pass wt2wt and other modes because
10902 ### on serialization, the table will be output on a new line.
10903 ### For now, we are blacklisting them, and using this to test selser.
10904 ###
10905
10906 !!test
10907 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10908 !!options
10909 parsoid=wt2html,wt2wt
10910 !!wikitext
10911 {{echo|}}{| width = '100%'
10912 |foo
10913 |}
10914 !!html/parsoid
10915 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10916 <tbody><tr><td>foo</td></tr>
10917 </tbody></table>
10918 !!end
10919
10920 !!test
10921 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10922 !!options
10923 parsoid=wt2html,wt2wt
10924 !!wikitext
10925 <includeonly>a</includeonly>{| {{{b}}}
10926 |c
10927 |}
10928 !!html/parsoid
10929 <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}}}":""}}'>
10930 <tbody><tr><td>c</td></tr>
10931 </tbody></table>
10932
10933 !!end
10934
10935 ###
10936 ### Testing parsing of templates where a template arg
10937 ### has the same name as the template itself.
10938 ###
10939
10940 !! article
10941 Template:quote
10942 !! text
10943 {{{quote|{{{1}}}}}}
10944 !! endarticle
10945
10946 !!test
10947 Templates: Template Name/Arg clash: 1. Use of positional param
10948 !! wikitext
10949 {{quote|foo}}
10950 !! html
10951 <p>foo
10952 </p>
10953 !!end
10954
10955 !!test
10956 Templates: Template Name/Arg clash: 2. Use of named param
10957 !! wikitext
10958 {{quote|quote=foo}}
10959 !! html
10960 <p>foo
10961 </p>
10962 !!end
10963
10964 !!test
10965 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10966 !! wikitext
10967 {{quote|quote}}
10968 !! html
10969 <p>quote
10970 </p>
10971 !!end
10972
10973 ###
10974 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10975 ###
10976
10977 !!test
10978 Templates: 1. Simple use
10979 !! wikitext
10980 {{echo|Foo}}
10981 !! html
10982 <p>Foo
10983 </p>
10984 !!end
10985
10986 !!test
10987 Templates: 2. Inside a block tag
10988 !! wikitext
10989 <div>{{echo|Foo}}</div>
10990 <blockquote>{{echo|Foo}}</blockquote>
10991 !! html
10992 <div>Foo</div>
10993 <blockquote>Foo</blockquote>
10994
10995 !! html+tidy
10996 <div>Foo</div>
10997 <blockquote>
10998 <p>Foo</p>
10999 </blockquote>
11000 !!end
11001
11002 !!test
11003 Templates: P-wrapping: 1a. Templates on consecutive lines
11004 !! wikitext
11005 {{echo|Foo}}
11006 {{echo|bar}}
11007 !! html
11008 <p>Foo
11009 bar
11010 </p>
11011 !!end
11012
11013 !!test
11014 Templates: P-wrapping: 1b. Templates on consecutive lines
11015 !! wikitext
11016 Foo
11017
11018 {{echo|bar}}
11019 {{echo|baz}}
11020 !! html
11021 <p>Foo
11022 </p><p>bar
11023 baz
11024 </p>
11025 !!end
11026
11027 !!test
11028 Templates: P-wrapping: 1c. Templates on consecutive lines
11029 !! wikitext
11030 {{echo|Foo}}
11031 {{echo|bar}} <div>baz</div>
11032 !! html
11033 <p>Foo
11034 </p>
11035 bar <div>baz</div>
11036
11037 !! html+tidy
11038 <p>Foo</p>
11039 <p>bar</p>
11040 <div>baz</div>
11041 !! end
11042
11043 !!test
11044 Templates: P-wrapping: 1d. Template preceded by comment-only line
11045 !!options
11046 parsoid
11047 !! wikitext
11048 <!-- foo -->
11049 {{echo|Bar}}
11050 !! html
11051 <!-- foo -->
11052
11053 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11054 !!end
11055
11056 !!test
11057 Templates: Inline Text: 1. Multiple template uses
11058 !! wikitext
11059 {{echo|Foo}}bar{{echo|baz}}
11060 !! html
11061 <p>Foobarbaz
11062 </p>
11063 !!end
11064
11065 !!test
11066 Templates: Inline Text: 2. Back-to-back template uses
11067 !! wikitext
11068 {{echo|Foo}}{{echo|bar}}
11069 !! html
11070 <p>Foobar
11071 </p>
11072 !!end
11073
11074 !!test
11075 Templates: Block Tags: 1. Multiple template uses
11076 !! wikitext
11077 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11078 !! html
11079 <div>Foo</div><div>bar</div><div>baz</div>
11080
11081 !!end
11082
11083 !!test
11084 Templates: Block Tags: 2. Back-to-back template uses
11085 !! wikitext
11086 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11087 !! html
11088 <div>Foo</div><div>bar</div>
11089
11090 !!end
11091
11092 # This is an edge case relating to paragraph wrapping.
11093 !!test
11094 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11095 !! wikitext
11096 {{echo|a
11097 b</p>}}
11098 !! html/parsoid
11099 <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
11100 b</p>
11101 !!end
11102
11103 !!test
11104 Templates: Links: 1. Simple example
11105 !! wikitext
11106 {{echo|[[Foo|bar]]}}
11107 !! html
11108 <p><a href="/wiki/Foo" title="Foo">bar</a>
11109 </p>
11110 !!end
11111
11112 !!test
11113 Templates: Links: 2. Generation of link href
11114 !! wikitext
11115 [[{{echo|Foo}}|bar]]
11116 !! html
11117 <p><a href="/wiki/Foo" title="Foo">bar</a>
11118 </p>
11119 !!end
11120
11121 !!test
11122 Templates: Links: 3. Generation of part of a link href
11123 !! wikitext
11124 [[Fo{{echo|o}}|bar]]
11125
11126 [[Foo{{echo|bar}}]]
11127
11128 [[Foo{{echo|bar}}baz]]
11129
11130 [[Foo{{echo|bar}}|bar]]
11131
11132 [[:Foo{{echo|bar}}]]
11133
11134 [[:Foo{{echo|bar}}|bar]]
11135 !! html
11136 <p><a href="/wiki/Foo" title="Foo">bar</a>
11137 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11138 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11139 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11140 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11141 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11142 </p>
11143 !!end
11144
11145 !!test
11146 Templates: Links: 4. Multiple templates generating link href
11147 !! wikitext
11148 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11149 !! html
11150 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11151 </p>
11152 !!end
11153
11154 !!test
11155 Templates: Links: 5. Generation of link text
11156 !! wikitext
11157 [[Foo|{{echo|bar}}]]
11158 !! html
11159 <p><a href="/wiki/Foo" title="Foo">bar</a>
11160 </p>
11161 !!end
11162
11163 !!test
11164 Templates: Links: 5. Nested templates (only outermost template should be marked)
11165 !! wikitext
11166 {{echo|[[{{echo|Foo}}|bar]]}}
11167 !! html
11168 <p><a href="/wiki/Foo" title="Foo">bar</a>
11169 </p>
11170 !!end
11171
11172 !!test
11173 Templates: HTML Tag: 1. Generation of HTML attr. key
11174 !! wikitext
11175 <div {{echo|style}}="color:red;">foo</div>
11176 !! html
11177 <div style="color:red;">foo</div>
11178
11179 !!end
11180
11181 !!test
11182 Templates: HTML Tag: 2. Generation of HTML attr. value
11183 !! wikitext
11184 <div style={{echo|'color:red;'}}>foo</div>
11185 !! html
11186 <div style="color:red;">foo</div>
11187
11188 !!end
11189
11190 !!test
11191 Templates: HTML Tag: 3. Generation of HTML attr key and value
11192 !! wikitext
11193 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11194 !! html
11195 <div style="color:red;">foo</div>
11196
11197 !!end
11198
11199 !!test
11200 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11201 !! wikitext
11202 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11203 !! html
11204 <div title="This is a long title with just one piece templated">foo</div>
11205
11206 !!end
11207
11208 !!test
11209 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11210 !! wikitext
11211 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11212 !! html
11213 <div title="This is a long title with just one piece templated">foo</div>
11214
11215 !!end
11216
11217 !!test
11218 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11219 !! wikitext
11220 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11221 !! html
11222 <div title="This is a long title with just one piece templated">foo</div>
11223
11224 !!end
11225
11226 # SSS FIXME: While it is great we added support for all this,
11227 # do we want to make this part of the spec? Maybe we want to
11228 # deprecate this kind of usage in the future?
11229 !!test
11230 Templates: HTML Tag: 7. Generation of partial attribute key string
11231 !! wikitext
11232 <div st{{echo|yle}}="color:red;">foo</div>
11233 !! html
11234 <div style="color:red;">foo</div>
11235
11236 !!end
11237
11238 !! test
11239 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11240 !! wikitext
11241 <div {{echo|1=id="v1"}}>bar</div>
11242 !! html
11243 <div id="v1">bar</div>
11244
11245 !!end
11246
11247 !! test
11248 Templates: HTML Tag: 9. Multiple template-generated attributes
11249 !! wikitext
11250 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11251 !! html
11252 <div id="v1" title="foo">bar</div>
11253
11254 !!end
11255
11256 !! test
11257 Templates: Support for templates generating attributes and content
11258 !! wikitext
11259 {| {{mixed_attr_content_template}}
11260 |-
11261 |bar
11262 |}
11263 !! html/php
11264 <table style="color:red;" title="T48811">
11265
11266 <tr>
11267 <td>foo
11268 </td></tr>
11269 <tr>
11270 <td>bar
11271 </td></tr></table>
11272
11273 !! html/parsoid
11274 <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|}"]}'>
11275 <tbody><tr>
11276 <td>foo</td></tr>
11277 <tr>
11278 <td>bar</td></tr>
11279 </tbody></table>
11280 !!end
11281
11282 !! test
11283 1. Entities and nowikis inside templated attributes should be handled correctly
11284 !! wikitext
11285 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11286 !! html/php
11287 <div style="background:#f9f9f9;">foo</div>
11288
11289 !! html/parsoid
11290 <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>
11291 !! end
11292
11293 !! test
11294 2. Entities and nowikis inside templated attributes should be handled correctly
11295 !! wikitext
11296 {|
11297 |{{table_attribs_3}}
11298 |}
11299 !! html/php
11300 <table>
11301 <tr>
11302 <td style="background:#f9f9f9;">Foo
11303 </td></tr></table>
11304
11305 !! html/parsoid
11306 <table>
11307 <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>
11308 </tbody></table>
11309 !! end
11310
11311 !! test
11312 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11313 !! wikitext
11314 {{tbl-start}}
11315 |{{table_attribs_3}}
11316 {{tbl-end}}
11317 !! html/php
11318 <table>
11319 <tr>
11320 <td style="background:#f9f9f9;">Foo
11321 </td></tr></table>
11322
11323 !! html/parsoid
11324 <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}}]}'>
11325 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11326 </tbody></table>
11327 !! end
11328
11329 # T107622
11330 !! test
11331 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11332 !! wikitext
11333 {|
11334 | {{table_attribs_6}} hi
11335 |}
11336 !! html/php
11337 <table>
11338 <tr>
11339 <td style="background: red;"> hi
11340 </td></tr></table>
11341
11342 !! html/parsoid
11343 <table>
11344 <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>
11345 </tbody></table>
11346 !! end
11347
11348 !!test
11349 Templates: HTML Tables: 1. Generating start of a HTML table
11350 !! wikitext
11351 {{echo|<table><tr><td>foo</td>}}</tr></table>
11352 !! html
11353 <table><tr><td>foo</td></tr></table>
11354
11355 !!end
11356
11357 !!test
11358 Templates: HTML Tables: 2a. Generating middle of a HTML table
11359 !! wikitext
11360 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11361 !! html
11362 <table><tr><td>foo</td></tr></table>
11363
11364 !!end
11365
11366 !!test
11367 Templates: HTML Tables: 2b. Generating middle of a HTML table
11368 !! wikitext
11369 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11370 !! html
11371 <table><tr><td>foo</td></tr></table>
11372
11373 !!end
11374
11375 !!test
11376 Templates: HTML Tables: 3. Generating end of a HTML table
11377 !! wikitext
11378 <table><tr>{{echo|<td>foo</td></tr></table>}}
11379 !! html
11380 <table><tr><td>foo</td></tr></table>
11381
11382 !!end
11383
11384 !!test
11385 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11386 !! wikitext
11387 {{echo|<table>}}<tr><td>foo</td></tr></table>
11388 !! html
11389 <table><tr><td>foo</td></tr></table>
11390
11391 !!end
11392
11393 !!test
11394 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11395 !! wikitext
11396 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11397 !! html
11398 <table><tr><td>foo</td></tr></table>
11399
11400 !!end
11401
11402 !!test
11403 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11404 !! wikitext
11405 <table><tr>{{echo|<td>}}foo</td></tr></table>
11406 !! html
11407 <table><tr><td>foo</td></tr></table>
11408
11409 !!end
11410
11411 !!test
11412 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11413 !! wikitext
11414 <table><tr><td>foo{{echo|</td>}}</tr></table>
11415 !! html
11416 <table><tr><td>foo</td></tr></table>
11417
11418 !!end
11419
11420 !!test
11421 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11422 !! wikitext
11423 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11424 !! html
11425 <table><tr><td>foo</td></tr></table>
11426
11427 !!end
11428
11429 !!test
11430 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11431 !! wikitext
11432 <table><tr><td>foo</td></tr>{{echo|</table>}}
11433 !! html
11434 <table><tr><td>foo</td></tr></table>
11435
11436 !!end
11437
11438 !!test
11439 Templates: HTML Tables: 5. Proper fostering of categories from inside
11440 !!options
11441 parsoid=wt2html,wt2wt
11442 !! wikitext
11443 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11444 <!--Two categories (Bug 50330)-->
11445 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11446 !! html
11447 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11448 <!--Two categories (Bug 50330)-->
11449 <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>
11450 !!end
11451
11452 !!test
11453 Templates: Wiki Tables: 1a. Fostering of entire template content
11454 !! wikitext
11455 {|
11456 {{echo|a}}
11457 |}
11458 !! html
11459 <table>
11460 a
11461 <tr><td></td></tr></table>
11462
11463 !! html+tidy
11464 <p>a</p>
11465 <table>
11466 <tr>
11467 <td></td>
11468 </tr>
11469 </table>
11470 !! end
11471
11472 !!test
11473 Templates: Wiki Tables: 1b. Fostering of entire template content
11474 !! wikitext
11475 {|
11476 {{echo|<div>}}
11477 foo
11478 {{echo|</div>}}
11479 |}
11480 !! html
11481 <table>
11482 <div>
11483 <p>foo
11484 </p>
11485 </div>
11486 <tr><td></td></tr></table>
11487
11488 !! html+tidy
11489 <div>
11490 <p>foo</p>
11491 </div>
11492 <table>
11493 <tr>
11494 <td></td>
11495 </tr>
11496 </table>
11497 !! end
11498
11499 !!test
11500 Templates: Wiki Tables: 2. Fostering of partial template content
11501 !! wikitext
11502 {|
11503 {{echo|a
11504 <div>b</div>}}
11505 |}
11506 !! html
11507 <table>
11508 a
11509 <div>b</div>
11510 <tr><td></td></tr></table>
11511
11512 !! html+tidy
11513 <p>a</p>
11514 <div>b</div>
11515 <table>
11516 <tr>
11517 <td></td>
11518 </tr>
11519 </table>
11520 !! end
11521
11522 !!test
11523 Templates: Wiki Tables: 3. td-content via multiple templates
11524 !! wikitext
11525 {|
11526 {{echo|{{pipe}}a}}{{echo|b}}
11527 |}
11528 !! html
11529 <table>
11530 <tr>
11531 <td>ab
11532 </td></tr></table>
11533
11534 !!end
11535
11536 !!test
11537 Templates: Wiki Tables: 4. Templated tags, no content
11538 !! wikitext
11539 {{tbl-start}}
11540 {{tbl-end}}
11541 !! html
11542 <table>
11543 <tr><td></td></tr></table>
11544
11545 !!end
11546
11547 !!test
11548 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11549 !! wikitext
11550 {{tbl-start}}
11551 |foo
11552 {{tbl-end}}
11553 !! html
11554 <table>
11555 <tr>
11556 <td>foo
11557 </td></tr></table>
11558
11559 !!end
11560
11561 !!test
11562 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11563 !! wikitext
11564 {{tbl-start}}
11565 {{!}}foo
11566 {{tbl-end}}
11567 !! html
11568 <table>
11569 <tr>
11570 <td>foo
11571 </td></tr></table>
11572
11573 !!end
11574
11575 ## This test case is very specific to Parsoid's internals
11576 ## and is hence only tested for Parsoid's code. Parsoid uses
11577 ## a <meta> marker tag for <ref> tags and they are expanded
11578 ## much later. We are verifying that this <meta> tag usage
11579 ## doesn't prevent foster parenting.
11580 !!test
11581 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11582 !!wikitext
11583 {{PartialTable}}<ref>foo</ref>
11584 |}
11585
11586 <references />
11587 !!html/parsoid
11588 <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">
11589 <tbody>
11590 </tbody></table>
11591
11592 <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>
11593 !!end
11594
11595 !! test
11596 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11597 !! wikitext
11598 {{echo|
11599 {{{!}}
11600 {{!}}-}}
11601 <onlyinclude>
11602 |foo
11603 </onlyinclude>
11604 {{!}}}
11605 !! html/parsoid
11606 <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{{!}}}"]}'>
11607 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11608 <tbody><tr>
11609
11610 <td>foo
11611 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11612 </tbody></table>
11613 !! end
11614
11615 !!test
11616 Templates: Lists: Multi-line list-items via templates
11617 !! wikitext
11618 *{{echo|a {{nonexistent|
11619 unused}}}}
11620 *{{echo|b {{nonexistent|
11621 unused}}}}
11622 !! html
11623 <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>
11624 <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>
11625
11626 !!end
11627
11628 !!test
11629 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11630 !! wikitext
11631 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11632 !! html
11633 <p><i>ab</i>c<i>d</i>e
11634 </p>
11635 !!end
11636
11637 !!test
11638 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11639 (PHP parser generates misnested html)
11640 !! wikitext
11641 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11642 !! html/parsoid
11643 <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>
11644 !!end
11645
11646 !!test
11647 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11648 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11649 !! options
11650 parsoid=wt2html,wt2wt
11651 !! wikitext
11652 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11653 !! html
11654 <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>
11655 <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>
11656 <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>
11657 !!end
11658
11659 !!test
11660 Templates: Ugly nesting: 4. Divs opened/closed across templates
11661 !! wikitext
11662 a<div>b{{echo|c</div>d}}e
11663 !! html
11664 a<div>bc</div>de
11665
11666 !! html+tidy
11667 <p>a</p>
11668 <div>bc</div>
11669 <p>de</p>
11670 !! end
11671
11672 !!test
11673 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11674 (Parsoid-centric)
11675 !! options
11676 parsoid
11677 !! wikitext
11678 {|
11679 |{{echo|foo</table>}}
11680 |bar
11681 |}
11682 !! html
11683 <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|}"]}'>
11684
11685 <tbody>
11686 <tr>
11687 <td>foo</td></tr></tbody></table><span about="#mwt1">
11688 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11689 |}</span>
11690 !!end
11691
11692 !!test
11693 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11694 (Parsoid-centric)
11695 !! options
11696 parsoid
11697 !! wikitext
11698 <table>
11699 <tr>
11700 <td>
11701 <table>
11702 <tr>
11703 <td>1. {{echo|foo </table>}}</td>
11704 <td> bar </td>
11705 <td>2. {{echo|baz </table>}}</td>
11706 </tr>
11707 <tr>
11708 <td>abc</td>
11709 </tr>
11710 </table>
11711 </td>
11712 </tr>
11713 <tr>
11714 <td>xyz</td>
11715 </tr>
11716 </table>
11717 !! html
11718 <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>"]}'>
11719 <tbody><tr>
11720 <td>
11721 <table>
11722 <tbody><tr>
11723 <td>1. foo </td></tr></tbody></table></td>
11724 <td> bar </td>
11725 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11726 </span><span about="#mwt2">
11727 </span><span about="#mwt2">
11728 </span><span about="#mwt2">abc</span><span about="#mwt2">
11729 </span><span about="#mwt2">
11730 </span><span about="#mwt2">
11731 </span><span about="#mwt2">
11732 </span><span about="#mwt2">
11733 </span><span about="#mwt2">
11734 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11735 </span><span about="#mwt2">
11736 </span>
11737 !!end
11738
11739 !! test
11740 Templates: Ugly templates: 3. newline-only template parameter
11741 !! wikitext
11742 foo {{echo|
11743 }}
11744 !! html
11745 <p>foo
11746 </p>
11747 !! end
11748
11749 # This looks like a bug: a single newline triggers p/br for some reason.
11750 !! test
11751 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11752 !! wikitext
11753 {{echo|
11754 }}
11755 !! html
11756 <p><br />
11757 </p>
11758 !! end
11759
11760 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11761 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11762 !! test
11763 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11764 !! wikitext
11765 {{echo|<table>}}
11766 {{echo|<div>foo}}
11767 {{echo|</table>}}
11768 !! html/parsoid
11769 <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
11770 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11771 </table>
11772 !! end
11773
11774 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11775 # that are "identical" and generate nesting cycles in the algorithm
11776 !! test
11777 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11778 !! wikitext
11779 {{echo|<table><tr><td><table>}}
11780 {{echo|<div>}}
11781 {{echo|</div>}}
11782 !! html/parsoid
11783 <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"}'>
11784 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11785 </table></td></tr></tbody></table>
11786 !! end
11787
11788 !!test
11789 Parser Functions: 1. Simple example
11790 !! wikitext
11791 {{uc:foo}}
11792 !! html
11793 <p>FOO
11794 </p>
11795 !!end
11796
11797 !!test
11798 Parser Functions: 2. Nested use (only outermost should be marked up)
11799 !! wikitext
11800 {{uc:{{lc:FOO}}}}
11801 !! html
11802 <p>FOO
11803 </p>
11804 !!end
11805
11806 ###
11807 ### Pre-save transform tests
11808 ###
11809 !! test
11810 pre-save transform: subst:
11811 !! options
11812 pst
11813 !! wikitext
11814 {{subst:test}}
11815 !! html/php
11816 This is a test template
11817 !! end
11818
11819 !! test
11820 pre-save transform: normal template
11821 !! options
11822 pst
11823 !! wikitext
11824 {{test}}
11825 !! html/php
11826 {{test}}
11827 !! end
11828
11829 !! test
11830 pre-save transform: nonexistent template
11831 !! options
11832 pst
11833 !! wikitext
11834 {{thistemplatedoesnotexist}}
11835 !! html/php
11836 {{thistemplatedoesnotexist}}
11837 !! end
11838
11839 !! test
11840 pre-save transform: subst magic variables
11841 !! options
11842 pst
11843 !! wikitext
11844 {{subst:SITENAME}}
11845 !! html/php
11846 MediaWiki
11847 !! end
11848
11849 # This is bug 89, which I fixed. -- wtm
11850 !! test
11851 pre-save transform: subst: templates with parameters
11852 !! options
11853 pst
11854 !! wikitext
11855 {{subst:paramtest|param="something else"}}
11856 !! html/php
11857 This is a test template with parameter "something else"
11858 !! end
11859
11860 !! article
11861 Template:nowikitest
11862 !! text
11863 <nowiki>'''not wiki'''</nowiki>
11864 !! endarticle
11865
11866 !! test
11867 pre-save transform: nowiki in subst (bug 1188)
11868 !! options
11869 pst
11870 !! wikitext
11871 {{subst:nowikitest}}
11872 !! html/php
11873 <nowiki>'''not wiki'''</nowiki>
11874 !! end
11875
11876 !! article
11877 Template:commenttest
11878 !! text
11879 This template has <!-- a comment --> in it.
11880 !! endarticle
11881
11882 !! test
11883 pre-save transform: comment in subst (bug 1936)
11884 !! options
11885 pst
11886 !! wikitext
11887 {{subst:commenttest}}
11888 !! html/php
11889 This template has <!-- a comment --> in it.
11890 !! end
11891
11892 !! test
11893 pre-save transform: unclosed tag
11894 !! options
11895 pst noxml
11896 !! wikitext
11897 <nowiki>'''not wiki'''
11898 !! html/php
11899 <nowiki>'''not wiki'''
11900 !! end
11901
11902 !! test
11903 pre-save transform: mixed tag case
11904 !! options
11905 pst noxml
11906 !! wikitext
11907 <NOwiki>'''not wiki'''</noWIKI>
11908 !! html/php
11909 <NOwiki>'''not wiki'''</noWIKI>
11910 !! end
11911
11912 !! test
11913 pre-save transform: unclosed comment in <nowiki>
11914 !! options
11915 pst noxml
11916 !! wikitext
11917 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11918 !! html/php
11919 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11920 !!end
11921
11922 # Leading @ in this template definition works around a limitation
11923 # in parsoid's parserTests which otherwise strips the <span> from the
11924 # result (confusing it for a template wrapper)
11925 !! article
11926 Template:dangerous
11927 !!text
11928 @<span onmouseover="alert('crap')">Oh no</span>
11929 !!endarticle
11930
11931 !!test
11932 (confirming safety of fix for subst bug 1936)
11933 !! wikitext
11934 {{Template:dangerous}}
11935 !! html
11936 <p>@<span>Oh no</span>
11937 </p>
11938 !! end
11939
11940 !! test
11941 pre-save transform: comment containing gallery (bug 5024)
11942 !! options
11943 pst
11944 !! wikitext
11945 <!-- <gallery>data</gallery> -->
11946 !! html/php
11947 <!-- <gallery>data</gallery> -->
11948 !!end
11949
11950 !! test
11951 pre-save transform: comment containing extension
11952 !! options
11953 pst
11954 !! wikitext
11955 <!-- <tag>data</tag> -->
11956 !! html/php
11957 <!-- <tag>data</tag> -->
11958 !!end
11959
11960 !! test
11961 pre-save transform: comment containing nowiki
11962 !! options
11963 pst
11964 !! wikitext
11965 <!-- <nowiki>data</nowiki> -->
11966 !! html/php
11967 <!-- <nowiki>data</nowiki> -->
11968 !!end
11969
11970 !! test
11971 pre-save transform: <noinclude> in subst (bug 3298)
11972 !! options
11973 pst
11974 !! wikitext
11975 {{subst:Includes}}
11976 !! html/php
11977 Foobar
11978 !! end
11979
11980 !! test
11981 pre-save transform: <onlyinclude> in subst (bug 3298)
11982 !! options
11983 pst
11984 !! wikitext
11985 {{subst:Includes2}}
11986 !! html/php
11987 Foo
11988 !! end
11989
11990 !! article
11991 Template:SubstTest
11992 !!text
11993 {{<includeonly>subst:</includeonly>Includes}}
11994 !! endarticle
11995
11996 !! article
11997 Template:SafeSubstTest
11998 !! text
11999 {{<includeonly>safesubst:</includeonly>Includes}}
12000 !! endarticle
12001
12002 !! test
12003 bug 22297: safesubst: works during PST
12004 !! options
12005 pst
12006 !! wikitext
12007 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12008 !! html/php
12009 FoobarFoobar
12010 !! end
12011
12012 !! test
12013 bug 22297: safesubst: works during normal parse
12014 !! wikitext
12015 {{SafeSubstTest}}
12016 !! html
12017 <p>Foobar
12018 </p>
12019 !! end
12020
12021 !! test
12022 subst: does not work during normal parse
12023 !! wikitext
12024 {{SubstTest}}
12025 !! html
12026 <p>{{subst:Includes}}
12027 </p>
12028 !! end
12029
12030 !! test
12031 pre-save transform: context links ("pipe trick")
12032 !! options
12033 pst
12034 !! wikitext
12035 [[Article (context)|]]
12036 [[Bar:Article|]]
12037 [[:Bar:Article|]]
12038 [[Bar:Article (context)|]]
12039 [[:Bar:Article (context)|]]
12040 [[|Article]]
12041 [[|Article (context)]]
12042 [[Bar:X (Y) Z|]]
12043 [[:Bar:X (Y) Z|]]
12044 !! html/php
12045 [[Article (context)|Article]]
12046 [[Bar:Article|Article]]
12047 [[:Bar:Article|Article]]
12048 [[Bar:Article (context)|Article]]
12049 [[:Bar:Article (context)|Article]]
12050 [[Article]]
12051 [[Article (context)]]
12052 [[Bar:X (Y) Z|X (Y) Z]]
12053 [[:Bar:X (Y) Z|X (Y) Z]]
12054 !! end
12055
12056 !! test
12057 pre-save transform: context links ("pipe trick") with interwiki prefix
12058 !! options
12059 pst
12060 !! wikitext
12061 [[interwiki:Article|]]
12062 [[:interwiki:Article|]]
12063 [[interwiki:Bar:Article|]]
12064 [[:interwiki:Bar:Article|]]
12065 !! html/php
12066 [[interwiki:Article|Article]]
12067 [[:interwiki:Article|Article]]
12068 [[interwiki:Bar:Article|Bar:Article]]
12069 [[:interwiki:Bar:Article|Bar:Article]]
12070 !! end
12071
12072 !! test
12073 pre-save transform: context links ("pipe trick") with parens in title
12074 !! options
12075 pst title=[[Somearticle (context)]]
12076 !! wikitext
12077 [[|Article]]
12078 !! html/php
12079 [[Article (context)|Article]]
12080 !! end
12081
12082 !! test
12083 pre-save transform: context links ("pipe trick") with comma in title
12084 !! options
12085 pst title=[[Someplace, Somewhere]]
12086 !! wikitext
12087 [[|Otherplace]]
12088 [[Otherplace, Elsewhere|]]
12089 [[Otherplace, Elsewhere, Anywhere|]]
12090 !! html/php
12091 [[Otherplace, Somewhere|Otherplace]]
12092 [[Otherplace, Elsewhere|Otherplace]]
12093 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12094 !! end
12095
12096 !! test
12097 pre-save transform: context links ("pipe trick") with parens and comma
12098 !! options
12099 pst title=[[Someplace (IGNORED), Somewhere]]
12100 !! wikitext
12101 [[|Otherplace]]
12102 [[Otherplace (place), Elsewhere|]]
12103 !! html/php
12104 [[Otherplace, Somewhere|Otherplace]]
12105 [[Otherplace (place), Elsewhere|Otherplace]]
12106 !! end
12107
12108 !! test
12109 pre-save transform: context links ("pipe trick") with comma and parens
12110 !! options
12111 pst title=[[Who, me? (context)]]
12112 !! wikitext
12113 [[|Yes, you.]]
12114 [[Me, Myself, and I (1937 song)|]]
12115 !! html/php
12116 [[Yes, you. (context)|Yes, you.]]
12117 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12118 !! end
12119
12120 !! test
12121 pre-save transform: context links ("pipe trick") with namespace
12122 !! options
12123 pst title=[[Ns:Somearticle]]
12124 !! wikitext
12125 [[|Article]]
12126 !! html/php
12127 [[Ns:Article|Article]]
12128 !! end
12129
12130 !! test
12131 pre-save transform: context links ("pipe trick") with namespace and parens
12132 !! options
12133 pst title=[[Ns:Somearticle (context)]]
12134 !! wikitext
12135 [[|Article]]
12136 !! html/php
12137 [[Ns:Article (context)|Article]]
12138 !! end
12139
12140 !! test
12141 pre-save transform: context links ("pipe trick") with namespace and comma
12142 !! options
12143 pst title=[[Ns:Somearticle, Context, Whatever]]
12144 !! wikitext
12145 [[|Article]]
12146 !! html/php
12147 [[Ns:Article, Context, Whatever|Article]]
12148 !! end
12149
12150 !! test
12151 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12152 !! options
12153 pst title=[[Ns:Somearticle, Context (context)]]
12154 !! wikitext
12155 [[|Article]]
12156 !! html/php
12157 [[Ns:Article (context)|Article]]
12158 !! end
12159
12160 !! test
12161 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12162 !! options
12163 pst title=[[Ns:Somearticle (IGNORED), Context]]
12164 !! wikitext
12165 [[|Article]]
12166 !! html/php
12167 [[Ns:Article, Context|Article]]
12168 !! end
12169
12170 !! test
12171 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12172 !! options
12173 pst
12174 !! wikitext
12175 [[Article(context)|]]
12176 [[Bar:Article(context)|]]
12177 [[:Bar:Article(context)|]]
12178 [[|Article(context)]]
12179 [[Bar:X(Y)Z|]]
12180 [[:Bar:X(Y)Z|]]
12181 !! html/php
12182 [[Article(context)|Article]]
12183 [[Bar:Article(context)|Article]]
12184 [[:Bar:Article(context)|Article]]
12185 [[Article(context)]]
12186 [[Bar:X(Y)Z|X(Y)Z]]
12187 [[:Bar:X(Y)Z|X(Y)Z]]
12188 !! end
12189
12190 !! test
12191 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12192 !! options
12193 pst
12194 !! wikitext
12195 [[Article (context)|]]
12196 [[Bar:Article (context)|]]
12197 [[:Bar:Article (context)|]]
12198 [[|Article (context)]]
12199 [[Bar:X (Y) Z|]]
12200 [[:Bar:X (Y) Z|]]
12201 !! html/php
12202 [[Article (context)|Article]]
12203 [[Bar:Article (context)|Article]]
12204 [[:Bar:Article (context)|Article]]
12205 [[Article (context)]]
12206 [[Bar:X (Y) Z|X (Y) Z]]
12207 [[:Bar:X (Y) Z|X (Y) Z]]
12208 !! end
12209
12210 !! test
12211 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12212 !! options
12213 pst
12214 !! wikitext
12215 [[Article(context)|]]
12216 [[Bar:Article(context)|]]
12217 [[:Bar:Article(context)|]]
12218 [[|Article(context)]]
12219 [[Bar:X(Y)Z|]]
12220 [[:Bar:X(Y)Z|]]
12221 !! html/php
12222 [[Article(context)|Article]]
12223 [[Bar:Article(context)|Article]]
12224 [[:Bar:Article(context)|Article]]
12225 [[Article(context)]]
12226 [[Bar:X(Y)Z|X(Y)Z]]
12227 [[:Bar:X(Y)Z|X(Y)Z]]
12228 !! end
12229
12230 !! test
12231 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12232 !! options
12233 pst
12234 !! wikitext
12235 [[Article (context), context|]]
12236 [[Article (context),context|]]
12237 [[Bar:Article (context), context|]]
12238 [[Bar:Article (context),context|]]
12239 [[:Bar:Article (context), context|]]
12240 [[:Bar:Article (context),context|]]
12241 !! html/php
12242 [[Article (context), context|Article]]
12243 [[Article (context),context|Article]]
12244 [[Bar:Article (context), context|Article]]
12245 [[Bar:Article (context),context|Article]]
12246 [[:Bar:Article (context), context|Article]]
12247 [[:Bar:Article (context),context|Article]]
12248 !! end
12249
12250 !! test
12251 pre-save transform: trim trailing empty lines
12252 !! options
12253 pst
12254 !! wikitext
12255 Empty lines are trimmed
12256
12257
12258
12259
12260 !! html/php
12261 Empty lines are trimmed
12262 !! end
12263
12264 !! test
12265 pre-save transform: Signature expansion
12266 !! options
12267 pst
12268 !! wikitext
12269 * ~~~
12270 * <noinclude>~~~</noinclude>
12271 * <includeonly>~~~</includeonly>
12272 * <onlyinclude>~~~</onlyinclude>
12273 !! html/php
12274 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12275 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12276 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12277 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12278 !! end
12279
12280
12281 !! test
12282 pre-save transform: Signature expansion in nowiki tags (bug 93)
12283 !! options
12284 pst disabled
12285 !! wikitext
12286 Shall not expand:
12287
12288 <nowiki>~~~~</nowiki>
12289
12290 <includeonly><nowiki>~~~~</nowiki></includeonly>
12291
12292 <noinclude><nowiki>~~~~</nowiki></noinclude>
12293
12294 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12295
12296 {{subst:Foo}} shall be converted to FOO
12297
12298 As well as inside noinclude/onlyinclude
12299 <noinclude>{{subst:Foo}}</noinclude>
12300 <onlyinclude>{{subst:Foo}}</onlyinclude>
12301
12302 But not inside includeonly
12303 <includeonly>{{subst:Foo}}</includeonly>
12304 !! html/php
12305 Shall not expand:
12306
12307 <nowiki>~~~~</nowiki>
12308
12309 <includeonly><nowiki>~~~~</nowiki></includeonly>
12310
12311 <noinclude><nowiki>~~~~</nowiki></noinclude>
12312
12313 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12314
12315 FOO shall be converted to FOO
12316
12317 As well as inside noinclude/onlyinclude
12318 <noinclude>FOO</noinclude>
12319 <onlyinclude>FOO</onlyinclude>
12320
12321 But not inside includeonly
12322 <includeonly>{{subst:Foo}}</includeonly>
12323 !! end
12324
12325 !! test
12326 Parsoid: Recognize nowiki with trailing space in tags
12327 !! options
12328 parsoid=wt2html
12329 !! wikitext
12330 <nowiki ><div>[[foo]]</nowiki >
12331
12332 a<nowiki / >b
12333
12334 c<nowiki />d
12335
12336 e<nowiki/ >f
12337 !! html
12338 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12339 <p>ab</p>
12340 <p>cd</p>
12341 <p>ef</p>
12342 !! end
12343
12344 !! test
12345 Parsoid: Recognize nowiki with odd capitalization
12346 !! options
12347 parsoid=wt2html
12348 !! wikitext
12349 <noWikI ><div>[[foo]]</Nowiki >
12350 !! html
12351 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12352 !! end
12353
12354
12355 !! test
12356 Parsoid: Escape nowiki with trailing space in tags
12357 !! options
12358 parsoid=html2wt
12359 !! html/parsoid
12360 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12361 <p>a&lt;nowiki /&gt;b</p>
12362 <p>c&lt;nowiki/ &gt;d</p>
12363 !! wikitext
12364 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12365
12366 a&lt;nowiki /&gt;b
12367
12368 c&lt;nowiki/ &gt;d
12369 !! end
12370
12371 !! test
12372 Parsoid: Escape weird noWikI capitalizations
12373 !! options
12374 parsoid=html2wt
12375 !! html/parsoid
12376 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12377 !! wikitext
12378 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12379 !! end
12380
12381 ###
12382 ### Message transform tests
12383 ###
12384 !! test
12385 message transform: magic variables
12386 !! options
12387 msg
12388 !! wikitext
12389 {{SITENAME}}
12390 !! html
12391 MediaWiki
12392 !! end
12393
12394 !! test
12395 message transform: should not transform wiki markup
12396 !! options
12397 msg
12398 !! wikitext
12399 ''test''
12400 !! html
12401 ''test''
12402 !! end
12403
12404 !! test
12405 message transform: <noinclude> in transcluded template (bug 4926)
12406 !! options
12407 msg
12408 !! wikitext
12409 {{Includes}}
12410 !! html
12411 Foobar
12412 !! end
12413
12414 !! test
12415 message transform: <onlyinclude> in transcluded template (bug 4926)
12416 !! options
12417 msg
12418 !! wikitext
12419 {{Includes2}}
12420 !! html
12421 Foo
12422 !! end
12423
12424 !! test
12425 {{#special:}} page name, known
12426 !! options
12427 msg
12428 !! wikitext
12429 {{#special:Recentchanges}}
12430 !! html
12431 Special:RecentChanges
12432 !! end
12433
12434 !! test
12435 {{#special:}} page name with subpage, known
12436 !! options
12437 msg
12438 !! wikitext
12439 {{#special:Recentchanges/param}}
12440 !! html
12441 Special:RecentChanges/param
12442 !! end
12443
12444 !! test
12445 {{#special:}} page name, unknown
12446 !! options
12447 msg
12448 !! wikitext
12449 {{#special:foobar nonexistent}}
12450 !! html
12451 Special:Foobar nonexistent
12452 !! end
12453
12454 !! test
12455 {{#speciale:}} page name, known
12456 !! options
12457 msg
12458 !! wikitext
12459 {{#speciale:Recentchanges}}
12460 !! html
12461 Special:RecentChanges
12462 !! end
12463
12464 !! test
12465 {{#speciale:}} page name with subpage, known
12466 !! options
12467 msg
12468 !! wikitext
12469 {{#speciale:Recentchanges/param}}
12470 !! html
12471 Special:RecentChanges/param
12472 !! end
12473
12474 !! test
12475 {{#speciale:}} page name, unknown
12476 !! options
12477 msg
12478 !! wikitext
12479 {{#speciale:foobar nonexistent}}
12480 !! html
12481 Special:Foobar_nonexistent
12482 !! end
12483
12484 ###
12485 ### Images
12486 ###
12487 ### For Parsoid-specific tests, see
12488 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12489
12490 !! test
12491 Simple image
12492 !! options
12493 parsoid=wt2html,wt2wt,html2html
12494 !! wikitext
12495 [[Image:foobar.jpg]]
12496 !! html/php
12497 <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>
12498 </p>
12499 !! html/parsoid
12500 <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>
12501 !! end
12502
12503 !! test
12504 Simple image (using File: namespace, now canonical)
12505 !! wikitext
12506 [[File:Foobar.jpg]]
12507 !! html/php
12508 <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>
12509 </p>
12510 !! html/parsoid
12511 <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>
12512 !! end
12513
12514 !! test
12515 Right-aligned image
12516 !! wikitext
12517 [[File:Foobar.jpg|right]]
12518 !! html/php
12519 <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>
12520
12521 !! html/parsoid
12522 <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>
12523 !! end
12524
12525 !! test
12526 Image with caption
12527 !! wikitext
12528 [[File:Foobar.jpg|right|Caption text]]
12529 !! html/php
12530 <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>
12531
12532 !! html/parsoid
12533 <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>
12534 !! end
12535
12536 !! test
12537 Image with caption, bug 53312 #1
12538 !! wikitext
12539 [[File:Foobar.jpg|right|Caption page stuff]]
12540 !! html/php
12541 <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>
12542
12543 !! html/parsoid
12544 <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>
12545 !! end
12546
12547 !! test
12548 Image with caption, bug 53312 #2
12549 !! wikitext
12550 [[File:Foobar.jpg|right|Caption page=]]
12551 !! html/php
12552 <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>
12553
12554 !! html/parsoid
12555 <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>
12556 !! end
12557
12558 !! test
12559 Image with caption, bug 53312 #3
12560 !! wikitext
12561 [[File:Foobar.jpg|right|Caption page=stuff]]
12562 !! html/php
12563 <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>
12564
12565 !! html/parsoid
12566 <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>
12567 !! end
12568
12569 !! test
12570 Allow empty links in image captions (Bug 60753)
12571 !! options
12572 thumbsize=220
12573 !! wikitext
12574 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12575 [[]]
12576 [[Link2]]
12577 ]]
12578 !! html/php
12579 <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>
12580
12581 !! html/parsoid
12582 <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>
12583 [[]]
12584 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12585 </figcaption></figure>
12586 !! end
12587
12588 !! test
12589 Titles in unlinked images (T23454)
12590 !! wikitext
12591 [[File:Foobar.jpg|link=|stuff]]
12592 !! html/php
12593 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12594 </p>
12595 !! end
12596
12597 !! test
12598 Link with empty target
12599 !! wikitext
12600 [[]]
12601 !! html
12602 <p>[[]]
12603 </p>
12604 !! end
12605
12606 !! test
12607 Image with link trail
12608 !! wikitext
12609 Linktrails should not work for images: [[File:Foobar.jpg]]s
12610 !! html/php
12611 <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
12612 </p>
12613 !! html/parsoid
12614 <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>
12615 !! end
12616
12617 !! test
12618 Image with empty attribute
12619 !! options
12620 parsoid=wt2html,wt2wt,html2html
12621 !! wikitext
12622 [[File:Foobar.jpg|right||Caption text]]
12623 !! html/php
12624 <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>
12625
12626 !! html/parsoid
12627 <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>
12628 !! end
12629
12630 !! test
12631 1. Block image with individual attributes from templates
12632 !! wikitext
12633 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12634 !! html/php
12635 <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>
12636
12637 !! html/parsoid
12638 <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>
12639 !! end
12640
12641 !! test
12642 2. Block Image with individual attributes from templates
12643 !! wikitext
12644 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12645 !! html/php
12646 <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>
12647
12648 !! html/parsoid
12649 <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>
12650 !! end
12651
12652 !! test
12653 3. Inline image with individual attributes from templates
12654 !! wikitext
12655 [[File:Foobar.jpg|{{echo|50px}}]]
12656 !! html/php
12657 <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>
12658 </p>
12659 !! html/parsoid
12660 <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>
12661 !! end
12662
12663 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12664 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12665 !! test
12666 Image with multiple attributes from the same template
12667 !! wikitext
12668 [[File:Foobar.jpg|{{image_attribs}}]]
12669 !! html/php
12670 <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>
12671
12672 !! html/parsoid
12673 <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>
12674 !! end
12675
12676 !! test
12677 Image with link tails
12678 !! options
12679 thumbsize=220
12680 !! wikitext
12681 123[[File:Foobar.jpg]]456
12682 123[[File:Foobar.jpg|right]]456
12683 123[[File:Foobar.jpg|thumb]]456
12684 !! html/php
12685 <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
12686 </p>
12687 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
12688 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
12689
12690 !! html/php+tidy
12691 <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>
12692 <p>123</p>
12693 <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>
12694 <p>456 123</p>
12695 <div class="thumb tright">
12696 <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>
12697 <div class="thumbcaption">
12698 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12699 </div>
12700 </div>
12701 </div>
12702 <p>456</p>
12703 !! html/parsoid
12704 <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>
12705 <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>
12706 <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>
12707 !! end
12708
12709 !! test
12710 Image with multiple captions -- only last one is accepted
12711 !! wikitext
12712 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12713 !! html/php
12714 <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>
12715
12716 !! html/parsoid
12717 <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>
12718 !! end
12719
12720 !! test
12721 Image with multiple widths -- use last
12722 !! wikitext
12723 [[File:Foobar.jpg|200px|300px|caption]]
12724 !! html/php
12725 <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>
12726 </p>
12727 !! html/parsoid
12728 <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>
12729 !! end
12730
12731 !! test
12732 Image with multiple alignments -- use first (bug 48664)
12733 !! options
12734 thumbsize=220
12735 !! wikitext
12736 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12737
12738 [[File:Foobar.jpg|middle|text-top|caption]]
12739 !! html/php
12740 <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>
12741 <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>
12742 </p>
12743 !! html/parsoid
12744 <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>
12745 <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>
12746 !! end
12747
12748 !! test
12749 Image with width attribute at different positions
12750 !! wikitext
12751 [[File:Foobar.jpg|200px|right|Caption]]
12752 [[File:Foobar.jpg|right|200px|Caption]]
12753 [[File:Foobar.jpg|right|Caption|200px]]
12754 !! html/php
12755 <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>
12756 <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>
12757 <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>
12758
12759 !! html/parsoid
12760 <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>
12761 <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>
12762 <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>
12763 !! end
12764
12765 # a sad bit of backward-compatibility
12766 !! test
12767 Image with size specified with pxpx (bug 13500, 51628)
12768 !! options
12769 parsoid=wt2html,wt2wt,html2html
12770 !! wikitext
12771 [[File:Foobar.jpg|20pxpx]]
12772 [[File:Foobar.jpg|200x20pxpx]]
12773 !! html/php
12774 <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>
12775 <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>
12776 </p>
12777 !! html/parsoid
12778 <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>
12779 !! end
12780
12781 !! test
12782 Image with link parameter, wiki target
12783 !! wikitext
12784 [[File:Foobar.jpg|link=Main Page]]
12785 !! html/php
12786 <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>
12787 </p>
12788 !! html/parsoid
12789 <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>
12790 !! end
12791
12792 # parsoid bug 49293 (part 1)
12793 !! test
12794 Image with link parameter, URL target
12795 !! wikitext
12796 [[File:Foobar.jpg|link=http://example.com/]]
12797 !! html/php
12798 <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>
12799 </p>
12800 !! html/parsoid
12801 <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>
12802 !! end
12803
12804 # parsoid bug 49293 (part 2)
12805 !! test
12806 Image with link parameter, protocol-less URL target
12807 !! wikitext
12808 [[File:Foobar.jpg|link=//example.com/]]
12809 !! html/php
12810 <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>
12811 </p>
12812 !! html/parsoid
12813 <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>
12814 !! end
12815
12816 !! test
12817 Escaping non-block captions (T107435)
12818 !! options
12819 parsoid={
12820 "modes": ["wt2wt"],
12821 "changes": [
12822 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12823 ]
12824 }
12825 !! wikitext
12826 [[Image:Foobar.jpg|caption]]
12827 !! wikitext/edited
12828 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12829 !! end
12830
12831 !! test
12832 Image with link parameter, wgExternalLinkTarget
12833 !! wikitext
12834 [[Image:foobar.jpg|link=http://example.com/]]
12835 !! config
12836 wgExternalLinkTarget='foobar'
12837 !! html
12838 <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>
12839 </p>
12840 !! end
12841
12842 !! test
12843 Image with link parameter, wgNoFollowLinks set to false
12844 !! wikitext
12845 [[Image:foobar.jpg|link=http://example.com/]]
12846 !! config
12847 wgNoFollowLinks=false
12848 !! html
12849 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12850 </p>
12851 !! end
12852
12853 !! test
12854 Image with link parameter, wgNoFollowDomainExceptions
12855 !! wikitext
12856 [[Image:foobar.jpg|link=http://example.com/]]
12857 !! config
12858 wgNoFollowDomainExceptions='example.com'
12859 !! html
12860 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12861 </p>
12862 !! end
12863
12864 !! test
12865 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12866 !! wikitext
12867 [[Image:foobar.jpg|link=http://example.com/|Title]]
12868 !! config
12869 wgExternalLinkTarget='foobar'
12870 !! html
12871 <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>
12872 </p>
12873 !! end
12874
12875 !! test
12876 Image with empty link parameter
12877 !! wikitext
12878 [[File:Foobar.jpg|link=]]
12879 !! html/php
12880 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12881 </p>
12882 !! html/parsoid
12883 <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>
12884 !! end
12885
12886 !! test
12887 Image with link parameter (wiki target) and unnamed parameter
12888 !! wikitext
12889 [[File:Foobar.jpg|link=Main_Page|Title]]
12890 !! html/php
12891 <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>
12892 </p>
12893 !! html/parsoid
12894 <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>
12895 !! end
12896
12897 !! test
12898 Image with link parameter (URL target) and unnamed parameter
12899 !! wikitext
12900 [[File:Foobar.jpg|link=http://example.com/|Title]]
12901 !! html/php
12902 <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>
12903 </p>
12904 !! html/parsoid
12905 <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>
12906 !! end
12907
12908 !! test
12909 Thumbnail image with link parameter
12910 !! options
12911 thumbsize=220
12912 parsoid=wt2html,wt2wt,html2html
12913 !! wikitext
12914 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12915 !! html/php
12916 <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>
12917
12918 !! html/parsoid
12919 <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>
12920 !! end
12921
12922 !! test
12923 Manually-specified thumbnail image
12924 !! options
12925 thumbsize=220
12926 !! wikitext
12927 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12928 !! html/php
12929 <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>
12930
12931 !! html/parsoid
12932 <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>
12933 !! end
12934
12935 !! test
12936 Manually-specified thumbnail image with explicit link to wiki page
12937 !! options
12938 thumbsize=220
12939 parsoid=wt2html,wt2wt,html2html
12940 !! wikitext
12941 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12942 !! html/php
12943 <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>
12944
12945 !! html/parsoid
12946 <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>
12947 !! end
12948
12949 !! test
12950 Manually-specified thumbnail image with explicit link to url
12951 !! options
12952 thumbsize=220
12953 parsoid=wt2html,wt2wt,html2html
12954 !! wikitext
12955 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12956 !! html/php
12957 <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>
12958
12959 !! html/parsoid
12960 <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>
12961 !! end
12962
12963 !! test
12964 Manually-specified thumbnail image with explicit no link
12965 !! options
12966 thumbsize=220
12967 parsoid=wt2html,wt2wt,html2html
12968 !! wikitext
12969 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12970 !! html/php
12971 <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>
12972
12973 !! html/parsoid
12974 <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>
12975 !! end
12976
12977 !! test
12978 Manually-specified thumbnail image with explicit link and alt text
12979 !! options
12980 thumbsize=220
12981 parsoid=wt2html,wt2wt,html2html
12982 !! wikitext
12983 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12984 !! html/php
12985 <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>
12986
12987 !! html/parsoid
12988 <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>
12989 !! end
12990
12991 !! test
12992 Image with frame and link
12993 !! options
12994 parsoid=wt2html,wt2wt,html2html
12995 !! wikitext
12996 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12997 !! html/php
12998 <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>
12999
13000 !! html/parsoid
13001 <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>
13002 !! end
13003
13004 !! test
13005 Image with frame and link and explicit alt
13006 !! options
13007 parsoid=wt2html,wt2wt,html2html
13008 !! wikitext
13009 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13010 !! html/php
13011 <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>
13012
13013 !! html/parsoid
13014 <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>
13015 !! end
13016
13017 !! test
13018 Image with wiki markup in implicit alt
13019 !! wikitext
13020 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13021
13022 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13023 !! html/php
13024 <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>
13025 </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>
13026 </p>
13027 !! html/parsoid
13028 <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>
13029 <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>
13030 !! end
13031
13032 !! test
13033 Alt image option should handle most kinds of wikitext without barfing
13034 !! wikitext
13035 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13036 !! html/php
13037 <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>
13038
13039 !! html/parsoid
13040 <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>
13041 !! end
13042
13043 ###################
13044 # Conflicting image format options.
13045 # First option specified should 'win'.
13046 # All three cases in each test should be identical.
13047
13048 !! test
13049 Image with 'frameless' first.
13050 !! options
13051 parsoid=wt2html,wt2wt,html2html
13052 !! wikitext
13053 [[File:Foobar.jpg|frameless|caption]]
13054
13055 [[File:Foobar.jpg|frameless|frame|caption]]
13056
13057 [[File:Foobar.jpg|frameless|thumb|caption]]
13058 !! html/php
13059 <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>
13060 </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>
13061 </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>
13062 </p>
13063 !! html/parsoid
13064 <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>
13065 <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>
13066 <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>
13067 !! end
13068
13069 !! test
13070 Image with 'frame' first.
13071 !! options
13072 parsoid=wt2html,wt2wt,html2html
13073 !! wikitext
13074 [[File:Foobar.jpg|frame|caption]]
13075 [[File:Foobar.jpg|frame|frameless|caption]]
13076 [[File:Foobar.jpg|frame|thumb|caption]]
13077 !! html/php
13078 <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>
13079 <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>
13080 <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>
13081
13082 !! html/parsoid
13083 <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>
13084 <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>
13085 <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>
13086 !! end
13087
13088 !! test
13089 Image with 'thumb' first.
13090 !! options
13091 parsoid=wt2html,wt2wt,html2html
13092 !! wikitext
13093 [[File:Foobar.jpg|thumb|caption]]
13094 [[File:Foobar.jpg|thumb|frameless|caption]]
13095 [[File:Foobar.jpg|thumb|frame|caption]]
13096 !! html/php
13097 <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>
13098 <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>
13099 <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>
13100
13101 !! html/parsoid
13102 <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>
13103 <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>
13104 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13105 !! end
13106
13107 ###################
13108 # Image sizing.
13109 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13110 # and https://phabricator.wikimedia.org/T64258
13111 # Foobar has actual size of 1941x220
13112 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13113 # a scalable format.
13114 # 2. Framed images always ignore size options; always render at default size.
13115 # 3. "Unspecified format" and border are the only types which can be
13116 # enlarged.
13117
13118 !! test
13119 Image: "unspecified format" and border enlarge
13120 !! options
13121 parsoid=wt2html,wt2wt,html2html
13122 !! wikitext
13123 [[File:Foobar.jpg|2000px]]
13124
13125 [[File:Foobar.jpg|border|2000px]]
13126 !! html/php
13127 <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>
13128 </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>
13129 </p>
13130 !! html/parsoid
13131 <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>
13132 <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>
13133 !! end
13134
13135 !! test
13136 Image: "unspecified format" and border reduce
13137 !! options
13138 parsoid=wt2html,wt2wt,html2html
13139 !! wikitext
13140 [[File:Foobar.jpg|1000px]]
13141
13142 [[File:Foobar.jpg|border|1000px]]
13143 !! html/php
13144 <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>
13145 </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>
13146 </p>
13147 !! html/parsoid
13148 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
13149 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
13150 !! end
13151
13152 !! test
13153 Image: thumbs reduce
13154 !! options
13155 parsoid=wt2html,wt2wt,html2html
13156 !! wikitext
13157 [[File:Foobar.jpg|thumb|50px]]
13158 !! html/php
13159 <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>
13160
13161 !! html/parsoid
13162 <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>
13163 !! end
13164
13165 !! test
13166 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13167 !! options
13168 parsoid=wt2html,wt2wt,html2html
13169 !! wikitext
13170 [[File:Foobar.jpg|thumb|2000px]]
13171
13172 [[File:Foobar.svg|thumb|2000px]]
13173 !! html/php
13174 <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>
13175 <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>
13176
13177 !! html/parsoid
13178 <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>
13179 <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>
13180 !! end
13181
13182 !! test
13183 Image: frameless can reduce in size
13184 !! options
13185 parsoid=wt2html,wt2wt,html2html
13186 !! wikitext
13187 [[File:Foobar.jpg|frameless|50px]]
13188 !! html/php
13189 <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>
13190 </p>
13191 !! html/parsoid
13192 <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>
13193 !! end
13194
13195 !! test
13196 Image: bitmap frameless can't be enlarged past original size, but vector can
13197 !! options
13198 parsoid=wt2html,wt2wt,html2html
13199 !! wikitext
13200 [[File:Foobar.jpg|frameless|2000px]]
13201
13202 [[File:Foobar.svg|frameless|2000px]]
13203 !! html/php
13204 <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>
13205 </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>
13206 </p>
13207 !! html/parsoid
13208 <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>
13209 <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>
13210 !! end
13211
13212 !! test
13213 Image: framed images are always unscaled.
13214 !! options
13215 parsoid=wt2html,wt2wt,html2html
13216 !! wikitext
13217 [[File:Foobar.jpg|frame]]
13218
13219 [[File:Foobar.jpg|frame|50px]]
13220
13221 [[File:Foobar.jpg|frame|50x50px]]
13222
13223 [[File:Foobar.jpg|frame|2000px]]
13224 !! html/php
13225 <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>
13226 <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>
13227 <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>
13228 <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>
13229
13230 !! html/parsoid
13231 <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>
13232 <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>
13233 <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>
13234 <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>
13235 !! end
13236
13237 ###################
13238
13239 !! test
13240 Link to image page- image page normally doesn't exists, hence edit link
13241 Add test with existing image page
13242 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13243 !! wikitext
13244 [[:Image:test]]
13245 !! html
13246 <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>
13247 </p>
13248 !! end
13249
13250 !! test
13251 bug 18784 Link to non-existent image page with caption should use caption as link text
13252 !! wikitext
13253 [[:Image:test|caption]]
13254 !! html
13255 <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>
13256 </p>
13257 !! end
13258
13259 !! test
13260 Frameless image caption with a free URL
13261 !! wikitext
13262 [[File:Foobar.jpg|http://example.com]]
13263 !! html/php
13264 <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>
13265 </p>
13266 !! html/parsoid
13267 <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>
13268 !! end
13269
13270 !! test
13271 Thumbnail image caption with a free URL
13272 !! options
13273 thumbsize=220
13274 !! wikitext
13275 [[File:Foobar.jpg|thumb|http://example.com]]
13276 !! html/php
13277 <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>
13278
13279 !! html/parsoid
13280 <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>
13281 !! end
13282
13283 !! test
13284 Thumbnail image caption with a free URL and explicit alt
13285 !! options
13286 thumbsize=220
13287 parsoid=wt2html,wt2wt,html2html
13288 !! wikitext
13289 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13290 !! html/php
13291 <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>
13292
13293 !! html/parsoid
13294 <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>
13295 !! end
13296
13297 !! test
13298 SVG thumbnails with no language set
13299 !! options
13300 !! wikitext
13301 [[File:Foobar.svg|thumb|caption]]
13302 !! html/php
13303 <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>
13304
13305 !! html/parsoid
13306 <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>
13307 !! end
13308
13309 !! test
13310 SVG thumbnails with language de
13311 !! options
13312 parsoid=wt2html,wt2wt,html2html
13313 !! wikitext
13314 [[File:Foobar.svg|thumb|caption|lang=de]]
13315 !! html/php
13316 <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>
13317
13318 !! html/parsoid
13319 <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>
13320 !! end
13321
13322 !! test
13323 SVG thumbnails with invalid language code
13324 !! options
13325 parsoid=wt2html,wt2wt,html2html
13326 !! wikitext
13327 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13328 !! html/php
13329 <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>
13330
13331 !! html/parsoid
13332 <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>
13333 !! end
13334
13335 !! test
13336 BUG 1887: A ISBN with a thumbnail
13337 !! wikitext
13338 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13339 !! html/php
13340 <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>
13341
13342 !! html/parsoid
13343 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
13344 !! end
13345
13346 !! test
13347 BUG 1887: A RFC with a thumbnail
13348 !! wikitext
13349 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13350 !! html/php
13351 <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>
13352
13353 !! html/parsoid
13354 <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>
13355 !! end
13356
13357 !! test
13358 BUG 1887: A mailto link with a thumbnail
13359 !! wikitext
13360 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13361 !! html/php
13362 <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>
13363
13364 !! html/parsoid
13365 <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>
13366 !! end
13367
13368 # Pending resolution to bug 368
13369 !! test
13370 BUG 648: Frameless image caption with a link
13371 !! wikitext
13372 [[File:Foobar.jpg|text with a [[link]] in it]]
13373 !! html/php
13374 <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>
13375 </p>
13376 !! html/parsoid
13377 <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>
13378 !! end
13379
13380 !! test
13381 BUG 648: Frameless image caption with a link (suffix)
13382 !! wikitext
13383 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13384 !! html/php
13385 <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>
13386 </p>
13387 !! html/parsoid
13388 <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>
13389 !! end
13390
13391 !! test
13392 BUG 648: Frameless image caption with an interwiki link
13393 !! wikitext
13394 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13395 !! html/php
13396 <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>
13397 </p>
13398 !! html/parsoid
13399 <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>
13400 !! end
13401
13402 !! test
13403 BUG 648: Frameless image caption with a piped interwiki link
13404 !! wikitext
13405 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13406 !! html/php
13407 <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>
13408 </p>
13409 !! html/parsoid
13410 <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>
13411 !! end
13412
13413 !! test
13414 T107474: Frameless image caption with <nowiki>
13415 !! wikitext
13416 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13417 !! html/parsoid
13418 <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>
13419 !! end
13420
13421 !! test
13422 Escape HTML special chars in image alt text
13423 !! wikitext
13424 [[File:Foobar.jpg|& < > "]]
13425 !! html/php
13426 <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>
13427 </p>
13428 !! html/parsoid
13429 <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>
13430 !! end
13431
13432 !! test
13433 BUG 499: Alt text should have &#1234;, not &amp;1234;
13434 !! wikitext
13435 [[File:Foobar.jpg|&#9792;]]
13436 !! html/php
13437 <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>
13438 </p>
13439 !! html/parsoid
13440 <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>
13441 !! end
13442
13443 !! test
13444 Broken image caption with link
13445 !! options
13446 parsoid=wt2html,wt2wt,html2html
13447 !! wikitext
13448 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13449 !! html/php
13450 <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.
13451 </p>
13452 !! html/parsoid
13453 <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>
13454 !! end
13455
13456 !! test
13457 Image caption containing another image
13458 !! wikitext
13459 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13460 !! html/php
13461 <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>
13462
13463 !! html/parsoid
13464 <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>
13465 !! end
13466
13467 !! test
13468 Image: caption containing a newline
13469 !! wikitext
13470 [[File:Foobar.jpg|This
13471 *is some text]]
13472 !! html/php
13473 <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>
13474 </p>
13475 !! html/parsoid
13476 <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>
13477 !!end
13478
13479 !!test
13480 Image: caption containing leading space
13481 (The leading space should not trigger nowiki escaping in wt2wt mode)
13482 !! wikitext
13483 [[File:Foobar.jpg|thumb| bar]]
13484 !! html/php
13485 <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>
13486
13487 !! html/parsoid
13488 <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>
13489 !!end
13490
13491 !! test
13492 Image: caption containing a table
13493 !! options
13494 parsoid=wt2html,wt2wt,html2html
13495 !! wikitext
13496 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13497 {|
13498 ! Foo !! Bar
13499 |-
13500 | Foo1 || Bar1
13501 |}
13502 and some more text.]]
13503 !! html/php
13504 <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>
13505
13506 !! html/parsoid
13507 <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
13508 <table>
13509 <tbody>
13510 <tr><th>Foo </th><th>Bar</th></tr>
13511 <tr>
13512 <td>Foo1 </td>
13513 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13514 !! end
13515
13516 !! test
13517 Bug 3090: External links other than http: in image captions
13518 !! wikitext
13519 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13520 !! html/php
13521 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This 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>
13522
13523 !! html/parsoid
13524 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This 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>
13525 !! end
13526
13527 !! test
13528 Custom class
13529 !! options
13530 parsoid=wt2html,wt2wt,html2html
13531 !! wikitext
13532 [[Image:foobar.jpg|a|class=b]]
13533 !! html/php
13534 <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>
13535 </p>
13536 !! html/parsoid
13537 <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>
13538 !! end
13539
13540 !! test
13541 Localized image handling (1).
13542 !! options
13543 parsoid=wt2html,wt2wt,html2html
13544 language=es
13545 !! wikitext
13546 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13547 !! html/php
13548 <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>
13549
13550 !! html/parsoid
13551 <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>
13552 !! end
13553
13554 !! test
13555 Localized image handling (2).
13556 !! options
13557 thumbsize=220
13558 parsoid=wt2html,wt2wt,html2html
13559 language=es
13560 !! wikitext
13561 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13562 !! html/php
13563 <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>
13564
13565 !! html/parsoid
13566 <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>
13567 !! end
13568
13569 !! test
13570 "border", "frameless" and "class" attributes on an image.
13571 !! options
13572 thumbsize=220
13573 parsoid=wt2html,wt2wt,html2html
13574 !! wikitext
13575 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13576 !! html/php
13577 <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>
13578 </p>
13579 !! html/parsoid
13580 <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>
13581 !! end
13582
13583 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13584 !! test
13585 Invalid image attributes (bug 62500)
13586 !! options
13587 thumbsize=220
13588 parsoid=wt2html,wt2wt,html2html
13589 !! wikitext
13590 [[File:Foobar.jpg|thumb|float|left|caption]]
13591
13592 [[File:Foobar.jpg|thumb|righ|caption]]
13593
13594 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13595 !! html/php
13596 <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>
13597 <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>
13598 <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>
13599
13600 !! html/parsoid
13601 <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>
13602 <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>
13603 <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>
13604 !! end
13605
13606 !! article
13607 File:Barfoo.jpg
13608 !! text
13609 #REDIRECT [[File:Barfoo.jpg]]
13610 !! endarticle
13611
13612 # FIXME: Parsoid should run this test -- but we'd need to teach the
13613 # mockAPI about the redirected Barfoo.jpg image.
13614 !! test
13615 Redirected image
13616 !! wikitext
13617 [[Image:Barfoo.jpg]]
13618 !! html/php
13619 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13620 </p>
13621 !! end
13622
13623 !! test
13624 Missing image with uploads disabled
13625 !! options
13626 wgEnableUploads=0
13627 !! wikitext
13628 [[File:Foobaz.jpg]]
13629 !! html/php
13630 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13631 </p>
13632 !! html/parsoid
13633 <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>
13634 !! end
13635
13636 # Parsoid-specific testing for images
13637 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13638 # Currently imperfect due to a flaw in the Parsoid testrunner
13639 # Work in progress
13640 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13641 # image tests.
13642
13643 !! test
13644 Parsoid-specific image handling - simple image with size and middle alignment
13645 !! wikitext
13646 [[File:Foobar.jpg|middle|50px]]
13647 !! html/parsoid
13648 <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>
13649 !! end
13650
13651 !! test
13652 Parsoid-specific image handling - simple image with size, middle alignment,
13653 non-standard namespace alias
13654 !! options
13655 parsoid=wt2wt,wt2html,html2html
13656 !! wikitext
13657 [[Image:Foobar.jpg|middle|50px]]
13658 !! html/parsoid
13659 <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>
13660 !! end
13661
13662 !! test
13663 Parsoid-specific image handling - simple image with size and middle alignment
13664 (existing content)
13665 !! wikitext
13666 [[File:Foobar.jpg|50px|middle]]
13667 !! html/parsoid
13668 <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>
13669 !! end
13670
13671 !! test
13672 Parsoid-specific image handling - simple image with size and middle alignment
13673 and non-standard namespace name
13674 !! options
13675 parsoid=wt2html,wt2wt,html2html
13676 !! wikitext
13677 [[Image:Foobar.jpg|50px|middle]]
13678 !! html/parsoid
13679 <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>
13680 !! end
13681
13682 !! test
13683 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13684 !! wikitext
13685 [[File:Foobar.jpg|500x10px|baseline|caption]]
13686 !! html/parsoid
13687 <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>
13688 !! end
13689
13690 !! test
13691 Parsoid-specific image handling - simple image with border and size spec
13692 !! wikitext
13693 [[File:Foobar.jpg|50px|border|caption]]
13694 !! html/parsoid
13695 <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>
13696 !! end
13697
13698 !! test
13699 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13700 !! wikitext
13701 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13702 !! html/parsoid
13703 <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>
13704 !! end
13705
13706 !! test
13707 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13708 (existing content)
13709 !! wikitext
13710 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13711 !! html/parsoid
13712 <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>
13713 !! end
13714
13715 !! test
13716 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13717 !! wikitext
13718 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13719 !! html/parsoid
13720 <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>
13721 !! end
13722
13723 !! test
13724 Parsoid-specific image handling - thumbnail with specific size, halign,
13725 valign, and caption (existing content)
13726 !! wikitext
13727 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13728 !! html/parsoid
13729 <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>
13730 !! end
13731
13732 !! test
13733 Parsoid-specific image handling - framed image with specific size and caption
13734 (size is ignored)
13735 !! options
13736 parsoid=wt2html,wt2wt,html2html
13737 !! wikitext
13738 [[File:Foobar.jpg|frame|500x50px|caption]]
13739 !! html/parsoid
13740 <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>
13741 !! end
13742
13743 !! test
13744 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13745 (size is ignored)
13746 !! options
13747 parsoid=wt2html,wt2wt,html2html
13748 !! wikitext
13749 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13750 !! html/parsoid
13751 <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>
13752 !! end
13753
13754 !! test
13755 Parsoid-specific image handling - frameless image with specific size, border, and caption
13756 !! wikitext
13757 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13758 !! html/parsoid
13759 <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>
13760 !! end
13761
13762 !! test
13763 Parsoid-specific image handling - simple image with a formatted caption
13764 !! wikitext
13765 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13766 !! html/parsoid
13767 <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>
13768 !! end
13769
13770 !! test
13771 Parsoid-specific image handling - caption with a template in it
13772 !! wikitext
13773 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13774 !! html/parsoid
13775 <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>
13776 !! end
13777
13778 !! test
13779 Parsoid-specific image handling - caption with unbalanced tags in it
13780 !! options
13781 parsoid=wt2html,wt2wt,html2html
13782 !! wikitext
13783 foo
13784 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13785 bar
13786 !! html/parsoid
13787 <p>foo</p>
13788 <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>
13789 <p>bar</p>
13790 !! end
13791
13792 !! test
13793 Parsoid-specific image handling - empty caption (1)
13794 !! options
13795 parsoid=wt2html,wt2wt
13796 !! wikitext
13797 [[File:Foobar.jpg|thumb|]]
13798 !! html/parsoid
13799 <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>
13800 !! end
13801
13802 # empty captions don't get serialized unless we're in the "round trip" case
13803 !! test
13804 Parsoid-specific image handling - empty caption (2)
13805 !! options
13806 parsoid=html2wt
13807 !! html/parsoid
13808 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13809 <a href="./File:Foobar.jpg">
13810 <img resource="./File:Foobar.jpg"
13811 src="//example.com/images/3/3a/Foobar.jpg"
13812 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13813 height="25" width="220"/>
13814 </a>
13815 <figcaption></figcaption>
13816 </figure>
13817 !! wikitext
13818 [[File:Foobar.jpg|thumb]]
13819 !! end
13820
13821 !! test
13822 Parsoid-specific image handling - whitespace caption
13823 !! wikitext
13824 [[File:Foobar.jpg|thumb| ]]
13825 !! html/parsoid
13826 <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>
13827 !! end
13828
13829 !! test
13830 Parsoid-specific image handling - lang option
13831 !! wikitext
13832 foo
13833 [[File:Foobar.svg|lang=de|caption]]
13834 bar
13835 !! html/parsoid
13836 <p>foo
13837 <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>
13838 bar</p>
13839 !! end
13840
13841 ## Edge case bug in Parsoid
13842 !! test
13843 T93580: Templated <ref> inside images
13844 !! wikitext
13845 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13846
13847 <references />
13848 !! html/parsoid
13849 <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>
13850
13851 <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>
13852 !! end
13853
13854 ###
13855 ### Subpages
13856 ###
13857 !! article
13858 Subpage test/subpage
13859 !! text
13860 foo
13861 !! endarticle
13862
13863 !! test
13864 Subpage link
13865 !! options
13866 subpage title=[[Subpage test]]
13867 !! wikitext
13868 [[/subpage]]
13869 !! html
13870 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13871 </p>
13872 !! end
13873
13874 !! test
13875 Subpage noslash link
13876 !! options
13877 subpage title=[[Subpage test]]
13878 !! wikitext
13879 [[/subpage/]]
13880 !! html
13881 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13882 </p>
13883 !! end
13884
13885 !! article
13886 Subpage test/1/2/subpage
13887 !! text
13888 blah
13889 !! endarticle
13890
13891 !! test
13892 Relative subpage noslash link
13893 !! options
13894 parsoid=wt2wt,wt2html,html2html
13895 subpage title=[[Subpage test/1/2/3/4]]
13896 !! wikitext
13897 [[../../subpage/]]
13898
13899 [[../../subpage]]
13900 !! html/php
13901 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13902 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13903 </p>
13904 !! html/parsoid
13905 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13906 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13907 !! end
13908
13909 !! test
13910 Parsoid: dot-slash prefixed wikilinks
13911 !! wikitext
13912 [[./foo]]
13913
13914 [[././bar]]
13915
13916 [[././baz/]]
13917 !! html/php
13918 <p>[[./foo]]
13919 </p><p>[[././bar]]
13920 </p><p>[[././baz/]]
13921 </p>
13922 !! html/parsoid
13923 <p>[[./foo]]
13924 </p><p>[[././bar]]
13925 </p><p>[[././baz/]]
13926 </p>
13927 !! end
13928
13929 !! test
13930 Render invalid page names as plain text (bug 51090)
13931 !! wikitext
13932 [[./../foo|bar]]
13933 [[foo�|bar]]
13934 [[foo/.|bar]]
13935 [[foo/..|bar]]
13936 [[foo~~~bar]]
13937 [[foo>bar]]
13938 [[foo[bar]]
13939 [[.]]
13940 [[..]]
13941 [[foo././bar]]
13942
13943 [[{{echo|./../foo}}|bar]]
13944 [[{{echo|foo/.}}|bar]]
13945 [[{{echo|foo/..}}|bar]]
13946 [[{{echo|foo~~~~bar}}]]
13947 [[{{echo|foo>bar}}]]
13948 [[{{echo|foo././bar}}]]
13949 [[{{echo|foo{bar}}]]
13950 [[{{echo|foo}bar}}]]
13951 [[{{echo|foo[bar}}]]
13952 [[{{echo|foo]bar}}]]
13953 [[{{echo|foo<bar}}]]
13954 !!html/php
13955 <p>[[./../foo|bar]]
13956 [[foo�|bar]]
13957 [[foo/.|bar]]
13958 [[foo/..|bar]]
13959 [[foo~~~bar]]
13960 [[foo&gt;bar]]
13961 [[foo[bar]]
13962 [[.]]
13963 [[..]]
13964 [[foo././bar]]
13965 </p><p>[[./../foo|bar]]
13966 [[foo/.|bar]]
13967 [[foo/..|bar]]
13968 [[foo~~~~bar]]
13969 [[foo&gt;bar]]
13970 [[foo././bar]]
13971 [[foo{bar]]
13972 [[foo}bar]]
13973 [[foo[bar]]
13974 [[foo]bar]]
13975 [[foo&lt;bar]]
13976 </p>
13977 !!html/parsoid
13978 <p>[[./../foo|bar]]
13979 [[foo�|bar]]
13980 [[foo/.|bar]]
13981 [[foo/..|bar]]
13982 [[foo~~~bar]]
13983 [[foo>bar]]
13984 [[foo[bar]]
13985 [[.]]
13986 [[..]]
13987 [[foo././bar]]</p>
13988
13989 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13990 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13991 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13992 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13993 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13994 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13995 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13996 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13997 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13998 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13999 [[<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>
14000 !!end
14001
14002 !! test
14003 Disabled subpages
14004 !! wikitext
14005 [[/subpage]]
14006 !! html
14007 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14008 </p>
14009 !! end
14010
14011 !! test
14012 BUG 561: {{/Subpage}}
14013 !! options
14014 subpage title=[[Page]]
14015 !! wikitext
14016 {{/Subpage}}
14017 !! html
14018 <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>
14019 </p>
14020 !! end
14021
14022 ###
14023 ### Categories
14024 ###
14025 !! article
14026 Category:MediaWiki User's Guide
14027 !! text
14028 blah
14029 !! endarticle
14030
14031 !! test
14032 Link to category
14033 !! wikitext
14034 [[:Category:MediaWiki User's Guide]]
14035 !! html
14036 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14037 </p>
14038 !! end
14039
14040 !! test
14041 Simple category
14042 !! options
14043 cat
14044 !! wikitext
14045 [[Category:MediaWiki User's Guide]]
14046 !! html
14047 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14048 !! end
14049
14050 !! test
14051 PAGESINCATEGORY invalid title fatal (r33546 fix)
14052 !! wikitext
14053 {{PAGESINCATEGORY:<bogus>}}
14054 !! html
14055 <p>0
14056 </p>
14057 !! end
14058
14059 !! test
14060 Category with different sort key
14061 !! options
14062 cat
14063 !! wikitext
14064 [[Category:MediaWiki User's Guide|Foo]]
14065 !! html
14066 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14067 !! end
14068
14069 !! test
14070 Category with identical sort key
14071 !! options
14072 cat
14073 !! wikitext
14074 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14075 !! html
14076 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14077 !! end
14078
14079 !! test
14080 Category with empty sort key
14081 !! options
14082 cat
14083 pst
14084 !! wikitext
14085 [[Category:MediaWiki User's Guide|]]
14086 !! html
14087 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14088 !! end
14089
14090 !! test
14091 Category with empty sort key and parentheses
14092 !! options
14093 cat
14094 pst
14095 !! wikitext
14096 [[Category:Foo (bar)|]]
14097 !! html
14098 [[Category:Foo (bar)|Foo]]
14099 !! end
14100
14101 !! test
14102 Category with link tail
14103 !! options
14104 cat
14105 pst
14106 !! wikitext
14107 123[[Category:Foo]]456
14108 !! html
14109 123[[Category:Foo]]456
14110 !! end
14111
14112 !! test
14113 Category with template
14114 !! options
14115 cat
14116 pst
14117 !! wikitext
14118 [[Category:{{echo|Foo}}]]
14119 !! html
14120 [[Category:{{echo|Foo}}]]
14121 !! end
14122
14123 !! test
14124 Category with template in sort key
14125 !! options
14126 cat
14127 pst
14128 !! wikitext
14129 [[Category:Foo|{{echo|Bar}}]]
14130 !! html
14131 [[Category:Foo|{{echo|Bar}}]]
14132 !! end
14133
14134 !! test
14135 Category with template in sort key and title
14136 !! options
14137 cat
14138 pst
14139 !! wikitext
14140 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14141 !! html
14142 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14143 !! end
14144
14145 !! test
14146 Category / paragraph interactions
14147 !! wikitext
14148 Foo [[Category:Baz]] Bar
14149
14150 Foo [[Category:Baz]]
14151 Bar
14152
14153 Foo
14154 [[Category:Baz]]
14155 Bar
14156
14157 Foo
14158 [[Category:Baz]] Bar
14159
14160 Foo
14161 [[Category:Baz]]
14162 [[Category:Baz]]
14163 [[Category:Baz]]
14164 Bar
14165
14166 [[Category:Baz]]
14167 [[Category:Baz]]
14168 [[Category:Baz]]
14169
14170 [[Category:Baz]]
14171 {{echo|[[Category:Baz]]}}
14172 [[Category:Baz]]
14173 !! html
14174 <p>Foo Bar
14175 </p><p>Foo
14176 Bar
14177 </p><p>Foo
14178 Bar
14179 </p><p>Foo Bar
14180 </p><p>Foo
14181 Bar
14182 </p>
14183 !! end
14184
14185 ## The whitespace on the empty line is part of the test. Please do not delete
14186 !! test
14187 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14188 !! options
14189 parsoid=wt2html,wt2wt
14190 !! wikitext
14191 This
14192
14193 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14194
14195 {{echo|[[Category:Foo]] and so should this!}}
14196 !! html
14197 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14198 </p>
14199 !! html/parsoid
14200 <p>This
14201
14202 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14203
14204 <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>
14205 !! end
14206
14207 ## Parsoid will not try to wt2wt this while preserving newlines because
14208 ## it suppresses excess newlines within list items -- and we don't want to
14209 ## introduce a special case just for categories, which is, in reality somewhat
14210 ## odd behavior -- categories are unlikely to be used in list items like this
14211 ## in top-level pages and are only likely to show up in template-generated
14212 ## list items where this RT-ing is a non-issue.
14213 ##
14214 ## The whitespace on the empty line is part of the test. Please do not delete
14215 !! test
14216 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14217 !! options
14218 parsoid=wt2html
14219 !! wikitext
14220 * This
14221
14222 [[Category:Foo]] and this should be part of the same list item
14223 * So should this
14224
14225 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14226 !! html
14227 <ul><li>This and this should be part of the same list item</li>
14228 <li>So should this and this should be part of the same list item</li></ul>
14229 !! html/parsoid
14230 <ul>
14231 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14232 <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>
14233 </ul>
14234 !! end
14235
14236 ## Newlines and categories that follow the last item of a list
14237 ## are treated differently because this (list followed by categories)
14238 ## is an extremely common pattern on wikis.
14239 !! test
14240 3. Categories and newlines: newline suppression for last list item should RT properly
14241 !! wikitext
14242 * a
14243 * b
14244
14245 [[Category:Foo]]
14246
14247 [[Category:Bar]]
14248 [[Category:Baz]]
14249 !! html/parsoid
14250 <ul><li> a</li>
14251 <li> b</li></ul>
14252
14253 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14254
14255 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14256 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14257 !! end
14258
14259 !! test
14260 4. Categories and newlines: newline suppression for last list item should RT properly
14261 !! wikitext
14262 * a
14263 **** b
14264
14265 [[Category:Foo]]
14266 !! html/parsoid
14267 <ul><li> a
14268 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14269
14270 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14271 !! end
14272
14273 ## only wt2html for this to make sure the algo only applies to the rightmost path
14274 !! test
14275 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14276 !! options
14277 parsoid=wt2html
14278 !! wikitext
14279 * a
14280 ** b
14281 [[Category:Foo]]
14282 * c
14283 ** d
14284 [[Category:Foo]]
14285 !! html/parsoid
14286 <ul><li> a
14287 <ul><li> b
14288 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14289 <li> c
14290 <ul><li> d</li></ul></li></ul>
14291 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14292 !! end
14293
14294 !! test
14295 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14296 !! wikitext
14297 * a [[Category:Foo]]
14298 !! html/parsoid
14299 <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>
14300 !! end
14301
14302 # This test also demonstrates because of newline+category tunneling
14303 # through the list hander, template wrapping doesn't expand to the
14304 # containing list when the list item swallows the category.
14305 !! test
14306 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14307 !! wikitext
14308 * {{echo|a
14309 [[Category:Foo]]}}
14310 !! html/parsoid
14311 <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">
14312 </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>
14313 !! end
14314
14315 !! test
14316 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14317 !! wikitext
14318 * a
14319
14320 {{echo|[[Category:Foo]]
14321 [[Category:Bar]]}}
14322 [[Category:Baz]]
14323 !! html/parsoid
14324 <ul><li> a</li></ul>
14325
14326 <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">
14327 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14328 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14329 !! end
14330
14331 !! test
14332 Parsoid: Serialize link to category page with colon escape
14333 !! options
14334 parsoid
14335 !! wikitext
14336
14337 [[:Category:Foo]]
14338 [[:Category:Foo|Bar]]
14339 !! html
14340 <p>
14341 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14342 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14343 </p>
14344 !! end
14345
14346 # html2wt localizes the "Category" namespace.
14347 # XXX the <link> element needs an empty data-parsoid attribute, or
14348 # else the html2html test fails because spaces are inserted.
14349 !! test
14350 Link prefix/suffixes aren't applied to category links
14351 !! options
14352 parsoid=wt2html,wt2wt,html2html
14353 language=is
14354 !! wikitext
14355 x[[Category:Foo]]y
14356 !! html/php
14357 <p>xy
14358 </p>
14359 !! html/parsoid
14360 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14361 !! end
14362
14363 !! test
14364 Parsoid: Serialize link to file page with colon escape
14365 !! options
14366 parsoid
14367 !! wikitext
14368
14369 [[:File:Foo.png]]
14370 [[:File:Foo.png|Bar]]
14371 !! html
14372 <p>
14373 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14374 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14375 </p>
14376 !! end
14377
14378 !! test
14379 Parsoid: Serialize a genuine category link without colon escape
14380 !! options
14381 parsoid
14382 !! wikitext
14383 [[Category:Foo]]
14384 [[Category:Foo|Bar]]
14385 !! html
14386 <link rel="mw:PageProp/Category" href="./Category:Foo">
14387 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14388 !! end
14389
14390 !! test
14391 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14392 !! options
14393 parsoid=html2wt
14394 !! html/parsoid
14395 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14396 !! wikitext
14397 [[Category:Toxine bactérienne]]
14398 !! end
14399
14400 !! test
14401 Parsoid: Defaultsort
14402 !! wikitext
14403 {{DEFAULTSORT:Foo}}
14404 !! html/parsoid
14405 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14406 !! end
14407
14408 !! test
14409 Parsoid: Defaultsort (template-generated)
14410 !! wikitext
14411 {{{{echo|DEFAULTSORT}}:Foo}}
14412 !! html/parsoid
14413 <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}}]}'/>
14414 !! end
14415
14416 ###
14417 ### Inter-language links
14418 ###
14419 !! test
14420 Interlanguage links
14421 !! options
14422 ill
14423 !! wikitext
14424 [[es:Alimento]]
14425 [[fr:Nourriture]]
14426 [[zh:食品]]
14427 !! html/php
14428 es:Alimento fr:Nourriture zh:食品
14429 !! html/parsoid
14430 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14431 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14432 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14433 !! end
14434
14435 !! test
14436 Duplicate interlanguage links (bug 24502)
14437 !! options
14438 ill
14439 !! wikitext
14440 [[es:1]]
14441 [[es:2]]
14442 [[fr:1]]
14443 [[fr:2]]
14444 !! html/php
14445 es:1 fr:1
14446 !! html/parsoid
14447 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14448 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14449 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14450 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14451 !! end
14452
14453 ###
14454 ### Sections
14455 ###
14456 !! test
14457 Basic section headings
14458 !! wikitext
14459 == Headline 1 ==
14460 Some text
14461
14462 ==Headline 2==
14463 More
14464 ===Smaller headline===
14465 Blah blah
14466 !! html
14467 <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>
14468 <p>Some text
14469 </p>
14470 <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>
14471 <p>More
14472 </p>
14473 <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>
14474 <p>Blah blah
14475 </p>
14476 !! end
14477
14478 !! test
14479 Section headings with TOC
14480 !! wikitext
14481 == Headline 1 ==
14482 === Subheadline 1 ===
14483 ===== Skipping a level =====
14484 ====== Skipping a level ======
14485
14486 == Headline 2 ==
14487 Some text
14488 ===Another headline===
14489 !! html
14490 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14491 <ul>
14492 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14493 <ul>
14494 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14495 <ul>
14496 <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>
14497 <ul>
14498 <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>
14499 </ul>
14500 </li>
14501 </ul>
14502 </li>
14503 </ul>
14504 </li>
14505 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14506 <ul>
14507 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14508 </ul>
14509 </li>
14510 </ul>
14511 </div>
14512
14513 <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>
14514 <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>
14515 <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>
14516 <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>
14517 <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>
14518 <p>Some text
14519 </p>
14520 <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>
14521
14522 !! end
14523
14524 !! test
14525 TOC anchors don't collide
14526 !! wikitext
14527 __FORCETOC__
14528 == Headline 2 ==
14529 == Headline ==
14530 == Headline 2 ==
14531 == Headline ==
14532 !! html/php
14533 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14534 <ul>
14535 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14536 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14537 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14538 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14539 </ul>
14540 </div>
14541
14542 <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>
14543 <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>
14544 <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>
14545 <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>
14546
14547 !! end
14548
14549 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14550 !! test
14551 Handling of sections up to level 6 and beyond
14552 !! wikitext
14553 = Level 1 Heading=
14554 == Level 2 Heading==
14555 === Level 3 Heading===
14556 ==== Level 4 Heading====
14557 ===== Level 5 Heading=====
14558 ====== Level 6 Heading======
14559 ======= Level 7 Heading=======
14560 ======== Level 8 Heading========
14561 ========= Level 9 Heading=========
14562 ========== Level 10 Heading==========
14563 !! html
14564 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14565 <ul>
14566 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14567 <ul>
14568 <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>
14569 <ul>
14570 <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>
14571 <ul>
14572 <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>
14573 <ul>
14574 <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>
14575 <ul>
14576 <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>
14577 <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>
14578 <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>
14579 <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>
14580 <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>
14581 </ul>
14582 </li>
14583 </ul>
14584 </li>
14585 </ul>
14586 </li>
14587 </ul>
14588 </li>
14589 </ul>
14590 </li>
14591 </ul>
14592 </div>
14593
14594 <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>
14595 <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>
14596 <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>
14597 <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>
14598 <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>
14599 <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>
14600 <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>
14601 <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>
14602 <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>
14603 <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>
14604
14605 !! end
14606
14607 !! test
14608 TOC regression (T11764)
14609 !! wikitext
14610 == title 1 ==
14611 === title 1.1 ===
14612 ==== title 1.1.1 ====
14613 === title 1.2 ===
14614 == title 2 ==
14615 === title 2.1 ===
14616 !! html
14617 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14618 <ul>
14619 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14620 <ul>
14621 <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>
14622 <ul>
14623 <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>
14624 </ul>
14625 </li>
14626 <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>
14627 </ul>
14628 </li>
14629 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14630 <ul>
14631 <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>
14632 </ul>
14633 </li>
14634 </ul>
14635 </div>
14636
14637 <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>
14638 <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>
14639 <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>
14640 <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>
14641 <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>
14642 <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>
14643
14644 !! end
14645
14646 !! test
14647 TOC for heading containing <span id="..."></span> (T96153)
14648 !! wikitext
14649 __FORCETOC__
14650 ==<span id="old-anchor"></span>New title==
14651 !! html/php
14652 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14653 <ul>
14654 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14655 </ul>
14656 </div>
14657
14658 <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>
14659
14660 !! end
14661
14662 !! test
14663 TOC with wgMaxTocLevel=3 (bug 6204)
14664 !! options
14665 wgMaxTocLevel=3
14666 !! wikitext
14667 == title 1 ==
14668 === title 1.1 ===
14669 ==== title 1.1.1 ====
14670 === title 1.2 ===
14671 == title 2 ==
14672 === title 2.1 ===
14673 !! html
14674 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14675 <ul>
14676 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14677 <ul>
14678 <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>
14679 <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>
14680 </ul>
14681 </li>
14682 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14683 <ul>
14684 <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>
14685 </ul>
14686 </li>
14687 </ul>
14688 </div>
14689
14690 <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>
14691 <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>
14692 <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>
14693 <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>
14694 <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>
14695 <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>
14696
14697 !! end
14698
14699 !! test
14700 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14701 !! options
14702 wgMaxTocLevel=3
14703 !! wikitext
14704 ==Section 1==
14705 ===Section 1.1===
14706 ====Section 1.1.1====
14707 ====Section 1.1.1.1====
14708 ==Section 2==
14709 !! html
14710 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14711 <ul>
14712 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14713 <ul>
14714 <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>
14715 </ul>
14716 </li>
14717 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14718 </ul>
14719 </div>
14720
14721 <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>
14722 <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>
14723 <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>
14724 <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>
14725 <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>
14726
14727 !! end
14728
14729
14730 !! test
14731 Resolving duplicate section names
14732 !! wikitext
14733 == Foo bar ==
14734 == Foo bar ==
14735 !! html
14736 <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>
14737 <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>
14738
14739 !! end
14740
14741 !! test
14742 Resolving duplicate section names with differing case (bug 10721)
14743 !! wikitext
14744 == Foo bar ==
14745 == Foo Bar ==
14746 !! html
14747 <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>
14748 <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>
14749
14750 !! end
14751
14752 !! article
14753 Template:sections
14754 !! text
14755 ===Section 1===
14756 ==Section 2==
14757 !! endarticle
14758
14759 !! test
14760 Template with sections, __NOTOC__
14761 !! wikitext
14762 __NOTOC__
14763 ==Section 0==
14764 {{sections}}
14765 ==Section 4==
14766 !! html
14767 <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>
14768 <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>
14769 <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>
14770 <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>
14771
14772 !! end
14773
14774 !! test
14775 __NOEDITSECTION__ keyword
14776 !! wikitext
14777 __NOEDITSECTION__
14778 ==Section 1==
14779 ==Section 2==
14780 !! html
14781 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14782 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14783
14784 !! end
14785
14786 !! test
14787 Link inside a section heading
14788 !! wikitext
14789 ==Section with a [[Main Page|link]] in it==
14790 !! html
14791 <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>
14792
14793 !! end
14794
14795 !! test
14796 TOC regression (T14077)
14797 !! wikitext
14798 __TOC__
14799 == title 1 ==
14800 === title 1.1 ===
14801 == title 2 ==
14802 !! html
14803 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14804 <ul>
14805 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14806 <ul>
14807 <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>
14808 </ul>
14809 </li>
14810 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14811 </ul>
14812 </div>
14813
14814 <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>
14815 <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>
14816 <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>
14817
14818 !! end
14819
14820 !! test
14821 BUG 1219 URL next to image (good)
14822 !! wikitext
14823 http://example.com [[File:Foobar.jpg]]
14824 !! html/php
14825 <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>
14826 </p>
14827 !! html/parsoid
14828 <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>
14829 !!end
14830
14831 !! test
14832 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14833 !! wikitext
14834 ===
14835 The line above must have a trailing space!
14836 === <!--
14837 --> <!-- -->
14838 But just in case it doesn't...
14839 !! html
14840 <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>
14841 <p>The line above must have a trailing space!
14842 </p>
14843 <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>
14844 <p>But just in case it doesn't...
14845 </p>
14846 !! end
14847
14848 !! test
14849 Header with special characters (bug 25462)
14850 !! wikitext
14851 The tooltips shall not show entities to the user (ie. be double escaped)
14852
14853 == text > text ==
14854 section 1
14855
14856 == text < text ==
14857 section 2
14858
14859 == text & text ==
14860 section 3
14861
14862 == text ' text ==
14863 section 4
14864
14865 == text " text ==
14866 section 5
14867 !! html
14868 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14869 </p>
14870 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14871 <ul>
14872 <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>
14873 <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>
14874 <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>
14875 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14876 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14877 </ul>
14878 </div>
14879
14880 <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>
14881 <p>section 1
14882 </p>
14883 <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>
14884 <p>section 2
14885 </p>
14886 <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>
14887 <p>section 3
14888 </p>
14889 <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>
14890 <p>section 4
14891 </p>
14892 <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>
14893 <p>section 5
14894 </p>
14895 !! end
14896
14897 !! test
14898 Header with space, plus and underscore as entity
14899 !! wikitext
14900 Id should not contain + for spaces
14901
14902 == Space between Text ==
14903 section 1
14904
14905 == Space-Entity&#32;between&#32;Text ==
14906 section 2
14907
14908 == Plus+between+Text ==
14909 section 3
14910
14911 == Plus-Entity&#43;between&#43;Text ==
14912 section 4
14913
14914 == Underscore_between_Text ==
14915 section 5
14916
14917 == Underscore-Entity&#95;between&#95;Text ==
14918 section 6
14919
14920 [[#Space between Text]]
14921 [[#Space-Entity&#32;between&#32;Text]]
14922 [[#Plus+between+Text]]
14923 [[#Plus-Entity&#43;between&#43;Text]]
14924 [[#Underscore_between_Text]]
14925 [[#Underscore-Entity&#95;between&#95;Text]]
14926 !! html
14927 <p>Id should not contain + for spaces
14928 </p>
14929 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14930 <ul>
14931 <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>
14932 <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>
14933 <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>
14934 <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>
14935 <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>
14936 <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>
14937 </ul>
14938 </div>
14939
14940 <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>
14941 <p>section 1
14942 </p>
14943 <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>
14944 <p>section 2
14945 </p>
14946 <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>
14947 <p>section 3
14948 </p>
14949 <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>
14950 <p>section 4
14951 </p>
14952 <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>
14953 <p>section 5
14954 </p>
14955 <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>
14956 <p>section 6
14957 </p><p><a href="#Space_between_Text">#Space between Text</a>
14958 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14959 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14960 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14961 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14962 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14963 </p>
14964 !! end
14965
14966 !! test
14967 Headers with excess '=' characters
14968 (Are similar tests necessary beyond the 1st level?)
14969 !! wikitext
14970 =foo==
14971 ==foo=
14972 =''italic'' heading==
14973 ==''italic'' heading=
14974 !! html
14975 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14976 <ul>
14977 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14978 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14979 <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>
14980 <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>
14981 </ul>
14982 </div>
14983
14984 <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>
14985 <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>
14986 <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>
14987 <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>
14988
14989 !! end
14990
14991 !! test
14992 HTML headers vs TOC (bug 23393)
14993 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14994 !! wikitext
14995 <h1>Header 1</h1>
14996 == Header 1.1 ==
14997 == Header 1.2 ==
14998
14999 <h1>Header 2
15000 </h1>
15001 == Header 2.1 ==
15002 == Header 2.2 ==
15003 __NOEDITSECTION__
15004 !! html
15005 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15006 <ul>
15007 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15008 <ul>
15009 <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>
15010 <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>
15011 </ul>
15012 </li>
15013 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15014 <ul>
15015 <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>
15016 <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>
15017 </ul>
15018 </li>
15019 </ul>
15020 </div>
15021
15022 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15023 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15024 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15025 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15026 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15027 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15028
15029 !! end
15030
15031 !! test
15032 Single-line or multiline-comments can follow headings
15033 !! options
15034 parsoid=wt2html,wt2wt
15035 !! wikitext
15036 ==foo==<!---->
15037 ==bar==<!--c1-->
15038 ==baz==<!--
15039 c2
15040 c3-->
15041 !! html
15042 <h2><span class="mw-headline" id="foo">foo</span></h2>
15043 <h2><span class="mw-headline" id="bar">bar</span></h2>
15044 <h2><span class="mw-headline" id="baz">baz</span></h2>
15045
15046 !! end
15047
15048 !! test
15049 BUG 1219 URL next to image (broken)
15050 !! wikitext
15051 http://example.com[[File:Foobar.jpg]]
15052 !! html/php
15053 <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>
15054 </p>
15055 !! html/parsoid
15056 <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>
15057 !!end
15058
15059 !! test
15060 Bug 1186 news: in the middle of text
15061 !! wikitext
15062 http://en.wikinews.org/wiki/Wikinews:Workplace
15063 !! html
15064 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15065 </p>
15066 !!end
15067
15068
15069 !! test
15070 Namespaced link must have a title
15071 !! wikitext
15072 [[Project:]]
15073 !! html
15074 <p>[[Project:]]
15075 </p>
15076 !!end
15077
15078 !! test
15079 Namespaced link must have a title (bad fragment version)
15080 !! wikitext
15081 [[Project:#fragment]]
15082 !! html
15083 <p>[[Project:#fragment]]
15084 </p>
15085 !!end
15086
15087
15088 ###
15089 ### HTML tags and HTML attributes
15090 ###
15091
15092 !! test
15093 div with no attributes
15094 !! wikitext
15095 <div>HTML rocks</div>
15096 !! html
15097 <div>HTML rocks</div>
15098
15099 !! end
15100
15101 !! test
15102 div with double-quoted attribute
15103 !! wikitext
15104 <div id="rock">HTML rocks</div>
15105 !! html
15106 <div id="rock">HTML rocks</div>
15107
15108 !! end
15109
15110 !! test
15111 div with single-quoted attribute
15112 !! wikitext
15113 <div id='rock'>HTML rocks</div>
15114 !! html
15115 <div id="rock">HTML rocks</div>
15116
15117 !! end
15118
15119 !! test
15120 div with unquoted attribute
15121 !! wikitext
15122 <div id=rock>HTML rocks</div>
15123 !! html
15124 <div id="rock">HTML rocks</div>
15125
15126 !! end
15127
15128 !! test
15129 div with illegal double attributes
15130 !! wikitext
15131 <div id="a" id="b">HTML rocks</div>
15132 !! html
15133 <div id="b">HTML rocks</div>
15134
15135 !!end
15136
15137 # FIXME: produce empty string instead of "class" in the PHP parser, following
15138 # the HTML5 spec.
15139 !! test
15140 div with empty attribute value, space before equals
15141 !! options
15142 parsoid
15143 !! wikitext
15144 <div class =>HTML rocks</div>
15145 !! html
15146 <div class="">HTML rocks</div>
15147
15148 !! end
15149
15150 !! test
15151 div with multiple empty attribute values
15152 !! options
15153 parsoid
15154 !! wikitext
15155 <div id= title=>HTML rocks</div>
15156 !! html
15157 <div id="" title="">HTML rocks</div>
15158
15159 !! end
15160
15161 !! test
15162 table with multiple empty attribute values
15163 !! options
15164 parsoid
15165 !! wikitext
15166 {| title= id=
15167 | hi
15168 |}
15169 !! html
15170 <table title="" id="">
15171 <tbody><tr><td> hi</td></tr>
15172 </tbody></table>
15173 !! end
15174
15175 !! test
15176 div with braces in attribute value
15177 !! wikitext
15178 <div title="{}">Foo</div>
15179 !! html/php
15180 <div title="&#123;}">Foo</div>
15181
15182 !! html/parsoid
15183 <div title="{}">Foo</div>
15184 !! end
15185
15186 # This it very inconsistent in the PHP parser: it returns
15187 # class="class" if there is a space between the name and the equal sign (see
15188 # 'div with empty attribute value, space before equals'), but strips the
15189 # attribute completely if the space is missing. We hope that not much content
15190 # depends on this, so are implementing the behavior below in Parsoid for
15191 # consistencies' sake.
15192 # FIXME: fix this behavior in the PHP parser?
15193 !! test
15194 div with empty attribute value, no space before equals
15195 !! options
15196 parsoid=wt2html,html2html
15197 !! wikitext
15198 <div class=>HTML rocks</div>
15199 !! html/php
15200 <div>HTML rocks</div>
15201
15202 !! html/parsoid
15203 <div class="">HTML rocks</div>
15204 !! end
15205
15206 !! test
15207 HTML multiple attributes correction
15208 !! wikitext
15209 <p class="error" class="awesome">Awesome!</p>
15210 !! html
15211 <p class="awesome">Awesome!</p>
15212
15213 !!end
15214
15215 !! test
15216 Table multiple attributes correction
15217 !! wikitext
15218 {|
15219 !+ class="error" class="awesome"| status
15220 |}
15221 !! html
15222 <table>
15223 <tr>
15224 <th class="awesome"> status
15225 </th></tr></table>
15226
15227 !!end
15228
15229 !! test
15230 DIV IN UPPERCASE
15231 !! wikitext
15232 <DIV ID="x">HTML ROCKS</DIV>
15233 !! html
15234 <div id="x">HTML ROCKS</div>
15235
15236 !!end
15237
15238 !! test
15239 Non-ASCII pseudo-tags are rendered as text
15240 !! wikitext
15241 <khyô>
15242 !! html
15243 <p>&lt;khyô&gt;
15244 </p>
15245 !! end
15246
15247 !! test
15248 Pseudo-tag with URL 'name' renders as url link
15249 !! wikitext
15250 <http://example.com/>
15251 !! html
15252 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15253 </p>
15254 !! end
15255
15256 !! test
15257 text with amp in the middle of nowhere
15258 !! wikitext
15259 Remember AT&T?
15260 !! html
15261 <p>Remember AT&amp;T?
15262 </p>
15263 !! end
15264
15265 !! test
15266 text with character entity: eacute
15267 !! wikitext
15268 I always thought &eacute; was a cute letter.
15269 !! html
15270 <p>I always thought &#233; was a cute letter.
15271 </p>
15272 !! html+tidy
15273 <p>I always thought é was a cute letter.</p>
15274 !! end
15275
15276 !! test
15277 text with entity-escaped character entity-like string: eacute
15278 !! wikitext
15279 I always thought &amp;eacute; was a cute letter.
15280 !! html
15281 <p>I always thought &amp;eacute; was a cute letter.
15282 </p>
15283 !! end
15284
15285 !! test
15286 text with undefined character entity: xacute
15287 !! wikitext
15288 I always thought &xacute; was a cute letter.
15289 !! html
15290 <p>I always thought &amp;xacute; was a cute letter.
15291 </p>
15292 !! end
15293
15294 !! test
15295 HTML5 tags
15296 !! wikitext
15297 <data value="5">five</data>
15298 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15299 <mark>This highlighted text</mark>
15300 !! html
15301 <p><data value="5">five</data>
15302 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15303 <mark>This highlighted text</mark>
15304 </p>
15305 !! end
15306
15307 !! test
15308 HTML tag with leading space is parsed as text
15309 !! wikitext
15310 < div>foo< /div>
15311 !! html
15312 <p>&lt; div&gt;foo&lt; /div&gt;
15313 </p>
15314 !! end
15315
15316 ###
15317 ### Nesting tests (see bug 41545, 50604, 51081)
15318 ###
15319
15320 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15321 # Note that html2wt is considerably more difficult if we use <b> in
15322 # the test case, instead of <big>
15323 !! test
15324 Ensure that HTML adoption agency algorithm is properly implemented.
15325 !! wikitext
15326 <big>X<big>Y</big>Z</big>
15327 !! html
15328 <p><big>X<big>Y</big>Z</big>
15329 </p>
15330 !! end
15331
15332 # This was bug 41545 in the PHP parser.
15333 # Note that tidy doesn't handle this correctly.
15334 !! test
15335 Nesting of <kbd>
15336 !! wikitext
15337 <kbd>X<kbd>Y</kbd>Z</kbd>
15338 !! html
15339 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15340 </p>
15341 !! end
15342
15343 # The following cases were bug 51081 in the PHP parser.
15344 # Note that there are some other nestable tags (b, i, etc) which are
15345 # not covered; see bug 51081 for discussion.
15346
15347 # Note that tidy doesn't handle this correctly.
15348 !! test
15349 Nesting of <em>
15350 !! wikitext
15351 <em>X<em>Y</em>Z</em>
15352 !! html
15353 <p><em>X<em>Y</em>Z</em>
15354 </p>
15355 !! end
15356
15357 # Note that tidy doesn't handle this correctly.
15358 !! test
15359 Nesting of <strong>
15360 !! wikitext
15361 <strong>X<strong>Y</strong>Z</strong>
15362 !! html
15363 <p><strong>X<strong>Y</strong>Z</strong>
15364 </p>
15365 !! end
15366
15367 !! test
15368 Nesting of <q>
15369 !! wikitext
15370 <q>X<q>Y</q>Z</q>
15371 !! html+tidy
15372 <p><q>X<q>Y</q>Z</q></p>
15373 !! end
15374
15375 # Note that tidy doesn't handle this correctly.
15376 !! test
15377 Nesting of <ruby>
15378 !! wikitext
15379 <ruby>X<ruby>Y</ruby>Z</ruby>
15380 !! html
15381 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15382 </p>
15383 !! end
15384
15385 # Note that tidy doesn't handle this correctly.
15386 !! test
15387 Nesting of <bdo>
15388 !! wikitext
15389 <bdo>X<bdo>Y</bdo>Z</bdo>
15390 !! html
15391 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15392 </p>
15393 !! end
15394
15395
15396 ###
15397 ### Media links
15398 ###
15399
15400 !! test
15401 Media link
15402 !! wikitext
15403 [[Media:Foobar.jpg]]
15404 !! html
15405 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15406 </p>
15407 !! end
15408
15409 !! test
15410 Media link with text
15411 !! wikitext
15412 [[Media:Foobar.jpg|A neat file to look at]]
15413 !! html
15414 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15415 </p>
15416 !! end
15417
15418 # FIXME: this is still bad HTML tag nesting
15419 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15420 !! test
15421 Media link with nasty text
15422 !! wikitext
15423 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15424 !! html
15425 <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>
15426
15427 !! html+tidy
15428 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15429 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15430 !! end
15431
15432 !! test
15433 Media link to nonexistent file (bug 1702)
15434 !! wikitext
15435 [[Media:No such.jpg]]
15436 !! html
15437 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15438 </p>
15439 !! end
15440
15441 !! test
15442 Image link to nonexistent file (bug 1850 - good)
15443 !! wikitext
15444 [[File:No_such.jpg]]
15445 !! html/php
15446 <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>
15447 </p>
15448 !! html/parsoid
15449 <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>
15450 !! end
15451
15452 !! test
15453 :Image link to nonexistent file (bug 1850 - bad)
15454 !! wikitext
15455 [[:Image:No such.jpg]]
15456 !! html/php
15457 <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>
15458 </p>
15459 !! html/parsoid
15460 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15461 !! end
15462
15463
15464
15465 !! test
15466 Character reference normalization in link text (bug 1938)
15467 !! wikitext
15468 [[Main Page|this&that]]
15469 !! html
15470 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15471 </p>
15472 !!end
15473
15474 !! article
15475 אַ
15476 !! text
15477 Test for unicode normalization
15478
15479 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15480 !! endarticle
15481
15482 !! test
15483 (bug 19451) Links should refer to the normalized form.
15484 !! wikitext
15485 [[&#xFB2E;]]
15486 [[&#x5d0;&#x5b7;]]
15487 [[&#x5d0;ַ]]
15488 [[א&#x5b7;]]
15489 [[אַ]]
15490 !! html
15491 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15492 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15493 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15494 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15495 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15496 </p>
15497 !! end
15498
15499 !! test
15500 Empty attribute crash test (bug 2067)
15501 !! wikitext
15502 <font color="">foo</font>
15503 !! html
15504 <p><font color="">foo</font>
15505 </p>
15506 !! end
15507
15508 !! test
15509 Empty attribute crash test single-quotes (bug 2067)
15510 !! wikitext
15511 <font color=''>foo</font>
15512 !! html
15513 <p><font color="">foo</font>
15514 </p>
15515 !! end
15516
15517 !! test
15518 Attribute test: equals, then nothing
15519 !! wikitext
15520 <font color=>foo</font>
15521 !! html
15522 <p><font>foo</font>
15523 </p>
15524 !! end
15525
15526 !! test
15527 Attribute test: unquoted value
15528 !! wikitext
15529 <font color=x>foo</font>
15530 !! html
15531 <p><font color="x">foo</font>
15532 </p>
15533 !! end
15534
15535 !! test
15536 Attribute test: unquoted but illegal value (hash)
15537 !! wikitext
15538 <font color=#x>foo</font>
15539 !! html
15540 <p><font color="#x">foo</font>
15541 </p>
15542 !! end
15543
15544 # Parsoid does not serialize to empty attribute syntax,
15545 # so wt2wt and html2wt cases are skipped
15546 !! test
15547 Attribute test: no value (T54330)
15548 !! options
15549 parsoid=wt2html,html2html
15550 !! wikitext
15551 <font color>foo</font>
15552 !! html/php
15553 <p><font color="">foo</font>
15554 </p>
15555 !! html/parsoid
15556 <p><font color="">foo</font></p>
15557 !! end
15558
15559 !! test
15560 Bug 2095: link with three closing brackets
15561 !! wikitext
15562 [[Main Page]]]
15563 !! html/php
15564 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15565 </p>
15566 !! html/parsoid
15567 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15568 !! end
15569
15570 !! test
15571 Bug 2095: link with pipe and three closing brackets
15572 !! wikitext
15573 [[Main Page|link]]]
15574 !! html/php
15575 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15576 </p>
15577 !! html/parsoid
15578 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15579 !! end
15580
15581 !! test
15582 Bug 2095: link with pipe and three closing brackets, version 2
15583 !! wikitext
15584 [[Main Page|[http://example.com/]]]
15585 !! html/php
15586 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15587 </p>
15588 !! html/parsoid
15589 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15590 !! end
15591
15592
15593 ###
15594 ### Safety
15595 ###
15596
15597 !! article
15598 Template:Dangerous attribute
15599 !! text
15600 " onmouseover="alert(document.cookie)
15601 !! endarticle
15602
15603 !! article
15604 Template:Dangerous style attribute
15605 !! text
15606 border-size: expression(alert(document.cookie))
15607 !! endarticle
15608
15609 !! article
15610 Template:Div style
15611 !! text
15612 <div style="float: right; {{{1}}}">Magic div</div>
15613 !! endarticle
15614
15615 !! test
15616 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15617 !! wikitext
15618 <div title="{{test}}"></div>
15619 !! html
15620 <div title="This is a test template"></div>
15621
15622 !! end
15623
15624 # Parsoid has enough context to handle this case
15625 !! test
15626 Bug 2304: HTML attribute safety (dangerous template; 2309)
15627 !! wikitext
15628 <div title="{{dangerous attribute}}"></div>
15629 !! html/php
15630 <div title=""></div>
15631
15632 !! html/parsoid
15633 <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>
15634 !! end
15635
15636 !! test
15637 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15638 !! wikitext
15639 <div style="{{dangerous style attribute}}"></div>
15640 !! html
15641 <div style="/* insecure input */"></div>
15642
15643 !! end
15644
15645 !! test
15646 Bug 2304: HTML attribute safety (safe parameter; 2309)
15647 !! wikitext
15648 {{div style|width: 200px}}
15649 !! html
15650 <div style="float: right; width: 200px">Magic div</div>
15651
15652 !! end
15653
15654 !! test
15655 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15656 !! wikitext
15657 {{div style|width: expression(alert(document.cookie))}}
15658 !! html
15659 <div style="/* insecure input */">Magic div</div>
15660
15661 !! end
15662
15663 !! test
15664 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15665 !! wikitext
15666 {{div style|"><script>alert(document.cookie)</script>}}
15667 !! html
15668 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15669
15670 !! end
15671
15672 !! test
15673 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15674 !! wikitext
15675 {{div style|" ><script>alert(document.cookie)</script>}}
15676 !! html
15677 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15678
15679 !! end
15680
15681 !! test
15682 Bug 2304: HTML attribute safety (link)
15683 !! wikitext
15684 <div title="[[Main Page]]"></div>
15685 !! html
15686 <div title="&#91;&#91;Main Page]]"></div>
15687
15688 !! end
15689
15690 !! test
15691 Bug 2304: HTML attribute safety (italics)
15692 !! wikitext
15693 <div title="''foobar''"></div>
15694 !! html
15695 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15696
15697 !! end
15698
15699 !! test
15700 Bug 2304: HTML attribute safety (bold)
15701 !! wikitext
15702 <div title="'''foobar'''"></div>
15703 !! html
15704 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15705
15706 !! end
15707
15708
15709 !! test
15710 Bug 2304: HTML attribute safety (ISBN)
15711 !! wikitext
15712 <div title="ISBN 1234567890"></div>
15713 !! html
15714 <div title="&#73;SBN 1234567890"></div>
15715
15716 !! end
15717
15718 !! test
15719 Bug 2304: HTML attribute safety (RFC)
15720 !! wikitext
15721 <div title="RFC 1234"></div>
15722 !! html
15723 <div title="&#82;FC 1234"></div>
15724
15725 !! end
15726
15727 !! test
15728 Bug 2304: HTML attribute safety (PMID)
15729 !! wikitext
15730 <div title="PMID 1234567890"></div>
15731 !! html
15732 <div title="&#80;MID 1234567890"></div>
15733
15734 !! end
15735
15736 !! test
15737 Bug 2304: HTML attribute safety (web link)
15738 !! wikitext
15739 <div title="http://example.com/"></div>
15740 !! html
15741 <div title="http&#58;//example.com/"></div>
15742
15743 !! end
15744
15745 !! test
15746 Bug 2304: HTML attribute safety (named web link)
15747 !! wikitext
15748 <div title="[http://example.com/ link]"></div>
15749 !! html
15750 <div title="&#91;http&#58;//example.com/ link]"></div>
15751
15752 !! end
15753
15754 !! test
15755 Bug 3244: HTML attribute safety (extension; safe)
15756 !! wikitext
15757 <div style="<nowiki>background:blue</nowiki>"></div>
15758 !! html
15759 <div style="background:blue"></div>
15760
15761 !! end
15762
15763 !! test
15764 Bug 3244: HTML attribute safety (extension; unsafe)
15765 !! wikitext
15766 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15767 !! html
15768 <div style="/* insecure input */"></div>
15769
15770 !! end
15771
15772 # More MSIE fun discovered by Tom Gilder
15773
15774 !! test
15775 MSIE CSS safety test: spurious slash
15776 !! wikitext
15777 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15778 !! html
15779 <div style="/* insecure input */">evil</div>
15780
15781 !! end
15782
15783 !! test
15784 MSIE CSS safety test: hex code
15785 !! wikitext
15786 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15787 !! html
15788 <div style="/* insecure input */">evil</div>
15789
15790 !! end
15791
15792 !! test
15793 MSIE CSS safety test: comment in url
15794 !! wikitext
15795 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15796 !! html
15797 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15798
15799 !! end
15800
15801 !! test
15802 MSIE CSS safety test: comment in expression
15803 !! wikitext
15804 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15805 !! html
15806 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15807
15808 !! end
15809
15810 !! test
15811 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15812 !! wikitext
15813 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15814 !! html
15815 <p style="/* invalid control char */">A</p>
15816
15817 !! end
15818
15819 !! test
15820 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15821 !! wikitext
15822 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15823 <div style="top:EXPRESSION(alert())">B</div>
15824 !! html
15825 <p style="/* insecure input */">A</p>
15826 <div style="/* insecure input */">B</div>
15827
15828 !! end
15829
15830 !! test
15831 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15832 !! wikitext
15833 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15834 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15835 !! html
15836 <div style="/* insecure input */">A</div>
15837 <p style="/* insecure input */">B</p>
15838
15839 !! end
15840
15841 !! test
15842 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15843 !! wikitext
15844 <div style="background-image:url⁽javascript:alert())">A</div>
15845 <div style="background-image:url₍javascript:alert())">B</div>
15846 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15847 !! html
15848 <div style="/* insecure input */">A</div>
15849 <div style="/* insecure input */">B</div>
15850 <p style="/* insecure input */">C</p>
15851
15852 !! end
15853
15854 !! test
15855 Opera -o-link CSS
15856 !! wikitext
15857 <div
15858 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;"
15859 style="-o-link:attr(title);-o-link-source:current">X</div>
15860 !! html
15861 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15862
15863 !! end
15864
15865 !! test
15866 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15867 !! wikitext
15868 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15869 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15870 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15871 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15872 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15873 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15874 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15875 !! html
15876 <p style="/* insecure input */">A</p>
15877 <p style="/* insecure input */">B</p>
15878 <p style="/* insecure input */">C</p>
15879 <p style="/* insecure input */">D</p>
15880 <p style="/* insecure input */">E</p>
15881 <p style="/* insecure input */">F</p>
15882 <p style="/* insecure input */">G</p>
15883
15884 !! end
15885
15886 !! test
15887 Table attribute legitimate extension
15888 !! wikitext
15889 {|
15890 !+ style="<nowiki>color:blue</nowiki>"| status
15891 |}
15892 !! html
15893 <table>
15894 <tr>
15895 <th style="color:blue"> status
15896 </th></tr></table>
15897
15898 !!end
15899
15900 !! test
15901 Table attribute safety
15902 !! wikitext
15903 {|
15904 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15905 |}
15906 !! html
15907 <table>
15908 <tr>
15909 <th style="/* insecure input */"> status
15910 </th></tr></table>
15911
15912 !! end
15913
15914 !! test
15915 CSS line continuation 1
15916 !! wikitext
15917 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15918 !! html
15919 <div style="/* insecure input */"></div>
15920
15921 !! end
15922
15923 !! test
15924 CSS line continuation 2
15925 !! wikitext
15926 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15927 !! html
15928 <div style="/* invalid control char */"></div>
15929
15930 !! end
15931
15932 !! article
15933 Template:Identity
15934 !! text
15935 {{{1}}}
15936 !! endarticle
15937
15938 !! test
15939 Expansion of multi-line templates in attribute values (bug 6255)
15940 !! wikitext
15941 <div style="background: {{identity|#00FF00}}">-</div>
15942 !! html
15943 <div style="background: #00FF00">-</div>
15944
15945 !! end
15946
15947
15948 !! test
15949 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15950 !! wikitext
15951 <div style="background:
15952 #00FF00">-</div>
15953 !! html/php
15954 <div style="background: #00FF00">-</div>
15955
15956 !! html/parsoid
15957 <div style="background:
15958 #00FF00">-</div>
15959 !! end
15960
15961 !! test
15962 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15963 !! wikitext
15964 <div style="background: &#10;#00FF00">-</div>
15965 !! html
15966 <div style="background: &#10;#00FF00">-</div>
15967
15968 !! end
15969
15970 !! test
15971 evil <math>-wiki-tags without Extension:Math enabled
15972 !! wikitext
15973 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15974 !! html+tidy
15975 <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>
15976 !! end
15977
15978 ###
15979 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15980 ###
15981 !! test
15982 Parser hook: empty input
15983 !! wikitext
15984 <tag></tag>
15985 !! html/php
15986 <pre>
15987 ''
15988 array (
15989 )
15990 </pre>
15991
15992 !! end
15993
15994 !! test
15995 Parser hook: empty input using terminated empty elements
15996 !! wikitext
15997 <tag/>
15998 !! html/php
15999 <pre>
16000 NULL
16001 array (
16002 )
16003 </pre>
16004
16005 !! end
16006
16007 !! test
16008 Parser hook: empty input using terminated empty elements (space before)
16009 !! wikitext
16010 <tag />
16011 !! html/php
16012 <pre>
16013 NULL
16014 array (
16015 )
16016 </pre>
16017
16018 !! end
16019
16020 !! test
16021 Parser hook: basic input
16022 !! wikitext
16023 <tag>input</tag>
16024 !! html/php
16025 <pre>
16026 'input'
16027 array (
16028 )
16029 </pre>
16030
16031 !! end
16032
16033
16034 !! test
16035 Parser hook: case insensitive
16036 !! wikitext
16037 <TAG>input</TAG>
16038 !! html/php
16039 <pre>
16040 'input'
16041 array (
16042 )
16043 </pre>
16044
16045 !! end
16046
16047
16048 !! test
16049 Parser hook: case insensitive, redux
16050 !! wikitext
16051 <TaG>input</TAg>
16052 !! html/php
16053 <pre>
16054 'input'
16055 array (
16056 )
16057 </pre>
16058
16059 !! end
16060
16061 !! test
16062 Parser hook: nested tags
16063 !! options
16064 noxml
16065 !! wikitext
16066 <tag><tag></tag></tag>
16067 !! html/php
16068 <pre>
16069 '<tag>'
16070 array (
16071 )
16072 </pre>&lt;/tag&gt;
16073
16074 !! end
16075
16076 !! test
16077 Parser hook: basic arguments
16078 !! wikitext
16079 <tag width=200 height = "100" depth = '50' square></tag>
16080 !! html/php
16081 <pre>
16082 ''
16083 array (
16084 'width' => '200',
16085 'height' => '100',
16086 'depth' => '50',
16087 'square' => '',
16088 )
16089 </pre>
16090
16091 !! end
16092
16093 !! test
16094 Parser hook: argument containing a forward slash (bug 5344)
16095 !! wikitext
16096 <tag filename='/tmp/bla'></tag>
16097 !! html/php
16098 <pre>
16099 ''
16100 array (
16101 'filename' => '/tmp/bla',
16102 )
16103 </pre>
16104
16105 !! end
16106
16107 !! test
16108 Parser hook: empty input using terminated empty elements (bug 2374)
16109 !! wikitext
16110 <tag foo=bar/>text
16111 !! html/php
16112 <pre>
16113 NULL
16114 array (
16115 'foo' => 'bar',
16116 )
16117 </pre>text
16118
16119 !! end
16120
16121 # </tag> should be output literally since there is no matching tag that begins it
16122 !! test
16123 Parser hook: basic arguments using terminated empty elements (bug 2374)
16124 !! wikitext
16125 <tag width=200 height = "100" depth = '50' square/>
16126 other stuff
16127 </tag>
16128 !! html/php
16129 <pre>
16130 NULL
16131 array (
16132 'width' => '200',
16133 'height' => '100',
16134 'depth' => '50',
16135 'square' => '',
16136 )
16137 </pre>
16138 <p>other stuff
16139 &lt;/tag&gt;
16140 </p>
16141 !! end
16142
16143 ###
16144 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16145 ###
16146
16147 !! test
16148 Parser hook: static parser hook not inside a comment
16149 !! wikitext
16150 <statictag>hello, world</statictag>
16151 <statictag action=flush/>
16152 !! html/php
16153 <p>hello, world
16154 </p>
16155 !! end
16156
16157
16158 !! test
16159 Parser hook: static parser hook inside a comment
16160 !! wikitext
16161 <!-- <statictag>hello, world</statictag> -->
16162 <statictag action=flush/>
16163 !! html/php
16164 <p><br />
16165 </p>
16166 !! end
16167
16168 # Nested template calls; this case was broken by Parser.php rev 1.506,
16169 # since reverted.
16170
16171 !! article
16172 Template:One-parameter
16173 !! text
16174 (My parameter is: {{{1}}})
16175 !! endarticle
16176
16177 !! article
16178 Template:Map-one-parameter
16179 !! text
16180 {{{{{1}}}|{{{2}}}}}
16181 !! endarticle
16182
16183 !! test
16184 Nested template calls
16185 !! wikitext
16186 {{Map-one-parameter|One-parameter|param}}
16187 !! html
16188 <p>(My parameter is: param)
16189 </p>
16190 !! end
16191
16192
16193 ###
16194 ### Sanitizer
16195 ###
16196
16197 # HTML+Tidy effectively strips out the empty tags completely
16198 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16199 # which Tidy would have done for the PHP parser had there been content inside it.
16200 !! test
16201 Sanitizer: Closing of open tags
16202 !! wikitext
16203 <s></s><table></table>
16204 !! html
16205 <s></s><table></table>
16206
16207 !! html/parsoid
16208 <p><s></s></p><table></table>
16209 !! end
16210
16211 !! test
16212 Sanitizer: Closing of open but not closed tags
16213 !! wikitext
16214 <s>foo
16215 !! html
16216 <p><s>foo</s>
16217 </p>
16218 !! end
16219
16220 !! test
16221 Sanitizer: Closing of closed but not open tags
16222 !! options
16223 parsoid=wt2html
16224 !! wikitext
16225 </s>
16226 !! html/php+tidy
16227 !! html/parsoid
16228 !! end
16229
16230 !! test
16231 Sanitizer: Closing of closed but not open table tags
16232 !! options
16233 parsoid=wt2html
16234 !! wikitext
16235 Table not started</td></tr></table>
16236 !! html/php+tidy
16237 <p>Table not started</p>
16238 !! html/parsoid
16239 <p>Table not started</p>
16240 !! end
16241
16242 !! test
16243 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16244 !! wikitext
16245 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16246 !! html
16247 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16248 </p>
16249 !! end
16250
16251 # In HTML5, the restrictions are that id must contain at least one character,
16252 # and must not contain any space characters.
16253 !! test
16254 Sanitizer: Validating the contents of the id attribute (bug 4515)
16255 !! options
16256 disabled
16257 !! wikitext
16258 <br id="" /><br id="a space" />
16259 !! html
16260 Something ...
16261 !! end
16262
16263 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16264 !! test
16265 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16266 !! options
16267 disabled
16268 !! wikitext
16269 <br id="foo" /><br id="foo" />
16270 !! html
16271 Something need to be done. foo-2 ?
16272 !! end
16273
16274 !! test
16275 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16276 !! wikitext
16277 <div itemscope>
16278 <meta itemprop="hello" content="world">
16279 <meta http-equiv="refresh" content="5">
16280 <meta itemprop="hello" http-equiv="refresh" content="5">
16281 <link itemprop="hello" href="{{SERVER}}">
16282 <link rel="stylesheet" href="{{SERVER}}">
16283 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16284 </div>
16285 !! html
16286 <div itemscope="">
16287 <p> <meta itemprop="hello" content="world" />
16288 &lt;meta http-equiv="refresh" content="5"&gt;
16289 <meta itemprop="hello" content="5" />
16290 </p>
16291 <link itemprop="hello" href="http&#58;//example.org" />
16292 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16293 <link itemprop="hello" href="http&#58;//example.org" />
16294 </div>
16295
16296 !! end
16297
16298 !! test
16299 Language converter: output gets cut off unexpectedly (bug 5757)
16300 !! options
16301 language=zh
16302 !! wikitext
16303 this bit is safe: }-
16304
16305 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16306
16307 then we get cut off here: }-
16308
16309 all additional text is vanished
16310 !! html
16311 <p>this bit is safe: }-
16312 </p><p>but if we add a conversion instance: xxx
16313 </p><p>then we get cut off here: }-
16314 </p><p>all additional text is vanished
16315 </p>
16316 !! end
16317
16318 !! test
16319 Self closed html pairs (bug 5487)
16320 !! options
16321 !! wikitext
16322 <center><font id="bug" />Centered text</center>
16323 <div><font id="bug2" />In div text</div>
16324 !! html
16325 <center>&lt;font id="bug" /&gt;Centered text</center>
16326 <div>&lt;font id="bug2" /&gt;In div text</div>
16327
16328 !! end
16329
16330 #
16331 #
16332 #
16333
16334 !! test
16335 Punctuation: nbsp before exclamation
16336 !! wikitext
16337 C'est grave !
16338 !! html
16339 <p>C'est grave&#160;!
16340 </p>
16341 !! end
16342
16343 !! test
16344 Punctuation: CSS !important (bug 11874)
16345 !! wikitext
16346 <div style="width:50% !important">important</div>
16347 !! html
16348 <div style="width:50% !important">important</div>
16349
16350 !!end
16351
16352 !! test
16353 Punctuation: CSS ! important (bug 11874; with space after)
16354 !! wikitext
16355 <div style="width:50% ! important">important</div>
16356 !! html
16357 <div style="width:50% ! important">important</div>
16358
16359 !!end
16360
16361 !! test
16362 HTML bullet list, closed tags (bug 5497)
16363 !! wikitext
16364 <ul>
16365 <li>One</li>
16366 <li>Two</li>
16367 </ul>
16368 !! html/php
16369 <ul>
16370 <li>One</li>
16371 <li>Two</li>
16372 </ul>
16373
16374 !! html/parsoid
16375 <ul data-parsoid='{"stx":"html"}'>
16376 <li data-parsoid='{"stx":"html"}'>One</li>
16377 <li data-parsoid='{"stx":"html"}'>Two</li>
16378 </ul>
16379
16380 !! end
16381
16382 !! test
16383 HTML bullet list, unclosed tags (bug 5497)
16384 !! wikitext
16385 <ul>
16386 <li>One
16387 <li>Two
16388 </ul>
16389 !! html/php+tidy
16390 <ul>
16391 <li>One</li>
16392 <li>Two</li>
16393 </ul>
16394 !! html/parsoid
16395 <ul data-parsoid='{"stx":"html"}'>
16396 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16397 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16398 </ul>
16399
16400 !! end
16401
16402 !! test
16403 HTML ordered list, closed tags (bug 5497)
16404 !! wikitext
16405 <ol>
16406 <li>One</li>
16407 <li>Two</li>
16408 </ol>
16409 !! html/php
16410 <ol>
16411 <li>One</li>
16412 <li>Two</li>
16413 </ol>
16414
16415 !! html/parsoid
16416 <ol data-parsoid='{"stx":"html"}'>
16417 <li data-parsoid='{"stx":"html"}'>One</li>
16418 <li data-parsoid='{"stx":"html"}'>Two</li>
16419 </ol>
16420
16421 !! end
16422
16423 !! test
16424 HTML ordered list, unclosed tags (bug 5497)
16425 !! options
16426 !! wikitext
16427 <ol>
16428 <li>One
16429 <li>Two
16430 </ol>
16431 !! html/php+tidy
16432 <ol>
16433 <li>One</li>
16434 <li>Two</li>
16435 </ol>
16436 !! html/parsoid
16437 <ol data-parsoid='{"stx":"html"}'>
16438 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16439 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16440 </ol>
16441
16442 !! end
16443
16444 !! test
16445 HTML nested bullet list, closed tags (bug 5497)
16446 !! wikitext
16447 <ul>
16448 <li>One</li>
16449 <li>Two:
16450 <ul>
16451 <li>Sub-one</li>
16452 <li>Sub-two</li>
16453 </ul>
16454 </li>
16455 </ul>
16456 !! html
16457 <ul>
16458 <li>One</li>
16459 <li>Two:
16460 <ul>
16461 <li>Sub-one</li>
16462 <li>Sub-two</li>
16463 </ul>
16464 </li>
16465 </ul>
16466
16467 !! end
16468
16469 !! test
16470 HTML nested bullet list, open tags (bug 5497)
16471 !! wikitext
16472 <ul>
16473 <li>One
16474 <li>Two:
16475 <ul>
16476 <li>Sub-one
16477 <li>Sub-two
16478 </ul>
16479 </ul>
16480 !! html/php+tidy
16481 <ul>
16482 <li>One</li>
16483 <li>Two:
16484 <ul>
16485 <li>Sub-one</li>
16486 <li>Sub-two</li>
16487 </ul>
16488 </li>
16489 </ul>
16490 !! html/parsoid
16491 <ul>
16492 <li>One
16493 </li>
16494 <li>Two:
16495 <ul>
16496 <li>Sub-one
16497 </li>
16498 <li>Sub-two
16499 </li>
16500 </ul>
16501 </li>
16502 </ul>
16503
16504 !! end
16505
16506 !! test
16507 HTML nested ordered list, closed tags (bug 5497)
16508 !! wikitext
16509 <ol>
16510 <li>One</li>
16511 <li>Two:
16512 <ol>
16513 <li>Sub-one</li>
16514 <li>Sub-two</li>
16515 </ol>
16516 </li>
16517 </ol>
16518 !! html
16519 <ol>
16520 <li>One</li>
16521 <li>Two:
16522 <ol>
16523 <li>Sub-one</li>
16524 <li>Sub-two</li>
16525 </ol>
16526 </li>
16527 </ol>
16528
16529 !! end
16530
16531 !! test
16532 HTML nested ordered list, open tags (bug 5497)
16533 !! wikitext
16534 <ol>
16535 <li>One
16536 <li>Two:
16537 <ol>
16538 <li>Sub-one
16539 <li>Sub-two
16540 </ol>
16541 </ol>
16542 !! html/php
16543 <ol>
16544 <li>One
16545 <li>Two:
16546 <ol>
16547 <li>Sub-one
16548 <li>Sub-two
16549 </ol>
16550 </ol>
16551
16552 !! html/parsoid
16553 <ol>
16554 <li>One
16555 </li>
16556 <li>Two:
16557 <ol>
16558 <li>Sub-one
16559 </li>
16560 <li>Sub-two
16561 </li>
16562 </ol>
16563 </li>
16564 </ol>
16565
16566 !! end
16567
16568 !! test
16569 HTML ordered list item with parameters oddity
16570 !! wikitext
16571 <ol><li id="fragment">One</li>
16572 </ol>
16573 !! html
16574 <ol><li id="fragment">One</li>
16575 </ol>
16576
16577 !! end
16578
16579 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16580 !!test
16581 bug 5918: autonumbering
16582 !! wikitext
16583 [http://first/] [http://second] [ftp://ftp]
16584
16585 ftp://inlineftp
16586
16587 [mailto:enclosed@mail.tld With target]
16588
16589 [mailto:enclosed@mail.tld]
16590
16591 mailto:inline@mail.tld
16592 !! html/php
16593 <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>
16594 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16595 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16596 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16597 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16598 </p>
16599 !! html/parsoid
16600 <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>
16601 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16602 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16603 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16604 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16605 !! end
16606
16607
16608 #
16609 # Security and HTML correctness
16610 # From Nick Jenkins' fuzz testing
16611 #
16612
16613 !! test
16614 Fuzz testing: Parser13
16615 !! wikitext
16616 {|
16617 | http://a|
16618 !! html
16619 <table>
16620 <tr>
16621 <td>
16622 </td>
16623 </tr>
16624 </table>
16625
16626 !! end
16627
16628 !! test
16629 Fuzz testing: Parser14
16630 !! wikitext
16631 == onmouseover= ==
16632 http://__TOC__
16633 !! html
16634 <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>
16635 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16636 <ul>
16637 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16638 </ul>
16639 </div>
16640
16641
16642 !! html+tidy
16643 <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>
16644 <p>http://</p>
16645 <div id="toc" class="toc">
16646 <div id="toctitle">
16647 <h2>Contents</h2>
16648 </div>
16649 <ul>
16650 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16651 </ul>
16652 </div>
16653 <p></p>
16654 !! end
16655
16656 !! test
16657 Fuzz testing: Parser14-table
16658 !! wikitext
16659 ==a==
16660 {| STYLE=__TOC__
16661 !! html
16662 <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>
16663 <table style="&#95;_TOC&#95;_">
16664 <tr><td></td></tr>
16665 </table>
16666
16667 !! html+tidy
16668 <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>
16669 <table style="__TOC__">
16670 <tr>
16671 <td></td>
16672 </tr>
16673 </table>
16674 !! end
16675
16676 # Known to produce bogus xml (extra </td>)
16677 !! test
16678 Fuzz testing: Parser16
16679 !! options
16680 noxml
16681 !! wikitext
16682 {|
16683 !https://||||||
16684 !! html
16685 <table>
16686 <tr>
16687 <th>https://</th>
16688 <th></th>
16689 <th></th>
16690 <th>
16691 </td>
16692 </tr>
16693 </table>
16694
16695 !! html+tidy
16696 <table>
16697 <tr>
16698 <th>https://</th>
16699 <th></th>
16700 <th></th>
16701 <th></th>
16702 </tr>
16703 </table>
16704 !! end
16705
16706 !! test
16707 Fuzz testing: Parser21
16708 !! wikitext
16709 {|
16710 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16711 |
16712 !! html
16713 <table>
16714 <tr>
16715 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16716 </th>
16717 <td>
16718 </td>
16719 </tr>
16720 </table>
16721
16722 !! end
16723
16724 !! test
16725 Fuzz testing: Parser22
16726 !! wikitext
16727 http://===r:::https://b
16728
16729 {|
16730 !! html
16731 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16732 </p>
16733 <table>
16734 <tr><td></td></tr>
16735 </table>
16736
16737 !! end
16738
16739 # Known to produce bad XML for now
16740 !! test
16741 Fuzz testing: Parser24
16742 !! options
16743 noxml
16744 !! wikitext
16745 {|
16746 {{{|
16747 <u CLASS=
16748 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16749 <br style="onmouseover='alert(document.cookie);' " />
16750
16751 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16752 |
16753 !! html
16754 <table>
16755 {{{|
16756 <u class="&#124;">}}}} &gt;
16757 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16758
16759 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16760 <tr>
16761 <td></u>
16762 </td>
16763 </tr>
16764 </table>
16765
16766 !! end
16767
16768 # Note: the current result listed for this is not what the original one was,
16769 # but the original bug was JavaScript injection, which is fixed in any case.
16770 # It's not clear that the original result listed was any more correct than the
16771 # current one. Original result:
16772 # <p>{{{|
16773 # </p>
16774 # <li class="&#124;&#124;">
16775 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16776 !!test
16777 Fuzz testing: Parser25 (bug 6055)
16778 !! wikitext
16779 {{{
16780 |
16781 <LI CLASS=||
16782 >
16783 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16784 !! html
16785 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16786 </p>
16787 !! end
16788
16789 !!test
16790 Fuzz testing: URL adjacent extension (with space, clean)
16791 !! wikitext
16792 http://example.com <nowiki>junk</nowiki>
16793 !! html/php
16794 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16795 </p>
16796 !! html/parsoid
16797 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16798 !! end
16799
16800 !!test
16801 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16802 !! wikitext
16803 http://example.com<nowiki>junk</nowiki>
16804 !! html/php
16805 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16806 </p>
16807 !! html/parsoid
16808 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16809 !! end
16810
16811 !!test
16812 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16813 !! wikitext
16814 http://example.com<pre>junk</pre>
16815 !! html/php
16816 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16817
16818 !! html/php+tidy
16819 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16820 <pre>
16821 junk
16822 </pre>
16823 !! html/parsoid
16824 <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>
16825 !!end
16826
16827 !!test
16828 Fuzz testing: image with bogus manual thumbnail
16829 !! wikitext
16830 [[Image:foobar.jpg|thumbnail= ]]
16831 !! html/php
16832 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16833
16834 !! html/parsoid
16835 <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>
16836 !!end
16837
16838 !! test
16839 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16840 !! wikitext
16841 <pre dir="&#10;"></pre>
16842 !! html
16843 <pre dir="&#10;"></pre>
16844
16845 !! end
16846
16847 !! test
16848 Parsing optional HTML elements (Bug 6171)
16849 !! options
16850 !! wikitext
16851 <table>
16852 <tr>
16853 <td> Some tabular data</td>
16854 <td> More tabular data ...
16855 <td> And yet som tabular data</td>
16856 </tr>
16857 </table>
16858 !! html
16859 <table>
16860 <tr>
16861 <td> Some tabular data</td>
16862 <td> More tabular data ...
16863 </td><td> And yet som tabular data</td>
16864 </tr>
16865 </table>
16866
16867 !! end
16868
16869 !! test
16870 Correct handling of <td>, <tr> (Bug 6171)
16871 !! options
16872 !! wikitext
16873 <table>
16874 <tr>
16875 <td> Some tabular data</td>
16876 <td> More tabular data ...</td>
16877 <td> And yet som tabular data</td>
16878 </tr>
16879 </table>
16880 !! html
16881 <table>
16882 <tr>
16883 <td> Some tabular data</td>
16884 <td> More tabular data ...</td>
16885 <td> And yet som tabular data</td>
16886 </tr>
16887 </table>
16888
16889 !! end
16890
16891
16892 !! test
16893 Parsing crashing regression (fr:JavaScript)
16894 !! wikitext
16895 </body></x>
16896 !! html
16897 <p>&lt;/body&gt;&lt;/x&gt;
16898 </p>
16899 !! end
16900
16901 !! test
16902 Inline wiki vs wiki block nesting
16903 !! wikitext
16904 '''Bold paragraph
16905
16906 New wiki paragraph
16907 !! html
16908 <p><b>Bold paragraph</b>
16909 </p><p>New wiki paragraph
16910 </p>
16911 !! end
16912
16913 # FIXME: The current php output is documented
16914 # and desired output is the parsoid target.
16915 !! test
16916 Inline HTML vs wiki block nesting
16917 !! wikitext
16918 <b>Bold paragraph
16919
16920 New wiki paragraph
16921 !! html/php
16922 <p><b>Bold paragraph
16923 </p><p>New wiki paragraph</b>
16924 </p>
16925 !! html/parsoid
16926 <p><b>Bold paragraph</b>
16927 </p><p>New wiki paragraph
16928 </p>
16929 !! end
16930
16931 # Original result was this:
16932 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16933 # </p>
16934 # While that might be marginally more intuitive, maybe, the six-apostrophe
16935 # construct is clearly pathological and the result stated here (which is what
16936 # the parser actually does) is about as reasonable as anything.
16937 !!test
16938 Mixing markup for italics and bold
16939 !! options
16940 !! wikitext
16941 '''bold''''''bold''bolditalics'''''
16942 !! html
16943 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16944 </p>
16945 !! end
16946
16947
16948 !! article
16949 Xyzzyx
16950 !! text
16951 Article for special page transclusion test
16952 !! endarticle
16953
16954 !! test
16955 Special page transclusion
16956 !! options
16957 !! wikitext
16958 {{Special:Prefixindex/Xyzzyx}}
16959 !! html
16960 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16961
16962 !! end
16963
16964 !! test
16965 Special page transclusion twice (bug 5021)
16966 !! options
16967 !! wikitext
16968 {{Special:Prefixindex/Xyzzyx}}
16969 {{Special:Prefixindex/Xyzzyx}}
16970 !! html
16971 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16972 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16973
16974 !! end
16975
16976 !! test
16977 Transclusion of default MediaWiki message
16978 !! wikitext
16979 {{MediaWiki:Mainpage}}
16980 !! html
16981 <p>Main Page
16982 </p>
16983 !! end
16984
16985 !! test
16986 Transclusion of nonexistent MediaWiki message
16987 !! wikitext
16988 {{MediaWiki:Mainpagexxx}}
16989 !! html
16990 <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>
16991 </p>
16992 !! end
16993
16994 !! test
16995 Transclusion of MediaWiki message with underscore
16996 !! wikitext
16997 {{MediaWiki:history_short}}
16998 !! html
16999 <p>History
17000 </p>
17001 !! end
17002
17003 !! test
17004 Transclusion of MediaWiki message with space
17005 !! wikitext
17006 {{MediaWiki:history short}}
17007 !! html
17008 <p>History
17009 </p>
17010 !! end
17011
17012 !! test
17013 Invalid header with following text
17014 !! wikitext
17015 = x = y
17016 !! html
17017 <p>= x = y
17018 </p>
17019 !! end
17020
17021
17022 !! test
17023 Section extraction test (section 0)
17024 !! options
17025 section=0
17026 !! wikitext
17027 start
17028 ==a==
17029 ===aa===
17030 ====aaa====
17031 ==b==
17032 ===ba===
17033 ===bb===
17034 ====bba====
17035 ===bc===
17036 ==c==
17037 ===ca===
17038 !! html/php
17039 start
17040 !! end
17041
17042 !! test
17043 Section extraction test (section 1)
17044 !! options
17045 section=1
17046 !! wikitext
17047 start
17048 ==a==
17049 ===aa===
17050 ====aaa====
17051 ==b==
17052 ===ba===
17053 ===bb===
17054 ====bba====
17055 ===bc===
17056 ==c==
17057 ===ca===
17058 !! html/php
17059 ==a==
17060 ===aa===
17061 ====aaa====
17062 !! end
17063
17064 !! test
17065 Section extraction test (section 2)
17066 !! options
17067 section=2
17068 !! wikitext
17069 start
17070 ==a==
17071 ===aa===
17072 ====aaa====
17073 ==b==
17074 ===ba===
17075 ===bb===
17076 ====bba====
17077 ===bc===
17078 ==c==
17079 ===ca===
17080 !! html/php
17081 ===aa===
17082 ====aaa====
17083 !! end
17084
17085 !! test
17086 Section extraction test (section 3)
17087 !! options
17088 section=3
17089 !! wikitext
17090 start
17091 ==a==
17092 ===aa===
17093 ====aaa====
17094 ==b==
17095 ===ba===
17096 ===bb===
17097 ====bba====
17098 ===bc===
17099 ==c==
17100 ===ca===
17101 !! html/php
17102 ====aaa====
17103 !! end
17104
17105 !! test
17106 Section extraction test (section 4)
17107 !! options
17108 section=4
17109 !! wikitext
17110 start
17111 ==a==
17112 ===aa===
17113 ====aaa====
17114 ==b==
17115 ===ba===
17116 ===bb===
17117 ====bba====
17118 ===bc===
17119 ==c==
17120 ===ca===
17121 !! html/php
17122 ==b==
17123 ===ba===
17124 ===bb===
17125 ====bba====
17126 ===bc===
17127 !! end
17128
17129 !! test
17130 Section extraction test (section 5)
17131 !! options
17132 section=5
17133 !! wikitext
17134 start
17135 ==a==
17136 ===aa===
17137 ====aaa====
17138 ==b==
17139 ===ba===
17140 ===bb===
17141 ====bba====
17142 ===bc===
17143 ==c==
17144 ===ca===
17145 !! html/php
17146 ===ba===
17147 !! end
17148
17149 !! test
17150 Section extraction test (section 6)
17151 !! options
17152 section=6
17153 !! wikitext
17154 start
17155 ==a==
17156 ===aa===
17157 ====aaa====
17158 ==b==
17159 ===ba===
17160 ===bb===
17161 ====bba====
17162 ===bc===
17163 ==c==
17164 ===ca===
17165 !! html/php
17166 ===bb===
17167 ====bba====
17168 !! end
17169
17170 !! test
17171 Section extraction test (section 7)
17172 !! options
17173 section=7
17174 !! wikitext
17175 start
17176 ==a==
17177 ===aa===
17178 ====aaa====
17179 ==b==
17180 ===ba===
17181 ===bb===
17182 ====bba====
17183 ===bc===
17184 ==c==
17185 ===ca===
17186 !! html/php
17187 ====bba====
17188 !! end
17189
17190 !! test
17191 Section extraction test (section 8)
17192 !! options
17193 section=8
17194 !! wikitext
17195 start
17196 ==a==
17197 ===aa===
17198 ====aaa====
17199 ==b==
17200 ===ba===
17201 ===bb===
17202 ====bba====
17203 ===bc===
17204 ==c==
17205 ===ca===
17206 !! html/php
17207 ===bc===
17208 !! end
17209
17210 !! test
17211 Section extraction test (section 9)
17212 !! options
17213 section=9
17214 !! wikitext
17215 start
17216 ==a==
17217 ===aa===
17218 ====aaa====
17219 ==b==
17220 ===ba===
17221 ===bb===
17222 ====bba====
17223 ===bc===
17224 ==c==
17225 ===ca===
17226 !! html/php
17227 ==c==
17228 ===ca===
17229 !! end
17230
17231 !! test
17232 Section extraction test (section 10)
17233 !! options
17234 section=10
17235 !! wikitext
17236 start
17237 ==a==
17238 ===aa===
17239 ====aaa====
17240 ==b==
17241 ===ba===
17242 ===bb===
17243 ====bba====
17244 ===bc===
17245 ==c==
17246 ===ca===
17247 !! html/php
17248 ===ca===
17249 !! end
17250
17251 !! test
17252 Section extraction test (nonexistent section 11)
17253 !! options
17254 section=11
17255 !! wikitext
17256 start
17257 ==a==
17258 ===aa===
17259 ====aaa====
17260 ==b==
17261 ===ba===
17262 ===bb===
17263 ====bba====
17264 ===bc===
17265 ==c==
17266 ===ca===
17267 !! html/php
17268 !! end
17269
17270 !! test
17271 Section extraction test with bogus heading (section 1)
17272 !! options
17273 section=1
17274 !! wikitext
17275 ==a==
17276 ==bogus== not a legal section
17277 ==b==
17278 !! html/php
17279 ==a==
17280 ==bogus== not a legal section
17281 !! end
17282
17283 !! test
17284 Section extraction test with bogus heading (section 2)
17285 !! options
17286 section=2
17287 !! wikitext
17288 ==a==
17289 ==bogus== not a legal section
17290 ==b==
17291 !! html/php
17292 ==b==
17293 !! end
17294
17295 !! test
17296 Section extraction test with comment after heading (section 1)
17297 !! options
17298 section=1
17299 !! wikitext
17300 ==a==
17301 ==b== <!-- -->
17302 ==c==
17303 !! html/php
17304 ==a==
17305 !! end
17306
17307 !! test
17308 Section extraction test with comment after heading (section 2)
17309 !! options
17310 section=2
17311 !! wikitext
17312 ==a==
17313 ==b== <!-- -->
17314 ==c==
17315 !! html/php
17316 ==b== <!-- -->
17317 !! end
17318
17319 !! test
17320 Section extraction test with bogus <nowiki> heading (section 1)
17321 !! options
17322 section=1
17323 !! wikitext
17324 ==a==
17325 ==bogus== <nowiki>not a legal section</nowiki>
17326 ==b==
17327 !! html/php
17328 ==a==
17329 ==bogus== <nowiki>not a legal section</nowiki>
17330 !! end
17331
17332 !! test
17333 Section extraction test with bogus <nowiki> heading (section 2)
17334 !! options
17335 section=2
17336 !! wikitext
17337 ==a==
17338 ==bogus== <nowiki>not a legal section</nowiki>
17339 ==b==
17340 !! html/php
17341 ==b==
17342 !! end
17343
17344 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17345 # instead of respecting commented sections
17346 !! test
17347 Section extraction prefixed by comment (section 1)
17348 !! options
17349 section=1
17350 !! wikitext
17351 <!-- -->==sec1==
17352 ==sec2==
17353 !! html/php
17354 ==sec2==
17355 !!end
17356
17357 !! test
17358 Section extraction prefixed by comment (section 2)
17359 !! options
17360 section=2
17361 !! wikitext
17362 <!-- -->==sec1==
17363 ==sec2==
17364 !! html/php
17365
17366 !!end
17367
17368 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17369 # instead of respecting HTML-style headings
17370 !! test
17371 Section extraction, mixed wiki and html (section 1)
17372 !! options
17373 section=1
17374 !! wikitext
17375 <h2>unmarked</h2>
17376 unmarked
17377 ==1==
17378 one
17379 ==2==
17380 two
17381 !! html/php
17382 ==1==
17383 one
17384 !! end
17385
17386 !! test
17387 Section extraction, mixed wiki and html (section 2)
17388 !! options
17389 section=2
17390 !! wikitext
17391 <h2>unmarked</h2>
17392 unmarked
17393 ==1==
17394 one
17395 ==2==
17396 two
17397 !! html/php
17398 ==2==
17399 two
17400 !! end
17401
17402
17403 # Formerly testing for bug 3342
17404 !! test
17405 Section extraction, heading surrounded by <noinclude>
17406 !! options
17407 section=1
17408 !! wikitext
17409 <noinclude>==unmarked==</noinclude>
17410 ==marked==
17411 !! html/php
17412 ==marked==
17413 !!end
17414
17415 # Test behavior of bug 19910
17416 !! test
17417 Sectiion with all-equals
17418 !! options
17419 section=2
17420 !! wikitext
17421 ===
17422 The line above must have a trailing space
17423 === <!--
17424 --> <!-- -->
17425 But just in case it doesn't...
17426 !! html/php
17427 === <!--
17428 --> <!-- -->
17429 But just in case it doesn't...
17430 !! end
17431
17432 !! test
17433 Section replacement test (section 0)
17434 !! options
17435 replace=0,"xxx"
17436 !! wikitext
17437 start
17438 ==a==
17439 ===aa===
17440 ====aaa====
17441 ==b==
17442 ===ba===
17443 ===bb===
17444 ====bba====
17445 ===bc===
17446 ==c==
17447 ===ca===
17448 !! html/php
17449 xxx
17450
17451 ==a==
17452 ===aa===
17453 ====aaa====
17454 ==b==
17455 ===ba===
17456 ===bb===
17457 ====bba====
17458 ===bc===
17459 ==c==
17460 ===ca===
17461 !! end
17462
17463 !! test
17464 Section replacement test (section 1)
17465 !! options
17466 replace=1,"xxx"
17467 !! wikitext
17468 start
17469 ==a==
17470 ===aa===
17471 ====aaa====
17472 ==b==
17473 ===ba===
17474 ===bb===
17475 ====bba====
17476 ===bc===
17477 ==c==
17478 ===ca===
17479 !! html/php
17480 start
17481 xxx
17482
17483 ==b==
17484 ===ba===
17485 ===bb===
17486 ====bba====
17487 ===bc===
17488 ==c==
17489 ===ca===
17490 !! end
17491
17492 !! test
17493 Section replacement test (section 2)
17494 !! options
17495 replace=2,"xxx"
17496 !! wikitext
17497 start
17498 ==a==
17499 ===aa===
17500 ====aaa====
17501 ==b==
17502 ===ba===
17503 ===bb===
17504 ====bba====
17505 ===bc===
17506 ==c==
17507 ===ca===
17508 !! html/php
17509 start
17510 ==a==
17511 xxx
17512
17513 ==b==
17514 ===ba===
17515 ===bb===
17516 ====bba====
17517 ===bc===
17518 ==c==
17519 ===ca===
17520 !! end
17521
17522 !! test
17523 Section replacement test (section 3)
17524 !! options
17525 replace=3,"xxx"
17526 !! wikitext
17527 start
17528 ==a==
17529 ===aa===
17530 ====aaa====
17531 ==b==
17532 ===ba===
17533 ===bb===
17534 ====bba====
17535 ===bc===
17536 ==c==
17537 ===ca===
17538 !! html/php
17539 start
17540 ==a==
17541 ===aa===
17542 xxx
17543
17544 ==b==
17545 ===ba===
17546 ===bb===
17547 ====bba====
17548 ===bc===
17549 ==c==
17550 ===ca===
17551 !! end
17552
17553 !! test
17554 Section replacement test (section 4)
17555 !! options
17556 replace=4,"xxx"
17557 !! wikitext
17558 start
17559 ==a==
17560 ===aa===
17561 ====aaa====
17562 ==b==
17563 ===ba===
17564 ===bb===
17565 ====bba====
17566 ===bc===
17567 ==c==
17568 ===ca===
17569 !! html/php
17570 start
17571 ==a==
17572 ===aa===
17573 ====aaa====
17574 xxx
17575
17576 ==c==
17577 ===ca===
17578 !! end
17579
17580 !! test
17581 Section replacement test (section 5)
17582 !! options
17583 replace=5,"xxx"
17584 !! wikitext
17585 start
17586 ==a==
17587 ===aa===
17588 ====aaa====
17589 ==b==
17590 ===ba===
17591 ===bb===
17592 ====bba====
17593 ===bc===
17594 ==c==
17595 ===ca===
17596 !! html/php
17597 start
17598 ==a==
17599 ===aa===
17600 ====aaa====
17601 ==b==
17602 xxx
17603
17604 ===bb===
17605 ====bba====
17606 ===bc===
17607 ==c==
17608 ===ca===
17609 !! end
17610
17611 !! test
17612 Section replacement test (section 6)
17613 !! options
17614 replace=6,"xxx"
17615 !! wikitext
17616 start
17617 ==a==
17618 ===aa===
17619 ====aaa====
17620 ==b==
17621 ===ba===
17622 ===bb===
17623 ====bba====
17624 ===bc===
17625 ==c==
17626 ===ca===
17627 !! html/php
17628 start
17629 ==a==
17630 ===aa===
17631 ====aaa====
17632 ==b==
17633 ===ba===
17634 xxx
17635
17636 ===bc===
17637 ==c==
17638 ===ca===
17639 !! end
17640
17641 !! test
17642 Section replacement test (section 7)
17643 !! options
17644 replace=7,"xxx"
17645 !! wikitext
17646 start
17647 ==a==
17648 ===aa===
17649 ====aaa====
17650 ==b==
17651 ===ba===
17652 ===bb===
17653 ====bba====
17654 ===bc===
17655 ==c==
17656 ===ca===
17657 !! html/php
17658 start
17659 ==a==
17660 ===aa===
17661 ====aaa====
17662 ==b==
17663 ===ba===
17664 ===bb===
17665 xxx
17666
17667 ===bc===
17668 ==c==
17669 ===ca===
17670 !! end
17671
17672 !! test
17673 Section replacement test (section 8)
17674 !! options
17675 replace=8,"xxx"
17676 !! wikitext
17677 start
17678 ==a==
17679 ===aa===
17680 ====aaa====
17681 ==b==
17682 ===ba===
17683 ===bb===
17684 ====bba====
17685 ===bc===
17686 ==c==
17687 ===ca===
17688 !! html/php
17689 start
17690 ==a==
17691 ===aa===
17692 ====aaa====
17693 ==b==
17694 ===ba===
17695 ===bb===
17696 ====bba====
17697 xxx
17698
17699 ==c==
17700 ===ca===
17701 !!end
17702
17703 !! test
17704 Section replacement test (section 9)
17705 !! options
17706 replace=9,"xxx"
17707 !! wikitext
17708 start
17709 ==a==
17710 ===aa===
17711 ====aaa====
17712 ==b==
17713 ===ba===
17714 ===bb===
17715 ====bba====
17716 ===bc===
17717 ==c==
17718 ===ca===
17719 !! html/php
17720 start
17721 ==a==
17722 ===aa===
17723 ====aaa====
17724 ==b==
17725 ===ba===
17726 ===bb===
17727 ====bba====
17728 ===bc===
17729 xxx
17730 !! end
17731
17732 !! test
17733 Section replacement test (section 10)
17734 !! options
17735 replace=10,"xxx"
17736 !! wikitext
17737 start
17738 ==a==
17739 ===aa===
17740 ====aaa====
17741 ==b==
17742 ===ba===
17743 ===bb===
17744 ====bba====
17745 ===bc===
17746 ==c==
17747 ===ca===
17748 !! html/php
17749 start
17750 ==a==
17751 ===aa===
17752 ====aaa====
17753 ==b==
17754 ===ba===
17755 ===bb===
17756 ====bba====
17757 ===bc===
17758 ==c==
17759 xxx
17760 !! end
17761
17762 !! test
17763 Section replacement test with initial whitespace (bug 13728)
17764 !! options
17765 replace=2,"xxx"
17766 !! wikitext
17767 Preformatted initial line
17768 ==a==
17769 ===a===
17770 !! html/php
17771 Preformatted initial line
17772 ==a==
17773 xxx
17774 !! end
17775
17776
17777 !! test
17778 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17779 !! options
17780 section=1
17781 !! wikitext
17782 ==a==
17783 a
17784 !! html/php
17785 ==a==
17786 a
17787 !! end
17788
17789 !! test
17790 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17791 !! options
17792 section=1
17793 !! wikitext
17794 ==a==
17795 a
17796 !! html/php
17797 ==a==
17798 a
17799 !! end
17800
17801
17802 !! test
17803 Section extraction, <pre> around bogus header (bug 10309)
17804 !! options
17805 noxml section=2
17806 !! wikitext
17807 == Section One ==
17808 <pre>
17809 =======
17810 </pre>
17811
17812 == Section Two ==
17813 stuff
17814 !! html/php
17815 == Section Two ==
17816 stuff
17817 !! end
17818
17819 !! test
17820 Section replacement, <pre> around bogus header (bug 10309)
17821 !! options
17822 noxml replace=2,"xxx"
17823 !! wikitext
17824 == Section One ==
17825 <pre>
17826 =======
17827 </pre>
17828
17829 == Section Two ==
17830 stuff
17831 !! html/php
17832 == Section One ==
17833 <pre>
17834 =======
17835 </pre>
17836
17837 xxx
17838 !! end
17839
17840
17841 !! test
17842 Handling of &#x0A; in URLs
17843 !! wikitext
17844 ** irc://&#x0A;a
17845 !! html/php
17846 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17847
17848 !! html/parsoid
17849 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17850 a">irc://
17851 a</a></li></ul></li></ul>
17852 !! end
17853
17854 !! test
17855 Handling of %0A in URLs
17856 !! wikitext
17857 ** irc://%0Aa
17858 !! html/php
17859 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17860
17861 !! html/parsoid
17862 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17863 !! end
17864
17865
17866 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17867 !! test
17868 5 quotes, code coverage +1 line
17869 !! options
17870 parsoid=wt2html
17871 !! wikitext
17872 '''''
17873 !! html/php
17874 !! html/parsoid
17875 <p><b><i></i></b></p>
17876 !! end
17877
17878 # same html as previous, but wikitext adjusted to match parsoid html2wt
17879 # note that wt2html and html2html will put the <i> before the <b>
17880 !! test
17881 5 quotes, code coverage +1 line w/ nowiki (1)
17882 !! options
17883 parsoid=wt2wt,html2wt
17884 !! wikitext
17885 '''''<nowiki/>'''''
17886 !! html/php
17887 <p><i></i>
17888 </p>
17889 !! html/parsoid
17890 <p><b><i></i></b></p>
17891 !! end
17892
17893 # same as previous, just swapping the <i> and <b>
17894 !! test
17895 5 quotes, code coverage +1 line w/ nowiki (2)
17896 !! wikitext
17897 '''''<nowiki/>'''''
17898 !! html/php
17899 <p><i></i>
17900 </p>
17901 !! html/parsoid
17902 <p><i><b></b></i></p>
17903 !! end
17904
17905 !! test
17906 Special:Search page linking.
17907 !! wikitext
17908 {{Special:search}}
17909 !! html
17910 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17911 </p>
17912 !! end
17913
17914 !! test
17915 {{!}} is a magic word
17916 !! wikitext
17917 {{!}} is a magic word there and {{!}} is still a magic word here
17918 !! html/php
17919 <p>| is a magic word there and | is still a magic word here
17920 </p>
17921 !! html/parsoid
17922 <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>
17923 !! end
17924
17925 !! test
17926 Say the magic word
17927 !! options
17928 title=[[Parser test]]
17929 !! wikitext
17930 * {{PAGENAME}}
17931 * {{PAGENAMEE}}
17932 * {{FULLPAGENAME}}
17933 * {{FULLPAGENAMEE}}
17934 * {{BASEPAGENAME}}
17935 * {{BASEPAGENAMEE}}
17936 * {{SUBPAGENAME}}
17937 * {{SUBPAGENAMEE}}
17938 * {{ROOTPAGENAME}}
17939 * {{ROOTPAGENAMEE}}
17940 * {{TALKPAGENAME}}
17941 * {{TALKPAGENAMEE}}
17942 * {{SUBJECTPAGENAME}}
17943 * {{SUBJECTPAGENAMEE}}
17944 * {{NAMESPACEE}}
17945 * {{NAMESPACE}}
17946 * {{NAMESPACENUMBER}}
17947 * {{TALKSPACE}}
17948 * {{TALKSPACEE}}
17949 * {{SUBJECTSPACE}}
17950 * {{SUBJECTSPACEE}}
17951 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17952 !! html
17953 <ul><li> Parser test</li>
17954 <li> Parser_test</li>
17955 <li> Parser test</li>
17956 <li> Parser_test</li>
17957 <li> Parser test</li>
17958 <li> Parser_test</li>
17959 <li> Parser test</li>
17960 <li> Parser_test</li>
17961 <li> Parser test</li>
17962 <li> Parser_test</li>
17963 <li> Talk:Parser test</li>
17964 <li> Talk:Parser_test</li>
17965 <li> Parser test</li>
17966 <li> Parser_test</li>
17967 <li> </li>
17968 <li> </li>
17969 <li> 0</li>
17970 <li> Talk</li>
17971 <li> Talk</li>
17972 <li> </li>
17973 <li> </li>
17974 <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>
17975
17976 !! end
17977 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17978
17979 !! test
17980 Gallery
17981 !! wikitext
17982 <gallery>
17983 image1.png |
17984 image2.gif|||||
17985
17986 image3|
17987 image4 |300px| centre
17988 image5.svg| http://///////
17989 [[x|xx]]]]
17990 * image6
17991 </gallery>
17992 !! html
17993 <ul class="gallery mw-gallery-traditional">
17994 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17995 <div class="thumb" style="height: 150px;">Image1.png</div>
17996 <div class="gallerytext">
17997 </div>
17998 </div></li>
17999 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18000 <div class="thumb" style="height: 150px;">Image2.gif</div>
18001 <div class="gallerytext">
18002 <p>||||
18003 </p>
18004 </div>
18005 </div></li>
18006 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18007 <div class="thumb" style="height: 150px;">Image3</div>
18008 <div class="gallerytext">
18009 </div>
18010 </div></li>
18011 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18012 <div class="thumb" style="height: 150px;">Image4</div>
18013 <div class="gallerytext">
18014 <p>300px| centre
18015 </p>
18016 </div>
18017 </div></li>
18018 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18019 <div class="thumb" style="height: 150px;">Image5.svg</div>
18020 <div class="gallerytext">
18021 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18022 </p>
18023 </div>
18024 </div></li>
18025 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18026 <div class="thumb" style="height: 150px;">* image6</div>
18027 <div class="gallerytext">
18028 </div>
18029 </div></li>
18030 </ul>
18031
18032 !! end
18033
18034 !! test
18035 Gallery (with options)
18036 !! wikitext
18037 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18038 File:Nonexistent.jpg|caption
18039 File:Nonexistent.jpg
18040 image:foobar.jpg|some '''caption''' [[Main Page]]
18041 image:foobar.jpg
18042 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18043 </gallery>
18044 !! html
18045 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18046 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18047 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18048 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18049 <div class="gallerytext">
18050 <p>caption
18051 </p>
18052 </div>
18053 </div></li>
18054 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18055 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18056 <div class="gallerytext">
18057 </div>
18058 </div></li>
18059 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18060 <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>
18061 <div class="gallerytext">
18062 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18063 </p>
18064 </div>
18065 </div></li>
18066 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18067 <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>
18068 <div class="gallerytext">
18069 </div>
18070 </div></li>
18071 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18072 <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>
18073 <div class="gallerytext">
18074 <p>Blabla|blabla.
18075 </p>
18076 </div>
18077 </div></li>
18078 </ul>
18079
18080 !! end
18081
18082 !! test
18083 Gallery with link that has fragment
18084 !! wikitext
18085 <gallery>
18086 image:foobar.jpg|link=Main_Page
18087 image:foobar.jpg|link=Main_Page#section
18088 image:foobar.jpg|link=Main Page#section|caption
18089 </gallery>
18090 !! html
18091 <ul class="gallery mw-gallery-traditional">
18092 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18093 <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>
18094 <div class="gallerytext">
18095 </div>
18096 </div></li>
18097 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18098 <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>
18099 <div class="gallerytext">
18100 </div>
18101 </div></li>
18102 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18103 <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>
18104 <div class="gallerytext">
18105 <p>caption
18106 </p>
18107 </div>
18108 </div></li>
18109 </ul>
18110
18111 !! end
18112
18113 !! test
18114 Gallery with wikitext inside caption
18115 !! wikitext
18116 <gallery>
18117 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18118 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18119 </gallery>
18120 !! html
18121 <ul class="gallery mw-gallery-traditional">
18122 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18123 <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>
18124 <div class="gallerytext">
18125 <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>
18126 </p>
18127 </div>
18128 </div></li>
18129 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18130 <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>
18131 <div class="gallerytext">
18132 <p>This is a test template
18133 </p>
18134 </div>
18135 </div></li>
18136 </ul>
18137
18138 !! end
18139
18140 !! test
18141 gallery (with showfilename option)
18142 !! wikitext
18143 <gallery showfilename>
18144 File:Nonexistent.jpg|caption
18145 File:Nonexistent.jpg
18146 image:foobar.jpg|some '''caption''' [[Main Page]]
18147 File:Foobar.jpg
18148 </gallery>
18149 !! html
18150 <ul class="gallery mw-gallery-traditional">
18151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18152 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18153 <div class="gallerytext">
18154 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18155 caption
18156 </p>
18157 </div>
18158 </div></li>
18159 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18160 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18161 <div class="gallerytext">
18162 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18163 </p>
18164 </div>
18165 </div></li>
18166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18167 <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>
18168 <div class="gallerytext">
18169 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18170 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18171 </p>
18172 </div>
18173 </div></li>
18174 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18175 <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>
18176 <div class="gallerytext">
18177 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18178 </p>
18179 </div>
18180 </div></li>
18181 </ul>
18182
18183 !! end
18184
18185 !! test
18186 Gallery (with namespace-less filenames)
18187 !! wikitext
18188 <gallery>
18189 File:Nonexistent.jpg
18190 Nonexistent.jpg
18191 image:foobar.jpg
18192 foobar.jpg
18193 </gallery>
18194 !! html
18195 <ul class="gallery mw-gallery-traditional">
18196 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18197 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18198 <div class="gallerytext">
18199 </div>
18200 </div></li>
18201 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18202 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18203 <div class="gallerytext">
18204 </div>
18205 </div></li>
18206 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18207 <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>
18208 <div class="gallerytext">
18209 </div>
18210 </div></li>
18211 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18212 <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>
18213 <div class="gallerytext">
18214 </div>
18215 </div></li>
18216 </ul>
18217
18218 !! end
18219
18220 !! test
18221 HTML Hex character encoding (spells the word "JavaScript")
18222 !! options
18223 parsoid=wt2html,wt2wt,html2html
18224 !! wikitext
18225 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18226 !! html/php
18227 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18228 </p>
18229 !! html/php+tidy
18230 <p>JavaScript</p>
18231 !! html/parsoid
18232 <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>
18233 !! end
18234
18235 !! test
18236 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18237 !! wikitext
18238 &#xsee;&#XSEE;
18239 !! html/php
18240 <p>&amp;#xsee;&amp;#XSEE;
18241 </p>
18242 !! html/parsoid
18243 <p>&amp;#xsee;&amp;#XSEE;</p>
18244 !! end
18245
18246 !! test
18247 HTML Hex character encoding mixed case
18248 !! options
18249 parsoid=wt2html,wt2wt,html2html
18250 !! wikitext
18251 &#xEE;&#Xee;
18252 !! html/php
18253 <p>&#xee;&#xee;
18254 </p>
18255 !! html/php+tidy
18256 <p>îî</p>
18257 !! html/parsoid
18258 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18259 !! end
18260
18261 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18262 # Note that U+000C (form feed) is not a valid XML character, so
18263 # it is banned even though allowed in HTML5.
18264 !! test
18265 Illegal character references (T106578)
18266 !! wikitext
18267 ; Null: &#00;
18268 ; FF: &#xC;
18269 ; CR: &#xD;
18270 ; Control (low): &#8;
18271 ; Control (high): &#x7F; &#x9F;
18272 ; Surrogate: &#xD83D;&#xDCA9;
18273 ; This is an okay astral character: &#x1F4A9;
18274 !! html+tidy
18275 <dl>
18276 <dt>Null</dt>
18277 <dd>&amp;#00;</dd>
18278 <dt>FF</dt>
18279 <dd>&amp;#xC;</dd>
18280 <dt>CR</dt>
18281 <dd>&amp;#xD;</dd>
18282 <dt>Control (low)</dt>
18283 <dd>&amp;#8;</dd>
18284 <dt>Control (high)</dt>
18285 <dd>&amp;#x7F; &amp;#x9F;</dd>
18286 <dt>Surrogate</dt>
18287 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18288 <dt>This is an okay astral character</dt>
18289 <dd>💩</dd>
18290 </dl>
18291 !! end
18292
18293 !! test
18294 __FORCETOC__ override
18295 !! wikitext
18296 __NEWSECTIONLINK__
18297 __FORCETOC__
18298 !! html/php
18299 <p><br />
18300 </p>
18301 !! end
18302
18303 !! test
18304 ISBN code coverage
18305 !! wikitext
18306 ISBN 978-0-1234-56&#x20;789
18307 !! html
18308 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18309 </p>
18310 !! html+tidy
18311 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18312 !! html/parsoid
18313 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18314 !! end
18315
18316 !! test
18317 ISBN followed by 5 spaces
18318 !! wikitext
18319 ISBN
18320 !! html
18321 <p>ISBN
18322 </p>
18323 !! end
18324
18325 !! test
18326 Double ISBN
18327 !! wikitext
18328 ISBN ISBN 1234567890
18329 !! html/php
18330 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18331 </p>
18332 !! html/parsoid
18333 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18334 !! end
18335
18336 # Uppercase X and lowercase x as well
18337 !! test
18338 ISBN with an X
18339 !! wikitext
18340 ISBN 3-462-04561-X
18341 ISBN 3-462-04561-x
18342 ISBN 080442957X
18343 ISBN 080442957x
18344 ISBN 978080442957X
18345 ISBN 978080442957x
18346 !! html/php
18347 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18348 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18349 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18350 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18351 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18352 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18353 </p>
18354 !! html/parsoid
18355 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18356 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18357 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18358 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18359 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18360 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18361 !! end
18362
18363 !! test
18364 ISBN with empty prefix (parsoid test)
18365 !! wikitext
18366 ISBN 1234567890
18367 !! html/php
18368 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18369 </p>
18370 !! html/parsoid
18371 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18372 !! end
18373
18374 !! test
18375 Bug 22905: <abbr> followed by ISBN followed by </a>
18376 !! wikitext
18377 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18378 !! html/php
18379 <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>
18380 </p>
18381 !! html/parsoid
18382 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18383 !! end
18384
18385 !! test
18386 Double RFC
18387 !! wikitext
18388 RFC RFC 1234
18389 !! html
18390 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18391 </p>
18392 !! end
18393
18394 !! test
18395 Double RFC with a wiki link
18396 !! wikitext
18397 RFC [[RFC 1234]]
18398 !! html
18399 <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>
18400 </p>
18401 !! end
18402
18403 !! test
18404 RFC code coverage
18405 !! wikitext
18406 RFC 983&#x20;987
18407 !! html
18408 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18409 </p>
18410 !! html+tidy
18411 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18412 !! end
18413
18414 !! test
18415 Centre-aligned image
18416 !! wikitext
18417 [[Image:foobar.jpg|centre]]
18418 !! html
18419 <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>
18420
18421 !!end
18422
18423 !! test
18424 None-aligned image
18425 !! wikitext
18426 [[Image:foobar.jpg|none]]
18427 !! html
18428 <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>
18429
18430 !!end
18431
18432 !! test
18433 Width + Height sized image (using px) (height is ignored)
18434 !! wikitext
18435 [[Image:foobar.jpg|640x480px]]
18436 !! html
18437 <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>
18438 </p>
18439 !!end
18440
18441 !! test
18442 Width-sized image (using px, no following whitespace)
18443 !! wikitext
18444 [[Image:foobar.jpg|640px]]
18445 !! html
18446 <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>
18447 </p>
18448 !!end
18449
18450 !! test
18451 Width-sized image (using px, with following whitespace - test regression from r39467)
18452 !! wikitext
18453 [[Image:foobar.jpg|640px ]]
18454 !! html
18455 <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>
18456 </p>
18457 !!end
18458
18459 !! test
18460 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18461 !! wikitext
18462 [[Image:foobar.jpg| 640px]]
18463 !! html
18464 <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>
18465 </p>
18466 !!end
18467
18468 !! test
18469 Image with page parameter
18470 !! options
18471 djvu
18472 !! wikitext
18473 [[File:LoremIpsum.djvu|page=2]]
18474 !! html/php
18475 <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>
18476 </p>
18477 !! html/parsoid
18478 <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>
18479 !! end
18480
18481 !! test
18482 Another italics / bold test
18483 !! wikitext
18484 ''' ''x'
18485 !! html
18486 <pre>'<i> </i>x'
18487 </pre>
18488 !!end
18489
18490 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18491 !! test
18492 dt/dd/dl test
18493 !! wikitext
18494 :;;;::
18495 !! html/php
18496 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18497
18498 !! html/parsoid
18499 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18500
18501 !!end
18502
18503
18504 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18505 !! test
18506 Images with the "|" character in the comment
18507 !! wikitext
18508 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18509 !! html/php
18510 <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>
18511
18512 !! html/parsoid
18513 <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>
18514 !! end
18515
18516 !! test
18517 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18518 !! wikitext
18519 <html><script>alert(1);</script></html>
18520 !! html
18521 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18522 </p>
18523 !! end
18524
18525 !! test
18526 HTML with raw HTML ($wgRawHtml==true)
18527 !! options
18528 wgRawHtml=1
18529 !! wikitext
18530 <html><script>alert(1);</script></html>
18531 !! html
18532 <p><script>alert(1);</script>
18533 </p>
18534 !! end
18535
18536 !! test
18537 Parents of subpages, one level up
18538 !! options
18539 subpage title=[[Subpage test/L1/L2/L3]]
18540 !! wikitext
18541 [[../|L2]]
18542 !! html
18543 <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>
18544 </p>
18545 !! end
18546
18547
18548 !! test
18549 Parents of subpages, one level up, not named
18550 !! options
18551 subpage title=[[Subpage test/L1/L2/L3]]
18552 !! wikitext
18553 [[../]]
18554 !! html
18555 <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>
18556 </p>
18557 !! end
18558
18559
18560
18561 !! test
18562 Parents of subpages, two levels up
18563 !! options
18564 subpage title=[[Subpage test/L1/L2/L3]]
18565 !! wikitext
18566 [[../../|L1]]2
18567
18568 [[../../|L1]]l
18569 !! html
18570 <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
18571 </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>
18572 </p>
18573 !! end
18574
18575 !! test
18576 Parents of subpages, two levels up, without trailing slash or name.
18577 !! options
18578 subpage title=[[Subpage test/L1/L2/L3]]
18579 !! wikitext
18580 [[../..]]
18581 !! html
18582 <p>[[../..]]
18583 </p>
18584 !! end
18585
18586 !! test
18587 Parents of subpages, two levels up, with lots of extra trailing slashes.
18588 !! options
18589 subpage title=[[Subpage test/L1/L2/L3]]
18590 !! wikitext
18591 [[../../////]]
18592 !! html
18593 <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>
18594 </p>
18595 !! end
18596
18597 !! article
18598 Subpage test/L1/L2/L3Sibling
18599 !! text
18600 Sibling article
18601 !! endarticle
18602
18603 !! test
18604 Transclusion of a sibling page (one level up)
18605 !! options
18606 subpage title=[[Subpage test/L1/L2/L3]]
18607 !! wikitext
18608 {{../L3Sibling}}
18609 !! html
18610 <p>Sibling article
18611 </p>
18612 !! end
18613
18614 !! test
18615 Transclusion of a child page
18616 !! options
18617 subpage title=[[Subpage test/L1/L2]]
18618 !! wikitext
18619 {{/L3Sibling}}
18620 !! html
18621 <p>Sibling article
18622 </p>
18623 !! end
18624
18625 !! test
18626 Non-transclusion because of too many up levels
18627 !! options
18628 subpage title=[[Subpage test/L1/L2/L3]]
18629 !! wikitext
18630 {{../../../../More than parent}}
18631 !! html
18632 <p>{{../../../../More than parent}}
18633 </p>
18634 !! end
18635
18636 !! test
18637 Definition list code coverage
18638 !! wikitext
18639 ; title : def
18640 ; title : def
18641 ;title: def
18642 !! html/php
18643 <dl><dt> title &#160;</dt>
18644 <dd> def</dd>
18645 <dt> title&#160;</dt>
18646 <dd> def</dd>
18647 <dt>title</dt>
18648 <dd> def</dd></dl>
18649
18650 !! html/parsoid
18651 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18652 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18653 <dt>title</dt><dd> def</dd></dl>
18654 !! end
18655
18656 !! test
18657 Don't fall for the self-closing div
18658 !! wikitext
18659 <div>hello world</div/>
18660 !! html
18661 <div>hello world</div>
18662
18663 !! end
18664
18665 !! test
18666 MSGNW magic word
18667 !! wikitext
18668 {{MSGNW:msg}}
18669 !! html/php
18670 <p>&#91;&#91;:Template:Msg&#93;&#93;
18671 </p>
18672 !! end
18673
18674 !! test
18675 RAW magic word
18676 !! wikitext
18677 {{RAW:QUERTY}}
18678 !! html
18679 <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>
18680 </p>
18681 !! end
18682
18683 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18684 !! test
18685 Always escape literal '>' in output, not just after '<'
18686 !! wikitext
18687 ><>
18688 !! html
18689 <p>&gt;&lt;&gt;
18690 </p>
18691 !! end
18692
18693 !! test
18694 Template caching
18695 !! wikitext
18696 {{Test}}
18697 {{Test}}
18698 !! html
18699 <p>This is a test template
18700 This is a test template
18701 </p>
18702 !! end
18703
18704
18705 !! article
18706 MediaWiki:Fake
18707 !! text
18708 ==header==
18709 !! endarticle
18710
18711 !! test
18712 Inclusion of !userCanEdit() content
18713 !! wikitext
18714 {{MediaWiki:Fake}}
18715 !! html
18716 <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>
18717
18718 !! end
18719
18720
18721 !! test
18722 Out-of-order TOC heading levels
18723 !! wikitext
18724 ==2==
18725 ======6======
18726 ===3===
18727 =1=
18728 =====5=====
18729 ==2==
18730 !! html
18731 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18732 <ul>
18733 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18734 <ul>
18735 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18736 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18737 </ul>
18738 </li>
18739 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18740 <ul>
18741 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18742 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18743 </ul>
18744 </li>
18745 </ul>
18746 </div>
18747
18748 <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>
18749 <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>
18750 <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>
18751 <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>
18752 <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>
18753 <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>
18754
18755 !! end
18756
18757
18758 !! test
18759 ISBN with a dummy number
18760 !! wikitext
18761 ISBN ---
18762 !! html
18763 <p>ISBN ---
18764 </p>
18765 !! end
18766
18767
18768 !! test
18769 ISBN with space-delimited number
18770 !! wikitext
18771 ISBN 92 9017 032 8
18772 !! html
18773 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18774 </p>
18775 !! end
18776
18777
18778 !! test
18779 ISBN with multiple spaces, no number
18780 !! wikitext
18781 ISBN foo
18782 !! html
18783 <p>ISBN foo
18784 </p>
18785 !! end
18786
18787
18788 !! test
18789 ISBN length
18790 !! wikitext
18791 ISBN 123456789
18792
18793 ISBN 1234567890
18794
18795 ISBN 12345678901
18796 !! html
18797 <p>ISBN 123456789
18798 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18799 </p><p>ISBN 12345678901
18800 </p>
18801 !! end
18802
18803
18804 !! test
18805 ISBN with trailing year (bug 8110)
18806 !! wikitext
18807 ISBN 1-234-56789-0 - 2006
18808
18809 ISBN 1 234 56789 0 - 2006
18810 !! html
18811 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18812 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18813 </p>
18814 !! end
18815
18816
18817 !! test
18818 anchorencode
18819 !! wikitext
18820 {{anchorencode:foo bar©#%n}}
18821 !! html
18822 <p>foo_bar.C2.A9.23.25n
18823 </p>
18824 !! end
18825
18826 !! test
18827 anchorencode trims spaces
18828 !! wikitext
18829 {{anchorencode: __pretty__please__}}
18830 !! html
18831 <p>pretty_please
18832 </p>
18833 !! end
18834
18835 !! test
18836 anchorencode deals with links
18837 !! wikitext
18838 {{anchorencode: [[hello|world]] [[hi]]}}
18839 !! html
18840 <p>world_hi
18841 </p>
18842 !! end
18843
18844 !! test
18845 anchorencode deals with templates
18846 !! wikitext
18847 {{anchorencode: {{Foo}} }}
18848 !! html
18849 <p>FOO
18850 </p>
18851 !! end
18852
18853 !! test
18854 anchorencode encodes like the TOC generator: (bug 18431)
18855 !! wikitext
18856 === _ +:.3A%3A&&amp;]] ===
18857 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18858 __NOEDITSECTION__
18859 !! html
18860 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18861 <p>.2B:.3A.253A.26.26.5D.5D
18862 </p>
18863 !! end
18864
18865 !! test
18866 Bug 6200: blockquotes and paragraph formatting
18867 !! wikitext
18868 <blockquote>
18869 foo
18870 </blockquote>
18871
18872 bar
18873
18874 baz
18875 !! html
18876 <blockquote>
18877 <p>foo
18878 </p>
18879 </blockquote>
18880 <p>bar
18881 </p>
18882 <pre>baz
18883 </pre>
18884 !! end
18885
18886 !! test
18887 Bug 8293: Use of center tag ruins paragraph formatting
18888 !! wikitext
18889 <center>
18890 foo
18891 </center>
18892
18893 bar
18894
18895 baz
18896 !! html
18897 <center>
18898 <p>foo
18899 </p>
18900 </center>
18901 <p>bar
18902 </p>
18903 <pre>baz
18904 </pre>
18905 !! end
18906
18907 !!test
18908 Parsing of overlapping (improperly nested) inline html tags
18909 !! wikitext
18910 <span><s>x</span></s>
18911 !! html/php
18912 <p><span><s>x&lt;/span&gt;</s></span>
18913 </p>
18914 !! html/parsoid
18915 <p><span><s>x</s></span>
18916 </p>
18917 !!end
18918
18919 ###
18920 ### Language variants related tests
18921 ###
18922 !! test
18923 Self-link in language variants
18924 !! options
18925 title=[[Dunav]] language=sr
18926 !! wikitext
18927 Both [[Dunav]] and [[Дунав]] are names for this river.
18928 !! html
18929 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18930 </p>
18931 !!end
18932
18933 !! article
18934 Дуна
18935 !! text
18936 content
18937 !! endarticle
18938
18939 !! test
18940 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18941 !! options
18942 title=[[Duna]] language=sr
18943 !! wikitext
18944 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18945 !! html
18946 <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.
18947 </p>
18948 !! end
18949
18950 !! test
18951 Link to a section of a variant of this title shouldn't be parsed as self-link
18952 !! options
18953 title=[[Duna]] language=sr
18954 !! wikitext
18955 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18956 !! html
18957 <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.
18958 </p>
18959 !! end
18960
18961 !! test
18962 Link to pages in language variants
18963 !! options
18964 language=sr
18965 !! wikitext
18966 Main Page can be written as [[Маин Паге]]
18967 !! html
18968 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18969 </p>
18970 !!end
18971
18972
18973 !! test
18974 Multiple links to pages in language variants
18975 !! options
18976 language=sr
18977 !! wikitext
18978 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18979 !! html
18980 <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>.
18981 </p>
18982 !!end
18983
18984
18985 !! test
18986 Simple template in language variants
18987 !! options
18988 language=sr
18989 !! wikitext
18990 {{тест}}
18991 !! html
18992 <p>This is a test template
18993 </p>
18994 !! end
18995
18996
18997 !! test
18998 Template with explicit namespace in language variants
18999 !! options
19000 language=sr
19001 !! wikitext
19002 {{Template:тест}}
19003 !! html
19004 <p>This is a test template
19005 </p>
19006 !! end
19007
19008
19009 !! test
19010 Basic test for template parameter in language variants
19011 !! options
19012 language=sr
19013 !! wikitext
19014 {{парамтест|param=foo}}
19015 !! html
19016 <p>This is a test template with parameter foo
19017 </p>
19018 !! end
19019
19020
19021 !! test
19022 Simple category in language variants
19023 !! options
19024 language=sr cat
19025 !! wikitext
19026 [[Category:МедиаWики Усер'с Гуиде]]
19027 !! html
19028 <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>
19029 !! end
19030
19031
19032 !! article
19033 Category:分类
19034 !! text
19035 blah
19036 !! endarticle
19037
19038 !! article
19039 Category:分類
19040 !! text
19041 blah
19042 !! endarticle
19043
19044 !! test
19045 Don't convert blue categorylinks to another variant (bug 33210)
19046 !! options
19047 language=zh cat
19048 !! wikitext
19049 [[A]][[Category:分类]]
19050 !! html
19051 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19052 !! end
19053
19054
19055 !! test
19056 Stripping -{}- tags (language variants)
19057 !! options
19058 language=sr
19059 !! wikitext
19060 Latin proverb: -{Ne nuntium necare}-
19061 !! html
19062 <p>Latin proverb: Ne nuntium necare
19063 </p>
19064 !! end
19065
19066
19067 !! test
19068 Prevent conversion with -{}- tags (language variants)
19069 !! options
19070 language=sr variant=sr-ec
19071 !! wikitext
19072 Latinski: -{Ne nuntium necare}-
19073 !! html
19074 <p>Латински: Ne nuntium necare
19075 </p>
19076 !! end
19077
19078
19079 !! test
19080 Prevent conversion of text with -{}- tags (language variants)
19081 !! options
19082 language=sr variant=sr-ec
19083 !! wikitext
19084 Latinski: -{Ne nuntium necare}-
19085 !! html
19086 <p>Латински: Ne nuntium necare
19087 </p>
19088 !! end
19089
19090
19091 !! test
19092 Prevent conversion of links with -{}- tags (language variants)
19093 !! options
19094 language=sr variant=sr-ec
19095 !! wikitext
19096 -{[[Main Page]]}-
19097 !! html
19098 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19099 </p>
19100 !! end
19101
19102
19103 !! test
19104 -{}- tags within headlines (within html for parserConvert())
19105 !! options
19106 language=sr variant=sr-ec
19107 !! wikitext
19108 == -{Naslov}- ==
19109 !! html
19110 <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>
19111
19112 !! end
19113
19114
19115 !! test
19116 Explicit definition of language variant alternatives
19117 !! options
19118 language=zh variant=zh-tw
19119 !! wikitext
19120 -{zh:China;zh-tw:Taiwan}-, not China
19121 !! html
19122 <p>Taiwan, not China
19123 </p>
19124 !! end
19125
19126
19127 !! test
19128 Conversion around HTML tags
19129 !! options
19130 language=sr variant=sr-ec
19131 !! wikitext
19132 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19133 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19134 !! html
19135 <p>
19136 <span title="ЛаCтин">ски</span>
19137 </p>
19138 !! end
19139
19140
19141 !! test
19142 Explicit session-wise language variant mapping (A flag and - flag)
19143 !! options
19144 language=zh variant=zh-tw
19145 !! wikitext
19146 Taiwan is not China.
19147 But -{A|zh:China;zh-tw:Taiwan}- is China,
19148 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19149 and -{China}- is China.
19150 !! html
19151 <p>Taiwan is not China.
19152 But Taiwan is Taiwan,
19153 (This should be stripped!)
19154 and China is China.
19155 </p>
19156 !! end
19157
19158 !! test
19159 Explicit session-wise language variant mapping (H flag for hide)
19160 !! options
19161 language=zh variant=zh-tw
19162 !! wikitext
19163 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19164 Taiwan is China.
19165 !! html
19166 <p>(This should be stripped!)
19167 Taiwan is Taiwan.
19168 </p>
19169 !! end
19170
19171 !! test
19172 Adding explicit conversion rule for title (T flag)
19173 !! options
19174 language=zh variant=zh-tw showtitle
19175 !! wikitext
19176 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19177 !! html
19178 Taiwan
19179 <p>Should be stripped!
19180 </p>
19181 !! end
19182
19183 !! test
19184 Testing that changing the language variant here in the tests actually works
19185 !! options
19186 language=zh variant=zh showtitle
19187 !! wikitext
19188 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19189 !! html
19190 China
19191 <p>Should be stripped!
19192 </p>
19193 !! end
19194
19195 !! test
19196 Recursive conversion of alt and title attrs shouldn't clear converter state
19197 !! options
19198 language=zh variant=zh-cn showtitle
19199 !! wikitext
19200 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19201 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19202 !! html
19203 China
19204 <p>
19205 Should be stripped<span title="Exclamation">!</span>
19206 </p>
19207 !! end
19208
19209 !! test
19210 Bug 24072: more test on conversion rule for title
19211 !! options
19212 language=zh variant=zh-tw showtitle
19213 !! wikitext
19214 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19215 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19216 !! html
19217 Taiwan
19218 <p>This should be stripped!
19219 This won't take interferes with the title rule.
19220 </p>
19221 !! end
19222
19223 !! test
19224 Partly disable title conversion if variant == main language code
19225 !! options
19226 language=zh variant=zh title=[[ZH]] showtitle
19227 !! wikitext
19228 -{T|zh-cn:CN;zh-tw:TW}-
19229 !! html
19230 ZH
19231 <p>
19232 </p>
19233 !! end
19234
19235 !! test
19236 Partly disable title conversion if variant == main language code, more
19237 !! options
19238 language=zh variant=zh title=[[ZH]] showtitle
19239 !! wikitext
19240 -{T|TW}-
19241 !! html
19242 ZH
19243 <p>
19244 </p>
19245 !! end
19246
19247 !! test
19248 Raw output of variant escape tags (R flag)
19249 !! options
19250 language=zh variant=zh-tw
19251 !! wikitext
19252 Raw: -{R|zh:China;zh-tw:Taiwan}-
19253 !! html
19254 <p>Raw: zh:China;zh-tw:Taiwan
19255 </p>
19256 !! end
19257
19258 !! test
19259 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19260 !! options
19261 language=zh variant=zh-cn
19262 !! input
19263 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19264 !! result
19265 <p>0
19266 </p>
19267 !! end
19268
19269 !! test
19270 Conversion rules from [numeric-only string] to [something else] (T48634)
19271 !! options
19272 language=zh variant=zh-cn
19273 !! input
19274 -{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
19275 !! result
19276 <p>D12345EE12345
19277 </p>
19278 !! end
19279
19280 !! test
19281 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19282 !! options
19283 language=zh variant=zh-cn
19284 !! input
19285 -{H|zh-cn:foo;zh-tw:;}-foobar
19286 !! result
19287 <p>foobar
19288 </p>
19289 !! end
19290
19291 !! test
19292 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19293 !! options
19294 language=zh variant=zh-cn
19295 !! input
19296 -{H|=>zh-cn:foo;}-foobar
19297 !! result
19298 <p>foobar
19299 </p>
19300 !! end
19301
19302 !! test
19303 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19304 !! options
19305 language=zh variant=zh-cn
19306 !! input
19307 -{H|}-foobar
19308 !! result
19309 <p>foobar
19310 </p>
19311 !! end
19312
19313 !! test
19314 Nested using of manual convert syntax
19315 !! options
19316 language=zh variant=zh-hk
19317 !! wikitext
19318 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19319 !! html
19320 <p>Nested: Hello Hong Kong!
19321 </p>
19322 !! end
19323
19324 !! test
19325 Proper conversion of text in external links
19326 !! options
19327 language=sr variant=sr-ec
19328 !! wikitext
19329 http://www.google.com
19330 gopher://www.google.com
19331 [http://www.google.com http://www.google.com]
19332 [gopher://www.google.com gopher://www.google.com]
19333 [https://www.google.com irc://www.google.com]
19334 [ftp://www.google.com www.google.com/ftp://dir]
19335 [//www.google.com www.google.com]
19336 !! html
19337 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19338 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19339 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19340 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19341 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19342 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19343 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19344 </p>
19345 !! end
19346
19347 !! test
19348 Do not convert roman numbers to language variants
19349 !! options
19350 language=sr variant=sr-ec
19351 !! wikitext
19352 Fridrih IV je car.
19353 !! html
19354 <p>Фридрих IV је цар.
19355 </p>
19356 !! end
19357
19358 !! test
19359 Unclosed language converter markup "-{"
19360 !! options
19361 language=sr
19362 !! wikitext
19363 -{T|hello
19364 !! html
19365 <p>-{T|hello
19366 </p>
19367 !! end
19368
19369 !! test
19370 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19371 !! options
19372 language=sr
19373 !! wikitext
19374 -{R|=&gt;}-
19375 !! html
19376 <p>=&gt;
19377 </p>
19378 !!end
19379
19380 !! test
19381 Don't break link parsing if language converter markup is in the caption.
19382 !! options
19383 language=sr variant=sr-ec
19384 !! wikitext
19385 [[Main Page|-{R|main page}-]]
19386 !! html
19387 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19388 </p>
19389 !! end
19390
19391 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19392 !! test
19393 Don't break image parsing if language converter markup is in the caption.
19394 !! options
19395 language=sr
19396 !! wikitext
19397 [[File:Foobar.jpg|-{R|caption}-]]
19398 !! html/parsoid
19399 <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>
19400 </p>
19401 !! end
19402
19403 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19404 !! test
19405 Don't break list handling if language converter markup is in the item.
19406 !! options
19407 language=zh variant=zh-cn
19408 !! wikitext
19409 ;-{zh-cn:AAA;zh-tw:BBB}-
19410 !! html/php
19411 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19412
19413 !! html/parsoid
19414 <dl><dt>AAA
19415 </dt></dl>
19416 !! end
19417
19418 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19419 !! test
19420 Don't break table handling if language converter markup is in the cell.
19421 !! options
19422 language=sr variant=sr-ec
19423 !! wikitext
19424 {|
19425 |-
19426 | -{R|B}-
19427 |}
19428 !! html/php
19429 <table>
19430
19431 <tr>
19432 <td>Б}-
19433 </td></tr></table>
19434
19435 !! html/parsoid
19436 <table>
19437
19438 <tr>
19439 <td> B
19440 </td></tr></table>
19441
19442 !! end
19443
19444 !! test
19445 Bug 529: Uncovered bullet
19446 !! wikitext
19447 * Foo {{bullet}}
19448 !! html
19449 <ul><li> Foo </li>
19450 <li> Bar</li></ul>
19451
19452 !! end
19453
19454 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19455 # Templates in Wikipedia rely on this behavior, as tidy has always been
19456 # enabled there. These tests are normally run *without* tidy, so specify the
19457 # full output here.
19458 # To test realistic parsing behavior, apply a tidy-like transformation to both
19459 # the expected output and your parser's output.
19460 !! test
19461 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19462 !! wikitext
19463 ******* Foo {{bullet}}
19464 !! html
19465 <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>
19466 <li> Bar</li></ul>
19467
19468 !! end
19469
19470 !! test
19471 Bug 529: Uncovered table already at line-start
19472 !! wikitext
19473 x
19474
19475 {{table}}
19476 y
19477 !! html
19478 <p>x
19479 </p>
19480 <table>
19481 <tr>
19482 <td> 1 </td>
19483 <td> 2
19484 </td></tr>
19485 <tr>
19486 <td> 3 </td>
19487 <td> 4
19488 </td></tr></table>
19489 <p>y
19490 </p>
19491 !! end
19492
19493 !! test
19494 Bug 529: Uncovered bullet in parser function result
19495 !! wikitext
19496 * Foo {{lc:{{bullet}} }}
19497 !! html
19498 <ul><li> Foo </li>
19499 <li> bar</li></ul>
19500
19501 !! end
19502
19503 !! test
19504 Bug 5678: Double-parsed template argument
19505 !! wikitext
19506 {{lc:{{{1}}}|hello}}
19507 !! html
19508 <p>{{{1}}}
19509 </p>
19510 !! end
19511
19512 !! test
19513 Bug 5678: Double-parsed template invocation
19514 !! wikitext
19515 {{lc:{{paramtest {{!}} param = hello }} }}
19516 !! html
19517 <p>{{paramtest | param = hello }}
19518 </p>
19519 !! end
19520
19521 !! test
19522 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19523 !! options
19524 language=cs
19525 title=[[Main Page]]
19526 !! wikitext
19527 {{PRVNÍVELKÉ:ěščř}}
19528 {{prvnívelké:ěščř}}
19529 {{PRVNÍMALÉ:ěščř}}
19530 {{prvnímalé:ěščř}}
19531 {{MALÁ:ěščř}}
19532 {{malá:ěščř}}
19533 {{VELKÁ:ěščř}}
19534 {{velká:ěščř}}
19535 !! html
19536 <p>Ěščř
19537 Ěščř
19538 ěščř
19539 ěščř
19540 ěščř
19541 ěščř
19542 ĚŠČŘ
19543 ĚŠČŘ
19544 </p>
19545 !! end
19546
19547 !! test
19548 Morwen/13: Unclosed link followed by heading
19549 !! wikitext
19550 [[link
19551 ==heading==
19552 !! html
19553 <p>[[link
19554 </p>
19555 <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>
19556
19557 !! end
19558
19559 !! test
19560 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19561 !! wikitext
19562 {{foo|
19563 =heading=
19564 !! html
19565 <p>{{foo|
19566 </p>
19567 <h1><span class="mw-headline" id="heading">heading</span></h1>
19568
19569 !! end
19570
19571 !! test
19572 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19573 !! wikitext
19574 {{foo|
19575 ==heading==
19576 !! html
19577 <p>{{foo|
19578 </p>
19579 <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>
19580
19581 !! end
19582
19583 !! test
19584 Tildes in comments
19585 !! options
19586 pst
19587 !! wikitext
19588 <!-- ~~~~ -->
19589 !! html
19590 <!-- ~~~~ -->
19591 !! end
19592
19593 !! test
19594 Paragraphs inside divs (no extra line breaks)
19595 !! wikitext
19596 <div>Line one
19597
19598 Line two</div>
19599 !! html
19600 <div>Line one
19601 Line two</div>
19602
19603 !! end
19604
19605 !! test
19606 Paragraphs inside divs (extra line break on open)
19607 !! wikitext
19608 <div>
19609 Line one
19610
19611 Line two</div>
19612 !! html
19613 <div>
19614 <p>Line one
19615 </p>
19616 Line two</div>
19617
19618 !! end
19619
19620 !! test
19621 Paragraphs inside divs (extra line break on close)
19622 !! wikitext
19623 <div>Line one
19624
19625 Line two
19626 </div>
19627 !! html
19628 <div>Line one
19629 <p>Line two
19630 </p>
19631 </div>
19632
19633 !! end
19634
19635 !! test
19636 Paragraphs inside divs (extra line break on open and close)
19637 !! wikitext
19638 <div>
19639 Line one
19640
19641 Line two
19642 </div>
19643 !! html
19644 <div>
19645 <p>Line one
19646 </p><p>Line two
19647 </p>
19648 </div>
19649
19650 !! end
19651
19652 !! test
19653 Nesting tags, paragraphs on lines which begin with <div>
19654 !! wikitext
19655 <div></div><strong>A
19656 B</strong>
19657 !! html/php+tidy
19658 <p><strong>A</strong></p>
19659 <p><strong>B</strong></p>
19660 !! html/parsoid
19661 <div></div>
19662 <p><strong>A
19663 B</strong>
19664 </p>
19665 !! end
19666
19667 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19668 !! test
19669 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19670 !! wikitext
19671 <blockquote>Line one
19672
19673 Line two</blockquote>
19674 !! html
19675 <blockquote>Line one
19676 Line two</blockquote>
19677
19678 !! html+tidy
19679 <blockquote>
19680 <p>Line one Line two</p>
19681 </blockquote>
19682 !! end
19683
19684 !! test
19685 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19686 !! wikitext
19687 <blockquote>
19688 Line one
19689
19690 Line two</blockquote>
19691 !! html
19692 <blockquote>
19693 <p>Line one
19694 </p>
19695 Line two</blockquote>
19696
19697 !! html+tidy
19698 <blockquote>
19699 <p>Line one</p>
19700 Line two</blockquote>
19701 !! end
19702
19703 !! test
19704 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19705 !! wikitext
19706 <blockquote>Line one
19707
19708 Line two
19709 </blockquote>
19710 !! html
19711 <blockquote>Line one
19712 <p>Line two
19713 </p>
19714 </blockquote>
19715
19716 !! html+tidy
19717 <blockquote>
19718 <p>Line one</p>
19719 <p>Line two</p>
19720 </blockquote>
19721 !! end
19722
19723 !! test
19724 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19725 !! wikitext
19726 <blockquote>
19727 Line one
19728
19729 Line two
19730 </blockquote>
19731 !! html
19732 <blockquote>
19733 <p>Line one
19734 </p><p>Line two
19735 </p>
19736 </blockquote>
19737
19738 !! html+tidy
19739 <blockquote>
19740 <p>Line one</p>
19741 <p>Line two</p>
19742 </blockquote>
19743 !! end
19744
19745 !! test
19746 Paragraphs inside blockquotes/divs (no extra line breaks)
19747 !! wikitext
19748 <blockquote><div>Line one
19749
19750 Line two</div></blockquote>
19751 !! html
19752 <blockquote><div>Line one
19753 Line two</div></blockquote>
19754
19755 !! end
19756
19757 !! test
19758 Paragraphs inside blockquotes/divs (extra line break on open)
19759 !! wikitext
19760 <blockquote><div>
19761 Line one
19762
19763 Line two</div></blockquote>
19764 !! html
19765 <blockquote><div>
19766 <p>Line one
19767 </p>
19768 Line two</div></blockquote>
19769
19770 !! end
19771
19772 !! test
19773 Paragraphs inside blockquotes/divs (extra line break on close)
19774 !! wikitext
19775 <blockquote><div>Line one
19776
19777 Line two
19778 </div></blockquote>
19779 !! html
19780 <blockquote><div>Line one
19781 <p>Line two
19782 </p>
19783 </div></blockquote>
19784
19785 !! end
19786
19787 !! test
19788 Paragraphs inside blockquotes/divs (extra line break on open and close)
19789 !! wikitext
19790 <blockquote><div>
19791 Line one
19792
19793 Line two
19794 </div></blockquote>
19795 !! html
19796 <blockquote><div>
19797 <p>Line one
19798 </p><p>Line two
19799 </p>
19800 </div></blockquote>
19801
19802 !! end
19803
19804 !! test
19805 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19806 !! options
19807 wgLinkHolderBatchSize=0
19808 !! wikitext
19809 [[meatball:1]]
19810 [[meatball:2]]
19811 [[meatball:3]]
19812 !! html
19813 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19814 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19815 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19816 </p>
19817 !! end
19818
19819 !! test
19820 Free external link invading image caption
19821 !! wikitext
19822 [[Image:Foobar.jpg|thumb|http://x|hello]]
19823 !! html
19824 <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>
19825
19826 !! end
19827
19828 !! test
19829 Bug 15196: localised external link numbers
19830 !! options
19831 language=fa
19832 !! wikitext
19833 [http://en.wikipedia.org/]
19834 !! html/php
19835 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19836 </p>
19837 !! html/parsoid
19838 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19839 !! end
19840
19841 !! test
19842 Multibyte character in padleft
19843 !! wikitext
19844 {{padleft:-Hello|7|Æ}}
19845 !! html
19846 <p>Æ-Hello
19847 </p>
19848 !! end
19849
19850 !! test
19851 Multibyte character in padright
19852 !! wikitext
19853 {{padright:Hello-|7|Æ}}
19854 !! html
19855 <p>Hello-Æ
19856 </p>
19857 !! end
19858
19859 !!test
19860 formatdate parser function
19861 !! wikitext
19862 {{#formatdate:2009-03-24}}
19863 !! html
19864 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19865 </p>
19866 !! end
19867
19868 !!test
19869 formatdate parser function, with default format
19870 !! wikitext
19871 {{#formatdate:2009-03-24|mdy}}
19872 !! html
19873 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19874 </p>
19875 !! end
19876
19877 !! test
19878 Spacing of numbers in formatted dates
19879 !! wikitext
19880 {{#formatdate:January 15}}
19881 !! html
19882 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19883 </p>
19884 !! end
19885
19886 !! test
19887 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
19888 !! options
19889 language=nl title=[[MediaWiki:Common.css]]
19890 !! wikitext
19891 {{#formatdate:2009-03-24|dmy}}
19892 !! html
19893 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19894 </p>
19895 !! end
19896
19897 #
19898 #
19899 #
19900
19901 #
19902 # Edit comments
19903 #
19904
19905 !! test
19906 Edit comment with link
19907 !! options
19908 comment
19909 !! wikitext
19910 I like the [[Main Page]] a lot
19911 !! html
19912 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19913 !!end
19914
19915 !! test
19916 Edit comment with link and link text
19917 !! options
19918 comment
19919 !! wikitext
19920 I like the [[Main Page|best pages]] a lot
19921 !! html
19922 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19923 !!end
19924
19925 !! test
19926 Edit comment with link and link text with suffix
19927 !! options
19928 comment
19929 !! wikitext
19930 I like the [[Main Page|best page]]s a lot
19931 !! html
19932 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19933 !!end
19934
19935 !! test
19936 Edit comment with section link (non-local, eg in history list)
19937 !! options
19938 comment title=[[Main Page]]
19939 !! wikitext
19940 /* External links */ removed bogus entries
19941 !! html
19942 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19943 !!end
19944
19945 !! test
19946 Edit comment with section link and text before it (non-local, eg in history list)
19947 !! options
19948 comment title=[[Main Page]]
19949 !! wikitext
19950 pre-comment text /* External links */ removed bogus entries
19951 !! html
19952 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>
19953 !!end
19954
19955 !! test
19956 Edit comment with section link (local, eg in diff view)
19957 !! options
19958 comment local title=[[Main Page]]
19959 !! wikitext
19960 /* External links */ removed bogus entries
19961 !! html
19962 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19963 !!end
19964
19965 !! test
19966 Edit comment with subpage link (bug 14080)
19967 !! options
19968 comment
19969 subpage
19970 title=[[Subpage test]]
19971 !! wikitext
19972 Poked at a [[/subpage]] here...
19973 !! html
19974 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19975 !!end
19976
19977 !! test
19978 Edit comment with subpage link and link text (bug 14080)
19979 !! options
19980 comment
19981 subpage
19982 title=[[Subpage test]]
19983 !! wikitext
19984 Poked at a [[/subpage|neat little page]] here...
19985 !! html
19986 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19987 !!end
19988
19989 !! test
19990 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19991 !! options
19992 comment
19993 title=[[Subpage test]]
19994 !! wikitext
19995 Poked at a [[/subpage]] here...
19996 !! html
19997 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...
19998 !!end
19999
20000 !! test
20001 Edit comment with bare anchor link (local, as on diff)
20002 !! options
20003 comment
20004 local
20005 title=[[Main Page]]
20006 !! wikitext
20007 [[#section]]
20008 !! html
20009 <a href="#section">#section</a>
20010 !! end
20011
20012 !! test
20013 Edit comment with bare anchor link (non-local, as on history)
20014 !! options
20015 comment
20016 title=[[Main Page]]
20017 !! wikitext
20018 [[#section]]
20019 !! html
20020 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20021 !! end
20022
20023 !! test
20024 Anchor starting with underscore
20025 !! wikitext
20026 [[#_ref|One]]
20027 !! html
20028 <p><a href="#_ref">One</a>
20029 </p>
20030 !! end
20031
20032 !! test
20033 Id starting with underscore
20034 !! wikitext
20035 <div id="_ref"></div>
20036 !! html
20037 <div id="_ref"></div>
20038
20039 !! end
20040
20041 !! test
20042 Space normalisation on autocomment (bug 22784)
20043 !! options
20044 comment
20045 title=[[Main Page]]
20046 !! wikitext
20047 /* __hello__world__ */
20048 !! html
20049 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20050 !! end
20051
20052 !! test
20053 percent-encoding and + signs in comments (Bug 26410)
20054 !! options
20055 comment
20056 !! wikitext
20057 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20058 !! html/php
20059 <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>
20060 !! end
20061
20062 # Parsoid doesn't support this yet: see bug 73581
20063 # but it *should* omit the 'src' attribute if the image is bad.
20064 # PHP side of tests was disabled in
20065 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20066 # because of issues in the PHP parserTests infrastructure
20067 # (but the output below is indeed what the PHP side emits)
20068 !! test
20069 Bad images - basic functionality
20070 !! wikitext
20071 [[File:Bad.jpg]]
20072 !! DISABLED/html/php
20073 !! html/parsoid
20074 <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>
20075 !! end
20076
20077 !! test
20078 Bad images - bug 16039: text after bad image disappears
20079 !! wikitext
20080 Foo bar
20081 [[File:Bad.jpg]]
20082 Bar foo
20083 !! DISABLED/html/php
20084 <p>Foo bar
20085 </p><p>Bar foo
20086 </p>
20087 !! html/parsoid
20088 <p>Foo bar
20089 <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>
20090 Bar foo</p>
20091 !! end
20092
20093 !! test
20094 Verify that displaytitle works (bug #22501) no displaytitle
20095 !! options
20096 showtitle
20097 !! config
20098 wgAllowDisplayTitle=true
20099 wgRestrictDisplayTitle=false
20100 !! wikitext
20101 this is not the the title
20102 !! html/php
20103 Parser test
20104 <p>this is not the the title
20105 </p>
20106 !! end
20107
20108 !! test
20109 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20110 !! options
20111 showtitle
20112 title=[[Screen]]
20113 !! config
20114 wgAllowDisplayTitle=true
20115 wgRestrictDisplayTitle=false
20116 !! wikitext
20117 this is not the the title
20118 {{DISPLAYTITLE:whatever}}
20119 !! html/php
20120 whatever
20121 <p>this is not the the title
20122 </p>
20123 !! end
20124
20125 !! test
20126 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20127 !! options
20128 showtitle
20129 title=[[Screen]]
20130 !! config
20131 wgAllowDisplayTitle=true
20132 wgRestrictDisplayTitle=true
20133 !! wikitext
20134 this is not the the title
20135 {{DISPLAYTITLE:whatever}}
20136 !! html/php
20137 Screen
20138 <p>this is not the the title
20139 </p>
20140 !! end
20141
20142 !! test
20143 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20144 !! options
20145 showtitle
20146 title=[[Screen]]
20147 !! config
20148 wgAllowDisplayTitle=true
20149 wgRestrictDisplayTitle=true
20150 !! wikitext
20151 this is not the the title
20152 {{DISPLAYTITLE:screen}}
20153 !! html/php
20154 screen
20155 <p>this is not the the title
20156 </p>
20157 !! end
20158
20159 !! test
20160 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20161 !! options
20162 showtitle
20163 title=[[Screen]]
20164 !! config
20165 wgAllowDisplayTitle=false
20166 !! wikitext
20167 this is not the the title
20168 {{DISPLAYTITLE:screen}}
20169 !! html/php
20170 Screen
20171 <p>this is not the the title
20172 <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>
20173 </p>
20174 !! end
20175
20176 !! test
20177 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20178 !! options
20179 showtitle
20180 title=[[Screen]]
20181 !! config
20182 wgAllowDisplayTitle=false
20183 !! wikitext
20184 this is not the the title
20185 !! html/php
20186 Screen
20187 <p>this is not the the title
20188 </p>
20189 !! end
20190
20191 !! test
20192 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20193 !! options
20194 showtitle
20195 title=[[Screen]]
20196 !! config
20197 wgAllowDisplayTitle=true
20198 wgRestrictDisplayTitle=true
20199 !! wikitext
20200 this is not the the title
20201 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20202 !! html/php
20203 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20204 <p>this is not the the title
20205 </p>
20206 !! end
20207
20208 !! test
20209 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20210 !! options
20211 showtitle
20212 title=[[Screen]]
20213 !! config
20214 wgAllowDisplayTitle=true
20215 wgRestrictDisplayTitle=true
20216 !! wikitext
20217 this is not the the title
20218 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20219 !! html/php
20220 <span style="color: red;">s</span>creen
20221 <p>this is not the the title
20222 </p>
20223 !! end
20224
20225 !! test
20226 Page status indicators: Empty name is invalid
20227 !! options
20228 showindicators
20229 !! wikitext
20230 <indicator name=" "></indicator>
20231 <indicator></indicator>
20232 !! html
20233 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20234 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20235 </p>
20236 !! end
20237
20238 !! test
20239 Page status indicators: Weird syntaxes that are okay
20240 !! options
20241 showindicators
20242 !! wikitext
20243 <indicator name="empty" />
20244 <indicator name="name"></indicator>
20245 !! html
20246 empty=
20247 name=
20248 <p><br />
20249 </p>
20250 !! end
20251
20252 !! test
20253 Page status indicators: Torture test
20254 !! options
20255 showindicators
20256 !! wikitext
20257 <indicator name="01">hello world</indicator>
20258 <indicator name="02">[[Main Page]]</indicator>
20259 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20260 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20261 <indicator name="05">* foo
20262 * bar</indicator>
20263 <indicator name="06"><nowiki>foo</nowiki></indicator>
20264 <indicator name="07"> Preformatted</indicator>
20265 <indicator name="08"><div>Broken tag</indicator>
20266 <indicator name="09">{| class=wikitable
20267 | cell
20268 |}</indicator>
20269 <indicator name="10">Two
20270
20271 paragraphs</indicator>
20272 !! html
20273 01=hello world
20274 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20275 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" />
20276 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>
20277 05=<ul><li> foo</li>
20278 <li> bar</li></ul>
20279
20280 06=foo
20281 07=<pre>Preformatted
20282 </pre>
20283 08=<div>Broken tag</div>
20284
20285 09=<table class="wikitable">
20286 <tr>
20287 <td> cell
20288 </td></tr></table>
20289
20290 10=<p>Two
20291 </p><p>paragraphs
20292 </p>
20293 <p><br />
20294 </p><p><br />
20295 </p><p><br />
20296 </p><p><br />
20297 </p><p><br />
20298 </p>
20299 !! end
20300
20301 !! test
20302 preload: check <noinclude> and <includeonly>
20303 !! options
20304 preload
20305 !! wikitext
20306 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20307 !! html/php
20308 Hello kind world.
20309 !! end
20310
20311 !! test
20312 preload: check <onlyinclude>
20313 !! options
20314 preload
20315 !! wikitext
20316 Goodbye <onlyinclude>Hello world</onlyinclude>
20317 !! html/php
20318 Hello world
20319 !! end
20320
20321 !! test
20322 preload: can pass tags through if we want to
20323 !! options
20324 preload
20325 !! wikitext
20326 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20327 !! html/php
20328 <includeonly>Hello world</includeonly>
20329 !! end
20330
20331 !! test
20332 preload: check that it doesn't try to do tricks
20333 !! options
20334 preload
20335 !! wikitext
20336 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20337 !! html/php
20338 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20339 !! end
20340
20341 !! test
20342 Play a bit with r67090 and bug 3158
20343 !! wikitext
20344 <div style="width:50% !important">&nbsp;</div>
20345 <div style="width:50%&nbsp;!important">&nbsp;</div>
20346 <div style="width:50%&#160;!important">&nbsp;</div>
20347 <div style="border : solid;">&nbsp;</div>
20348 !! html/php
20349 <div style="width:50% !important">&#160;</div>
20350 <div style="width:50% !important">&#160;</div>
20351 <div style="width:50% !important">&#160;</div>
20352 <div style="border&#160;: solid;">&#160;</div>
20353
20354 !! html/parsoid
20355 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20356 <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>
20357 <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>
20358 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20359
20360 !! end
20361
20362 !! test
20363 HTML5 data attributes
20364 !! wikitext
20365 <span data-foo="bar">Baz</span>
20366 <p data-abc-def_hij="">Quuz</p>
20367 !! html
20368 <p><span data-foo="bar">Baz</span>
20369 </p>
20370 <p data-abc-def_hij="">Quuz</p>
20371
20372 !! end
20373
20374 !! test
20375 percent-encoding and + signs in internal links (Bug 26410)
20376 !! wikitext
20377 [[User:+%]] [[Page+title%]]
20378 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20379 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20380 [[%33%45]] [[%33%45+]]
20381 !! html/php
20382 <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>
20383 <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>
20384 <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>
20385 <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>
20386 </p>
20387 !! html/parsoid
20388 <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>
20389 <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>
20390 <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>
20391 <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>
20392 !! end
20393
20394 !! test
20395 Special characters in embedded file links (bug 27679)
20396 !! wikitext
20397 [[File:Contains & ampersand.jpg]]
20398 [[File:Does not exist.jpg|Title with & ampersand]]
20399 !! html/php
20400 <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>
20401 <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>
20402 </p>
20403 !! html/parsoid
20404 <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>
20405 <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>
20406 !! end
20407
20408 !! test
20409 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20410 !! wikitext
20411 Text&apos;s been normalized?
20412 !! html
20413 <p>Text&#39;s been normalized?
20414 </p>
20415 !! end
20416
20417 !! test
20418 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20419 !! wikitext
20420 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20421 !! html
20422 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20423 </p>
20424 !! end
20425
20426 !! test
20427 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20428 !! wikitext
20429 [http://www.example.org/ ideograms]
20430 !! html
20431 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20432 </p>
20433 !! end
20434
20435 !! test
20436 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20437 !! wikitext
20438 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20439 !! html
20440 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20441 </p>
20442 !! end
20443
20444 !! article
20445 Mediawiki:loop1
20446 !! text
20447 {{Identical|A}}
20448 !! endarticle
20449
20450 !! article
20451 Mediawiki:loop2
20452 !! text
20453 {{Identical|B}}
20454 !! endarticle
20455
20456 !! article
20457 Template:Identical
20458 !! text
20459 {{int:loop1}}
20460 {{int:loop2}}
20461 !! endarticle
20462
20463 !! test
20464 Bug 31098 Template which includes system messages which includes the template
20465 !! wikitext
20466 {{Identical}}
20467 !! html
20468 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20469 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20470 </p>
20471 !! end
20472
20473 !! test
20474 Bug31490 Turkish: ucfirst 'blah'
20475 !! options
20476 language=tr
20477 !! wikitext
20478 {{ucfirst:blah}}
20479 !! html
20480 <p>Blah
20481 </p>
20482 !! end
20483
20484 !! test
20485 Bug31490 Turkish: ucfirst 'ix'
20486 !! options
20487 language=tr
20488 !! wikitext
20489 {{ucfirst:ix}}
20490 !! html
20491 <p>İx
20492 </p>
20493 !! end
20494
20495 !! test
20496 Bug31490 Turkish: lcfirst 'BLAH'
20497 !! options
20498 language=tr
20499 !! wikitext
20500 {{lcfirst:BLAH}}
20501 !! html
20502 <p>bLAH
20503 </p>
20504 !! end
20505
20506 !! test
20507 Bug31490 Turkish: ucfırst (with a dotless i)
20508 !! options
20509 language=tr
20510 !! wikitext
20511 {{ucfırst:blah}}
20512 !! html
20513 <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>
20514 </p>
20515 !! end
20516
20517 !! test
20518 Bug31490 ucfırst (with a dotless i) with English language
20519 !! options
20520 language=en
20521 !! wikitext
20522 {{ucfırst:blah}}
20523 !! html
20524 <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>
20525 </p>
20526 !! end
20527
20528 !! test
20529 Bug 26375: TOC with italics
20530 !! options
20531 title=[[Main Page]]
20532 !! wikitext
20533 __TOC__
20534 == ''Lost'' episodes ==
20535 !! html
20536 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20537 <ul>
20538 <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>
20539 </ul>
20540 </div>
20541
20542 <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>
20543
20544 !! end
20545
20546 !! test
20547 Bug 26375: TOC with bold
20548 !! options
20549 title=[[Main Page]]
20550 !! wikitext
20551 __TOC__
20552 == '''should be bold''' then normal text ==
20553 !! html
20554 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20555 <ul>
20556 <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>
20557 </ul>
20558 </div>
20559
20560 <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>
20561
20562 !! end
20563
20564 !! test
20565 Bug 33845: Headings become cursive in TOC when they contain an image
20566 !! options
20567 title=[[Main Page]]
20568 !! wikitext
20569 __TOC__
20570 == Image [[Image:foobar.jpg]] ==
20571 !! html
20572 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20573 <ul>
20574 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20575 </ul>
20576 </div>
20577
20578 <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>
20579
20580 !! end
20581
20582 !! test
20583 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20584 !! options
20585 title=[[Main Page]]
20586 !! wikitext
20587 __TOC__
20588 == <blockquote>Quote</blockquote> ==
20589 !! html
20590 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20591 <ul>
20592 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20593 </ul>
20594 </div>
20595
20596 <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>
20597
20598 !! html+tidy
20599 <p></p>
20600 <div id="toc" class="toc">
20601 <div id="toctitle">
20602 <h2>Contents</h2>
20603 </div>
20604 <ul>
20605 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20606 </ul>
20607 </div>
20608 <p></p>
20609 <h2><span class="mw-headline" id="Quote"></span></h2>
20610 <blockquote>
20611 <p><span class="mw-headline" id="Quote">Quote</span></p>
20612 </blockquote>
20613 <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>
20614 !! end
20615
20616 !! test
20617 Unclosed tags in TOC
20618 !! options
20619 title=[[Main Page]]
20620 !! wikitext
20621 __TOC__
20622 == Proof: 2 < 3 ==
20623 <small>Hanc marginis exiguitas non caperet.</small>
20624 QED
20625 !! html
20626 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20627 <ul>
20628 <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>
20629 </ul>
20630 </div>
20631
20632 <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>
20633 <p><small>Hanc marginis exiguitas non caperet.</small>
20634 QED
20635 </p>
20636 !! end
20637
20638 !! test
20639 Multiple tags in TOC
20640 !! wikitext
20641 __TOC__
20642 == <i>Foo</i> <b>Bar</b> ==
20643
20644 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20645 !! html
20646 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20647 <ul>
20648 <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>
20649 <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>
20650 </ul>
20651 </div>
20652
20653 <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>
20654 <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>
20655
20656 !! html+tidy
20657 <p></p>
20658 <div id="toc" class="toc">
20659 <div id="toctitle">
20660 <h2>Contents</h2>
20661 </div>
20662 <ul>
20663 <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>
20664 <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>
20665 </ul>
20666 </div>
20667 <p></p>
20668 <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>
20669 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20670 <blockquote>
20671 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20672 </blockquote>
20673 <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>
20674 !! end
20675
20676 !! test
20677 Tags with parameters in TOC
20678 !! wikitext
20679 __TOC__
20680 == <sup class="in-h2">Hello</sup> ==
20681
20682 == <sup class="a > b">Evilbye</sup> ==
20683 !! html
20684 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20685 <ul>
20686 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20687 <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>
20688 </ul>
20689 </div>
20690
20691 <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>
20692 <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>
20693
20694 !! end
20695
20696 !! test
20697 span tags with directionality in TOC
20698 !! wikitext
20699 __TOC__
20700 == <span dir="ltr">C++</span> ==
20701
20702 == <span dir="rtl">זבנג!</span> ==
20703
20704 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20705
20706 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20707
20708 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20709 !! html
20710 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20711 <ul>
20712 <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>
20713 <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>
20714 <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>
20715 <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>
20716 <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>
20717 </ul>
20718 </div>
20719
20720 <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>
20721 <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>
20722 <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>
20723 <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>
20724 <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>
20725
20726 !! end
20727
20728 !! test
20729 Bug 72884: bdi element in ToC
20730 !! wikitext
20731 __TOC__
20732 == <bdi>test</bdi> ==
20733 !! html
20734 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20735 <ul>
20736 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20737 </ul>
20738 </div>
20739
20740 <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>
20741
20742 !! end
20743
20744 # Note that the html output does not have the <p></p>, but the
20745 # html+tidy output *does*. This is because the empty <p></p> is
20746 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20747 !! test
20748 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20749 !! wikitext
20750 __TOC__
20751 == x ==
20752 !! html
20753 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20754 <ul>
20755 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20756 </ul>
20757 </div>
20758
20759 <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>
20760
20761 !! html+tidy
20762 <p></p>
20763 <div id="toc" class="toc">
20764 <div id="toctitle">
20765 <h2>Contents</h2>
20766 </div>
20767 <ul>
20768 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20769 </ul>
20770 </div>
20771 <p></p>
20772 <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>
20773 !! end
20774
20775 !! article
20776 MediaWiki:Bug32057
20777 !! text
20778 == {{int:headline_sample}} ==
20779 !! endarticle
20780
20781 !! test
20782 Bug 32057: Title needed when expanding <h> nodes.
20783 !! options
20784 title=[[Main Page]]
20785 !! wikitext
20786 {{int:Bug32057}}
20787 !! html
20788 <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>
20789
20790 !! end
20791
20792 !! test
20793 Strip marker in urlencode
20794 !! wikitext
20795 {{urlencode:x<nowiki/>y}}
20796 {{urlencode:x<nowiki/>y|wiki}}
20797 {{urlencode:x<nowiki/>y|path}}
20798 {{urlencode:x<pre id="one">two</pre>y}}
20799 !! html
20800 <p>xy
20801 xy
20802 xy
20803 xy
20804 </p>
20805 !! end
20806
20807 !! test
20808 Strip marker in lc
20809 !! wikitext
20810 {{lc:x<nowiki/>y}}
20811 !! html
20812 <p>xy
20813 </p>
20814 !! end
20815
20816 !! test
20817 Strip marker in uc
20818 !! wikitext
20819 {{uc:x<nowiki/>y}}
20820 !! html
20821 <p>XY
20822 </p>
20823 !! end
20824
20825 !! test
20826 Strip marker in formatNum
20827 !! wikitext
20828 {{formatnum:1<nowiki/>2}}
20829 {{formatnum:1<nowiki/>2|R}}
20830 !! html
20831 <p>12
20832 12
20833 </p>
20834 !! end
20835
20836 !! test
20837 Check noCommafy in formatNum
20838 !! options
20839 language=be-tarask
20840 !! wikitext
20841 {{formatnum:123456.78}}
20842 {{formatnum:123456.78|NOSEP}}
20843 !! html
20844 <p>123 456,78
20845 123456.78
20846 </p>
20847 !! end
20848
20849 !! test
20850 Wrong option for formatNum (bug 56199)
20851 !! wikitext
20852 {{formatnum:1,234.56|Random}}
20853 {{formatnum:1,234.56|EVERYTHING}}
20854 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20855 !! html
20856 <p>1,234.56
20857 1,234.56
20858 1,234.56
20859 </p>
20860 !! end
20861
20862 !! test
20863 Strip marker in grammar
20864 !! options
20865 language=fi
20866 !! wikitext
20867 {{grammar:elative|foo<nowiki/>bar}}
20868 !! html
20869 <p>foobarista
20870 </p>
20871 !! end
20872
20873 !! test
20874 Strip marker in padleft
20875 !! wikitext
20876 {{padleft:|2|x<nowiki/>y}}
20877 !! html
20878 <p>xy
20879 </p>
20880 !! end
20881
20882 !! test
20883 Strip marker in padright
20884 !! wikitext
20885 {{padright:|2|x<nowiki/>y}}
20886 !! html
20887 <p>xy
20888 </p>
20889 !! end
20890
20891 !! test
20892 Strip marker in anchorencode
20893 !! wikitext
20894 {{anchorencode:x<nowiki/>y}}
20895 !! html
20896 <p>xy
20897 </p>
20898 !! end
20899
20900 !! test
20901 nowiki inside link inside heading (bug 18295)
20902 !! wikitext
20903 ==[[foo|x<nowiki>y</nowiki>z]]==
20904 !! html
20905 <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>
20906
20907 !! end
20908
20909 !! test
20910 new support for bdi element (bug 31817)
20911 !! wikitext
20912 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20913 !! html
20914 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20915
20916 !!end
20917
20918 !! test
20919 Ignore pipe between table row attributes
20920 !! wikitext
20921 {|
20922 | quux
20923 |- id=foo | style='color: red'
20924 | bar
20925 |}
20926 !! html
20927 <table>
20928 <tr>
20929 <td> quux
20930 </td></tr>
20931 <tr id="foo" style="color: red">
20932 <td> bar
20933 </td></tr></table>
20934
20935 !! end
20936
20937 !!test
20938 Gallery override link with WikiLink (bug 34852)
20939 !! wikitext
20940 <gallery>
20941 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20942 </gallery>
20943 !! html
20944 <ul class="gallery mw-gallery-traditional">
20945 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20946 <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>
20947 <div class="gallerytext">
20948 <p>caption
20949 </p>
20950 </div>
20951 </div></li>
20952 </ul>
20953
20954 !! end
20955
20956 !!test
20957 Gallery override link with absolute external link (bug 34852)
20958 !! wikitext
20959 <gallery>
20960 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20961 </gallery>
20962 !! html
20963 <ul class="gallery mw-gallery-traditional">
20964 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20965 <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>
20966 <div class="gallerytext">
20967 <p>caption
20968 </p>
20969 </div>
20970 </div></li>
20971 </ul>
20972
20973 !! end
20974
20975 !!test
20976 Gallery override link with malicious javascript (bug 34852)
20977 !! wikitext
20978 <gallery>
20979 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20980 </gallery>
20981 !! html
20982 <ul class="gallery mw-gallery-traditional">
20983 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20984 <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>
20985 <div class="gallerytext">
20986 <p>caption
20987 </p>
20988 </div>
20989 </div></li>
20990 </ul>
20991
20992 !! end
20993
20994 !!test
20995 Gallery with invalid title as link (bug 43964)
20996 !! wikitext
20997 <gallery>
20998 File:foobar.jpg|link=<
20999 </gallery>
21000 !! html
21001 <ul class="gallery mw-gallery-traditional">
21002 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21003 <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>
21004 <div class="gallerytext">
21005 </div>
21006 </div></li>
21007 </ul>
21008
21009 !! end
21010
21011 !!test
21012 Language parser function
21013 !! wikitext
21014 {{#language:ar}}
21015 !! html
21016 <p>العربية
21017 </p>
21018 !! end
21019
21020 !!test
21021 Padleft and padright as substr
21022 !! wikitext
21023 {{padleft:|3|abcde}}
21024 {{padright:|3|abcde}}
21025 !! html
21026 <p>abc
21027 abc
21028 </p>
21029 !! end
21030
21031 !!test
21032 Special parser function
21033 !! wikitext
21034 {{#special:RandomPage}}
21035 {{#special:BaDtItLe}}
21036 {{#special:Foobar}}
21037 !! html
21038 <p>Special:Random
21039 Special:Badtitle
21040 Special:Foobar
21041 </p>
21042 !! end
21043
21044 !!test
21045 Bug 34939 - Case insensitive link parsing ([HttP://])
21046 !! wikitext
21047 [HttP://MediaWiki.Org/]
21048 !! html/php
21049 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21050 </p>
21051 !! html/parsoid
21052 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21053 !! end
21054
21055 !!test
21056 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21057 !! wikitext
21058 [HttP://MediaWiki.Org/ MediaWiki]
21059 !! html
21060 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21061 </p>
21062 !! end
21063
21064 !!test
21065 Bug 34939 - Case insensitive link parsing (HttP://)
21066 !! wikitext
21067 HttP://MediaWiki.Org/
21068 !! html/php
21069 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21070 </p>
21071 !! html/parsoid
21072 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21073 !! end
21074
21075 !!test
21076 Disable TOC
21077 !! options
21078 notoc
21079 !! wikitext
21080 Lead
21081 == Section 1 ==
21082 == Section 2 ==
21083 == Section 3 ==
21084 == Section 4 ==
21085 == Section 5 ==
21086 !! html
21087 <p>Lead
21088 </p>
21089
21090 <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>
21091 <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>
21092 <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>
21093 <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>
21094 <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>
21095
21096 !! end
21097
21098
21099 ###
21100 ### Parsoid-specific tests
21101 ### Parsoid-PHP parser incompatibilities
21102 ###
21103 !!test
21104 1. SOL-sensitive wikitext tokens as template-args
21105 !!options
21106 parsoid=wt2html,wt2wt
21107 !! wikitext
21108 {{echo|*a}}
21109 {{echo|#a}}
21110 {{echo|:a}}
21111 !! html
21112 <span about="#mwt1" typeof="mw:Transclusion">
21113 </span><ul about="#mwt1"><li>a</li>
21114 </ul>
21115 <span about="#mwt2" typeof="mw:Transclusion">
21116 </span><ol about="#mwt2"><li>a</li>
21117 </ol>
21118 <span about="#mwt3" typeof="mw:Transclusion">
21119 </span><dl about="#mwt3"><dd>a</dd>
21120 </dl>
21121 !!end
21122
21123 #### -----------------------------------------------------------------
21124 #### Parsoid-specific functionality tests
21125 #### -----------------------------------------------------------------
21126
21127 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21128 # We know wt2wt will fail, but we expect selser to pass.
21129 # Due to the nature of our testing, wt2wt and selser tests will enter the
21130 # blacklist and we'll catch selser regressions based on changes to the
21131 # blacklist entries for selser tests.
21132 !! test
21133 1. Bad treebuilder fixup of formatting elt is cleaned up
21134 !! options
21135 parsoid=wt2html,wt2wt
21136 !! wikitext
21137 {|
21138 |
21139 <small>
21140 [[Image:Foobar.jpg|right|Test]]
21141 </small>
21142 |}
21143 !! html/parsoid
21144 <table>
21145 <tbody><tr><td>
21146 <small>
21147 <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>
21148 </small>
21149 </td></tr>
21150 </tbody></table>
21151 !! end
21152
21153 !! test
21154 2. Bad treebuilder fixup of formatting elt is cleaned up
21155 !! options
21156 parsoid=wt2html,wt2wt
21157 !! wikitext
21158 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21159
21160 <small>[[Image:Foobar.jpg|right|300px]]</small>
21161 !! html/parsoid
21162
21163 <p><b>foo</b></p>
21164 <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>
21165 <p><b>bar</b></p>
21166 <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>
21167 !! end
21168
21169 !! test
21170 3. Bad treebuilder fixup of formatting elt is cleaned up
21171 !! options
21172 parsoid=wt2html,wt2wt
21173 !! wikitext
21174 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21175 !! html/parsoid
21176 <p><small><b>foo</b></small></p>
21177 <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>
21178 <p><small><b>bar</b></small></p>
21179 !! end
21180
21181 !! test
21182 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21183 !! options
21184 parsoid=wt2html,wt2wt
21185 !! wikitext
21186 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21187 !! html/parsoid
21188 <p><b><small></small></b></p>
21189 <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>
21190 <p></p>
21191 !! end
21192
21193 #### ----------------------------------------------------------------
21194 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21195 #### tags. Parsoid's output for these tags differs from that of the
21196 #### PHP parser.
21197 #### ----------------------------------------------------------------
21198
21199 !!test
21200 Ref: 1. ref-location should be replaced with an index span
21201 !!options
21202 parsoid
21203 !! wikitext
21204 A <ref>foo</ref>
21205 B <ref name="x">foo</ref>
21206 C <ref name="y" />
21207 <references />
21208 !! html
21209 <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>
21210 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>
21211 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>
21212 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21213 <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>
21214 <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>
21215 <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>
21216 </ol>
21217 !!end
21218
21219 !!test
21220 Ref: 2. ref-tags with identical names should all get the same index
21221 !!options
21222 parsoid
21223 !! wikitext
21224 A <ref name="x">foo</ref>
21225 B <ref name="x" />
21226 <references />
21227 !! html
21228 <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>
21229 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>
21230 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21231 <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>
21232 </ol>
21233 !!end
21234
21235 !!test
21236 Ref: 3. spaces in ref-names should be ignored
21237 !!options
21238 parsoid
21239 !! wikitext
21240 A <ref name="x">foo</ref>
21241 B <ref name=" x " />
21242 C <ref name= x />
21243 <references />
21244 !! html
21245 <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>
21246 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>
21247 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>
21248 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21249 <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>
21250 </ol>
21251 !!end
21252
21253 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21254 !!test
21255 Ref: 4. 'constructor' should be accepted as a valid ref-name
21256 !!options
21257 parsoid
21258 !! wikitext
21259 A <ref name="constructor">foo</ref>
21260 <references />
21261 !! html
21262 <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>
21263 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21264 <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>
21265 </ol>
21266 !!end
21267
21268 !!test
21269 Ref: 5. body should accept generic wikitext
21270 !!options
21271 parsoid
21272 !! wikitext
21273 A <ref>
21274 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21275 </ref>
21276
21277 <references />
21278 !! html
21279 <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>
21280
21281 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" 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">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>
21283 </span></li>
21284 </ol>
21285 !!end
21286
21287 !!test
21288 Ref: 6. indent-pres should not be output in ref-body
21289 !!options
21290 parsoid
21291 !! wikitext
21292 A <ref>
21293 foo
21294 bar
21295 baz
21296 </ref>
21297
21298 <references />
21299 !! html
21300 <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>
21301
21302 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21303 <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
21304 bar
21305 baz
21306 </span></li>
21307 </ol>
21308 !!end
21309
21310 !!test
21311 Ref: 7. No p-wrapping in ref-body
21312 !!options
21313 parsoid
21314 !! wikitext
21315 A <ref>
21316 foo
21317
21318 bar
21319
21320
21321 baz
21322
21323
21324
21325 booz
21326 </ref>
21327
21328 <references />
21329 !! html
21330 <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>
21331
21332 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21333 <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
21334
21335 bar
21336
21337
21338 baz
21339
21340
21341
21342 booz
21343 </span></li>
21344 </ol>
21345 !!end
21346
21347 !!test
21348 Ref: 8. transclusion wikitext has lower precedence
21349 !!options
21350 parsoid
21351 !! wikitext
21352 A <ref> foo {{echo|</ref> B C}}
21353
21354 <references />
21355 !! html
21356 <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>
21357 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21358 <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>
21359 </ol>
21360 !!end
21361
21362 !!test
21363 Ref: 9. unclosed comments should not leak out of ref-body
21364 !!options
21365 parsoid
21366 !! wikitext
21367 A <ref> foo <!--</ref> B C
21368 <references />
21369 !! html
21370 <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>
21371 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21372 <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>
21373 </ol>
21374 !!end
21375
21376 !!test
21377 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21378 !!options
21379 parsoid
21380 !! wikitext
21381 A <ref> <b> foo </ref> B C
21382
21383 <references />
21384 !! html
21385 <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>
21386
21387
21388 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21389 <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>
21390 </ol>
21391 !!end
21392
21393 !!test
21394 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21395 !!options
21396 parsoid
21397 !! wikitext
21398 A <ref>foo</ref> B
21399 C <ref>bar</ref> D
21400 <references />
21401 !! html
21402 <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
21403 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>
21404 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21405 <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>
21406 <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>
21407 </ol>
21408 !!end
21409
21410 !!test
21411 Ref: 12. ref-tags act as trailing newline migration barrier
21412 !! wikitext
21413 <!--the newline at the end of this line moves out of the p tag-->a
21414
21415 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21416 <ref />
21417
21418 c
21419 <references />
21420 !! html/parsoid
21421 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21422
21423
21424 <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>
21425 <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>
21426
21427 <p>c</p>
21428 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21429 <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>
21430 <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>
21431 !!end
21432
21433 !!test
21434 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21435 !!options
21436 parsoid
21437 !! wikitext
21438 <ref>foo</ref> A
21439 <ref>bar
21440 </ref> B
21441 <references />
21442 !! html
21443 <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
21444 <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>
21445 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21446 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21447 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
21448 </span></li>
21449 </ol>
21450 !!end
21451
21452 !!test
21453 Ref: 14. A nested ref-tag should be emitted as plain text
21454 !!options
21455 parsoid
21456 !! wikitext
21457 <ref>foo <ref>bar</ref> baz</ref>
21458
21459 <references />
21460 !! html
21461 <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>
21462 </p>
21463 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21464 <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>
21465 </ol>
21466 !!end
21467
21468 !!test
21469 Ref: 15. ref-tags with identical names should get identical indexes
21470 !!options
21471 parsoid
21472 !! wikitext
21473 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21474 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21475
21476 <references />
21477 !! html
21478 <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>
21479 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>
21480
21481 <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>
21482 </ol>
21483 !!end
21484
21485 ## We don't bother wt2wt-ing non-standard whitespace
21486 !!test
21487 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21488 !!options
21489 parsoid=wt2html
21490 !! wikitext
21491 A <ref >foo</ref >
21492
21493 <references />
21494 !! html
21495 <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>
21496 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21497 <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>
21498 !!end
21499
21500 !!test
21501 Ref: 17. Generate valid HTML5 id/about attributes
21502 !!options
21503 parsoid
21504 !!wikitext
21505 <ref name="a b">foo</ref>
21506
21507 <references />
21508 !!html
21509 <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>
21510 </p>
21511
21512 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21513 <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>
21514 </ol>
21515 !!end
21516
21517 !!test
21518 Ref: 18. T58916: Extension attributes should be parsed as plain text
21519 !!options
21520 parsoid
21521 !!wikitext
21522 <ref name="{{echo|a}}">foo</ref>
21523
21524 <references />
21525 !!html
21526 <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>
21527 </p>
21528
21529 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21530 <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>
21531 </ol>
21532 !!end
21533
21534 !!test
21535 Ref: 19. ref-tags with identical name encodings should get identical indexes
21536 !!options
21537 parsoid
21538 !! wikitext
21539 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21540
21541 <references />
21542 !! html
21543 <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>
21544 </p>
21545 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21546 <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>
21547 </ol>
21548 !!end
21549
21550 !!test
21551 Ref: 20. ref-tags with identical names but different content should keep it
21552 !!options
21553 parsoid
21554 !! wikitext
21555 A <ref name="foo">Foo one</ref>
21556 B <ref name="foo">Foo two</ref>
21557 C <ref name="foo" />
21558
21559 <references />
21560 !! html
21561 <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>
21562 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>
21563 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>
21564
21565 <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>
21566 </ol>
21567 !!end
21568
21569 !!test
21570 References: 1. references tag without any refs should be handled properly
21571 !! wikitext
21572 <references />
21573 !! html/parsoid
21574 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21575 !!end
21576
21577 !!test
21578 References: 2. references tag with group only outputs references from that group
21579 !! wikitext
21580 A <ref group="a">foo</ref>
21581 B <ref group="b">bar</ref>
21582 C <ref>baz</ref>
21583
21584 <references group="a" />
21585 <references />
21586 <references group="b" />
21587 !! html/parsoid
21588 <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>
21589 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>
21590 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>
21591
21592 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21593 <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>
21594 </ol>
21595 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21596 <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>
21597 </ol>
21598 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21599 <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>
21600 </ol>
21601 !!end
21602
21603 !!test
21604 References: 3. ref list should be cleared after processing references
21605 !! wikitext
21606 A <ref>foo</ref>
21607
21608 <references />
21609
21610 B <ref>bar</ref>
21611
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></p>
21615
21616 <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>
21617 </ol>
21618
21619 <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>
21620
21621 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21622 <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>
21623 </ol>
21624 !!end
21625
21626 !!test
21627 References: 4. only referenced group should be cleared after processing references
21628 !! wikitext
21629 A <ref group="a">afoo</ref>
21630 B <ref>bfoo</ref>
21631
21632 <references group="a" />
21633
21634 C <ref>cfoo</ref>
21635
21636 <references />
21637 !! html/parsoid
21638 <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>
21639 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>
21640
21641 <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>
21642 </ol>
21643
21644 <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>
21645
21646 <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>
21647 </ol>
21648 !!end
21649
21650 !!test
21651 References: 5. ref tags in references should be processed while ignoring all other content
21652 !! wikitext
21653 A <ref name="a" />
21654 B <ref name="b">bar</ref>
21655
21656 <references>
21657 <ref name="a">foo</ref>
21658 This should just get lost.
21659 </references>
21660 !! html/parsoid
21661 <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>
21662 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>
21663
21664
21665 <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>
21666 </ol>
21667 !!end
21668
21669 !!test
21670 References: 6. <references /> from a transclusion
21671 !! wikitext
21672 <ref>Foo</ref> {{echo|<references />}}
21673 !! html/parsoid
21674 <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>
21675 </ol>
21676 !!end
21677
21678 !! test
21679 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21680 !! wikitext
21681 A <ref>foo bar for a</ref>
21682 B <ref group="X" name="b" />
21683
21684 <references />
21685
21686 <references group="X">
21687 <ref name="b">foo</ref>
21688 </references>
21689 !! html/parsoid
21690 <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>
21691 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>
21692 </p>
21693
21694 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21695 <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>
21696 </ol>
21697
21698 <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"}}'>
21699 <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>
21700 </ol>
21701 !! end
21702
21703 !! test
21704 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21705 !! wikitext
21706 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21707 <references />
21708 !! html/parsoid
21709 <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>
21710 <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>
21711 </ol>
21712 !!end
21713
21714 # This test only works in wt2html now as the <references /> are always generated
21715 # unless selser is active. Once T72722 is fixed, we should add a changes test
21716 # here to ensure that unrelated changes don't add the new <references /> in
21717 # wt2wt.
21718 !! test
21719 References: 9. Generate missing references list at the end
21720 !! wikitext
21721 A <ref>foo</ref>
21722 B <ref group="inexistent">bar</ref>
21723 !! html/parsoid
21724 <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>
21725 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21726 <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>
21727 </ol>
21728 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21729 <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>
21730 </ol>
21731 !! end
21732
21733 !! test
21734 References: 10. New <references/> shouldn't be added for unrelated edits.
21735 !! options
21736 parsoid={
21737 "modes": ["selser"],
21738 "changes": [["#x", "remove"]],
21739 "selser": "noauto"
21740 }
21741 !! wikitext
21742 Unrelated text<span id="x"> that's going to disappear</span>.
21743 A <ref>foo</ref>
21744 !! wikitext/edited
21745 Unrelated text.
21746 A <ref>foo</ref>
21747 !!end
21748
21749 !! test
21750 Entities in ref name
21751 !! wikitext
21752 <ref name="test &amp; me">hi</ref>
21753 <references />
21754 !! html/parsoid
21755 <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>
21756 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21757 <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>
21758 </ol>
21759 !! end
21760
21761 # This test is wt2html only because we're permitting the serializer to produce
21762 # dirty diffs, normalizing the unclosed references to the self-closed version.
21763 !! test
21764 Generate references for unclosed references tag
21765 !! options
21766 parsoid=wt2html
21767 !! wikitext
21768 a<ref>foo</ref>
21769
21770 <references>
21771 !! html/parsoid
21772 <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>
21773 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21774 <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>
21775 !! end
21776
21777 !! test
21778 New reference serializes on its own line
21779 !! options
21780 parsoid=wt2wt,html2wt
21781 !! wikitext
21782 foo
21783 <references />
21784 !! html/parsoid
21785 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21786 !! end
21787
21788 #### ----------------------------------------------------------------
21789 #### Parsoid-only testing of Parsoid's impl of LST
21790 #### Not implemented yet, see
21791 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21792 #### ----------------------------------------------------------------
21793
21794 !!test
21795 LST Sections: 1. Simple section start and end
21796 !! wikitext
21797 <section begin="2011-05-16" />
21798 <section end="2014-04-10 (MW 1.23wmf22)" />
21799 !! html/parsoid
21800 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21801 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21802 !! end
21803
21804 #--------- Test stripping of empty nodes in template content ----------
21805 !!test
21806 Empty LI and TR nodes should be stripped from template content
21807 !!wikitext
21808 {{EmptyLITest}}
21809 {{EmptyTRTest}}
21810 !!html/parsoid
21811 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21812 <li>a</li>
21813 <li>b</li>
21814 </ul>
21815 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21816 <tbody>
21817 <tr>
21818 <td>foo</td>
21819 </tr>
21820 <tr>
21821 <td>bar</td>
21822 </tr>
21823 </tbody>
21824 </table>
21825 !!end
21826
21827 !!test
21828 Empty LI and TR nodes should not be stripped from top-level content
21829 !!wikitext
21830 * a
21831 *
21832 * b
21833 {|
21834 |-
21835 |-
21836 |foo
21837 |}
21838 !!html/parsoid
21839 <ul>
21840 <li> a</li>
21841 <li></li>
21842 <li> b</li>
21843 </ul>
21844 <table>
21845 <tbody>
21846 <tr></tr>
21847 <tr>
21848 <td>foo</td>
21849 </tr>
21850 </tbody>
21851 </table>
21852 !!end
21853
21854 !!test
21855 Empty TR nodes should not be stripped if they have any attributes set
21856 !!wikitext
21857 {{EmptyTRWithHTMLAttrTest}}
21858 !!html/parsoid
21859 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21860 <tr align="center"></tr>
21861 <tr><td>foo</td></tr>
21862 <tr align="center"></tr>
21863 <tr><td>bar</td></tr>
21864 </table>
21865 !!end
21866
21867 #### ----------------------------------------------------------------
21868 #### The following section of tests are primarily to test
21869 #### wikitext escaping capabilities of Parsoid. Given that
21870 #### escaping can be done any number of ways, the wikitext (input)
21871 #### is always adjusted to reflect how Parsoid adds nowiki
21872 #### escape tags.
21873 ####
21874 #### We are marking several tests as parsoid-only since the
21875 #### HTML in the result section is different from what the
21876 #### PHP parser generates for it.
21877 #### ----------------------------------------------------------------
21878
21879
21880 #### --------------- Headings ---------------
21881 #### 0. Unnested
21882 #### 1. Nested inside html <h1>=foo=</h1>
21883 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21884 #### 3. Nested inside html with wikitext split by html tags
21885 #### 4. No escape needed
21886 #### 5. Empty headings <h1></h1>
21887 #### 6. Heading chars in SOL context
21888 #### ----------------------------------------
21889 !! test
21890 Headings: 0. Unnested
21891 !! options
21892 parsoid
21893 !! wikitext
21894 <nowiki>=foo=</nowiki>
21895
21896 <nowiki> =foo= </nowiki>
21897 <!--cmt-->
21898 <nowiki>=foo=</nowiki>
21899
21900 =foo''a''<nowiki>=</nowiki>
21901 !! html
21902 <p><span typeof="mw:Nowiki">=foo=</span></p>
21903
21904 <p><span typeof="mw:Nowiki"> =foo= </span>
21905 <!--cmt-->
21906 <span typeof="mw:Nowiki">=foo=</span></p>
21907
21908 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21909 !!end
21910
21911 # New headings and existing headings are handled differently
21912 !! test
21913 Headings: 1. Nested inside html
21914 !! options
21915 parsoid=html2wt
21916 !! html/parsoid
21917 <h1>=foo=</h1>
21918 <h2>=foo=</h2>
21919 <h3>=foo=</h3>
21920
21921 <h1 data-parsoid=''>=foo=</h1>
21922 <h2 data-parsoid=''>=foo=</h2>
21923 <h3 data-parsoid=''>=foo=</h3>
21924 <h4 data-parsoid=''>=foo=</h4>
21925 <h5 data-parsoid=''>=foo=</h5>
21926 <h6 data-parsoid=''>=foo=</h6>
21927 !! wikitext
21928 = =foo= =
21929
21930 == =foo= ==
21931
21932 === =foo= ===
21933
21934 =<nowiki>=foo=</nowiki>=
21935 ==<nowiki>=foo=</nowiki>==
21936 ===<nowiki>=foo=</nowiki>===
21937 ====<nowiki>=foo=</nowiki>====
21938 =====<nowiki>=foo=</nowiki>=====
21939 ======<nowiki>=foo=</nowiki>======
21940
21941 !!end
21942
21943 !! test
21944 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21945 !! options
21946 parsoid=html2wt
21947 !! html/parsoid
21948 <h1>foo</h1>*bar
21949 <h1>foo</h1>=bar
21950 <h1>foo</h1>=bar=
21951 !! wikitext
21952 = foo =
21953 <nowiki>*</nowiki>bar
21954
21955 = foo =
21956 =bar
21957
21958 = foo =
21959 <nowiki>=bar=</nowiki>
21960 !!end
21961
21962 !! test
21963 Headings: 3. Nested inside html with wikitext split by html tags
21964 !! options
21965 parsoid=html2wt,wt2wt
21966 !! wikitext
21967 = ='''bold'''<nowiki>foo=</nowiki> =
21968 !! html/parsoid
21969 <h1>=<b>bold</b>foo=</h1>
21970 !!end
21971
21972 !! test
21973 Headings: 4a. No escaping needed (testing just h1 and h2)
21974 !! wikitext
21975 = =foo =
21976
21977 = foo= =
21978
21979 = =foo= =
21980
21981 = =foo= bar =
21982
21983 == =foo ==
21984
21985 == foo= ==
21986
21987 = = =
21988
21989 = ''=''foo= =
21990 !! html/parsoid
21991 <h1>=foo</h1>
21992 <h1>foo=</h1>
21993 <h1> =foo= </h1>
21994 <h1>=foo= bar</h1>
21995 <h2>=foo</h2>
21996 <h2>foo=</h2>
21997 <h1>=</h1>
21998 <h1><i>=</i>foo=</h1>
21999 !!end
22000
22001 !! test
22002 Headings: 4b. No escaping needed (inside p-tags)
22003 !! options
22004 parsoid=html2wt
22005 !! html/parsoid
22006 <p>===
22007 =foo= x
22008 =foo= <s></s>
22009 </p>
22010 !! wikitext
22011 ===
22012 =foo= x
22013 =foo= <s></s>
22014 !!end
22015
22016 !! test
22017 Headings: 5. Empty headings
22018 !! wikitext
22019 =<nowiki/>=
22020
22021 ==<nowiki/>==
22022
22023 ===<nowiki/>===
22024
22025 ====<nowiki/>====
22026
22027 =====<nowiki/>=====
22028
22029 ======<nowiki/>======
22030 !! html/parsoid
22031 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
22032
22033 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
22034
22035 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
22036
22037 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
22038
22039 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
22040
22041 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
22042 !!end
22043
22044 !! test
22045 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22046 !! wikitext
22047 <nowiki>=a=</nowiki>
22048
22049 <nowiki>=a=</nowiki>
22050
22051 <nowiki>=a=</nowiki>
22052
22053 <nowiki>=a=</nowiki>
22054 !! html/php
22055 <p>=a=
22056 </p><p>=a=
22057 </p><p>=a=
22058 </p><p>=a=
22059 </p>
22060 !! html/parsoid
22061 <p><span typeof="mw:Nowiki">=a=</span></p>
22062
22063 <p><span typeof="mw:Nowiki">=a=</span></p>
22064
22065 <p><span typeof="mw:Nowiki">=a=</span></p>
22066
22067 <p><span typeof="mw:Nowiki">=a=</span></p>
22068 !!end
22069
22070 !! test
22071 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22072 !! wikitext
22073 <nowiki>=a=
22074 b</nowiki>
22075
22076 <nowiki>=a=
22077 b</nowiki>
22078
22079 <nowiki>=a=
22080 b</nowiki>
22081
22082 <nowiki>=a=
22083 b</nowiki>
22084 !! html/php
22085 <p>=a=
22086 b
22087 </p><p>=a=
22088 b
22089 </p><p>=a=
22090 b
22091 </p><p>=a=
22092 b
22093 </p>
22094 !! html/parsoid
22095 <p><span typeof="mw:Nowiki">=a=
22096 b</span></p>
22097
22098 <p><span typeof="mw:Nowiki">=a=
22099 b</span></p>
22100
22101 <p><span typeof="mw:Nowiki">=a=
22102 b</span></p>
22103
22104 <p><span typeof="mw:Nowiki">=a=
22105 b</span></p>
22106 !!end
22107
22108 !! test
22109 Headings: 6c. Heading chars in SOL context (leading newline break)
22110 !! wikitext
22111 a
22112 <nowiki>=b=</nowiki>
22113 !! html/php
22114 <p>a
22115 =b=
22116 </p>
22117 !! html/parsoid
22118 <p>a
22119 <span typeof="mw:Nowiki">=b=</span>
22120 !!end
22121
22122 !! test
22123 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22124 !! wikitext
22125 <!--c0--><nowiki>=a=</nowiki>
22126
22127 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22128 !! html/php
22129 <p>=a=
22130 </p><p>=a=
22131 </p>
22132 !! html/parsoid
22133 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
22134
22135 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
22136 !!end
22137
22138 !! test
22139 Headings: 6d. Heading chars in SOL context (No escaping needed)
22140 !! options
22141 parsoid=html2wt
22142 !! html/parsoid
22143 =a=<div>b</div>
22144 !! wikitext
22145 =a=<div>b</div>
22146 !!end
22147
22148 !! test
22149 Headings: 7. Insert a newline between new content and headings
22150 !! options
22151 parsoid=html2wt
22152 !! html/parsoid
22153 <h2>NEW</h2>
22154 <p>new</p>
22155 <h2 data-parsoid='{}'>A</h2>
22156 <p data-parsoid='{}'>a</p>
22157 !! wikitext
22158 == NEW ==
22159 new
22160
22161 ==A==
22162 a
22163
22164 !! end
22165
22166 #### --------------- Lists ---------------
22167 #### 0. Outside nests (*foo, etc.)
22168 #### 1. Nested inside html <ul><li>*foo</li></ul>
22169 #### 2. Inside definition lists
22170 #### 3. Only bullets at start should be escaped
22171 #### 4. No escapes needed
22172 #### 5. No unnecessary escapes
22173 #### 6. Escape bullets in SOL position
22174 #### 7. Escape bullets in a multi-line context
22175 #### ----------------------------------------
22176
22177 !! test
22178 Lists: 0. Outside nests
22179 !! wikitext
22180 <nowiki>*</nowiki>foo
22181
22182 <nowiki>#</nowiki>foo
22183
22184 <nowiki>;Foo:</nowiki>bar
22185 !! html/php
22186 <p>*foo
22187 </p><p>#foo
22188 </p><p>;Foo:bar
22189 </p>
22190 !! html/parsoid
22191 <p><span typeof="mw:Nowiki">*</span>foo</p>
22192
22193 <p><span typeof="mw:Nowiki">#</span>foo</p>
22194
22195 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
22196 !!end
22197
22198 !! test
22199 Lists: 1. Nested inside html
22200 !! wikitext
22201 *<nowiki>*foo</nowiki>
22202
22203 *<nowiki>#foo</nowiki>
22204
22205 *<nowiki>:foo</nowiki>
22206
22207 *<nowiki>;foo</nowiki>
22208
22209 #<nowiki>*foo</nowiki>
22210
22211 #<nowiki>#foo</nowiki>
22212
22213 #<nowiki>:foo</nowiki>
22214
22215 #<nowiki>;foo</nowiki>
22216 !! html
22217 <ul><li>*foo</li></ul>
22218 <ul><li>#foo</li></ul>
22219 <ul><li>:foo</li></ul>
22220 <ul><li>;foo</li></ul>
22221 <ol><li>*foo</li></ol>
22222 <ol><li>#foo</li></ol>
22223 <ol><li>:foo</li></ol>
22224 <ol><li>;foo</li></ol>
22225
22226 !!end
22227
22228 !! test
22229 Lists: 2. Inside definition lists
22230 !! wikitext
22231 ;<nowiki>;foo</nowiki>
22232
22233 ;<nowiki>:foo</nowiki>
22234
22235 ;<nowiki>:foo</nowiki>
22236 :bar
22237
22238 :<nowiki>:foo</nowiki>
22239 !! html
22240 <dl><dt>;foo</dt></dl>
22241 <dl><dt>:foo</dt></dl>
22242 <dl><dt>:foo</dt>
22243 <dd>bar</dd></dl>
22244 <dl><dd>:foo</dd></dl>
22245
22246 !!end
22247
22248 !! test
22249 Lists: 3. Only bullets at start of text should be escaped
22250 !! wikitext
22251 *<nowiki>*foo*bar</nowiki>
22252
22253 *<nowiki>*foo</nowiki>''it''*bar
22254 !! html
22255 <ul><li>*foo*bar</li></ul>
22256 <ul><li>*foo<i>it</i>*bar</li></ul>
22257
22258 !!end
22259
22260 !! test
22261 Lists: 4. No escapes needed
22262 !! options
22263 parsoid
22264 !! wikitext
22265 *foo*bar
22266
22267 *''foo''*bar
22268
22269 *[[Foo]]: bar
22270
22271 *[[Foo]]*bar
22272 !! html
22273 <ul>
22274 <li>foo*bar
22275 </li>
22276 </ul>
22277 <ul>
22278 <li><i>foo</i>*bar
22279 </li>
22280 </ul>
22281 <ul>
22282 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22283 </li>
22284 </ul>
22285 <ul>
22286 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22287 </li>
22288 </ul>
22289 !!end
22290
22291 !! test
22292 Lists: 5. No unnecessary escapes
22293 !! wikitext
22294 * bar <span><nowiki>[[foo]]</nowiki></span>
22295
22296 * =bar <span><nowiki>[[foo]]</nowiki></span>
22297
22298 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22299
22300 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22301
22302 * =bar <span>foo]]</span>=
22303
22304 * <s></s>: a
22305
22306 * ''* foo''
22307 !! html
22308 <ul><li> bar <span>[[foo]]</span></li></ul>
22309 <ul><li> =bar <span>[[foo]]</span></li></ul>
22310 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22311 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22312 <ul><li> =bar <span>foo]]</span>=</li></ul>
22313 <ul><li> <s></s>: a</li></ul>
22314 <ul><li> <i>* foo</i></li></ul>
22315
22316 !!end
22317
22318 !! test
22319 Lists: 6. Escape bullets in SOL position
22320 !! options
22321 parsoid=html2wt
22322 !! html/parsoid
22323 <p><!--cmt-->*foo</p>
22324 !! wikitext
22325 <!--cmt--><nowiki>*</nowiki>foo
22326 !!end
22327
22328 !! test
22329 Lists: 7. Escape bullets in a multi-line context
22330 !! wikitext
22331 a
22332 <nowiki>*</nowiki>b
22333 !! html
22334 <p>a
22335 *b
22336 </p>
22337 !!end
22338
22339 !! test
22340 Lists: 8. Escape colons only if not present in tags
22341 !! options
22342 parsoid=html2wt
22343 !! html/parsoid
22344 <dl><dt>a:b<i>c:d</i></dt></dl>
22345 !! wikitext
22346 ; <nowiki>a:b</nowiki>''c:d''
22347 !! end
22348
22349 #### --------------- HRs ---------------
22350 #### 1. Single line
22351 #### -----------------------------------
22352
22353 !! test
22354 HRs: 1. Single line
22355 !! wikitext
22356 ----<nowiki>----</nowiki>
22357 ----=foo=
22358 ----*foo
22359 !! html+tidy
22360 <hr />
22361 <p>----</p>
22362 <hr />
22363 <p>=foo=</p>
22364 <hr />
22365 <p>*foo</p>
22366 !! end
22367
22368 #### --------------- Tables ---------------
22369 #### 1a. Simple example
22370 #### 1b. No escaping needed (!foo)
22371 #### 1c. No escaping needed (|foo)
22372 #### 1d. No escaping needed (|}foo)
22373 ####
22374 #### 2a. Nested in td (<td>foo|bar</td>)
22375 #### 2b. Nested in td (<td>foo||bar</td>)
22376 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22377 ####
22378 #### 3a. Nested in th (<th>foo!bar</th>)
22379 #### 3b. Nested in th (<th>foo!!bar</th>)
22380 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22381 ####
22382 #### 4a. Escape -
22383 #### 4b. Escape +
22384 #### 4c. No escaping needed
22385 #### --------------------------------------
22386
22387 !! test
22388 Tables: 1a. Simple example
22389 !! wikitext
22390 <nowiki>{|
22391 |}</nowiki>
22392 !! html
22393 <p>{|
22394 |}
22395 </p>
22396 !! end
22397
22398 !! test
22399 Tables: 1b. No escaping needed
22400 !! wikitext
22401 !foo
22402 !! html
22403 <p>!foo
22404 </p>
22405 !! end
22406
22407 !! test
22408 Tables: 1c. No escaping needed
22409 !! wikitext
22410 |foo
22411 !! html
22412 <p>|foo
22413 </p>
22414 !! end
22415
22416 !! test
22417 Tables: 1d. No escaping needed
22418 !! wikitext
22419 |}foo
22420 !! html
22421 <p>|}foo
22422 </p>
22423 !! end
22424
22425 !! test
22426 Tables: 2a. Nested in td
22427 !! options
22428 parsoid=html2wt
22429 !! html/parsoid
22430 <table><tbody><tr>
22431 <td>foo|bar</td></tr>
22432 <tr><td>x<div>a|b</div></td>
22433 </tbody></table>
22434 !! wikitext
22435 {|
22436 |<nowiki>foo|bar</nowiki>
22437 |-
22438 |x<div><nowiki>a|b</nowiki></div>
22439 |}
22440 !! html/php+tidy
22441 <table>
22442 <tr>
22443 <td>foo|bar</td>
22444 </tr>
22445 <tr>
22446 <td>x
22447 <div>a|b</div>
22448 </td>
22449 </tr>
22450 </table>
22451 !! end
22452
22453 !! test
22454 Tables: 2b. Nested in td
22455 !! options
22456 parsoid=html2wt
22457 !! html/parsoid
22458 <table><tbody><tr>
22459 <td>foo||bar</td>
22460 <td>a<i>b||c</i></td>
22461 <td>a<i><div>b||c</div></i></td>
22462 </tr></tbody></table>
22463 !! wikitext
22464 {|
22465 |<nowiki>foo||bar</nowiki>
22466 |a''<nowiki>b||c</nowiki>''
22467 |a''<div><nowiki>b||c</nowiki></div>''
22468 |}
22469 !! html/php
22470 <table>
22471 <tr>
22472 <td>foo||bar
22473 </td>
22474 <td>a<i>b||c</i>
22475 </td>
22476 <td>a<i><div>b||c</div></i>
22477 </td></tr></table>
22478
22479 !! end
22480
22481 !! test
22482 Tables: 2c. Nested in td -- no escaping needed
22483 !! wikitext
22484 {|
22485
22486 |foo!!bar
22487 |}
22488 !! html/*
22489 <table>
22490
22491 <tr>
22492 <td>foo!!bar
22493 </td></tr></table>
22494
22495 !! end
22496
22497 !! test
22498 Tables: 3a. Nested in th
22499 !! wikitext
22500 {|
22501
22502 !foo!bar
22503 |}
22504 !! html/*
22505 <table>
22506
22507 <tr>
22508 <th>foo!bar
22509 </th></tr></table>
22510
22511 !! end
22512
22513 !! test
22514 Tables: 3b. Nested in th
22515 !! options
22516 parsoid=html2wt
22517 !! html/parsoid
22518 <table><tbody>
22519 <tr><th>foo!!bar</th>
22520 <th><i>foo|bar</i></th>
22521 <th><i>foo!!bar</i></th>
22522 <th><i><span>foo!!bar</span></i></th>
22523 </tr></tbody></table>
22524 !! wikitext
22525 {|
22526 !<nowiki>foo!!bar</nowiki>
22527 !''<nowiki>foo|bar</nowiki>''
22528 !''<nowiki>foo!!bar</nowiki>''
22529 !''<span><nowiki>foo!!bar</nowiki></span>''
22530 |}
22531 !! html/php
22532 <table>
22533 <tr>
22534 <th>foo!!bar
22535 </th>
22536 <th><i>foo|bar</i>
22537 </th>
22538 <th><i>foo!!bar</i>
22539 </th>
22540 <th><i><span>foo!!bar</span></i>
22541 </th></tr></table>
22542
22543 !! end
22544
22545 !! test
22546 Tables: 3c. Nested in th
22547 !! options
22548 parsoid=html2wt
22549 !! html/parsoid
22550 <table><tbody>
22551 <tr><th>foo||bar</th>
22552 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22553 </tr></tbody></table>
22554 !! wikitext
22555 {|
22556 !<nowiki>foo||bar</nowiki>
22557 !<nowiki>foo||bar</nowiki>
22558 |}
22559 !! html/php
22560 <table>
22561 <tr>
22562 <th>foo||bar
22563 </th>
22564 <th>foo||bar
22565 </th></tr></table>
22566
22567 !! end
22568
22569 !! test
22570 Tables: 4a. Escape -
22571 !! options
22572 parsoid=html2wt
22573 !! html/*
22574 <table>
22575
22576 <tr>
22577 <th>-bar
22578 </th></tr>
22579 <tr>
22580 <td>-bar
22581 </td></tr></table>
22582
22583 !! wikitext
22584 {|
22585
22586 !-bar
22587
22588 |-
22589 |<nowiki>-bar</nowiki>
22590 |}
22591 !! end
22592
22593 !! test
22594 Tables: 4b. Escape +
22595 !! options
22596 parsoid=html2wt
22597 !! html/*
22598 <table>
22599
22600 <tr>
22601 <th>+bar
22602 </th></tr>
22603 <tr>
22604 <td>+bar
22605 </td></tr></table>
22606
22607 !! wikitext
22608 {|
22609
22610 !+bar
22611
22612 |-
22613 |<nowiki>+bar</nowiki>
22614 |}
22615 !! end
22616
22617 !! test
22618 Tables: 4c. No escaping needed
22619 !! wikitext
22620 {|
22621 |foo-bar
22622 |foo+bar
22623 |-
22624 |''foo''-bar
22625 |''foo''+bar
22626 |-
22627 |foo
22628 bar|baz
22629 +bar
22630 -bar
22631 |-
22632 |x
22633 <div>a|b</div>
22634 |}
22635 !! html/php
22636 <table>
22637 <tr>
22638 <td>foo-bar
22639 </td>
22640 <td>foo+bar
22641 </td></tr>
22642 <tr>
22643 <td><i>foo</i>-bar
22644 </td>
22645 <td><i>foo</i>+bar
22646 </td></tr>
22647 <tr>
22648 <td>foo
22649 <p>bar|baz
22650 +bar
22651 -bar
22652 </p>
22653 </td></tr>
22654 <tr>
22655 <td>x
22656 <div>a|b</div>
22657 </td></tr></table>
22658
22659 !! html/parsoid
22660 <table><tbody>
22661 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22662 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22663 <tr><td>foo
22664 <p>bar|baz
22665 +bar
22666 -bar</p></td></tr>
22667 <tr><td>x
22668 <div>a|b</div></td>
22669 </tbody></table>
22670 !! end
22671
22672 !! test
22673 Tables: 4d. No escaping needed
22674 !! wikitext
22675 {|
22676 |[[Foo]]-bar
22677 ||+1
22678 ||-2
22679 |}
22680 !! html/php
22681 <table>
22682 <tr>
22683 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22684 </td>
22685 <td>+1
22686 </td>
22687 <td>-2
22688 </td></tr></table>
22689
22690 !! html/parsoid
22691 <table>
22692 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22693 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22694 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22695 </tbody></table>
22696 !! end
22697
22698 !! test
22699 Tables: Digest broken attributes on table and tr tag
22700 !! options
22701 parsoid=wt2html
22702 !! wikitext
22703 {| || |} ++
22704 |- || || ++ --
22705 |- > [
22706 |}
22707 !! html
22708 <table>
22709 <tbody>
22710 <tr></tr>
22711 <tr></tr>
22712 </tbody></table>
22713 !! end
22714
22715 !! test
22716 T97430: Don't emit empty nowiki pairs around marker meta tags
22717 !! options
22718 parsoid=html2wt
22719 !! html/parsoid
22720 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22721 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22722 !! wikitext
22723 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22724 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22725 !! end
22726
22727 !! test
22728 Unclosed xmlish element in table line shouldn't eat end delimiters
22729 !! wikitext
22730 {|
22731 | <foo
22732 | bar>
22733 |}
22734 !! html/php
22735 <table>
22736 <tr>
22737 <td> &lt;foo
22738 </td>
22739 <td> bar&gt;
22740 </td></tr></table>
22741
22742 !! html/parsoid
22743 <table>
22744 <tbody><tr><td> &lt;foo</td>
22745 <td> bar></td></tr>
22746 </tbody></table>
22747 !! end
22748
22749 #### --------------- Links ----------------
22750 #### 1. Quote marks in link text
22751 #### 2. Wikilinks: Escapes needed
22752 #### 3. Wikilinks: No escapes needed
22753 #### 4. Extlinks: Escapes needed
22754 #### 5. Extlinks: No escapes needed
22755 #### --------------------------------------
22756 !! test
22757 Links 1. WikiLinks: No escapes needed
22758 !! wikitext
22759 [[Foo|Foo''boo'']]
22760 [[Foo|[Foobar]]]
22761 [[Foo|x [Foobar] x]]
22762 !! html/php
22763 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22764 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22765 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22766 </p>
22767 !! html/parsoid
22768 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22769 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22770 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22771 !! end
22772
22773 !! test
22774 Links 2. WikiLinks: Escapes needed
22775 !! options
22776 parsoid=html2wt
22777 !! html/parsoid
22778 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22779 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22780 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22781 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22782 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22783 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22784 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22785 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22786 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22787 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22788 !! wikitext
22789 [[Foo|<nowiki>Foobar]</nowiki>]]
22790 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22791 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22792 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22793 [[Foo|<nowiki>|Bar</nowiki>]]
22794 [[Foo|<nowiki>]]bar</nowiki>]]
22795 [[Foo|<nowiki>[[bar</nowiki>]]
22796 [[Foo|<nowiki>x [[ y</nowiki>]]
22797 [[Foo|<nowiki>x ]] y</nowiki>]]
22798 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22799 !! html/php
22800 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22801 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22802 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22803 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22804 <a href="/wiki/Foo" title="Foo">|Bar</a>
22805 <a href="/wiki/Foo" title="Foo">]]bar</a>
22806 <a href="/wiki/Foo" title="Foo">[[bar</a>
22807 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22808 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22809 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22810 </p>
22811 !! end
22812
22813 !! test
22814 Links 3. WikiLinks: No escapes needed
22815 !! wikitext
22816 [[Foo|[Foobar]]
22817 [[Foo|foo|bar]]
22818 !! html/php
22819 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22820 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22821 </p>
22822 !! html/parsoid
22823 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22824 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22825 !! end
22826
22827 !! test
22828 Links 4. ExtLinks: Escapes needed
22829 !! options
22830 parsoid=html2wt
22831 !! html/parsoid
22832 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22833 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22834 <p>[http://google.com]</p>
22835 <p>[http://google.com google]</p>
22836 !! wikitext
22837 [http://google.com <nowiki>[google]</nowiki>]
22838 [http://google.com <nowiki>google]</nowiki>]
22839
22840 <nowiki>[http://google.com]</nowiki>
22841
22842 <nowiki>[http://google.com google]</nowiki>
22843
22844 !! html/php
22845 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22846 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22847 </p><p>[http://google.com]
22848 </p><p>[http://google.com google]
22849 </p>
22850 !! end
22851
22852 !! test
22853 Links 5. ExtLinks: No escapes needed
22854 !! wikitext
22855 [http://google.com [google]
22856 !! html/php
22857 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22858 </p>
22859 !! html/parsoid
22860 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22861 !! end
22862
22863 !! test
22864 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22865 !! html/parsoid
22866 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22867 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22868 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22869 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22870 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22871 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22872 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22873 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22874 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22875 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22876 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22877 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22878 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22879 </p>
22880 !! wikitext
22881 x<nowiki/>http://example.com<nowiki/>y
22882 http://example.com<nowiki/>?x
22883 http://example.com<nowiki/>&x
22884 http://example.com<nowiki/>'x
22885 http://example.com<nowiki/>,x
22886 http://example.com<nowiki/>.x
22887 http://example.com<nowiki/>;x
22888 http://example.com<nowiki/>:x
22889 http://example.com<nowiki/>;x
22890 http://example.com<nowiki/>!x
22891 http://example.com<nowiki/>=x
22892 http://example.com<nowiki/>(x)
22893 http://example.com(x<nowiki/>)
22894 !! end
22895
22896 !! test
22897 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22898 !! html/parsoid
22899 <p>x
22900 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22901 y
22902 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22903 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22904 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22905 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22906 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22907 </p>
22908 !! wikitext
22909 x
22910 http://example.com
22911 y
22912 "http://example.com"
22913 (http://example.com)
22914 (http://example.com) foo
22915 http://example.com,
22916 http://example.com, foo
22917 !! html/php
22918 <p>x
22919 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22920 y
22921 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22922 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22923 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22924 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22925 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22926 </p>
22927 !! end
22928
22929 !! test
22930 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22931 !! html/parsoid
22932 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22933 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22934 !! wikitext
22935 http://example.com.,;:!?\
22936 -http://example.com:
22937 !! html/php
22938 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22939 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22940 </p>
22941 !! end
22942
22943 !! test
22944 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22945 !! html/parsoid
22946 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22947 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22948 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22949 !! wikitext
22950 RFC 123<nowiki/>4
22951 RFC 123<nowiki/>y
22952 X<nowiki/>RFC 123<nowiki/>y
22953 !! end
22954
22955 !! test
22956 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22957 !! html/parsoid
22958 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22959 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22960 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22961 </p>
22962 !! wikitext
22963 RFC 123?foo
22964 RFC 123&foo
22965 -RFC 123-
22966 !! html/php
22967 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22968 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22969 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22970 </p>
22971 !! end
22972
22973 !! test
22974 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22975 !! html/parsoid
22976 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22977 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22978 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22979 !! wikitext
22980 PMID 123<nowiki/>4
22981 PMID 123<nowiki/>y
22982 X<nowiki/>PMID 123<nowiki/>y
22983 !! end
22984
22985 !! test
22986 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22987 !! html/parsoid
22988 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22989 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22990 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22991 </p>
22992 !! wikitext
22993 PMID 123?foo
22994 PMID 123&foo
22995 -PMID 123-
22996 !! html/php
22997 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22998 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22999 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23000 </p>
23001 !! end
23002
23003 !! test
23004 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23005 !! html/parsoid
23006 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23007 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23008 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23009 </p>
23010 !! wikitext
23011 ISBN 1234567890<nowiki/>1
23012 ISBN 1234567890<nowiki/>x
23013 a<nowiki/>ISBN 1234567890<nowiki/>b
23014 !! end
23015
23016 !! test
23017 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23018 !! html/parsoid
23019 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23020 !! wikitext
23021 -ISBN 1234567890's
23022 !! html/php
23023 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23024 </p>
23025 !! end
23026
23027 !! test
23028 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23029 !! options
23030 parsoid=html2wt
23031 !! html/*
23032 <p>this is not a link: http://example.com
23033 </p>
23034 !! wikitext
23035 <nowiki>this is not a link: http://example.com</nowiki>
23036 !! end
23037
23038 !! test
23039 Links 15. Link trails can't become link prefixes.
23040 !! options
23041 language=is
23042 !! wikitext
23043 [[Söfnuður]]-[[00]]
23044 !! html/php
23045 <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>
23046 </p>
23047 !! html/parsoid
23048 <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>
23049 !! end
23050
23051 #### --------------- Quotes ---------------
23052 #### 1. Quotes inside <b> and <i>
23053 #### 2. Link fragments separated by <i> and <b> tags
23054 #### 3. Link fragments inside <i> and <b>
23055 #### 4. No escaping needed
23056 #### --------------------------------------
23057 !! test
23058 1a. Quotes inside <b> and <i>
23059 !! options
23060 parsoid=html2wt,wt2wt
23061 !! wikitext
23062 ''<nowiki/>'foo'''
23063 ''<nowiki>''foo''</nowiki>''
23064 ''<nowiki>'''foo'''</nowiki>''
23065 ''foo''<nowiki/>'s
23066 '''<nowiki/>'foo''''
23067 '''<nowiki>''foo''</nowiki>'''
23068 '''<nowiki>'''foo'''</nowiki>'''
23069 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23070 '''foo'''<nowiki/>'s
23071 '''foo''
23072 ''foo''<nowiki/>'
23073 ''foo'''<nowiki/>'
23074 '''foo''<nowiki/>'
23075 ''''foo'''
23076 '''foo'''<nowiki/>'
23077 ''''foo'''<nowiki/>'
23078 ''fools'<span> errand</span>''
23079 ''<span>fool</span>'s errand''
23080 '<nowiki/>''foo'' bar '''baz''
23081 a|!*#-:;+-~[]{}b'''x''
23082 !! html/*
23083 <p><i>'foo'</i>
23084 <i>''foo''</i>
23085 <i>'''foo'''</i>
23086 <i>foo</i>'s
23087 <b>'foo'</b>
23088 <b>''foo''</b>
23089 <b>'''foo'''</b>
23090 <b>foo'<i>bar'</i>baz</b>
23091 <b>foo</b>'s
23092 '<i>foo</i>
23093 <i>foo</i>'
23094 <i>foo'</i>'
23095 '<i>foo</i>'
23096 '<b>foo</b>
23097 <b>foo</b>'
23098 '<b>foo</b>'
23099 <i>fools'<span> errand</span></i>
23100 <i><span>fool</span>'s errand</i>
23101 '<i>foo</i> bar '<i>baz</i>
23102 a|!*#-:;+-~[]{}b'<i>x</i>
23103 </p>
23104 !! end
23105
23106 !! test
23107 1b. Quotes inside <b> and <i> with other tags on same line
23108 !! options
23109 parsoid=html2wt,wt2wt
23110 !! wikitext
23111 '''a'' foo ''[[bar]]''
23112 ''a''' foo ''[[bar]]''
23113 ''a''' foo '''{{echo|[[bar]]}}'''
23114 [[foo]] x'''[[bar]]''
23115 '''foo'' <ref>test</ref>
23116 '''foo'' <div title="name">test</div>
23117 '''foo'' and <br> bar
23118 <references />
23119 !! html
23120 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23121 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23122 <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>
23123 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23124 '<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>
23125 '<i>foo</i> <div title="name">test</div>
23126 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23127 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23128 <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>
23129 </ol>
23130 !! end
23131
23132 !! test
23133 2. Link fragments separated by <i> and <b> tags
23134 !! wikitext
23135 [[''foo''<nowiki>hello]]</nowiki>
23136
23137 [['''foo'''<nowiki>hello]]</nowiki>
23138 !! html
23139 <p>[[<i>foo</i>hello]]
23140 </p><p>[[<b>foo</b>hello]]
23141 </p>
23142 !! end
23143
23144 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23145 # this is one of the shortcomings of this format
23146 !! test
23147 3. Link fragments inside <i> and <b>
23148 !! wikitext
23149 ''[[foo''<nowiki>]]</nowiki>
23150
23151 '''[[foo'''<nowiki>]]</nowiki>
23152 !! html
23153 <p><i>[[foo</i>]]
23154 </p><p><b>[[foo</b>]]
23155 </p>
23156 !! end
23157
23158 !! test
23159 4. No escaping needed
23160 !! wikitext
23161 '<span>''bar''</span>'
23162 '<span>'''bar'''</span>'
23163 'a:b'foo
23164 !! html
23165 <p>'<span><i>bar</i></span>'
23166 '<span><b>bar</b></span>'
23167 'a:b'foo
23168 </p>
23169 !! end
23170
23171 #### ----------- Paragraphs ---------------
23172 #### 1. No unnecessary escapes
23173 #### --------------------------------------
23174
23175 !! test
23176 1. No unnecessary escapes
23177 !! wikitext
23178 bar <span><nowiki>[[foo]]</nowiki></span>
23179
23180 =bar <span><nowiki>[[foo]]</nowiki></span>
23181
23182 [[bar <span><nowiki>[[foo]]</nowiki></span>
23183
23184 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23185
23186 =bar <span>foo]]</span><nowiki>=</nowiki>
23187 !! html
23188 <p>bar <span>[[foo]]</span>
23189 </p><p>=bar <span>[[foo]]</span>
23190 </p><p>[[bar <span>[[foo]]</span>
23191 </p><p>]]bar <span>[[foo]]</span>
23192 </p><p>=bar <span>foo]]</span>=
23193 </p>
23194 !!end
23195
23196 #### ----------------------- PRE --------------------------
23197 #### 1. Leading whitespace in SOL context should be escaped
23198 #### ------------------------------------------------------
23199 !! test
23200 1. Leading whitespace in SOL context should be escaped
23201 !! options
23202 parsoid=html2wt,wt2wt
23203 !! html/php
23204 <p> a
23205 </p><p> a
23206 </p><p> a(tab)
23207 </p><p> a
23208 a
23209 </p><p>a
23210 b
23211 </p><p>a
23212 b
23213 </p><p>a
23214 b
23215 </p>
23216 !! html/parsoid
23217 <p> a</p>
23218
23219 <p> a</p>
23220
23221 <p> a(tab)</p>
23222
23223 <p> a
23224 <!--cmt-->
23225 a</p>
23226
23227 <p>a
23228 b</p>
23229
23230 <p>a
23231 b</p>
23232
23233 <p>a
23234 b</p>
23235 !! wikitext
23236 <nowiki> </nowiki>a
23237
23238 <nowiki> </nowiki> a
23239
23240 a(tab)
23241
23242 <nowiki> </nowiki> a
23243 <!--cmt-->
23244 <nowiki> </nowiki>a
23245
23246 a
23247 <nowiki> </nowiki>b
23248
23249 a
23250 b
23251
23252 a
23253 b
23254 !! end
23255
23256 !! test
23257 2. Leading whitespace in non-indent-pre contexts should not be escaped
23258 !! options
23259 parsoid
23260 !! wikitext
23261 foo <ref>''a''
23262 b</ref>
23263 <references />
23264 !! html
23265 <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>
23266 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23267 <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>
23268 b</span></li>
23269 </ol>
23270 !! end
23271
23272 !! test
23273 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23274 !! options
23275 parsoid
23276 !! wikitext
23277 <blockquote>
23278 a
23279 <span>b</span>
23280 c
23281 </blockquote>
23282 !! html
23283 <blockquote>
23284 <p>
23285 a
23286 <span>b</span>
23287 c</p>
23288 </blockquote>
23289 !! end
23290
23291 !! test
23292 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23293 !! options
23294 parsoid
23295 !! wikitext
23296 [[File:Foobar.jpg|thumb|caption]]
23297 !! html/parsoid
23298 <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>
23299 !! end
23300
23301 !! test
23302 5. Nowiki escaping should account for indent-pres
23303 !! options
23304 parsoid=html2wt
23305 !! html/parsoid
23306 <pre>==foo==</pre>
23307 !! wikitext
23308 ==foo==
23309 !! end
23310
23311 !!test
23312 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23313 !! options
23314 parsoid
23315 !! wikitext
23316 * foo
23317 * bar
23318 !! html
23319 <pre>
23320 * foo
23321 * bar
23322 </pre>
23323 !! end
23324
23325 #### --------------- Behavior Switches --------------------
23326
23327 !! test
23328 1. Valid behavior switches should be escaped
23329 !! options
23330 parsoid=html2wt
23331 !! html/parsoid
23332 __TOC__
23333 <i>__TOC__</i>
23334 !! wikitext
23335 <nowiki>__TOC__</nowiki>
23336 ''<nowiki>__TOC__</nowiki>''
23337 !! end
23338
23339 !! test
23340 2. Invalid behavior switches should not be escaped
23341 !! options
23342 parsoid=html2wt
23343 !! html/parsoid
23344 __TOO__
23345 __|__
23346 !! wikitext
23347 __TOO__
23348 __|__
23349 !! end
23350
23351 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23352 !! test
23353 Behavior switches should be SOL-transparent
23354 !! wikitext
23355 __TOC__
23356
23357 <!-- this one's bogus -->
23358 __TOO__
23359
23360 __TOC__ foo
23361
23362 __TOC__ bar
23363 !! html/parsoid
23364 <meta property="mw:PageProp/toc" />
23365
23366 <!-- this one's bogus -->
23367 <pre>__TOO__</pre>
23368
23369 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23370
23371 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23372 !! end
23373
23374 #### --------------- HTML tags ---------------
23375 #### 1. a tags
23376 #### 2. other tags
23377 #### 3. multi-line html tag
23378 #### 4. extension tags
23379 #### -----------------------------------------
23380 !! test
23381 1. a tags
23382 !! options
23383 parsoid
23384 !! wikitext
23385 <a href="http://google.com">google</a>
23386 !! html
23387 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23388 !! end
23389
23390 !! test
23391 2. other tags
23392 !! wikitext
23393 * <nowiki><div>foo</div></nowiki>
23394 * <nowiki><div style="color:red">foo</div></nowiki>
23395 * <nowiki><td></nowiki>
23396 !! html
23397 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23398 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23399 <li> &lt;td&gt;</li></ul>
23400
23401 !! end
23402
23403 !! test
23404 3. multi-line html tag
23405 !! wikitext
23406 <nowiki><div
23407 >foo</div
23408 ></nowiki>
23409 !! html
23410 <p>&lt;div
23411 &gt;foo&lt;/div
23412 &gt;
23413 </p>
23414 !! end
23415
23416 !! test
23417 4. extension tags
23418 !! wikitext
23419 <nowiki><ref>foo</ref></nowiki>
23420
23421 <nowiki><ref>bar</nowiki>
23422
23423 baz<nowiki></ref></nowiki>
23424 !! html
23425 <p>&lt;ref&gt;foo&lt;/ref&gt;
23426 </p><p>&lt;ref&gt;bar
23427 </p><p>baz&lt;/ref&gt;
23428 </p>
23429 !! end
23430
23431 #### --------------- Others ---------------
23432 !! test
23433 Escaping nowikis
23434 !! wikitext
23435 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23436 !! html
23437 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23438 </p>
23439 !! end
23440
23441 ## The quote-char in the input is necessary for triggering the bug
23442 !! test
23443 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23444 !! options
23445 parsoid=wt2wt,html2wt
23446 !! wikitext
23447 foo's bar :
23448 !! html
23449 <p>foo's bar :</p>
23450 !! end
23451
23452 !! test
23453
23454 Tag-like HTML structures are passed through as text
23455 !! wikitext
23456 <x y>
23457
23458 <x.y>
23459
23460 <x-y>
23461
23462 1>2
23463
23464 x<y
23465
23466 a>b
23467
23468 1<d e>f
23469 !! html
23470 <p>&lt;x y&gt;
23471 </p><p>&lt;x.y&gt;
23472 </p><p>&lt;x-y&gt;
23473 </p><p>1&gt;2
23474 </p><p>x&lt;y
23475 </p><p>a&gt;b
23476 </p><p>1&lt;d e&gt;f
23477 </p>
23478 !! end
23479
23480 !! test
23481 HTML tag with necessary entities in attributes
23482 !! wikitext
23483 <span title="&amp;amp;">foo</span>
23484 !! html
23485 <p><span title="&amp;amp;">foo</span>
23486 </p>
23487 !! end
23488
23489 !! test
23490 HTML tag with 'unnecessary' entity encoding in attributes
23491 !! wikitext
23492 <span title="&amp;">foo</span>
23493 !! html
23494 <p><span title="&amp;">foo</span>
23495 </p>
23496 !! end
23497
23498 !! test
23499 HTML tag with broken attribute value quoting
23500 !! wikitext
23501 <span title="Hello world>Foo</span>
23502 !! html/php
23503 <p><span title="Hello world">Foo</span>
23504 </p>
23505 !! html/parsoid
23506 <p><span title="Hello world">Foo</span>
23507 </p>
23508 !! end
23509
23510 !! test
23511 Table with broken attribute value quoting
23512 !! wikitext
23513 {|
23514 | title="Hello world|Foo
23515 |}
23516 !! html/php
23517 <table>
23518 <tr>
23519 <td title="Hello world">Foo
23520 </td></tr></table>
23521
23522 !! html/parsoid
23523 <table>
23524 <tr>
23525 <td title="Hello world">Foo
23526 </td></tr></table>
23527
23528 !! end
23529
23530 !! test
23531 Table with broken attribute value quoting on consecutive lines
23532 !! wikitext
23533 {|
23534 | title="Hello world|Foo
23535 | style="color:red|Bar
23536 |}
23537 !! html/php
23538 <table>
23539 <tr>
23540 <td title="Hello world">Foo
23541 </td>
23542 <td style="color:red">Bar
23543 </td></tr></table>
23544
23545 !! html/parsoid
23546 <table><tbody>
23547 <tr>
23548 <td title="Hello world">Foo
23549 </td><td style="color: red">Bar
23550 </td></tr></tbody></table>
23551
23552 !! end
23553
23554 !! test
23555 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23556 !! options
23557 parsoid
23558 !! wikitext
23559 {{}}
23560 !! html
23561 {{}}
23562 !! end
23563
23564 !! test
23565 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23566 !! options
23567 parsoid
23568 !! wikitext
23569 }}{{
23570 !! html
23571 }}{{
23572 !! end
23573
23574 !!test
23575 Accept empty td cell attribute
23576 !! wikitext
23577 {|
23578 | align="center" | foo || |
23579 |}
23580 !! html
23581 <table>
23582 <tr>
23583 <td align="center"> foo </td>
23584 <td>
23585 </td></tr></table>
23586
23587 !!end
23588
23589 !!test
23590 Non-empty attributes in th-cells
23591 !! wikitext
23592 {|
23593 ! Foo !! style="color: red" | Bar
23594 |}
23595 !! html
23596 <table>
23597 <tr>
23598 <th> Foo </th>
23599 <th style="color: red"> Bar
23600 </th></tr></table>
23601
23602 !!end
23603
23604 !!test
23605 Accept empty attributes in th-cells
23606 !! wikitext
23607 {|
23608 !| foo !!| bar
23609 |}
23610 !! html
23611 <table>
23612 <tr>
23613 <th> foo </th>
23614 <th> bar
23615 </th></tr></table>
23616
23617 !!end
23618
23619 !!test
23620 Empty table rows go away
23621 !! wikitext
23622 {|
23623 | Hello
23624 | there
23625 |- class="foo"
23626 |-
23627 |}
23628 !! html
23629 <table>
23630 <tr>
23631 <td> Hello
23632 </td>
23633 <td> there
23634 </td></tr>
23635
23636 </table>
23637
23638 !! end
23639
23640 ###
23641 ### Parsoid-centric tests for testing RTing of inter-element separators
23642 ### Edge cases not tested by existing parser tests and specific to
23643 ### Parsoid-specific serialization strategies.
23644 ###
23645
23646 !!test
23647 RT-ed inter-element separators should be valid separators
23648 !! wikitext
23649 {|
23650 |- [[foo]]
23651 |}
23652 !! html
23653 <table>
23654
23655 </table>
23656
23657 !!end
23658
23659 # Parsoid-only since PHP parser relies on Tidy for correct output
23660 !!test
23661 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23662 !!options
23663 parsoid
23664 !! wikitext
23665 {|
23666 |<small>foo
23667 bar
23668 |}
23669
23670 {|
23671 |<small>foo<small>
23672 |}
23673 !! html
23674 <table>
23675 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23676 <p>bar</p></small></td></tr>
23677 </tbody></table>
23678
23679 <table>
23680 <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>
23681 </tbody></table>
23682 !!end
23683
23684 # Note that the "style" attribute is really a template parameter here.
23685 # The = would have to be {{=}} if you wanted the literal.
23686 !!test
23687 Empty TD followed by TD with tpl-generated attribute
23688 !! wikitext
23689 {|
23690 |-
23691 |
23692 |{{echo|style='color:red'}}|foo
23693 |}
23694 !! html
23695 <table>
23696
23697 <tr>
23698 <td>
23699 </td>
23700 <td>foo
23701 </td></tr></table>
23702
23703 !!end
23704
23705 !!test
23706 Indented table with an empty td
23707 !! wikitext
23708 {|
23709 |-
23710 |
23711 |foo
23712 |}
23713 !! html
23714 <table>
23715
23716 <tr>
23717 <td>
23718 </td>
23719 <td>foo
23720 </td></tr></table>
23721
23722 !!end
23723
23724 ## We have some newline diffs RT-ing this edge case
23725 ## and it is not important enough -- we seem to be emitting
23726 ## at most 2 newlines after a </tr> and this is unrelated to
23727 ## the issue from T85627 that this is testing.
23728 !!test
23729 Indented table with blank lines in between (T85627)
23730 !! options
23731 parsoid=wt2html
23732 !! wikitext
23733 {|
23734 |foo
23735
23736
23737 |}
23738 !! html
23739 <table>
23740
23741 <tr>
23742 <td>foo
23743 </td></tr></table>
23744
23745 !!end
23746
23747 !!test
23748 Indented block & table
23749 !! wikitext
23750 <div>foo</div>
23751 {|
23752 |foo
23753 |}
23754 !! html/php
23755 <div>foo</div>
23756 <table>
23757 <tr>
23758 <td>foo
23759 </td></tr></table>
23760
23761 !! html/parsoid
23762 <div data-parsoid='{"stx":"html"}'>foo</div>
23763 <table><tbody>
23764 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23765 </tbody></table>
23766 !!end
23767
23768 !! test
23769 Indent and comment before table row
23770 !! wikitext
23771 {|
23772 <!--hi-->|-
23773 | there
23774 |}
23775 !! html/php
23776 <table>
23777
23778 <tr>
23779 <td> there
23780 </td></tr></table>
23781
23782 !! html/parsoid
23783 <table>
23784 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23785 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23786 </tbody></table>
23787 !! end
23788
23789 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23790 !!test
23791 Empty TR followed by a template-generated TR
23792 !!options
23793 parsoid
23794 !! wikitext
23795 {|
23796 |-
23797 {{echo|<tr><td>foo</td></tr>}}
23798 |}
23799 !! html
23800 <table>
23801 <tbody>
23802 <tr></tr>
23803 <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}}]}'>
23804 <td>foo</td></tr>
23805 </tbody></table>
23806 !!end
23807
23808 ## PHP and parsoid output differ for this, and since this is primarily
23809 ## for testing Parsoid's serializer, marking this Parsoid only
23810 !!test
23811 Empty TR followed by mixed-ws-comment line should RT correctly
23812 !!options
23813 parsoid
23814 !! wikitext
23815 {|
23816 |-
23817 <!--c-->
23818 |-
23819 <!--c--> <!--d-->
23820 |}
23821 !! html
23822 <table>
23823 <tbody>
23824 <tr></tr>
23825 <!--c-->
23826 <tr>
23827 <!--c--> </tr><!--d-->
23828 </tbody></table>
23829
23830 !!end
23831
23832 !!test
23833 Multi-line image caption generated by templates with/without trailing newlines
23834 !! wikitext
23835 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23836 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23837 !! html/parsoid
23838 <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>
23839 <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>
23840 !!end
23841
23842 !! test
23843 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23844 !! options
23845 parsoid=html2wt
23846 !! html/parsoid
23847 <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>
23848
23849 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23850 !! wikitext
23851 <includeonly>foo</includeonly>
23852 new para
23853
23854 [[Category:Foo]]
23855
23856 = new heading =
23857 !! end
23858
23859 ## PHP emits broken html for this, and since this is primarily
23860 ## a Parsoid serializer test, marking this Parsoid only
23861 !!test
23862 Improperly nested inline or quotes tags with whitespace in between
23863 !! wikitext
23864 <span> <s>x</span> </s>
23865 ''' ''x''' ''
23866 !! html/parsoid
23867 <p><span> <s>x</s></span><s> </s>
23868 <b> <i>x</i></b><i> </i>
23869 </p>
23870 !!end
23871
23872 !!test
23873 Encapsulate protected attributes from wt
23874 !! wikitext
23875 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23876 !! html/parsoid
23877 <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>
23878 </body>
23879 !!end
23880
23881 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23882 ## Having nested or stray pre tags results in the attempt to add duplicates,
23883 ## causing an assertion fail. This test tries to prevent that situation.
23884 !!test
23885 Ensure ParagraphWrapper can deal with stray closing pre tags
23886 !!options
23887 parsoid=wt2html
23888 !! wikitext
23889 plain text</pre>
23890 !! html/parsoid
23891 plain text
23892 !!end
23893
23894 !!test
23895 1. Ensure fostered text content is wrapped in element nodes
23896 !!options
23897 parsoid=wt2html
23898 !! wikitext
23899 <table>hi</table><table>ho</table>
23900 !! html/parsoid
23901 <p>hi</p>
23902 <table></table>
23903 <p>ho</p>
23904 <table></table>
23905 !!end
23906
23907 !!test
23908 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23909 !!options
23910 parsoid=wt2html,wt2wt
23911 !! wikitext
23912 <table>
23913 <tr> || ||
23914 <td> a
23915 </table>
23916 !! html/parsoid
23917 <p> || ||
23918 </p><table>
23919 <tbody><tr><td> a</td></tr>
23920 </tbody></table>
23921 !!end
23922
23923 !!test
23924 Encapsulation properly handles null DSR information from foster box
23925 !!options
23926 parsoid=wt2html,wt2wt
23927 !! wikitext
23928 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23929 !! html/parsoid
23930 <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>
23931 !!end
23932
23933 !!test
23934 1. Encapsulate foster-parented transclusion content
23935 !!options
23936 parsoid=wt2wt,wt2html
23937 !! wikitext
23938 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23939 !! html/parsoid
23940 <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>
23941 <tbody>
23942 <tr>
23943 <td>bar</td>
23944 </tr>
23945 </tbody>
23946 </table>
23947 !!end
23948
23949 !!test
23950 2. Encapsulate foster-parented transclusion content
23951 !!options
23952 parsoid=wt2wt,wt2html
23953 !! wikitext
23954 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23955 !! html/parsoid
23956 <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>
23957 <table>
23958 <tbody>
23959 <tr>
23960 <td>bar</td>
23961 </tr>
23962 </tbody>
23963 </table>
23964 !!end
23965
23966 !!test
23967 3. Encapsulate foster-parented transclusion content
23968 !!options
23969 parsoid=wt2wt,wt2html
23970 !! wikitext
23971 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23972 !! html/parsoid
23973 <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;]}">
23974 <p>foo</p>
23975 </div>
23976 <table>
23977 <tbody>
23978 <tr>
23979 <td>bar</td>
23980 </tr>
23981 </tbody>
23982 </table>
23983 !!end
23984
23985 !!test
23986 4. Encapsulate foster-parented transclusion content
23987 !!options
23988 parsoid=wt2wt,wt2html
23989 !! wikitext
23990 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23991 !! html/parsoid
23992 <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;]}">
23993 <p>foo</p>
23994 </div>
23995 <table>
23996 <tbody>
23997 <tr>
23998 <td>bar</td>
23999 </tr>
24000 </tbody>
24001 </table>
24002 !!end
24003
24004 !!test
24005 5. Encapsulate foster-parented transclusion content
24006 !!options
24007 parsoid=wt2wt,wt2html
24008 !! wikitext
24009 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24010 !! html/parsoid
24011 <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>
24012 <table>
24013 <tbody>
24014 <tr>
24015 <td>
24016 <div>
24017 <p>foo</p>
24018 </div>
24019 </td>
24020 </tr>
24021 </tbody>
24022 </table>
24023 !!end
24024
24025 !!test
24026 6. Encapsulate foster-parented transclusion content
24027 !!options
24028 parsoid=wt2wt,wt2html
24029 !! wikitext
24030 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24031 !! html/parsoid
24032 <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>
24033 <table>
24034 <tbody>
24035 <tr>
24036 <td>
24037 <div>
24038 <p>foo</p>
24039 </div>
24040 </td>
24041 </tr>
24042 </tbody>
24043 </table>
24044 <p>ok</p>
24045 !!end
24046
24047 !!test
24048 7. Encapsulate foster-parented transclusion content
24049 !!options
24050 parsoid=wt2wt,wt2html
24051 !! wikitext
24052 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24053 !! html/parsoid
24054 <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>
24055 <table>
24056 <tbody>
24057 <tr>
24058 <td>bar</td>
24059 </tr>
24060 </tbody>
24061 </table>
24062 !!end
24063
24064 # Note that the wt is broken on purpose: the = should be {{=}} if you
24065 # don't want it to be a template parameter key.
24066 !!test
24067 8. Encapsulate foster-parented transclusion content
24068 !!options
24069 parsoid=wt2wt,wt2html
24070 !! wikitext
24071 {{echo|a
24072 }}{|{{echo|style='color:red'}}
24073 |-
24074 |b
24075 |}
24076 !! html/parsoid
24077 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24078 <span> </span>
24079 <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>
24080 <table>
24081 <tbody>
24082 <tr>
24083 <td>b</td>
24084 </tr>
24085 </tbody>
24086 </table>
24087 !!end
24088
24089 !!test
24090 9. Encapsulate foster-parented transclusion content
24091 !!options
24092 parsoid=wt2wt,wt2html
24093 !! wikitext
24094 <table>{{echo|hi</table>hello}}
24095 !! html/parsoid
24096 <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>
24097 !!end
24098
24099 !!test
24100 Table in fosterable position
24101 !!options
24102 parsoid=wt2html,wt2wt
24103 !! wikitext
24104 {{OpenTable}}
24105 <div>
24106 {|
24107 |}
24108 </div>
24109 |}
24110 !! html/parsoid
24111 <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">
24112 </span>
24113 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24114
24115 <table>
24116 </table>
24117 !!end
24118
24119 # Parsoid only for bug 64747
24120 !! test
24121 Properly encapsulate empty-content transclusions in fosterable positions
24122 !! wikitext
24123 <table>
24124 {{#if:|
24125 <td>foo</td>
24126 }}
24127 </table>
24128 !! html/parsoid
24129 <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":["","","",""]}]]}'>
24130
24131 </table>
24132 !! end
24133
24134 !!test
24135 Support <object> element with .data attribute
24136 !!options
24137 parsoid=html2wt
24138 !! html/parsoid
24139 <object data="test.swf"></object>
24140 !! wikitext
24141 <object data="test.swf"></object>
24142 !!end
24143
24144 !! test
24145 Don't block XML namespace declaration
24146 !! wikitext
24147 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24148 !! html/php
24149 <p><span>MediaWiki</span>
24150 </p>
24151 !! html/parsoid
24152 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24153 !! end
24154
24155 # -----------------------------------------------------------------
24156 # The following section of tests are primarily to spec requirements
24157 # around serialization of new/edited content.
24158 #
24159 # All these tests are marked Parsoid html2wt and html2html only
24160 # ----------------------------------------------------------------
24161
24162 # 'mi' is a localinterwiki prefix as well as a language
24163 !! test
24164 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24165 !! options
24166 parsoid=html2wt
24167 !! html/parsoid
24168 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24169 !! wikitext
24170 [[Foo]]
24171 !! end
24172
24173 # See T93839
24174 !! test
24175 New wikilinks should be serialized properly
24176 !! options
24177 parsoid=html2wt
24178 !! html/parsoid
24179 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24180 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24181 !! wikitext
24182 [[Foo]]
24183 [[Foo]]
24184 !! end
24185
24186 !! test
24187 New wiki links (href variations)
24188 !! options
24189 parsoid=html2wt
24190 !! html/parsoid
24191 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24192 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24193 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24194 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24195 !! wikitext
24196 [[Foo_bar]]
24197 [[Foo_bar]]
24198 [[Foo_bar]]
24199 [[Toxine bactérienne]]
24200 !! end
24201
24202 !! test
24203 New wiki links (content string variations)
24204 !! options
24205 parsoid=html2wt
24206 !! html/parsoid
24207 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24208 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24209 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24210 !! wikitext
24211 [[Foo_bar]]
24212 [[Foo bar]]
24213 [[Foo_bar|./Foo_bar]]
24214 !! end
24215
24216 !! test
24217 New category links (href variations)
24218 !! options
24219 parsoid=html2wt
24220 !! html/parsoid
24221 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24222 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24223 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24224 !! wikitext
24225 [[Category:Toxine bactérienne]]
24226 [[Category:Toxine bactérienne]]
24227 [[Category:Toxine bactérienne]]
24228 !! end
24229
24230 !! test
24231 New sol transparent links don't need indent-pre nowiki protection
24232 !! options
24233 parsoid=html2wt
24234 language=de
24235 !! html/parsoid
24236 <link rel="mw:PageProp/redirect" href="./Main_Page">
24237 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24238 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24239 !! wikitext
24240 #WEITERLEITUNG [[Main Page]]
24241 <!-- this is good --> [[Category:Good]]
24242 <!-- this is great --> [[Kategorie:Great]]
24243 !! end
24244
24245 !! test
24246 New interlanguage links (href variations)
24247 !! options
24248 parsoid=html2wt
24249 !! html/parsoid
24250 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24251 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24252 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24253 !! wikitext
24254 [[es:Toxine bactérienne]]
24255 [[es:Toxine_bactérienne]]
24256 [[es:Toxine_bactérienne]]
24257 !! end
24258
24259 !! test
24260 Image: Modifying size of an image (1)
24261 !! options
24262 parsoid={
24263 "modes": ["wt2wt"],
24264 "changes": [
24265 ["img[height]", "attr", "height", "22"],
24266 ["img[width]", "attr", "width", "200"]
24267 ]
24268 }
24269 !! wikitext
24270 [[Image:Foobar.jpg|230x230px]]
24271 !! wikitext/edited
24272 [[Image:Foobar.jpg|200x200px]]
24273 !!end
24274
24275 !! test
24276 Image: Modifying size of an image (2)
24277 !! options
24278 parsoid={
24279 "modes": ["wt2wt"],
24280 "changes": [
24281 ["img[height]", "attr", "height", "100"],
24282 ["img[width]", "attr", "width", "500"]
24283 ]
24284 }
24285 !! wikitext
24286 [[Image:Foobar.jpg|230x230px]]
24287 !! wikitext/edited
24288 [[Image:Foobar.jpg|500x500px]]
24289 !!end
24290
24291 # Change in size is ignored so long as class='mw-default-size'
24292 !! test
24293 Image: Modifying size of an image (3)
24294 !! options
24295 parsoid={
24296 "modes": ["wt2wt"],
24297 "changes": [
24298 ["figure[class]", "removeClass", "mw-default-size"],
24299 ["figure img", "attr", "height", "19"],
24300 ["figure img", "attr", "width", "170"]
24301 ]
24302 }
24303 !! wikitext
24304 [[Image:Foobar.jpg|thumb]]
24305 !! wikitext/edited
24306 [[Image:Foobar.jpg|thumb|170x170px]]
24307 !!end
24308
24309 !! test
24310 Image: Modifying alignment of an image (bug 48665)
24311 !! options
24312 parsoid={
24313 "modes": ["wt2wt"],
24314 "changes": [
24315 ["figure[class]", "removeClass", "mw-halign-right"],
24316 ["figure[class]", "addClass", "mw-halign-left"]
24317 ]
24318 }
24319 !! wikitext
24320 [[Image:Foobar.jpg|thumb|caption|right]]
24321 !! wikitext/edited
24322 [[Image:Foobar.jpg|thumb|caption|left]]
24323 !! end
24324
24325 !! test
24326 Image: Modifying mw-default-size of an frameless image (bug 62805)
24327 !! options
24328 parsoid={
24329 "modes": ["wt2wt"],
24330 "changes": [
24331 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24332 ]
24333 }
24334 !! wikitext
24335 [[Image:Foobar.jpg|frameless|right]]
24336 !! wikitext/edited
24337 [[Image:Foobar.jpg|frameless|right|220x220px]]
24338 !! end
24339
24340 !! test
24341 Image: Modifying valign of an image (bug 49221)
24342 !! options
24343 parsoid={
24344 "modes": ["wt2wt"],
24345 "changes": [
24346 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24347 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24348 ]
24349 }
24350 !! wikitext
24351 [[File:Foobar.jpg|20px|middle]]
24352 !! wikitext/edited
24353 [[File:Foobar.jpg|20px|text-top]]
24354 !! end
24355
24356 !! test
24357 Image: Modifying alt attribute of an image (bug 56400)
24358 !! options
24359 parsoid={
24360 "modes": ["wt2wt"],
24361 "changes": [
24362 ["img[alt]", "attr", "alt", "some alternate edited text"]
24363 ]
24364 }
24365 !! wikitext
24366 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24367 !! wikitext/edited
24368 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24369 !!end
24370
24371 !! test
24372 Image: Modifying caption of an image
24373 !! options
24374 parsoid={
24375 "modes": ["wt2wt"],
24376 "changes": [
24377 ["figcaption", "text", "new caption"]
24378 ]
24379 }
24380 !! wikitext
24381 [[Image:Foobar.jpg|thumb|original caption]]
24382 !! wikitext/edited
24383 [[Image:Foobar.jpg|thumb|new caption]]
24384 !!end
24385
24386 !! test
24387 Image: empty alt attribute (bug 48924)
24388 !! options
24389 parsoid
24390 !! wikitext
24391 [[File:Foobar.jpg|thumb|alt=|bar]]
24392 !! html
24393 <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>
24394 !! end
24395
24396 !! test
24397 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24398 !! options
24399 parsoid=html2wt
24400 language=ar
24401 disabled
24402 !! html/parsoid
24403 <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>
24404 !! wikitext
24405 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24406 !! end
24407
24408 !! test
24409 Image: Block level image should have \n before and after
24410 !! wikitext
24411 123
24412 [[File:Foobar.jpg|right|thumb|150x150px]]
24413 456
24414 !! html/parsoid
24415 <p>123</p>
24416 <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>
24417 <p>456</p>
24418 !!end
24419
24420 !! test
24421 Image: New block level image should have \n before and after (existing content)
24422 !! wikitext
24423 123
24424 [[File:Foobar.jpg|right|thumb|150x150px]]
24425 456
24426 !! html/parsoid
24427 <p>123</p>
24428 <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>
24429 <p>456</p>
24430 !!end
24431
24432 !! test
24433 Image: upright option (parsoid)
24434 !! wikitext
24435 [[File:Foobar.jpg|thumb|upright|caption]]
24436 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24437 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24438 !! html/parsoid
24439 <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>
24440 <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>
24441 <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>
24442 !!end
24443
24444 !! test
24445 Image: upright option is ignored on inline and frame images (parsoid)
24446 !! wikitext
24447 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24448 !! html/parsoid
24449 <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>
24450 !!end
24451
24452 !! test
24453 Image: from basic HTML (1)
24454 !! options
24455 parsoid=html2wt
24456 !! html/parsoid
24457 <span typeof="mw:Image">
24458 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24459 </span>
24460 !! wikitext
24461 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24462 !! end
24463
24464 !! test
24465 Image: from basic HTML (2)
24466 !! options
24467 parsoid=html2wt
24468 !! html/parsoid
24469 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24470 !! wikitext
24471 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24472 !! end
24473
24474 !! test
24475 Image: from basic HTML (3)
24476 !! options
24477 parsoid=html2wt
24478 !! html/parsoid
24479 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24480 !! wikitext
24481 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24482 !! end
24483
24484 !! test
24485 Image: from basic HTML (4)
24486 !! options
24487 parsoid=html2wt
24488 !! html/parsoid
24489 <img src="./File:Foobar.jpg">
24490 !! wikitext
24491 [[File:Foobar.jpg|link=]]
24492 !! end
24493
24494 !! test
24495 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24496 !! options
24497 parsoid=html2wt
24498 !! html/parsoid
24499 <ul>
24500 <li><p>foo</p></li>
24501 </ul>
24502 !! wikitext
24503 * foo
24504 !! end
24505
24506 !! test
24507 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24508 !! options
24509 parsoid=html2wt
24510 !! html/parsoid
24511 <ul> <li>foo</li></ul>
24512 !! wikitext
24513 * foo
24514 !! end
24515
24516 !! test
24517 Don't strip leading whitespace when handling indent-pre suppressing tags
24518 !! options
24519 parsoid=html2wt
24520 !! html/parsoid
24521 <table>
24522 <tr><td> indented row</td></tr>
24523 </table>
24524 <blockquote><p>
24525 <b>This is very bold of you!</b>
24526 </p>
24527 <table><tr><td>
24528 indented cell (no pre-wrapping!)
24529 </td></tr></table>
24530 </blockquote>
24531 <p>foo</p>
24532 <div>bar</div>
24533 !! wikitext
24534 {|
24535 | indented row
24536 |}
24537 <blockquote>
24538 '''This is very bold of you!'''
24539
24540 {|
24541 |
24542 indented cell (no pre-wrapping!)
24543 |}
24544 </blockquote>
24545 foo
24546 <div>bar</div>
24547 !! end
24548
24549 !! test
24550 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24551 !! options
24552 parsoid=html2wt
24553 !! html/parsoid
24554 <p>foo</p>
24555 <span>bar</span>
24556
24557 <span>foo2
24558 </span>bar2
24559
24560 <div>foo</div>
24561 <span>bar</span>
24562
24563 <div>
24564 <span>foo</span>
24565 </div>
24566 !! wikitext
24567 foo
24568 <nowiki> </nowiki><span>bar</span>
24569
24570 <span>foo2
24571 <nowiki> </nowiki></span>bar2
24572
24573 <div>foo</div>
24574 <nowiki> </nowiki><span>bar</span>
24575
24576 <div>
24577 <nowiki> </nowiki><span>foo</span>
24578 </div>
24579 !! end
24580
24581 !! test
24582 Lists: Dont insert newlines in a serialized list item.
24583 !! options
24584 parsoid=html2wt
24585 !! html/parsoid
24586 <ul><li>a<br>b</li><li>c</li></ul>
24587 !! wikitext
24588 * a<br>b
24589 * c
24590 !! end
24591
24592 !! test
24593 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24594 !! options
24595 parsoid={
24596 "modes": ["html2wt"],
24597 "scrubWikitext": false
24598 }
24599 !! html/parsoid
24600 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24601 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24602
24603 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24604 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24605
24606 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24607
24608 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24609 !! wikitext
24610 == hello there [[Category:A1]] ==
24611
24612 == [[Category:A2]] hi pal ==
24613
24614 == <!--foo--> [[Category:A3]] how goes it ==
24615
24616 == it goes well [[Category:A4]] <!--bar--> ==
24617
24618 ==howdy [[Category:A5]] ==
24619
24620 == __TOC__ ok ==
24621 !! end
24622
24623 !! test
24624 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24625 !! options
24626 parsoid={
24627 "modes": ["html2wt"],
24628 "scrubWikitext": true
24629 }
24630 !! html/parsoid
24631 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24632 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24633
24634 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24635 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24636
24637 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24638 !! wikitext
24639 == hello there ==
24640 [[Category:A1]]
24641 [[Category:A2]]
24642
24643 == hi pal ==
24644
24645 <!--foo--> [[Category:A3]]
24646
24647 == how goes it ==
24648
24649 == it goes well ==
24650 [[Category:A4]] <!--bar-->
24651
24652 __TOC__
24653
24654 == ok ==
24655 !! end
24656
24657 !! test
24658 Headings: Don't hoist metas that come from templates
24659 !! options
24660 parsoid={
24661 "modes": ["html2wt"],
24662 "scrubWikitext": true
24663 }
24664 !! html/parsoid
24665 <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>
24666 !! wikitext
24667 == {{echo|foo [[Category:Foo]]}} ==
24668 !! end
24669
24670 !! test
24671 Headings: Category in ref isn't hoisted
24672 !! options
24673 parsoid={
24674 "modes": ["html2wt"],
24675 "scrubWikitext": true
24676 }
24677 !! html/parsoid
24678 <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>
24679
24680 <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>
24681 !! wikitext
24682 == foo <ref>bar
24683 [[Category:Baz]] </ref> ==
24684
24685 <references />
24686 !! end
24687
24688 !! test
24689 Parsoid: Serialize positional parameters with = in them as named parameter
24690 !! options
24691 parsoid=html2wt
24692 !! html/parsoid
24693 <p about="#mwt1" typeof="mw:Transclusion"
24694 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24695
24696 <p about="#mwt1" typeof="mw:Transclusion"
24697 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24698
24699 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24700 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24701 <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>
24702 !! wikitext
24703 {{echo|1 = f=oo}}
24704
24705 {{echo|1 = f=oo|2 = bar}}
24706
24707 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24708 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24709 {{echo|<nowiki>f=oo</nowiki>|bar}}
24710 !! end
24711
24712 !! test
24713 Parsoid: Serialize positional parameters with = in extlink as named parameter
24714 !! options
24715 parsoid=html2wt
24716 !! html/parsoid
24717 <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>
24718 !! wikitext
24719 {{echo|1 = http://stuff?is=ok}}
24720 !! end
24721
24722 !! test
24723 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24724 !! options
24725 parsoid=html2wt
24726 !! html/parsoid
24727 <div>a<p>b</p></div>
24728 <div>a
24729 <p>b</p></div>
24730 <div>
24731 a
24732 <p>b</p></div>
24733 !! wikitext
24734 <div>a
24735 b
24736 </div>
24737 <div>a
24738 b
24739 </div>
24740 <div>
24741 a
24742
24743 b
24744 </div>
24745 !! end
24746
24747 !! test
24748 Substrings resembling wikitext in hrefs should not get nowiki escapes
24749 !! options
24750 parsoid=html2wt
24751 !! html/parsoid
24752 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24753 !! wikitext
24754 [[Foo''bar''baz]]
24755 !! end
24756
24757 !! test
24758 Enforce single-line context in the serializer
24759 !! options
24760 parsoid=html2wt
24761 !! html/parsoid
24762 <h2>testing
24763 123</h2>
24764
24765 <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">
24766 </span><span about="#mwt1">you</span> </h2>
24767
24768 <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>
24769
24770 <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
24771 there</span></li></ol>
24772
24773 <ul><li>asd
24774 sdf</li></ul>
24775
24776 <ul><li>foo
24777 bar
24778 baz</li>
24779 <li>foo <b>bar</b>
24780 baz</li></ul>
24781
24782 <dl><dt>hi
24783 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24784 ho</dd></dl>
24785
24786 <dl><dd> <table>
24787 <tbody><tr><td> ha
24788 ha
24789 ha</td></tr>
24790 </tbody></table></dd></dl>
24791 !! wikitext
24792 == testing 123 ==
24793
24794 == hi {{bogus|there
24795 you}} ==
24796
24797 == foo <ref>hello
24798 there</ref> ==
24799
24800 <references />
24801
24802 * asd sdf
24803
24804 * foo bar baz
24805 * foo '''bar''' baz
24806
24807 ; hi ho : hi ho
24808
24809 : {|
24810 | ha
24811 ha
24812 ha
24813 |}
24814 !! end
24815
24816 !! test
24817 Serialize new placeholder space without spans
24818 !! options
24819 parsoid=html2wt
24820 !! html/parsoid
24821 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24822
24823 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24824
24825 <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>
24826 !! wikitext
24827 foo : bar
24828
24829 foo : bar
24830
24831 <ref>foo : bar</ref>ok
24832 !! end
24833
24834
24835 #-----------------------
24836 # Tag minimization tests
24837 #-----------------------
24838
24839 !! test
24840 1. I/B quote minimization: wikitext-only tags should be combined
24841 !! options
24842 parsoid=html2wt
24843 !! html/parsoid
24844 <p><i>A</i><i>B</i></p>
24845 <p><b>A</b><b>B</b></p>
24846 <p><i>A</i><b><i>B</i></b></p>
24847 <p><b>A</b><i><b>B</b></i></p>
24848 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24849 <p><i><b>A</b></i><i><b>B</b></i></p>
24850 <p><i><b>A</b></i><b><i>B</i></b></p>
24851 <p><b><i>A</i></b><i><b>B</b></i></p>
24852 !! wikitext
24853 ''AB''
24854
24855 '''AB'''
24856
24857 ''A'''B'''''
24858
24859 '''A''B'''''
24860
24861 '''A''BC''D'''
24862
24863 '''''AB'''''
24864
24865 '''''AB'''''
24866
24867 '''''AB'''''
24868 !! end
24869
24870 !! test
24871 2. I/B quote minimization: wikitext and html tags should not be combined
24872 !! options
24873 parsoid=html2wt
24874 !! html/parsoid
24875 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24876 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24877 !! wikitext
24878 ''A''<i>B</i>
24879
24880 ''A''<nowiki/>'''<i>B</i>'''
24881 !! end
24882
24883 !! test
24884 3. I/B quote minimization: templated content stops minimization
24885 !! options
24886 parsoid=html2wt
24887 !! html/parsoid
24888 <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>
24889 <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>
24890 !! wikitext
24891 ''A''{{echo|''B''}}
24892
24893 ''A''{{echo|'''''B'''''}}
24894 !! end
24895
24896 !! test
24897 4. I/B quote minimization: new content should be mimimized with adjacent old content
24898 !! options
24899 parsoid=html2wt
24900 !! html/parsoid
24901 <p><i>A</i><i>B</i></p>
24902 <p><b>A</b><b>B</b></p>
24903 <p><i>A</i><b><i>B</i></b></p>
24904 !! wikitext
24905 ''AB''
24906
24907 '''AB'''
24908
24909 ''A'''B'''''
24910 !! end
24911
24912 !! test
24913 5a. Merge adjacent quote nodes if they've been edited
24914 !! options
24915 parsoid={
24916 "modes": ["wt2wt", "selser"],
24917 "changes": [
24918 ["p", "contents", "remove", ":contains('b')"]
24919 ]
24920 }
24921 !! wikitext
24922 ''a''b''c''
24923 !! wikitext/edited
24924 ''ac''
24925 !! end
24926
24927 !! test
24928 5b. Merge adjacent quote nodes if they've been edited
24929 !! options
24930 parsoid={
24931 "modes": ["wt2wt", "selser"],
24932 "changes": [
24933 ["#x", "remove"]
24934 ]
24935 }
24936 !! wikitext
24937 ''a''<span id="x">b</span>''c''
24938 !! wikitext/edited
24939 ''ac''
24940 !! end
24941
24942 !! test
24943 1. Merge adjacent link nodes as long as at least one element is new
24944 !! options
24945 parsoid={
24946 "modes": ["html2wt"],
24947 "scrubWikitext": true
24948 }
24949 !! html/parsoid
24950 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24951 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24952 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24953 !! wikitext
24954 [[Football]]
24955 [[Football]]
24956 [[Football|Foot]][[Football|ball]]
24957 !! end
24958
24959 !! test
24960 2. Merge adjacent link nodes and enable additional normalizations
24961 !! options
24962 parsoid={
24963 "modes": ["html2wt"],
24964 "scrubWikitext": true
24965 }
24966 !! html/parsoid
24967 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24968 !! wikitext
24969 [[Football|''Football'']]
24970 !! end
24971
24972 !! test
24973 3. Don't merge adjacent link nodes if scrubWikitext is false
24974 !! options
24975 parsoid={
24976 "modes": ["html2wt"],
24977 "scrubWikitext": false
24978 }
24979 !! html/parsoid
24980 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24981 !! wikitext
24982 [[Football|Foot]][[Football|ball]]
24983 !! end
24984
24985 #------------------------------
24986 # End of tag minimization tests
24987 #------------------------------
24988
24989 !!test
24990 Bug 54262: New entities
24991 !! options
24992 parsoid=html2wt
24993 !! html/parsoid
24994 <span typeof="mw:Entity">&nbsp;</span>
24995 !! wikitext
24996 &nbsp;
24997 !! end
24998
24999 ## Note that there is no wikitext output for 'unknownproperty' ##
25000 ## Unknown magic words are silently dropped ##
25001
25002 !! test
25003 Magic words
25004 !! options
25005 parsoid=html2wt
25006 !! html/parsoid
25007 <meta property='mw:PageProp/toc' />
25008 <meta property='mw:PageProp/notoc' />
25009 <meta property='mw:PageProp/forcetoc' />
25010 <meta property='mw:PageProp/index' />
25011 <meta property='mw:PageProp/noindex' />
25012 <meta property='mw:PageProp/nogallery' />
25013 <meta property='mw:PageProp/noeditsection' />
25014 <meta property='mw:PageProp/notitleconvert' />
25015 <meta property='mw:PageProp/nocontentconvert' />
25016 <meta property='mw:PageProp/unknownproperty' />
25017 !! wikitext
25018 __TOC__
25019 __NOTOC__
25020 __FORCETOC__
25021 __INDEX__
25022 __NOINDEX__
25023 __NOGALLERY__
25024 __NOEDITSECTION__
25025 __NOTITLECONVERT__
25026 __NOCONTENTCONVERT__
25027 !! end
25028
25029 !! test
25030 Consecutive <pre>s should not get merged
25031 !! options
25032 parsoid=html2wt,html2html
25033 !! html/parsoid
25034 <pre>a</pre><pre>b</pre>
25035
25036 <pre>c
25037 </pre><pre>
25038 d</pre>
25039
25040 <pre>e
25041
25042 </pre><pre>
25043
25044 f</pre>
25045 !! wikitext
25046 a
25047
25048 b
25049
25050 c
25051
25052 d
25053
25054 e
25055
25056
25057
25058 f
25059 !! end
25060
25061 !! test
25062 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25063 !! options
25064 parsoid=html2wt
25065 !! html/parsoid
25066 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25067 !! wikitext
25068 [[Special:BookSources/1234567890|ISBN 1234567895]]
25069 !! end
25070
25071 !! test
25072 Edited RFC links not serializable as RFC links should serialize as extlinks
25073 !! options
25074 parsoid=html2wt
25075 !! html/parsoid
25076 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25077 !! wikitext
25078 [//tools.ietf.org/html/rfc123 New RFC]
25079 !! end
25080
25081 !! test
25082 Edited PMID links not serializable as PMID links should serialize as extlinks
25083 !! options
25084 parsoid=html2wt
25085 !! html/parsoid
25086 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25087 !! wikitext
25088 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25089 !! end
25090
25091 !! test
25092 WTS of autolinks with trailing/surrounding context
25093 !! options
25094 parsoid=html2wt
25095 !! html/parsoid
25096 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25097 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25098 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25099 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25100 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25101 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25102 !! wikitext
25103 http://cscott.net<nowiki/>'''foo'''
25104
25105 http://cscott.net<b>foo</b>
25106
25107 '''http://cscott.net<nowiki/>'''
25108
25109 '''http://cscott.net '''
25110
25111 '''http://cscott.net<nowiki/>x'''
25112
25113 http://cscott.net<nowiki/>x
25114 !! end
25115
25116 !! test
25117 WTS of autolinks with nowikis (round-trip)
25118 !! wikitext
25119 x<nowiki/>http://cscott.net<nowiki/>x
25120 !! html/parsoid
25121 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25122 !! end
25123
25124 # this is the "easy" test because it leaves in place all the
25125 # data-parsoid information indicating this is an autolink
25126 !! test
25127 WTS of autolinks with escapes (editing)
25128 !! options
25129 parsoid={
25130 "modes": ["wt2wt"],
25131 "changes": [
25132 [ "meta", "remove" ]
25133 ]
25134 }
25135 !! wikitext
25136 x<nowiki/>http://cscott.net<nowiki/>x
25137 !! wikitext/edited
25138 x<nowiki/>http://cscott.net<nowiki/>x
25139 !! end
25140
25141 !! test
25142 WTS of edited autolink-like text (T103364)
25143 !! options
25144 parsoid={
25145 "modes": ["wt2wt"],
25146 "changes": [
25147 [ "span[typeof]", "removeAttr", "typeof" ]
25148 ]
25149 }
25150 !! wikitext
25151 Not a link: <nowiki>http://example.com</nowiki>.
25152 !! wikitext/edited
25153 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25154 !! end
25155
25156 !! test
25157 WTS of newly-authored autolink-like text (T103364)
25158 !! options
25159 parsoid=html2wt
25160 !! html/parsoid
25161 <p>http://example.com is not a link.</p>
25162 !! wikitext
25163 <nowiki>http://example.com is not a link.</nowiki>
25164 !! end
25165
25166 !! test
25167 WTS of autolink-like text after an autolink (T108563)
25168 !! options
25169 parsoid=html2wt
25170 !! html/parsoid
25171 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25172 !! wikitext
25173 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25174 !! end
25175
25176 !! test
25177 Magic links inside links (not autolinked)
25178 !! wikitext
25179 [[Foo|http://example.com]]
25180 [[Foo|RFC 1234]]
25181 [[Foo|PMID 1234]]
25182 [[Foo|ISBN 123456789x]]
25183
25184 [http://foo.com http://example.com]
25185 [http://foo.com RFC 1234]
25186 [http://foo.com PMID 1234]
25187 [http://foo.com ISBN 123456789x]
25188 !! html+tidy
25189 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
25190 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
25191 !! html/parsoid
25192 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25193 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25194 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25195 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25196
25197 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25198 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25199 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25200 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25201 !! end
25202
25203 !! test
25204 Magic links inside image captions (autolinked)
25205 !! wikitext
25206 [[File:Foobar.jpg|thumb|http://example.com]]
25207 [[File:Foobar.jpg|thumb|RFC 1234]]
25208 [[File:Foobar.jpg|thumb|PMID 1234]]
25209 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25210 !! html+tidy
25211 <div class="thumb tright">
25212 <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>
25213 <div class="thumbcaption">
25214 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25215 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25216 </div>
25217 </div>
25218 <div class="thumb tright">
25219 <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>
25220 <div class="thumbcaption">
25221 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25222 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25223 </div>
25224 </div>
25225 <div class="thumb tright">
25226 <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>
25227 <div class="thumbcaption">
25228 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25229 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25230 </div>
25231 </div>
25232 <div class="thumb tright">
25233 <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>
25234 <div class="thumbcaption">
25235 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25236 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25237 </div>
25238 </div>
25239 !! html/parsoid
25240 <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>
25241 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
25242 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
25243 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
25244 !! end
25245
25246 !! test
25247 WTS of magic word text (T109371)
25248 !! options
25249 parsoid=html2wt
25250 !! html/parsoid
25251 <p>RFC 1234</p>
25252 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25253 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25254 !! wikitext
25255 <nowiki>RFC 1234</nowiki>
25256
25257 [http://foo.com RFC 1234]
25258
25259 [[Foo|RFC 1234]]
25260 !! end
25261
25262 !! test
25263 Edited Redirect link should emit a non-piped wikitext link
25264 !! options
25265 parsoid=html2wt
25266 !! html/parsoid
25267 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25268 !! wikitext
25269 #REDIRECT [[Bar]]
25270 !! end
25271
25272 !! test
25273 T75121: Infer extension name from typeOf if data-mw is not present
25274 !! options
25275 parsoid=html2wt
25276 !! html/parsoid
25277 <div typeOf="mw:Extension/foo"></div>
25278 !! wikitext
25279 <foo />
25280 !! end
25281
25282 # Note that the <p> wrapping isn't present in PHP parser output
25283 # The important thing for this test is that P-wrapping doesn't
25284 # interfere with the <nowiki> protection for leading - in <td>
25285 # (which isn't necessary for <th>).
25286 !! test
25287 T88318: p-wrapped dash in table.
25288 !! options
25289 parsoid=html2wt,wt2wt
25290 !! html/parsoid
25291 <table><tbody>
25292 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25293 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25294 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25295 </tbody></table>
25296 !! wikitext
25297 {|
25298 !-
25299 !-
25300 |-
25301 |<nowiki>-</nowiki>
25302 |<nowiki>- </nowiki>
25303 |-
25304 |<small>-</small>
25305 |<br>
25306 -
25307 |<br>
25308 -
25309 |}
25310 !! html/php+tidy
25311 <table>
25312 <tr>
25313 <th>-</th>
25314 <th>-</th>
25315 </tr>
25316 <tr>
25317 <td>-</td>
25318 <td>-</td>
25319 </tr>
25320 <tr>
25321 <td><small>-</small></td>
25322 <td><br />
25323 <p>-</p>
25324 </td>
25325 <td><br />
25326 <p>-</p>
25327 </td>
25328 </tr>
25329 </table>
25330 !! end
25331
25332 !! test
25333 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25334 !! options
25335 parsoid=html2wt
25336 !! html/parsoid
25337 <table id='mwAb'>
25338 <td id='mwAc'>foo</td>
25339 <td id='serialize-this'>bar</td>
25340 </table>
25341 !! wikitext
25342 {|
25343 |foo
25344 | id="serialize-this" |bar
25345 |}
25346 !! end
25347
25348 !! test
25349 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25350 !! options
25351 parsoid=html2wt
25352 !! html/parsoid
25353 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25354 !! wikitext
25355 <div id="hello">ok</div>
25356 !! end
25357
25358 !! test
25359 WTS change modes
25360 !! options
25361 parsoid={
25362 "modes": ["wt2wt"],
25363 "changes": [
25364 [ "#xyz", "before", "<b>before</b> stuff " ],
25365 [ "#xyz", "after", " stuff <i>after</i>" ],
25366 [ "#xyz", "html", "x <b>y</b> z" ]
25367 ]
25368 }
25369 !! wikitext
25370 <span id="xyz">hello</span>
25371 !! wikitext/edited
25372 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25373 !! end
25374
25375 !! test
25376 Never serialize a-tag as html, regardless of what data-parsoid has to say
25377 !! options
25378 parsoid=html2wt
25379 !! html/parsoid
25380 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25381 !! wikitext
25382 [[Foo]]
25383 !! end
25384
25385 ## SSS FIXME: This is broken output nevertheless.
25386 ## What might be a reasonable non-broken output for this?
25387 ## This is an edge case unlikely to be seen in production
25388 ## that I am not wasting more time on this right now.
25389 !! test
25390 Never serialize a-tag as html, no matter what attributes it has
25391 !! options
25392 parsoid=html2wt
25393 !! html/parsoid
25394 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25395 !! wikitext
25396 [http://boo.org http://boohoo.org]
25397 !! end
25398
25399 # Misnested is an indication that selser can reuse the source but these have
25400 # shown to sneak through on occasion. See T101768.
25401 # The original wikitext here is: [http://test.com [[one]] two three]
25402 !! test
25403 Strip span tags added to mark as misnested
25404 !! options
25405 parsoid=html2wt
25406 !! html/parsoid
25407 <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>
25408 !! wikitext
25409 [http://test.com][[one]] two three
25410 !! end
25411
25412 # --------------------------------------------
25413 # Tests spec'ing wikitext serialization norms |
25414 # --------------------------------------------
25415
25416 !! test
25417 Lists: Add space after bullets
25418 !! options
25419 parsoid=html2wt
25420 !! html/parsoid
25421 <ul>
25422 <li>foo</li>
25423 <li> bar</li>
25424 <li><span> baz</span></li>
25425 </ul>
25426 !! wikitext
25427 * foo
25428 * bar
25429 * <span> baz</span>
25430 !! end
25431
25432 !! test
25433 1. Headings: Add space before/after == (T53744)
25434 !! options
25435 parsoid=html2wt
25436 !! html/parsoid
25437 <h2>foo</h2>
25438 <h2> bar</h2>
25439 <h2>baz </h2>
25440 <h2><span> baz</span></h2>
25441 !! wikitext
25442 == foo ==
25443
25444 == bar ==
25445
25446 == baz ==
25447
25448 == <span> baz</span> ==
25449 !! end
25450
25451 !! test
25452 2. Headings: Add space before/after == even after hoisted content
25453 !! options
25454 parsoid={
25455 "modes": ["html2wt"],
25456 "scrubWikitext": true
25457 }
25458 !! html/parsoid
25459 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25460 !! wikitext
25461 [[Category:A2]]
25462
25463 == ok ==
25464 !! end
25465
25466 !! test
25467 1. Headings: suppress newly created empty headings
25468 !! options
25469 parsoid={
25470 "modes": ["html2wt"],
25471 "scrubWikitext": true
25472 }
25473 !! html/parsoid
25474 <h2></h2>
25475 !! wikitext
25476 !! end
25477
25478 !! test
25479 2. Headings: don't suppress empty headings if scrubWikitext is false
25480 !! options
25481 parsoid=html2wt
25482 !! html/parsoid
25483 <h2></h2>
25484 !! wikitext
25485 ==<nowiki/>==
25486 !! end
25487
25488 !! test
25489 3. Headings: suppress empty headings on edits
25490 !! options
25491 parsoid={
25492 "modes": ["selser"],
25493 "scrubWikitext": true,
25494 "changes": [
25495 [ "#x", "remove"]
25496 ]
25497 }
25498 !! wikitext
25499 ==<span id="x">foo</span>==
25500 !! wikitext/edited
25501 !! end
25502
25503 !! test
25504 1. WT Quote Tags: suppress newly created empty style tags
25505 !! options
25506 parsoid={
25507 "modes": ["html2wt"],
25508 "scrubWikitext": true
25509 }
25510 !! html/parsoid
25511 <i></i><b></b>
25512 !! wikitext
25513 !! end
25514
25515 !! test
25516 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25517 !! options
25518 parsoid=html2wt
25519 !! html/parsoid
25520 <i></i><b></b>
25521 !! wikitext
25522 ''<nowiki/>'''''<nowiki/>'''
25523 !! end
25524
25525 !! test
25526 3. WT Quote Tags: suppress empty style tags on edits
25527 !! options
25528 parsoid={
25529 "modes": ["selser"],
25530 "scrubWikitext": true,
25531 "changes": [
25532 [ "#x", "remove"]
25533 ]
25534 }
25535 !! wikitext
25536 '''<span id="x">foo</span>'''
25537 !! wikitext/edited
25538 !! end
25539
25540 !! test
25541 1. Anchors: suppress newly created empty anchors
25542 !! options
25543 parsoid={
25544 "modes": ["html2wt"],
25545 "scrubWikitext": true
25546 }
25547 !! html/parsoid
25548 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25549 !! wikitext
25550 !! end
25551
25552 !! test
25553 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25554 !! options
25555 parsoid={
25556 "modes": ["html2wt"],
25557 "scrubWikitext": false
25558 }
25559 !! html/parsoid
25560 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25561 !! wikitext
25562 [[Test|<nowiki/>]]
25563 !! end
25564
25565 !! test
25566 3. Anchors: suppress empty anchors on edits
25567 !! options
25568 parsoid={
25569 "modes": ["selser"],
25570 "scrubWikitext": true,
25571 "changes": [
25572 [ "#x", "remove"]
25573 ]
25574 }
25575 !! wikitext
25576 [[Test|<span id="x">foo</span>]]
25577 !! wikitext/edited
25578 !! end
25579
25580 !! test
25581 3a. Anchors: do not suppress numbered extlinks
25582 !! options
25583 parsoid={
25584 "modes": ["wt2wt"],
25585 "scrubWikitext": true
25586 }
25587 !! wikitext
25588 [http://foo.com]
25589 !! html/parsoid
25590 <a rel="mw:ExtLink" href="http://foo.com"></a>
25591 !! end
25592
25593 !! test
25594 3b. Anchors: do not suppress numbered extlinks
25595 !! options
25596 parsoid={
25597 "modes": ["wt2wt"],
25598 "scrubWikitext": true,
25599 "changes": [
25600 [ "#x", "remove"]
25601 ]
25602 }
25603 !! wikitext
25604 [http://foo.com <span id="x">foo</span>]
25605 !! wikitext/edited
25606 [http://foo.com]
25607 !! end
25608
25609 !!test
25610 Normalizations should be restricted to edited content
25611 !!options
25612 parsoid={
25613 "modes": ["selser"],
25614 "scrubWikitext": true,
25615 "changes": [
25616 [ "h1", "before", "<i></i>"]
25617 ]
25618 }
25619 !!wikitext
25620 a
25621 = =
25622 b
25623 !!wikitext/edited
25624 a
25625 = =
25626 b
25627 !!end
25628
25629 !! test
25630 1. Multiple normalizations (html2wt)
25631 !! options
25632 parsoid={
25633 "modes": ["html2wt"],
25634 "scrubWikitext": true
25635 }
25636 !! html
25637 <h2><i></i></h2>
25638 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25639 </a><b><i></i></b>x</p>
25640 !! wikitext
25641
25642 [[foo]]
25643 x
25644
25645 !! end
25646
25647 !! test
25648 2. Multiple normalizations (selser)
25649 !! options
25650 parsoid={
25651 "modes": ["selser"],
25652 "scrubWikitext": true,
25653 "changes": [
25654 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25655 ]
25656 }
25657 !! wikitext
25658 <span id="x">foo</span>
25659 !! wikitext/edited
25660 <span id="x">foo</span>
25661
25662 x
25663 !! end
25664
25665 !! test
25666 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25667 !! options
25668 parsoid={
25669 "modes": ["html2wt"],
25670 "scrubWikitext": true
25671 }
25672 !! html/parsoid
25673 <p> hi</p>
25674 <p> hello</p>
25675 !! wikitext
25676 hi
25677
25678 hello
25679 !! end
25680
25681 !! test
25682 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25683 !! options
25684 parsoid=html2wt
25685 !! html/parsoid
25686 <p> hi</p>
25687 <p> hello</p>
25688 !! wikitext
25689 <nowiki> </nowiki>hi
25690
25691 <nowiki> </nowiki> hello
25692 !! end
25693
25694 !! test
25695 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25696 !! options
25697 parsoid={
25698 "modes": ["html2wt"],
25699 "scrubWikitext": true
25700 }
25701 !! html/parsoid
25702 <p>Foo
25703 bar
25704 baz</p>
25705
25706 <table><tr><td>Foo
25707 bar
25708 baz bang</td></tr></table>
25709
25710 <p><!--boo--> foo
25711 bar</p>
25712
25713 <p> foo
25714 bar<span>boo</span></p>
25715 !! wikitext
25716 Foo
25717 bar
25718 baz
25719
25720 {|
25721 |Foo
25722 bar
25723 baz bang
25724 |}
25725
25726 <!--boo-->foo
25727 bar
25728
25729 foo
25730 bar<span>boo</span>
25731 !! end
25732
25733 !! test
25734 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25735 !! options
25736 parsoid={
25737 "modes": ["selser"],
25738 "scrubWikitext": true,
25739 "changes": [
25740 [ "p", "html", " a\n b" ]
25741 ]
25742 }
25743 !! wikitext
25744 xyz
25745 !! wikitext/edited
25746 a
25747 b
25748 !! end
25749
25750 !! test
25751 1. New links that end in spaces
25752 !! options
25753 parsoid={
25754 "modes": ["html2wt"],
25755 "scrubWikitext": false
25756 }
25757 !! html/parsoid
25758 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25759 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25760 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25761 !! wikitext
25762 [[Berlin ]]<nowiki/>is the capital of Germany.
25763
25764 [[Foo ]]'''bar'''
25765
25766 [[Boston ]] is a city.
25767 !! end
25768
25769 !! test
25770 2. New links that end in spaces
25771 !! options
25772 parsoid={
25773 "modes": ["html2wt"],
25774 "scrubWikitext": true
25775 }
25776 !! html/parsoid
25777 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25778 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25779 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25780 !! wikitext
25781 [[Berlin]] is the capital of Germany.
25782
25783 [[Foo]] '''bar'''
25784
25785 [[Boston]] is a city.
25786 !! end
25787
25788 !! test
25789 1. Table cells with escapable prefixes
25790 !! options
25791 parsoid={
25792 "modes": ["html2wt"],
25793 "scrubWikitext": false
25794 }
25795 !! html
25796 <table>
25797 <tr><td>a</td></tr>
25798 <tr><td>-</td></tr>
25799 <tr><td>+</td></tr>
25800 </table>
25801 !! wikitext
25802 {|
25803 |a
25804 |-
25805 |<nowiki>-</nowiki>
25806 |-
25807 |<nowiki>+</nowiki>
25808 |}
25809 !! end
25810
25811 !! test
25812 2. Table cells with escapable prefixes
25813 !! options
25814 parsoid={
25815 "modes": ["html2wt"],
25816 "scrubWikitext": true
25817 }
25818 !! html
25819 <table>
25820 <tr><td>a</td></tr>
25821 <tr><td>-</td></tr>
25822 <tr><td>+</td></tr>
25823 </table>
25824 !! wikitext
25825 {|
25826 |a
25827 |-
25828 | -
25829 |-
25830 | +
25831 |}
25832 !! end
25833
25834 !! test
25835 3a. Table cells with escapable prefixes after edits
25836 !! options
25837 parsoid={
25838 "modes": ["selser"],
25839 "scrubWikitext": true,
25840 "changes": [
25841 [ "table tbody tr:first-child td:first-child", "remove"]
25842 ]
25843 }
25844 !! wikitext
25845 {|
25846 |a||-
25847 |}
25848 !! wikitext/edited
25849 {|
25850 | -
25851 |}
25852 !! end
25853
25854 !! test
25855 3b. Table cells with escapable prefixes after edits
25856 !! options
25857 parsoid={
25858 "modes": ["selser"],
25859 "scrubWikitext": true,
25860 "changes": [
25861 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25862 [ "#x", "remove" ]
25863 ]
25864 }
25865 !! wikitext
25866 {|
25867 |pqr
25868 |<span id="x">foo</span>+
25869 |}
25870 !! wikitext/edited
25871 {|
25872 | -
25873 | +
25874 |}
25875 !! end
25876
25877 # FIXME: This test will fail because
25878 # normalization doesn't realize that the id attribute
25879 # will eliminate the escapable scenario
25880 !! test
25881 4a. Table cells without escapable prefixes after edits
25882 !! options
25883 parsoid={
25884 "modes": ["selser"],
25885 "scrubWikitext": true,
25886 "changes": [
25887 [ "#x", "html", "-" ]
25888 ]
25889 }
25890 !! wikitext
25891 {|
25892 | id="x" |abcd
25893 |}
25894 !! wikitext/edited
25895 {|
25896 | id="x" |-
25897 |}
25898 !! end
25899
25900 ## This tests normalizer's ability to discriminate between
25901 ## cells having identical content.
25902 !! test
25903 4b. Table cells without escapable prefixes after edits
25904 !! options
25905 parsoid={
25906 "modes": ["selser"],
25907 "scrubWikitext": true,
25908 "changes": [
25909 [ "td", "html", "-" ]
25910 ]
25911 }
25912 !! wikitext
25913 {|
25914 |a||b
25915 |}
25916 !! wikitext/edited
25917 {|
25918 | -||-
25919 |}
25920 !! end
25921
25922 ## This tests normalizer's ability to not be tripped by
25923 ## comments (and whitespace)
25924 !! test
25925 4c. Table cells without escapable prefixes after edits
25926 !! options
25927 parsoid={
25928 "modes": ["selser"],
25929 "scrubWikitext": true,
25930 "changes": [
25931 [ "table tbody tr td:first-child", "remove" ]
25932 ]
25933 }
25934 !! wikitext
25935 {|
25936 |-
25937 <!--foo--> |a||-
25938 |}
25939 !! wikitext/edited
25940 {|
25941 |-
25942 <!--foo--> | -
25943 |}
25944 !! end
25945
25946 ## This tests normalizer's ability to handle HTML cells
25947 !! test
25948 4d. Table cells without escapable prefixes after edits
25949 !! options
25950 parsoid={
25951 "modes": ["selser"],
25952 "scrubWikitext": true,
25953 "changes": [
25954 [ "td", "html", "-" ]
25955 ]
25956 }
25957 !! wikitext
25958 <table>
25959 <tr><td>a</td></tr>
25960 </table>
25961 !! wikitext/edited
25962 <table>
25963 <tr><td>-</td></tr>
25964 </table>
25965 !! end
25966
25967 !! test
25968 Escape nowiki DOM elements
25969 !! options
25970 parsoid=html2wt
25971 !! html/parsoid
25972 <nowiki><i>foo</i></nowiki>
25973 !! wikitext
25974 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
25975 !! end
25976
25977 # ---------------------------------------------------
25978 # End of tests spec'ing wikitext serialization norms |
25979 # ---------------------------------------------------
25980
25981 # -----------------------------------------------------------------
25982 # End of section for Parsoid-only html2wt tests for serialization
25983 # of new content
25984 # -----------------------------------------------------------------
25985
25986 # -----------------------------------------------------------------
25987 # The following section of tests are primarily to spec behavior of
25988 # the selective serializer. All these tests have manual selser
25989 # changes. The automated selser changes for all tests handle the
25990 # wide variation of changes, but these tests here capture specs
25991 # deterministically.
25992 # ----------------------------------------------------------------
25993
25994 ## T90517
25995 !! test
25996 Selser: New comments should not be lost
25997 !! options
25998 parsoid={
25999 "modes": ["selser"],
26000 "changes": [
26001 [ "#a", "after", "<!--c1-->" ],
26002 [ "#b", "before", "<!--c2-->" ]
26003 ]
26004 }
26005 !! wikitext
26006 <span id="a">a</span>
26007
26008 <span id="b">b</span>
26009 !! wikitext/edited
26010 <span id="a">a</span><!--c1-->
26011
26012 <!--c2--><span id="b">b</span>
26013 !! end
26014
26015 ## T89383
26016 !! test
26017 Selser: Check for validity of DSR before using it
26018 !! options
26019 parsoid={
26020 "modes": ["selser"],
26021 "changes": [
26022 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26023 ]
26024 }
26025 !! wikitext
26026 <span id="a">a</span>
26027 !! wikitext/edited
26028 {{DISPLAYTITLE:foo}}
26029 <span id="a">a</span>
26030 !! end
26031
26032 !! test
26033 1. DOMDiff: Changes to <ref> content should be looked up using id
26034 !! options
26035 parsoid={
26036 "modes": ["selser"],
26037 "changes": [
26038 ["#X", "after", "bar"],
26039 ["#Y", "after", "baz"]
26040 ]
26041 }
26042 !! wikitext
26043 X <ref><span id="X">foo</span></ref>
26044 Y <ref name="a" />
26045 <references>
26046 <ref name="a"><span id="Y">foo</span></ref>
26047 </references>
26048 !! wikitext/edited
26049 X <ref><span id="X">foo</span>bar</ref>
26050 Y <ref name="a" />
26051 <references>
26052 <ref name="a"><span id="Y">foo</span>baz</ref>
26053 </references>
26054 !! end
26055
26056 !! test
26057 2. DOMDiff: Changes to <ref> content should be looked up using id
26058 !! options
26059 parsoid={
26060 "modes": ["selser"],
26061 "changes": [
26062 ["#Z", "after", "bar"]
26063 ]
26064 }
26065 !! wikitext
26066 A <ref>foo bar for a</ref>
26067 B <ref group="X" name="b" />
26068
26069 <references />
26070
26071 <references group="X">
26072 <ref name="b"><span id="Z">foo</span></ref>
26073 </references>
26074 !! wikitext/edited
26075 A <ref>foo bar for a</ref>
26076 B <ref group="X" name="b" />
26077
26078 <references />
26079
26080 <references group="X">
26081 <ref name="b"><span id="Z">foo</span>bar</ref>
26082 </references>
26083 !! end