Merge "Revert "Adding release note for category changes in watchlists""
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
604 !! html
605 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !! end
679
680
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !! end
739
740
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !! end
823
824
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,2+3)
843 !! wikitext
844 '''''foo'''''
845 !! html/*
846 <p><i><b>foo</b></i>
847 </p>
848 !! end
849
850 !! test
851 Italics and bold: 5-quote opening sequence: (5,3)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 '''''foo'''
856 !! html/*
857 <p><i><b>foo</b></i>
858 </p>
859 !!end
860
861 # same html as previous, but wikitext adjusted to match parsoid html2wt
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,3+2)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !! end
870
871 !! test
872 Italics and bold: 5-quote opening sequence: (5,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 '''''foo''''
877 !! html/*
878 <p><i><b>foo'</b></i>
879 </p>
880 !!end
881
882 !! test
883 Italics and bold: 5-quote opening sequence: (5,5)
884 !! wikitext
885 '''''foo'''''
886 !! html
887 <p><i><b>foo</b></i>
888 </p>
889 !!end
890
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,6)
893 !! wikitext
894 '''''foo''''''
895 !! html/*
896 <p><i><b>foo'</b></i>
897 </p>
898 !! end
899
900 ###
901 ### multiple quote sequences in a line
902 ###
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2)
905 !! options
906 parsoid=wt2html
907 !! wikitext
908 ''foo''''bar''
909 !! html/*
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !!end
913
914
915 # same html as previous, but wikitext adjusted to match parsoid html2wt
916 !! test
917 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
918 !! wikitext
919 ''foo'<nowiki/>'''bar'''''
920 !! html
921 <p><i>foo'<b>bar</b></i>
922 </p>
923 !! end
924
925
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 ''foo''''bar'''
932 !! html/*
933 <p><i>foo'<b>bar</b></i>
934 </p>
935 !!end
936
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
941 !! wikitext
942 ''foo'<nowiki/>'''bar'''''
943 !! html
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,4)
951 !! options
952 parsoid=wt2html
953 !! wikitext
954 ''foo''''bar''''
955 !! html/*
956 <p><i>foo'<b>bar'</b></i>
957 </p>
958 !!end
959
960
961 # same html as previous, but wikitext adjusted to match parsoid html2wt
962 !! test
963 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
964 !! wikitext
965 ''foo'<nowiki/>'''bar'<nowiki/>'''''
966 !! html
967 <p><i>foo'<b>bar'</b></i>
968 </p>
969 !! end
970
971
972 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
973 !! test
974 Italics and bold: multiple quote sequences: (3,4,2)
975 !! options
976 parsoid=wt2html
977 !! wikitext
978 '''foo''''bar''
979 !! html/php
980 <p><b>foo'</b>bar
981 </p>
982 !! html/parsoid
983 <p><b>foo'</b>bar<i></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
990 !! options
991 parsoid
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
999 </p>
1000 !! end
1001
1002
1003 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1004 !! test
1005 Italics and bold: multiple quote sequences: (3,4,3)
1006 !! options
1007 parsoid=wt2html
1008 !! wikitext
1009 '''foo''''bar'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b>foo'</b>bar<b></b>
1015 </p>
1016 !!end
1017
1018 # same html as previous, but wikitext adjusted to match parsoid html2wt
1019 !! test
1020 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1021 !! wikitext
1022 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1028 </p>
1029 !! end
1030
1031 ###
1032 ### other quote tests
1033 ###
1034 !! test
1035 Italics and bold: other quote tests: (2,3,5)
1036 !! wikitext
1037 ''this is about '''foo's family'''''
1038 !! html
1039 <p><i>this is about <b>foo's family</b></i>
1040 </p>
1041 !!end
1042
1043
1044 !! test
1045 Italics and bold: other quote tests: (2,(3,3),2)
1046 !! wikitext
1047 ''this is about '''foo's''' family''
1048 !! html
1049 <p><i>this is about <b>foo's</b> family</i>
1050 </p>
1051 !!end
1052
1053
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3,2)
1056 !! options
1057 parsoid=wt2html
1058 !! wikitext
1059 '''this is about ''foo'''s family''
1060 !! html/*
1061 <p><b>this is about <i>foo</i></b><i>s family</i>
1062 </p>
1063 !!end
1064
1065
1066 # same html as previous, but wikitext adjusted to match parsoid html2wt
1067 !! test
1068 Italics and bold: other quote tests: (3,2,3+2+2,2)
1069 !! wikitext
1070 '''this is about ''foo'''''<nowiki/>''s family''
1071 !! html
1072 <p><b>this is about <i>foo</i></b><i>s family</i>
1073 </p>
1074 !! end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (3,2,3,3)
1079 !! wikitext
1080 '''this is about ''foo'''s family'''
1081 !! html/*
1082 <p>'<i>this is about </i>foo<b>s family</b>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,(2,2),3)
1089 !! wikitext
1090 '''this is about ''foo's'' family'''
1091 !! html
1092 <p><b>this is about <i>foo's</i> family</b>
1093 </p>
1094 !!end
1095
1096
1097 !! test
1098 Italicized possessive
1099 !! wikitext
1100 The ''[[Main Page]]'''s talk page.
1101 !! html/php
1102 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1103 </p>
1104 !! html/parsoid
1105 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1106 !! end
1107
1108 !! test
1109 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1110 (Requires tidy for PHP parser output to be fixed up)
1111 !! options
1112 parsoid=wt2html,wt2wt
1113 !! wikitext
1114 {|
1115 !''a!!''b
1116 |''a||''b
1117 |}
1118 !! html/php+tidy
1119 <table>
1120 <tr>
1121 <th><i>a</i></th>
1122 <th><i>b</i></th>
1123 <td><i>a</i></td>
1124 <td><i>b</i></td>
1125 </tr>
1126 </table>
1127 !! html/parsoid
1128 <table>
1129 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1130 <td><i>a</i></td><td><i>b</i></td></tr>
1131 </tbody></table>
1132 !! end
1133
1134 ###
1135 ### Non-html5 tags
1136 ###
1137
1138 !! test
1139 Non-html5 tags should be accepted
1140 !! wikitext
1141 <center>''foo''</center>
1142 <big>''foo''</big>
1143 <font>''foo''</font>
1144 <strike>''foo''</strike>
1145 <tt>''foo''</tt>
1146 !! html
1147 <center><i>foo</i></center>
1148 <p><big><i>foo</i></big>
1149 <font><i>foo</i></font>
1150 <strike><i>foo</i></strike>
1151 <tt><i>foo</i></tt>
1152 </p>
1153 !! end
1154
1155 !! test
1156 <wbr> is valid wikitext (bug 52468)
1157 !! wikitext
1158 <wbr>
1159 !! html
1160 <p><wbr />
1161 </p>
1162 !! end
1163
1164 # <strike> is HTML4, <s> is HTML4/5.
1165 !! test
1166 <s> or <strike> for strikethrough
1167 !! wikitext
1168 <strike>strike</strike>
1169
1170 <s>s</s>
1171 !! html
1172 <p><strike>strike</strike>
1173 </p><p><s>s</s>
1174 </p>
1175 !! end
1176
1177 ## a not permitted
1178 ## i,b,br omitted
1179 !! test
1180 Text-level semantic html elements in wikitext
1181 !! wikitext
1182 <em>text</em>
1183 <strong>text</strong>
1184 <small>text</small>
1185 <s>text</s>
1186 <cite>text</cite>
1187 <q>text</q>
1188 <dfn>text</dfn>
1189 <abbr>text</abbr>
1190 <data>text</data>
1191 <time>text</time>
1192 <code>text</code>
1193 <var>text</var>
1194 <samp>text</samp>
1195 <kbd>text</kbd>
1196 <sub>text</sub>
1197 <u>text</u>
1198 <mark>text</mark>
1199 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1200 <bdi>text</bdi>
1201 <bdo>text</bdo>
1202 <span>text</span>
1203 <wbr />
1204 !! html
1205 <p><em>text</em>
1206 <strong>text</strong>
1207 <small>text</small>
1208 <s>text</s>
1209 <cite>text</cite>
1210 <q>text</q>
1211 <dfn>text</dfn>
1212 <abbr>text</abbr>
1213 <data>text</data>
1214 <time>text</time>
1215 <code>text</code>
1216 <var>text</var>
1217 <samp>text</samp>
1218 <kbd>text</kbd>
1219 <sub>text</sub>
1220 <u>text</u>
1221 <mark>text</mark>
1222 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1223 <bdi>text</bdi>
1224 <bdo>text</bdo>
1225 <span>text</span>
1226 <wbr />
1227 </p>
1228 !! end
1229
1230 # test cases taken from
1231 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1232 !! test
1233 Ruby markup (W3C-style)
1234 !! wikitext
1235 ; Mono-ruby for individual base characters
1236 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1237 ; Group ruby
1238 : <ruby>今日<rt>きょう</rt></ruby>
1239 ; Jukugo ruby
1240 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1241 ; Inline ruby
1242 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1243 ; Double-sided ruby
1244 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1245 <ruby>
1246 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1247 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1248 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1249 </ruby>
1250 !! html
1251 <dl><dt> Mono-ruby for individual base characters</dt>
1252 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1253 <dt> Group ruby</dt>
1254 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1255 <dt> Jukugo ruby</dt>
1256 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1257 <dt> Inline ruby</dt>
1258 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1259 <dt> Double-sided ruby</dt>
1260 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1261 <p><ruby>
1262 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1263 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1264 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1265 </ruby>
1266 </p>
1267 !! end
1268
1269 # The next two test different paths in the sanitizer.
1270 !! test
1271 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1272 !! wikitext
1273 <blockquote|>a</blockquote>
1274
1275 <b→> doesn't terminate </b→>
1276
1277 <bä> doesn't terminate </bä>
1278
1279 <boo> doesn't terminate </boo>
1280
1281 <s.foo> doesn't terminate </s.foo>
1282
1283 <sub-ID#1>
1284 !! html
1285 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1286 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1287 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1288 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1289 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1290 </p><p>&lt;sub-ID#1&gt;
1291 </p>
1292 !! end
1293
1294 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1295 # If the non-word-character tag made it through the sanitizer, tidy
1296 # would munge it up.
1297 !! test
1298 Non-word characters don't terminate tag names + tidy
1299 !! wikitext
1300 <blockquote|>a</blockquote>
1301
1302 <b→> doesn't terminate </b→>
1303
1304 <bä> doesn't terminate </bä>
1305
1306 <boo> doesn't terminate </boo>
1307
1308 <s.foo> doesn't terminate </s.foo>
1309
1310 <sub-ID#1>
1311 !! html+tidy
1312 <p>&lt;blockquote|&gt;a</p>
1313 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1314 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1315 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1316 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1317 <p>&lt;sub-ID#1&gt;</p>
1318 !! end
1319
1320 ###
1321 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1322 ### This checks that HTML5 tags (with non-word characters in the tag
1323 ### name) make it safely through the parser -- the Sanitizer will
1324 ### munge them later, as it should.
1325 ###
1326 !! test
1327 Non-word characters are valid in extension tags (T19663)
1328 !! wikitext
1329 <tåg>tåg</tåg>
1330 !! html/php
1331 <pre>
1332 'tåg'
1333 array (
1334 )
1335 </pre>
1336
1337 !! end
1338
1339 !! test
1340 Isolated close tags should be treated as literal text (bug 52760)
1341 !! options
1342 parsoid=wt2html
1343 !! wikitext
1344 </b>
1345
1346 <s.foo>s</s>
1347 !! html/php+tidy
1348 <p>&lt;s.foo&gt;s</p>
1349 !! html/parsoid
1350 <p>&lt;s.foo&gt;s</p>
1351 !! end
1352
1353 ###
1354 ### Special characters
1355 ###
1356
1357 !! test
1358 Bare pipe character (bug 52363)
1359 !! wikitext
1360 |
1361 !! html
1362 <p>|
1363 </p>
1364 !! end
1365
1366 !! test
1367 Bare pipe character from a template (bug 52363)
1368 !! wikitext
1369 {{pipe}}
1370 !! html
1371 <p>|
1372 </p>
1373 !! end
1374
1375 ###
1376 ### <nowiki> test cases
1377 ###
1378
1379 !! test
1380 <nowiki> unordered list
1381 !! wikitext
1382 <nowiki>* This is not an unordered list item.</nowiki>
1383 !! html/php
1384 <p>* This is not an unordered list item.
1385 </p>
1386 !! html/parsoid
1387 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1388 !! end
1389
1390 !! test
1391 <nowiki> spacing
1392 !! wikitext
1393 <nowiki>Lorem ipsum dolor
1394
1395 sed abit.
1396 sed nullum.
1397
1398 :and a colon
1399 </nowiki>
1400 !! html/php
1401 <p>Lorem ipsum dolor
1402
1403 sed abit.
1404 sed nullum.
1405
1406 :and a colon
1407
1408 </p>
1409 !! html/parsoid
1410 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </span></p>
1417 !! end
1418
1419 !! test
1420 nowiki 3
1421 !! wikitext
1422 :There is not nowiki.
1423 :There is <nowiki>nowiki</nowiki>.
1424
1425 #There is not nowiki.
1426 #There is <nowiki>nowiki</nowiki>.
1427
1428 *There is not nowiki.
1429 *There is <nowiki>nowiki</nowiki>.
1430 !! html/php
1431 <dl><dd>There is not nowiki.</dd>
1432 <dd>There is nowiki.</dd></dl>
1433 <ol><li>There is not nowiki.</li>
1434 <li>There is nowiki.</li></ol>
1435 <ul><li>There is not nowiki.</li>
1436 <li>There is nowiki.</li></ul>
1437
1438 !! html/parsoid
1439 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1440 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1441
1442 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1443 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1444
1445 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1447 !! end
1448
1449 !! test
1450 Entities inside <nowiki>
1451 !! wikitext
1452 <nowiki>&lt;</nowiki>
1453 !! html
1454 <p>&lt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 Entities inside template parameters
1460 !! wikitext
1461 {{echo|&ndash;}}
1462 !! html/php+tidy
1463 <p>–</p>
1464 !! html/parsoid
1465 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1466 !! end
1467
1468 !! test
1469 Properly escape nowiki when combined with other wiki markup
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <p>* &lt;/nowiki&gt; tag</p>
1474 !! wikitext
1475 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1476 !! end
1477
1478 !! test
1479 T93824: Put escaped HTML tags inside nowiki
1480 !! options
1481 parsoid=html2wt
1482 !! html/parsoid
1483 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1484 !! wikitext
1485 <nowiki><h2>foo</h2></nowiki>
1486 !! end
1487
1488 !! test
1489 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1490 !! options
1491 parsoid=html2wt
1492 !! html/parsoid
1493 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1494 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1495 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1496 !! wikitext
1497 This text: L'[[Foo]]
1498 This text: L<nowiki>''</nowiki>[[Foo]]
1499 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1500 !! end
1501
1502 # This test fails because wikitext whitespace is not normalized before comparing.
1503 !! test
1504 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1505 !! options
1506 parsoid=html2wt
1507 !! html/parsoid
1508 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1509 </p>
1510 !! wikitext
1511 This text : L<nowiki>''</nowiki>[[Foo]]
1512 !! end
1513
1514 # This test and the next one are html2wt only as they test that incorrect wikitext
1515 # passed in template arguments gets escaped or wrapped in nowikis where required.
1516 !! test
1517 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1522 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1523 !! wikitext
1524 {{echo|foo{{!}}bar}}
1525 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1526 !! end
1527
1528 !! test
1529 T53961: Output correct nowikis in template arguments
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1534 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1535 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1536 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1538 !! wikitext
1539 {{echo|a [ b}}
1540 {{echo|a <nowiki>}}</nowiki> b}}
1541 {{echo|<nowiki>a [[ b</nowiki>}}
1542 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1543 {{echo|a <nowiki>}</nowiki>}}
1544 !! end
1545
1546 !! test
1547 Cases where "!!" needs nowiki protection
1548 !! options
1549 parsoid=html2wt
1550 !! html/parsoid
1551 <table>
1552 <tr><th>this needs protection !! here</th></tr>
1553 </table>
1554
1555 <table>
1556 <tr><th>this does not need
1557 protection !! here</th></tr>
1558 </table>
1559 !! wikitext
1560 {|
1561 !<nowiki>this needs protection !! here</nowiki>
1562 |}
1563
1564 {|
1565 !this does not need
1566 protection !! here
1567 |}
1568 !! end
1569
1570 ###
1571 ### Comments
1572 ###
1573 !! test
1574 Comments and Indent-Pre
1575 !! wikitext
1576 <!-- comment 1 --> asdf
1577
1578 <!-- comment 1 --> asdf
1579 <!-- comment 2 -->
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->xyz
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 --> xyz
1586 !! html
1587 <pre>asdf
1588 </pre>
1589 <pre>asdf
1590 </pre>
1591 <pre>asdf
1592 </pre>
1593 <p>xyz
1594 </p>
1595 <pre>asdf
1596 xyz
1597 </pre>
1598 !! end
1599
1600 !! test
1601 Comment test 2a
1602 !! wikitext
1603 asdf
1604 <!-- comment 1 -->
1605 jkl
1606 !! html
1607 <p>asdf
1608 jkl
1609 </p>
1610 !! end
1611
1612 !! test
1613 Comment test 2b
1614 !! wikitext
1615 asdf
1616 <!-- comment 1 -->
1617
1618 jkl
1619 !! html
1620 <p>asdf
1621 </p><p>jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 3
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630 <!-- comment 2 -->
1631 jkl
1632 !! html
1633 <p>asdf
1634 jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 4
1640 !! wikitext
1641 asdf<!-- comment 1 -->jkl
1642 !! html
1643 <p>asdfjkl
1644 </p>
1645 !! end
1646
1647 !! test
1648 Comment spacing
1649 !! wikitext
1650 a
1651 <!-- foo --> b <!-- bar -->
1652 c
1653 !! html
1654 <p>a
1655 </p>
1656 <pre> b
1657 </pre>
1658 <p>c
1659 </p>
1660 !! end
1661
1662 !! test
1663 Comment whitespace
1664 !! wikitext
1665 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1666 !! html
1667
1668 !! end
1669
1670 !! test
1671 Comment semantics and delimiters
1672 !! wikitext
1673 <!-- --><!----><!-----><!------>
1674 !! html/php
1675
1676 !! html/parsoid
1677 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1678 !! end
1679
1680 !! test
1681 Comment semantics and delimiters, redux
1682 !! wikitext
1683 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1684 -- foo -- funky huh? ... -->
1685 !! html/php
1686
1687 !! html/parsoid
1688 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1689 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1690 !! end
1691
1692 !! test
1693 Comment semantics and delimiters: directors cut
1694 !! wikitext
1695 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1696 everything starting with < followed by !-- until the first -- and > we see,
1697 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1698 -->-->
1699 !! html/php
1700 <p>--&gt;
1701 </p>
1702 !! html/parsoid
1703 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1704 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1705 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1706 --><p>--></p>
1707 !! end
1708
1709 !! test
1710 Comment semantics: nesting
1711 !! wikitext
1712 <!--<!-- no, we're not going to do anything fancy here -->-->
1713 !! html/php
1714 <p>--&gt;
1715 </p>
1716 !! html/parsoid
1717 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1718 !! end
1719
1720 # Parsoid closes the unclosed comment, even if it means a slight
1721 # round-trip diff.
1722 !! test
1723 Comment semantics: unclosed comment at end
1724 !! options
1725 parsoid=wt2html,html2html
1726 !! wikitext
1727 <!--This comment will run out to the end of the document
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!--This comment will run out to the end of the document-->
1732 !! end
1733
1734 !! test
1735 Comment semantics: normalize comments to play nice with XML and browsers
1736 !! wikitext
1737 <!-- Browsers --!> think this is closed -->
1738 <!--> This would normally be text -->
1739 <!---> As would this -->
1740 <!-- XML doesn't like trailing dashes -------->
1741 <!-- Nor doubled hyphens -- anywhere in the data -->
1742 But this is not a comment.
1743 !! html/php
1744 <p>But this is not a comment.
1745 </p>
1746 !! html/parsoid
1747 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1748 <!--&#x3E; This would normally be text -->
1749 <!--&#x2D;&#x3E; As would this -->
1750 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1751 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1752 <p>But this is not a comment.</p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: round-trip even text which contains encoded -->
1757 !! wikitext
1758 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1759 !! html/parsoid
1760 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1761 !! end
1762
1763 !! test
1764 Comment in template title
1765 !! wikitext
1766 {{f<!---->oo}}
1767 !! html
1768 <p>FOO
1769 </p>
1770 !! end
1771
1772 !! test
1773 Comment on its own line post-expand
1774 !! wikitext
1775 a
1776 {{blank}}<!---->
1777 b
1778 !! html
1779 <p>a
1780 </p><p>b
1781 </p>
1782 !! end
1783
1784 !! test
1785 Comment on its own line post-expand with non-significant whitespace
1786 !! wikitext
1787 a
1788 {{blank}} <!---->
1789 b
1790 !! html
1791 <p>a
1792 </p><p>b
1793 </p>
1794 !! end
1795
1796 !! test
1797 Multiple comments should still parse as SOL-transparent
1798 !! options
1799 parsoid=wt2html,wt2wt
1800 !! wikitext
1801 <!--c1-->*a
1802 <!--c2--><!--c3--><!--c4-->*b
1803 !! html/php
1804 <ul><li>a</li>
1805 <li>b</li></ul>
1806
1807 !! html/parsoid
1808 <!--c1--><ul>
1809 <li>a
1810 </li>
1811 <!--c2--><!--c3--><!--c4-->
1812 <li>b
1813 </li>
1814 </ul>
1815 !! end
1816
1817 ###
1818 ### paragraph wrapping tests
1819 ###
1820 !! test
1821 No block tags
1822 !! wikitext
1823 a
1824
1825 b
1826 !! html
1827 <p>a
1828 </p><p>b
1829 </p>
1830 !! end
1831
1832 !! test
1833 Block tag on one line (<div>)
1834 !! wikitext
1835 a <div>foo</div>
1836
1837 b
1838 !! html
1839 a <div>foo</div>
1840 <p>b
1841 </p>
1842 !! html+tidy
1843 <p>a</p>
1844 <div>foo</div>
1845 <p>b</p>
1846 !! end
1847
1848 !! test
1849 Block tag on one line (<blockquote>)
1850 !! wikitext
1851 a <blockquote>foo</blockquote>
1852
1853 b
1854 !! html
1855 a <blockquote>foo</blockquote>
1856 <p>b
1857 </p>
1858 !! html+tidy
1859 <p>a</p>
1860 <blockquote>
1861 <p>foo</p>
1862 </blockquote>
1863 <p>b</p>
1864 !! end
1865
1866 !! test
1867 Block tag on both lines (<div>)
1868 !! wikitext
1869 a <div>foo</div>
1870
1871 b <div>foo</div>
1872 !! html
1873 a <div>foo</div>
1874 b <div>foo</div>
1875
1876 !! html+tidy
1877 <p>a</p>
1878 <div>foo</div>
1879 <p>b</p>
1880 <div>foo</div>
1881 !! end
1882
1883 !! test
1884 Block tag on both lines (<blockquote>)
1885 !! wikitext
1886 a <blockquote>foo</blockquote>
1887
1888 b <blockquote>foo</blockquote>
1889 !! html
1890 a <blockquote>foo</blockquote>
1891 b <blockquote>foo</blockquote>
1892
1893 !! html+tidy
1894 <p>a</p>
1895 <blockquote>
1896 <p>foo</p>
1897 </blockquote>
1898 <p>b</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 !! end
1903
1904 !! test
1905 Multiple lines without block tags
1906 !! wikitext
1907 <div>foo</div> a
1908 b
1909 c
1910 d<!--foo--> e
1911 x <div>foo</div> z
1912 !! html
1913 <div>foo</div> a
1914 <p>b
1915 c
1916 d e
1917 </p>
1918 x <div>foo</div> z
1919
1920 !! html+tidy
1921 <div>foo</div>
1922 <p>a</p>
1923 <p>b c d e</p>
1924 <p>x</p>
1925 <div>foo</div>
1926 <p>z</p>
1927 !! end
1928
1929 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1930 # So, we have a separate section for Parsoid. We don't want
1931 # to mimic this stripping behavior in Parsoid. It affects
1932 # editing experience and also requires us to maintain additional
1933 # info for RT-ing.
1934 !! test
1935 Empty lines between lines with block tags
1936 !! wikitext
1937 <div></div>
1938
1939
1940 <div></div>a
1941
1942 b
1943 <div>a</div>b
1944
1945 <div>b</div>d
1946
1947
1948 <div>e</div>
1949 !! html
1950 <div></div>
1951 <p><br />
1952 </p>
1953 <div></div>a
1954 <p>b
1955 </p>
1956 <div>a</div>b
1957 <div>b</div>d
1958 <p><br />
1959 </p>
1960 <div>e</div>
1961
1962 !! html+tidy
1963 <p><br /></p>
1964 <p>a</p>
1965 <p>b</p>
1966 <div>a</div>
1967 <p>b</p>
1968 <div>b</div>
1969 <p>d</p>
1970 <p><br /></p>
1971 <div>e</div>
1972 !! html/parsoid
1973 <div data-parsoid='{"stx":"html"}'></div>
1974
1975 <p><br /></p>
1976 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1977
1978 <p>b</p>
1979 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1980
1981 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1982
1983 <p><br /></p>
1984 <div data-parsoid='{"stx":"html"}'>e</div>
1985 !! end
1986
1987 ## PHP parser emits output which is broken
1988 !! test
1989 Unclosed HTML p-tags should be handled properly
1990 !! wikitext
1991 <div><p>foo</div>
1992 a
1993
1994 b
1995 !! html/php+tidy
1996 <div>
1997 <p>foo</p>
1998 </div>
1999 <p>a</p>
2000 <p>b</p>
2001 !! html/parsoid
2002 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! end
2006
2007 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2008 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2009 ## them for now.
2010 !! test
2011 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2012 !! options
2013 parsoid=wt2html
2014 !! wikitext
2015 a [[Category:A1]] [[Category:A2]]
2016 [[Category:A3]]
2017 [[Category:A4]]
2018 !! html/parsoid
2019 <p>a</p>
2020 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2021 !! end
2022
2023 !! test
2024 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 [[Category:A1]]a
2029 !! html/parsoid
2030 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2031 !! end
2032
2033 ###
2034 ### Preformatted text
2035 ###
2036 !! test
2037 Preformatted text
2038 !! wikitext
2039 This is some
2040 Preformatted text
2041 With ''italic''
2042 And '''bold'''
2043 And a [[Main Page|link]]
2044 !! html
2045 <pre>This is some
2046 Preformatted text
2047 With <i>italic</i>
2048 And <b>bold</b>
2049 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2050 </pre>
2051 !! end
2052
2053 !! test
2054 Tabs don't trigger preformatted text
2055 !! wikitext
2056 This is not
2057 preformatted text.
2058 This is preformatted text.
2059 So is this.
2060 !! html
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! end
2068
2069 !! test
2070 Ident preformatting with inline content
2071 !! wikitext
2072 a
2073 ''b''
2074 !! html
2075 <pre>a
2076 <i>b</i>
2077 </pre>
2078 !! end
2079
2080 !! test
2081 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2082 !! wikitext
2083 <pre><nowiki>
2084 <b>
2085 <cite>
2086 <em>
2087 </nowiki></pre>
2088 !! html
2089 <pre>
2090 &lt;b&gt;
2091 &lt;cite&gt;
2092 &lt;em&gt;
2093 </pre>
2094
2095 !! end
2096
2097 !! test
2098 Regression with preformatted in <center>
2099 !! wikitext
2100 <center>
2101 Blah
2102 </center>
2103 !! html
2104 <center>
2105 <pre>Blah
2106 </pre>
2107 </center>
2108
2109 !! end
2110
2111 !! test
2112 Bug 52763: Preformatted in <blockquote>
2113 !! wikitext
2114 <blockquote>
2115 Blah
2116 {|
2117 |
2118 indented cell (no pre-wrapping!)
2119 |}
2120 </blockquote>
2121 !! html
2122 <blockquote>
2123 <p> Blah
2124 </p>
2125 <table>
2126 <tr>
2127 <td>
2128 <p> indented cell (no pre-wrapping!)
2129 </p>
2130 </td></tr></table>
2131 </blockquote>
2132
2133 !! end
2134
2135 !! test
2136 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2137 !! wikitext
2138 <blockquote>
2139 Foo
2140
2141 Bar
2142 </blockquote>
2143 !! html
2144 <blockquote>
2145 <p>Foo
2146 </p><p>Bar
2147 </p>
2148 </blockquote>
2149
2150 !! end
2151
2152 !! test
2153 Bug 15491: <ins>/<del> in blockquote
2154 !! wikitext
2155 <blockquote>
2156 Foo <del>bar</del> <ins>baz</ins> quux
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo <del>bar</del> <ins>baz</ins> quux
2161 </p>
2162 </blockquote>
2163
2164 !! end
2165
2166 # Note that the p-wrapping is newline sensitive, which could be
2167 # considered a bug: tidy will wrap only the 'Foo' in the example
2168 # below in a <p> tag. (see comment 23-25 of bug #6200)
2169 !! test
2170 Bug 15491: <ins>/<del> in blockquote (2)
2171 !! wikitext
2172 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2173 </blockquote>
2174 !! html
2175 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177
2178 !! html+tidy
2179 <blockquote>
2180 <p>Foo</p>
2181 <del>bar</del> <ins>baz</ins> quux</blockquote>
2182 !! end
2183
2184 !! test
2185 <pre> with attributes (bug 3202)
2186 !! wikitext
2187 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2188 !! html
2189 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2190
2191 !! end
2192
2193 !! test
2194 <pre> with width attribute (bug 3202)
2195 !! wikitext
2196 <pre width="8">Narrow screen goodies</pre>
2197 !! html
2198 <pre width="8">Narrow screen goodies</pre>
2199
2200 !! end
2201
2202 !! test
2203 <pre> with forbidden attribute (bug 3202)
2204 !! wikitext
2205 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2206 !! html
2207 <pre width="8">Narrow screen goodies</pre>
2208
2209 !! end
2210
2211 !! test
2212 Entities inside <pre>
2213 !! wikitext
2214 <pre>&lt;</pre>
2215 !! html
2216 <pre>&lt;</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute values (bug 3202)
2222 !! wikitext
2223 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 <nowiki> inside <pre> (bug 13238)
2231 !! wikitext
2232 <pre>
2233 <nowiki>
2234 </pre>
2235 <pre>
2236 <nowiki></nowiki>
2237 </pre>
2238 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2239 !! html
2240 <pre>
2241 &lt;nowiki&gt;
2242 </pre>
2243 <pre>
2244
2245 </pre>
2246 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2247
2248 !! end
2249
2250 !! test
2251 <nowiki> and <pre> preference (first one wins)
2252 !! wikitext
2253 <pre>
2254 <nowiki>
2255 </pre>
2256 </nowiki>
2257 </pre>
2258
2259 <nowiki>
2260 <pre>
2261 <nowiki>
2262 </pre>
2263 </nowiki>
2264 </pre>
2265
2266 !! html/php
2267 <pre>
2268 &lt;nowiki&gt;
2269 </pre>
2270 <p>&lt;/nowiki&gt;
2271 &lt;/pre&gt;
2272 </p><p>
2273 &lt;pre&gt;
2274 &lt;nowiki&gt;
2275 &lt;/pre&gt;
2276
2277 &lt;/pre&gt;
2278 </p>
2279 !! html/parsoid
2280 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2281 </pre>
2282 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2283 &lt;/pre></p>
2284
2285 <p><span typeof="mw:Nowiki">
2286 &lt;pre>
2287 &lt;nowiki>
2288 &lt;/pre>
2289 </span>
2290 &lt;/pre></p>
2291 !! end
2292
2293 !! test
2294 </pre> inside nowiki
2295 !! wikitext
2296 <nowiki></pre></nowiki>
2297 !! html
2298 <p>&lt;/pre&gt;
2299 </p>
2300 !! end
2301
2302 # Parsoid doesn't strip empty tags, like Tidy does.
2303 !! test
2304 Empty pre; pre inside other HTML tags (bug 54946)
2305 !! options
2306 parsoid=wt2html,wt2wt
2307 !! wikitext
2308 a
2309
2310 <div><pre>
2311 foo
2312 </pre></div>
2313 <pre></pre>
2314 !! html/php
2315 <p>a
2316 </p>
2317 <div><pre>
2318 foo
2319 </pre></div>
2320 <pre></pre>
2321
2322 !! html/php+tidy
2323 <p>a</p>
2324 <div>
2325 <pre>
2326 foo
2327 </pre></div>
2328 !! html/parsoid
2329 <p>a</p>
2330
2331 <div><pre>foo
2332 </pre></div>
2333 <pre></pre>
2334 !! end
2335
2336 !! test
2337 HTML pre followed by indent-pre
2338 !! wikitext
2339 <pre>foo</pre>
2340 bar
2341 !! html
2342 <pre>foo</pre>
2343 <pre>bar
2344 </pre>
2345 !! end
2346
2347 # Note that tidy removes the empty <p> tags from the start and end.
2348 # Parsoid does not, by design.
2349 !!test
2350 Block tag pre
2351 !! wikitext
2352 <p><pre>foo</pre></p>
2353 !! html/php+tidy
2354 <pre>
2355 foo
2356 </pre>
2357 !! html/parsoid
2358 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2359 !!end
2360
2361 !!test
2362 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2363 !! wikitext
2364 {{echo|}}
2365 !! html
2366
2367 !!end
2368
2369 !!test
2370 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2371 !! wikitext
2372 {{echo|
2373 foo}}
2374 !! html
2375 <p>foo
2376 </p>
2377 !!end
2378
2379 !! test
2380 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2381 !! wikitext
2382 {{echo|a
2383 b}}
2384 !! html
2385 <pre>a
2386 </pre>
2387 <p>b
2388 </p>
2389 !!end
2390
2391 !! test
2392 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2393 !! wikitext
2394 {{echo|a
2395 b
2396 c
2397 d
2398 e
2399 }}
2400 !! html
2401 <pre>a
2402 </pre>
2403 <p>b
2404 c
2405 </p>
2406 <pre>d
2407 </pre>
2408 <p>e
2409 </p>
2410 !!end
2411
2412 !!test
2413 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2414 !! wikitext
2415 {{echo| foo}}
2416
2417 {{echo| foo}}{{echo| bar}}
2418
2419 {{echo| foo}}
2420 {{echo| bar}}
2421
2422 {{echo|<!--cmt--> foo}}
2423
2424 <!--cmt-->{{echo| foo}}
2425
2426 {{echo|{{echo| }}bar}}
2427 !! html
2428 <pre>foo
2429 </pre>
2430 <pre>foo bar
2431 </pre>
2432 <pre>foo
2433 bar
2434 </pre>
2435 <pre>foo
2436 </pre>
2437 <pre>foo
2438 </pre>
2439 <pre>bar
2440 </pre>
2441 !!end
2442
2443 !! test
2444 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2445 !! wikitext
2446 {{echo| }}a
2447
2448 {{echo|
2449 }}a
2450
2451 {{echo|
2452 b}}
2453
2454 {{echo|a
2455 }}b
2456
2457 {{echo|a
2458 }} b
2459 !! html
2460 <pre>a
2461 </pre>
2462 <p><br />
2463 </p>
2464 <pre>a
2465 </pre>
2466 <p><br />
2467 </p>
2468 <pre>b
2469 </pre>
2470 <p>a
2471 </p>
2472 <pre>b
2473 </pre>
2474 <p>a
2475 </p>
2476 <pre>b
2477 </pre>
2478 !!end
2479
2480 !! test
2481 Pres with newline attributes
2482 !! wikitext
2483 <pre class="one
2484 two">hi</pre>
2485 !! html/php
2486 <pre class="one two">hi</pre>
2487
2488 !! html/parsoid
2489 <pre class="one
2490 two" data-parsoid='{"stx":"html"}'>hi</pre>
2491 !! end
2492
2493 !! test
2494 Things that look like <pre> tags aren't treated as such
2495 !! wikitext
2496 Barack Obama <President> of the United States
2497 <President></President>
2498 !! html
2499 <p>Barack Obama &lt;President&gt; of the United States
2500 &lt;President&gt;&lt;/President&gt;
2501 </p>
2502 !! end
2503
2504 ## PHP parser discards the "<pre " string
2505 !! test
2506 Handle broken pre-like tags (bug 64025)
2507 !! options
2508 parsoid=wt2html
2509 !! wikitext
2510 {{echo|<pre <pre>x</pre>}}
2511
2512 <table><pre </table>
2513 !! html/php
2514 <pre>x</pre>
2515 <table><pre></pre></table>
2516
2517 !! html/parsoid
2518 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2519
2520
2521 <p>&lt;pre </p>
2522
2523 <table></table>
2524 !! end
2525
2526 !! test
2527 Parsoid: handle pre with space after attribute
2528 !! options
2529 parsoid=wt2html
2530 !! wikitext
2531 <pre style="width:50%;" >{{echo|foo}}</pre>
2532 !! html/php
2533 <pre style="width:50%;">{{echo|foo}}</pre>
2534
2535 !! html/parsoid
2536 <pre style="width:50%;">{{echo|foo}}</pre>
2537 !! end
2538
2539 # TODO / maybe: fix wt2wt for this
2540 !! test
2541 Parsoid: Don't paragraph-wrap fosterable content
2542 !! options
2543 parsoid=wt2html
2544 !! wikitext
2545 {|
2546 <td></td>
2547 <td></td>
2548
2549
2550
2551 |}
2552 !! html
2553 <table>
2554
2555 <tbody>
2556 <tr>
2557 <td></td>
2558
2559 <td></td></tr>
2560
2561
2562
2563 </tbody></table>
2564 !! end
2565
2566 !! test
2567 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2568 !! options
2569 parsoid=wt2html
2570 !! wikitext
2571 {|
2572 <td>
2573 <td>
2574 </td>
2575
2576
2577
2578 |}
2579 !! html
2580 <table>
2581
2582 <tbody>
2583 <tr>
2584 <td></td>
2585
2586 <td>
2587 </td></tr>
2588
2589
2590
2591 </tbody></table>
2592 !! end
2593
2594
2595 #--------------------------------------------------------------------
2596 # Transclusion parameter whitespace stripping tests
2597 # Behavior is different for positional and named parameters
2598 #--------------------------------------------------------------------
2599 !! test
2600 Templates: Strip leading and trailing whitespace from named-param values
2601 !! wikitext
2602 {{echo|1= a }}
2603
2604 {{echo|1= {{echo|b}} }}
2605
2606 {{echo| 1 =
2607 c }}
2608
2609 {{echo| 1 =
2610 * d
2611 }}
2612 !! html
2613 <p>a
2614 </p><p>b
2615 </p><p>c
2616 </p>
2617 <ul><li> d</li></ul>
2618
2619 !! end
2620
2621 !! test
2622 Templates: Don't strip whitespace from positional-param values
2623 !! wikitext
2624 {{echo|a }}
2625
2626 {{echo|{{echo|b}} }}
2627
2628 {{echo| c
2629 }}
2630
2631 {{echo| {{echo|d}}
2632 }}
2633
2634 {{echo|
2635 e}}
2636
2637 {{echo|
2638 * f}}
2639
2640 {{echo|
2641 }}g
2642 !! html
2643 <p>a
2644 </p><p>b
2645 </p>
2646 <pre>c
2647 </pre>
2648 <p><br />
2649 </p>
2650 <pre>d
2651 </pre>
2652 <p><br />
2653 </p>
2654 <pre>e
2655 </pre>
2656 <p><br />
2657 </p>
2658 <ul><li> f</li></ul>
2659 <p><br />
2660 </p>
2661 <pre>g
2662 </pre>
2663 !! end
2664
2665 !! test
2666 Templates: Handle empty comment-and-ws-only lines correctly
2667 !! wikitext
2668 {{echo|foo
2669 <!--should be ignored-->
2670 <!--should be ignored as well-->
2671 bar}}
2672 !! html
2673 <p>foo
2674 bar
2675 </p>
2676 !! end
2677
2678 !! test
2679 Templates: Handle comments in the target
2680 !! wikitext
2681 {{echo
2682 <!-- should be ignored -->
2683 |foo}}
2684
2685 {{echo<!-- should be ignored -->
2686 |foo}}
2687
2688 {{echo<!-- should be ignored -->|foo}}
2689
2690 {{<!-- should be ignored -->echo|foo}}
2691 !!html/parsoid
2692 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2693
2694 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2695
2696 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2697
2698 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2699 !!end
2700
2701 !! test
2702 Templates: Handle comments in parameter names (bug 67657)
2703 !! wikitext
2704 {{echo|1
2705 <!-- should be ignored -->
2706 =foo}}
2707
2708 {{echo|
2709 <!-- should be ignored -->
2710 1 = foo}}
2711
2712 {{echo|1<!-- should be ignored --> = foo}}
2713
2714 {{echo|<!-- should be ignored -->1 = foo}}
2715 !!html/parsoid
2716 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2717
2718 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2719
2720 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2721
2722 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2723 !!end
2724
2725 !! test
2726 Templates: Other wikitext in parameter names (bug 67657)
2727 !! wikitext
2728 {{echo|''1''=foo}}
2729 !!html/parsoid
2730 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2731 !!html/php
2732 <p>{{{1}}}
2733 </p>
2734 !!end
2735
2736 #--------------------------------------------------------------------
2737 # Transclusion parameter escaping tests
2738 #--------------------------------------------------------------------
2739 !! test
2740 Templates: Parsoid parameter escaping test 1
2741 !! wikitext
2742 {{echo|[foo]|{{echo|[bar]}}}}
2743 !! html/php+tidy
2744 <p>[foo]</p>
2745 !! html/parsoid
2746 <p about="#mwt1" typeof="mw:Transclusion"
2747 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2748 !! end
2749
2750 !! test
2751 Parsoid: Pipes in external links in template parameter
2752 !! wikitext
2753 {{echo|[{{echo|http://example.com}} link]}}
2754 !! html/php+tidy
2755 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2756 !! html/parsoid
2757 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2758 !! end
2759
2760 !! test
2761 Parsoid: pipe in transclusion parameter
2762 !! wikitext
2763 {{echo|http://foo.com/a&#124;b}}
2764 !! html/php+tidy
2765 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2766 !! html/parsoid
2767 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2768 typeof="mw:Transclusion"
2769 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2770 !! end
2771
2772 !! test
2773 Parsoid: Pipe in external link target and content in template parameter
2774 !! options
2775 parsoid=html2wt,wt2wt
2776 !! wikitext
2777 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2778 !! html/php+tidy
2779 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2780 !! html/parsoid
2781 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2782 typeof="mw:Transclusion"
2783 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2784 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2789 !! options
2790 parsoid
2791 !! wikitext
2792 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2793 !! html
2794 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2795 !! end
2796
2797 !! test
2798 Templates: Don't escape already nowiki-escaped text in template parameters
2799 !! options
2800 parsoid=html2wt,wt2wt
2801 !! wikitext
2802 {{echo|foo<nowiki>|</nowiki>bar}}
2803 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2804 {{echo|<nowiki></nowiki>}}
2805 !! html/php+tidy
2806 <p>foo|bar &lt;div&gt;</p>
2807 !! html/parsoid
2808 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2809 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2810 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2811 </p>
2812 !! end
2813
2814 ## Bug 52824
2815 !! test
2816 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2817 !! options
2818 parsoid=html2wt,wt2wt
2819 !! wikitext
2820 {{echo|{{echo|1=bar}}}}
2821 !! html/php+tidy
2822 <p>bar</p>
2823 !! html/parsoid
2824 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2825 !! end
2826
2827 ## Bug 56733
2828 !! test
2829 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2830 !! wikitext
2831 {{echo|a : b}}
2832 !! html/php+tidy
2833 <p>a&#160;: b</p>
2834 !! html/parsoid
2835 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2836 !! end
2837
2838 ## Bug T73412
2839 !! test
2840 Templates: Preserve blank parameter names
2841 !! wikitext
2842 {{echo|=foo}}
2843 !! html/php+tidy
2844 <p>{{{1}}}</p>
2845 !! html/parsoid
2846 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2847 !! end
2848
2849 !! test
2850 Templates: Preserve blank parameter names in other positions
2851 !! wikitext
2852 {{blank_param|bar|=foo}}
2853 !! html/php+tidy
2854 <p>bar foo</p>
2855 !! html/parsoid
2856 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2857 foo</p>
2858 !! end
2859
2860 ###
2861 ### Parsoid-centric tests for testing RT edge cases for pre
2862 ###
2863
2864 !!test
2865 1a. Indent-Pre and Comments
2866 !! wikitext
2867 a
2868 <!--a-->
2869 c
2870 !! html
2871 <pre>a
2872 </pre>
2873 <p>c
2874 </p>
2875 !!end
2876
2877 !!test
2878 1b. Indent-Pre and Comments
2879 !! wikitext
2880 a
2881 <!--a-->
2882 c
2883 !! html
2884 <pre>a
2885 </pre>
2886 <p>c
2887 </p>
2888 !!end
2889
2890 !!test
2891 1c. Indent-Pre and Comments
2892 !! wikitext
2893 <!--a--> a
2894
2895 <!--a--> a
2896 !! html
2897 <pre> a
2898 </pre>
2899 <pre> a
2900 </pre>
2901 !!end
2902
2903 !!test
2904 1d. Indent-Pre and Comments
2905 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2906 !! wikitext
2907 <!--a--> a
2908
2909 <!--b-->b
2910 !! html
2911 <pre>a
2912 </pre>
2913 <pre>b
2914 </pre>
2915 !!end
2916
2917 !!test
2918 2a. Indent-Pre and tables
2919 !! wikitext
2920 {|
2921 |-
2922 !h1!!h2
2923 |foo||bar
2924 |}
2925 !! html
2926 <table>
2927
2928 <tr>
2929 <th>h1</th>
2930 <th>h2
2931 </th>
2932 <td>foo</td>
2933 <td>bar
2934 </td></tr></table>
2935
2936 !!end
2937
2938 !!test
2939 2b. Indent-Pre and tables
2940 !! wikitext
2941 {|
2942 |-
2943 |foo
2944 |}
2945 !! html
2946 <table>
2947
2948 <tr>
2949 <td>foo
2950 </td></tr></table>
2951
2952 !!end
2953
2954 !!test
2955 2c. Indent-Pre and tables (bug 42252)
2956 !! wikitext
2957 {|
2958 |+ foo
2959 ! | bar
2960 |}
2961 !! html
2962 <table>
2963 <caption> foo
2964 </caption>
2965 <tr>
2966 <th> bar
2967 </th></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2d. Indent-Pre and tables
2973 !! wikitext
2974 a
2975 {|
2976 | b
2977 |}
2978 !! html/php
2979 <pre>a
2980 </pre>
2981 <table>
2982 <tr>
2983 <td> b
2984 </td></tr></table>
2985
2986 !! html/parsoid
2987 <pre>a</pre>
2988 <table>
2989 <tbody><tr><td> b</td></tr>
2990 </tbody></table>
2991 !!end
2992
2993 !!test
2994 2e. Indent-Pre and table-line syntax
2995 !! wikitext
2996 a
2997 | b
2998 | c
2999 !! html/php
3000 <pre>a
3001 | b
3002 | c
3003 </pre>
3004 !!end
3005
3006 !!test
3007 2f. Indent-pre started by table-line syntax
3008 !! wikitext
3009 a
3010 | b
3011 | c
3012 !! html/php
3013 <p>a
3014 </p>
3015 <pre>| b
3016 | c
3017 </pre>
3018 !! html/parsoid
3019 <p>a</p>
3020 <pre>
3021 | b
3022 | c</pre>
3023 !!end
3024
3025 !!test
3026 3a. Indent-Pre and block tags (single-line html)
3027 !! wikitext
3028 a <p> foo </p>
3029 b <div> foo </div>
3030 c <blockquote> foo </blockquote>
3031 <span> foo </span>
3032 !! html
3033 a <p> foo </p>
3034 b <div> foo </div>
3035 c <blockquote> foo </blockquote>
3036 <pre><span> foo </span>
3037 </pre>
3038 !! html/parsoid
3039 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3040 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3041 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3042 <pre><span> foo </span>
3043 </pre>
3044 !! html+tidy
3045 <p>a</p>
3046 <p>foo</p>
3047 <p>b</p>
3048 <div>foo</div>
3049 <p>c</p>
3050 <blockquote>
3051 <p>foo</p>
3052 </blockquote>
3053 <pre>
3054 <span> foo </span>
3055 </pre>
3056 !! end
3057
3058 !!test
3059 3b. Indent-Pre and block tags (multi-line html)
3060 !! wikitext
3061 a <span>foo</span>
3062 b <div> foo </div>
3063 !! html
3064 <pre>a <span>foo</span>
3065 </pre>
3066 b <div> foo </div>
3067
3068 !! html/parsoid
3069 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3070 b <div data-parsoid='{"stx":"html"}'> foo </div>
3071 !! html+tidy
3072 <pre>
3073 a <span>foo</span>
3074 </pre>
3075 <p>b</p>
3076 <div>foo</div>
3077 !!end
3078
3079 !!test
3080 3c. Indent-Pre and block tags (pre-content on separate line)
3081 !! wikitext
3082 <p>
3083 foo
3084 </p>
3085
3086 <div>
3087 foo
3088 </div>
3089
3090 <center>
3091 foo
3092 </center>
3093
3094 <blockquote>
3095 foo
3096 </blockquote>
3097
3098 <blockquote>
3099 <pre>
3100 foo
3101 </pre>
3102 </blockquote>
3103
3104 <table><tr><td>
3105 foo
3106 </td></tr></table>
3107
3108 <ul><li>
3109 foo
3110 </li></ul>
3111
3112 !! html
3113 <p>
3114 foo
3115 </p>
3116 <div>
3117 <pre>foo
3118 </pre>
3119 </div>
3120 <center>
3121 <pre>foo
3122 </pre>
3123 </center>
3124 <blockquote>
3125 <p> foo
3126 </p>
3127 </blockquote>
3128 <blockquote>
3129 <pre>
3130 foo
3131 </pre>
3132 </blockquote>
3133 <table><tr><td>
3134 <pre>foo
3135 </pre>
3136 </td></tr></table>
3137 <ul><li>
3138 foo
3139 </li></ul>
3140
3141 !!end
3142
3143 !!test
3144 4. Indent-Pre and extension tags
3145 !! wikitext
3146 a <gallery>
3147 File:foobar.jpg
3148 </gallery>
3149 !! html
3150 a <ul class="gallery mw-gallery-traditional">
3151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3152 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3153 <div class="gallerytext">
3154 </div>
3155 </div></li>
3156 </ul>
3157
3158 !! html+tidy
3159 <p>a</p>
3160 <ul class="gallery mw-gallery-traditional">
3161 <li class="gallerybox" style="width: 155px">
3162 <div style="width: 155px">
3163 <div class="thumb" style="width: 150px;">
3164 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3165 </div>
3166 <div class="gallerytext"></div>
3167 </div>
3168 </li>
3169 </ul>
3170 !!end
3171
3172 !! test
3173 Table wikitext syntax outside wiki-tables
3174 !! wikitext
3175 a
3176 ! not a table heading
3177 |- not a table row
3178 | not a table cell
3179 | class="foo bar" | baz
3180 b
3181 |}
3182 |-
3183 c
3184 !! html
3185 <p>a
3186 ! not a table heading
3187 |- not a table row
3188 | not a table cell
3189 | class="foo bar" | baz
3190 b
3191 |}
3192 |-
3193 c
3194 </p>
3195 !! end
3196
3197 !!test
3198 Render paragraphs when indent-pre is suppressed in blocklevels
3199 !! wikitext
3200 <blockquote>
3201 foo
3202
3203 bar
3204 </blockquote>
3205 !! html
3206 <blockquote>
3207 <p> foo
3208 </p><p> bar
3209 </p>
3210 </blockquote>
3211
3212 !!end
3213
3214 !!test
3215 4. Multiple spaces at start-of-line
3216 !! wikitext
3217 <p> foo </p>
3218 foo
3219 {|
3220 |foo
3221 |}
3222 !! html
3223 <p> foo </p>
3224 <pre> foo
3225 </pre>
3226 <table>
3227 <tr>
3228 <td>foo
3229 </td></tr></table>
3230
3231 !!end
3232
3233 ## NOTE: the leading white-space chars on empty line are significant
3234 !! test
3235 5a. White-space in indent-pre
3236 !! wikitext
3237 a<br />
3238
3239 b
3240 !! html
3241 <pre>a<br />
3242
3243 b
3244 </pre>
3245 !! end
3246
3247 ## NOTE: the leading white-space chars on empty line are significant
3248 !! test
3249 5b. White-space in indent-pre
3250 !! wikitext
3251 a
3252
3253 b
3254
3255
3256 c
3257 !! html
3258 <pre>a
3259
3260 b
3261
3262
3263 c
3264 </pre>
3265 !! end
3266
3267 !! test
3268 5c. White-space in indent-pre
3269 !! wikitext
3270 ''a''
3271 ''b''
3272 ''c''
3273 !! html
3274 <pre><i>a</i>
3275 <i>b</i>
3276 <i>c</i>
3277 </pre>
3278 !! end
3279
3280 !! test
3281 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3282 !! wikitext
3283 a
3284
3285 <!-- continue -->
3286 b
3287
3288 c
3289
3290 d
3291 !! html
3292 <pre>a
3293
3294 b
3295 </pre>
3296 <pre>c
3297
3298 </pre>
3299 <p>d
3300 </p>
3301 !! end
3302
3303 !! test
3304 7a. Indent-pre and category links
3305 !! options
3306 parsoid=wt2html,wt2wt
3307 !! wikitext
3308 [[Category:foo]] <!-- No pre-wrapping -->
3309 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3310 !! html/php+tidy
3311 !! html/parsoid
3312 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3313 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3314 !! end
3315
3316 !! test
3317 7b. Indent-pre and category links
3318 !! options
3319 parsoid=wt2html,wt2wt
3320 !! wikitext
3321 [[Category:foo]] a
3322 [[Category:foo]] {{echo|b}}
3323 !! html
3324 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3325 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3326 !! end
3327
3328 !! test
3329 Indent-Pre: Newlines in comments shouldn't affect sol state
3330 !! wikitext
3331 a <!--
3332 foo
3333 --> b
3334 !! html/php+tidy
3335 <p>a b</p>
3336 !! html/parsoid
3337 <p>a <!--
3338 foo
3339 --> b</p>
3340 !! end
3341
3342 ###
3343 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3344 ###
3345
3346 !!test
3347 HTML-pre: 1. embedded newlines
3348 !! wikitext
3349 <pre>foo</pre>
3350
3351 <pre>
3352 foo
3353 </pre>
3354
3355 <pre>
3356
3357 foo
3358 </pre>
3359
3360 <pre>
3361
3362
3363 foo
3364 </pre>
3365 !! html/php+tidy
3366 <pre>
3367 foo
3368 </pre>
3369 <pre>
3370 foo
3371 </pre>
3372 <pre>
3373
3374 foo
3375 </pre>
3376 <pre>
3377
3378
3379 foo
3380 </pre>
3381 !! html/parsoid
3382 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3383
3384 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3385 foo
3386 </pre>
3387
3388 <pre data-parsoid='{"stx":"html"}'>
3389
3390 foo
3391 </pre>
3392
3393 <pre data-parsoid='{"stx":"html"}'>
3394
3395
3396 foo
3397 </pre>
3398 !!end
3399
3400 !! test
3401 HTML-pre: big spaces
3402 !! wikitext
3403 <pre>
3404
3405
3406
3407
3408 haha
3409
3410
3411
3412
3413 haha
3414
3415
3416
3417
3418 </pre>
3419 !! html/php+tidy
3420 <pre>
3421
3422
3423
3424
3425 haha
3426
3427
3428
3429
3430 haha
3431
3432
3433
3434
3435 </pre>
3436 !! html/parsoid
3437 <pre data-parsoid='{"stx":"html"}'>
3438
3439
3440
3441
3442 haha
3443
3444
3445
3446
3447 haha
3448
3449
3450
3451
3452 </pre>
3453 !! end
3454
3455 !!test
3456 HTML-pre: 2: indented text
3457 !! wikitext
3458 <pre>
3459 foo
3460 </pre>
3461 !! html
3462 <pre>
3463 foo
3464 </pre>
3465
3466 !!end
3467
3468 !!test
3469 HTML-pre: 3: other wikitext
3470 !! wikitext
3471 <pre>
3472 * foo
3473 # bar
3474 = no-h =
3475 '' no-italic ''
3476 [[ NoLink ]]
3477 </pre>
3478 !! html/php
3479 <pre>
3480 * foo
3481 # bar
3482 = no-h =
3483 '' no-italic ''
3484 [[ NoLink ]]
3485 </pre>
3486
3487 !! html/parsoid
3488 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3489 # bar
3490 = no-h =
3491 '' no-italic ''
3492 [[ NoLink ]]
3493 </pre>
3494 !!end
3495
3496 ###
3497 ### Definition lists
3498 ###
3499 !! test
3500 Simple definition
3501 !! wikitext
3502 ; name : Definition
3503 !! html
3504 <dl><dt> name&#160;</dt>
3505 <dd> Definition</dd></dl>
3506
3507 !! end
3508
3509 !! test
3510 Definition list for indentation only
3511 !! wikitext
3512 : Indented text
3513 !! html
3514 <dl><dd> Indented text</dd></dl>
3515
3516 !! end
3517
3518 !! test
3519 Definition list with no space
3520 !! wikitext
3521 ;name:Definition
3522 !! html
3523 <dl><dt>name</dt>
3524 <dd>Definition</dd></dl>
3525
3526 !!end
3527
3528 !! test
3529 Definition list with URL link
3530 !! wikitext
3531 ; http://example.com/ : definition
3532 !! html
3533 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3534 <dd> definition</dd></dl>
3535
3536 !! end
3537
3538 !! test
3539 Definition list with bracketed URL link
3540 !! wikitext
3541 ;[http://www.example.com/ Example]:Something about it
3542 !! html
3543 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3544 <dd>Something about it</dd></dl>
3545
3546 !! end
3547
3548 !! test
3549 Definition list with wikilink containing colon
3550 !! wikitext
3551 ; [[Help:FAQ]]: The least-read page on Wikipedia
3552 !! html
3553 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3554 <dd> The least-read page on Wikipedia</dd></dl>
3555
3556 !! end
3557
3558 # At Brion's and JeLuF's insistence... :)
3559 !! test
3560 Definition list with news link containing colon
3561 !! wikitext
3562 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3563 !! html/php
3564 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3565 <dd> This isn't even a real newsgroup!</dd></dl>
3566
3567 !! html/parsoid
3568 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3569 !! end
3570
3571 !! test
3572 Malformed definition list with colon
3573 !! wikitext
3574 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3575 !! html
3576 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3577
3578 !! end
3579
3580 !! test
3581 Definition lists: colon in external link text
3582 !! wikitext
3583 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3584 !! html
3585 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3586 <dd> OK, I made that up</dd></dl>
3587
3588 !! end
3589
3590 !! test
3591 Definition lists: colon in HTML attribute
3592 !! wikitext
3593 ;<b style="display: inline">bold</b>
3594 !! html
3595 <dl><dt><b style="display: inline">bold</b></dt></dl>
3596
3597 !! end
3598
3599 !! test
3600 Definition lists: self-closed tag
3601 !! wikitext
3602 ;one<br/>two : two-line fun
3603 !! html
3604 <dl><dt>one<br />two&#160;</dt>
3605 <dd> two-line fun</dd></dl>
3606
3607 !! end
3608
3609 !! test
3610 Bug 11748: Literal closing tags
3611 !! wikitext
3612 <dl>
3613 <dt>test 1</dt>
3614 <dd>test test test test test</dd>
3615 <dt>test 2</dt>
3616 <dd>test test test test test</dd>
3617 </dl>
3618 !! html
3619 <dl>
3620 <dt>test 1</dt>
3621 <dd>test test test test test</dd>
3622 <dt>test 2</dt>
3623 <dd>test test test test test</dd>
3624 </dl>
3625
3626 !! end
3627
3628 !! test
3629 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3630 !! wikitext
3631 <ul><li>
3632 ; term : description
3633 * unordered
3634 </li></ul>
3635 !! html
3636 <ul><li>
3637 <dl><dt> term&#160;</dt>
3638 <dd> description</dd></dl>
3639 <ul><li> unordered</li></ul>
3640 </li></ul>
3641
3642 !! end
3643
3644 !! test
3645
3646 Definition list with empty definition and following paragraph
3647 !! wikitext
3648 ; term:
3649 Paragraph text
3650 !! html
3651 <dl><dt> term</dt>
3652 <dd></dd></dl>
3653 <p>Paragraph text
3654 </p>
3655 !! end
3656
3657 !! test
3658 Nested definition lists using html syntax
3659 !! wikitext
3660 <dl><dt>x</dt>
3661 <dd>a</dd>
3662 <dd>b</dd></dl>
3663
3664 !! end
3665
3666 !! test
3667 Definition Lists: No nesting: Multiple dd's
3668 !! wikitext
3669 ;x
3670 :a
3671 :b
3672 !! html
3673 <dl><dt>x</dt>
3674 <dd>a</dd>
3675 <dd>b</dd></dl>
3676
3677 !! end
3678
3679 !! test
3680 Definition Lists: Indentation: Regular
3681 !! wikitext
3682 :i1
3683 ::i2
3684 :::i3
3685 !! html
3686 <dl><dd>i1
3687 <dl><dd>i2
3688 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3689
3690 !! end
3691
3692 !! test
3693 Definition Lists: Indentation: Missing 1st level
3694 !! wikitext
3695 ::i2
3696 :::i3
3697 !! html
3698 <dl><dd><dl><dd>i2
3699 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3700
3701 !! end
3702
3703 !! test
3704 Definition Lists: Indentation: Multi-level indent
3705 !! wikitext
3706 :::i3
3707 !! html
3708 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition Lists: Hacky use to indent tables
3714 !! wikitext
3715 ::{|
3716 |foo
3717 |bar
3718 |}
3719 this text
3720 should be left alone
3721 !! html
3722 <dl><dd><dl><dd><table>
3723 <tr>
3724 <td>foo
3725 </td>
3726 <td>bar
3727 </td></tr></table></dd></dl></dd></dl>
3728 <p>this text
3729 should be left alone
3730 </p>
3731 !! end
3732
3733 !! test
3734 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3735 !! wikitext
3736 <!-- foo -->
3737 ::{|
3738 |foo
3739 |bar
3740 |}<!-- bar -->
3741 this text
3742 should be left alone
3743 !! html/parsoid
3744 <!-- foo -->
3745 <dl><dd><dl><dd><table><tr>
3746 <td>foo</td>
3747 <td>bar</td>
3748 </tr></table><!-- bar --></dd></dl></dd></dl>
3749 <p>this text
3750 should be left alone</p>
3751 !! end
3752
3753 !! test
3754 Definition Lists: Hacky use to indent tables, with comment before table
3755 !! wikitext
3756 ::<!-- foo -->{|
3757 |foo
3758 |}
3759 !! html/parsoid
3760 <dl><dd><dl><dd><!-- foo --><table><tr>
3761 <td>foo</td>
3762 </tr></table></dd></dl></dd></dl>
3763 !! end
3764
3765 # The trailing whitespace in this test is to catch a regression in
3766 # Parsoid after T54473.
3767 !! test
3768 Definition Lists: Hacky use to indent tables (WS-insensitive)
3769 !! wikitext
3770 : {|
3771 |a
3772 |}
3773 !! html/php
3774 <dl><dd><table>
3775 <tr>
3776 <td>a
3777 </td></tr></table></dd></dl>
3778
3779 !! html/parsoid
3780 <dl><dd> <table>
3781 <tbody><tr><td>a</td></tr>
3782 </tbody></table> </dd></dl>
3783 !! end
3784
3785 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3786 ## as an empty dt item. It also ignores all but the last ";" when followed
3787 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3788 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3789 ## ";"s.
3790 ##
3791 ## Ex: ";;t2 ::d2" is transformed into:
3792 ##
3793 ## <dl>
3794 ## <dt>t2 </dt>
3795 ## <dd>
3796 ## <dl>
3797 ## <dt></dt>
3798 ## <dd>d2</dd>
3799 ## </dl>
3800 ## </dd>
3801 ## </dl>
3802 ##
3803 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3804 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3805 ##
3806 ## <dl>
3807 ## <dt>
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>:d2</dd>
3811 ## </dl>
3812 ## </dt>
3813 ## </dl>
3814 ##
3815 ## All Parsoid only definition list tests have this difference.
3816 ##
3817 ## See also: https://phabricator.wikimedia.org/T8569
3818 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3819
3820 !! test
3821 Table / list interaction: indented table with lists in table contents
3822 !! wikitext
3823 :{|
3824 |-
3825 | a
3826 * b
3827 |-
3828 | c
3829 * d
3830 |}
3831 !! html
3832 <dl><dd><table>
3833
3834 <tr>
3835 <td> a
3836 <ul><li> b</li></ul>
3837 </td></tr>
3838 <tr>
3839 <td> c
3840 <ul><li> d</li></ul>
3841 </td></tr></table></dd></dl>
3842
3843 !! end
3844
3845 !!test
3846 Table / list interaction: lists nested in tables nested in indented lists
3847 !! wikitext
3848 :{|
3849 |
3850 :a
3851 :b
3852 |
3853 *c
3854 *d
3855 |}
3856
3857 *e
3858 *f
3859 !! html
3860 <dl><dd><table>
3861 <tr>
3862 <td>
3863 <dl><dd>a</dd>
3864 <dd>b</dd></dl>
3865 </td>
3866 <td>
3867 <ul><li>c</li>
3868 <li>d</li></ul>
3869 </td></tr></table></dd></dl>
3870 <ul><li>e</li>
3871 <li>f</li></ul>
3872
3873 !!end
3874
3875 !! test
3876 Definition Lists: Nesting: Multi-level (Parsoid only)
3877 !! options
3878 parsoid
3879 !! wikitext
3880 ;t1 :d1
3881 ;;t2 ::d2
3882 ;;;t3 :::d3
3883 !! html
3884 <dl>
3885 <dt>t1 </dt>
3886 <dd>d1</dd>
3887 <dt>
3888 <dl>
3889 <dt>t2 </dt>
3890 <dd>:d2</dd>
3891 <dt>
3892 <dl>
3893 <dt>t3 </dt>
3894 <dd>::d3</dd>
3895 </dl>
3896 </dt>
3897 </dl>
3898 </dt>
3899 </dl>
3900
3901
3902 !! end
3903
3904
3905 !! test
3906 Definition Lists: Nesting: Test 2 (Parsoid only)
3907 !! wikitext
3908 ;t1
3909 ::d2
3910 !! html/php+tidy
3911 <dl>
3912 <dt>t1</dt>
3913 <dd>
3914 <dl>
3915 <dd>d2</dd>
3916 </dl>
3917 </dd>
3918 </dl>
3919 !! html/parsoid
3920 <dl>
3921 <dt>t1</dt>
3922 <dd>
3923 <dl>
3924 <dd>d2</dd>
3925 </dl>
3926 </dd>
3927 </dl>
3928
3929 !! end
3930
3931
3932 !! test
3933 Definition Lists: Nesting: Test 3 (Parsoid only)
3934 !! wikitext
3935 :;t1
3936 ::::d2
3937 !! html/php+tidy
3938 <dl>
3939 <dd>
3940 <dl>
3941 <dt>t1</dt>
3942 <dd>
3943 <dl>
3944 <dd>
3945 <dl>
3946 <dd>d2</dd>
3947 </dl>
3948 </dd>
3949 </dl>
3950 </dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954 !! html/parsoid
3955 <dl>
3956 <dd>
3957 <dl>
3958 <dt>t1</dt>
3959 <dd>
3960 <dl>
3961 <dd>
3962 <dl>
3963 <dd>d2</dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 </dd>
3970 </dl>
3971
3972 !! end
3973
3974
3975 !! test
3976 Definition Lists: Nesting: Test 4
3977 !! wikitext
3978 ::;t3
3979 :::d3
3980 !! html
3981 <dl><dd><dl><dd><dl><dt>t3</dt>
3982 <dd>d3</dd></dl></dd></dl></dd></dl>
3983
3984 !! end
3985
3986
3987 ## The Parsoid team believes the following three test exposes a
3988 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3989 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3990 ## It also exposes a "misfeature" in tidy, which doesn't like
3991 ## <dl> tags with a single <dt> child; it converts the <dt> into
3992 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3993 !! test
3994 Definition Lists: Mixed Lists: Test 1
3995 !! wikitext
3996 :;* foo
3997 ::* bar
3998 :; baz
3999 !! html/php
4000 <dl><dd><dl><dt><ul><li> foo</li>
4001 <li> bar</li></ul></dt></dl>
4002 <dl><dt> baz</dt></dl></dd></dl>
4003
4004 !! html/php+tidy
4005 <dl>
4006 <dd>
4007 <dl>
4008 <dd>
4009 <ul>
4010 <li>foo</li>
4011 <li>bar</li>
4012 </ul>
4013 </dd>
4014 </dl>
4015 <dl>
4016 <dt>baz</dt>
4017 </dl>
4018 </dd>
4019 </dl>
4020 !! html/parsoid
4021 <dl>
4022 <dd><dl>
4023 <dt><ul>
4024 <li> foo
4025 </li>
4026 </ul></dt>
4027 <dd><ul>
4028 <li> bar
4029 </li>
4030 </ul></dd>
4031 <dt> baz</dt>
4032 </dl></dd>
4033 </dl>
4034 !! end
4035
4036 !! test
4037 Definition Lists: Mixed Lists: Test 2
4038 !! wikitext
4039 *: d1
4040 *: d2
4041 !! html
4042 <ul><li><dl><dd> d1</dd>
4043 <dd> d2</dd></dl></li></ul>
4044
4045 !! end
4046
4047
4048 !! test
4049 Definition Lists: Mixed Lists: Test 3
4050 !! wikitext
4051 *::: d1
4052 *::: d2
4053 !! html
4054 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4055 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4056
4057 !! end
4058
4059
4060 !! test
4061 Definition Lists: Mixed Lists: Test 4
4062 !! wikitext
4063 *;d1 :d2
4064 *;d3 :d4
4065 !! html
4066 <ul><li><dl><dt>d1&#160;</dt>
4067 <dd>d2</dd>
4068 <dt>d3&#160;</dt>
4069 <dd>d4</dd></dl></li></ul>
4070
4071 !! end
4072
4073
4074 !! test
4075 Definition Lists: Mixed Lists: Test 5
4076 !! wikitext
4077 *:d1
4078 *:: d2
4079 !! html
4080 <ul><li><dl><dd>d1
4081 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Mixed Lists: Test 6
4088 !! wikitext
4089 #*:d1
4090 #*::: d3
4091 !! html
4092 <ol><li><ul><li><dl><dd>d1
4093 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4094
4095 !! end
4096
4097
4098 !! test
4099 Definition Lists: Mixed Lists: Test 7
4100 !! wikitext
4101 :* d1
4102 :* d2
4103 !! html
4104 <dl><dd><ul><li> d1</li>
4105 <li> d2</li></ul></dd></dl>
4106
4107 !! end
4108
4109
4110 !! test
4111 Definition Lists: Mixed Lists: Test 8
4112 !! wikitext
4113 :* d1
4114 ::* d2
4115 !! html
4116 <dl><dd><ul><li> d1</li></ul>
4117 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4118
4119 !! end
4120
4121
4122 !! test
4123 Definition Lists: Mixed Lists: Test 9
4124 !! wikitext
4125 *;foo :bar
4126 !! html
4127 <ul><li><dl><dt>foo&#160;</dt>
4128 <dd>bar</dd></dl></li></ul>
4129
4130 !! end
4131
4132
4133 !! test
4134 Definition Lists: Mixed Lists: Test 10
4135 !! wikitext
4136 *#;foo :bar
4137 !! html
4138 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4139 <dd>bar</dd></dl></li></ol></li></ul>
4140
4141 !! end
4142
4143 # The Parsoid team disagrees with the PHP parser's seemingly-random
4144 # rules regarding dd/dt on the next two tests. Parsoid is more
4145 # consistent, and recognizes the shared nesting and keeps the
4146 # still-open tags around until the nesting is complete.
4147 # (And tidy again converts <dt> to <dd> before 'bar'.)
4148
4149 !! test
4150 Definition Lists: Mixed Lists: Test 11
4151 !! wikitext
4152 *#*#;*;;foo :bar
4153 *#*#;boo :baz
4154 !! html/php
4155 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4156 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4157 <dl><dt>boo&#160;</dt>
4158 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4159
4160 !! html/php+tidy
4161 <ul>
4162 <li>
4163 <ol>
4164 <li>
4165 <ul>
4166 <li>
4167 <ol>
4168 <li>
4169 <dl>
4170 <dt>foo&#160;</dt>
4171 <dd>
4172 <ul>
4173 <li>
4174 <dl>
4175 <dd>
4176 <dl>
4177 <dt>bar</dt>
4178 </dl>
4179 </dd>
4180 </dl>
4181 </li>
4182 </ul>
4183 </dd>
4184 </dl>
4185 <dl>
4186 <dt>boo&#160;</dt>
4187 <dd>baz</dd>
4188 </dl>
4189 </li>
4190 </ol>
4191 </li>
4192 </ul>
4193 </li>
4194 </ol>
4195 </li>
4196 </ul>
4197 !! html/parsoid
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>
4208 <ul>
4209 <li>
4210 <dl>
4211 <dt>
4212 <dl>
4213 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4214 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4215 </dl></dt>
4216 </dl></li>
4217 </ul></dt>
4218 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4219 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4220 </dl></li>
4221 </ol></li>
4222 </ul></li>
4223 </ol></li>
4224 </ul>
4225 !! end
4226
4227
4228 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4229 # From whitelist:
4230 # * The test is wrong, there are two colons where there should be :;
4231 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4232 !! test
4233 Definition Lists: Weird Ones: Test 1
4234 !! wikitext
4235 *#;*::;; foo : bar (who uses this?)
4236 !! html/php
4237 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4238 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4239
4240 !! html/php+tidy
4241 <ul>
4242 <li>
4243 <ol>
4244 <li>
4245 <dl>
4246 <dt>foo&#160;</dt>
4247 <dd>
4248 <ul>
4249 <li>
4250 <dl>
4251 <dd>
4252 <dl>
4253 <dd>
4254 <dl>
4255 <dd>
4256 <dl>
4257 <dt>bar (who uses this?)</dt>
4258 </dl>
4259 </dd>
4260 </dl>
4261 </dd>
4262 </dl>
4263 </dd>
4264 </dl>
4265 </li>
4266 </ul>
4267 </dd>
4268 </dl>
4269 </li>
4270 </ol>
4271 </li>
4272 </ul>
4273 !! html/parsoid
4274 <ul>
4275 <li>
4276 <ol>
4277 <li>
4278 <dl>
4279 <dt>
4280 <ul>
4281 <li>
4282 <dl>
4283 <dd>
4284 <dl>
4285 <dd>
4286 <dl>
4287 <dt>
4288 <dl>
4289 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4290 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4291 </dl></dt>
4292 </dl></dd>
4293 </dl></dd>
4294 </dl></li>
4295 </ul></dt>
4296 </dl></li>
4297 </ol></li>
4298 </ul>
4299 !! end
4300
4301 !! test
4302 Definition Lists: colons occurring in tags
4303 !! wikitext
4304 ;a:b
4305 ;'''a:b'''
4306 ;<i>a:b</i>
4307 ;<span>a:b</span>
4308 ;<div>a:b</div>
4309 ;<div>a
4310 :b</div>
4311 ;{{echo|a:b}}
4312 ;{{echo|''a:b''}}
4313 ;;;''a:b''
4314 !! html+tidy
4315 <dl>
4316 <dt>a</dt>
4317 <dd>b</dd>
4318 <dt><b>a:b</b></dt>
4319 <dt><i>a:b</i></dt>
4320 <dt><span>a:b</span></dt>
4321 <dd>
4322 <div>a:b</div>
4323 </dd>
4324 <dd>
4325 <div>a
4326 <dl>
4327 <dd>b</dd>
4328 </dl>
4329 </div>
4330 </dd>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><i>a:b</i></dt>
4334 </dl>
4335 <dl>
4336 <dd>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dt><i>a:b</i></dt>
4341 </dl>
4342 </dd>
4343 </dl>
4344 </dd>
4345 </dl>
4346 !! html/parsoid
4347 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4348 <dt><b>a:b</b></dt>
4349 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4350 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4351 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4352 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4353 <dd>b</dd>
4354 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4355 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4356 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4357 !! end
4358
4359 !! test
4360 Definition Lists: colons and tables 1
4361 !! wikitext
4362 :{|
4363 | x
4364 |}
4365 :{|
4366 | y
4367 |}
4368 !! html
4369 <dl><dd><table>
4370 <tr>
4371 <td> x
4372 </td></tr></table></dd></dl>
4373 <dl><dd><table>
4374 <tr>
4375 <td> y
4376 </td></tr></table></dd></dl>
4377
4378 !! end
4379
4380 # Parsoid's output (as documented below) differs from php's in this case.
4381 # This is probably a bug. If we fixup parsoid to match php's output, the
4382 # above test should pass and the below test case can be removed. It is
4383 # unclear which output is more desirable.
4384
4385 !! test
4386 Definition Lists: colons and tables 2
4387 !! wikitext
4388 :{|
4389 | x
4390 |}
4391 :{|
4392 | y
4393 |}
4394 !! html/parsoid
4395 <dl><dd><table>
4396 <tr>
4397 <td> x
4398 </td></tr></table></dd>
4399 <dd><table>
4400 <tr>
4401 <td> y
4402 </td></tr></table></dd></dl>
4403 !! end
4404
4405 !! test
4406 Definition Lists: template interaction
4407 !! wikitext
4408 ::{{definition_list}}
4409
4410 :one
4411 ::{{definition_list}}
4412 :::two
4413 :::three
4414 ::four
4415 !! html/parsoid
4416 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4417 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4418
4419 <dl><dd data-parsoid='{}'>one
4420 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4421 </span><dd about="#mwt2">two
4422 <dl><dd>two</dd>
4423 <dd>three</dd></dl></dd>
4424 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4425 !! end
4426
4427
4428 ###
4429 ### External links
4430 ###
4431 !! test
4432 External links: non-bracketed
4433 !! wikitext
4434 Non-bracketed: http://example.com
4435 !! html
4436 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4437 </p>
4438 !! end
4439
4440 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4441 !! test
4442 External links: numbered
4443 !! wikitext
4444 Numbered: [http://example.com]
4445 Numbered: [http://example.net]
4446 Numbered: [http://example.com]
4447 !! html/php
4448 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4449 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4450 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4451 </p>
4452 !! html/parsoid
4453 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4454 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4455 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4456 !!end
4457
4458 !! test
4459 External links: specified text
4460 !! wikitext
4461 Specified text: [http://example.com link]
4462 !! html
4463 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4464 </p>
4465 !!end
4466
4467 !! test
4468 External links: trail
4469 !! wikitext
4470 Linktrails should not work for external links: [http://example.com link]s
4471 !! html
4472 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4473 </p>
4474 !! end
4475
4476 !! test
4477 External links: dollar sign in URL
4478 !! wikitext
4479 http://example.com/1$2345
4480 !! html
4481 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4482 </p>
4483 !! end
4484
4485 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4486 !! test
4487 External links: dollar sign in URL (autonumber)
4488 !! wikitext
4489 [http://example.com/1$2345]
4490 !! html/php
4491 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4492 </p>
4493 !! html/parsoid
4494 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4495 !!end
4496
4497 !! test
4498 External links: open square bracket forbidden in URL (bug 4377)
4499 !! options
4500 parsoid=wt2html,wt2wt,html2html
4501 !! wikitext
4502 http://example.com/1[2345
4503 !! html/php
4504 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4505 </p>
4506 !! html/parsoid
4507 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4508 !! end
4509
4510 !! test
4511 External links: open square bracket forbidden in URL (named) (bug 4377)
4512 !! options
4513 parsoid=wt2html,html2html
4514 !! wikitext
4515 [http://example.com/1[2345]
4516 !! html/php
4517 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4518 </p>
4519 !! html/parsoid
4520 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4521 !!end
4522
4523 # parsoid adds a space before the link name
4524 !! test
4525 External links: open square bracket forbidden in URL (named) (bug 4377)
4526 Parsoid variant.
4527 !! wikitext
4528 [http://example.com/1 [2345]
4529 !! html
4530 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4531 </p>
4532 !!end
4533
4534 !! test
4535 External links: nowiki in URL link text (bug 6230)
4536 !! wikitext
4537 [http://example.com/ <nowiki>''example site''</nowiki>]
4538 !! html
4539 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4540 </p>
4541 !! end
4542
4543 !! test
4544 External links: newline forbidden in text (bug 6230 regression check)
4545 !! wikitext
4546 [http://example.com/ first
4547 second]
4548 !! html
4549 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4550 second]
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: Pipe char between url and text
4556 !! wikitext
4557 [http://example.com | link]
4558 !! html
4559 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4560 </p>
4561 !!end
4562
4563 !! test
4564 External links: protocol-relative URL in brackets
4565 !! wikitext
4566 [//example.com/ Test]
4567 !! html
4568 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4569 </p>
4570 !! end
4571
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: protocol-relative URL in brackets without text
4575 !! wikitext
4576 [//example.com]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4582 !! end
4583
4584 !! test
4585 External links: protocol-relative URL in free text is left alone
4586 !! wikitext
4587 //example.com/Foo
4588 !! html
4589 <p>//example.com/Foo
4590 </p>
4591 !!end
4592
4593 !! test
4594 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4595 !! wikitext
4596 foo//example.com/Foo
4597 !! html
4598 <p>foo//example.com/Foo
4599 </p>
4600 !! end
4601
4602 !! test
4603 External links: with no contents
4604 !! wikitext
4605 [http://en.wikipedia.org/wiki/Foo]
4606
4607 [[wikipedia:Foo|Bar]]
4608
4609 [[wikipedia:Foo|<span>Bar</span>]]
4610 !! html/php
4611 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4612 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4613 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4614 </p>
4615 !! html/parsoid
4616 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4617 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4618 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4619 !! end
4620
4621 !! test
4622 External links: Free with trailing punctuation
4623 !! wikitext
4624 http://example.com,
4625 http://example.com;
4626 http://example.com\
4627 http://example.com.
4628 http://example.com:
4629 http://example.com!
4630 http://example.com?
4631 http://example.com)
4632 http://example.com/url_with_(brackets)
4633 (http://example.com/url_without_brackets)
4634 http://example.com/url_with_entity&nbsp;
4635 http://example.com/url_with_entity&#xA0;
4636 http://example.com/url_with_entity&#160;
4637 http://example.com/url_with_entity&lt;
4638 http://example.com/url_with_entity&#x3C;
4639 http://example.com/url_with_entity&#60;
4640 !! html/php
4641 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4642 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4643 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4644 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4645 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4647 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4648 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4649 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4650 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4651 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4652 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4653 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4654 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4655 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4656 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4657 </p>
4658 !! html/parsoid
4659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4660 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4661 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4662 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4663 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4664 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4665 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4666 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4667 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4668 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4669 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4670 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4671 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4672 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4673 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4674 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4675 !! end
4676
4677 !! test
4678 External links: Lone protocols are never linked (T105697)
4679 !! wikitext
4680 http://
4681 http://;
4682 (http://)
4683 bitcoin:
4684 bitcoin:;
4685 (bitcoin:)
4686 !! html
4687 <p>http://
4688 http://;
4689 (http://)
4690 bitcoin:
4691 bitcoin:;
4692 (bitcoin:)
4693 </p>
4694 !! end
4695
4696 !! test
4697 External links: No preceding word characters allowed (bug 65278)
4698 !! wikitext
4699 NOPEhttp://example.com
4700 N0http://example.com
4701 ok:http://example.com
4702 ok-http://example.com
4703 !! html
4704 <p>NOPEhttp://example.com
4705 N0http://example.com
4706 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4707 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4708 </p>
4709 !! end
4710
4711 !! test
4712 External image
4713 !! wikitext
4714 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4715 !! html
4716 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4717 </p>
4718 !! end
4719
4720 !! test
4721 External image from https
4722 !! wikitext
4723 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4724 !! html
4725 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4726 </p>
4727 !! end
4728
4729 !! test
4730 External image (when not allowed)
4731 !! options
4732 wgAllowExternalImages=0
4733 !! wikitext
4734 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4735 !! html
4736 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4737 </p>
4738 !! end
4739
4740 !! test
4741 Link to non-http image, no img tag
4742 !! wikitext
4743 Link to non-http image, no img tag: ftp://example.com/test.jpg
4744 !! html
4745 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4746 </p>
4747 !! end
4748
4749 !! test
4750 External links: terminating separator
4751 !! wikitext
4752 Terminating separator: http://example.com/thing,
4753 !! html
4754 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4755 </p>
4756 !! end
4757
4758 !! test
4759 External links: intervening separator
4760 !! wikitext
4761 Intervening separator: http://example.com/1,2,3
4762 !! html
4763 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4764 </p>
4765 !! end
4766
4767 !! test
4768 External links: old bug with URL in query
4769 !! wikitext
4770 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4771 !! html
4772 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4773 </p>
4774 !! end
4775
4776 !! test
4777 External links: old URL-in-URL bug, mixed protocols
4778 !! wikitext
4779 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4780 !! html
4781 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4782 </p>
4783 !!end
4784
4785 !! test
4786 External links: URL in text
4787 !! wikitext
4788 URL in text: [http://example.com http://example.com]
4789 !! html
4790 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4791 </p>
4792 !! end
4793
4794 !! test
4795 External links: Clickable images
4796 !! wikitext
4797 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4798 !! html/php
4799 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4800 </p>
4801 !! html/parsoid
4802 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4803 !! end
4804
4805 !! test
4806 External links: raw ampersand
4807 !! wikitext
4808 Old &amp; use: http://x&y
4809 !! html
4810 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4811 </p>
4812 !! end
4813
4814 !! test
4815 External links: encoded ampersand
4816 !! wikitext
4817 Old &amp; use: http://x&amp;y
4818 !! html/php
4819 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4820 </p>
4821 !! html/parsoid
4822 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4823 !! end
4824
4825 !! test
4826 External links: encoded equals (bug 6102)
4827 !! wikitext
4828 http://example.com/?foo&#61;bar
4829 !! html/php
4830 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4831 </p>
4832 !! html/parsoid
4833 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4834 !! end
4835
4836 ##
4837 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4838 ## does it number them. As discussed in bug 53505, we can identify
4839 ## autonumbered links via CSS.
4840 ##
4841
4842 !! test
4843 External links: [raw ampersand]
4844 !! wikitext
4845 Old &amp; use: [http://x&y]
4846 !! html/php
4847 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4848 </p>
4849 !! html/parsoid
4850 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4851 !! end
4852
4853 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4854 # mode will return the [raw ampersand] wikitext
4855 !! test
4856 External links: [encoded ampersand]
4857 !! options
4858 parsoid=wt2html,wt2wt,html2html
4859 !! wikitext
4860 Old &amp; use: [http://x&amp;y]
4861 !! html/php
4862 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4863 </p>
4864 !! html/parsoid
4865 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4866 !! end
4867
4868 !! test
4869 External links: [raw equals]
4870 !! wikitext
4871 [http://example.com/?foo=bar]
4872 !! html/php
4873 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4874 </p>
4875 !! html/parsoid
4876 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4877 !! end
4878
4879 # note that parsoid html is identical to [raw equals] case; so html2wt
4880 # mode will return the [raw equals] wikitext
4881 !! test
4882 External links: [encoded equals] (bug 6102)
4883 !! options
4884 parsoid=wt2html,wt2wt,html2html
4885 !! wikitext
4886 [http://example.com/?foo&#61;bar]
4887 !! html/php
4888 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4889 </p>
4890 !! html/parsoid
4891 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4892 !! end
4893
4894 # xxx parsoid strips the IDN character, so the round-trip tests will
4895 # obviously fail and are disabled. --cscott
4896 !! test
4897 External links: [IDN ignored character reference in hostname; strip it right off]
4898 !! options
4899 parsoid=wt2html,wt2wt,html2html
4900 !! wikitext
4901 [http://e&zwnj;xample.com/]
4902 !! html/php
4903 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4907 !! end
4908
4909 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4910 # Where an external link could easily circumvent the sanitization of the text of
4911 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4912 # test demands a higher standard. That's a bit strange.
4913 #
4914 # Example:
4915 #
4916 # http://e‌xample.com -> [http://example.com|http://example.com]
4917 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4918 #
4919 # The first example is sanitized, but the second is not. Any security benefits
4920 # from this production are trivial to circumvent. Either remove this test and
4921 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4922 # the test accordingly.
4923 #
4924 # All our love,
4925 # The Parsoid team.
4926 # xxx parsoid strips the IDN character, so the round-trip tests will
4927 # obviously fail and are disabled. --cscott
4928 !! test
4929 External links: IDN ignored character reference in hostname; strip it right off
4930 !! options
4931 parsoid=wt2html,html2html
4932 !! wikitext
4933 http://e&zwnj;xample.com/
4934 !! html/php
4935 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4936 </p>
4937 !! html/parsoid
4938 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4939 !! end
4940
4941 !! test
4942 External links: www.jpeg.org (bug 554)
4943 !! wikitext
4944 http://www.jpeg.org
4945 !! html
4946 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4947 </p>
4948 !! end
4949
4950 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4951 !! test
4952 External links: URL within URL (original bug 2)
4953 !! wikitext
4954 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4960 !! end
4961
4962 !! test
4963 BUG 361: URL inside bracketed URL
4964 !! wikitext
4965 [http://www.example.com/foo http://www.example.com/bar]
4966 !! html
4967 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4968 </p>
4969 !! end
4970
4971 !! test
4972 BUG 361: URL within URL, not bracketed
4973 !! wikitext
4974 http://www.example.com/foo?=http://www.example.com/bar
4975 !! html
4976 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
4977 </p>
4978 !! end
4979
4980 !! test
4981 BUG 289: ">"-token in URL-tail
4982 !! wikitext
4983 http://www.example.com/<hello>
4984 !! html
4985 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4986 </p>
4987 !!end
4988
4989 !! test
4990 BUG 289: literal ">"-token in URL-tail
4991 !! wikitext
4992 http://www.example.com/<b>html</b>
4993 !! html/php
4994 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4995 </p>
4996 !! html/parsoid
4997 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
4998 !! end
4999
5000 !! test
5001 BUG 289: ">"-token in bracketed URL
5002 !! wikitext
5003 [http://www.example.com/<hello> stuff]
5004 !! html
5005 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5006 </p>
5007 !!end
5008
5009 !! test
5010 BUG 289: literal ">"-token in bracketed URL
5011 !! wikitext
5012 [http://www.example.com/<b>html</b> stuff]
5013 !! html
5014 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5015 </p>
5016 !!end
5017
5018 !! test
5019 BUG 289: literal double quote at end of URL
5020 !! wikitext
5021 http://www.example.com/"hello"
5022 !! html
5023 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5024 </p>
5025 !!end
5026
5027 !! test
5028 BUG 289: literal double quote in bracketed URL
5029 !! wikitext
5030 [http://www.example.com/"hello" stuff]
5031 !! html
5032 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5033 </p>
5034 !!end
5035
5036 !! test
5037 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5038 !! wikitext
5039 [http://www.example.com test]
5040 !! html
5041 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5042 </p>
5043 !! end
5044
5045 !! test
5046 External links: link text with spaces
5047 !! wikitext
5048 [http://www.example.com a b c]
5049 [http://www.example.com ''a'' ''b'']
5050 !! html
5051 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5052 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5053 </p>
5054 !! end
5055
5056 !! test
5057 External links: wiki links within external link (Bug 3695)
5058 !! wikitext
5059 [http://example.com [[wikilink]] embedded in ext link]
5060 !! html/php
5061 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5062 </p>
5063 !! html/parsoid
5064 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5065 !! end
5066
5067 !! test
5068 BUG 787: Links with one slash after the url protocol are invalid
5069 !! wikitext
5070 http:/example.com
5071
5072 [http:/example.com title]
5073 !! html
5074 <p>http:/example.com
5075 </p><p>[http:/example.com title]
5076 </p>
5077 !! end
5078
5079 !! test
5080 Bracketed external links with template-generated invalid target
5081 !! wikitext
5082 [{{echo|http:/example.com}} title]
5083 !! html
5084 <p>[http:/example.com title]
5085 </p>
5086 !! end
5087
5088 !! test
5089 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5090 !! wikitext
5091 ''[http://example.com text'']
5092 [http://example.com '''text]'''
5093 ''Something [http://example.com in italic'']
5094 ''Something [http://example.com mixed''''', even bold]'''
5095 '''''Now [http://example.com both''''']
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5098 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5099 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5100 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5101 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5102 </p>
5103 !! end
5104
5105
5106 !! test
5107 Bug 4781: %26 in URL
5108 !! wikitext
5109 http://www.example.com/?title=AT%26T
5110 !! html/php
5111 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5112 </p>
5113 !! html/parsoid
5114 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5115 !! end
5116
5117 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5118 # % is actually legal in HTML5. Any change in output would need testing though.
5119 !! test
5120 Bug 4781, 5267: %25 in URL
5121 !! wikitext
5122 http://www.example.com/?title=100%25_Bran
5123 !! html/php
5124 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5125 </p>
5126 !! html/parsoid
5127 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5128 !! end
5129
5130 !! test
5131 Bug 4781, 5267: %28, %29 in URL
5132 !! wikitext
5133 http://www.example.com/?title=Ben-Hur_%281959_film%29
5134 !! html/php
5135 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5136 </p>
5137 !! html/parsoid
5138 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5139 !! end
5140
5141
5142 !! test
5143 Bug 4781: %26 in autonumber URL
5144 !! wikitext
5145 [http://www.example.com/?title=AT%26T]
5146 !! html/php
5147 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5148 </p>
5149 !! html/parsoid
5150 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5151 !! end
5152
5153 !! test
5154 Bug 4781, 5267: %26 in autonumber URL
5155 !! wikitext
5156 [http://www.example.com/?title=100%25_Bran]
5157 !! html/php
5158 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5159 </p>
5160 !! html/parsoid
5161 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5162 !! end
5163
5164 !! test
5165 Bug 4781, 5267: %28, %29 in autonumber URL
5166 !! wikitext
5167 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5168 !! html/php
5169 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5170 </p>
5171 !! html/parsoid
5172 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5173 !! end
5174
5175
5176 !! test
5177 Bug 4781: %26 in bracketed URL
5178 !! wikitext
5179 [http://www.example.com/?title=AT%26T link]
5180 !! html/php
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5182 </p>
5183 !! html/parsoid
5184 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5185 !! end
5186
5187 !! test
5188 Bug 4781, 5267: %25 in bracketed URL
5189 !! wikitext
5190 [http://www.example.com/?title=100%25_Bran link]
5191 !! html
5192 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 Bug 4781, 5267: %28, %29 in bracketed URL
5198 !! wikitext
5199 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5200 !! html/php
5201 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5202 </p>
5203 !! html/parsoid
5204 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5205 !! end
5206
5207 !! test
5208 External link containing a period in the anchor. (bug 63947)
5209 !! wikitext
5210 [//foo.org/bar#baz. bang]
5211
5212 [//foo.org/bar. bang]
5213 !! html/php
5214 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5215 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5216 </p>
5217 !! html/parsoid
5218 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5219 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5220 !! end
5221
5222 !! test
5223 External link containing a single quote. (bug 63947)
5224 !! wikitext
5225 [//foo.org/bar'baz]
5226
5227 [//foo.org/bar'baz bang]
5228 !! html/php
5229 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5234 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5235 !! end
5236
5237
5238 !! test
5239 External link containing a period in the anchor. (bug 63947)
5240 !! wikitext
5241 [//foo.org/bar#baz. bang]
5242
5243 [//foo.org/bar. bang]
5244 !! html/php
5245 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5246 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5250 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5251 !! end
5252
5253 !! test
5254 External link containing a single quote. (bug 63947)
5255 !! wikitext
5256 [//foo.org/bar'baz]
5257
5258 [//foo.org/bar'baz bang]
5259 !! html/php
5260 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5261 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5265 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5266 !! end
5267
5268
5269 !! test
5270 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5271 !! wikitext
5272 Some [http://example.com/ pretty ''italics'' and stuff]!
5273 !! html
5274 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5275 </p>
5276 !! end
5277
5278 !! test
5279 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5280 !! wikitext
5281 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5282 !! html
5283 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5284 </p>
5285 !! end
5286
5287 !! test
5288 External link containing double-single-quotes with no space separating the url from text in italics
5289 !! wikitext
5290 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5291 !! html/php
5292 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5293 </p>
5294 !! html/php+tidy
5295 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5296 !! html/parsoid
5297 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5298 !! end
5299
5300 !! test
5301 External link with comments in link text
5302 !! wikitext
5303 [http://www.google.com Google <!-- comment -->]
5304 !! html
5305 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5306 </p>
5307 !! end
5308
5309 !! test
5310 URL-encoding in URL functions (single parameter)
5311 !! wikitext
5312 {{localurl:Some page|amp=&}}
5313 !! html
5314 <p>/index.php?title=Some_page&amp;amp=&amp;
5315 </p>
5316 !! end
5317
5318 !! test
5319 URL-encoding in URL functions (multiple parameters)
5320 !! wikitext
5321 {{localurl:Some page|q=?&amp=&}}
5322 !! html
5323 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5324 </p>
5325 !! end
5326
5327 !! test
5328 Brackets in urls
5329 !! wikitext
5330 http://example.com/index.php?foozoid%5B%5D=bar
5331
5332 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5333 !! html/php
5334 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5335 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5336 </p>
5337 !! html/parsoid
5338 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5339
5340 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5341 !! end
5342
5343 !! test
5344 IPv6 urls, autolink format (T23261)
5345 !! wikitext
5346 http://[2404:130:0:1000::187:2]/index.php
5347
5348 Examples from RFC2373, section 2.2:
5349 * http://[1080::8:800:200C:417A]/unicast
5350 * http://[FF01::101]/multicast
5351 * http://[::1]/loopback
5352 * http://[::]/unspecified
5353 * http://[::13.1.68.3]/ipv4compat
5354 * http://[::FFFF:129.144.52.38]/ipv4compat
5355
5356 Examples from RFC 2732, section 2:
5357 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5358 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5359 * http://[3ffe:2a00:100:7031::1]
5360 * http://[1080::8:800:200C:417A]/foo
5361 * http://[::192.9.5.5]/ipng
5362 * http://[::FFFF:129.144.52.38]:80/index.html
5363 * http://[2010:836B:4179::836B:4179]
5364
5365 !! html
5366 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5367 </p><p>Examples from RFC2373, section 2.2:
5368 </p>
5369 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5370 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5371 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5372 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5373 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5374 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5375 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5376 </p>
5377 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5378 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5379 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5380 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5381 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5382 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5383 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5384
5385 !! end
5386
5387 !! test
5388 IPv6 urls, bracketed format (T23261)
5389 !! wikitext
5390 [http://[2404:130:0:1000::187:2]/index.php test]
5391
5392 Examples from RFC2373, section 2.2:
5393 * [http://[1080::8:800:200C:417A] unicast]
5394 * [http://[FF01::101] multicast]
5395 * [http://[::1]/ loopback]
5396 * [http://[::] unspecified]
5397 * [http://[::13.1.68.3] ipv4compat]
5398 * [http://[::FFFF:129.144.52.38] ipv4compat]
5399
5400 Examples from RFC 2732, section 2:
5401 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5402 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5403 * [http://[3ffe:2a00:100:7031::1] 3]
5404 * [http://[1080::8:800:200C:417A]/foo 4]
5405 * [http://[::192.9.5.5]/ipng 5]
5406 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5407 * [http://[2010:836B:4179::836B:4179] 7]
5408
5409 !! html
5410 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5411 </p><p>Examples from RFC2373, section 2.2:
5412 </p>
5413 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5414 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5415 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5416 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5417 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5418 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5419 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5420 </p>
5421 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5422 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5423 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5424 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5425 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5426 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5427 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5428
5429 !! end
5430
5431 !! test
5432 Non-extlinks in brackets
5433 !! wikitext
5434 [foo]
5435 [foo bar]
5436 [foo ''bar'']
5437 [fool's] errand
5438 [fool's errand]
5439 [{{echo|foo}}]
5440 [{{echo|foo}} bar]
5441 [{{echo|foo}} ''bar'']
5442 [{{echo|foo}}l's] errand
5443 [{{echo|foo}}l's errand]
5444 [url={{echo|foo}}]
5445 [url=http://example.com]
5446 !! html
5447 <p>[foo]
5448 [foo bar]
5449 [foo <i>bar</i>]
5450 [fool's] errand
5451 [fool's errand]
5452 [foo]
5453 [foo bar]
5454 [foo <i>bar</i>]
5455 [fool's] errand
5456 [fool's errand]
5457 [url=foo]
5458 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5459 </p>
5460 !! end
5461
5462 !! test
5463 Percent encoding in external links
5464 !! wikitext
5465 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5466 !! html/php
5467 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5468 </p>
5469 !! html/parsoid
5470 <p><a rel="mw:ExtLink"
5471 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5472 !! end
5473
5474 !! test
5475 Use url link syntax for links where the content is equal the link target
5476 !! wikitext
5477 http://example.com
5478 !! html/php
5479 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5480 </p>
5481 !! html/parsoid
5482 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5483 !! end
5484
5485 !! test
5486 Parenthesis in external links, especially URL links
5487 !! wikitext
5488 http://example.com)
5489
5490 http://example.com/test)
5491
5492 http://example.com/(test)
5493
5494 http://example.com/((test)
5495
5496 (http://example.com/(test))
5497
5498 (http://example.com/(test)))))
5499
5500 http://example.com/a)b
5501
5502 [http://example.com) foo]
5503 !! html/php
5504 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5505 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5506 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5507 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5508 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5509 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5510 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5511 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5512 </p>
5513 !! html/parsoid
5514 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5515 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5516 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5517 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5518 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5519 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5520 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5521 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5522 !! end
5523
5524 !! test
5525 Parenthesis in external links, w/ transclusion or comment
5526 !! wikitext
5527 (http://example.com/{{echo|hi}})
5528
5529 (http://example.com<!-- hi -->)
5530 !! html/php
5531 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5532 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5533 </p>
5534 !! html/parsoid
5535 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5536
5537 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5538 !! end
5539
5540 !! test
5541 Serialize <a> tags with invalid link targets as plain text
5542 !! options
5543 parsoid=html2wt
5544 !! html/parsoid
5545 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5546 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5547 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5548 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5549 !! wikitext
5550 text
5551 <nowiki>*</nowiki>text
5552 <nowiki>[[foo]]</nowiki>
5553 <nowiki>*a [[foo]]</nowiki>
5554 !! end
5555
5556 !! test
5557 mw:ExtLink -vs- mw:WikiLink (T94723)
5558 !! options
5559 parsoid=html2wt
5560 !! html/parsoid
5561 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5562 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5563 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5564 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5565 <p>
5566 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5567 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5568 </p>
5569 !! wikitext
5570 [[Foo|Bar]]
5571 [[Foo|Bar]]
5572 [[wikipedia:Foo|Bar]]
5573 [[wikipedia:Foo|Bar]]
5574
5575 [[wikipedia:European_Robin|European Robin]]
5576 [[wikipedia:European_Robin|European Robin]]
5577 !! end
5578
5579 !! test
5580 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5581 !! options
5582 parsoid=wt2wt
5583 !! wikitext
5584 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5585 !! html/parsoid
5586 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5587 !! end
5588
5589
5590 ###
5591 ### Quotes
5592 ###
5593
5594 !! test
5595 Quotes
5596 !! wikitext
5597 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5598
5599 Normal text. '''''Bold italic text.''''' Normal text.
5600 !! html
5601 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5602 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5603 </p>
5604 !! end
5605
5606
5607 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5608 # parser strips. The wikitext contains just the first half of the bold
5609 # quote pair.
5610 !! test
5611 Unclosed and unmatched quotes
5612 !! wikitext
5613 '''''Bold italic text '''with bold deactivated''' in between.'''''
5614
5615 '''''Bold italic text ''with italic deactivated'' in between.'''''
5616
5617 '''Bold text..
5618
5619 ..spanning two paragraphs (should not work).'''
5620
5621 '''Bold tag left open
5622
5623 ''Italic tag left open
5624
5625 Normal text.
5626
5627 <!-- Unmatching number of opening, closing tags: -->
5628 '''This year''''s election ''should'' beat '''last year''''s.
5629
5630 ''Tom'''s car is bigger than ''Susan'''s.
5631
5632 Plain ''italic'''s plain
5633 !! html/php
5634 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5635 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5636 </p><p><b>Bold text..</b>
5637 </p><p>..spanning two paragraphs (should not work).
5638 </p><p><b>Bold tag left open</b>
5639 </p><p><i>Italic tag left open</i>
5640 </p><p>Normal text.
5641 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5642 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5643 </p><p>Plain <i>italic'</i>s plain
5644 </p>
5645 !! html/parsoid
5646 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5647 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5648 </p><p><b>Bold text..</b>
5649 </p><p>..spanning two paragraphs (should not work).<b></b>
5650 </p><p><b>Bold tag left open</b>
5651 </p><p><i>Italic tag left open</i>
5652 </p><p>Normal text.
5653 </p>
5654 <!-- Unmatching number of opening, closing tags: -->
5655 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5656 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5657 </p><p>Plain <i>italic'</i>s plain
5658 </p>
5659 !! end
5660
5661 ###
5662 ### Tables
5663 ###
5664 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5665 ###
5666
5667 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5668 # is the bare minimum required by the spec, see:
5669 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5670 # Parsoid team replies: empty table tags are legal in HTML5
5671 !! test
5672 A table with no data.
5673 !! options
5674 parsoid=wt2html
5675 !! wikitext
5676 {||}
5677 !! html/php
5678
5679 !! html/parsoid
5680 <table></table>
5681
5682 !! end
5683
5684 !! test
5685 A table with stray table end tags on start tag line (wt2html)
5686 !! options
5687 parsoid=wt2html
5688 !! wikitext
5689 {|style="color: red;"|}
5690
5691 {|style="color: red;" |}
5692 |foo
5693 |}
5694
5695 {|style="color: red;"|} id="foo"
5696 |foo
5697 |}
5698
5699 {|style="color: red;" |} id="foo"
5700 |foo
5701 |}
5702 !! html
5703 <table style="color: red;"></table>
5704
5705 <table style="color: red;">
5706 <tbody><tr>
5707 <td>foo</td>
5708 </tr></tbody>
5709 </table>
5710
5711 <table style="color: red;" id="foo">
5712 <tbody><tr>
5713 <td>foo</td>
5714 </tr></tbody>
5715 </table>
5716
5717 <table style="color: red;" id="foo">
5718 <tbody><tr>
5719 <td>foo</td>
5720 </tr></tbody>
5721 </table>
5722
5723 !! end
5724
5725 !! test
5726 A table with no data (take 2)
5727 !! wikitext
5728 {|
5729 |}
5730 !! html/parsoid
5731 <table></table>
5732 !! end
5733
5734 # A table with nothing but a caption is invalid XHTML, we might want to render
5735 # this as <p>caption</p>
5736 # Parsoid team replies: table with only a caption is legal in HTML5
5737 !! test
5738 A table with nothing but a caption
5739 !! wikitext
5740 {|
5741 |+ caption
5742 |}
5743 !! html/php
5744 <table>
5745 <caption> caption
5746 </caption><tr><td></td></tr></table>
5747
5748 !! html/parsoid
5749 <table><caption> caption</caption></table>
5750 !! end
5751
5752 !! test
5753 A table with caption with default-spaced attributes and a table row
5754 !! wikitext
5755 {|
5756 |+ style="color: red;" | caption1
5757 |-
5758 | foo
5759 |}
5760 !! html
5761 <table>
5762 <caption style="color: red;"> caption1
5763 </caption>
5764 <tr>
5765 <td> foo
5766 </td></tr></table>
5767
5768 !! end
5769
5770 !! test
5771 A table with captions with non-default spaced attributes and a table row
5772 !! wikitext
5773 {|
5774 |+style="color: red;"|caption2
5775 |+ style="color: red;"| caption3
5776 |-
5777 | foo
5778 |}
5779 !! html
5780 <table>
5781 <caption style="color: red;">caption2
5782 </caption>
5783 <caption style="color: red;"> caption3
5784 </caption>
5785 <tr>
5786 <td> foo
5787 </td></tr></table>
5788
5789 !! end
5790
5791 !! test
5792 Table td-cell syntax variations
5793 !! wikitext
5794 {|
5795 | foo bar foo | baz
5796 | foo bar foo || baz
5797 | style='color:red;' | baz
5798 | style='color:red;' || baz
5799 |}
5800 !! html
5801 <table>
5802 <tr>
5803 <td> baz
5804 </td>
5805 <td> foo bar foo </td>
5806 <td> baz
5807 </td>
5808 <td style="color:red;"> baz
5809 </td>
5810 <td> style='color:red;' </td>
5811 <td> baz
5812 </td></tr></table>
5813
5814 !! end
5815
5816 !! test
5817 Simple table
5818 !! wikitext
5819 {|
5820 | 1 || 2
5821 |-
5822 | 3 || 4
5823 |}
5824 !! html
5825 <table>
5826 <tr>
5827 <td> 1 </td>
5828 <td> 2
5829 </td></tr>
5830 <tr>
5831 <td> 3 </td>
5832 <td> 4
5833 </td></tr></table>
5834
5835 !! end
5836
5837 !! test
5838 Simple table but with multiple dashes for row wikitext
5839 !! wikitext
5840 {|
5841 | foo
5842 |-----
5843 | bar
5844 |}
5845 !! html
5846 <table>
5847 <tr>
5848 <td> foo
5849 </td></tr>
5850 <tr>
5851 <td> bar
5852 </td></tr></table>
5853
5854 !! end
5855
5856 !! test
5857 Multiplication table
5858 !! wikitext
5859 {| border="1" cellpadding="2"
5860 |+Multiplication table
5861 |-
5862 ! &times; !! 1 !! 2 !! 3
5863 |-
5864 ! 1
5865 | 1 || 2 || 3
5866 |-
5867 ! 2
5868 | 2 || 4 || 6
5869 |-
5870 ! 3
5871 | 3 || 6 || 9
5872 |-
5873 ! 4
5874 | 4 || 8 || 12
5875 |-
5876 ! 5
5877 | 5 || 10 || 15
5878 |}
5879 !! html
5880 <table border="1" cellpadding="2">
5881 <caption>Multiplication table
5882 </caption>
5883 <tr>
5884 <th> &#215; </th>
5885 <th> 1 </th>
5886 <th> 2 </th>
5887 <th> 3
5888 </th></tr>
5889 <tr>
5890 <th> 1
5891 </th>
5892 <td> 1 </td>
5893 <td> 2 </td>
5894 <td> 3
5895 </td></tr>
5896 <tr>
5897 <th> 2
5898 </th>
5899 <td> 2 </td>
5900 <td> 4 </td>
5901 <td> 6
5902 </td></tr>
5903 <tr>
5904 <th> 3
5905 </th>
5906 <td> 3 </td>
5907 <td> 6 </td>
5908 <td> 9
5909 </td></tr>
5910 <tr>
5911 <th> 4
5912 </th>
5913 <td> 4 </td>
5914 <td> 8 </td>
5915 <td> 12
5916 </td></tr>
5917 <tr>
5918 <th> 5
5919 </th>
5920 <td> 5 </td>
5921 <td> 10 </td>
5922 <td> 15
5923 </td></tr></table>
5924
5925 !! end
5926
5927 !! test
5928 Accept "||" in table headings
5929 !! wikitext
5930 {|
5931 !h1 || h2
5932 |}
5933 !! html
5934 <table>
5935 <tr>
5936 <th>h1 </th>
5937 <th> h2
5938 </th></tr></table>
5939
5940 !! end
5941
5942 !! test
5943 Accept "!!" in table data
5944 !! wikitext
5945 {|
5946 | Foo!! ||
5947 |}
5948 !! html
5949 <table>
5950 <tr>
5951 <td> Foo!! </td>
5952 <td>
5953 </td></tr></table>
5954
5955 !! html/parsoid
5956 <table>
5957 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5958 </tbody></table>
5959 !! end
5960
5961 !! test
5962 Accept "||" in indented table headings
5963 !! wikitext
5964 :{|
5965 !h1 || h2
5966 |}
5967 !! html
5968 <dl><dd><table>
5969 <tr>
5970 <th>h1 </th>
5971 <th> h2
5972 </th></tr></table></dd></dl>
5973
5974 !! end
5975
5976 !! test
5977 Accept "!!" in templates
5978 !! wikitext
5979 {|
5980 !a {{echo|b!!c}}
5981 |}
5982 !! html/php
5983 <table>
5984 <tr>
5985 <th>a b</th>
5986 <th>c
5987 </th></tr></table>
5988
5989 !! html/parsoid
5990 <table>
5991 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
5992 !! end
5993
5994 !! test
5995 Accept "!!" in table headings after newline
5996 !! wikitext
5997 {|
5998 !a
5999 b!!c
6000 |}
6001 !! html/php
6002 <table>
6003 <tr>
6004 <th>a
6005 <p>b!!c
6006 </p>
6007 </th></tr></table>
6008
6009 !! html/parsoid
6010 <table>
6011 <tbody><tr><th>a
6012 <p>b!!c</p></th></tr>
6013 </tbody></table>
6014 !! end
6015
6016 !! test
6017 Accept "!!" in table data of mixed wikitext / html syntax
6018 !! wikitext
6019 {|
6020 !a
6021 <tr><td>b!!c</td></tr>
6022 |}
6023 !! html+tidy
6024 <table>
6025 <tr>
6026 <th>a</th>
6027 </tr>
6028 <tr>
6029 <td>b!!c</td>
6030 </tr>
6031 </table>
6032 !! html/parsoid
6033 <table>
6034 <tbody><tr><th>a</th></tr>
6035 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6036 </tbody></table>
6037 !! end
6038
6039 !! test
6040 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6041 !! wikitext
6042 {|
6043 !| h1
6044 || a
6045 |}
6046 !! html
6047 <table>
6048 <tr>
6049 <th> h1
6050 </th>
6051 <td> a
6052 </td></tr></table>
6053
6054 !! end
6055
6056 !!test
6057 Accept "| !" at start of line in tables (ignore !-attribute)
6058 !! wikitext
6059 {|
6060 |-
6061 | !style="color:red" | bar
6062 |}
6063 !! html
6064 <table>
6065
6066 <tr>
6067 <td> bar
6068 </td></tr></table>
6069
6070 !!end
6071
6072 !!test
6073 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6074 !! wikitext
6075 {|
6076 |-
6077 |style='color:red;'|+1
6078 |style='color:blue;'|-1
6079 |-
6080 | 1 || 2 || 3
6081 | 1 ||+2 ||-3
6082 |-
6083 | +1
6084 | -1
6085 |}
6086 !! html
6087 <table>
6088
6089 <tr>
6090 <td style="color:red;">+1
6091 </td>
6092 <td style="color:blue;">-1
6093 </td></tr>
6094 <tr>
6095 <td> 1 </td>
6096 <td> 2 </td>
6097 <td> 3
6098 </td>
6099 <td> 1 </td>
6100 <td>+2 </td>
6101 <td>-3
6102 </td></tr>
6103 <tr>
6104 <td> +1
6105 </td>
6106 <td> -1
6107 </td></tr></table>
6108
6109 !!end
6110
6111 !! test
6112 Table rowspan
6113 !! wikitext
6114 {| border=1
6115 | Cell 1, row 1
6116 |rowspan=2| Cell 2, row 1 (and 2)
6117 | Cell 3, row 1
6118 |-
6119 | Cell 1, row 2
6120 | Cell 3, row 2
6121 |}
6122 !! html
6123 <table border="1">
6124 <tr>
6125 <td> Cell 1, row 1
6126 </td>
6127 <td rowspan="2"> Cell 2, row 1 (and 2)
6128 </td>
6129 <td> Cell 3, row 1
6130 </td></tr>
6131 <tr>
6132 <td> Cell 1, row 2
6133 </td>
6134 <td> Cell 3, row 2
6135 </td></tr></table>
6136
6137 !! end
6138
6139 !! test
6140 Nested table
6141 !! wikitext
6142 {| border=1
6143 | &alpha;
6144 |
6145 {| bgcolor=#ABCDEF border=2
6146 |nested
6147 |-
6148 |table
6149 |}
6150 |the original table again
6151 |}
6152 !! html
6153 <table border="1">
6154 <tr>
6155 <td> &#945;
6156 </td>
6157 <td>
6158 <table bgcolor="#ABCDEF" border="2">
6159 <tr>
6160 <td>nested
6161 </td></tr>
6162 <tr>
6163 <td>table
6164 </td></tr></table>
6165 </td>
6166 <td>the original table again
6167 </td></tr></table>
6168
6169 !! end
6170
6171 !! test
6172 Invalid attributes in table cell (bug 1830)
6173 !! wikitext
6174 {|
6175 |Cell:|broken
6176 |}
6177 !! html
6178 <table>
6179 <tr>
6180 <td>broken
6181 </td></tr></table>
6182
6183 !! end
6184
6185 !! test
6186 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6187 !! wikitext
6188 {|
6189 | title="foo" |bar
6190 | title="foo<nowiki>|</nowiki>" |bar
6191 | title="foo<nowiki>|</nowiki>" bar
6192 |}
6193 !! html
6194 <table>
6195 <tr>
6196 <td title="foo">bar
6197 </td>
6198 <td title="foo&#124;">bar
6199 </td>
6200 <td> title="foo|" bar
6201 </td></tr></table>
6202
6203 !! end
6204
6205 # The "|}" to close the table is missing from the input, so parsoid's
6206 # *2wt modes will fail.
6207 !! test
6208 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6209 !! options
6210 parsoid=wt2html,html2html
6211 !! wikitext
6212 {|
6213 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6214 !! html/php
6215 <table>
6216 <tr>
6217 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6218 <td>]" onmouseover="alert(document.cookie)"&gt;test
6219 </td>
6220 </tr>
6221 </table>
6222
6223 !! html/parsoid
6224 <table><tbody>
6225 <tr>
6226 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6227 !! end
6228
6229 # FIXME: The php output is broken.
6230 !! test
6231 ! and || in td attributes should not be parsed as <th>/<td>
6232 !! wikitext
6233 {|
6234 | style="color: red !important;" data-contrived="put this here ||" | foo
6235 |}
6236 !! html/php
6237 <table>
6238 <tr>
6239 <td> style="color: red !important;" data-contrived="put this here </td>
6240 <td> foo
6241 </td></tr></table>
6242
6243 !! html/parsoid
6244 <table>
6245 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6246 </tbody></table>
6247 !! end
6248
6249 !! test
6250 Indented table markup mixed with indented pre content (proposed in bug 6200)
6251 !! wikitext
6252 <table>
6253 <tr>
6254 <td>
6255 Text that should be rendered preformatted
6256 </td>
6257 </tr>
6258 </table>
6259 !! html
6260 <table>
6261 <tr>
6262 <td>
6263 <pre>Text that should be rendered preformatted
6264 </pre>
6265 </td>
6266 </tr>
6267 </table>
6268
6269 !! end
6270
6271 !! test
6272 1. Template-generated table cell attributes and cell content
6273 !! wikitext
6274 {|
6275 |{{table_attribs}}
6276 | {{table_attribs}}
6277 || {{table_attribs_5}}
6278 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6279 |align=center {{table_attribs}}
6280 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6281 |}
6282 !! html
6283 <table>
6284 <tr>
6285 <td style="color:red;">Foo
6286 </td>
6287 <td style="color:red;">Foo
6288 </td>
6289 <td> style="color:red;"</td>
6290 <td>Bar
6291 </td>
6292 <td style="color:red;">Foo
6293 </td>
6294 <td align="center" style="color:red;">Foo
6295 </td>
6296 <td align="center" style="color:red;">Foo
6297 </td></tr></table>
6298
6299 !! end
6300
6301 !! test
6302 2. Template-generated table cell attributes and cell content
6303 !! wikitext
6304 {|
6305 |{{table_attribs_2}}
6306 |}
6307 !! html/php
6308 <table>
6309 <tr>
6310 <td style="color:red;">Foo
6311 </td>
6312 <td>Bar</td>
6313 <td>Baz
6314 </td></tr></table>
6315
6316 !! html/parsoid
6317 <table>
6318 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6319 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6320 </tbody></table>
6321 !! end
6322
6323 !! test
6324 3. Template-generated table cell attributes and cell content
6325 !! wikitext
6326 {|
6327 !align=center {{table_header_cells}}
6328 |-
6329 |align=center {{table_cells}}
6330 |}
6331 !! html/php
6332 <table>
6333 <tr>
6334 <th align="center" style="color:red;">Foo</th>
6335 <th style="color:red;"><i>Bar</i></th>
6336 <th style="color:brown;"><i>Foo</i> and Baz
6337 </th></tr>
6338 <tr>
6339 <td align="center" style="color:red;">Foo</td>
6340 <td style="color:red;"><i>Bar</i></td>
6341 <td style="color:brown;"><i>Foo</i> and Baz
6342 </td></tr></table>
6343
6344 !! html/parsoid
6345 <table>
6346 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6347 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6348 </tbody></table>
6349 !! end
6350
6351 !! test
6352 4. Template-generated table cell attributes and cell content inside a templated table
6353 !! wikitext
6354 {{tbl-start}}
6355 !align=center {{table_header_cells}}
6356 |-
6357 |align=center {{table_cells}}
6358 {{tbl-end}}
6359 !! html/php
6360 <table>
6361 <tr>
6362 <th align="center" style="color:red;">Foo</th>
6363 <th style="color:red;"><i>Bar</i></th>
6364 <th style="color:brown;"><i>Foo</i> and Baz
6365 </th></tr>
6366 <tr>
6367 <td align="center" style="color:red;">Foo</td>
6368 <td style="color:red;"><i>Bar</i></td>
6369 <td style="color:brown;"><i>Foo</i> and Baz
6370 </td></tr></table>
6371
6372 !! html/parsoid
6373 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6374 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6375 <tr>
6376 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6377 </tbody></table>
6378 !! end
6379
6380 ## Edge case fix to prevent future regressions
6381 !! test
6382 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6383 !! wikitext
6384 {|
6385 |{{table_attribs_7}}
6386 |}
6387 <references />
6388 !! html/parsoid
6389 <table>
6390 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6391 </tbody></table>
6392 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6393 !! end
6394
6395 !! test
6396 Table with row followed by newlines and table heading
6397 !! wikitext
6398 {|
6399 |-
6400
6401 ! foo
6402 |}
6403 !! html
6404 <table>
6405
6406
6407 <tr>
6408 <th> foo
6409 </th></tr></table>
6410
6411 !! end
6412
6413 !! test
6414 Table with empty line following the start tag
6415 !! wikitext
6416 {|
6417
6418 |-
6419 | foo
6420 |}
6421 !! html
6422 <table>
6423
6424
6425 <tr>
6426 <td> foo
6427 </td></tr></table>
6428
6429 !! end
6430
6431 # FIXME: Preserve the attribute properly (with an empty string as value) in
6432 # the PHP parser. Parsoid implements the behavior below.
6433 !! test
6434 Table attributes with empty value
6435 !! wikitext
6436 {|
6437 | style=| hello
6438 |}
6439 !! html/parsoid
6440 <table>
6441 <tbody>
6442 <tr>
6443 <td style=""> hello
6444 </td></tr></tbody></table>
6445
6446 !! end
6447
6448 !! test
6449 Wikitext table with a lot of comments
6450 !! wikitext
6451 {|
6452 <!-- c0 -->
6453 | foo
6454 <!-- c1 -->
6455 |-<!-- c2 -->
6456 <!-- c3 -->
6457 |<!-- c4 -->
6458 <!-- c5 -->
6459 |}
6460 !! html
6461 <table>
6462 <tr>
6463 <td> foo
6464 </td></tr>
6465 <tr>
6466 <td>
6467 </td></tr></table>
6468
6469 !! end
6470
6471 !! test
6472 Wikitext table comments represented in parsoid dom
6473 !! wikitext
6474 {|<!--c1--><!--c2-->
6475 |-<!--c3-->
6476 | x
6477 |}
6478 !! html/php+tidy
6479 <table>
6480 <tr>
6481 <td>x</td>
6482 </tr>
6483 </table>
6484 !! html/parsoid
6485 <table><!--c1--><!--c2-->
6486 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6487 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6488 </tbody></table>
6489 !! end
6490
6491 !! test
6492 Wikitext table with double-line table cell
6493 !! wikitext
6494 {|
6495 |a
6496 b
6497 |}
6498 !! html
6499 <table>
6500 <tr>
6501 <td>a
6502 <p>b
6503 </p>
6504 </td></tr></table>
6505
6506 !! end
6507
6508 !! test
6509 Table cell with a single comment
6510 !! wikitext
6511 {|
6512 | <!-- c1 -->
6513 | a
6514 |}
6515 !! html
6516 <table>
6517 <tr>
6518 <td>
6519 </td>
6520 <td> a
6521 </td></tr></table>
6522
6523 !! end
6524
6525 !! test
6526 Table-cell after a comment-only-empty-line
6527 !! wikitext
6528 {|
6529 |a
6530 <!--c1-->
6531 <!--c2-->| b
6532 |}
6533 !! html
6534 <table>
6535 <tr>
6536 <td>a
6537 </td>
6538 <td> b
6539 </td></tr></table>
6540
6541 !! html/parsoid
6542 <table>
6543 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6544 <!--c1-->
6545 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6546 </tbody></table>
6547
6548 !! end
6549
6550 !! test
6551 Build table with {{!}}
6552 !! wikitext
6553 {{{!}} class="wikitable"
6554 ! header
6555 ! second header
6556 {{!}}- style="color:red;"
6557 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6558 {{!}}}
6559 !! html
6560 <table class="wikitable">
6561 <tr>
6562 <th> header
6563 </th>
6564 <th> second header
6565 </th></tr>
6566 <tr style="color:red;">
6567 <td> data </td>
6568 <td style="color:red;"> second data
6569 </td></tr></table>
6570
6571 !! end
6572
6573 !! test
6574 Build table with pipe as data
6575 !! wikitext
6576 {| class="wikitable"
6577 ! header
6578 ! second header
6579 |- style="color:red;"
6580 | data || style="color:red;" | second data
6581 |-
6582 | style="color:red;" | data with | || style="color:red;" | second data with |
6583 |-
6584 || data with | ||| second data with |
6585 |}
6586 !! html
6587 <table class="wikitable">
6588 <tr>
6589 <th> header
6590 </th>
6591 <th> second header
6592 </th></tr>
6593 <tr style="color:red;">
6594 <td> data </td>
6595 <td style="color:red;"> second data
6596 </td></tr>
6597 <tr>
6598 <td style="color:red;"> data with | </td>
6599 <td style="color:red;"> second data with |
6600 </td></tr>
6601 <tr>
6602 <td> data with | </td>
6603 <td> second data with |
6604 </td></tr></table>
6605
6606 !! end
6607
6608 !! test
6609 Build table with wikilink
6610 !! wikitext
6611 {| class="wikitable"
6612 ! header || second header
6613 |- style="color:red;"
6614 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6615 |-
6616 | data || second data [[Main Page|link|text with pipe]]
6617 |}
6618 !! html
6619 <table class="wikitable">
6620 <tr>
6621 <th> header </th>
6622 <th> second header
6623 </th></tr>
6624 <tr style="color:red;">
6625 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6626 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6627 </td></tr>
6628 <tr>
6629 <td> data </td>
6630 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6631 </td></tr></table>
6632
6633 !! end
6634
6635 # The expected HTML structure in this test is debatable. The PHP parser does
6636 # not parse this kind of table at all. The main focus for Parsoid is on
6637 # round-tripping, so this output is ok for now. TODO: revisit!
6638 !! test
6639 Wikitext table with html-syntax row
6640 !! wikitext
6641 {|
6642 |-
6643 <td>foo</td>
6644 |}
6645 !! html/parsoid
6646 <table>
6647 <tbody>
6648 <tr>
6649 <td>foo</td></tr></tbody></table>
6650 !! end
6651
6652 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6653 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6654 ## PHP parser, which tidy then compounds by fostering the content
6655 ## entirely out of the table. Parsoid recognizes the table context
6656 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6657 ## depends on PHP's treatment of broken table markup!
6658 !! test
6659 Implicit <td> after a |-
6660 !! options
6661 parsoid=wt2html,html2html
6662 !! wikitext
6663 {|
6664 |-
6665 a
6666 |}
6667 !! html/php
6668 <table>
6669
6670 a
6671 </table>
6672
6673 !! html/php+tidy
6674 <p>a</p>
6675 !! html/parsoid
6676 <table>
6677 <tr><td>a</td></tr>
6678 </table>
6679 !! end
6680
6681 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6682 !! test
6683 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6684 !! options
6685 parsoid=wt2html,html2html
6686 !! wikitext
6687 {|
6688 |-
6689 |
6690 a
6691 |-
6692 b
6693 |}
6694 !! html/php
6695 <table>
6696
6697 <tr>
6698 <td>
6699 <pre>a
6700 </pre>
6701 </td></tr>
6702 b
6703 </table>
6704
6705 !! html/php+tidy
6706 <p>b</p>
6707 <table>
6708 <tr>
6709 <td>
6710 <pre>
6711 a
6712 </pre></td>
6713 </tr>
6714 </table>
6715 !! html/parsoid
6716 <table>
6717 <tbody>
6718 <tr><td><pre>a</pre></td></tr>
6719 <tr><td> b</td></tr>
6720 </tbody>
6721 </table>
6722 !! end
6723
6724 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6725 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6726 !! test
6727 Lists should be recognized in an implicit <td> context
6728 !! options
6729 parsoid=wt2html,html2html
6730 !! wikitext
6731 {|
6732 |-
6733 *a
6734 |}
6735 !! html/php
6736 <table>
6737
6738 <ul><li>a</li></ul>
6739 </table>
6740
6741 !! html/php+tidy
6742 <ul>
6743 <li>a</li>
6744 </ul>
6745 !! html/parsoid
6746 <table>
6747 <tr>
6748 <td><ul>
6749 <li>a</li>
6750 </ul></td>
6751 </tr>
6752 </table>
6753 !! end
6754
6755 !! test
6756 Table cells not properly parsed in an implicit-td context
6757 !! wikitext
6758 {|
6759 |-
6760 {{table_attribs_4}} || a || b
6761 |}
6762 !! html/php+tidy
6763 <table>
6764 <tr>
6765 <td style="background-color:#DC241f;" width="10px"></td>
6766 <td>a</td>
6767 <td>b</td>
6768 </tr>
6769 </table>
6770 !! html/parsoid
6771 <table>
6772 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6773 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6774 </tbody></table>
6775 !! end
6776
6777 !! test
6778 Parsoid: Round-trip tables directly followed by content (bug 51219)
6779 !! options
6780 parsoid=wt2html,wt2wt
6781 !! wikitext
6782 {|
6783 |foo
6784 |} bar
6785
6786 {|
6787 |baz
6788 |}<b>quux</b>
6789 !! html+tidy
6790 <table>
6791 <tr>
6792 <td>foo</td>
6793 </tr>
6794 </table>
6795 <p>bar</p>
6796 <table>
6797 <tr>
6798 <td>baz</td>
6799 </tr>
6800 </table>
6801 <p><b>quux</b></p>
6802 !! end
6803
6804 !! test
6805 Parsoid: Default to a newline after tables in new content (bug 51219)
6806 !! options
6807 parsoid=html2wt
6808 !! html/parsoid
6809 <table><tbody>
6810 <tr><td>foo</td></tr></tbody></table> bar
6811 <table><tbody>
6812 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6813 !! wikitext
6814 {|
6815 |foo
6816 |}
6817 <nowiki> </nowiki>bar
6818 {|
6819 |baz
6820 |}
6821 '''quux'''
6822 !! end
6823
6824 !! test
6825 Parsoid: newline inducing block nodes don't suppress <nowiki>
6826 !! options
6827 parsoid=html2wt
6828 !! html/parsoid
6829 a<h1>foo</h1>
6830 !! wikitext
6831 <nowiki> </nowiki>a
6832
6833 = foo =
6834 !! end
6835
6836 !! test
6837 Parsoid: Row-syntax table headings followed by comment & table cells
6838 !! options
6839 parsoid=wt2html,wt2wt
6840 !! wikitext
6841 {|
6842 ! foo || bar
6843 <!-- foo --> || baz || quux
6844 |}
6845 !! html/php
6846 <table>
6847 <tr>
6848 <th> foo </th>
6849 <th> bar
6850 </th>
6851 <td> baz </td>
6852 <td> quux
6853 </td></tr></table>
6854
6855 !! html/parsoid
6856 <table>
6857 <tbody><tr><th> foo </th><th> bar
6858 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6859 </tbody></table>
6860 !! end
6861
6862
6863 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6864 # preserves it.
6865 !!test
6866 Parsoid: Recover better from broken table attributes
6867 !!options
6868 parsoid=wt2html
6869 !!wikitext
6870 {| class="foo
6871 | class="bar" |
6872 foo
6873 |}
6874 !!html/php+tidy
6875 <table>
6876 <tr>
6877 <td class="bar">
6878 <p>foo</p>
6879 </td>
6880 </tr>
6881 </table>
6882 !!html/parsoid
6883 <table class="foo">
6884 <tr>
6885 <td class="bar">
6886 <p>foo</p></td></tr>
6887 </tbody></table>
6888 !!end
6889
6890 !! test
6891 Strip unsupported table tags
6892 !! options
6893 parsoid=html2wt
6894 !! html/parsoid
6895 <table>
6896 <thead>
6897 <tr>
6898 <th>Month</th>
6899 <th>Savings</th>
6900 </tr>
6901 </thead>
6902 <tbody>
6903 <tr>
6904 <td>January</td>
6905 <td>$100</td>
6906 </tr>
6907 <tr>
6908 <td>February</td>
6909 <td>$80</td>
6910 </tr>
6911 </tbody>
6912 <tfoot>
6913 <tr>
6914 <td>Sum</td>
6915 <td>$180</td>
6916 </tr>
6917 </tfoot>
6918 </table>
6919 !! wikitext
6920 {|
6921
6922 !Month
6923 !Savings
6924
6925 |January
6926 |$100
6927
6928 |-
6929 |February
6930 |$80
6931
6932 |Sum
6933 |$180
6934
6935 |}
6936 !! end
6937
6938 !!test
6939 Testing serialization after deletion of table cells
6940 !!options
6941 parsoid={
6942 "modes": ["wt2wt", "selser"],
6943 "changes": [
6944 ["#x", "remove"]
6945 ]
6946 }
6947 !!wikitext
6948 {|
6949 !h1 !!h2 !!h3
6950 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6951 |}
6952 !! wikitext/edited
6953 {|
6954 !h1 !!h2 !!h3
6955 |c2 |||c3
6956 |}
6957 !!end
6958
6959 ###
6960 ### Internal links
6961 ###
6962 !! test
6963 Plain link, capitalized
6964 !! wikitext
6965 [[Main Page]]
6966 !! html
6967 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6968 </p>
6969 !! end
6970
6971 !! test
6972 Plain link, uncapitalized
6973 !! wikitext
6974 [[main Page]]
6975 !! html
6976 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6977 </p>
6978 !! end
6979
6980 !! test
6981 Piped link
6982 !! wikitext
6983 [[Main Page|The Main Page]]
6984 !! html
6985 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6986 </p>
6987 !! end
6988
6989 !! test
6990 Piped link with comment in link text
6991 !! wikitext
6992 [[Main Page|The Main<!--front--> Page]]
6993 !! html
6994 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6995 </p>
6996 !! end
6997
6998 !! test
6999 Piped link with multiple pipe characters in link text
7000 !! wikitext
7001 [[Main Page||The|Main|Page|]]
7002 !! html/php
7003 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7004 </p>
7005 !! html/parsoid
7006 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7007 !! end
7008
7009 !! test
7010 Broken link
7011 !! wikitext
7012 [[Zigzagzogzagzig]]
7013 !! html
7014 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7015 </p>
7016 !! end
7017
7018 !! test
7019 Broken link with fragment
7020 !! wikitext
7021 [[Zigzagzogzagzig#zug]]
7022 !! html
7023 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7024 </p>
7025 !! end
7026
7027 !! test
7028 Special page link with fragment
7029 !! wikitext
7030 [[Special:Version#anchor]]
7031 !! html
7032 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7033 </p>
7034 !! end
7035
7036 !! test
7037 Nonexistent special page link with fragment
7038 !! wikitext
7039 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7040 !! html
7041 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7042 </p>
7043 !! end
7044
7045 !! test
7046 Link with prefix
7047 !! wikitext
7048 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7049 !! html
7050 <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>
7051 </p>
7052 !! end
7053
7054 !! test
7055 Link with suffix
7056 !! wikitext
7057 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7058 !! html
7059 <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>!!!
7060 </p>
7061 !! end
7062
7063 !! article
7064 prefixed article
7065 !! text
7066 Some text
7067 !! endarticle
7068
7069 !! test
7070 Bug 43661: Piped links with identical prefixes
7071 !! wikitext
7072 [[prefixed article|prefixed articles with spaces]]
7073
7074 [[prefixed article|prefixed articlesaoeu]]
7075
7076 [[Main Page|Main Page test]]
7077 !! html
7078 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7079 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7080 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7081 </p>
7082 !! end
7083
7084
7085 !! test
7086 Link with HTML entity in suffix / tail
7087 !! wikitext
7088 [[Main Page]]&quot;, [[Main Page]]&#97;
7089 !! html/php
7090 <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;
7091 </p>
7092 !! html/parsoid
7093 <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>
7094 !! end
7095
7096 !! test
7097 Link with 3 brackets
7098 !! wikitext
7099 [[[Main Page]]]
7100 !! html
7101 <p>[[[Main Page]]]
7102 </p>
7103 !! end
7104
7105 !! test
7106 Link with 4 brackets
7107 !! wikitext
7108 [[[[Main Page]]]]
7109 !! html
7110 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7111 </p>
7112 !! end
7113
7114 !! test
7115 Piped link with 3 brackets
7116 !! wikitext
7117 [[[main page|the main page]]]
7118 !! html
7119 <p>[[[main page|the main page]]]
7120 </p>
7121 !! end
7122
7123 !! test
7124 Piped link with extlink-like text
7125 !! wikitext
7126 [[Main Page|[bar]]]
7127 [[Main Page|This is a [bar]]]
7128 !! html/php
7129 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7130 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7131 </p>
7132 !! html/parsoid
7133 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7134 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7135 !! end
7136
7137 !! test
7138 Link with multiple pipes
7139 !! wikitext
7140 [[Main Page|The|Main|Page]]
7141 !! html
7142 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7143 </p>
7144 !! end
7145
7146 # Note that parsoid does not munge anchor text; all non-space
7147 # characters are valid in HTML5 ids.
7148 !! test
7149 Anchor containing a #. (bug 63430)
7150 !! wikitext
7151 [[Main Page#And#Link]]
7152 !! html/php
7153 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7154 </p>
7155 !! html/parsoid
7156 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7157 !! end
7158
7159 !! test
7160 Link to namespaces
7161 !! wikitext
7162 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7163 !! html
7164 <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>
7165 </p>
7166 !! end
7167
7168 !! test
7169 Link with space in namespace
7170 !! wikitext
7171 [[User talk:Foo bar]]
7172 !! html
7173 <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>
7174 </p>
7175 !! end
7176
7177 !! article
7178 MemoryAlpha:AlphaTest
7179 !! text
7180 This is an article in the MemoryAlpha namespace
7181 (which shadows the memoryalpha interwiki link).
7182 !! endarticle
7183
7184 !! test
7185 Namespace takes precedence over interwiki link (bug 51680)
7186 !! wikitext
7187 [[MemoryAlpha:AlphaTest]]
7188 !! html
7189 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7190 </p>
7191 !! end
7192
7193 # The previous test doesn't work correctly in html2*, due to not recognizing the
7194 # link as an internal one. This one checks for the correct behavior.
7195 !! test
7196 Link to namespace preferred over interwiki with correct rel attribute
7197 !! options
7198 parsoid=html2wt,html2html
7199 !! html/parsoid
7200 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7201 !! wikitext
7202 [[MemoryAlpha:AlphaTest]]
7203 !! end
7204
7205 !! test
7206 Piped link to namespace
7207 !! wikitext
7208 [[Meta:Disclaimers|The disclaimers]]
7209 !! html
7210 <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>
7211 </p>
7212 !! end
7213
7214 !! test
7215 Link containing }
7216 !! wikitext
7217 [[Usually caused by a typo (oops}]]
7218 !! html
7219 <p>[[Usually caused by a typo (oops}]]
7220 </p>
7221 !! end
7222
7223 !! article
7224 7% Solution
7225 !! text
7226 Just a test of an article title containing a percent.
7227 !! endarticle
7228
7229 !! test
7230 Link containing % (not as a hex sequence)
7231 !! wikitext
7232 [[7% Solution]]
7233 !! html/php
7234 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7235 </p>
7236 !! html/parsoid
7237 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7238 !! end
7239
7240 # note that the parsoid HTML is identical to the previous test output,
7241 # so the previous test ensures that the html2wt mode will generate the
7242 # "not as a hex sequence" wikitext.
7243 !! test
7244 Link containing % as a single hex sequence interpreted to char
7245 !! options
7246 parsoid=wt2wt,wt2html,html2html
7247 !! wikitext
7248 [[7%25 Solution]]
7249 !! html/php
7250 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7251 </p>
7252 !! html/parsoid
7253 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7254 !!end
7255
7256 !! test
7257 Link containing % as a double hex sequence interpreted to hex sequence
7258 !! wikitext
7259 [[7%2525 Solution]]
7260 !! html
7261 <p>[[7%2525 Solution]]
7262 </p>
7263 !!end
7264
7265 # note that parsoid does not munge anchor text; all non-space
7266 # characters are valid in HTML5 anchors.
7267 !! test
7268 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7269 Example for such a section: == < ==
7270 !! wikitext
7271 [[%23%3c]][[%23%3e]]
7272 !! html/php
7273 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7274 </p>
7275 !! html/parsoid
7276 <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>
7277 !! end
7278
7279 !! test
7280 Link containing "<#" and ">#" as a hex sequences
7281 !! wikitext
7282 [[%3c%23]][[%3e%23]]
7283 !! html
7284 <p>[[%3c%23]][[%3e%23]]
7285 </p>
7286 !! end
7287
7288 !! test
7289 Link containing an equals sign
7290 !! wikitext
7291 [[Special:BookSources/isbn=4-00-026157-6]]
7292 !! html/php
7293 <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>
7294 </p>
7295 !! html/parsoid
7296 <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>
7297 !! end
7298
7299 !! article
7300 Foo~bar
7301 !! text
7302 Just a test of an article title containing a tilde.
7303 !! endarticle
7304
7305 # note that links containing signatures, like [[Foo~~~~]], are
7306 # massaged by the pre-save transform (PST) and so the tildes are never
7307 # seen by the parser.
7308 !! test
7309 Link containing a tilde
7310 !! wikitext
7311 [[Foo~bar]]
7312 !! html/php
7313 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7314 </p>
7315 !! html/parsoid
7316 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7317 !! end
7318
7319 !! test
7320 Link containing double-single-quotes '' (bug 4598)
7321 !! wikitext
7322 [[Lista d''e paise d''o munno]]
7323 !! html/php
7324 <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>
7325 </p>
7326 !! html/parsoid
7327 <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>
7328 !! end
7329
7330 !! test
7331 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7332 !! wikitext
7333 Some [[Link|pretty ''italics'' and stuff]]!
7334 !! html/php
7335 <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>!
7336 </p>
7337 !! html/parsoid
7338 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7339 !! end
7340
7341 !! test
7342 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7343 !! wikitext
7344 ''Some [[Link|pretty ''italics'' and stuff]]!''
7345 !! html
7346 <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>
7347 </p>
7348 !! end
7349
7350 !! test
7351 Link with double quotes in title part (literal) and alternate part (interpreted)
7352 !! wikitext
7353 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7354
7355 [[''Pentecoste'']]
7356
7357 [[''Pentecoste''|Pentecoste]]
7358
7359 [[''Pentecoste''|''Pentecoste'']]
7360 !! html/php
7361 <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>
7362 </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>
7363 </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>
7364 </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>
7365 </p>
7366 !! html/parsoid
7367 <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>
7368 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7369 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7370 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7371 !! end
7372
7373 !! test
7374 Broken image links with HTML captions (bug 39700)
7375 !! wikitext
7376 [[File:Nonexistent|<script></script>]]
7377 [[File:Nonexistent|100x100px|<script></script>]]
7378 [[File:Nonexistent|&lt;]]
7379 [[File:Nonexistent|a<i>b</i>c]]
7380 !! html/php
7381 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7382 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7383 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7384 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7385 </p>
7386 !! html/parsoid
7387 <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>
7388 <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>
7389 <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>
7390 <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>
7391 !! end
7392
7393 !! test
7394 Plain link to URL
7395 !! wikitext
7396 [[http://www.example.com]]
7397 !! html/php
7398 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7399 </p>
7400 !! html/parsoid
7401 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7402 !! end
7403
7404 !! test
7405 Plain link to URL with link text
7406 !! wikitext
7407 [[http://www.example.com Link text]]
7408 !! html
7409 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7410 </p>
7411 !! end
7412
7413 !! test
7414 Plain link to protocol-relative URL
7415 !! wikitext
7416 [[//www.example.com]]
7417 !! html/php
7418 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7419 </p>
7420 !! html/parsoid
7421 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7422 !! end
7423
7424 !! test
7425 Plain link to protocol-relative URL with link text
7426 !! wikitext
7427 [[//www.example.com Link text]]
7428 !! html
7429 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7430 </p>
7431 !! end
7432
7433 !! test
7434 Plain link to page with question mark in title
7435 !! wikitext
7436 [[A?b]]
7437
7438 [[A?b|Baz]]
7439 !! html
7440 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7441 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7442 </p>
7443 !! end
7444
7445
7446 # I'm fairly sure the expected result here is wrong.
7447 # We want these to be URL links, not pseudo-pages with URLs for titles....
7448 # However the current output is also pretty screwy.
7449 #
7450 # ----
7451 # I'm changing it to match the current output--it arguably makes more
7452 # sense in the light of the test above. Old expected result was:
7453 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7454 #</p>
7455 # But I think this test is bordering on "garbage in, garbage out" anyway.
7456 # -- wtm
7457 !! test
7458 Piped link to URL
7459 !! wikitext
7460 Piped link to URL: [[http://www.example.com|an example URL]]
7461 !! html/php
7462 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7463 </p>
7464 !! html/parsoid
7465 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7466 !! end
7467
7468 !! test
7469 BUG 2: [[page|http://url/]] should link to page, not http://url/
7470 !! wikitext
7471 [[Main Page|http://url/]]
7472 !! html/php
7473 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7474 </p>
7475 !! html/parsoid
7476 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7477 !! end
7478
7479 # Parsoid does not mark self-links, by design.
7480 !! test
7481 BUG 337: Escaped self-links should be bold
7482 !! options
7483 title=[[Bug462]]
7484 !! wikitext
7485 [[Bu&#103;462]] [[Bug462]]
7486 !! html/php
7487 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7488 </p>
7489 !! html/php+tidy
7490 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7491 !! html/parsoid
7492 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7493 !! end
7494
7495 !! test
7496 Self-link to section should not be bold
7497 !! options
7498 title=[[Main Page]]
7499 !! wikitext
7500 [[Main Page#section]]
7501 !! html
7502 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7503 </p>
7504 !! end
7505
7506 !! article
7507 00
7508 !! text
7509 This is 00.
7510 !! endarticle
7511
7512 !!test
7513 Self-link to numeric title
7514 !!options
7515 title=[[0]]
7516 !! wikitext
7517 [[0]]
7518 !! html
7519 <p><strong class="selflink">0</strong>
7520 </p>
7521 !!end
7522
7523 !!test
7524 Link to numeric-equivalent title
7525 !!options
7526 title=[[0]]
7527 !! wikitext
7528 [[00]]
7529 !! html
7530 <p><a href="/wiki/00" title="00">00</a>
7531 </p>
7532 !!end
7533
7534 !! test
7535 <nowiki> inside a link
7536 !! wikitext
7537 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7538 !! html
7539 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7540 </p>
7541 !! end
7542
7543 !! test
7544 Non-breaking spaces in title
7545 !! wikitext
7546 [[&nbsp; Main &nbsp; Page &nbsp;]]
7547 !! html
7548 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7549 </p>
7550 !!end
7551
7552 !! test
7553 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7554 !! options
7555 language=ca
7556 !! wikitext
7557 '''[[Main Page]]'''
7558 !! html
7559 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7560 </p>
7561 !! end
7562
7563 !! test
7564 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7565 !! options
7566 language=ca
7567 !! wikitext
7568 ''[[Main Page]]''
7569 !! html
7570 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7571 </p>
7572 !! end
7573
7574 !! test
7575 Internal link with en linktrail: no apostrophes (bug 27473)
7576 !! options
7577 language=en
7578 !! wikitext
7579 [[Something]]'nice
7580 !! html
7581 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7582 </p>
7583 !! end
7584
7585 !! test
7586 Internal link with ca linktrail with apostrophes (bug 27473)
7587 !! options
7588 language=ca
7589 !! wikitext
7590 [[Something]]'nice
7591 !! html
7592 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7593 </p>
7594 !! end
7595
7596 !! test
7597 Internal link with kaa linktrail with apostrophes (bug 27473)
7598 !! options
7599 language=kaa
7600 !! wikitext
7601 [[Something]]'nice
7602 !! html
7603 <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>
7604 </p>
7605 !! end
7606
7607 !! test
7608 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7609 !! wikitext
7610 [[User:Foo/Test/63636:Bar|Test]]
7611 !! html/php
7612 <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>
7613 </p>
7614 !! html/parsoid
7615 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7616 !! end
7617
7618 !! test
7619 Purely hash wikilink
7620 !! options
7621 title=[[User:test/123]]
7622 !! wikitext
7623 [[#a|b]]
7624 !! html/php
7625 <p><a href="#a">b</a>
7626 </p>
7627 !! html/parsoid
7628 <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>
7629 !! end
7630
7631 !! test
7632 1. Interaction of linktrail and template encapsulation
7633 !! options
7634 parsoid
7635 !! wikitext
7636 {{echo|[[Foo]]}}l
7637 !! html
7638 <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>
7639 !! end
7640
7641 !! test
7642 2. Interaction of linktrail and template encapsulation
7643 !! options
7644 parsoid
7645 !! wikitext
7646 {{echo|Some [[Fool]]}}s
7647 !! html
7648 <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>
7649 !! end
7650
7651 !! test
7652 3. Interaction of linktrail and template encapsulation
7653 !! options
7654 parsoid
7655 !! wikitext
7656 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7657 !! html
7658 <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>
7659 !! end
7660
7661 !! article
7662 Söfnuður
7663 !! text
7664 Test.
7665 !! endarticle
7666
7667 !! test
7668 Internal link with is link prefix
7669 !! options
7670 language=is
7671 !! wikitext
7672 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7673 !! html
7674 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7675 </p>
7676 !! end
7677
7678 !! article
7679 Mótmælendatrú
7680 !! text
7681 Test.
7682 !! endarticle
7683
7684 !! test
7685 Internal link with is link trail and link prefix
7686 !! options
7687 language=is
7688 !! wikitext
7689 [[mótmælendatrú|xxx]]ar
7690 [[mótmælendatrú]]ar
7691 mótmælenda[[söfnuður]]
7692 mótmælenda[[söfnuður|söfnuðir]]
7693 mótmælenda[[söfnuður|söfnuðir]]xxx
7694 !! html
7695 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7696 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7697 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7698 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7699 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7700 </p>
7701 !! end
7702
7703 !! test
7704 Parsoid link trail escaping
7705 !! options
7706 parsoid=html2wt,html2html
7707 !! html/parsoid
7708 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7709 !! wikitext
7710 [[apple]]<nowiki/>s
7711 !! end
7712
7713 !! test
7714 Parsoid link prefix escaping
7715 !! options
7716 language=is
7717 parsoid=html2wt,html2html
7718 !! html/parsoid
7719 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7720 !! wikitext
7721 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7722 !! end
7723
7724 !! test
7725 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7726 !! wikitext
7727 [[Foo| bar]]
7728
7729 [[Foo| ''bar'']]
7730
7731 [http://wp.org foo]
7732
7733 [http://wp.org ''foo'']
7734 !! html
7735 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7736 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7737 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7738 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7739 </p>
7740 !! end
7741
7742 !! test
7743 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7744 !! options
7745 parsoid
7746 !! wikitext
7747 [[Foo|{{echo|a}} b {{echo|c}}]]
7748 !! html
7749 <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>
7750 !! end
7751
7752 !! test
7753 Link with angle bracket after anchor
7754 !! wikitext
7755 [[Foo#<bar>]]
7756 !! html/php
7757 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7758 </p>
7759 !! html/parsoid
7760 <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>
7761 !! end
7762
7763 ###
7764 ### Interwiki links (see maintenance/interwiki.sql)
7765 ###
7766
7767 !! test
7768 Inline interwiki link
7769 !! options
7770 parsoid=wt2html,wt2wt,html2html
7771 !! wikitext
7772 [[MeatBall:SoftSecurity]]
7773 !! html/php
7774 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7775 </p>
7776 !! html/parsoid
7777 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7778 !! end
7779
7780 !! test
7781 Inline interwiki link with empty title (bug 2372)
7782 !! options
7783 parsoid=wt2html,wt2wt,html2html
7784 !! wikitext
7785 [[MeatBall:]]
7786 !! html/php
7787 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7788 </p>
7789 !! html/parsoid
7790 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7791 !! end
7792
7793 !! test
7794 Interwiki link encoding conversion (bug 1636)
7795 !! wikitext
7796 *[[Wikipedia:ro:Olteni&#0355;a]]
7797 *[[Wikipedia:ro:Olteni&#355;a]]
7798 !! html
7799 <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>
7800 <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>
7801
7802 !! html+tidy
7803 <ul>
7804 <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>
7805 <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>
7806 </ul>
7807 !! end
7808
7809 !! test
7810 Interwiki link with fragment (bug 2130)
7811 !! wikitext
7812 [[MeatBall:SoftSecurity#foo]]
7813 !! html
7814 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7815 </p>
7816 !! end
7817
7818 # Ideally the wikipedia: prefix here should be proto-relative too
7819 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7820 # define the 'en' prefix, and originally the test used 'wikipedia',
7821 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7822 # article.
7823 !! test
7824 Different interwiki prefixes mapping to the same URL
7825 !! wikitext
7826 [[:en:Foo]]
7827
7828 [[:en:Foo|Foo]]
7829
7830 [[wikipedia:Foo]]
7831
7832 [[:wikipedia:Foo|Foo]]
7833
7834 [[wikipedia:en:Foo]]
7835
7836 [[:wikipedia:en:Foo]]
7837
7838 [[ wikiPEdia :Foo]]
7839 !! html/parsoid
7840 <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>
7841
7842 <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>
7843
7844 <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>
7845
7846 <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>
7847
7848 <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>
7849
7850 <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>
7851
7852 <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>
7853 !! end
7854
7855 !! test
7856 Interwiki links that cannot be represented in wiki syntax
7857 !! wikitext
7858 [[meatball:ok]]
7859 [[meatball:ok#foo|ok with fragment]]
7860 [[meatball:ok_as_well?|ok ending with ? mark]]
7861 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7862 [http://de.wikipedia.org/wiki/#foo is just fragment]
7863
7864 !! html/php
7865 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7866 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7867 <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>
7868 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7869 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7870 </p>
7871 !! html/parsoid
7872 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7873 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7874 <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>
7875 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7876 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7877 !! end
7878
7879 !! test
7880 Interwiki links: trail
7881 !! wikitext
7882 [[wikipedia:Foo|Ba]]r
7883 !! html/php
7884 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7885 </p>
7886 !! html/parsoid
7887 <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>
7888 !! end
7889
7890 !! test
7891 Local interwiki link
7892 !! options
7893 parsoid=wt2html,wt2wt,html2html
7894 !! wikitext
7895 [[local:Template:Foo]]
7896 !! html/php
7897 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7898 </p>
7899 !! html/parsoid
7900 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7901 !! end
7902
7903 # Parsoid does not mark self-links, by design.
7904 !! test
7905 Local interwiki link: self-link to current page
7906 !! options
7907 title=[[Main Page]]
7908 parsoid=wt2html,wt2wt,html2html
7909 !! wikitext
7910 [[local:Main Page]]
7911 !! html/php
7912 <p><strong class="selflink">local:Main Page</strong>
7913 </p>
7914 !! html/parsoid
7915 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7916 !! end
7917
7918 !! test
7919 Local interwiki link: prefix only (bug 64167)
7920 !! options
7921 parsoid=wt2html,wt2wt,html2html
7922 !! wikitext
7923 [[local:]]
7924 !! html/php
7925 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7926 </p>
7927 !! html/parsoid
7928 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7929 !! end
7930
7931 !! test
7932 Local interwiki link: with additional interwiki prefix (bug 61357)
7933 !! options
7934 parsoid=wt2html,wt2wt,html2html
7935 !! wikitext
7936 [[local:meatball:Hello]]
7937 !! html/php
7938 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7939 </p>
7940 !! html/parsoid
7941 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7942 !! end
7943
7944 !! test
7945 Multiple local interwiki link prefixes
7946 !! wikitext
7947 [[local:local:local:local:mi:local:Foo]]
7948 !! options
7949 parsoid=wt2html,wt2wt,html2html
7950 !! html/php
7951 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7952 </p>
7953 !! html/parsoid
7954 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7955 !! end
7956
7957 ###
7958 ### Interlanguage links
7959 ### Language links (so that searching for '### language' matches..)
7960 ###
7961
7962 !! test
7963 Interlanguage link
7964 !! options
7965 parsoid=wt2html,wt2wt,html2html
7966 !! wikitext
7967 Blah blah blah
7968 [[zh:Chinese]]
7969 !! html/php
7970 <p>Blah blah blah
7971 </p>
7972 !! html/parsoid
7973 <p>Blah blah blah</p>
7974 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7975 !! end
7976
7977 !! test
7978 Interlanguage link with spacing
7979 !! options
7980 parsoid=wt2html,wt2wt,html2html
7981 !! wikitext
7982 Blah blah blah
7983 [[ zh : Chinese ]]
7984 !! html/php
7985 <p>Blah blah blah
7986 </p>
7987 !! html/parsoid
7988 <p>Blah blah blah</p>
7989 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7990 !! end
7991
7992 !! test
7993 Double interlanguage link
7994 !! options
7995 parsoid=wt2html,wt2wt,html2html
7996 !! wikitext
7997 Blah blah blah
7998 [[es:Spanish]]
7999 [[zh:Chinese]]
8000 !! html/php
8001 <p>Blah blah blah
8002 </p>
8003 !! html/parsoid
8004 <p>Blah blah blah</p>
8005 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8006 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8007 !! end
8008
8009 !! test
8010 Interlanguage link variations
8011 !! options
8012 parsoid=wt2html,wt2wt,html2html
8013 !! wikitext
8014 Blah blah blah
8015 [[ es :Spanish]]
8016 [[ ZH :Chinese]]
8017 [[es:Foo_bar]]
8018 !! html/php
8019 <p>Blah blah blah
8020 </p>
8021 !! html/parsoid
8022 <p>Blah blah blah</p>
8023 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8024 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8025 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8026 !! end
8027
8028 !! test
8029 Space and question mark encoding in interlanguage links (T95473)
8030 !! options
8031 parsoid=wt2html,wt2wt,html2html
8032 !! wikitext
8033 Blah blah blah
8034 [[es:Foo bar?]]
8035 !! html/php
8036 <p>Blah blah blah
8037 </p>
8038 !! html/parsoid
8039 <p>Blah blah blah</p>
8040 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8041 !! end
8042
8043 !! test
8044 Interlanguage link, with prefix links
8045 !! options
8046 language=ln
8047 !! wikitext
8048 Blah blah blah
8049 [[zh:Chinese]]
8050 !! html/php
8051 <p>Blah blah blah
8052 </p>
8053 !! html/parsoid
8054 <p>Blah blah blah</p>
8055 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8056 !! end
8057
8058 !! test
8059 Double interlanguage link, with prefix links (bug 8897)
8060 !! options
8061 language=ln
8062 !! wikitext
8063 Blah blah blah
8064 [[es:Spanish]]
8065 [[zh:Chinese]]
8066 !! html/php
8067 <p>Blah blah blah
8068 </p>
8069 !! html/parsoid
8070 <p>Blah blah blah</p>
8071 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8072 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8073 !! end
8074
8075 !! test
8076 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8077 !! wikitext
8078 Blah blah blah
8079 [[mul:Article]]
8080 !! html/php
8081 <p>Blah blah blah
8082 </p>
8083 !! html/parsoid
8084 <p>Blah blah blah</p>
8085 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8086 !! end
8087
8088 !! test
8089 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8090 !! options
8091 language=ln
8092 !! wikitext
8093 [[WW&nbsp;II]]
8094 !! html
8095 <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>
8096 </p>
8097 !! end
8098
8099 !! test
8100 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8101 !! options
8102 parsoid=html2wt
8103 !! html/parsoid
8104 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8105 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8106 !! wikitext
8107 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8108
8109 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8110 !! end
8111
8112 !! test
8113 Parsoid: handle constructor well
8114 !! wikitext
8115 [[constructor]]
8116
8117 [[constructor:foo]]
8118 !! html/php
8119 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8120 </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>
8121 </p>
8122 !! html/parsoid
8123 <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>
8124
8125 <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>
8126 !! end
8127
8128 !! article
8129 ko:
8130 !! text
8131 Test.
8132 !! endarticle
8133
8134 # Note that `ko` isn't a known interlanguage prefix
8135 !! test
8136 Parsoid: recognize interlanguage links without a target page
8137 !! options
8138 ill
8139 !! wikitext
8140 [[es:]]
8141
8142 [[ko:]]
8143 !! html/php
8144 es:
8145 !! html/parsoid
8146 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8147
8148 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8149 !! end
8150
8151 # Note that `ko` isn't a known interwiki prefix
8152 !! test
8153 Parsoid: recognize interwiki links without a target page
8154 !! options
8155 parsoid=wt2html,wt2wt,html2html
8156 !! wikitext
8157 [[:es:]]
8158
8159 [[:ko:]]
8160 !! html/php
8161 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8162 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8163 </p>
8164 !! html/parsoid
8165 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8166 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8167 !! end
8168
8169 !! test
8170 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8171 !! wikitext
8172 [[mi:Foo]]
8173 !! html/php
8174 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8175 </p>
8176 !! html/parsoid
8177 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8178 !! end
8179
8180 !! test
8181 Interlanguage link with preceding local interwiki link (bug 68085)
8182 !! options
8183 parsoid=wt2html,wt2wt,html2html
8184 !! wikitext
8185 Blah blah blah
8186 [[local:es:Spanish]]
8187 !! html/php
8188 <p>Blah blah blah
8189 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8190 </p>
8191 !! html/parsoid
8192 <p>Blah blah blah
8193 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8194 !! end
8195
8196 !! test
8197 Looks like an interlanguage link, but is actually a local interwiki
8198 !! options
8199 parsoid=wt2html,wt2wt,html2html
8200 !! wikitext
8201 Blah blah blah
8202 [[mi:Template:Foo]]
8203 !! html/php
8204 <p>Blah blah blah
8205 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8206 </p>
8207 !! html/parsoid
8208 <p>Blah blah blah
8209 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8210 !! end
8211
8212 ###
8213 ### Redirects, Parsoid-only
8214 ###
8215
8216 !! test
8217 1. Simple redirect to page
8218 !! wikitext
8219 #REDIRECT [[Main Page]]
8220 !! html/parsoid
8221 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8222 !! end
8223
8224 !! test
8225 2. Other redirect variants
8226 !! wikitext
8227 #REDIRECT [[Main_Page]]
8228 !! html/parsoid
8229 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8230 !! end
8231
8232 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8233 # This tests the Parsoid bail-out code.
8234 !! test
8235 3. Other redirect variants
8236 !! wikitext
8237 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8238 !! html/parsoid
8239 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8240 !! end
8241
8242 !! test
8243 4. Redirect to a templated destination
8244 !! wikitext
8245 #REDIRECT [[{{echo|Foo}}bar]]
8246 !! html/parsoid
8247 <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"}]]}'/>
8248 !! end
8249
8250 !! test
8251 Empty redirect
8252 !! options
8253 parsoid=wt2html,wt2wt
8254 !! wikitext
8255 #REDIRECT [[]]
8256 !! html/parsoid
8257 <ol>
8258 <li>REDIRECT [[]]</li></ol>
8259 !! end
8260
8261 !! test
8262 Optional colon in #REDIRECT
8263 !! options
8264 # the colon is archaic syntax. we support it for wt2html, but we
8265 # don't care that it roundtrips back to the modern syntax.
8266 parsoid=wt2html,html2html
8267 !! wikitext
8268 #REDIRECT:[[Main Page]]
8269 !! html/parsoid
8270 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8271 !! end
8272
8273 !! test
8274 Whitespace in #REDIRECT with optional colon
8275 !! options
8276 # the colon and gratuitous whitespace is archaic syntax. we support
8277 # it for wt2html, but we don't care that it roundtrips back to the
8278 # modern syntax (without extra whitespace)
8279 parsoid=wt2html,html2html
8280 !! wikitext
8281
8282 #REDIRECT
8283 :
8284 [[Main Page]]
8285 !! html/parsoid
8286 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8287 !! end
8288
8289 !! test
8290 Piped link in #REDIRECT
8291 !! options
8292 # content after piped link is ignored. we support this syntax,
8293 # but don't care that the piped link is lost when we roundtrip this.
8294 parsoid=wt2html
8295 !! wikitext
8296 #REDIRECT [[Main Page|bar]]
8297 !! html/parsoid
8298 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8299 !! end
8300
8301 !! test
8302 Redirect to category (T104502)
8303 !! options
8304 parsoid=wt2html,wt2wt
8305 !! wikitext
8306 #REDIRECT [[Category:Foo]]
8307 !! html/parsoid
8308 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8309 !! end
8310
8311 !! test
8312 Redirect to category with URL encoding (T104502)
8313 !! options
8314 parsoid=wt2html
8315 !! wikitext
8316 #REDIRECT [[Category%3AFoo]]
8317 !! html/parsoid
8318 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8319 !! end
8320
8321 !! test
8322 Redirect to category page
8323 !! wikitext
8324 #REDIRECT [[:Category:Foo]]
8325 !! html/parsoid
8326 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8327 !! end
8328
8329 !! test
8330 Redirect to image page (1)
8331 !! wikitext
8332 #REDIRECT [[File:Wiki.png]]
8333 !! html/parsoid
8334 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8335 !! end
8336
8337 !! test
8338 Redirect to image page (2)
8339 !! wikitext
8340 #REDIRECT [[Image:Wiki.png]]
8341 !! html/parsoid
8342 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8343 !! end
8344
8345 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8346 # Next test confirms this.
8347 !! test
8348 Redirect to language (1) (T104918)
8349 !! options
8350 parsoid=wt2html,wt2wt,html2html
8351 !! wikitext
8352 #REDIRECT [[en:File:Wiki.png]]
8353 !! html/parsoid
8354 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8355 !! end
8356
8357 !! test
8358 Redirect to language (2) (T104918)
8359 !! wikitext
8360 #REDIRECT [[:en:File:Wiki.png]]
8361 !! html/parsoid
8362 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8363 !! end
8364
8365 !! test
8366 Redirect to interwiki (T104918)
8367 !! wikitext
8368 #REDIRECT [[meatball:File:Wiki.png]]
8369 !! html/parsoid
8370 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8371 !! end
8372
8373 !! test
8374 Non-English #REDIRECT
8375 !! options
8376 language=is
8377 !! wikitext
8378 #TILVÍSUN [[Main Page]]
8379 !! html/parsoid
8380 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8381 !! end
8382
8383 !! test
8384 Redirect syntax under text isn't considered a redirect
8385 !! wikitext
8386 some text
8387 #redirect [[Main Page]]
8388 !! html/parsoid
8389 <p>some text</p>
8390 <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>
8391 !! end
8392
8393 # FIXME: Should hoist the redirect to the top of the page and ensure there
8394 # is only one.
8395 !! test
8396 New redirect
8397 !! options
8398 parsoid=html2wt
8399 !! html/parsoid
8400 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8401 !! wikitext
8402 Foo
8403 #REDIRECT [[Foo]]
8404 !! end
8405
8406 ##
8407 ## XHTML tidiness
8408 ###
8409
8410 !! test
8411 <br> to <br />
8412 !! wikitext
8413 1<br>2<br />3
8414 !! html
8415 <p>1<br />2<br />3
8416 </p>
8417 !! end
8418
8419 !! test
8420 Broken br tag sanitization
8421 !! wikitext
8422 </br>
8423 !! html/php
8424 <p>&lt;/br&gt;
8425 </p>
8426 !! end
8427
8428 # TODO: Fix html2html mode (bug 51055)!
8429 !! test
8430 Parsoid: Broken br tag recognition
8431 !! options
8432 parsoid=wt2html
8433 !! wikitext
8434 </br>
8435
8436 <br/ >
8437 !! html+tidy
8438 <p><br /></p>
8439 <p><br /></p>
8440 !! end
8441
8442 !! test
8443 Incorrecly removing closing slashes from correctly formed XHTML
8444 !! wikitext
8445 <br style="clear:both;" />
8446 !! html
8447 <p><br style="clear:both;" />
8448 </p>
8449 !! end
8450
8451 !! test
8452 Failing to transform badly formed HTML into correct XHTML
8453 !! wikitext
8454 <br style="clear: left;">
8455 <br style="clear: right;">
8456 <br style="clear: both;">
8457 !! html
8458 <p><br style="clear: left;" />
8459 <br style="clear: right;" />
8460 <br style="clear: both;" />
8461 </p>
8462 !!end
8463
8464 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8465 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8466 !! test
8467 Handling html with a div self-closing tag
8468 !! wikitext
8469 <div title />
8470 <div title/>
8471 <div title/ >
8472 <div title=bar />
8473 <div title=bar/>
8474 <div title=bar/ >
8475 !! html/php
8476 <p>&lt;div title /&gt;
8477 &lt;div title/&gt;
8478 </p>
8479 <div>
8480 <p>&lt;div title=bar /&gt;
8481 &lt;div title=bar/&gt;
8482 </p>
8483 <div title="bar/"></div>
8484 </div>
8485
8486 !! html/parsoid
8487 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8488 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8489 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8490 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8491 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8492 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8493 !! end
8494
8495 !! test
8496 Handling html with a br self-closing tag
8497 !! wikitext
8498 <br title />
8499 <br title/>
8500 <br title/ >
8501 <br title=bar />
8502 <br title=bar/>
8503 <br title=bar/ >
8504 !! html/php
8505 <p><br title="" />
8506 <br title="" />
8507 <br />
8508 <br title="bar" />
8509 <br title="bar" />
8510 <br title="bar/" />
8511 </p>
8512 !! html/parsoid
8513 <p><br title="" />
8514 <br title="" />
8515 <br title="" />
8516 <br title="bar" />
8517 <br title="bar" />
8518 <br title="bar/" />
8519 </p>
8520 !! end
8521
8522 !! test
8523 Horizontal ruler (should it add that extra space?)
8524 !! wikitext
8525 <hr>
8526 <hr >
8527 foo <hr
8528 > bar
8529 !! html+tidy
8530 <hr />
8531 <hr />
8532 <p>foo</p>
8533 <hr />
8534 <p>bar</p>
8535 !! end
8536
8537 !! test
8538 Horizontal ruler -- 4+ dashes render hr
8539 !! wikitext
8540 ----
8541 !! html
8542 <hr />
8543
8544 !! end
8545
8546 !! test
8547 Horizontal ruler -- eats additional dashes on the same line
8548 !! wikitext
8549 ---------
8550 !! html
8551 <hr />
8552
8553 !! end
8554
8555 !! test
8556 Horizontal ruler -- does not collapse dashes on consecutive lines
8557 !! wikitext
8558 ----
8559 ----
8560 !! html
8561 <hr />
8562 <hr />
8563
8564 !! end
8565
8566 !! test
8567 Horizontal ruler -- <4 dashes render as plain text
8568 !! wikitext
8569 ---
8570 !! html
8571 <p>---
8572 </p>
8573 !! end
8574
8575 !! test
8576 Horizontal ruler -- Supports content following dashes on same line
8577 !! wikitext
8578 ---- Foo
8579 !! html
8580 <hr /> Foo
8581
8582 !! html+tidy
8583 <hr />
8584 <p>Foo</p>
8585 !! end
8586
8587 ###
8588 ### Block-level elements
8589 ###
8590 !! test
8591 Common list
8592 !! wikitext
8593 *Common list
8594 * item 2
8595 *item 3
8596 !! html
8597 <ul><li>Common list</li>
8598 <li> item 2</li>
8599 <li>item 3</li></ul>
8600
8601 !! end
8602
8603 !! test
8604 Numbered list
8605 !! wikitext
8606 #Numbered list
8607 #item 2
8608 # item 3
8609 !! html
8610 <ol><li>Numbered list</li>
8611 <li>item 2</li>
8612 <li> item 3</li></ol>
8613
8614 !! end
8615
8616 !! test
8617 Mixed list
8618 !! wikitext
8619 *Mixed list
8620 *# with numbers
8621 ** and bullets
8622 *# and numbers
8623 *bullets again
8624 **bullet level 2
8625 ***bullet level 3
8626 ***#Number on level 4
8627 **bullet level 2
8628 **#Number on level 3
8629 **#Number on level 3
8630 *#number level 2
8631 *Level 1
8632 *** Level 3
8633 #** Level 3, but ordered
8634 !! html
8635 <ul><li>Mixed list
8636 <ol><li> with numbers</li></ol>
8637 <ul><li> and bullets</li></ul>
8638 <ol><li> and numbers</li></ol></li>
8639 <li>bullets again
8640 <ul><li>bullet level 2
8641 <ul><li>bullet level 3
8642 <ol><li>Number on level 4</li></ol></li></ul></li>
8643 <li>bullet level 2
8644 <ol><li>Number on level 3</li>
8645 <li>Number on level 3</li></ol></li></ul>
8646 <ol><li>number level 2</li></ol></li>
8647 <li>Level 1
8648 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8649 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8650
8651 !! end
8652
8653 !! test
8654 Nested lists 1
8655 !! wikitext
8656 *foo
8657 **bar
8658 !! html
8659 <ul><li>foo
8660 <ul><li>bar</li></ul></li></ul>
8661
8662 !! end
8663
8664 !! test
8665 Nested lists 2
8666 !! wikitext
8667 **foo
8668 *bar
8669 !! html
8670 <ul><li><ul><li>foo</li></ul></li>
8671 <li>bar</li></ul>
8672
8673 !! end
8674
8675 !! test
8676 Nested lists 3 (first element empty)
8677 !! wikitext
8678 *
8679 **bar
8680 !! html
8681 <ul><li>
8682 <ul><li>bar</li></ul></li></ul>
8683
8684 !! end
8685
8686 !! test
8687 Nested lists 4 (first element empty)
8688 !! wikitext
8689 **
8690 *bar
8691 !! html
8692 <ul><li><ul><li></li></ul></li>
8693 <li>bar</li></ul>
8694
8695 !! end
8696
8697 !! test
8698 Nested lists 5 (both elements empty)
8699 !! wikitext
8700 **
8701 *
8702 !! html
8703 <ul><li><ul><li></li></ul></li>
8704 <li></li></ul>
8705
8706 !! end
8707
8708 !! test
8709 Nested lists 6 (both elements empty)
8710 !! wikitext
8711 *
8712 **
8713 !! html
8714 <ul><li>
8715 <ul><li></li></ul></li></ul>
8716
8717 !! end
8718
8719 !! test
8720 Nested lists 7 (skip initial nesting levels)
8721 !! wikitext
8722 *** foo
8723 !! html
8724 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8725
8726 !! end
8727
8728 !! test
8729 Nested lists 8 (multiple nesting transitions)
8730 !! wikitext
8731 * foo
8732 *** bar
8733 ** baz
8734 * boo
8735 !! html
8736 <ul><li> foo
8737 <ul><li><ul><li> bar</li></ul></li>
8738 <li> baz</li></ul></li>
8739 <li> boo</li></ul>
8740
8741 !! end
8742
8743 !! test
8744 Nested lists 9 (extension interaction)
8745 !! options
8746 parsoid
8747 !! wikitext
8748 *<references />
8749 !! html/parsoid
8750 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8751 !! end
8752
8753 !! test
8754 1. Lists with start-of-line-transparent tokens before bullets: Comments
8755 !! wikitext
8756 *foo
8757 *<!--cmt-->bar
8758 <!--cmt-->*baz
8759 !! html
8760 <ul><li>foo</li>
8761 <li>bar</li>
8762 <li>baz</li></ul>
8763
8764 !! end
8765
8766 !! test
8767 2. Lists with start-of-line-transparent tokens before bullets: Template close
8768 !! wikitext
8769 *foo {{echo|bar
8770 }}*baz
8771 !! html
8772 <ul><li>foo bar</li>
8773 <li>baz</li></ul>
8774
8775 !! end
8776
8777 !! test
8778 List items are not parsed correctly following a <pre> block (bug 785)
8779 !! wikitext
8780 * <pre>foo</pre>
8781 * <pre>bar</pre>
8782 * zar
8783 !! html/php
8784 <ul><li> <pre>foo</pre></li>
8785 <li> <pre>bar</pre></li>
8786 <li> zar</li></ul>
8787
8788 !! html/parsoid
8789 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8790 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8791 <li> zar</li></ul>
8792 !! end
8793
8794 !! test
8795 List items from template
8796 !! wikitext
8797
8798 {{inner list}}
8799 * item 2
8800
8801 * item 0
8802 {{inner list}}
8803 * item 2
8804
8805 * item 0
8806 * notSOL{{inner list}}
8807 * item 2
8808 !! html
8809 <ul><li> item 1</li>
8810 <li> item 2</li></ul>
8811 <ul><li> item 0</li>
8812 <li> item 1</li>
8813 <li> item 2</li></ul>
8814 <ul><li> item 0</li>
8815 <li> notSOL</li>
8816 <li> item 1</li>
8817 <li> item 2</li></ul>
8818
8819 !! end
8820
8821 !! test
8822 List interrupted by empty line or heading
8823 !! wikitext
8824 * foo
8825
8826 ** bar
8827 == A heading ==
8828 * Another list item
8829 !! html
8830 <ul><li> foo</li></ul>
8831 <ul><li><ul><li> bar</li></ul></li></ul>
8832 <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>
8833 <ul><li> Another list item</li></ul>
8834
8835 !!end
8836
8837 !!test
8838 Multiple list tags generated by templates
8839 !! wikitext
8840 {{echo|<li>}}a
8841 {{echo|<li>}}b
8842 {{echo|<li>}}c
8843 !! html
8844 <li>a
8845 <li>b
8846 <li>c</li>
8847 </li>
8848 </li>
8849
8850 !! html+tidy
8851 <ul>
8852 <li>a</li>
8853 <li>b</li>
8854 <li>c</li>
8855 </ul>
8856 !!end
8857
8858 !!test
8859 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8860 !! wikitext
8861 *a
8862 <!--This line will NOT split the list-->
8863 *b
8864 <!--This line will NOT split the list either-->
8865 *c
8866 <!--foo--> <!----> <!--This line NOT split the list either-->
8867 *d
8868 !! html
8869 <ul><li>a</li>
8870 <li>b</li>
8871 <li>c</li>
8872 <li>d</li></ul>
8873
8874 !!end
8875
8876 !!test
8877 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8878 !! wikitext
8879 *a
8880 <!--This line will NOT split the list-->
8881 *b
8882 <!--This line will NOT split the list either-->
8883 *c
8884 <!--foo--> <!----> <!--This line NOT split the list
8885 either-->
8886 *d
8887 !! html
8888 <ul><li>a</li>
8889 <li>b</li>
8890 <li>c</li>
8891 <li>d</li></ul>
8892
8893 !!end
8894
8895 !!test
8896 Test the li-hack
8897 (The PHP parser relies on Tidy for the hack)
8898 !!options
8899 parsoid=wt2html,wt2wt
8900 !! wikitext
8901 * foo
8902 * <li>li-hack
8903 * {{echo|<li>templated li-hack}}
8904 * <!--foo--> <li> unsupported li-hack with preceding comments
8905
8906 <ul>
8907 <li><li>not a li-hack
8908 </li>
8909 </ul>
8910 !! html+tidy
8911 <ul>
8912 <li>foo</li>
8913 <li>li-hack</li>
8914 <li>templated li-hack</li>
8915 <li>unsupported li-hack with preceding comments</li>
8916 </ul>
8917 <ul>
8918 <li>not a li-hack</li>
8919 </ul>
8920 !!end
8921
8922 !! test
8923 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8924 !! options
8925 parsoid
8926 !! wikitext
8927 # foo
8928 ## bar
8929 * foo
8930 ** bar
8931 : foo
8932 :: bar
8933 !! html
8934 <ol>
8935 <li> foo<ol>
8936 <li> bar</li>
8937 </ol></li>
8938 </ol><ul>
8939 <li> foo<ul>
8940 <li> bar</li>
8941 </ul></li>
8942 </ul><dl>
8943 <dd> foo<dl>
8944 <dd> bar</dd>
8945 </dl></dd>
8946 </dl>
8947 !! end
8948
8949 !! test
8950 Parsoid: Test of whitespace serialization with Templated bullets
8951 !! options
8952 parsoid
8953 !! wikitext
8954 * {{bullet}}
8955 !! html
8956 <ul>
8957 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8958 </ul>
8959 !! end
8960
8961 # ------------------------------------------------------------------------
8962 # The next set of tests are about Parsoid's ability to handle badly nested
8963 # tags (parse, minimize scope of fixup, and roundtrip back)
8964 # ------------------------------------------------------------------------
8965
8966 !! test
8967 Unbalanced closing block tags break a list
8968 (php parser relies on Tidy to fix up)
8969 !! wikitext
8970 <div>
8971 *a</div><div>
8972 *b</div>
8973 !! html+tidy
8974 <div>
8975 <ul>
8976 <li>a</li>
8977 </ul>
8978 </div>
8979 <div>
8980 <ul>
8981 <li>b</li>
8982 </ul>
8983 </div>
8984 !! end
8985
8986 # Parsoid fails this test, but it might be tricky to support properly.
8987 # See bug 68395.
8988 !! test
8989 Unbalanced closing non-block tags don't break a list
8990 (php parser relies on Tidy to fix up)
8991 !! wikitext
8992 <span>
8993 *a</span><span>
8994 *b</span>
8995 !! html/php+tidy
8996 <ul>
8997 <li><span>a</span></li>
8998 <li><span>b</span></li>
8999 </ul>
9000 !! html/parsoid
9001 <span>
9002 <ul>
9003 <li>a<span></span>
9004 </li>
9005 <li>b
9006 </li>
9007 </ul>
9008 </span>
9009 !! end
9010
9011 !! test
9012 Unclosed formatting tags that straddle lists are closed and reopened
9013 (php parser relies on Tidy to fix up)
9014 !! options
9015 parsoid=wt2html,wt2wt,html2html
9016 !! wikitext
9017 # <s> a
9018 # b </s>
9019 !! html/php+tidy
9020 <ol>
9021 <li><s>a</s></li>
9022 <li><s>b</s></li>
9023 </ol>
9024 !! html/parsoid
9025 <ol><li> <s> a</s></li>
9026 <li><s> b </s></li></ol>
9027 !! end
9028
9029 # See bug 68395.
9030 !!test
9031 1. List embedded in a formatting tag
9032 !! wikitext
9033 <small>
9034 * foo
9035 </small>
9036 !! html/php+tidy
9037 <ul>
9038 <li><small>foo</small></li>
9039 </ul>
9040 !! html/parsoid
9041 <small>
9042 <ul>
9043 <li> foo</li>
9044 </ul>
9045 </small>
9046 !!end
9047
9048 ## Ugly Parsoid output here
9049 ## Not sure what the right output is.
9050 !!test
9051 2. List embedded in a formatting tag
9052 !! wikitext
9053 <small>
9054 *a
9055 *b</small>
9056 !! html/php+tidy
9057 <ul>
9058 <li><small>a</small></li>
9059 <li><small>b</small></li>
9060 </ul>
9061 !! html/parsoid
9062 <small></small>
9063 <ul><small>
9064 <li>a</li>
9065 </small>
9066 <li><small>b</small></li>
9067 </ul>
9068 !!end
9069
9070 # Ugly Parsoid and PHP parser output here
9071 # Not sure if we want to make this a test!
9072 #
9073 ## !!test
9074 ## 3. Unclosed formatting tags in list elements
9075 ## !! wikitext
9076 ## *<small>a
9077 ## *<small>b
9078 ## !! html/php+tidy
9079 ## <ul>
9080 ## <li><small>a</small></li>
9081 ## <li><small><small>b</small></small></li>
9082 ## </ul>
9083 ## !! html/parsoid
9084 ## <ul>
9085 ## <li><small>a</small></li>
9086 ## <small>
9087 ## <li><small>b</small></li>
9088 ## </small></ul>
9089 ## !!end
9090
9091 # This is a bug in the PHP parser + tidy combination.
9092 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9093 # and then fostered out of the table by tidy.)
9094 # We believe the Parsoid output to be correct.
9095 !! test
9096 Table with missing opening <tr> tag
9097 !! options
9098 parsoid=wt2html,wt2wt
9099 !! wikitext
9100 <table>
9101 <td>foo</td>
9102 </tr>
9103 </table>
9104 !! html+tidy
9105 <table>
9106 <tr>
9107 <td>foo</td>
9108 </tr>
9109 </table>
9110 !! end
9111
9112 ###
9113 ### Magic Words
9114 ###
9115
9116 # Note that the current date is hard-coded as
9117 # 1970-01-01T00:02:03Z (a Thursday)
9118 # when running parser tests. The timezone is also fixed to GMT, so
9119 # local date will be identical to current date.
9120
9121 !! test
9122 Magic Word: {{CURRENTDAY}}
9123 !! wikitext
9124 {{CURRENTDAY}}
9125 !! html
9126 <p>1
9127 </p>
9128 !! end
9129
9130 !! test
9131 Magic Word: {{CURRENTDAY2}}
9132 !! wikitext
9133 {{CURRENTDAY2}}
9134 !! html
9135 <p>01
9136 </p>
9137 !! end
9138
9139 !! test
9140 Magic Word: {{CURRENTDAYNAME}}
9141 !! wikitext
9142 {{CURRENTDAYNAME}}
9143 !! html
9144 <p>Thursday
9145 </p>
9146 !! end
9147
9148 !! test
9149 Magic Word: {{CURRENTDOW}}
9150 !! wikitext
9151 {{CURRENTDOW}}
9152 !! html
9153 <p>4
9154 </p>
9155 !! end
9156
9157 !! test
9158 Magic Word: {{CURRENTMONTH}}
9159 !! wikitext
9160 {{CURRENTMONTH}}
9161 !! html
9162 <p>01
9163 </p>
9164 !! end
9165
9166 !! test
9167 Magic Word: {{CURRENTMONTH1}}
9168 !! wikitext
9169 {{CURRENTMONTH1}}
9170 !! html
9171 <p>1
9172 </p>
9173 !! end
9174
9175 !! test
9176 Magic Word: {{CURRENTMONTHABBREV}}
9177 !! wikitext
9178 {{CURRENTMONTHABBREV}}
9179 !! html
9180 <p>Jan
9181 </p>
9182 !! end
9183
9184 !! test
9185 Magic Word: {{CURRENTMONTHNAME}}
9186 !! wikitext
9187 {{CURRENTMONTHNAME}}
9188 !! html
9189 <p>January
9190 </p>
9191 !! end
9192
9193 !! test
9194 Magic Word: {{CURRENTMONTHNAMEGEN}}
9195 !! wikitext
9196 {{CURRENTMONTHNAMEGEN}}
9197 !! html
9198 <p>January
9199 </p>
9200 !! end
9201
9202 !! test
9203 Magic Word: {{CURRENTTIME}}
9204 !! wikitext
9205 {{CURRENTTIME}}
9206 !! html
9207 <p>00:02
9208 </p>
9209 !! end
9210
9211 !! test
9212 Magic Word: {{CURRENTHOUR}}
9213 !! wikitext
9214 {{CURRENTHOUR}}
9215 !! html
9216 <p>00
9217 </p>
9218 !! end
9219
9220 !! test
9221 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9222 !! wikitext
9223 {{CURRENTWEEK}}
9224 !! html
9225 <p>1
9226 </p>
9227 !! end
9228
9229 !! test
9230 Magic Word: {{CURRENTYEAR}}
9231 !! wikitext
9232 {{CURRENTYEAR}}
9233 !! html
9234 <p>1970
9235 </p>
9236 !! end
9237
9238 !! test
9239 Magic Word: {{CURRENTTIMESTAMP}}
9240 !! wikitext
9241 {{CURRENTTIMESTAMP}}
9242 !! html
9243 <p>19700101000203
9244 </p>
9245 !! end
9246
9247 !! test
9248 Magic Words LOCAL (UTC)
9249 !! wikitext
9250 * {{LOCALMONTH}}
9251 * {{LOCALMONTH1}}
9252 * {{LOCALMONTHNAME}}
9253 * {{LOCALMONTHNAMEGEN}}
9254 * {{LOCALMONTHABBREV}}
9255 * {{LOCALDAY}}
9256 * {{LOCALDAY2}}
9257 * {{LOCALDAYNAME}}
9258 * {{LOCALYEAR}}
9259 * {{LOCALTIME}}
9260 * {{LOCALHOUR}}
9261 * {{LOCALWEEK}}
9262 * {{LOCALDOW}}
9263 * {{LOCALTIMESTAMP}}
9264 !! html
9265 <ul><li> 01</li>
9266 <li> 1</li>
9267 <li> January</li>
9268 <li> January</li>
9269 <li> Jan</li>
9270 <li> 1</li>
9271 <li> 01</li>
9272 <li> Thursday</li>
9273 <li> 1970</li>
9274 <li> 00:02</li>
9275 <li> 00</li>
9276 <li> 1</li>
9277 <li> 4</li>
9278 <li> 19700101000203</li></ul>
9279
9280 !! end
9281
9282 !! test
9283 Magic Word: {{FULLPAGENAME}}
9284 !! options
9285 title=[[User:Ævar Arnfjörð Bjarmason]]
9286 !! wikitext
9287 {{FULLPAGENAME}}
9288 !! html
9289 <p>User:Ævar Arnfjörð Bjarmason
9290 </p>
9291 !! end
9292
9293 !! test
9294 Magic Word: {{FULLPAGENAMEE}}
9295 !! options
9296 title=[[User:Ævar Arnfjörð Bjarmason]]
9297 !! wikitext
9298 {{FULLPAGENAMEE}}
9299 !! html
9300 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9301 </p>
9302 !! end
9303
9304 !! test
9305 Magic Word: {{TALKSPACE}}
9306 !! options
9307 title=[[User:Ævar Arnfjörð Bjarmason]]
9308 !! wikitext
9309 {{TALKSPACE}}
9310 !! html
9311 <p>User talk
9312 </p>
9313 !! end
9314
9315 !! test
9316 Magic Word: {{TALKSPACE}}, same namespace
9317 !! options
9318 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9319 !! wikitext
9320 {{TALKSPACE}}
9321 !! html
9322 <p>User talk
9323 </p>
9324 !! end
9325
9326 !! test
9327 Magic Word: {{TALKSPACE}}, main namespace
9328 !! options
9329 title=[[Parser Test]]
9330 !! wikitext
9331 {{TALKSPACE}}
9332 !! html
9333 <p>Talk
9334 </p>
9335 !! end
9336
9337 !! test
9338 Magic Word: {{TALKSPACEE}}
9339 !! options
9340 title=[[User:Ævar Arnfjörð Bjarmason]]
9341 !! wikitext
9342 {{TALKSPACEE}}
9343 !! html
9344 <p>User_talk
9345 </p>
9346 !! end
9347
9348 !! test
9349 Magic Word: {{SUBJECTSPACE}}
9350 !! options
9351 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9352 !! wikitext
9353 {{SUBJECTSPACE}}
9354 !! html
9355 <p>User
9356 </p>
9357 !! end
9358
9359 !! test
9360 Magic Word: {{SUBJECTSPACE}}, same namespace
9361 !! options
9362 title=[[User:Ævar Arnfjörð Bjarmason]]
9363 !! wikitext
9364 {{SUBJECTSPACE}}
9365 !! html
9366 <p>User
9367 </p>
9368 !! end
9369
9370 !! test
9371 Magic Word: {{SUBJECTSPACE}}, main namespace
9372 !! options
9373 title=[[Parser Test]]
9374 !! wikitext
9375 {{SUBJECTSPACE}}
9376 !! html
9377
9378 !! end
9379
9380 !! test
9381 Magic Word: {{SUBJECTSPACEE}}
9382 !! options
9383 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9384 !! wikitext
9385 {{SUBJECTSPACEE}}
9386 !! html
9387 <p>User
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{NAMESPACE}}
9393 !! options
9394 title=[[User:Ævar Arnfjörð Bjarmason]]
9395 !! wikitext
9396 {{NAMESPACE}}
9397 !! html
9398 <p>User
9399 </p>
9400 !! end
9401
9402 !! test
9403 Magic Word: {{NAMESPACEE}}
9404 !! options
9405 title=[[User:Ævar Arnfjörð Bjarmason]]
9406 !! wikitext
9407 {{NAMESPACEE}}
9408 !! html
9409 <p>User
9410 </p>
9411 !! end
9412
9413 !! test
9414 Magic Word: {{NAMESPACENUMBER}}
9415 !! options
9416 title=[[User:Ævar Arnfjörð Bjarmason]]
9417 !! wikitext
9418 {{NAMESPACENUMBER}}
9419 !! html
9420 <p>2
9421 </p>
9422 !! end
9423
9424 !! test
9425 Magic Word: {{SUBPAGENAME}}
9426 !! options
9427 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9428 !! wikitext
9429 {{SUBPAGENAME}}
9430 !! html
9431 <p>sub ö
9432 </p>
9433 !! end
9434
9435 !! test
9436 Magic Word: {{SUBPAGENAMEE}}
9437 !! options
9438 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9439 !! wikitext
9440 {{SUBPAGENAMEE}}
9441 !! html
9442 <p>sub_%C3%B6
9443 </p>
9444 !! end
9445
9446 !! test
9447 Magic Word: {{ROOTPAGENAME}}
9448 !! options
9449 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9450 !! wikitext
9451 {{ROOTPAGENAME}}
9452 !! html
9453 <p>Ævar Arnfjörð Bjarmason
9454 </p>
9455 !! end
9456
9457 !! test
9458 Magic Word: {{ROOTPAGENAMEE}}
9459 !! options
9460 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9461 !! wikitext
9462 {{ROOTPAGENAMEE}}
9463 !! html
9464 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9465 </p>
9466 !! end
9467
9468 !! test
9469 Magic Word: {{BASEPAGENAME}}
9470 !! options
9471 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9472 !! wikitext
9473 {{BASEPAGENAME}}
9474 !! html
9475 <p>Ævar Arnfjörð Bjarmason
9476 </p>
9477 !! end
9478
9479 !! test
9480 Magic Word: {{BASEPAGENAMEE}}
9481 !! options
9482 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9483 !! wikitext
9484 {{BASEPAGENAMEE}}
9485 !! html
9486 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9487 </p>
9488 !! end
9489
9490 !! test
9491 Magic Word: {{TALKPAGENAME}}
9492 !! options
9493 title=[[User:Ævar Arnfjörð Bjarmason]]
9494 !! wikitext
9495 {{TALKPAGENAME}}
9496 !! html
9497 <p>User talk:Ævar Arnfjörð Bjarmason
9498 </p>
9499 !! end
9500
9501 !! test
9502 Magic Word: {{TALKPAGENAMEE}}
9503 !! options
9504 title=[[User:Ævar Arnfjörð Bjarmason]]
9505 !! wikitext
9506 {{TALKPAGENAMEE}}
9507 !! html
9508 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9509 </p>
9510 !! end
9511
9512 !! test
9513 Magic Word: {{SUBJECTPAGENAME}}
9514 !! options
9515 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9516 !! wikitext
9517 {{SUBJECTPAGENAME}}
9518 !! html
9519 <p>User:Ævar Arnfjörð Bjarmason
9520 </p>
9521 !! end
9522
9523 !! test
9524 Magic Word: {{SUBJECTPAGENAMEE}}
9525 !! options
9526 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9527 !! wikitext
9528 {{SUBJECTPAGENAMEE}}
9529 !! html
9530 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9531 </p>
9532 !! end
9533
9534 !! test
9535 Magic Word: {{NUMBEROFFILES}}
9536 !! wikitext
9537 {{NUMBEROFFILES}}
9538 !! html
9539 <p>5
9540 </p>
9541 !! end
9542
9543 !! test
9544 Magic Word: {{PAGENAME}}
9545 !! options
9546 title=[[User:Ævar Arnfjörð Bjarmason]]
9547 !! wikitext
9548 {{PAGENAME}}
9549 !! html
9550 <p>Ævar Arnfjörð Bjarmason
9551 </p>
9552 !! end
9553
9554 !! test
9555 Magic Word: {{PAGENAME}} with metacharacters
9556 !! options
9557 title=[['foo & bar = baz']]
9558 !! wikitext
9559 ''{{PAGENAME}}''
9560 !! html/php
9561 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9562 </p>
9563 !! html+tidy
9564 <p><i>'foo &amp; bar = baz'</i></p>
9565 !! end
9566
9567 !! test
9568 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9569 !! options
9570 title=[[*RFC 1234 http://example.com/]]
9571 !! wikitext
9572 {{PAGENAME}}
9573 !! html/php
9574 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9575 </p>
9576 !! html+tidy
9577 <p>*RFC 1234 http://example.com/</p>
9578 !! end
9579
9580 !! test
9581 Magic Word: {{PAGENAMEE}}
9582 !! options
9583 title=[[User:Ævar Arnfjörð Bjarmason]]
9584 !! wikitext
9585 {{PAGENAMEE}}
9586 !! html
9587 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9588 </p>
9589 !! end
9590
9591 !! test
9592 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9593 !! options
9594 title=[[*RFC 1234 http://example.com/]]
9595 !! wikitext
9596 {{PAGENAMEE}}
9597 !! html/php
9598 <p>&#42;RFC_1234_http&#58;//example.com/
9599 </p>
9600 !! html+tidy
9601 <p>*RFC_1234_http://example.com/</p>
9602 !! end
9603
9604 !! test
9605 Magic Word: {{REVISIONID}}
9606 !! wikitext
9607 {{REVISIONID}}
9608 !! html
9609 <p>1337
9610 </p>
9611 !! end
9612
9613 !! test
9614 Magic Word: {{SCRIPTPATH}}
9615 !! wikitext
9616 {{SCRIPTPATH}}
9617 !! html
9618 <p>/
9619 </p>
9620 !! end
9621
9622 !! test
9623 Magic Word: {{STYLEPATH}}
9624 !! wikitext
9625 {{STYLEPATH}}
9626 !! html
9627 <p>/skins
9628 </p>
9629 !! end
9630
9631 !! test
9632 Magic Word: {{SERVER}}
9633 !! wikitext
9634 {{SERVER}}
9635 !! html
9636 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9637 </p>
9638 !! end
9639
9640 !! test
9641 Magic Word: {{SERVERNAME}}
9642 !! wikitext
9643 {{SERVERNAME}}
9644 !! html
9645 <p>example.org
9646 </p>
9647 !! end
9648
9649 !! test
9650 Magic Word: {{SITENAME}}
9651 !! wikitext
9652 {{SITENAME}}
9653 !! html
9654 <p>MediaWiki
9655 </p>
9656 !! end
9657
9658 !! test
9659 Case-sensitive magic words, when cased differently, should just be template transclusions
9660 !! wikitext
9661 {{CurrentMonth}}
9662 {{currentday}}
9663 {{cURreNTweEK}}
9664 {{currentHour}}
9665 !! html
9666 <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>
9667 <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>
9668 <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>
9669 <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>
9670 </p>
9671 !! end
9672
9673 !! test
9674 Case-insensitive magic words should still work with weird casing.
9675 !! wikitext
9676 {{sErVeRNaMe}}
9677 {{LCFirst:AOEU}}
9678 {{ucFIRST:aoeu}}
9679 {{SERver}}
9680 !! html
9681 <p>example.org
9682 aOEU
9683 Aoeu
9684 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9685 </p>
9686 !! end
9687
9688 # From plwiki:PLOS_ONE
9689 !! test
9690 Parsoid: Page property magic word with magic word contents
9691 !! wikitext
9692 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9693 !! html/parsoid
9694 <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>"}]]}'/>
9695 !! end
9696
9697 !! test
9698 Parsoid: Template-generated DISPLAYTITLE
9699 !! wikitext
9700 {{{{echo|DISPLAYTITLE}}:Foo}}
9701 !! html/parsoid
9702 <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}}]}'/>
9703 !! end
9704
9705 !! test
9706 Namespace 1 {{ns:1}}
9707 !! wikitext
9708 {{ns:1}}
9709 !! html
9710 <p>Talk
9711 </p>
9712 !! end
9713
9714 !! test
9715 Namespace 1 {{ns:01}}
9716 !! wikitext
9717 {{ns:01}}
9718 !! html
9719 <p>Talk
9720 </p>
9721 !! end
9722
9723 !! test
9724 Namespace 0 {{ns:0}} (bug 4783)
9725 !! wikitext
9726 {{ns:0}}
9727 !! html
9728
9729 !! end
9730
9731 !! test
9732 Namespace 0 {{ns:00}} (bug 4783)
9733 !! wikitext
9734 {{ns:00}}
9735 !! html
9736
9737 !! end
9738
9739 !! test
9740 Namespace -1 {{ns:-1}}
9741 !! wikitext
9742 {{ns:-1}}
9743 !! html
9744 <p>Special
9745 </p>
9746 !! end
9747
9748 !! test
9749 Namespace User {{ns:User}}
9750 !! wikitext
9751 {{ns:User}}
9752 !! html
9753 <p>User
9754 </p>
9755 !! end
9756
9757 !! test
9758 Namespace User talk {{ns:User_talk}}
9759 !! wikitext
9760 {{ns:User_talk}}
9761 !! html
9762 <p>User talk
9763 </p>
9764 !! end
9765
9766 !! test
9767 Namespace User talk {{ns:uSeR tAlK}}
9768 !! wikitext
9769 {{ns:uSeR tAlK}}
9770 !! html
9771 <p>User talk
9772 </p>
9773 !! end
9774
9775 !! test
9776 Namespace File {{ns:File}}
9777 !! wikitext
9778 {{ns:File}}
9779 !! html
9780 <p>File
9781 </p>
9782 !! end
9783
9784 !! test
9785 Namespace File {{ns:Image}}
9786 !! wikitext
9787 {{ns:Image}}
9788 !! html
9789 <p>File
9790 </p>
9791 !! end
9792
9793 !! test
9794 Namespace (lang=de) Benutzer {{ns:User}}
9795 !! options
9796 language=de
9797 !! wikitext
9798 {{ns:User}}
9799 !! html
9800 <p>Benutzer
9801 </p>
9802 !! end
9803
9804 !! test
9805 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9806 !! options
9807 language=de
9808 !! wikitext
9809 {{ns:3}}
9810 !! html
9811 <p>Benutzer Diskussion
9812 </p>
9813 !! end
9814
9815
9816 !! test
9817 Urlencode
9818 !! wikitext
9819 {{urlencode:hi world?!}}
9820 {{urlencode:hi world?!|WIKI}}
9821 {{urlencode:hi world?!|PATH}}
9822 {{urlencode:hi world?!|QUERY}}
9823 !! html
9824 <p>hi+world%3F%21
9825 hi_world%3F!
9826 hi%20world%3F%21
9827 hi+world%3F%21
9828 </p>
9829 !! end
9830
9831 !! test
9832 Magic Word: prioritize type info over data-parsoid
9833 !! options
9834 parsoid=html2wt
9835 !! html/parsoid
9836 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9837 !! wikitext
9838 __FORCETOC__
9839 !! end
9840
9841 !! test
9842 Magic Word: serialize on separate line (parsoid)
9843 !! options
9844 parsoid=wt2wt,html2wt
9845 !! wikitext
9846 foo
9847 __NOTOC__
9848 bar
9849 !! html/parsoid
9850 foo<meta property="mw:PageProp/notoc"/>bar
9851 !! end
9852
9853 !! test
9854 Magic Word: rt non-english wikis
9855 !! options
9856 parsoid=wt2wt
9857 language=de
9858 !! wikitext
9859 __NOEDITSECTION__
9860 !! html/parsoid
9861 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9862 !! end
9863
9864 !!test
9865 __proto__ is treated as normal wikitext (T105997)
9866 !!wikitext
9867 __proto__
9868 !!html
9869 <p>__proto__
9870 </p>
9871 !!end
9872
9873 ###
9874 ### Magic links
9875 ###
9876 !! test
9877 Magic links: internal link to RFC (bug 479)
9878 !! wikitext
9879 [[RFC 123]]
9880 !! html
9881 <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>
9882 </p>
9883 !! end
9884
9885 !! test
9886 Magic links: RFC (bug 479)
9887 !! wikitext
9888 RFC 822
9889 !! html
9890 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9891 </p>
9892 !! end
9893
9894 !! test
9895 Magic links: RFC (bug 65278)
9896 !! wikitext
9897 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9898 !! html
9899 <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.
9900 </p>
9901 !! end
9902
9903 !! test
9904 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9905 !! wikitext
9906 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9907 RFC
9908 822
9909 !! html
9910 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9911 RFC
9912 822
9913 </p>
9914 !! end
9915
9916 !! test
9917 Magic links: ISBN (bug 1937)
9918 !! wikitext
9919 ISBN 0-306-40615-2
9920 !! html
9921 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9922 </p>
9923 !! end
9924
9925 !! test
9926 Magic links: ISBN (bug 65278)
9927 !! wikitext
9928 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9929 !! html/php
9930 <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.
9931 </p>
9932 !! html/parsoid
9933 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9934 !! end
9935
9936 !! test
9937 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9938 !! wikitext
9939 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9940 ISBN
9941 9780316098113
9942 ISBN 978
9943 0316098113
9944 !! html
9945 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9946 ISBN
9947 9780316098113
9948 ISBN 978
9949 0316098113
9950 </p>
9951 !! end
9952
9953 !! test
9954 Magic links: PMID incorrectly converts space to underscore
9955 !! wikitext
9956 PMID 1234
9957 !! html
9958 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9959 </p>
9960 !! end
9961
9962 !! test
9963 Magic links: PMID (bug 65278)
9964 !! wikitext
9965 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9966 !! html
9967 <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.
9968 </p>
9969 !! end
9970
9971 !! test
9972 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9973 !! wikitext
9974 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9975 PMID
9976 1234
9977 !! html
9978 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9979 PMID
9980 1234
9981 </p>
9982 !! end
9983
9984 ###
9985 ### Templates
9986 ####
9987
9988 !! test
9989 Nonexistent template
9990 !! wikitext
9991 {{thistemplatedoesnotexist}}
9992 !! html
9993 <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>
9994 </p>
9995 !! end
9996
9997 !! test
9998 Template with invalid target containing tags
9999 !! wikitext
10000 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10001 !! html
10002 <p>{{a<b>b</b>|foo|a=b|a = b}}
10003 </p>
10004 !! end
10005
10006 !! test
10007 Template with invalid target containing unclosed tag
10008 !! wikitext
10009 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10010 !! html
10011 <p>{{a<b>|foo|a=b|a = b}}</b>
10012 </p>
10013 !! end
10014
10015 !! test
10016 Template with invalid target containing wikilink
10017 !! wikitext
10018 {{[[Main Page]]}}
10019 !! html/php
10020 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10021 </p>
10022 !! html/parsoid
10023 <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>
10024 !! end
10025
10026 !! test
10027 Template with just whitespace in it, bug #68421
10028 !! wikitext
10029 {{echo|{{ }}}}
10030 !! html/parsoid
10031 <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>
10032 !! end
10033
10034 !! article
10035 Template:test
10036 !! text
10037 This is a test template
10038 !! endarticle
10039
10040 !! test
10041 Simple template
10042 !! wikitext
10043 {{test}}
10044 !! html
10045 <p>This is a test template
10046 </p>
10047 !! end
10048
10049 !! test
10050 Template with explicit namespace
10051 !! wikitext
10052 {{Template:test}}
10053 !! html
10054 <p>This is a test template
10055 </p>
10056 !! end
10057
10058
10059 !! article
10060 Template:paramtest
10061 !! text
10062 This is a test template with parameter {{{param}}}
10063 !! endarticle
10064
10065 !! test
10066 Template parameter
10067 !! wikitext
10068 {{paramtest|param=foo}}
10069 !! html
10070 <p>This is a test template with parameter foo
10071 </p>
10072 !! end
10073
10074 !! article
10075 Template:paramtestnum
10076 !! text
10077 [[{{{1}}}|{{{2}}}]]
10078 !! endarticle
10079
10080 !! test
10081 Template unnamed parameter
10082 !! wikitext
10083 {{paramtestnum|Main Page|the main page}}
10084 !! html
10085 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10086 </p>
10087 !! end
10088
10089 !! article
10090 Template:templatesimple
10091 !! text
10092 (test)
10093 !! endarticle
10094
10095 !! article
10096 Template:templateredirect
10097 !! text
10098 #redirect [[Template:templatesimple]]
10099 !! endarticle
10100
10101 !! article
10102 Template:templateasargtestnum
10103 !! text
10104 {{{{{1}}}}}
10105 !! endarticle
10106
10107 !! article
10108 Template:templateasargtest
10109 !! text
10110 {{template{{{templ}}}}}
10111 !! endarticle
10112
10113 !! article
10114 Template:templateasargtest2
10115 !! text
10116 {{{{{templ}}}}}
10117 !! endarticle
10118
10119 !! test
10120 Template with template name as unnamed argument
10121 !! wikitext
10122 {{templateasargtestnum|templatesimple}}
10123 !! html
10124 <p>(test)
10125 </p>
10126 !! end
10127
10128 !! test
10129 Template with template name as argument
10130 !! wikitext
10131 {{templateasargtest|templ=simple}}
10132 !! html
10133 <p>(test)
10134 </p>
10135 !! end
10136
10137 !! test
10138 Template with template name as argument (2)
10139 !! wikitext
10140 {{templateasargtest2|templ=templatesimple}}
10141 !! html
10142 <p>(test)
10143 </p>
10144 !! end
10145
10146 !! article
10147 Template:templateasargtestdefault
10148 !! text
10149 {{{{{templ|templatesimple}}}}}
10150 !! endarticle
10151
10152 !! article
10153 Template:templa
10154 !! text
10155 '''templ'''
10156 !! endarticle
10157
10158 !! test
10159 Template with default value
10160 !! wikitext
10161 {{templateasargtestdefault}}
10162 !! html
10163 <p>(test)
10164 </p>
10165 !! end
10166
10167 !! test
10168 Template with default value (value set)
10169 !! wikitext
10170 {{templateasargtestdefault|templ=templa}}
10171 !! html
10172 <p><b>templ</b>
10173 </p>
10174 !! end
10175
10176 !! test
10177 Template redirect
10178 !! wikitext
10179 {{templateredirect}}
10180 !! html/php
10181 <p>(test)
10182 </p>
10183 !! html/parsoid
10184 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10185 !! end
10186
10187 !! test
10188 Template with argument in separate line
10189 !! wikitext
10190 {{ templateasargtest |
10191 templ = simple }}
10192 !! html
10193 <p>(test)
10194 </p>
10195 !! end
10196
10197 !! test
10198 Template with complex template as argument
10199 !! wikitext
10200 {{paramtest|
10201 param ={{ templateasargtest |
10202 templ = simple }}}}
10203 !! html
10204 <p>This is a test template with parameter (test)
10205 </p>
10206 !! end
10207
10208 !! test
10209 Template with thumb image (with link in description)
10210 !! wikitext
10211 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10212 !! html/php
10213 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>
10214
10215 !! html+tidy
10216 <p>This is a test template with parameter</p>
10217 <div class="thumb tright">
10218 <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>
10219 <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>
10220 </div>
10221 </div>
10222 !! html/parsoid
10223 <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>
10224 !! end
10225
10226 !! article
10227 Template:complextemplate
10228 !! text
10229 {{{1}}} {{paramtest|
10230 param ={{{param}}}}}
10231 !! endarticle
10232
10233 !! test
10234 Template with complex arguments
10235 !! wikitext
10236 {{complextemplate|
10237 param ={{ templateasargtest |
10238 templ = simple }}|[[Template:complextemplate|link]]}}
10239 !! html
10240 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10241 </p>
10242 !! end
10243
10244 !! test
10245 BUG 553: link with two variables in a piped link
10246 !! wikitext
10247 {|
10248 |[[{{{1}}}|{{{2}}}]]
10249 |}
10250 !! html
10251 <table>
10252 <tr>
10253 <td>[[{{{1}}}|{{{2}}}]]
10254 </td></tr></table>
10255
10256 !! end
10257
10258 !! test
10259 Magic variable as template parameter
10260 !! wikitext
10261 {{paramtest|param={{SITENAME}}}}
10262 !! html
10263 <p>This is a test template with parameter MediaWiki
10264 </p>
10265 !! end
10266
10267 !! article
10268 Template:linktest
10269 !! text
10270 [[{{{param}}}|link]]
10271 !! endarticle
10272
10273 !! test
10274 Template parameter as link source
10275 !! wikitext
10276 {{linktest|param=Main Page}}
10277 !! html
10278 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10279 </p>
10280 !! end
10281
10282 !!article
10283 Template:paramtest2
10284 !! text
10285 including another template, {{paramtest|param={{{arg}}}}}
10286 !! endarticle
10287
10288 !! test
10289 Template passing argument to another template
10290 !! wikitext
10291 {{paramtest2|arg='hmm'}}
10292 !! html
10293 <p>including another template, This is a test template with parameter 'hmm'
10294 </p>
10295 !! end
10296
10297 !! article
10298 Template:Linktest2
10299 !! text
10300 Main Page
10301 !! endarticle
10302
10303 !! test
10304 Template as link source
10305 !! wikitext
10306 [[{{linktest2}}]]
10307
10308 [[{{linktest2}}|Main Page]]
10309
10310 [[{{linktest2}}]]Page
10311 !! html
10312 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10313 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10314 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10315 </p>
10316 !! end
10317
10318
10319 !! article
10320 Template:loop1
10321 !! text
10322 {{loop2}}
10323 !! endarticle
10324
10325 !! article
10326 Template:loop2
10327 !! text
10328 {{loop1}}
10329 !! endarticle
10330
10331 !! test
10332 Template infinite loop
10333 !! wikitext
10334 {{loop1}}
10335 !! html
10336 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10337 </p>
10338 !! end
10339
10340 !! test
10341 Template from main namespace
10342 !! wikitext
10343 {{:Main Page}}
10344 !! html
10345 <p>blah blah
10346 </p>
10347 !! end
10348
10349 !! article
10350 Template:table
10351 !! text
10352 {|
10353 | 1 || 2
10354 |-
10355 | 3 || 4
10356 |}
10357 !! endarticle
10358
10359 !! test
10360 BUG 529: Template with table, not included at beginning of line
10361 !! wikitext
10362 foo {{table}}
10363 !! html
10364 <p>foo
10365 </p>
10366 <table>
10367 <tr>
10368 <td> 1 </td>
10369 <td> 2
10370 </td></tr>
10371 <tr>
10372 <td> 3 </td>
10373 <td> 4
10374 </td></tr></table>
10375
10376 !! end
10377
10378 !! test
10379 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10380 !! wikitext
10381 foo
10382 {{table}}
10383 !! html
10384 <p>foo
10385 </p>
10386 <table>
10387 <tr>
10388 <td> 1 </td>
10389 <td> 2
10390 </td></tr>
10391 <tr>
10392 <td> 3 </td>
10393 <td> 4
10394 </td></tr></table>
10395
10396 !! end
10397
10398 !! test
10399 BUG 41: Template parameters shown as broken links
10400 !! wikitext
10401 {{{parameter}}}
10402 !! html
10403 <p>{{{parameter}}}
10404 </p>
10405 !! end
10406
10407 !! test
10408 Template with targets containing wikilinks
10409 !! wikitext
10410 {{[[foo]]}}
10411
10412 {{[[{{echo|foo}}]]}}
10413
10414 {{{{echo|[[foo}}]]}}
10415 !! html
10416 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10417 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10418 </p><p>{{[[foo}}]]
10419 </p>
10420 !! end
10421
10422 !! article
10423 Template:''
10424 !! text
10425 bar
10426 !! endarticle
10427
10428 !! test
10429 Templates: Double quotes as template target
10430 !! wikitext
10431 foo {{''}} baz
10432 !! html/php
10433 <p>foo bar baz
10434 </p>
10435 !! html/parsoid
10436 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10437 </p>
10438 !! end
10439
10440 !! article
10441 Template:MSGNW test
10442 !! text
10443 ''None'' of '''this''' should be
10444 * interpreted
10445 but rather passed unmodified
10446 {{test}}
10447 <gallery>
10448 File:Foobar.jpg
10449 </gallery>
10450 <!-- comment -->
10451 !! endarticle
10452
10453 # hmm, fix this or just deprecate msgnw and document its behavior?
10454 !! test
10455 msgnw keyword
10456 !! wikitext
10457 {{msgnw:MSGNW test}}
10458 !! html/php
10459 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10460 &#42; interpreted
10461 &#32;but rather passed unmodified
10462 &#123;&#123;test&#125;&#125;
10463 &#60;gallery&#62;
10464 File:Foobar.jpg
10465 &#60;/gallery&#62;
10466 &#60;!-- comment --&#62;
10467 </p>
10468 !! end
10469
10470 !! test
10471 int keyword
10472 !! wikitext
10473 {{int:youhavenewmessages|lots of money|not!}}
10474 !! html
10475 <p>You have lots of money (not!).
10476 </p>
10477 !! end
10478
10479 !! test
10480 int keyword - non-existing message
10481 !! wikitext
10482 {{int:var}}
10483 !! html
10484 <p>&lt;var&gt;
10485 </p>
10486 !! end
10487
10488 !! article
10489 Template:Includes
10490 !! text
10491 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10492 !! endarticle
10493
10494 !! test
10495 <includeonly> and <noinclude> being included
10496 !! wikitext
10497 {{Includes}}
10498 !! html
10499 <p>Foobar
10500 </p>
10501 !! end
10502
10503 !! article
10504 Template:Includes2
10505 !! text
10506 <onlyinclude>Foo</onlyinclude>bar
10507 !! endarticle
10508
10509 !! test
10510 <onlyinclude> being included
10511 !! wikitext
10512 {{Includes2}}
10513 !! html
10514 <p>Foo
10515 </p>
10516 !! end
10517
10518
10519 !! article
10520 Template:Includes3
10521 !! text
10522 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10523 !! endarticle
10524
10525 !! test
10526 <onlyinclude> and <includeonly> being included
10527 !! wikitext
10528 {{Includes3}}
10529 !! html
10530 <p>Foo
10531 </p>
10532 !! end
10533
10534 !! test
10535 <includeonly> and <noinclude> on a page
10536 !! wikitext
10537 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10538 !! html
10539 <p>Foozar
10540 </p>
10541 !! end
10542
10543 !! test
10544 Un-closed <noinclude>
10545 !! wikitext
10546 <noinclude>
10547 !! html
10548 !! end
10549
10550 !! test
10551 <onlyinclude> on a page
10552 !! wikitext
10553 <onlyinclude>Foo</onlyinclude>bar
10554 !! html
10555 <p>Foobar
10556 </p>
10557 !! end
10558
10559 !! test
10560 Un-closed <onlyinclude>
10561 !! wikitext
10562 <onlyinclude>
10563 !! html
10564 !! end
10565
10566 !!test
10567 Self-closed noinclude, includeonly, onlyinclude tags
10568 !! wikitext
10569 <noinclude />
10570 <includeonly />
10571 <onlyinclude />
10572 !! html
10573 <p><br />
10574 </p>
10575 !!end
10576
10577 !!test
10578 Unbalanced includeonly and noinclude tags
10579 !! wikitext
10580 {|
10581 |a</noinclude>
10582 |b</noinclude></noinclude>
10583 |c</noinclude></includeonly>
10584 |d</includeonly></includeonly>
10585 |}
10586 !! html
10587 <table>
10588 <tr>
10589 <td>a
10590 </td>
10591 <td>b
10592 </td>
10593 <td>c&lt;/includeonly&gt;
10594 </td>
10595 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10596 </td></tr></table>
10597
10598 !!end
10599
10600 !! article
10601 Template:Includeonly section
10602 !! text
10603 <includeonly>
10604 ==Includeonly section==
10605 </includeonly>
10606 ==Section T-1==
10607 !!endarticle
10608
10609 !! test
10610 Bug 6563: Edit link generation for section shown by <includeonly>
10611 !! wikitext
10612 {{includeonly section}}
10613 !! html
10614 <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>
10615 <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>
10616
10617 !! end
10618
10619 # Uses same input as the contents of [[Template:Includeonly section]]
10620 !! test
10621 Bug 6563: Section extraction for section shown by <includeonly>
10622 !! options
10623 section=T-2
10624 !! wikitext
10625 <includeonly>
10626 ==Includeonly section==
10627 </includeonly>
10628 ==Section T-2==
10629 !! html
10630 ==Section T-2==
10631 !! end
10632
10633 !! test
10634 Bug 6563: Edit link generation for section suppressed by <includeonly>
10635 !! wikitext
10636 <includeonly>
10637 ==Includeonly section==
10638 </includeonly>
10639 ==Section 1==
10640 !! html
10641 <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>
10642
10643 !! end
10644
10645 !! test
10646 Bug 6563: Section extraction for section suppressed by <includeonly>
10647 !! options
10648 section=1
10649 !! wikitext
10650 <includeonly>
10651 ==Includeonly section==
10652 </includeonly>
10653 ==Section 1==
10654 !! html
10655 ==Section 1==
10656 !! end
10657
10658 !! test
10659 Un-closed <includeonly>
10660 !! wikitext
10661 <includeonly>
10662 !! html
10663 !! end
10664
10665 !! test
10666 Includes and comments at SOL
10667 !! wikitext
10668 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10669
10670 <noinclude>
10671 some
10672 </noinclude>* stuff
10673 * here
10674
10675 <includeonly>can have stuff</includeonly>=== here ===
10676
10677 !! html/php
10678 <h2><span class="mw-headline" id="hu">hu</span></h2>
10679 <p>some
10680 </p>
10681 <ul><li> stuff</li>
10682 <li> here</li></ul>
10683 <h3><span class="mw-headline" id="here">here</span></h3>
10684
10685 !! html/parsoid
10686 <!-- 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>
10687
10688 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10689 <p>some</p>
10690 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10691 <li> here</li></ul>
10692
10693 <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>
10694
10695 !! end
10696
10697 # TODO: test with DOM fragment reuse!
10698 !! test
10699 Parsoid: DOM fragment reuse
10700 !! options
10701 parsoid=wt2wt,wt2html
10702 !! wikitext
10703 a{{echo|b<table></table>c}}d
10704
10705 a{{echo|b
10706 <table></table>
10707 c}}d
10708
10709 {{echo|a
10710
10711 <table></table>
10712
10713 b}}
10714 !! html
10715 <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>
10716
10717 <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">
10718 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10719 </span><p about="#mwt2">cd</p>
10720
10721 <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">
10722
10723 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10724
10725 </span><p about="#mwt3">b</p>
10726 !! end
10727
10728 !! test
10729 Parsoid: Merge double tds (T52603)
10730 !! options
10731 parsoid
10732 !! wikitext
10733 {|
10734 |{{echo|{{!}} foo}}
10735 |}
10736 !! html
10737 <table><tbody>
10738 <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>
10739 </tbody></table>
10740 !! end
10741
10742 !! test
10743 Parsoid: Merge double tds in nested transclusion content (T52603)
10744 !! options
10745 parsoid
10746 !! wikitext
10747 {{echo|<div>}}
10748 {|
10749 |{{echo|{{!}} foo}}
10750 |}
10751 {{echo|</div>}}
10752 !! html
10753 <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}}]}'>
10754 <table><tbody>
10755 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10756 </tbody></table>
10757 </div>
10758 !! end
10759
10760 ###
10761 ### <includeonly> and <noinclude> in attributes
10762 ###
10763 !!test
10764 0. includeonly around the entire attribute
10765 !! wikitext
10766 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10767 !! html
10768 <p><span id="v2">bar</span>
10769 </p>
10770 !!end
10771
10772 !!test
10773 1. includeonly in html attr key
10774 !! wikitext
10775 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10776 !! html
10777 <p><span id="foo">bar</span>
10778 </p>
10779 !!end
10780
10781 !!test
10782 2. includeonly in html attr value
10783 !! wikitext
10784 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10785 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10786 !! html
10787 <p><span id="v1">bar</span>
10788 <span id="v1">bar</span>
10789 </p>
10790 !!end
10791
10792 !!test
10793 3. includeonly in part of an attr value
10794 !! wikitext
10795 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10796 !! html
10797 <p><span style="color:red;">bar</span>
10798 </p>
10799 !!end
10800
10801 !!test
10802 4. includeonly in table attributes
10803 !! wikitext
10804 {|
10805 |- <noinclude>
10806 |-
10807 |a
10808 </noinclude>
10809 |- <includeonly>
10810 |-
10811 |b
10812 </includeonly>
10813 |}
10814 !! html
10815 <table>
10816
10817
10818 <tr>
10819 <td>a
10820 </td></tr>
10821 </table>
10822
10823 !!end
10824
10825 ###
10826 ### Token Stream Patcher tests
10827 ###
10828 ### These tests won't always pass wt2wt and other modes because
10829 ### on serialization, the table will be output on a new line.
10830 ### For now, we are blacklisting them, and using this to test selser.
10831 ###
10832
10833 !!test
10834 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10835 !!options
10836 parsoid=wt2html,wt2wt
10837 !!wikitext
10838 {{echo|}}{| width = '100%'
10839 |foo
10840 |}
10841 !!html/parsoid
10842 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10843 <tbody><tr><td>foo</td></tr>
10844 </tbody></table>
10845 !!end
10846
10847 !!test
10848 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10849 !!options
10850 parsoid=wt2html,wt2wt
10851 !!wikitext
10852 <includeonly>a</includeonly>{| {{{b}}}
10853 |c
10854 |}
10855 !!html/parsoid
10856 <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}}}":""}}'>
10857 <tbody><tr><td>c</td></tr>
10858 </tbody></table>
10859
10860 !!end
10861
10862 ###
10863 ### Testing parsing of templates where a template arg
10864 ### has the same name as the template itself.
10865 ###
10866
10867 !! article
10868 Template:quote
10869 !! text
10870 {{{quote|{{{1}}}}}}
10871 !! endarticle
10872
10873 !!test
10874 Templates: Template Name/Arg clash: 1. Use of positional param
10875 !! wikitext
10876 {{quote|foo}}
10877 !! html
10878 <p>foo
10879 </p>
10880 !!end
10881
10882 !!test
10883 Templates: Template Name/Arg clash: 2. Use of named param
10884 !! wikitext
10885 {{quote|quote=foo}}
10886 !! html
10887 <p>foo
10888 </p>
10889 !!end
10890
10891 !!test
10892 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10893 !! wikitext
10894 {{quote|quote}}
10895 !! html
10896 <p>quote
10897 </p>
10898 !!end
10899
10900 ###
10901 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10902 ###
10903
10904 !!test
10905 Templates: 1. Simple use
10906 !! wikitext
10907 {{echo|Foo}}
10908 !! html
10909 <p>Foo
10910 </p>
10911 !!end
10912
10913 !!test
10914 Templates: 2. Inside a block tag
10915 !! wikitext
10916 <div>{{echo|Foo}}</div>
10917 <blockquote>{{echo|Foo}}</blockquote>
10918 !! html
10919 <div>Foo</div>
10920 <blockquote>Foo</blockquote>
10921
10922 !! html+tidy
10923 <div>Foo</div>
10924 <blockquote>
10925 <p>Foo</p>
10926 </blockquote>
10927 !!end
10928
10929 !!test
10930 Templates: P-wrapping: 1a. Templates on consecutive lines
10931 !! wikitext
10932 {{echo|Foo}}
10933 {{echo|bar}}
10934 !! html
10935 <p>Foo
10936 bar
10937 </p>
10938 !!end
10939
10940 !!test
10941 Templates: P-wrapping: 1b. Templates on consecutive lines
10942 !! wikitext
10943 Foo
10944
10945 {{echo|bar}}
10946 {{echo|baz}}
10947 !! html
10948 <p>Foo
10949 </p><p>bar
10950 baz
10951 </p>
10952 !!end
10953
10954 !!test
10955 Templates: P-wrapping: 1c. Templates on consecutive lines
10956 !! wikitext
10957 {{echo|Foo}}
10958 {{echo|bar}} <div>baz</div>
10959 !! html
10960 <p>Foo
10961 </p>
10962 bar <div>baz</div>
10963
10964 !! html+tidy
10965 <p>Foo</p>
10966 <p>bar</p>
10967 <div>baz</div>
10968 !! end
10969
10970 !!test
10971 Templates: P-wrapping: 1d. Template preceded by comment-only line
10972 !!options
10973 parsoid
10974 !! wikitext
10975 <!-- foo -->
10976 {{echo|Bar}}
10977 !! html
10978 <!-- foo -->
10979
10980 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10981 !!end
10982
10983 !!test
10984 Templates: Inline Text: 1. Multiple template uses
10985 !! wikitext
10986 {{echo|Foo}}bar{{echo|baz}}
10987 !! html
10988 <p>Foobarbaz
10989 </p>
10990 !!end
10991
10992 !!test
10993 Templates: Inline Text: 2. Back-to-back template uses
10994 !! wikitext
10995 {{echo|Foo}}{{echo|bar}}
10996 !! html
10997 <p>Foobar
10998 </p>
10999 !!end
11000
11001 !!test
11002 Templates: Block Tags: 1. Multiple template uses
11003 !! wikitext
11004 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11005 !! html
11006 <div>Foo</div><div>bar</div><div>baz</div>
11007
11008 !!end
11009
11010 !!test
11011 Templates: Block Tags: 2. Back-to-back template uses
11012 !! wikitext
11013 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11014 !! html
11015 <div>Foo</div><div>bar</div>
11016
11017 !!end
11018
11019 # This is an edge case relating to paragraph wrapping.
11020 !!test
11021 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11022 !! wikitext
11023 {{echo|a
11024 b</p>}}
11025 !! html/parsoid
11026 <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
11027 b</p>
11028 !!end
11029
11030 !!test
11031 Templates: Links: 1. Simple example
11032 !! wikitext
11033 {{echo|[[Foo|bar]]}}
11034 !! html
11035 <p><a href="/wiki/Foo" title="Foo">bar</a>
11036 </p>
11037 !!end
11038
11039 !!test
11040 Templates: Links: 2. Generation of link href
11041 !! wikitext
11042 [[{{echo|Foo}}|bar]]
11043 !! html
11044 <p><a href="/wiki/Foo" title="Foo">bar</a>
11045 </p>
11046 !!end
11047
11048 !!test
11049 Templates: Links: 3. Generation of part of a link href
11050 !! wikitext
11051 [[Fo{{echo|o}}|bar]]
11052
11053 [[Foo{{echo|bar}}]]
11054
11055 [[Foo{{echo|bar}}baz]]
11056
11057 [[Foo{{echo|bar}}|bar]]
11058
11059 [[:Foo{{echo|bar}}]]
11060
11061 [[:Foo{{echo|bar}}|bar]]
11062 !! html
11063 <p><a href="/wiki/Foo" title="Foo">bar</a>
11064 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11065 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11066 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11067 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11068 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11069 </p>
11070 !!end
11071
11072 !!test
11073 Templates: Links: 4. Multiple templates generating link href
11074 !! wikitext
11075 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11076 !! html
11077 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11078 </p>
11079 !!end
11080
11081 !!test
11082 Templates: Links: 5. Generation of link text
11083 !! wikitext
11084 [[Foo|{{echo|bar}}]]
11085 !! html
11086 <p><a href="/wiki/Foo" title="Foo">bar</a>
11087 </p>
11088 !!end
11089
11090 !!test
11091 Templates: Links: 5. Nested templates (only outermost template should be marked)
11092 !! wikitext
11093 {{echo|[[{{echo|Foo}}|bar]]}}
11094 !! html
11095 <p><a href="/wiki/Foo" title="Foo">bar</a>
11096 </p>
11097 !!end
11098
11099 !!test
11100 Templates: HTML Tag: 1. Generation of HTML attr. key
11101 !! wikitext
11102 <div {{echo|style}}="color:red;">foo</div>
11103 !! html
11104 <div style="color:red;">foo</div>
11105
11106 !!end
11107
11108 !!test
11109 Templates: HTML Tag: 2. Generation of HTML attr. value
11110 !! wikitext
11111 <div style={{echo|'color:red;'}}>foo</div>
11112 !! html
11113 <div style="color:red;">foo</div>
11114
11115 !!end
11116
11117 !!test
11118 Templates: HTML Tag: 3. Generation of HTML attr key and value
11119 !! wikitext
11120 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11121 !! html
11122 <div style="color:red;">foo</div>
11123
11124 !!end
11125
11126 !!test
11127 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11128 !! wikitext
11129 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11130 !! html
11131 <div title="This is a long title with just one piece templated">foo</div>
11132
11133 !!end
11134
11135 !!test
11136 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11137 !! wikitext
11138 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11139 !! html
11140 <div title="This is a long title with just one piece templated">foo</div>
11141
11142 !!end
11143
11144 !!test
11145 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11146 !! wikitext
11147 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11148 !! html
11149 <div title="This is a long title with just one piece templated">foo</div>
11150
11151 !!end
11152
11153 # SSS FIXME: While it is great we added support for all this,
11154 # do we want to make this part of the spec? Maybe we want to
11155 # deprecate this kind of usage in the future?
11156 !!test
11157 Templates: HTML Tag: 7. Generation of partial attribute key string
11158 !! wikitext
11159 <div st{{echo|yle}}="color:red;">foo</div>
11160 !! html
11161 <div style="color:red;">foo</div>
11162
11163 !!end
11164
11165 !! test
11166 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11167 !! wikitext
11168 <div {{echo|1=id="v1"}}>bar</div>
11169 !! html
11170 <div id="v1">bar</div>
11171
11172 !!end
11173
11174 !! test
11175 Templates: HTML Tag: 9. Multiple template-generated attributes
11176 !! wikitext
11177 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11178 !! html
11179 <div id="v1" title="foo">bar</div>
11180
11181 !!end
11182
11183 !! test
11184 Templates: Support for templates generating attributes and content
11185 !! wikitext
11186 {| {{mixed_attr_content_template}}
11187 |-
11188 |bar
11189 |}
11190 !! html/php
11191 <table style="color:red;" title="T48811">
11192
11193 <tr>
11194 <td>foo
11195 </td></tr>
11196 <tr>
11197 <td>bar
11198 </td></tr></table>
11199
11200 !! html/parsoid
11201 <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|}"]}'>
11202 <tbody><tr>
11203 <td>foo</td></tr>
11204 <tr>
11205 <td>bar</td></tr>
11206 </tbody></table>
11207 !!end
11208
11209 !! test
11210 1. Entities and nowikis inside templated attributes should be handled correctly
11211 !! wikitext
11212 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11213 !! html/php
11214 <div style="background:#f9f9f9;">foo</div>
11215
11216 !! html/parsoid
11217 <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>
11218 !! end
11219
11220 !! test
11221 2. Entities and nowikis inside templated attributes should be handled correctly
11222 !! wikitext
11223 {|
11224 |{{table_attribs_3}}
11225 |}
11226 !! html/php
11227 <table>
11228 <tr>
11229 <td style="background:#f9f9f9;">Foo
11230 </td></tr></table>
11231
11232 !! html/parsoid
11233 <table>
11234 <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>
11235 </tbody></table>
11236 !! end
11237
11238 !! test
11239 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11240 !! wikitext
11241 {{tbl-start}}
11242 |{{table_attribs_3}}
11243 {{tbl-end}}
11244 !! html/php
11245 <table>
11246 <tr>
11247 <td style="background:#f9f9f9;">Foo
11248 </td></tr></table>
11249
11250 !! html/parsoid
11251 <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}}]}'>
11252 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11253 </tbody></table>
11254 !! end
11255
11256 # T107622
11257 !! test
11258 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11259 !! wikitext
11260 {|
11261 | {{table_attribs_6}} hi
11262 |}
11263 !! html/php
11264 <table>
11265 <tr>
11266 <td style="background: red;"> hi
11267 </td></tr></table>
11268
11269 !! html/parsoid
11270 <table>
11271 <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>
11272 </tbody></table>
11273 !! end
11274
11275 !!test
11276 Templates: HTML Tables: 1. Generating start of a HTML table
11277 !! wikitext
11278 {{echo|<table><tr><td>foo</td>}}</tr></table>
11279 !! html
11280 <table><tr><td>foo</td></tr></table>
11281
11282 !!end
11283
11284 !!test
11285 Templates: HTML Tables: 2a. Generating middle of a HTML table
11286 !! wikitext
11287 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11288 !! html
11289 <table><tr><td>foo</td></tr></table>
11290
11291 !!end
11292
11293 !!test
11294 Templates: HTML Tables: 2b. Generating middle of a HTML table
11295 !! wikitext
11296 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11297 !! html
11298 <table><tr><td>foo</td></tr></table>
11299
11300 !!end
11301
11302 !!test
11303 Templates: HTML Tables: 3. Generating end of a HTML table
11304 !! wikitext
11305 <table><tr>{{echo|<td>foo</td></tr></table>}}
11306 !! html
11307 <table><tr><td>foo</td></tr></table>
11308
11309 !!end
11310
11311 !!test
11312 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11313 !! wikitext
11314 {{echo|<table>}}<tr><td>foo</td></tr></table>
11315 !! html
11316 <table><tr><td>foo</td></tr></table>
11317
11318 !!end
11319
11320 !!test
11321 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11322 !! wikitext
11323 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11324 !! html
11325 <table><tr><td>foo</td></tr></table>
11326
11327 !!end
11328
11329 !!test
11330 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11331 !! wikitext
11332 <table><tr>{{echo|<td>}}foo</td></tr></table>
11333 !! html
11334 <table><tr><td>foo</td></tr></table>
11335
11336 !!end
11337
11338 !!test
11339 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11340 !! wikitext
11341 <table><tr><td>foo{{echo|</td>}}</tr></table>
11342 !! html
11343 <table><tr><td>foo</td></tr></table>
11344
11345 !!end
11346
11347 !!test
11348 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11349 !! wikitext
11350 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11351 !! html
11352 <table><tr><td>foo</td></tr></table>
11353
11354 !!end
11355
11356 !!test
11357 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11358 !! wikitext
11359 <table><tr><td>foo</td></tr>{{echo|</table>}}
11360 !! html
11361 <table><tr><td>foo</td></tr></table>
11362
11363 !!end
11364
11365 !!test
11366 Templates: HTML Tables: 5. Proper fostering of categories from inside
11367 !!options
11368 parsoid=wt2html,wt2wt
11369 !! wikitext
11370 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11371 <!--Two categories (Bug 50330)-->
11372 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11373 !! html
11374 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11375 <!--Two categories (Bug 50330)-->
11376 <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>
11377 !!end
11378
11379 !!test
11380 Templates: Wiki Tables: 1a. Fostering of entire template content
11381 !! wikitext
11382 {|
11383 {{echo|a}}
11384 |}
11385 !! html
11386 <table>
11387 a
11388 <tr><td></td></tr></table>
11389
11390 !! html+tidy
11391 <p>a</p>
11392 <table>
11393 <tr>
11394 <td></td>
11395 </tr>
11396 </table>
11397 !! end
11398
11399 !!test
11400 Templates: Wiki Tables: 1b. Fostering of entire template content
11401 !! wikitext
11402 {|
11403 {{echo|<div>}}
11404 foo
11405 {{echo|</div>}}
11406 |}
11407 !! html
11408 <table>
11409 <div>
11410 <p>foo
11411 </p>
11412 </div>
11413 <tr><td></td></tr></table>
11414
11415 !! html+tidy
11416 <div>
11417 <p>foo</p>
11418 </div>
11419 <table>
11420 <tr>
11421 <td></td>
11422 </tr>
11423 </table>
11424 !! end
11425
11426 !!test
11427 Templates: Wiki Tables: 2. Fostering of partial template content
11428 !! wikitext
11429 {|
11430 {{echo|a
11431 <div>b</div>}}
11432 |}
11433 !! html
11434 <table>
11435 a
11436 <div>b</div>
11437 <tr><td></td></tr></table>
11438
11439 !! html+tidy
11440 <p>a</p>
11441 <div>b</div>
11442 <table>
11443 <tr>
11444 <td></td>
11445 </tr>
11446 </table>
11447 !! end
11448
11449 !!test
11450 Templates: Wiki Tables: 3. td-content via multiple templates
11451 !! wikitext
11452 {|
11453 {{echo|{{pipe}}a}}{{echo|b}}
11454 |}
11455 !! html
11456 <table>
11457 <tr>
11458 <td>ab
11459 </td></tr></table>
11460
11461 !!end
11462
11463 !!test
11464 Templates: Wiki Tables: 4. Templated tags, no content
11465 !! wikitext
11466 {{tbl-start}}
11467 {{tbl-end}}
11468 !! html
11469 <table>
11470 <tr><td></td></tr></table>
11471
11472 !!end
11473
11474 !!test
11475 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11476 !! wikitext
11477 {{tbl-start}}
11478 |foo
11479 {{tbl-end}}
11480 !! html
11481 <table>
11482 <tr>
11483 <td>foo
11484 </td></tr></table>
11485
11486 !!end
11487
11488 !!test
11489 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11490 !! wikitext
11491 {{tbl-start}}
11492 {{!}}foo
11493 {{tbl-end}}
11494 !! html
11495 <table>
11496 <tr>
11497 <td>foo
11498 </td></tr></table>
11499
11500 !!end
11501
11502 ## This test case is very specific to Parsoid's internals
11503 ## and is hence only tested for Parsoid's code. Parsoid uses
11504 ## a <meta> marker tag for <ref> tags and they are expanded
11505 ## much later. We are verifying that this <meta> tag usage
11506 ## doesn't prevent foster parenting.
11507 !!test
11508 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11509 !!wikitext
11510 {{PartialTable}}<ref>foo</ref>
11511 |}
11512
11513 <references />
11514 !!html/parsoid
11515 <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">
11516 <tbody>
11517 </tbody></table>
11518
11519 <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>
11520 !!end
11521
11522 !! test
11523 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11524 !! wikitext
11525 {{echo|
11526 {{{!}}
11527 {{!}}-}}
11528 <onlyinclude>
11529 |foo
11530 </onlyinclude>
11531 {{!}}}
11532 !! html/parsoid
11533 <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{{!}}}"]}'>
11534 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11535 <tbody><tr>
11536
11537 <td>foo
11538 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11539 </tbody></table>
11540 !! end
11541
11542 !!test
11543 Templates: Lists: Multi-line list-items via templates
11544 !! wikitext
11545 *{{echo|a {{nonexistent|
11546 unused}}}}
11547 *{{echo|b {{nonexistent|
11548 unused}}}}
11549 !! html
11550 <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>
11551 <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>
11552
11553 !!end
11554
11555 !!test
11556 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11557 !! wikitext
11558 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11559 !! html
11560 <p><i>ab</i>c<i>d</i>e
11561 </p>
11562 !!end
11563
11564 !!test
11565 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11566 (PHP parser generates misnested html)
11567 !! wikitext
11568 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11569 !! html/parsoid
11570 <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>
11571 !!end
11572
11573 !!test
11574 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11575 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11576 !! options
11577 parsoid=wt2html,wt2wt
11578 !! wikitext
11579 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11580 !! html
11581 <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>
11582 <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>
11583 <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>
11584 !!end
11585
11586 !!test
11587 Templates: Ugly nesting: 4. Divs opened/closed across templates
11588 !! wikitext
11589 a<div>b{{echo|c</div>d}}e
11590 !! html
11591 a<div>bc</div>de
11592
11593 !! html+tidy
11594 <p>a</p>
11595 <div>bc</div>
11596 <p>de</p>
11597 !! end
11598
11599 !!test
11600 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11601 (Parsoid-centric)
11602 !! options
11603 parsoid
11604 !! wikitext
11605 {|
11606 |{{echo|foo</table>}}
11607 |bar
11608 |}
11609 !! html
11610 <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|}"]}'>
11611
11612 <tbody>
11613 <tr>
11614 <td>foo</td></tr></tbody></table><span about="#mwt1">
11615 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11616 |}</span>
11617 !!end
11618
11619 !!test
11620 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11621 (Parsoid-centric)
11622 !! options
11623 parsoid
11624 !! wikitext
11625 <table>
11626 <tr>
11627 <td>
11628 <table>
11629 <tr>
11630 <td>1. {{echo|foo </table>}}</td>
11631 <td> bar </td>
11632 <td>2. {{echo|baz </table>}}</td>
11633 </tr>
11634 <tr>
11635 <td>abc</td>
11636 </tr>
11637 </table>
11638 </td>
11639 </tr>
11640 <tr>
11641 <td>xyz</td>
11642 </tr>
11643 </table>
11644 !! html
11645 <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>"]}'>
11646 <tbody><tr>
11647 <td>
11648 <table>
11649 <tbody><tr>
11650 <td>1. foo </td></tr></tbody></table></td>
11651 <td> bar </td>
11652 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11653 </span><span about="#mwt2">
11654 </span><span about="#mwt2">
11655 </span><span about="#mwt2">abc</span><span about="#mwt2">
11656 </span><span about="#mwt2">
11657 </span><span about="#mwt2">
11658 </span><span about="#mwt2">
11659 </span><span about="#mwt2">
11660 </span><span about="#mwt2">
11661 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11662 </span><span about="#mwt2">
11663 </span>
11664 !!end
11665
11666 !! test
11667 Templates: Ugly templates: 3. newline-only template parameter
11668 !! wikitext
11669 foo {{echo|
11670 }}
11671 !! html
11672 <p>foo
11673 </p>
11674 !! end
11675
11676 # This looks like a bug: a single newline triggers p/br for some reason.
11677 !! test
11678 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11679 !! wikitext
11680 {{echo|
11681 }}
11682 !! html
11683 <p><br />
11684 </p>
11685 !! end
11686
11687 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11688 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11689 !! test
11690 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11691 !! wikitext
11692 {{echo|<table>}}
11693 {{echo|<div>foo}}
11694 {{echo|</table>}}
11695 !! html/parsoid
11696 <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
11697 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11698 </table>
11699 !! end
11700
11701 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11702 # that are "identical" and generate nesting cycles in the algorithm
11703 !! test
11704 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11705 !! wikitext
11706 {{echo|<table><tr><td><table>}}
11707 {{echo|<div>}}
11708 {{echo|</div>}}
11709 !! html/parsoid
11710 <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"}'>
11711 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11712 </table></td></tr></tbody></table>
11713 !! end
11714
11715 !!test
11716 Parser Functions: 1. Simple example
11717 !! wikitext
11718 {{uc:foo}}
11719 !! html
11720 <p>FOO
11721 </p>
11722 !!end
11723
11724 !!test
11725 Parser Functions: 2. Nested use (only outermost should be marked up)
11726 !! wikitext
11727 {{uc:{{lc:FOO}}}}
11728 !! html
11729 <p>FOO
11730 </p>
11731 !!end
11732
11733 ###
11734 ### Pre-save transform tests
11735 ###
11736 !! test
11737 pre-save transform: subst:
11738 !! options
11739 pst
11740 !! wikitext
11741 {{subst:test}}
11742 !! html/php
11743 This is a test template
11744 !! end
11745
11746 !! test
11747 pre-save transform: normal template
11748 !! options
11749 pst
11750 !! wikitext
11751 {{test}}
11752 !! html/php
11753 {{test}}
11754 !! end
11755
11756 !! test
11757 pre-save transform: nonexistent template
11758 !! options
11759 pst
11760 !! wikitext
11761 {{thistemplatedoesnotexist}}
11762 !! html/php
11763 {{thistemplatedoesnotexist}}
11764 !! end
11765
11766 !! test
11767 pre-save transform: subst magic variables
11768 !! options
11769 pst
11770 !! wikitext
11771 {{subst:SITENAME}}
11772 !! html/php
11773 MediaWiki
11774 !! end
11775
11776 # This is bug 89, which I fixed. -- wtm
11777 !! test
11778 pre-save transform: subst: templates with parameters
11779 !! options
11780 pst
11781 !! wikitext
11782 {{subst:paramtest|param="something else"}}
11783 !! html/php
11784 This is a test template with parameter "something else"
11785 !! end
11786
11787 !! article
11788 Template:nowikitest
11789 !! text
11790 <nowiki>'''not wiki'''</nowiki>
11791 !! endarticle
11792
11793 !! test
11794 pre-save transform: nowiki in subst (bug 1188)
11795 !! options
11796 pst
11797 !! wikitext
11798 {{subst:nowikitest}}
11799 !! html/php
11800 <nowiki>'''not wiki'''</nowiki>
11801 !! end
11802
11803 !! article
11804 Template:commenttest
11805 !! text
11806 This template has <!-- a comment --> in it.
11807 !! endarticle
11808
11809 !! test
11810 pre-save transform: comment in subst (bug 1936)
11811 !! options
11812 pst
11813 !! wikitext
11814 {{subst:commenttest}}
11815 !! html/php
11816 This template has <!-- a comment --> in it.
11817 !! end
11818
11819 !! test
11820 pre-save transform: unclosed tag
11821 !! options
11822 pst noxml
11823 !! wikitext
11824 <nowiki>'''not wiki'''
11825 !! html/php
11826 <nowiki>'''not wiki'''
11827 !! end
11828
11829 !! test
11830 pre-save transform: mixed tag case
11831 !! options
11832 pst noxml
11833 !! wikitext
11834 <NOwiki>'''not wiki'''</noWIKI>
11835 !! html/php
11836 <NOwiki>'''not wiki'''</noWIKI>
11837 !! end
11838
11839 !! test
11840 pre-save transform: unclosed comment in <nowiki>
11841 !! options
11842 pst noxml
11843 !! wikitext
11844 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11845 !! html/php
11846 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11847 !!end
11848
11849 # Leading @ in this template definition works around a limitation
11850 # in parsoid's parserTests which otherwise strips the <span> from the
11851 # result (confusing it for a template wrapper)
11852 !! article
11853 Template:dangerous
11854 !!text
11855 @<span onmouseover="alert('crap')">Oh no</span>
11856 !!endarticle
11857
11858 !!test
11859 (confirming safety of fix for subst bug 1936)
11860 !! wikitext
11861 {{Template:dangerous}}
11862 !! html
11863 <p>@<span>Oh no</span>
11864 </p>
11865 !! end
11866
11867 !! test
11868 pre-save transform: comment containing gallery (bug 5024)
11869 !! options
11870 pst
11871 !! wikitext
11872 <!-- <gallery>data</gallery> -->
11873 !! html/php
11874 <!-- <gallery>data</gallery> -->
11875 !!end
11876
11877 !! test
11878 pre-save transform: comment containing extension
11879 !! options
11880 pst
11881 !! wikitext
11882 <!-- <tag>data</tag> -->
11883 !! html/php
11884 <!-- <tag>data</tag> -->
11885 !!end
11886
11887 !! test
11888 pre-save transform: comment containing nowiki
11889 !! options
11890 pst
11891 !! wikitext
11892 <!-- <nowiki>data</nowiki> -->
11893 !! html/php
11894 <!-- <nowiki>data</nowiki> -->
11895 !!end
11896
11897 !! test
11898 pre-save transform: <noinclude> in subst (bug 3298)
11899 !! options
11900 pst
11901 !! wikitext
11902 {{subst:Includes}}
11903 !! html/php
11904 Foobar
11905 !! end
11906
11907 !! test
11908 pre-save transform: <onlyinclude> in subst (bug 3298)
11909 !! options
11910 pst
11911 !! wikitext
11912 {{subst:Includes2}}
11913 !! html/php
11914 Foo
11915 !! end
11916
11917 !! article
11918 Template:SubstTest
11919 !!text
11920 {{<includeonly>subst:</includeonly>Includes}}
11921 !! endarticle
11922
11923 !! article
11924 Template:SafeSubstTest
11925 !! text
11926 {{<includeonly>safesubst:</includeonly>Includes}}
11927 !! endarticle
11928
11929 !! test
11930 bug 22297: safesubst: works during PST
11931 !! options
11932 pst
11933 !! wikitext
11934 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11935 !! html/php
11936 FoobarFoobar
11937 !! end
11938
11939 !! test
11940 bug 22297: safesubst: works during normal parse
11941 !! wikitext
11942 {{SafeSubstTest}}
11943 !! html
11944 <p>Foobar
11945 </p>
11946 !! end
11947
11948 !! test
11949 subst: does not work during normal parse
11950 !! wikitext
11951 {{SubstTest}}
11952 !! html
11953 <p>{{subst:Includes}}
11954 </p>
11955 !! end
11956
11957 !! test
11958 pre-save transform: context links ("pipe trick")
11959 !! options
11960 pst
11961 !! wikitext
11962 [[Article (context)|]]
11963 [[Bar:Article|]]
11964 [[:Bar:Article|]]
11965 [[Bar:Article (context)|]]
11966 [[:Bar:Article (context)|]]
11967 [[|Article]]
11968 [[|Article (context)]]
11969 [[Bar:X (Y) Z|]]
11970 [[:Bar:X (Y) Z|]]
11971 !! html/php
11972 [[Article (context)|Article]]
11973 [[Bar:Article|Article]]
11974 [[:Bar:Article|Article]]
11975 [[Bar:Article (context)|Article]]
11976 [[:Bar:Article (context)|Article]]
11977 [[Article]]
11978 [[Article (context)]]
11979 [[Bar:X (Y) Z|X (Y) Z]]
11980 [[:Bar:X (Y) Z|X (Y) Z]]
11981 !! end
11982
11983 !! test
11984 pre-save transform: context links ("pipe trick") with interwiki prefix
11985 !! options
11986 pst
11987 !! wikitext
11988 [[interwiki:Article|]]
11989 [[:interwiki:Article|]]
11990 [[interwiki:Bar:Article|]]
11991 [[:interwiki:Bar:Article|]]
11992 !! html/php
11993 [[interwiki:Article|Article]]
11994 [[:interwiki:Article|Article]]
11995 [[interwiki:Bar:Article|Bar:Article]]
11996 [[:interwiki:Bar:Article|Bar:Article]]
11997 !! end
11998
11999 !! test
12000 pre-save transform: context links ("pipe trick") with parens in title
12001 !! options
12002 pst title=[[Somearticle (context)]]
12003 !! wikitext
12004 [[|Article]]
12005 !! html/php
12006 [[Article (context)|Article]]
12007 !! end
12008
12009 !! test
12010 pre-save transform: context links ("pipe trick") with comma in title
12011 !! options
12012 pst title=[[Someplace, Somewhere]]
12013 !! wikitext
12014 [[|Otherplace]]
12015 [[Otherplace, Elsewhere|]]
12016 [[Otherplace, Elsewhere, Anywhere|]]
12017 !! html/php
12018 [[Otherplace, Somewhere|Otherplace]]
12019 [[Otherplace, Elsewhere|Otherplace]]
12020 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12021 !! end
12022
12023 !! test
12024 pre-save transform: context links ("pipe trick") with parens and comma
12025 !! options
12026 pst title=[[Someplace (IGNORED), Somewhere]]
12027 !! wikitext
12028 [[|Otherplace]]
12029 [[Otherplace (place), Elsewhere|]]
12030 !! html/php
12031 [[Otherplace, Somewhere|Otherplace]]
12032 [[Otherplace (place), Elsewhere|Otherplace]]
12033 !! end
12034
12035 !! test
12036 pre-save transform: context links ("pipe trick") with comma and parens
12037 !! options
12038 pst title=[[Who, me? (context)]]
12039 !! wikitext
12040 [[|Yes, you.]]
12041 [[Me, Myself, and I (1937 song)|]]
12042 !! html/php
12043 [[Yes, you. (context)|Yes, you.]]
12044 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12045 !! end
12046
12047 !! test
12048 pre-save transform: context links ("pipe trick") with namespace
12049 !! options
12050 pst title=[[Ns:Somearticle]]
12051 !! wikitext
12052 [[|Article]]
12053 !! html/php
12054 [[Ns:Article|Article]]
12055 !! end
12056
12057 !! test
12058 pre-save transform: context links ("pipe trick") with namespace and parens
12059 !! options
12060 pst title=[[Ns:Somearticle (context)]]
12061 !! wikitext
12062 [[|Article]]
12063 !! html/php
12064 [[Ns:Article (context)|Article]]
12065 !! end
12066
12067 !! test
12068 pre-save transform: context links ("pipe trick") with namespace and comma
12069 !! options
12070 pst title=[[Ns:Somearticle, Context, Whatever]]
12071 !! wikitext
12072 [[|Article]]
12073 !! html/php
12074 [[Ns:Article, Context, Whatever|Article]]
12075 !! end
12076
12077 !! test
12078 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12079 !! options
12080 pst title=[[Ns:Somearticle, Context (context)]]
12081 !! wikitext
12082 [[|Article]]
12083 !! html/php
12084 [[Ns:Article (context)|Article]]
12085 !! end
12086
12087 !! test
12088 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12089 !! options
12090 pst title=[[Ns:Somearticle (IGNORED), Context]]
12091 !! wikitext
12092 [[|Article]]
12093 !! html/php
12094 [[Ns:Article, Context|Article]]
12095 !! end
12096
12097 !! test
12098 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12099 !! options
12100 pst
12101 !! wikitext
12102 [[Article(context)|]]
12103 [[Bar:Article(context)|]]
12104 [[:Bar:Article(context)|]]
12105 [[|Article(context)]]
12106 [[Bar:X(Y)Z|]]
12107 [[:Bar:X(Y)Z|]]
12108 !! html/php
12109 [[Article(context)|Article]]
12110 [[Bar:Article(context)|Article]]
12111 [[:Bar:Article(context)|Article]]
12112 [[Article(context)]]
12113 [[Bar:X(Y)Z|X(Y)Z]]
12114 [[:Bar:X(Y)Z|X(Y)Z]]
12115 !! end
12116
12117 !! test
12118 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12119 !! options
12120 pst
12121 !! wikitext
12122 [[Article (context)|]]
12123 [[Bar:Article (context)|]]
12124 [[:Bar:Article (context)|]]
12125 [[|Article (context)]]
12126 [[Bar:X (Y) Z|]]
12127 [[:Bar:X (Y) Z|]]
12128 !! html/php
12129 [[Article (context)|Article]]
12130 [[Bar:Article (context)|Article]]
12131 [[:Bar:Article (context)|Article]]
12132 [[Article (context)]]
12133 [[Bar:X (Y) Z|X (Y) Z]]
12134 [[:Bar:X (Y) Z|X (Y) Z]]
12135 !! end
12136
12137 !! test
12138 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12139 !! options
12140 pst
12141 !! wikitext
12142 [[Article(context)|]]
12143 [[Bar:Article(context)|]]
12144 [[:Bar:Article(context)|]]
12145 [[|Article(context)]]
12146 [[Bar:X(Y)Z|]]
12147 [[:Bar:X(Y)Z|]]
12148 !! html/php
12149 [[Article(context)|Article]]
12150 [[Bar:Article(context)|Article]]
12151 [[:Bar:Article(context)|Article]]
12152 [[Article(context)]]
12153 [[Bar:X(Y)Z|X(Y)Z]]
12154 [[:Bar:X(Y)Z|X(Y)Z]]
12155 !! end
12156
12157 !! test
12158 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12159 !! options
12160 pst
12161 !! wikitext
12162 [[Article (context), context|]]
12163 [[Article (context),context|]]
12164 [[Bar:Article (context), context|]]
12165 [[Bar:Article (context),context|]]
12166 [[:Bar:Article (context), context|]]
12167 [[:Bar:Article (context),context|]]
12168 !! html/php
12169 [[Article (context), context|Article]]
12170 [[Article (context),context|Article]]
12171 [[Bar:Article (context), context|Article]]
12172 [[Bar:Article (context),context|Article]]
12173 [[:Bar:Article (context), context|Article]]
12174 [[:Bar:Article (context),context|Article]]
12175 !! end
12176
12177 !! test
12178 pre-save transform: trim trailing empty lines
12179 !! options
12180 pst
12181 !! wikitext
12182 Empty lines are trimmed
12183
12184
12185
12186
12187 !! html/php
12188 Empty lines are trimmed
12189 !! end
12190
12191 !! test
12192 pre-save transform: Signature expansion
12193 !! options
12194 pst
12195 !! wikitext
12196 * ~~~
12197 * <noinclude>~~~</noinclude>
12198 * <includeonly>~~~</includeonly>
12199 * <onlyinclude>~~~</onlyinclude>
12200 !! html/php
12201 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12202 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12203 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12204 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12205 !! end
12206
12207
12208 !! test
12209 pre-save transform: Signature expansion in nowiki tags (bug 93)
12210 !! options
12211 pst disabled
12212 !! wikitext
12213 Shall not expand:
12214
12215 <nowiki>~~~~</nowiki>
12216
12217 <includeonly><nowiki>~~~~</nowiki></includeonly>
12218
12219 <noinclude><nowiki>~~~~</nowiki></noinclude>
12220
12221 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12222
12223 {{subst:Foo}} shall be converted to FOO
12224
12225 As well as inside noinclude/onlyinclude
12226 <noinclude>{{subst:Foo}}</noinclude>
12227 <onlyinclude>{{subst:Foo}}</onlyinclude>
12228
12229 But not inside includeonly
12230 <includeonly>{{subst:Foo}}</includeonly>
12231 !! html/php
12232 Shall not expand:
12233
12234 <nowiki>~~~~</nowiki>
12235
12236 <includeonly><nowiki>~~~~</nowiki></includeonly>
12237
12238 <noinclude><nowiki>~~~~</nowiki></noinclude>
12239
12240 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12241
12242 FOO shall be converted to FOO
12243
12244 As well as inside noinclude/onlyinclude
12245 <noinclude>FOO</noinclude>
12246 <onlyinclude>FOO</onlyinclude>
12247
12248 But not inside includeonly
12249 <includeonly>{{subst:Foo}}</includeonly>
12250 !! end
12251
12252 !! test
12253 Parsoid: Recognize nowiki with trailing space in tags
12254 !! options
12255 parsoid=wt2html
12256 !! wikitext
12257 <nowiki ><div>[[foo]]</nowiki >
12258
12259 a<nowiki / >b
12260
12261 c<nowiki />d
12262
12263 e<nowiki/ >f
12264 !! html
12265 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12266 <p>ab</p>
12267 <p>cd</p>
12268 <p>ef</p>
12269 !! end
12270
12271 !! test
12272 Parsoid: Recognize nowiki with odd capitalization
12273 !! options
12274 parsoid=wt2html
12275 !! wikitext
12276 <noWikI ><div>[[foo]]</Nowiki >
12277 !! html
12278 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12279 !! end
12280
12281
12282 !! test
12283 Parsoid: Escape nowiki with trailing space in tags
12284 !! options
12285 parsoid=html2wt
12286 !! html/parsoid
12287 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12288 <p>a&lt;nowiki /&gt;b</p>
12289 <p>c&lt;nowiki/ &gt;d</p>
12290 !! wikitext
12291 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12292
12293 a&lt;nowiki /&gt;b
12294
12295 c&lt;nowiki/ &gt;d
12296 !! end
12297
12298 !! test
12299 Parsoid: Escape weird noWikI capitalizations
12300 !! options
12301 parsoid=html2wt
12302 !! html/parsoid
12303 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12304 !! wikitext
12305 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12306 !! end
12307
12308 ###
12309 ### Message transform tests
12310 ###
12311 !! test
12312 message transform: magic variables
12313 !! options
12314 msg
12315 !! wikitext
12316 {{SITENAME}}
12317 !! html
12318 MediaWiki
12319 !! end
12320
12321 !! test
12322 message transform: should not transform wiki markup
12323 !! options
12324 msg
12325 !! wikitext
12326 ''test''
12327 !! html
12328 ''test''
12329 !! end
12330
12331 !! test
12332 message transform: <noinclude> in transcluded template (bug 4926)
12333 !! options
12334 msg
12335 !! wikitext
12336 {{Includes}}
12337 !! html
12338 Foobar
12339 !! end
12340
12341 !! test
12342 message transform: <onlyinclude> in transcluded template (bug 4926)
12343 !! options
12344 msg
12345 !! wikitext
12346 {{Includes2}}
12347 !! html
12348 Foo
12349 !! end
12350
12351 !! test
12352 {{#special:}} page name, known
12353 !! options
12354 msg
12355 !! wikitext
12356 {{#special:Recentchanges}}
12357 !! html
12358 Special:RecentChanges
12359 !! end
12360
12361 !! test
12362 {{#special:}} page name with subpage, known
12363 !! options
12364 msg
12365 !! wikitext
12366 {{#special:Recentchanges/param}}
12367 !! html
12368 Special:RecentChanges/param
12369 !! end
12370
12371 !! test
12372 {{#special:}} page name, unknown
12373 !! options
12374 msg
12375 !! wikitext
12376 {{#special:foobar nonexistent}}
12377 !! html
12378 Special:Foobar nonexistent
12379 !! end
12380
12381 !! test
12382 {{#speciale:}} page name, known
12383 !! options
12384 msg
12385 !! wikitext
12386 {{#speciale:Recentchanges}}
12387 !! html
12388 Special:RecentChanges
12389 !! end
12390
12391 !! test
12392 {{#speciale:}} page name with subpage, known
12393 !! options
12394 msg
12395 !! wikitext
12396 {{#speciale:Recentchanges/param}}
12397 !! html
12398 Special:RecentChanges/param
12399 !! end
12400
12401 !! test
12402 {{#speciale:}} page name, unknown
12403 !! options
12404 msg
12405 !! wikitext
12406 {{#speciale:foobar nonexistent}}
12407 !! html
12408 Special:Foobar_nonexistent
12409 !! end
12410
12411 ###
12412 ### Images
12413 ###
12414 ### For Parsoid-specific tests, see
12415 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12416
12417 !! test
12418 Simple image
12419 !! options
12420 parsoid=wt2html,wt2wt,html2html
12421 !! wikitext
12422 [[Image:foobar.jpg]]
12423 !! html/php
12424 <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>
12425 </p>
12426 !! html/parsoid
12427 <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>
12428 !! end
12429
12430 !! test
12431 Simple image (using File: namespace, now canonical)
12432 !! wikitext
12433 [[File:Foobar.jpg]]
12434 !! html/php
12435 <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>
12436 </p>
12437 !! html/parsoid
12438 <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>
12439 !! end
12440
12441 !! test
12442 Right-aligned image
12443 !! wikitext
12444 [[File:Foobar.jpg|right]]
12445 !! html/php
12446 <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>
12447
12448 !! html/parsoid
12449 <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>
12450 !! end
12451
12452 !! test
12453 Image with caption
12454 !! wikitext
12455 [[File:Foobar.jpg|right|Caption text]]
12456 !! html/php
12457 <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>
12458
12459 !! html/parsoid
12460 <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>
12461 !! end
12462
12463 !! test
12464 Image with caption, bug 53312 #1
12465 !! wikitext
12466 [[File:Foobar.jpg|right|Caption page stuff]]
12467 !! html/php
12468 <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>
12469
12470 !! html/parsoid
12471 <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>
12472 !! end
12473
12474 !! test
12475 Image with caption, bug 53312 #2
12476 !! wikitext
12477 [[File:Foobar.jpg|right|Caption page=]]
12478 !! html/php
12479 <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>
12480
12481 !! html/parsoid
12482 <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>
12483 !! end
12484
12485 !! test
12486 Image with caption, bug 53312 #3
12487 !! wikitext
12488 [[File:Foobar.jpg|right|Caption page=stuff]]
12489 !! html/php
12490 <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>
12491
12492 !! html/parsoid
12493 <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>
12494 !! end
12495
12496 !! test
12497 Allow empty links in image captions (Bug 60753)
12498 !! options
12499 thumbsize=220
12500 !! wikitext
12501 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12502 [[]]
12503 [[Link2]]
12504 ]]
12505 !! html/php
12506 <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>
12507
12508 !! html/parsoid
12509 <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>
12510 [[]]
12511 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12512 </figcaption></figure>
12513 !! end
12514
12515 !! test
12516 Titles in unlinked images (T23454)
12517 !! wikitext
12518 [[File:Foobar.jpg|link=|stuff]]
12519 !! html/php
12520 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12521 </p>
12522 !! end
12523
12524 !! test
12525 Link with empty target
12526 !! wikitext
12527 [[]]
12528 !! html
12529 <p>[[]]
12530 </p>
12531 !! end
12532
12533 !! test
12534 Image with link trail
12535 !! wikitext
12536 Linktrails should not work for images: [[File:Foobar.jpg]]s
12537 !! html/php
12538 <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
12539 </p>
12540 !! html/parsoid
12541 <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>
12542 !! end
12543
12544 !! test
12545 Image with empty attribute
12546 !! options
12547 parsoid=wt2html,wt2wt,html2html
12548 !! wikitext
12549 [[File:Foobar.jpg|right||Caption text]]
12550 !! html/php
12551 <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>
12552
12553 !! html/parsoid
12554 <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>
12555 !! end
12556
12557 !! test
12558 1. Block image with individual attributes from templates
12559 !! wikitext
12560 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12561 !! html/php
12562 <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>
12563
12564 !! html/parsoid
12565 <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>
12566 !! end
12567
12568 !! test
12569 2. Block Image with individual attributes from templates
12570 !! wikitext
12571 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12572 !! html/php
12573 <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>
12574
12575 !! html/parsoid
12576 <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>
12577 !! end
12578
12579 !! test
12580 3. Inline image with individual attributes from templates
12581 !! wikitext
12582 [[File:Foobar.jpg|{{echo|50px}}]]
12583 !! html/php
12584 <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>
12585 </p>
12586 !! html/parsoid
12587 <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>
12588 !! end
12589
12590 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12591 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12592 !! test
12593 Image with multiple attributes from the same template
12594 !! wikitext
12595 [[File:Foobar.jpg|{{image_attribs}}]]
12596 !! html/php
12597 <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>
12598
12599 !! html/parsoid
12600 <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>
12601 !! end
12602
12603 !! test
12604 Image with link tails
12605 !! options
12606 thumbsize=220
12607 !! wikitext
12608 123[[File:Foobar.jpg]]456
12609 123[[File:Foobar.jpg|right]]456
12610 123[[File:Foobar.jpg|thumb]]456
12611 !! html/php
12612 <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
12613 </p>
12614 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
12615 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
12616
12617 !! html/php+tidy
12618 <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>
12619 <p>123</p>
12620 <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>
12621 <p>456 123</p>
12622 <div class="thumb tright">
12623 <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>
12624 <div class="thumbcaption">
12625 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12626 </div>
12627 </div>
12628 </div>
12629 <p>456</p>
12630 !! html/parsoid
12631 <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>
12632 <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>
12633 <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>
12634 !! end
12635
12636 !! test
12637 Image with multiple captions -- only last one is accepted
12638 !! wikitext
12639 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12640 !! html/php
12641 <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>
12642
12643 !! html/parsoid
12644 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
12645 !! end
12646
12647 !! test
12648 Image with multiple widths -- use last
12649 !! wikitext
12650 [[File:Foobar.jpg|200px|300px|caption]]
12651 !! html/php
12652 <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>
12653 </p>
12654 !! html/parsoid
12655 <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>
12656 !! end
12657
12658 !! test
12659 Image with multiple alignments -- use first (bug 48664)
12660 !! options
12661 thumbsize=220
12662 !! wikitext
12663 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12664
12665 [[File:Foobar.jpg|middle|text-top|caption]]
12666 !! html/php
12667 <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>
12668 <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>
12669 </p>
12670 !! html/parsoid
12671 <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>
12672 <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>
12673 !! end
12674
12675 !! test
12676 Image with width attribute at different positions
12677 !! wikitext
12678 [[File:Foobar.jpg|200px|right|Caption]]
12679 [[File:Foobar.jpg|right|200px|Caption]]
12680 [[File:Foobar.jpg|right|Caption|200px]]
12681 !! html/php
12682 <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>
12683 <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>
12684 <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>
12685
12686 !! html/parsoid
12687 <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>
12688 <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>
12689 <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>
12690 !! end
12691
12692 # a sad bit of backward-compatibility
12693 !! test
12694 Image with size specified with pxpx (bug 13500, 51628)
12695 !! options
12696 parsoid=wt2html,wt2wt,html2html
12697 !! wikitext
12698 [[File:Foobar.jpg|20pxpx]]
12699 [[File:Foobar.jpg|200x20pxpx]]
12700 !! html/php
12701 <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>
12702 <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>
12703 </p>
12704 !! html/parsoid
12705 <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>
12706 !! end
12707
12708 !! test
12709 Image with link parameter, wiki target
12710 !! wikitext
12711 [[File:Foobar.jpg|link=Main Page]]
12712 !! html/php
12713 <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>
12714 </p>
12715 !! html/parsoid
12716 <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>
12717 !! end
12718
12719 # parsoid bug 49293 (part 1)
12720 !! test
12721 Image with link parameter, URL target
12722 !! wikitext
12723 [[File:Foobar.jpg|link=http://example.com/]]
12724 !! html/php
12725 <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>
12726 </p>
12727 !! html/parsoid
12728 <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>
12729 !! end
12730
12731 # parsoid bug 49293 (part 2)
12732 !! test
12733 Image with link parameter, protocol-less URL target
12734 !! wikitext
12735 [[File:Foobar.jpg|link=//example.com/]]
12736 !! html/php
12737 <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>
12738 </p>
12739 !! html/parsoid
12740 <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>
12741 !! end
12742
12743 !! test
12744 Escaping non-block captions (T107435)
12745 !! options
12746 parsoid={
12747 "modes": ["wt2wt"],
12748 "changes": [
12749 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12750 ]
12751 }
12752 !! wikitext
12753 [[Image:Foobar.jpg|caption]]
12754 !! wikitext/edited
12755 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12756 !! end
12757
12758 !! test
12759 Image with link parameter, wgExternalLinkTarget
12760 !! wikitext
12761 [[Image:foobar.jpg|link=http://example.com/]]
12762 !! config
12763 wgExternalLinkTarget='foobar'
12764 !! html
12765 <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>
12766 </p>
12767 !! end
12768
12769 !! test
12770 Image with link parameter, wgNoFollowLinks set to false
12771 !! wikitext
12772 [[Image:foobar.jpg|link=http://example.com/]]
12773 !! config
12774 wgNoFollowLinks=false
12775 !! html
12776 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12777 </p>
12778 !! end
12779
12780 !! test
12781 Image with link parameter, wgNoFollowDomainExceptions
12782 !! wikitext
12783 [[Image:foobar.jpg|link=http://example.com/]]
12784 !! config
12785 wgNoFollowDomainExceptions='example.com'
12786 !! html
12787 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12788 </p>
12789 !! end
12790
12791 !! test
12792 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12793 !! wikitext
12794 [[Image:foobar.jpg|link=http://example.com/|Title]]
12795 !! config
12796 wgExternalLinkTarget='foobar'
12797 !! html
12798 <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>
12799 </p>
12800 !! end
12801
12802 !! test
12803 Image with empty link parameter
12804 !! wikitext
12805 [[File:Foobar.jpg|link=]]
12806 !! html/php
12807 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12808 </p>
12809 !! html/parsoid
12810 <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>
12811 !! end
12812
12813 !! test
12814 Image with link parameter (wiki target) and unnamed parameter
12815 !! wikitext
12816 [[File:Foobar.jpg|link=Main_Page|Title]]
12817 !! html/php
12818 <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>
12819 </p>
12820 !! html/parsoid
12821 <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>
12822 !! end
12823
12824 !! test
12825 Image with link parameter (URL target) and unnamed parameter
12826 !! wikitext
12827 [[File:Foobar.jpg|link=http://example.com/|Title]]
12828 !! html/php
12829 <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>
12830 </p>
12831 !! html/parsoid
12832 <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>
12833 !! end
12834
12835 !! test
12836 Thumbnail image with link parameter
12837 !! options
12838 thumbsize=220
12839 parsoid=wt2html,wt2wt,html2html
12840 !! wikitext
12841 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12842 !! html/php
12843 <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>
12844
12845 !! html/parsoid
12846 <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>
12847 !! end
12848
12849 !! test
12850 Manually-specified thumbnail image
12851 !! options
12852 thumbsize=220
12853 !! wikitext
12854 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12855 !! html/php
12856 <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>
12857
12858 !! html/parsoid
12859 <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>
12860 !! end
12861
12862 !! test
12863 Manually-specified thumbnail image with explicit link to wiki page
12864 !! options
12865 thumbsize=220
12866 parsoid=wt2html,wt2wt,html2html
12867 !! wikitext
12868 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12869 !! html/php
12870 <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>
12871
12872 !! html/parsoid
12873 <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>
12874 !! end
12875
12876 !! test
12877 Manually-specified thumbnail image with explicit link to url
12878 !! options
12879 thumbsize=220
12880 parsoid=wt2html,wt2wt,html2html
12881 !! wikitext
12882 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12883 !! html/php
12884 <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>
12885
12886 !! html/parsoid
12887 <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>
12888 !! end
12889
12890 !! test
12891 Manually-specified thumbnail image with explicit no link
12892 !! options
12893 thumbsize=220
12894 parsoid=wt2html,wt2wt,html2html
12895 !! wikitext
12896 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12897 !! html/php
12898 <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>
12899
12900 !! html/parsoid
12901 <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>
12902 !! end
12903
12904 !! test
12905 Manually-specified thumbnail image with explicit link and alt text
12906 !! options
12907 thumbsize=220
12908 parsoid=wt2html,wt2wt,html2html
12909 !! wikitext
12910 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12911 !! html/php
12912 <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>
12913
12914 !! html/parsoid
12915 <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>
12916 !! end
12917
12918 !! test
12919 Image with frame and link
12920 !! options
12921 parsoid=wt2html,wt2wt,html2html
12922 !! wikitext
12923 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12924 !! html/php
12925 <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>
12926
12927 !! html/parsoid
12928 <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>
12929 !! end
12930
12931 !! test
12932 Image with frame and link and explicit alt
12933 !! options
12934 parsoid=wt2html,wt2wt,html2html
12935 !! wikitext
12936 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12937 !! html/php
12938 <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>
12939
12940 !! html/parsoid
12941 <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>
12942 !! end
12943
12944 !! test
12945 Image with wiki markup in implicit alt
12946 !! wikitext
12947 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12948
12949 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12950 !! html/php
12951 <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>
12952 </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>
12953 </p>
12954 !! html/parsoid
12955 <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>
12956 <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>
12957 !! end
12958
12959 !! test
12960 Alt image option should handle most kinds of wikitext without barfing
12961 !! wikitext
12962 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12963 !! html/php
12964 <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>
12965
12966 !! html/parsoid
12967 <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>
12968 !! end
12969
12970 ###################
12971 # Conflicting image format options.
12972 # First option specified should 'win'.
12973 # All three cases in each test should be identical.
12974
12975 !! test
12976 Image with 'frameless' first.
12977 !! options
12978 parsoid=wt2html,wt2wt,html2html
12979 !! wikitext
12980 [[File:Foobar.jpg|frameless|caption]]
12981
12982 [[File:Foobar.jpg|frameless|frame|caption]]
12983
12984 [[File:Foobar.jpg|frameless|thumb|caption]]
12985 !! html/php
12986 <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>
12987 </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>
12988 </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>
12989 </p>
12990 !! html/parsoid
12991 <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>
12992 <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>
12993 <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>
12994 !! end
12995
12996 !! test
12997 Image with 'frame' first.
12998 !! options
12999 parsoid=wt2html,wt2wt,html2html
13000 !! wikitext
13001 [[File:Foobar.jpg|frame|caption]]
13002 [[File:Foobar.jpg|frame|frameless|caption]]
13003 [[File:Foobar.jpg|frame|thumb|caption]]
13004 !! html/php
13005 <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>
13006 <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>
13007 <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>
13008
13009 !! html/parsoid
13010 <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>
13011 <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>
13012 <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>
13013 !! end
13014
13015 !! test
13016 Image with 'thumb' first.
13017 !! options
13018 parsoid=wt2html,wt2wt,html2html
13019 !! wikitext
13020 [[File:Foobar.jpg|thumb|caption]]
13021 [[File:Foobar.jpg|thumb|frameless|caption]]
13022 [[File:Foobar.jpg|thumb|frame|caption]]
13023 !! html/php
13024 <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>
13025 <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>
13026 <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>
13027
13028 !! html/parsoid
13029 <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>
13030 <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>
13031 <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>
13032 !! end
13033
13034 ###################
13035 # Image sizing.
13036 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13037 # and https://phabricator.wikimedia.org/T64258
13038 # Foobar has actual size of 1941x220
13039 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13040 # a scalable format.
13041 # 2. Framed images always ignore size options; always render at default size.
13042 # 3. "Unspecified format" and border are the only types which can be
13043 # enlarged.
13044
13045 !! test
13046 Image: "unspecified format" and border enlarge
13047 !! options
13048 parsoid=wt2html,wt2wt,html2html
13049 !! wikitext
13050 [[File:Foobar.jpg|2000px]]
13051
13052 [[File:Foobar.jpg|border|2000px]]
13053 !! html/php
13054 <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>
13055 </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>
13056 </p>
13057 !! html/parsoid
13058 <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>
13059 <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>
13060 !! end
13061
13062 !! test
13063 Image: "unspecified format" and border reduce
13064 !! options
13065 parsoid=wt2html,wt2wt,html2html
13066 !! wikitext
13067 [[File:Foobar.jpg|1000px]]
13068
13069 [[File:Foobar.jpg|border|1000px]]
13070 !! html/php
13071 <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>
13072 </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>
13073 </p>
13074 !! html/parsoid
13075 <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>
13076 <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>
13077 !! end
13078
13079 !! test
13080 Image: thumbs reduce
13081 !! options
13082 parsoid=wt2html,wt2wt,html2html
13083 !! wikitext
13084 [[File:Foobar.jpg|thumb|50px]]
13085 !! html/php
13086 <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>
13087
13088 !! html/parsoid
13089 <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>
13090 !! end
13091
13092 !! test
13093 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13094 !! options
13095 parsoid=wt2html,wt2wt,html2html
13096 !! wikitext
13097 [[File:Foobar.jpg|thumb|2000px]]
13098
13099 [[File:Foobar.svg|thumb|2000px]]
13100 !! html/php
13101 <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>
13102 <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>
13103
13104 !! html/parsoid
13105 <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>
13106 <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>
13107 !! end
13108
13109 !! test
13110 Image: frameless can reduce in size
13111 !! options
13112 parsoid=wt2html,wt2wt,html2html
13113 !! wikitext
13114 [[File:Foobar.jpg|frameless|50px]]
13115 !! html/php
13116 <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>
13117 </p>
13118 !! html/parsoid
13119 <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>
13120 !! end
13121
13122 !! test
13123 Image: bitmap frameless can't be enlarged past original size, but vector can
13124 !! options
13125 parsoid=wt2html,wt2wt,html2html
13126 !! wikitext
13127 [[File:Foobar.jpg|frameless|2000px]]
13128
13129 [[File:Foobar.svg|frameless|2000px]]
13130 !! html/php
13131 <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>
13132 </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>
13133 </p>
13134 !! html/parsoid
13135 <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>
13136 <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>
13137 !! end
13138
13139 !! test
13140 Image: framed images are always unscaled.
13141 !! options
13142 parsoid=wt2html,wt2wt,html2html
13143 !! wikitext
13144 [[File:Foobar.jpg|frame]]
13145
13146 [[File:Foobar.jpg|frame|50px]]
13147
13148 [[File:Foobar.jpg|frame|50x50px]]
13149
13150 [[File:Foobar.jpg|frame|2000px]]
13151 !! html/php
13152 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13153 <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>
13154 <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>
13155 <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>
13156
13157 !! html/parsoid
13158 <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>
13159 <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>
13160 <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>
13161 <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>
13162 !! end
13163
13164 ###################
13165
13166 !! test
13167 Link to image page- image page normally doesn't exists, hence edit link
13168 Add test with existing image page
13169 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13170 !! wikitext
13171 [[:Image:test]]
13172 !! html
13173 <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>
13174 </p>
13175 !! end
13176
13177 !! test
13178 bug 18784 Link to non-existent image page with caption should use caption as link text
13179 !! wikitext
13180 [[:Image:test|caption]]
13181 !! html
13182 <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>
13183 </p>
13184 !! end
13185
13186 !! test
13187 Frameless image caption with a free URL
13188 !! wikitext
13189 [[File:Foobar.jpg|http://example.com]]
13190 !! html/php
13191 <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>
13192 </p>
13193 !! html/parsoid
13194 <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>
13195 !! end
13196
13197 !! test
13198 Thumbnail image caption with a free URL
13199 !! options
13200 thumbsize=220
13201 !! wikitext
13202 [[File:Foobar.jpg|thumb|http://example.com]]
13203 !! html/php
13204 <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>
13205
13206 !! html/parsoid
13207 <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>
13208 !! end
13209
13210 !! test
13211 Thumbnail image caption with a free URL and explicit alt
13212 !! options
13213 thumbsize=220
13214 parsoid=wt2html,wt2wt,html2html
13215 !! wikitext
13216 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13217 !! html/php
13218 <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>
13219
13220 !! html/parsoid
13221 <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>
13222 !! end
13223
13224 !! test
13225 SVG thumbnails with no language set
13226 !! options
13227 !! wikitext
13228 [[File:Foobar.svg|thumb|caption]]
13229 !! html/php
13230 <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>
13231
13232 !! html/parsoid
13233 <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>
13234 !! end
13235
13236 !! test
13237 SVG thumbnails with language de
13238 !! options
13239 parsoid=wt2html,wt2wt,html2html
13240 !! wikitext
13241 [[File:Foobar.svg|thumb|caption|lang=de]]
13242 !! html/php
13243 <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>
13244
13245 !! html/parsoid
13246 <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>
13247 !! end
13248
13249 !! test
13250 SVG thumbnails with invalid language code
13251 !! options
13252 parsoid=wt2html,wt2wt,html2html
13253 !! wikitext
13254 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13255 !! html/php
13256 <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>
13257
13258 !! html/parsoid
13259 <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>
13260 !! end
13261
13262 !! test
13263 BUG 1887: A ISBN with a thumbnail
13264 !! wikitext
13265 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13266 !! html/php
13267 <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>
13268
13269 !! html/parsoid
13270 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
13271 !! end
13272
13273 !! test
13274 BUG 1887: A RFC with a thumbnail
13275 !! wikitext
13276 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13277 !! html/php
13278 <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>
13279
13280 !! html/parsoid
13281 <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>
13282 !! end
13283
13284 !! test
13285 BUG 1887: A mailto link with a thumbnail
13286 !! wikitext
13287 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13288 !! html/php
13289 <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>
13290
13291 !! html/parsoid
13292 <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>
13293 !! end
13294
13295 # Pending resolution to bug 368
13296 !! test
13297 BUG 648: Frameless image caption with a link
13298 !! wikitext
13299 [[File:Foobar.jpg|text with a [[link]] in it]]
13300 !! html/php
13301 <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>
13302 </p>
13303 !! html/parsoid
13304 <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>
13305 !! end
13306
13307 !! test
13308 BUG 648: Frameless image caption with a link (suffix)
13309 !! wikitext
13310 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13311 !! html/php
13312 <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>
13313 </p>
13314 !! html/parsoid
13315 <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>
13316 !! end
13317
13318 !! test
13319 BUG 648: Frameless image caption with an interwiki link
13320 !! wikitext
13321 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13322 !! html/php
13323 <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>
13324 </p>
13325 !! html/parsoid
13326 <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>
13327 !! end
13328
13329 !! test
13330 BUG 648: Frameless image caption with a piped interwiki link
13331 !! wikitext
13332 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13333 !! html/php
13334 <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>
13335 </p>
13336 !! html/parsoid
13337 <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>
13338 !! end
13339
13340 !! test
13341 T107474: Frameless image caption with <nowiki>
13342 !! wikitext
13343 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13344 !! html/parsoid
13345 <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>
13346 !! end
13347
13348 !! test
13349 Escape HTML special chars in image alt text
13350 !! wikitext
13351 [[File:Foobar.jpg|& < > "]]
13352 !! html/php
13353 <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>
13354 </p>
13355 !! html/parsoid
13356 <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>
13357 !! end
13358
13359 !! test
13360 BUG 499: Alt text should have &#1234;, not &amp;1234;
13361 !! wikitext
13362 [[File:Foobar.jpg|&#9792;]]
13363 !! html/php
13364 <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>
13365 </p>
13366 !! html/parsoid
13367 <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>
13368 !! end
13369
13370 !! test
13371 Broken image caption with link
13372 !! options
13373 parsoid=wt2html,wt2wt,html2html
13374 !! wikitext
13375 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13376 !! html/php
13377 <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.
13378 </p>
13379 !! html/parsoid
13380 <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>
13381 !! end
13382
13383 !! test
13384 Image caption containing another image
13385 !! wikitext
13386 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13387 !! html/php
13388 <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>
13389
13390 !! html/parsoid
13391 <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>
13392 !! end
13393
13394 !! test
13395 Image: caption containing a newline
13396 !! wikitext
13397 [[File:Foobar.jpg|This
13398 *is some text]]
13399 !! html/php
13400 <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>
13401 </p>
13402 !! html/parsoid
13403 <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>
13404 !!end
13405
13406 !!test
13407 Image: caption containing leading space
13408 (The leading space should not trigger nowiki escaping in wt2wt mode)
13409 !! wikitext
13410 [[File:Foobar.jpg|thumb| bar]]
13411 !! html/php
13412 <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>
13413
13414 !! html/parsoid
13415 <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>
13416 !!end
13417
13418 !! test
13419 Image: caption containing a table
13420 !! options
13421 parsoid=wt2html,wt2wt,html2html
13422 !! wikitext
13423 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13424 {|
13425 ! Foo !! Bar
13426 |-
13427 | Foo1 || Bar1
13428 |}
13429 and some more text.]]
13430 !! html/php
13431 <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>
13432
13433 !! html/parsoid
13434 <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
13435 <table>
13436 <tbody>
13437 <tr><th>Foo </th><th>Bar</th></tr>
13438 <tr>
13439 <td>Foo1 </td>
13440 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13441 !! end
13442
13443 !! test
13444 Bug 3090: External links other than http: in image captions
13445 !! wikitext
13446 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13447 !! html/php
13448 <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>
13449
13450 !! html/parsoid
13451 <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>
13452 !! end
13453
13454 !! test
13455 Custom class
13456 !! options
13457 parsoid=wt2html,wt2wt,html2html
13458 !! wikitext
13459 [[Image:foobar.jpg|a|class=b]]
13460 !! html/php
13461 <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>
13462 </p>
13463 !! html/parsoid
13464 <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>
13465 !! end
13466
13467 !! test
13468 Localized image handling (1).
13469 !! options
13470 parsoid=wt2html,wt2wt,html2html
13471 language=es
13472 !! wikitext
13473 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13474 !! html/php
13475 <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>
13476
13477 !! html/parsoid
13478 <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>
13479 !! end
13480
13481 !! test
13482 Localized image handling (2).
13483 !! options
13484 thumbsize=220
13485 parsoid=wt2html,wt2wt,html2html
13486 language=es
13487 !! wikitext
13488 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13489 !! html/php
13490 <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>
13491
13492 !! html/parsoid
13493 <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>
13494 !! end
13495
13496 !! test
13497 "border", "frameless" and "class" attributes on an image.
13498 !! options
13499 thumbsize=220
13500 parsoid=wt2html,wt2wt,html2html
13501 !! wikitext
13502 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13503 !! html/php
13504 <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>
13505 </p>
13506 !! html/parsoid
13507 <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>
13508 !! end
13509
13510 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13511 !! test
13512 Invalid image attributes (bug 62500)
13513 !! options
13514 thumbsize=220
13515 parsoid=wt2html,wt2wt,html2html
13516 !! wikitext
13517 [[File:Foobar.jpg|thumb|float|left|caption]]
13518
13519 [[File:Foobar.jpg|thumb|righ|caption]]
13520
13521 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13522 !! html/php
13523 <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>
13524 <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>
13525 <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>
13526
13527 !! html/parsoid
13528 <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>
13529 <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>
13530 <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>
13531 !! end
13532
13533 !! article
13534 File:Barfoo.jpg
13535 !! text
13536 #REDIRECT [[File:Barfoo.jpg]]
13537 !! endarticle
13538
13539 # FIXME: Parsoid should run this test -- but we'd need to teach the
13540 # mockAPI about the redirected Barfoo.jpg image.
13541 !! test
13542 Redirected image
13543 !! wikitext
13544 [[Image:Barfoo.jpg]]
13545 !! html/php
13546 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13547 </p>
13548 !! end
13549
13550 !! test
13551 Missing image with uploads disabled
13552 !! options
13553 wgEnableUploads=0
13554 !! wikitext
13555 [[File:Foobaz.jpg]]
13556 !! html/php
13557 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13558 </p>
13559 !! html/parsoid
13560 <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>
13561 !! end
13562
13563 # Parsoid-specific testing for images
13564 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13565 # Currently imperfect due to a flaw in the Parsoid testrunner
13566 # Work in progress
13567 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13568 # image tests.
13569
13570 !! test
13571 Parsoid-specific image handling - simple image with size and middle alignment
13572 !! wikitext
13573 [[File:Foobar.jpg|middle|50px]]
13574 !! html/parsoid
13575 <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>
13576 !! end
13577
13578 !! test
13579 Parsoid-specific image handling - simple image with size, middle alignment,
13580 non-standard namespace alias
13581 !! options
13582 parsoid=wt2wt,wt2html,html2html
13583 !! wikitext
13584 [[Image:Foobar.jpg|middle|50px]]
13585 !! html/parsoid
13586 <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>
13587 !! end
13588
13589 !! test
13590 Parsoid-specific image handling - simple image with size and middle alignment
13591 (existing content)
13592 !! wikitext
13593 [[File:Foobar.jpg|50px|middle]]
13594 !! html/parsoid
13595 <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>
13596 !! end
13597
13598 !! test
13599 Parsoid-specific image handling - simple image with size and middle alignment
13600 and non-standard namespace name
13601 !! options
13602 parsoid=wt2html,wt2wt,html2html
13603 !! wikitext
13604 [[Image:Foobar.jpg|50px|middle]]
13605 !! html/parsoid
13606 <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>
13607 !! end
13608
13609 !! test
13610 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13611 !! wikitext
13612 [[File:Foobar.jpg|500x10px|baseline|caption]]
13613 !! html/parsoid
13614 <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>
13615 !! end
13616
13617 !! test
13618 Parsoid-specific image handling - simple image with border and size spec
13619 !! wikitext
13620 [[File:Foobar.jpg|50px|border|caption]]
13621 !! html/parsoid
13622 <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>
13623 !! end
13624
13625 !! test
13626 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13627 !! wikitext
13628 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13629 !! html/parsoid
13630 <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>
13631 !! end
13632
13633 !! test
13634 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13635 (existing content)
13636 !! wikitext
13637 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13638 !! html/parsoid
13639 <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>
13640 !! end
13641
13642 !! test
13643 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13644 !! wikitext
13645 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13646 !! html/parsoid
13647 <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>
13648 !! end
13649
13650 !! test
13651 Parsoid-specific image handling - thumbnail with specific size, halign,
13652 valign, and caption (existing content)
13653 !! wikitext
13654 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13655 !! html/parsoid
13656 <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>
13657 !! end
13658
13659 !! test
13660 Parsoid-specific image handling - framed image with specific size and caption
13661 (size is ignored)
13662 !! options
13663 parsoid=wt2html,wt2wt,html2html
13664 !! wikitext
13665 [[File:Foobar.jpg|frame|500x50px|caption]]
13666 !! html/parsoid
13667 <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>
13668 !! end
13669
13670 !! test
13671 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13672 (size is ignored)
13673 !! options
13674 parsoid=wt2html,wt2wt,html2html
13675 !! wikitext
13676 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13677 !! html/parsoid
13678 <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>
13679 !! end
13680
13681 !! test
13682 Parsoid-specific image handling - frameless image with specific size, border, and caption
13683 !! wikitext
13684 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13685 !! html/parsoid
13686 <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>
13687 !! end
13688
13689 !! test
13690 Parsoid-specific image handling - simple image with a formatted caption
13691 !! wikitext
13692 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13693 !! html/parsoid
13694 <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>
13695 !! end
13696
13697 !! test
13698 Parsoid-specific image handling - caption with a template in it
13699 !! wikitext
13700 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13701 !! html/parsoid
13702 <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>
13703 !! end
13704
13705 !! test
13706 Parsoid-specific image handling - caption with unbalanced tags in it
13707 !! options
13708 parsoid=wt2html,wt2wt,html2html
13709 !! wikitext
13710 foo
13711 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13712 bar
13713 !! html/parsoid
13714 <p>foo</p>
13715 <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>
13716 <p>bar</p>
13717 !! end
13718
13719 !! test
13720 Parsoid-specific image handling - empty caption (1)
13721 !! options
13722 parsoid=wt2html,wt2wt
13723 !! wikitext
13724 [[File:Foobar.jpg|thumb|]]
13725 !! html/parsoid
13726 <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>
13727 !! end
13728
13729 # empty captions don't get serialized unless we're in the "round trip" case
13730 !! test
13731 Parsoid-specific image handling - empty caption (2)
13732 !! options
13733 parsoid=html2wt
13734 !! html/parsoid
13735 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13736 <a href="./File:Foobar.jpg">
13737 <img resource="./File:Foobar.jpg"
13738 src="//example.com/images/3/3a/Foobar.jpg"
13739 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13740 height="25" width="220"/>
13741 </a>
13742 <figcaption></figcaption>
13743 </figure>
13744 !! wikitext
13745 [[File:Foobar.jpg|thumb]]
13746 !! end
13747
13748 !! test
13749 Parsoid-specific image handling - whitespace caption
13750 !! wikitext
13751 [[File:Foobar.jpg|thumb| ]]
13752 !! html/parsoid
13753 <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>
13754 !! end
13755
13756 !! test
13757 Parsoid-specific image handling - lang option
13758 !! wikitext
13759 foo
13760 [[File:Foobar.svg|lang=de|caption]]
13761 bar
13762 !! html/parsoid
13763 <p>foo
13764 <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>
13765 bar</p>
13766 !! end
13767
13768 ## Edge case bug in Parsoid
13769 !! test
13770 T93580: Templated <ref> inside images
13771 !! wikitext
13772 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13773
13774 <references />
13775 !! html/parsoid
13776 <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>
13777
13778 <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>
13779 !! end
13780
13781 ###
13782 ### Subpages
13783 ###
13784 !! article
13785 Subpage test/subpage
13786 !! text
13787 foo
13788 !! endarticle
13789
13790 !! test
13791 Subpage link
13792 !! options
13793 subpage title=[[Subpage test]]
13794 !! wikitext
13795 [[/subpage]]
13796 !! html
13797 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13798 </p>
13799 !! end
13800
13801 !! test
13802 Subpage noslash link
13803 !! options
13804 subpage title=[[Subpage test]]
13805 !! wikitext
13806 [[/subpage/]]
13807 !! html
13808 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13809 </p>
13810 !! end
13811
13812 !! article
13813 Subpage test/1/2/subpage
13814 !! text
13815 blah
13816 !! endarticle
13817
13818 !! test
13819 Relative subpage noslash link
13820 !! options
13821 parsoid=wt2wt,wt2html,html2html
13822 subpage title=[[Subpage test/1/2/3/4]]
13823 !! wikitext
13824 [[../../subpage/]]
13825
13826 [[../../subpage]]
13827 !! html/php
13828 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13829 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13830 </p>
13831 !! html/parsoid
13832 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13833 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13834 !! end
13835
13836 !! test
13837 Parsoid: dot-slash prefixed wikilinks
13838 !! wikitext
13839 [[./foo]]
13840
13841 [[././bar]]
13842
13843 [[././baz/]]
13844 !! html/php
13845 <p>[[./foo]]
13846 </p><p>[[././bar]]
13847 </p><p>[[././baz/]]
13848 </p>
13849 !! html/parsoid
13850 <p>[[./foo]]
13851 </p><p>[[././bar]]
13852 </p><p>[[././baz/]]
13853 </p>
13854 !! end
13855
13856 !! test
13857 Render invalid page names as plain text (bug 51090)
13858 !! wikitext
13859 [[./../foo|bar]]
13860 [[foo�|bar]]
13861 [[foo/.|bar]]
13862 [[foo/..|bar]]
13863 [[foo~~~bar]]
13864 [[foo>bar]]
13865 [[foo[bar]]
13866 [[.]]
13867 [[..]]
13868 [[foo././bar]]
13869
13870 [[{{echo|./../foo}}|bar]]
13871 [[{{echo|foo/.}}|bar]]
13872 [[{{echo|foo/..}}|bar]]
13873 [[{{echo|foo~~~~bar}}]]
13874 [[{{echo|foo>bar}}]]
13875 [[{{echo|foo././bar}}]]
13876 [[{{echo|foo{bar}}]]
13877 [[{{echo|foo}bar}}]]
13878 [[{{echo|foo[bar}}]]
13879 [[{{echo|foo]bar}}]]
13880 [[{{echo|foo<bar}}]]
13881 !!html/php
13882 <p>[[./../foo|bar]]
13883 [[foo�|bar]]
13884 [[foo/.|bar]]
13885 [[foo/..|bar]]
13886 [[foo~~~bar]]
13887 [[foo&gt;bar]]
13888 [[foo[bar]]
13889 [[.]]
13890 [[..]]
13891 [[foo././bar]]
13892 </p><p>[[./../foo|bar]]
13893 [[foo/.|bar]]
13894 [[foo/..|bar]]
13895 [[foo~~~~bar]]
13896 [[foo&gt;bar]]
13897 [[foo././bar]]
13898 [[foo{bar]]
13899 [[foo}bar]]
13900 [[foo[bar]]
13901 [[foo]bar]]
13902 [[foo&lt;bar]]
13903 </p>
13904 !!html/parsoid
13905 <p>[[./../foo|bar]]
13906 [[foo�|bar]]
13907 [[foo/.|bar]]
13908 [[foo/..|bar]]
13909 [[foo~~~bar]]
13910 [[foo>bar]]
13911 [[foo[bar]]
13912 [[.]]
13913 [[..]]
13914 [[foo././bar]]</p>
13915
13916 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13917 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13918 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13919 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13920 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13921 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13922 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13923 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13924 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13925 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13926 [[<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>
13927 !!end
13928
13929 !! test
13930 Disabled subpages
13931 !! wikitext
13932 [[/subpage]]
13933 !! html
13934 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13935 </p>
13936 !! end
13937
13938 !! test
13939 BUG 561: {{/Subpage}}
13940 !! options
13941 subpage title=[[Page]]
13942 !! wikitext
13943 {{/Subpage}}
13944 !! html
13945 <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>
13946 </p>
13947 !! end
13948
13949 ###
13950 ### Categories
13951 ###
13952 !! article
13953 Category:MediaWiki User's Guide
13954 !! text
13955 blah
13956 !! endarticle
13957
13958 !! test
13959 Link to category
13960 !! wikitext
13961 [[:Category:MediaWiki User's Guide]]
13962 !! html
13963 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13964 </p>
13965 !! end
13966
13967 !! test
13968 Simple category
13969 !! options
13970 cat
13971 !! wikitext
13972 [[Category:MediaWiki User's Guide]]
13973 !! html
13974 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13975 !! end
13976
13977 !! test
13978 PAGESINCATEGORY invalid title fatal (r33546 fix)
13979 !! wikitext
13980 {{PAGESINCATEGORY:<bogus>}}
13981 !! html
13982 <p>0
13983 </p>
13984 !! end
13985
13986 !! test
13987 Category with different sort key
13988 !! options
13989 cat
13990 !! wikitext
13991 [[Category:MediaWiki User's Guide|Foo]]
13992 !! html
13993 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13994 !! end
13995
13996 !! test
13997 Category with identical sort key
13998 !! options
13999 cat
14000 !! wikitext
14001 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14002 !! html
14003 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14004 !! end
14005
14006 !! test
14007 Category with empty sort key
14008 !! options
14009 cat
14010 pst
14011 !! wikitext
14012 [[Category:MediaWiki User's Guide|]]
14013 !! html
14014 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14015 !! end
14016
14017 !! test
14018 Category with empty sort key and parentheses
14019 !! options
14020 cat
14021 pst
14022 !! wikitext
14023 [[Category:Foo (bar)|]]
14024 !! html
14025 [[Category:Foo (bar)|Foo]]
14026 !! end
14027
14028 !! test
14029 Category with link tail
14030 !! options
14031 cat
14032 pst
14033 !! wikitext
14034 123[[Category:Foo]]456
14035 !! html
14036 123[[Category:Foo]]456
14037 !! end
14038
14039 !! test
14040 Category with template
14041 !! options
14042 cat
14043 pst
14044 !! wikitext
14045 [[Category:{{echo|Foo}}]]
14046 !! html
14047 [[Category:{{echo|Foo}}]]
14048 !! end
14049
14050 !! test
14051 Category with template in sort key
14052 !! options
14053 cat
14054 pst
14055 !! wikitext
14056 [[Category:Foo|{{echo|Bar}}]]
14057 !! html
14058 [[Category:Foo|{{echo|Bar}}]]
14059 !! end
14060
14061 !! test
14062 Category with template in sort key and title
14063 !! options
14064 cat
14065 pst
14066 !! wikitext
14067 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14068 !! html
14069 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14070 !! end
14071
14072 !! test
14073 Category / paragraph interactions
14074 !! wikitext
14075 Foo [[Category:Baz]] Bar
14076
14077 Foo [[Category:Baz]]
14078 Bar
14079
14080 Foo
14081 [[Category:Baz]]
14082 Bar
14083
14084 Foo
14085 [[Category:Baz]] Bar
14086
14087 Foo
14088 [[Category:Baz]]
14089 [[Category:Baz]]
14090 [[Category:Baz]]
14091 Bar
14092
14093 [[Category:Baz]]
14094 [[Category:Baz]]
14095 [[Category:Baz]]
14096
14097 [[Category:Baz]]
14098 {{echo|[[Category:Baz]]}}
14099 [[Category:Baz]]
14100 !! html
14101 <p>Foo Bar
14102 </p><p>Foo
14103 Bar
14104 </p><p>Foo
14105 Bar
14106 </p><p>Foo Bar
14107 </p><p>Foo
14108 Bar
14109 </p>
14110 !! end
14111
14112 ## The whitespace on the empty line is part of the test. Please do not delete
14113 !! test
14114 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14115 !! options
14116 parsoid=wt2html,wt2wt
14117 !! wikitext
14118 This
14119
14120 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14121
14122 {{echo|[[Category:Foo]] and so should this!}}
14123 !! html
14124 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14125 </p>
14126 !! html/parsoid
14127 <p>This
14128
14129 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14130
14131 <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>
14132 !! end
14133
14134 ## Parsoid will not try to wt2wt this while preserving newlines because
14135 ## it suppresses excess newlines within list items -- and we don't want to
14136 ## introduce a special case just for categories, which is, in reality somewhat
14137 ## odd behavior -- categories are unlikely to be used in list items like this
14138 ## in top-level pages and are only likely to show up in template-generated
14139 ## list items where this RT-ing is a non-issue.
14140 ##
14141 ## The whitespace on the empty line is part of the test. Please do not delete
14142 !! test
14143 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14144 !! options
14145 parsoid=wt2html
14146 !! wikitext
14147 * This
14148
14149 [[Category:Foo]] and this should be part of the same list item
14150 * So should this
14151
14152 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14153 !! html
14154 <ul><li>This and this should be part of the same list item</li>
14155 <li>So should this and this should be part of the same list item</li></ul>
14156 !! html/parsoid
14157 <ul>
14158 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14159 <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>
14160 </ul>
14161 !! end
14162
14163 ## Newlines and categories that follow the last item of a list
14164 ## are treated differently because this (list followed by categories)
14165 ## is an extremely common pattern on wikis.
14166 !! test
14167 3. Categories and newlines: newline suppression for last list item should RT properly
14168 !! wikitext
14169 * a
14170 * b
14171
14172 [[Category:Foo]]
14173
14174 [[Category:Bar]]
14175 [[Category:Baz]]
14176 !! html/parsoid
14177 <ul><li> a</li>
14178 <li> b</li></ul>
14179
14180 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14181
14182 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14183 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14184 !! end
14185
14186 !! test
14187 4. Categories and newlines: newline suppression for last list item should RT properly
14188 !! wikitext
14189 * a
14190 **** b
14191
14192 [[Category:Foo]]
14193 !! html/parsoid
14194 <ul><li> a
14195 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14196
14197 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14198 !! end
14199
14200 ## only wt2html for this to make sure the algo only applies to the rightmost path
14201 !! test
14202 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14203 !! options
14204 parsoid=wt2html
14205 !! wikitext
14206 * a
14207 ** b
14208 [[Category:Foo]]
14209 * c
14210 ** d
14211 [[Category:Foo]]
14212 !! html/parsoid
14213 <ul><li> a
14214 <ul><li> b
14215 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14216 <li> c
14217 <ul><li> d</li></ul></li></ul>
14218 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14219 !! end
14220
14221 !! test
14222 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14223 !! wikitext
14224 * a [[Category:Foo]]
14225 !! html/parsoid
14226 <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>
14227 !! end
14228
14229 # This test also demonstrates because of newline+category tunneling
14230 # through the list hander, template wrapping doesn't expand to the
14231 # containing list when the list item swallows the category.
14232 !! test
14233 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14234 !! wikitext
14235 * {{echo|a
14236 [[Category:Foo]]}}
14237 !! html/parsoid
14238 <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">
14239 </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>
14240 !! end
14241
14242 !! test
14243 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14244 !! wikitext
14245 * a
14246
14247 {{echo|[[Category:Foo]]
14248 [[Category:Bar]]}}
14249 [[Category:Baz]]
14250 !! html/parsoid
14251 <ul><li> a</li></ul>
14252
14253 <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">
14254 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14255 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14256 !! end
14257
14258 !! test
14259 Parsoid: Serialize link to category page with colon escape
14260 !! options
14261 parsoid
14262 !! wikitext
14263
14264 [[:Category:Foo]]
14265 [[:Category:Foo|Bar]]
14266 !! html
14267 <p>
14268 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14269 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14270 </p>
14271 !! end
14272
14273 # html2wt localizes the "Category" namespace.
14274 # XXX the <link> element needs an empty data-parsoid attribute, or
14275 # else the html2html test fails because spaces are inserted.
14276 !! test
14277 Link prefix/suffixes aren't applied to category links
14278 !! options
14279 parsoid=wt2html,wt2wt,html2html
14280 language=is
14281 !! wikitext
14282 x[[Category:Foo]]y
14283 !! html/php
14284 <p>xy
14285 </p>
14286 !! html/parsoid
14287 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14288 !! end
14289
14290 !! test
14291 Parsoid: Serialize link to file page with colon escape
14292 !! options
14293 parsoid
14294 !! wikitext
14295
14296 [[:File:Foo.png]]
14297 [[:File:Foo.png|Bar]]
14298 !! html
14299 <p>
14300 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14301 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14302 </p>
14303 !! end
14304
14305 !! test
14306 Parsoid: Serialize a genuine category link without colon escape
14307 !! options
14308 parsoid
14309 !! wikitext
14310 [[Category:Foo]]
14311 [[Category:Foo|Bar]]
14312 !! html
14313 <link rel="mw:PageProp/Category" href="./Category:Foo">
14314 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14315 !! end
14316
14317 !! test
14318 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14319 !! options
14320 parsoid=html2wt
14321 !! html/parsoid
14322 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14323 !! wikitext
14324 [[Category:Toxine bactérienne]]
14325 !! end
14326
14327 !! test
14328 Parsoid: Defaultsort
14329 !! wikitext
14330 {{DEFAULTSORT:Foo}}
14331 !! html/parsoid
14332 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14333 !! end
14334
14335 !! test
14336 Parsoid: Defaultsort (template-generated)
14337 !! wikitext
14338 {{{{echo|DEFAULTSORT}}:Foo}}
14339 !! html/parsoid
14340 <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}}]}'/>
14341 !! end
14342
14343 ###
14344 ### Inter-language links
14345 ###
14346 !! test
14347 Interlanguage links
14348 !! options
14349 ill
14350 !! wikitext
14351 [[es:Alimento]]
14352 [[fr:Nourriture]]
14353 [[zh:食品]]
14354 !! html/php
14355 es:Alimento fr:Nourriture zh:食品
14356 !! html/parsoid
14357 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14358 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14359 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14360 !! end
14361
14362 !! test
14363 Duplicate interlanguage links (bug 24502)
14364 !! options
14365 ill
14366 !! wikitext
14367 [[es:1]]
14368 [[es:2]]
14369 [[fr:1]]
14370 [[fr:2]]
14371 !! html/php
14372 es:1 fr:1
14373 !! html/parsoid
14374 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14375 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14376 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14377 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14378 !! end
14379
14380 ###
14381 ### Sections
14382 ###
14383 !! test
14384 Basic section headings
14385 !! wikitext
14386 == Headline 1 ==
14387 Some text
14388
14389 ==Headline 2==
14390 More
14391 ===Smaller headline===
14392 Blah blah
14393 !! html
14394 <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>
14395 <p>Some text
14396 </p>
14397 <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>
14398 <p>More
14399 </p>
14400 <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>
14401 <p>Blah blah
14402 </p>
14403 !! end
14404
14405 !! test
14406 Section headings with TOC
14407 !! wikitext
14408 == Headline 1 ==
14409 === Subheadline 1 ===
14410 ===== Skipping a level =====
14411 ====== Skipping a level ======
14412
14413 == Headline 2 ==
14414 Some text
14415 ===Another headline===
14416 !! html
14417 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14418 <ul>
14419 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14420 <ul>
14421 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14422 <ul>
14423 <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>
14424 <ul>
14425 <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>
14426 </ul>
14427 </li>
14428 </ul>
14429 </li>
14430 </ul>
14431 </li>
14432 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14433 <ul>
14434 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14435 </ul>
14436 </li>
14437 </ul>
14438 </div>
14439
14440 <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>
14441 <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>
14442 <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>
14443 <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>
14444 <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>
14445 <p>Some text
14446 </p>
14447 <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>
14448
14449 !! end
14450
14451 !! test
14452 TOC anchors don't collide
14453 !! wikitext
14454 __FORCETOC__
14455 == Headline 2 ==
14456 == Headline ==
14457 == Headline 2 ==
14458 == Headline ==
14459 !! html/php
14460 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14461 <ul>
14462 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14463 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14464 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14465 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14466 </ul>
14467 </div>
14468
14469 <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>
14470 <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>
14471 <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>
14472 <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>
14473
14474 !! end
14475
14476 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14477 !! test
14478 Handling of sections up to level 6 and beyond
14479 !! wikitext
14480 = Level 1 Heading=
14481 == Level 2 Heading==
14482 === Level 3 Heading===
14483 ==== Level 4 Heading====
14484 ===== Level 5 Heading=====
14485 ====== Level 6 Heading======
14486 ======= Level 7 Heading=======
14487 ======== Level 8 Heading========
14488 ========= Level 9 Heading=========
14489 ========== Level 10 Heading==========
14490 !! html
14491 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14492 <ul>
14493 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14494 <ul>
14495 <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>
14496 <ul>
14497 <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>
14498 <ul>
14499 <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>
14500 <ul>
14501 <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>
14502 <ul>
14503 <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>
14504 <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>
14505 <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>
14506 <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>
14507 <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>
14508 </ul>
14509 </li>
14510 </ul>
14511 </li>
14512 </ul>
14513 </li>
14514 </ul>
14515 </li>
14516 </ul>
14517 </li>
14518 </ul>
14519 </div>
14520
14521 <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>
14522 <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>
14523 <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>
14524 <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>
14525 <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>
14526 <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>
14527 <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>
14528 <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>
14529 <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>
14530 <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>
14531
14532 !! end
14533
14534 !! test
14535 TOC regression (T11764)
14536 !! wikitext
14537 == title 1 ==
14538 === title 1.1 ===
14539 ==== title 1.1.1 ====
14540 === title 1.2 ===
14541 == title 2 ==
14542 === title 2.1 ===
14543 !! html
14544 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14545 <ul>
14546 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14547 <ul>
14548 <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>
14549 <ul>
14550 <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>
14551 </ul>
14552 </li>
14553 <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>
14554 </ul>
14555 </li>
14556 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14557 <ul>
14558 <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>
14559 </ul>
14560 </li>
14561 </ul>
14562 </div>
14563
14564 <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>
14565 <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>
14566 <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>
14567 <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>
14568 <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>
14569 <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>
14570
14571 !! end
14572
14573 !! test
14574 TOC for heading containing <span id="..."></span> (T96153)
14575 !! wikitext
14576 __FORCETOC__
14577 ==<span id="old-anchor"></span>New title==
14578 !! html/php
14579 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14580 <ul>
14581 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14582 </ul>
14583 </div>
14584
14585 <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>
14586
14587 !! end
14588
14589 !! test
14590 TOC with wgMaxTocLevel=3 (bug 6204)
14591 !! options
14592 wgMaxTocLevel=3
14593 !! wikitext
14594 == title 1 ==
14595 === title 1.1 ===
14596 ==== title 1.1.1 ====
14597 === title 1.2 ===
14598 == title 2 ==
14599 === title 2.1 ===
14600 !! html
14601 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14602 <ul>
14603 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14604 <ul>
14605 <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>
14606 <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>
14607 </ul>
14608 </li>
14609 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14610 <ul>
14611 <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>
14612 </ul>
14613 </li>
14614 </ul>
14615 </div>
14616
14617 <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>
14618 <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>
14619 <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>
14620 <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>
14621 <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>
14622 <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>
14623
14624 !! end
14625
14626 !! test
14627 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14628 !! options
14629 wgMaxTocLevel=3
14630 !! wikitext
14631 ==Section 1==
14632 ===Section 1.1===
14633 ====Section 1.1.1====
14634 ====Section 1.1.1.1====
14635 ==Section 2==
14636 !! html
14637 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14638 <ul>
14639 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14640 <ul>
14641 <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>
14642 </ul>
14643 </li>
14644 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14645 </ul>
14646 </div>
14647
14648 <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>
14649 <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>
14650 <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>
14651 <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>
14652 <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>
14653
14654 !! end
14655
14656
14657 !! test
14658 Resolving duplicate section names
14659 !! wikitext
14660 == Foo bar ==
14661 == Foo bar ==
14662 !! html
14663 <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>
14664 <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>
14665
14666 !! end
14667
14668 !! test
14669 Resolving duplicate section names with differing case (bug 10721)
14670 !! wikitext
14671 == Foo bar ==
14672 == Foo Bar ==
14673 !! html
14674 <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>
14675 <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>
14676
14677 !! end
14678
14679 !! article
14680 Template:sections
14681 !! text
14682 ===Section 1===
14683 ==Section 2==
14684 !! endarticle
14685
14686 !! test
14687 Template with sections, __NOTOC__
14688 !! wikitext
14689 __NOTOC__
14690 ==Section 0==
14691 {{sections}}
14692 ==Section 4==
14693 !! html
14694 <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>
14695 <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>
14696 <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>
14697 <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>
14698
14699 !! end
14700
14701 !! test
14702 __NOEDITSECTION__ keyword
14703 !! wikitext
14704 __NOEDITSECTION__
14705 ==Section 1==
14706 ==Section 2==
14707 !! html
14708 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14709 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14710
14711 !! end
14712
14713 !! test
14714 Link inside a section heading
14715 !! wikitext
14716 ==Section with a [[Main Page|link]] in it==
14717 !! html
14718 <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>
14719
14720 !! end
14721
14722 !! test
14723 TOC regression (T14077)
14724 !! wikitext
14725 __TOC__
14726 == title 1 ==
14727 === title 1.1 ===
14728 == title 2 ==
14729 !! html
14730 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14731 <ul>
14732 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14733 <ul>
14734 <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>
14735 </ul>
14736 </li>
14737 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14738 </ul>
14739 </div>
14740
14741 <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>
14742 <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>
14743 <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>
14744
14745 !! end
14746
14747 !! test
14748 BUG 1219 URL next to image (good)
14749 !! wikitext
14750 http://example.com [[File:Foobar.jpg]]
14751 !! html/php
14752 <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>
14753 </p>
14754 !! html/parsoid
14755 <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>
14756 !!end
14757
14758 !! test
14759 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14760 !! wikitext
14761 ===
14762 The line above must have a trailing space!
14763 === <!--
14764 --> <!-- -->
14765 But just in case it doesn't...
14766 !! html
14767 <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>
14768 <p>The line above must have a trailing space!
14769 </p>
14770 <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>
14771 <p>But just in case it doesn't...
14772 </p>
14773 !! end
14774
14775 !! test
14776 Header with special characters (bug 25462)
14777 !! wikitext
14778 The tooltips shall not show entities to the user (ie. be double escaped)
14779
14780 == text > text ==
14781 section 1
14782
14783 == text < text ==
14784 section 2
14785
14786 == text & text ==
14787 section 3
14788
14789 == text ' text ==
14790 section 4
14791
14792 == text " text ==
14793 section 5
14794 !! html
14795 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14796 </p>
14797 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14798 <ul>
14799 <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>
14800 <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>
14801 <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>
14802 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14803 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14804 </ul>
14805 </div>
14806
14807 <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>
14808 <p>section 1
14809 </p>
14810 <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>
14811 <p>section 2
14812 </p>
14813 <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>
14814 <p>section 3
14815 </p>
14816 <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>
14817 <p>section 4
14818 </p>
14819 <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>
14820 <p>section 5
14821 </p>
14822 !! end
14823
14824 !! test
14825 Header with space, plus and underscore as entity
14826 !! wikitext
14827 Id should not contain + for spaces
14828
14829 == Space between Text ==
14830 section 1
14831
14832 == Space-Entity&#32;between&#32;Text ==
14833 section 2
14834
14835 == Plus+between+Text ==
14836 section 3
14837
14838 == Plus-Entity&#43;between&#43;Text ==
14839 section 4
14840
14841 == Underscore_between_Text ==
14842 section 5
14843
14844 == Underscore-Entity&#95;between&#95;Text ==
14845 section 6
14846
14847 [[#Space between Text]]
14848 [[#Space-Entity&#32;between&#32;Text]]
14849 [[#Plus+between+Text]]
14850 [[#Plus-Entity&#43;between&#43;Text]]
14851 [[#Underscore_between_Text]]
14852 [[#Underscore-Entity&#95;between&#95;Text]]
14853 !! html
14854 <p>Id should not contain + for spaces
14855 </p>
14856 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14857 <ul>
14858 <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>
14859 <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>
14860 <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>
14861 <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>
14862 <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>
14863 <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>
14864 </ul>
14865 </div>
14866
14867 <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>
14868 <p>section 1
14869 </p>
14870 <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>
14871 <p>section 2
14872 </p>
14873 <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>
14874 <p>section 3
14875 </p>
14876 <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>
14877 <p>section 4
14878 </p>
14879 <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>
14880 <p>section 5
14881 </p>
14882 <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>
14883 <p>section 6
14884 </p><p><a href="#Space_between_Text">#Space between Text</a>
14885 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14886 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14887 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14888 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14889 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14890 </p>
14891 !! end
14892
14893 !! test
14894 Headers with excess '=' characters
14895 (Are similar tests necessary beyond the 1st level?)
14896 !! wikitext
14897 =foo==
14898 ==foo=
14899 =''italic'' heading==
14900 ==''italic'' heading=
14901 !! html
14902 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14903 <ul>
14904 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14905 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14906 <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>
14907 <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>
14908 </ul>
14909 </div>
14910
14911 <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>
14912 <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>
14913 <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>
14914 <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>
14915
14916 !! end
14917
14918 !! test
14919 HTML headers vs TOC (bug 23393)
14920 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14921 !! wikitext
14922 <h1>Header 1</h1>
14923 == Header 1.1 ==
14924 == Header 1.2 ==
14925
14926 <h1>Header 2
14927 </h1>
14928 == Header 2.1 ==
14929 == Header 2.2 ==
14930 __NOEDITSECTION__
14931 !! html
14932 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14933 <ul>
14934 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14935 <ul>
14936 <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>
14937 <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>
14938 </ul>
14939 </li>
14940 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14941 <ul>
14942 <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>
14943 <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>
14944 </ul>
14945 </li>
14946 </ul>
14947 </div>
14948
14949 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14950 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14951 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14952 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14953 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14954 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14955
14956 !! end
14957
14958 !! test
14959 Single-line or multiline-comments can follow headings
14960 !! options
14961 parsoid=wt2html,wt2wt
14962 !! wikitext
14963 ==foo==<!---->
14964 ==bar==<!--c1-->
14965 ==baz==<!--
14966 c2
14967 c3-->
14968 !! html
14969 <h2><span class="mw-headline" id="foo">foo</span></h2>
14970 <h2><span class="mw-headline" id="bar">bar</span></h2>
14971 <h2><span class="mw-headline" id="baz">baz</span></h2>
14972
14973 !! end
14974
14975 !! test
14976 BUG 1219 URL next to image (broken)
14977 !! wikitext
14978 http://example.com[[File:Foobar.jpg]]
14979 !! html/php
14980 <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>
14981 </p>
14982 !! html/parsoid
14983 <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>
14984 !!end
14985
14986 !! test
14987 Bug 1186 news: in the middle of text
14988 !! wikitext
14989 http://en.wikinews.org/wiki/Wikinews:Workplace
14990 !! html
14991 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14992 </p>
14993 !!end
14994
14995
14996 !! test
14997 Namespaced link must have a title
14998 !! wikitext
14999 [[Project:]]
15000 !! html
15001 <p>[[Project:]]
15002 </p>
15003 !!end
15004
15005 !! test
15006 Namespaced link must have a title (bad fragment version)
15007 !! wikitext
15008 [[Project:#fragment]]
15009 !! html
15010 <p>[[Project:#fragment]]
15011 </p>
15012 !!end
15013
15014
15015 ###
15016 ### HTML tags and HTML attributes
15017 ###
15018
15019 !! test
15020 div with no attributes
15021 !! wikitext
15022 <div>HTML rocks</div>
15023 !! html
15024 <div>HTML rocks</div>
15025
15026 !! end
15027
15028 !! test
15029 div with double-quoted attribute
15030 !! wikitext
15031 <div id="rock">HTML rocks</div>
15032 !! html
15033 <div id="rock">HTML rocks</div>
15034
15035 !! end
15036
15037 !! test
15038 div with single-quoted attribute
15039 !! wikitext
15040 <div id='rock'>HTML rocks</div>
15041 !! html
15042 <div id="rock">HTML rocks</div>
15043
15044 !! end
15045
15046 !! test
15047 div with unquoted attribute
15048 !! wikitext
15049 <div id=rock>HTML rocks</div>
15050 !! html
15051 <div id="rock">HTML rocks</div>
15052
15053 !! end
15054
15055 !! test
15056 div with illegal double attributes
15057 !! wikitext
15058 <div id="a" id="b">HTML rocks</div>
15059 !! html
15060 <div id="b">HTML rocks</div>
15061
15062 !!end
15063
15064 # FIXME: produce empty string instead of "class" in the PHP parser, following
15065 # the HTML5 spec.
15066 !! test
15067 div with empty attribute value, space before equals
15068 !! options
15069 parsoid
15070 !! wikitext
15071 <div class =>HTML rocks</div>
15072 !! html
15073 <div class="">HTML rocks</div>
15074
15075 !! end
15076
15077 !! test
15078 div with multiple empty attribute values
15079 !! options
15080 parsoid
15081 !! wikitext
15082 <div id= title=>HTML rocks</div>
15083 !! html
15084 <div id="" title="">HTML rocks</div>
15085
15086 !! end
15087
15088 !! test
15089 table with multiple empty attribute values
15090 !! options
15091 parsoid
15092 !! wikitext
15093 {| title= id=
15094 | hi
15095 |}
15096 !! html
15097 <table title="" id="">
15098 <tbody><tr><td> hi</td></tr>
15099 </tbody></table>
15100 !! end
15101
15102 !! test
15103 div with braces in attribute value
15104 !! wikitext
15105 <div title="{}">Foo</div>
15106 !! html/php
15107 <div title="&#123;}">Foo</div>
15108
15109 !! html/parsoid
15110 <div title="{}">Foo</div>
15111 !! end
15112
15113 # This it very inconsistent in the PHP parser: it returns
15114 # class="class" if there is a space between the name and the equal sign (see
15115 # 'div with empty attribute value, space before equals'), but strips the
15116 # attribute completely if the space is missing. We hope that not much content
15117 # depends on this, so are implementing the behavior below in Parsoid for
15118 # consistencies' sake.
15119 # FIXME: fix this behavior in the PHP parser?
15120 !! test
15121 div with empty attribute value, no space before equals
15122 !! options
15123 parsoid=wt2html,html2html
15124 !! wikitext
15125 <div class=>HTML rocks</div>
15126 !! html/php
15127 <div>HTML rocks</div>
15128
15129 !! html/parsoid
15130 <div class="">HTML rocks</div>
15131 !! end
15132
15133 !! test
15134 HTML multiple attributes correction
15135 !! wikitext
15136 <p class="error" class="awesome">Awesome!</p>
15137 !! html
15138 <p class="awesome">Awesome!</p>
15139
15140 !!end
15141
15142 !! test
15143 Table multiple attributes correction
15144 !! wikitext
15145 {|
15146 !+ class="error" class="awesome"| status
15147 |}
15148 !! html
15149 <table>
15150 <tr>
15151 <th class="awesome"> status
15152 </th></tr></table>
15153
15154 !!end
15155
15156 !! test
15157 DIV IN UPPERCASE
15158 !! wikitext
15159 <DIV ID="x">HTML ROCKS</DIV>
15160 !! html
15161 <div id="x">HTML ROCKS</div>
15162
15163 !!end
15164
15165 !! test
15166 Non-ASCII pseudo-tags are rendered as text
15167 !! wikitext
15168 <khyô>
15169 !! html
15170 <p>&lt;khyô&gt;
15171 </p>
15172 !! end
15173
15174 !! test
15175 Pseudo-tag with URL 'name' renders as url link
15176 !! wikitext
15177 <http://example.com/>
15178 !! html
15179 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15180 </p>
15181 !! end
15182
15183 !! test
15184 text with amp in the middle of nowhere
15185 !! wikitext
15186 Remember AT&T?
15187 !! html
15188 <p>Remember AT&amp;T?
15189 </p>
15190 !! end
15191
15192 !! test
15193 text with character entity: eacute
15194 !! wikitext
15195 I always thought &eacute; was a cute letter.
15196 !! html
15197 <p>I always thought &#233; was a cute letter.
15198 </p>
15199 !! html+tidy
15200 <p>I always thought é was a cute letter.</p>
15201 !! end
15202
15203 !! test
15204 text with entity-escaped character entity-like string: eacute
15205 !! wikitext
15206 I always thought &amp;eacute; was a cute letter.
15207 !! html
15208 <p>I always thought &amp;eacute; was a cute letter.
15209 </p>
15210 !! end
15211
15212 !! test
15213 text with undefined character entity: xacute
15214 !! wikitext
15215 I always thought &xacute; was a cute letter.
15216 !! html
15217 <p>I always thought &amp;xacute; was a cute letter.
15218 </p>
15219 !! end
15220
15221 !! test
15222 HTML5 tags
15223 !! wikitext
15224 <data value="5">five</data>
15225 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15226 <mark>This highlighted text</mark>
15227 !! html
15228 <p><data value="5">five</data>
15229 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15230 <mark>This highlighted text</mark>
15231 </p>
15232 !! end
15233
15234 !! test
15235 HTML tag with leading space is parsed as text
15236 !! wikitext
15237 < div>foo< /div>
15238 !! html
15239 <p>&lt; div&gt;foo&lt; /div&gt;
15240 </p>
15241 !! end
15242
15243 ###
15244 ### Nesting tests (see bug 41545, 50604, 51081)
15245 ###
15246
15247 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15248 # Note that html2wt is considerably more difficult if we use <b> in
15249 # the test case, instead of <big>
15250 !! test
15251 Ensure that HTML adoption agency algorithm is properly implemented.
15252 !! wikitext
15253 <big>X<big>Y</big>Z</big>
15254 !! html
15255 <p><big>X<big>Y</big>Z</big>
15256 </p>
15257 !! end
15258
15259 # This was bug 41545 in the PHP parser.
15260 # Note that tidy doesn't handle this correctly.
15261 !! test
15262 Nesting of <kbd>
15263 !! wikitext
15264 <kbd>X<kbd>Y</kbd>Z</kbd>
15265 !! html
15266 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15267 </p>
15268 !! end
15269
15270 # The following cases were bug 51081 in the PHP parser.
15271 # Note that there are some other nestable tags (b, i, etc) which are
15272 # not covered; see bug 51081 for discussion.
15273
15274 # Note that tidy doesn't handle this correctly.
15275 !! test
15276 Nesting of <em>
15277 !! wikitext
15278 <em>X<em>Y</em>Z</em>
15279 !! html
15280 <p><em>X<em>Y</em>Z</em>
15281 </p>
15282 !! end
15283
15284 # Note that tidy doesn't handle this correctly.
15285 !! test
15286 Nesting of <strong>
15287 !! wikitext
15288 <strong>X<strong>Y</strong>Z</strong>
15289 !! html
15290 <p><strong>X<strong>Y</strong>Z</strong>
15291 </p>
15292 !! end
15293
15294 !! test
15295 Nesting of <q>
15296 !! wikitext
15297 <q>X<q>Y</q>Z</q>
15298 !! html+tidy
15299 <p><q>X<q>Y</q>Z</q></p>
15300 !! end
15301
15302 # Note that tidy doesn't handle this correctly.
15303 !! test
15304 Nesting of <ruby>
15305 !! wikitext
15306 <ruby>X<ruby>Y</ruby>Z</ruby>
15307 !! html
15308 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15309 </p>
15310 !! end
15311
15312 # Note that tidy doesn't handle this correctly.
15313 !! test
15314 Nesting of <bdo>
15315 !! wikitext
15316 <bdo>X<bdo>Y</bdo>Z</bdo>
15317 !! html
15318 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15319 </p>
15320 !! end
15321
15322
15323 ###
15324 ### Media links
15325 ###
15326
15327 !! test
15328 Media link
15329 !! wikitext
15330 [[Media:Foobar.jpg]]
15331 !! html
15332 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15333 </p>
15334 !! end
15335
15336 !! test
15337 Media link with text
15338 !! wikitext
15339 [[Media:Foobar.jpg|A neat file to look at]]
15340 !! html
15341 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15342 </p>
15343 !! end
15344
15345 # FIXME: this is still bad HTML tag nesting
15346 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15347 !! test
15348 Media link with nasty text
15349 !! wikitext
15350 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15351 !! html
15352 <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>
15353
15354 !! html+tidy
15355 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15356 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15357 !! end
15358
15359 !! test
15360 Media link to nonexistent file (bug 1702)
15361 !! wikitext
15362 [[Media:No such.jpg]]
15363 !! html
15364 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15365 </p>
15366 !! end
15367
15368 !! test
15369 Image link to nonexistent file (bug 1850 - good)
15370 !! wikitext
15371 [[File:No_such.jpg]]
15372 !! html/php
15373 <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>
15374 </p>
15375 !! html/parsoid
15376 <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>
15377 !! end
15378
15379 !! test
15380 :Image link to nonexistent file (bug 1850 - bad)
15381 !! wikitext
15382 [[:Image:No such.jpg]]
15383 !! html/php
15384 <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>
15385 </p>
15386 !! html/parsoid
15387 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15388 !! end
15389
15390
15391
15392 !! test
15393 Character reference normalization in link text (bug 1938)
15394 !! wikitext
15395 [[Main Page|this&that]]
15396 !! html
15397 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15398 </p>
15399 !!end
15400
15401 !! article
15402 אַ
15403 !! text
15404 Test for unicode normalization
15405
15406 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15407 !! endarticle
15408
15409 !! test
15410 (bug 19451) Links should refer to the normalized form.
15411 !! wikitext
15412 [[&#xFB2E;]]
15413 [[&#x5d0;&#x5b7;]]
15414 [[&#x5d0;ַ]]
15415 [[א&#x5b7;]]
15416 [[אַ]]
15417 !! html
15418 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15419 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15420 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15421 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15422 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15423 </p>
15424 !! end
15425
15426 !! test
15427 Empty attribute crash test (bug 2067)
15428 !! wikitext
15429 <font color="">foo</font>
15430 !! html
15431 <p><font color="">foo</font>
15432 </p>
15433 !! end
15434
15435 !! test
15436 Empty attribute crash test single-quotes (bug 2067)
15437 !! wikitext
15438 <font color=''>foo</font>
15439 !! html
15440 <p><font color="">foo</font>
15441 </p>
15442 !! end
15443
15444 !! test
15445 Attribute test: equals, then nothing
15446 !! wikitext
15447 <font color=>foo</font>
15448 !! html
15449 <p><font>foo</font>
15450 </p>
15451 !! end
15452
15453 !! test
15454 Attribute test: unquoted value
15455 !! wikitext
15456 <font color=x>foo</font>
15457 !! html
15458 <p><font color="x">foo</font>
15459 </p>
15460 !! end
15461
15462 !! test
15463 Attribute test: unquoted but illegal value (hash)
15464 !! wikitext
15465 <font color=#x>foo</font>
15466 !! html
15467 <p><font color="#x">foo</font>
15468 </p>
15469 !! end
15470
15471 # Parsoid does not serialize to empty attribute syntax,
15472 # so wt2wt and html2wt cases are skipped
15473 !! test
15474 Attribute test: no value (T54330)
15475 !! options
15476 parsoid=wt2html,html2html
15477 !! wikitext
15478 <font color>foo</font>
15479 !! html/php
15480 <p><font color="">foo</font>
15481 </p>
15482 !! html/parsoid
15483 <p><font color="">foo</font></p>
15484 !! end
15485
15486 !! test
15487 Bug 2095: link with three closing brackets
15488 !! wikitext
15489 [[Main Page]]]
15490 !! html/php
15491 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15492 </p>
15493 !! html/parsoid
15494 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15495 !! end
15496
15497 !! test
15498 Bug 2095: link with pipe and three closing brackets
15499 !! wikitext
15500 [[Main Page|link]]]
15501 !! html/php
15502 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15503 </p>
15504 !! html/parsoid
15505 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15506 !! end
15507
15508 !! test
15509 Bug 2095: link with pipe and three closing brackets, version 2
15510 !! wikitext
15511 [[Main Page|[http://example.com/]]]
15512 !! html/php
15513 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15514 </p>
15515 !! html/parsoid
15516 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15517 !! end
15518
15519
15520 ###
15521 ### Safety
15522 ###
15523
15524 !! article
15525 Template:Dangerous attribute
15526 !! text
15527 " onmouseover="alert(document.cookie)
15528 !! endarticle
15529
15530 !! article
15531 Template:Dangerous style attribute
15532 !! text
15533 border-size: expression(alert(document.cookie))
15534 !! endarticle
15535
15536 !! article
15537 Template:Div style
15538 !! text
15539 <div style="float: right; {{{1}}}">Magic div</div>
15540 !! endarticle
15541
15542 !! test
15543 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15544 !! wikitext
15545 <div title="{{test}}"></div>
15546 !! html
15547 <div title="This is a test template"></div>
15548
15549 !! end
15550
15551 # Parsoid has enough context to handle this case
15552 !! test
15553 Bug 2304: HTML attribute safety (dangerous template; 2309)
15554 !! wikitext
15555 <div title="{{dangerous attribute}}"></div>
15556 !! html/php
15557 <div title=""></div>
15558
15559 !! html/parsoid
15560 <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>
15561 !! end
15562
15563 !! test
15564 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15565 !! wikitext
15566 <div style="{{dangerous style attribute}}"></div>
15567 !! html
15568 <div style="/* insecure input */"></div>
15569
15570 !! end
15571
15572 !! test
15573 Bug 2304: HTML attribute safety (safe parameter; 2309)
15574 !! wikitext
15575 {{div style|width: 200px}}
15576 !! html
15577 <div style="float: right; width: 200px">Magic div</div>
15578
15579 !! end
15580
15581 !! test
15582 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15583 !! wikitext
15584 {{div style|width: expression(alert(document.cookie))}}
15585 !! html
15586 <div style="/* insecure input */">Magic div</div>
15587
15588 !! end
15589
15590 !! test
15591 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15592 !! wikitext
15593 {{div style|"><script>alert(document.cookie)</script>}}
15594 !! html
15595 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15596
15597 !! end
15598
15599 !! test
15600 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15601 !! wikitext
15602 {{div style|" ><script>alert(document.cookie)</script>}}
15603 !! html
15604 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15605
15606 !! end
15607
15608 !! test
15609 Bug 2304: HTML attribute safety (link)
15610 !! wikitext
15611 <div title="[[Main Page]]"></div>
15612 !! html
15613 <div title="&#91;&#91;Main Page]]"></div>
15614
15615 !! end
15616
15617 !! test
15618 Bug 2304: HTML attribute safety (italics)
15619 !! wikitext
15620 <div title="''foobar''"></div>
15621 !! html
15622 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15623
15624 !! end
15625
15626 !! test
15627 Bug 2304: HTML attribute safety (bold)
15628 !! wikitext
15629 <div title="'''foobar'''"></div>
15630 !! html
15631 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15632
15633 !! end
15634
15635
15636 !! test
15637 Bug 2304: HTML attribute safety (ISBN)
15638 !! wikitext
15639 <div title="ISBN 1234567890"></div>
15640 !! html
15641 <div title="&#73;SBN 1234567890"></div>
15642
15643 !! end
15644
15645 !! test
15646 Bug 2304: HTML attribute safety (RFC)
15647 !! wikitext
15648 <div title="RFC 1234"></div>
15649 !! html
15650 <div title="&#82;FC 1234"></div>
15651
15652 !! end
15653
15654 !! test
15655 Bug 2304: HTML attribute safety (PMID)
15656 !! wikitext
15657 <div title="PMID 1234567890"></div>
15658 !! html
15659 <div title="&#80;MID 1234567890"></div>
15660
15661 !! end
15662
15663 !! test
15664 Bug 2304: HTML attribute safety (web link)
15665 !! wikitext
15666 <div title="http://example.com/"></div>
15667 !! html
15668 <div title="http&#58;//example.com/"></div>
15669
15670 !! end
15671
15672 !! test
15673 Bug 2304: HTML attribute safety (named web link)
15674 !! wikitext
15675 <div title="[http://example.com/ link]"></div>
15676 !! html
15677 <div title="&#91;http&#58;//example.com/ link]"></div>
15678
15679 !! end
15680
15681 !! test
15682 Bug 3244: HTML attribute safety (extension; safe)
15683 !! wikitext
15684 <div style="<nowiki>background:blue</nowiki>"></div>
15685 !! html
15686 <div style="background:blue"></div>
15687
15688 !! end
15689
15690 !! test
15691 Bug 3244: HTML attribute safety (extension; unsafe)
15692 !! wikitext
15693 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15694 !! html
15695 <div style="/* insecure input */"></div>
15696
15697 !! end
15698
15699 # More MSIE fun discovered by Tom Gilder
15700
15701 !! test
15702 MSIE CSS safety test: spurious slash
15703 !! wikitext
15704 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15705 !! html
15706 <div style="/* insecure input */">evil</div>
15707
15708 !! end
15709
15710 !! test
15711 MSIE CSS safety test: hex code
15712 !! wikitext
15713 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15714 !! html
15715 <div style="/* insecure input */">evil</div>
15716
15717 !! end
15718
15719 !! test
15720 MSIE CSS safety test: comment in url
15721 !! wikitext
15722 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15723 !! html
15724 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15725
15726 !! end
15727
15728 !! test
15729 MSIE CSS safety test: comment in expression
15730 !! wikitext
15731 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15732 !! html
15733 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15734
15735 !! end
15736
15737 !! test
15738 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15739 !! wikitext
15740 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15741 !! html
15742 <p style="/* invalid control char */">A</p>
15743
15744 !! end
15745
15746 !! test
15747 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15748 !! wikitext
15749 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15750 <div style="top:EXPRESSION(alert())">B</div>
15751 !! html
15752 <p style="/* insecure input */">A</p>
15753 <div style="/* insecure input */">B</div>
15754
15755 !! end
15756
15757 !! test
15758 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15759 !! wikitext
15760 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15761 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15762 !! html
15763 <div style="/* insecure input */">A</div>
15764 <p style="/* insecure input */">B</p>
15765
15766 !! end
15767
15768 !! test
15769 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15770 !! wikitext
15771 <div style="background-image:url⁽javascript:alert())">A</div>
15772 <div style="background-image:url₍javascript:alert())">B</div>
15773 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15774 !! html
15775 <div style="/* insecure input */">A</div>
15776 <div style="/* insecure input */">B</div>
15777 <p style="/* insecure input */">C</p>
15778
15779 !! end
15780
15781 !! test
15782 Opera -o-link CSS
15783 !! wikitext
15784 <div
15785 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;"
15786 style="-o-link:attr(title);-o-link-source:current">X</div>
15787 !! html
15788 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15789
15790 !! end
15791
15792 !! test
15793 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15794 !! wikitext
15795 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15796 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15797 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15798 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15799 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15800 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15801 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15802 !! html
15803 <p style="/* insecure input */">A</p>
15804 <p style="/* insecure input */">B</p>
15805 <p style="/* insecure input */">C</p>
15806 <p style="/* insecure input */">D</p>
15807 <p style="/* insecure input */">E</p>
15808 <p style="/* insecure input */">F</p>
15809 <p style="/* insecure input */">G</p>
15810
15811 !! end
15812
15813 !! test
15814 Table attribute legitimate extension
15815 !! wikitext
15816 {|
15817 !+ style="<nowiki>color:blue</nowiki>"| status
15818 |}
15819 !! html
15820 <table>
15821 <tr>
15822 <th style="color:blue"> status
15823 </th></tr></table>
15824
15825 !!end
15826
15827 !! test
15828 Table attribute safety
15829 !! wikitext
15830 {|
15831 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15832 |}
15833 !! html
15834 <table>
15835 <tr>
15836 <th style="/* insecure input */"> status
15837 </th></tr></table>
15838
15839 !! end
15840
15841 !! test
15842 CSS line continuation 1
15843 !! wikitext
15844 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15845 !! html
15846 <div style="/* insecure input */"></div>
15847
15848 !! end
15849
15850 !! test
15851 CSS line continuation 2
15852 !! wikitext
15853 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15854 !! html
15855 <div style="/* invalid control char */"></div>
15856
15857 !! end
15858
15859 !! article
15860 Template:Identity
15861 !! text
15862 {{{1}}}
15863 !! endarticle
15864
15865 !! test
15866 Expansion of multi-line templates in attribute values (bug 6255)
15867 !! wikitext
15868 <div style="background: {{identity|#00FF00}}">-</div>
15869 !! html
15870 <div style="background: #00FF00">-</div>
15871
15872 !! end
15873
15874
15875 !! test
15876 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15877 !! wikitext
15878 <div style="background:
15879 #00FF00">-</div>
15880 !! html/php
15881 <div style="background: #00FF00">-</div>
15882
15883 !! html/parsoid
15884 <div style="background:
15885 #00FF00">-</div>
15886 !! end
15887
15888 !! test
15889 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15890 !! wikitext
15891 <div style="background: &#10;#00FF00">-</div>
15892 !! html
15893 <div style="background: &#10;#00FF00">-</div>
15894
15895 !! end
15896
15897 !! test
15898 evil <math>-wiki-tags without Extension:Math enabled
15899 !! wikitext
15900 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15901 !! html+tidy
15902 <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>
15903 !! end
15904
15905 ###
15906 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15907 ###
15908 !! test
15909 Parser hook: empty input
15910 !! wikitext
15911 <tag></tag>
15912 !! html/php
15913 <pre>
15914 ''
15915 array (
15916 )
15917 </pre>
15918
15919 !! end
15920
15921 !! test
15922 Parser hook: empty input using terminated empty elements
15923 !! wikitext
15924 <tag/>
15925 !! html/php
15926 <pre>
15927 NULL
15928 array (
15929 )
15930 </pre>
15931
15932 !! end
15933
15934 !! test
15935 Parser hook: empty input using terminated empty elements (space before)
15936 !! wikitext
15937 <tag />
15938 !! html/php
15939 <pre>
15940 NULL
15941 array (
15942 )
15943 </pre>
15944
15945 !! end
15946
15947 !! test
15948 Parser hook: basic input
15949 !! wikitext
15950 <tag>input</tag>
15951 !! html/php
15952 <pre>
15953 'input'
15954 array (
15955 )
15956 </pre>
15957
15958 !! end
15959
15960
15961 !! test
15962 Parser hook: case insensitive
15963 !! wikitext
15964 <TAG>input</TAG>
15965 !! html/php
15966 <pre>
15967 'input'
15968 array (
15969 )
15970 </pre>
15971
15972 !! end
15973
15974
15975 !! test
15976 Parser hook: case insensitive, redux
15977 !! wikitext
15978 <TaG>input</TAg>
15979 !! html/php
15980 <pre>
15981 'input'
15982 array (
15983 )
15984 </pre>
15985
15986 !! end
15987
15988 !! test
15989 Parser hook: nested tags
15990 !! options
15991 noxml
15992 !! wikitext
15993 <tag><tag></tag></tag>
15994 !! html/php
15995 <pre>
15996 '<tag>'
15997 array (
15998 )
15999 </pre>&lt;/tag&gt;
16000
16001 !! end
16002
16003 !! test
16004 Parser hook: basic arguments
16005 !! wikitext
16006 <tag width=200 height = "100" depth = '50' square></tag>
16007 !! html/php
16008 <pre>
16009 ''
16010 array (
16011 'width' => '200',
16012 'height' => '100',
16013 'depth' => '50',
16014 'square' => '',
16015 )
16016 </pre>
16017
16018 !! end
16019
16020 !! test
16021 Parser hook: argument containing a forward slash (bug 5344)
16022 !! wikitext
16023 <tag filename='/tmp/bla'></tag>
16024 !! html/php
16025 <pre>
16026 ''
16027 array (
16028 'filename' => '/tmp/bla',
16029 )
16030 </pre>
16031
16032 !! end
16033
16034 !! test
16035 Parser hook: empty input using terminated empty elements (bug 2374)
16036 !! wikitext
16037 <tag foo=bar/>text
16038 !! html/php
16039 <pre>
16040 NULL
16041 array (
16042 'foo' => 'bar',
16043 )
16044 </pre>text
16045
16046 !! end
16047
16048 # </tag> should be output literally since there is no matching tag that begins it
16049 !! test
16050 Parser hook: basic arguments using terminated empty elements (bug 2374)
16051 !! wikitext
16052 <tag width=200 height = "100" depth = '50' square/>
16053 other stuff
16054 </tag>
16055 !! html/php
16056 <pre>
16057 NULL
16058 array (
16059 'width' => '200',
16060 'height' => '100',
16061 'depth' => '50',
16062 'square' => '',
16063 )
16064 </pre>
16065 <p>other stuff
16066 &lt;/tag&gt;
16067 </p>
16068 !! end
16069
16070 ###
16071 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16072 ###
16073
16074 !! test
16075 Parser hook: static parser hook not inside a comment
16076 !! wikitext
16077 <statictag>hello, world</statictag>
16078 <statictag action=flush/>
16079 !! html/php
16080 <p>hello, world
16081 </p>
16082 !! end
16083
16084
16085 !! test
16086 Parser hook: static parser hook inside a comment
16087 !! wikitext
16088 <!-- <statictag>hello, world</statictag> -->
16089 <statictag action=flush/>
16090 !! html/php
16091 <p><br />
16092 </p>
16093 !! end
16094
16095 # Nested template calls; this case was broken by Parser.php rev 1.506,
16096 # since reverted.
16097
16098 !! article
16099 Template:One-parameter
16100 !! text
16101 (My parameter is: {{{1}}})
16102 !! endarticle
16103
16104 !! article
16105 Template:Map-one-parameter
16106 !! text
16107 {{{{{1}}}|{{{2}}}}}
16108 !! endarticle
16109
16110 !! test
16111 Nested template calls
16112 !! wikitext
16113 {{Map-one-parameter|One-parameter|param}}
16114 !! html
16115 <p>(My parameter is: param)
16116 </p>
16117 !! end
16118
16119
16120 ###
16121 ### Sanitizer
16122 ###
16123
16124 # HTML+Tidy effectively strips out the empty tags completely
16125 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16126 # which Tidy would have done for the PHP parser had there been content inside it.
16127 !! test
16128 Sanitizer: Closing of open tags
16129 !! wikitext
16130 <s></s><table></table>
16131 !! html
16132 <s></s><table></table>
16133
16134 !! html/parsoid
16135 <p><s></s></p><table></table>
16136 !! end
16137
16138 !! test
16139 Sanitizer: Closing of open but not closed tags
16140 !! wikitext
16141 <s>foo
16142 !! html
16143 <p><s>foo</s>
16144 </p>
16145 !! end
16146
16147 !! test
16148 Sanitizer: Closing of closed but not open tags
16149 !! options
16150 parsoid=wt2html
16151 !! wikitext
16152 </s>
16153 !! html/php+tidy
16154 !! html/parsoid
16155 !! end
16156
16157 !! test
16158 Sanitizer: Closing of closed but not open table tags
16159 !! options
16160 parsoid=wt2html
16161 !! wikitext
16162 Table not started</td></tr></table>
16163 !! html/php+tidy
16164 <p>Table not started</p>
16165 !! html/parsoid
16166 <p>Table not started</p>
16167 !! end
16168
16169 !! test
16170 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16171 !! wikitext
16172 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16173 !! html
16174 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16175 </p>
16176 !! end
16177
16178 # In HTML5, the restrictions are that id must contain at least one character,
16179 # and must not contain any space characters.
16180 !! test
16181 Sanitizer: Validating the contents of the id attribute (bug 4515)
16182 !! options
16183 disabled
16184 !! wikitext
16185 <br id="" /><br id="a space" />
16186 !! html
16187 Something ...
16188 !! end
16189
16190 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16191 !! test
16192 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16193 !! options
16194 disabled
16195 !! wikitext
16196 <br id="foo" /><br id="foo" />
16197 !! html
16198 Something need to be done. foo-2 ?
16199 !! end
16200
16201 !! test
16202 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16203 !! wikitext
16204 <div itemscope>
16205 <meta itemprop="hello" content="world">
16206 <meta http-equiv="refresh" content="5">
16207 <meta itemprop="hello" http-equiv="refresh" content="5">
16208 <link itemprop="hello" href="{{SERVER}}">
16209 <link rel="stylesheet" href="{{SERVER}}">
16210 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16211 </div>
16212 !! html
16213 <div itemscope="">
16214 <p> <meta itemprop="hello" content="world" />
16215 &lt;meta http-equiv="refresh" content="5"&gt;
16216 <meta itemprop="hello" content="5" />
16217 </p>
16218 <link itemprop="hello" href="http&#58;//example.org" />
16219 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16220 <link itemprop="hello" href="http&#58;//example.org" />
16221 </div>
16222
16223 !! end
16224
16225 !! test
16226 Language converter: output gets cut off unexpectedly (bug 5757)
16227 !! options
16228 language=zh
16229 !! wikitext
16230 this bit is safe: }-
16231
16232 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16233
16234 then we get cut off here: }-
16235
16236 all additional text is vanished
16237 !! html
16238 <p>this bit is safe: }-
16239 </p><p>but if we add a conversion instance: xxx
16240 </p><p>then we get cut off here: }-
16241 </p><p>all additional text is vanished
16242 </p>
16243 !! end
16244
16245 !! test
16246 Self closed html pairs (bug 5487)
16247 !! options
16248 !! wikitext
16249 <center><font id="bug" />Centered text</center>
16250 <div><font id="bug2" />In div text</div>
16251 !! html
16252 <center>&lt;font id="bug" /&gt;Centered text</center>
16253 <div>&lt;font id="bug2" /&gt;In div text</div>
16254
16255 !! end
16256
16257 #
16258 #
16259 #
16260
16261 !! test
16262 Punctuation: nbsp before exclamation
16263 !! wikitext
16264 C'est grave !
16265 !! html
16266 <p>C'est grave&#160;!
16267 </p>
16268 !! end
16269
16270 !! test
16271 Punctuation: CSS !important (bug 11874)
16272 !! wikitext
16273 <div style="width:50% !important">important</div>
16274 !! html
16275 <div style="width:50% !important">important</div>
16276
16277 !!end
16278
16279 !! test
16280 Punctuation: CSS ! important (bug 11874; with space after)
16281 !! wikitext
16282 <div style="width:50% ! important">important</div>
16283 !! html
16284 <div style="width:50% ! important">important</div>
16285
16286 !!end
16287
16288 !! test
16289 HTML bullet list, closed tags (bug 5497)
16290 !! wikitext
16291 <ul>
16292 <li>One</li>
16293 <li>Two</li>
16294 </ul>
16295 !! html/php
16296 <ul>
16297 <li>One</li>
16298 <li>Two</li>
16299 </ul>
16300
16301 !! html/parsoid
16302 <ul data-parsoid='{"stx":"html"}'>
16303 <li data-parsoid='{"stx":"html"}'>One</li>
16304 <li data-parsoid='{"stx":"html"}'>Two</li>
16305 </ul>
16306
16307 !! end
16308
16309 !! test
16310 HTML bullet list, unclosed tags (bug 5497)
16311 !! wikitext
16312 <ul>
16313 <li>One
16314 <li>Two
16315 </ul>
16316 !! html/php+tidy
16317 <ul>
16318 <li>One</li>
16319 <li>Two</li>
16320 </ul>
16321 !! html/parsoid
16322 <ul data-parsoid='{"stx":"html"}'>
16323 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16324 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16325 </ul>
16326
16327 !! end
16328
16329 !! test
16330 HTML ordered list, closed tags (bug 5497)
16331 !! wikitext
16332 <ol>
16333 <li>One</li>
16334 <li>Two</li>
16335 </ol>
16336 !! html/php
16337 <ol>
16338 <li>One</li>
16339 <li>Two</li>
16340 </ol>
16341
16342 !! html/parsoid
16343 <ol data-parsoid='{"stx":"html"}'>
16344 <li data-parsoid='{"stx":"html"}'>One</li>
16345 <li data-parsoid='{"stx":"html"}'>Two</li>
16346 </ol>
16347
16348 !! end
16349
16350 !! test
16351 HTML ordered list, unclosed tags (bug 5497)
16352 !! options
16353 !! wikitext
16354 <ol>
16355 <li>One
16356 <li>Two
16357 </ol>
16358 !! html/php+tidy
16359 <ol>
16360 <li>One</li>
16361 <li>Two</li>
16362 </ol>
16363 !! html/parsoid
16364 <ol data-parsoid='{"stx":"html"}'>
16365 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16366 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16367 </ol>
16368
16369 !! end
16370
16371 !! test
16372 HTML nested bullet list, closed tags (bug 5497)
16373 !! wikitext
16374 <ul>
16375 <li>One</li>
16376 <li>Two:
16377 <ul>
16378 <li>Sub-one</li>
16379 <li>Sub-two</li>
16380 </ul>
16381 </li>
16382 </ul>
16383 !! html
16384 <ul>
16385 <li>One</li>
16386 <li>Two:
16387 <ul>
16388 <li>Sub-one</li>
16389 <li>Sub-two</li>
16390 </ul>
16391 </li>
16392 </ul>
16393
16394 !! end
16395
16396 !! test
16397 HTML nested bullet list, open tags (bug 5497)
16398 !! wikitext
16399 <ul>
16400 <li>One
16401 <li>Two:
16402 <ul>
16403 <li>Sub-one
16404 <li>Sub-two
16405 </ul>
16406 </ul>
16407 !! html/php+tidy
16408 <ul>
16409 <li>One</li>
16410 <li>Two:
16411 <ul>
16412 <li>Sub-one</li>
16413 <li>Sub-two</li>
16414 </ul>
16415 </li>
16416 </ul>
16417 !! html/parsoid
16418 <ul>
16419 <li>One
16420 </li>
16421 <li>Two:
16422 <ul>
16423 <li>Sub-one
16424 </li>
16425 <li>Sub-two
16426 </li>
16427 </ul>
16428 </li>
16429 </ul>
16430
16431 !! end
16432
16433 !! test
16434 HTML nested ordered list, closed tags (bug 5497)
16435 !! wikitext
16436 <ol>
16437 <li>One</li>
16438 <li>Two:
16439 <ol>
16440 <li>Sub-one</li>
16441 <li>Sub-two</li>
16442 </ol>
16443 </li>
16444 </ol>
16445 !! html
16446 <ol>
16447 <li>One</li>
16448 <li>Two:
16449 <ol>
16450 <li>Sub-one</li>
16451 <li>Sub-two</li>
16452 </ol>
16453 </li>
16454 </ol>
16455
16456 !! end
16457
16458 !! test
16459 HTML nested ordered list, open tags (bug 5497)
16460 !! wikitext
16461 <ol>
16462 <li>One
16463 <li>Two:
16464 <ol>
16465 <li>Sub-one
16466 <li>Sub-two
16467 </ol>
16468 </ol>
16469 !! html/php
16470 <ol>
16471 <li>One
16472 <li>Two:
16473 <ol>
16474 <li>Sub-one
16475 <li>Sub-two
16476 </ol>
16477 </ol>
16478
16479 !! html/parsoid
16480 <ol>
16481 <li>One
16482 </li>
16483 <li>Two:
16484 <ol>
16485 <li>Sub-one
16486 </li>
16487 <li>Sub-two
16488 </li>
16489 </ol>
16490 </li>
16491 </ol>
16492
16493 !! end
16494
16495 !! test
16496 HTML ordered list item with parameters oddity
16497 !! wikitext
16498 <ol><li id="fragment">One</li>
16499 </ol>
16500 !! html
16501 <ol><li id="fragment">One</li>
16502 </ol>
16503
16504 !! end
16505
16506 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16507 !!test
16508 bug 5918: autonumbering
16509 !! wikitext
16510 [http://first/] [http://second] [ftp://ftp]
16511
16512 ftp://inlineftp
16513
16514 [mailto:enclosed@mail.tld With target]
16515
16516 [mailto:enclosed@mail.tld]
16517
16518 mailto:inline@mail.tld
16519 !! html/php
16520 <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>
16521 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16522 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16523 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16524 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16525 </p>
16526 !! html/parsoid
16527 <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>
16528 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16529 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16530 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16531 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16532 !! end
16533
16534
16535 #
16536 # Security and HTML correctness
16537 # From Nick Jenkins' fuzz testing
16538 #
16539
16540 !! test
16541 Fuzz testing: Parser13
16542 !! wikitext
16543 {|
16544 | http://a|
16545 !! html
16546 <table>
16547 <tr>
16548 <td>
16549 </td>
16550 </tr>
16551 </table>
16552
16553 !! end
16554
16555 !! test
16556 Fuzz testing: Parser14
16557 !! wikitext
16558 == onmouseover= ==
16559 http://__TOC__
16560 !! html
16561 <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>
16562 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16563 <ul>
16564 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16565 </ul>
16566 </div>
16567
16568
16569 !! html+tidy
16570 <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>
16571 <p>http://</p>
16572 <div id="toc" class="toc">
16573 <div id="toctitle">
16574 <h2>Contents</h2>
16575 </div>
16576 <ul>
16577 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16578 </ul>
16579 </div>
16580 <p></p>
16581 !! end
16582
16583 !! test
16584 Fuzz testing: Parser14-table
16585 !! wikitext
16586 ==a==
16587 {| STYLE=__TOC__
16588 !! html
16589 <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>
16590 <table style="&#95;_TOC&#95;_">
16591 <tr><td></td></tr>
16592 </table>
16593
16594 !! html+tidy
16595 <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>
16596 <table style="__TOC__">
16597 <tr>
16598 <td></td>
16599 </tr>
16600 </table>
16601 !! end
16602
16603 # Known to produce bogus xml (extra </td>)
16604 !! test
16605 Fuzz testing: Parser16
16606 !! options
16607 noxml
16608 !! wikitext
16609 {|
16610 !https://||||||
16611 !! html
16612 <table>
16613 <tr>
16614 <th>https://</th>
16615 <th></th>
16616 <th></th>
16617 <th>
16618 </td>
16619 </tr>
16620 </table>
16621
16622 !! html+tidy
16623 <table>
16624 <tr>
16625 <th>https://</th>
16626 <th></th>
16627 <th></th>
16628 <th></th>
16629 </tr>
16630 </table>
16631 !! end
16632
16633 !! test
16634 Fuzz testing: Parser21
16635 !! wikitext
16636 {|
16637 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16638 |
16639 !! html
16640 <table>
16641 <tr>
16642 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16643 </th>
16644 <td>
16645 </td>
16646 </tr>
16647 </table>
16648
16649 !! end
16650
16651 !! test
16652 Fuzz testing: Parser22
16653 !! wikitext
16654 http://===r:::https://b
16655
16656 {|
16657 !! html
16658 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16659 </p>
16660 <table>
16661 <tr><td></td></tr>
16662 </table>
16663
16664 !! end
16665
16666 # Known to produce bad XML for now
16667 !! test
16668 Fuzz testing: Parser24
16669 !! options
16670 noxml
16671 !! wikitext
16672 {|
16673 {{{|
16674 <u CLASS=
16675 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16676 <br style="onmouseover='alert(document.cookie);' " />
16677
16678 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16679 |
16680 !! html
16681 <table>
16682 {{{|
16683 <u class="&#124;">}}}} &gt;
16684 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16685
16686 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16687 <tr>
16688 <td></u>
16689 </td>
16690 </tr>
16691 </table>
16692
16693 !! end
16694
16695 # Note: the current result listed for this is not what the original one was,
16696 # but the original bug was JavaScript injection, which is fixed in any case.
16697 # It's not clear that the original result listed was any more correct than the
16698 # current one. Original result:
16699 # <p>{{{|
16700 # </p>
16701 # <li class="&#124;&#124;">
16702 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16703 !!test
16704 Fuzz testing: Parser25 (bug 6055)
16705 !! wikitext
16706 {{{
16707 |
16708 <LI CLASS=||
16709 >
16710 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16711 !! html
16712 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16713 </p>
16714 !! end
16715
16716 !!test
16717 Fuzz testing: URL adjacent extension (with space, clean)
16718 !! wikitext
16719 http://example.com <nowiki>junk</nowiki>
16720 !! html/php
16721 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16722 </p>
16723 !! html/parsoid
16724 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16725 !! end
16726
16727 !!test
16728 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16729 !! wikitext
16730 http://example.com<nowiki>junk</nowiki>
16731 !! html/php
16732 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16733 </p>
16734 !! html/parsoid
16735 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16736 !! end
16737
16738 !!test
16739 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16740 !! wikitext
16741 http://example.com<pre>junk</pre>
16742 !! html/php
16743 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16744
16745 !! html/php+tidy
16746 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16747 <pre>
16748 junk
16749 </pre>
16750 !! html/parsoid
16751 <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>
16752 !!end
16753
16754 !!test
16755 Fuzz testing: image with bogus manual thumbnail
16756 !! wikitext
16757 [[Image:foobar.jpg|thumbnail= ]]
16758 !! html/php
16759 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16760
16761 !! html/parsoid
16762 <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>
16763 !!end
16764
16765 !! test
16766 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16767 !! wikitext
16768 <pre dir="&#10;"></pre>
16769 !! html
16770 <pre dir="&#10;"></pre>
16771
16772 !! end
16773
16774 !! test
16775 Parsing optional HTML elements (Bug 6171)
16776 !! options
16777 !! wikitext
16778 <table>
16779 <tr>
16780 <td> Some tabular data</td>
16781 <td> More tabular data ...
16782 <td> And yet som tabular data</td>
16783 </tr>
16784 </table>
16785 !! html
16786 <table>
16787 <tr>
16788 <td> Some tabular data</td>
16789 <td> More tabular data ...
16790 </td><td> And yet som tabular data</td>
16791 </tr>
16792 </table>
16793
16794 !! end
16795
16796 !! test
16797 Correct handling of <td>, <tr> (Bug 6171)
16798 !! options
16799 !! wikitext
16800 <table>
16801 <tr>
16802 <td> Some tabular data</td>
16803 <td> More tabular data ...</td>
16804 <td> And yet som tabular data</td>
16805 </tr>
16806 </table>
16807 !! html
16808 <table>
16809 <tr>
16810 <td> Some tabular data</td>
16811 <td> More tabular data ...</td>
16812 <td> And yet som tabular data</td>
16813 </tr>
16814 </table>
16815
16816 !! end
16817
16818
16819 !! test
16820 Parsing crashing regression (fr:JavaScript)
16821 !! wikitext
16822 </body></x>
16823 !! html
16824 <p>&lt;/body&gt;&lt;/x&gt;
16825 </p>
16826 !! end
16827
16828 !! test
16829 Inline wiki vs wiki block nesting
16830 !! wikitext
16831 '''Bold paragraph
16832
16833 New wiki paragraph
16834 !! html
16835 <p><b>Bold paragraph</b>
16836 </p><p>New wiki paragraph
16837 </p>
16838 !! end
16839
16840 # FIXME: The current php output is documented
16841 # and desired output is the parsoid target.
16842 !! test
16843 Inline HTML vs wiki block nesting
16844 !! wikitext
16845 <b>Bold paragraph
16846
16847 New wiki paragraph
16848 !! html/php
16849 <p><b>Bold paragraph
16850 </p><p>New wiki paragraph</b>
16851 </p>
16852 !! html/parsoid
16853 <p><b>Bold paragraph</b>
16854 </p><p>New wiki paragraph
16855 </p>
16856 !! end
16857
16858 # Original result was this:
16859 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16860 # </p>
16861 # While that might be marginally more intuitive, maybe, the six-apostrophe
16862 # construct is clearly pathological and the result stated here (which is what
16863 # the parser actually does) is about as reasonable as anything.
16864 !!test
16865 Mixing markup for italics and bold
16866 !! options
16867 !! wikitext
16868 '''bold''''''bold''bolditalics'''''
16869 !! html
16870 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16871 </p>
16872 !! end
16873
16874
16875 !! article
16876 Xyzzyx
16877 !! text
16878 Article for special page transclusion test
16879 !! endarticle
16880
16881 !! test
16882 Special page transclusion
16883 !! options
16884 !! wikitext
16885 {{Special:Prefixindex/Xyzzyx}}
16886 !! html
16887 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16888
16889 !! end
16890
16891 !! test
16892 Special page transclusion twice (bug 5021)
16893 !! options
16894 !! wikitext
16895 {{Special:Prefixindex/Xyzzyx}}
16896 {{Special:Prefixindex/Xyzzyx}}
16897 !! html
16898 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16899 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16900
16901 !! end
16902
16903 !! test
16904 Transclusion of default MediaWiki message
16905 !! wikitext
16906 {{MediaWiki:Mainpage}}
16907 !! html
16908 <p>Main Page
16909 </p>
16910 !! end
16911
16912 !! test
16913 Transclusion of nonexistent MediaWiki message
16914 !! wikitext
16915 {{MediaWiki:Mainpagexxx}}
16916 !! html
16917 <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>
16918 </p>
16919 !! end
16920
16921 !! test
16922 Transclusion of MediaWiki message with underscore
16923 !! wikitext
16924 {{MediaWiki:history_short}}
16925 !! html
16926 <p>History
16927 </p>
16928 !! end
16929
16930 !! test
16931 Transclusion of MediaWiki message with space
16932 !! wikitext
16933 {{MediaWiki:history short}}
16934 !! html
16935 <p>History
16936 </p>
16937 !! end
16938
16939 !! test
16940 Invalid header with following text
16941 !! wikitext
16942 = x = y
16943 !! html
16944 <p>= x = y
16945 </p>
16946 !! end
16947
16948
16949 !! test
16950 Section extraction test (section 0)
16951 !! options
16952 section=0
16953 !! wikitext
16954 start
16955 ==a==
16956 ===aa===
16957 ====aaa====
16958 ==b==
16959 ===ba===
16960 ===bb===
16961 ====bba====
16962 ===bc===
16963 ==c==
16964 ===ca===
16965 !! html/php
16966 start
16967 !! end
16968
16969 !! test
16970 Section extraction test (section 1)
16971 !! options
16972 section=1
16973 !! wikitext
16974 start
16975 ==a==
16976 ===aa===
16977 ====aaa====
16978 ==b==
16979 ===ba===
16980 ===bb===
16981 ====bba====
16982 ===bc===
16983 ==c==
16984 ===ca===
16985 !! html/php
16986 ==a==
16987 ===aa===
16988 ====aaa====
16989 !! end
16990
16991 !! test
16992 Section extraction test (section 2)
16993 !! options
16994 section=2
16995 !! wikitext
16996 start
16997 ==a==
16998 ===aa===
16999 ====aaa====
17000 ==b==
17001 ===ba===
17002 ===bb===
17003 ====bba====
17004 ===bc===
17005 ==c==
17006 ===ca===
17007 !! html/php
17008 ===aa===
17009 ====aaa====
17010 !! end
17011
17012 !! test
17013 Section extraction test (section 3)
17014 !! options
17015 section=3
17016 !! wikitext
17017 start
17018 ==a==
17019 ===aa===
17020 ====aaa====
17021 ==b==
17022 ===ba===
17023 ===bb===
17024 ====bba====
17025 ===bc===
17026 ==c==
17027 ===ca===
17028 !! html/php
17029 ====aaa====
17030 !! end
17031
17032 !! test
17033 Section extraction test (section 4)
17034 !! options
17035 section=4
17036 !! wikitext
17037 start
17038 ==a==
17039 ===aa===
17040 ====aaa====
17041 ==b==
17042 ===ba===
17043 ===bb===
17044 ====bba====
17045 ===bc===
17046 ==c==
17047 ===ca===
17048 !! html/php
17049 ==b==
17050 ===ba===
17051 ===bb===
17052 ====bba====
17053 ===bc===
17054 !! end
17055
17056 !! test
17057 Section extraction test (section 5)
17058 !! options
17059 section=5
17060 !! wikitext
17061 start
17062 ==a==
17063 ===aa===
17064 ====aaa====
17065 ==b==
17066 ===ba===
17067 ===bb===
17068 ====bba====
17069 ===bc===
17070 ==c==
17071 ===ca===
17072 !! html/php
17073 ===ba===
17074 !! end
17075
17076 !! test
17077 Section extraction test (section 6)
17078 !! options
17079 section=6
17080 !! wikitext
17081 start
17082 ==a==
17083 ===aa===
17084 ====aaa====
17085 ==b==
17086 ===ba===
17087 ===bb===
17088 ====bba====
17089 ===bc===
17090 ==c==
17091 ===ca===
17092 !! html/php
17093 ===bb===
17094 ====bba====
17095 !! end
17096
17097 !! test
17098 Section extraction test (section 7)
17099 !! options
17100 section=7
17101 !! wikitext
17102 start
17103 ==a==
17104 ===aa===
17105 ====aaa====
17106 ==b==
17107 ===ba===
17108 ===bb===
17109 ====bba====
17110 ===bc===
17111 ==c==
17112 ===ca===
17113 !! html/php
17114 ====bba====
17115 !! end
17116
17117 !! test
17118 Section extraction test (section 8)
17119 !! options
17120 section=8
17121 !! wikitext
17122 start
17123 ==a==
17124 ===aa===
17125 ====aaa====
17126 ==b==
17127 ===ba===
17128 ===bb===
17129 ====bba====
17130 ===bc===
17131 ==c==
17132 ===ca===
17133 !! html/php
17134 ===bc===
17135 !! end
17136
17137 !! test
17138 Section extraction test (section 9)
17139 !! options
17140 section=9
17141 !! wikitext
17142 start
17143 ==a==
17144 ===aa===
17145 ====aaa====
17146 ==b==
17147 ===ba===
17148 ===bb===
17149 ====bba====
17150 ===bc===
17151 ==c==
17152 ===ca===
17153 !! html/php
17154 ==c==
17155 ===ca===
17156 !! end
17157
17158 !! test
17159 Section extraction test (section 10)
17160 !! options
17161 section=10
17162 !! wikitext
17163 start
17164 ==a==
17165 ===aa===
17166 ====aaa====
17167 ==b==
17168 ===ba===
17169 ===bb===
17170 ====bba====
17171 ===bc===
17172 ==c==
17173 ===ca===
17174 !! html/php
17175 ===ca===
17176 !! end
17177
17178 !! test
17179 Section extraction test (nonexistent section 11)
17180 !! options
17181 section=11
17182 !! wikitext
17183 start
17184 ==a==
17185 ===aa===
17186 ====aaa====
17187 ==b==
17188 ===ba===
17189 ===bb===
17190 ====bba====
17191 ===bc===
17192 ==c==
17193 ===ca===
17194 !! html/php
17195 !! end
17196
17197 !! test
17198 Section extraction test with bogus heading (section 1)
17199 !! options
17200 section=1
17201 !! wikitext
17202 ==a==
17203 ==bogus== not a legal section
17204 ==b==
17205 !! html/php
17206 ==a==
17207 ==bogus== not a legal section
17208 !! end
17209
17210 !! test
17211 Section extraction test with bogus heading (section 2)
17212 !! options
17213 section=2
17214 !! wikitext
17215 ==a==
17216 ==bogus== not a legal section
17217 ==b==
17218 !! html/php
17219 ==b==
17220 !! end
17221
17222 !! test
17223 Section extraction test with comment after heading (section 1)
17224 !! options
17225 section=1
17226 !! wikitext
17227 ==a==
17228 ==b== <!-- -->
17229 ==c==
17230 !! html/php
17231 ==a==
17232 !! end
17233
17234 !! test
17235 Section extraction test with comment after heading (section 2)
17236 !! options
17237 section=2
17238 !! wikitext
17239 ==a==
17240 ==b== <!-- -->
17241 ==c==
17242 !! html/php
17243 ==b== <!-- -->
17244 !! end
17245
17246 !! test
17247 Section extraction test with bogus <nowiki> heading (section 1)
17248 !! options
17249 section=1
17250 !! wikitext
17251 ==a==
17252 ==bogus== <nowiki>not a legal section</nowiki>
17253 ==b==
17254 !! html/php
17255 ==a==
17256 ==bogus== <nowiki>not a legal section</nowiki>
17257 !! end
17258
17259 !! test
17260 Section extraction test with bogus <nowiki> heading (section 2)
17261 !! options
17262 section=2
17263 !! wikitext
17264 ==a==
17265 ==bogus== <nowiki>not a legal section</nowiki>
17266 ==b==
17267 !! html/php
17268 ==b==
17269 !! end
17270
17271 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17272 # instead of respecting commented sections
17273 !! test
17274 Section extraction prefixed by comment (section 1)
17275 !! options
17276 section=1
17277 !! wikitext
17278 <!-- -->==sec1==
17279 ==sec2==
17280 !! html/php
17281 ==sec2==
17282 !!end
17283
17284 !! test
17285 Section extraction prefixed by comment (section 2)
17286 !! options
17287 section=2
17288 !! wikitext
17289 <!-- -->==sec1==
17290 ==sec2==
17291 !! html/php
17292
17293 !!end
17294
17295 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17296 # instead of respecting HTML-style headings
17297 !! test
17298 Section extraction, mixed wiki and html (section 1)
17299 !! options
17300 section=1
17301 !! wikitext
17302 <h2>unmarked</h2>
17303 unmarked
17304 ==1==
17305 one
17306 ==2==
17307 two
17308 !! html/php
17309 ==1==
17310 one
17311 !! end
17312
17313 !! test
17314 Section extraction, mixed wiki and html (section 2)
17315 !! options
17316 section=2
17317 !! wikitext
17318 <h2>unmarked</h2>
17319 unmarked
17320 ==1==
17321 one
17322 ==2==
17323 two
17324 !! html/php
17325 ==2==
17326 two
17327 !! end
17328
17329
17330 # Formerly testing for bug 3342
17331 !! test
17332 Section extraction, heading surrounded by <noinclude>
17333 !! options
17334 section=1
17335 !! wikitext
17336 <noinclude>==unmarked==</noinclude>
17337 ==marked==
17338 !! html/php
17339 ==marked==
17340 !!end
17341
17342 # Test behavior of bug 19910
17343 !! test
17344 Sectiion with all-equals
17345 !! options
17346 section=2
17347 !! wikitext
17348 ===
17349 The line above must have a trailing space
17350 === <!--
17351 --> <!-- -->
17352 But just in case it doesn't...
17353 !! html/php
17354 === <!--
17355 --> <!-- -->
17356 But just in case it doesn't...
17357 !! end
17358
17359 !! test
17360 Section replacement test (section 0)
17361 !! options
17362 replace=0,"xxx"
17363 !! wikitext
17364 start
17365 ==a==
17366 ===aa===
17367 ====aaa====
17368 ==b==
17369 ===ba===
17370 ===bb===
17371 ====bba====
17372 ===bc===
17373 ==c==
17374 ===ca===
17375 !! html/php
17376 xxx
17377
17378 ==a==
17379 ===aa===
17380 ====aaa====
17381 ==b==
17382 ===ba===
17383 ===bb===
17384 ====bba====
17385 ===bc===
17386 ==c==
17387 ===ca===
17388 !! end
17389
17390 !! test
17391 Section replacement test (section 1)
17392 !! options
17393 replace=1,"xxx"
17394 !! wikitext
17395 start
17396 ==a==
17397 ===aa===
17398 ====aaa====
17399 ==b==
17400 ===ba===
17401 ===bb===
17402 ====bba====
17403 ===bc===
17404 ==c==
17405 ===ca===
17406 !! html/php
17407 start
17408 xxx
17409
17410 ==b==
17411 ===ba===
17412 ===bb===
17413 ====bba====
17414 ===bc===
17415 ==c==
17416 ===ca===
17417 !! end
17418
17419 !! test
17420 Section replacement test (section 2)
17421 !! options
17422 replace=2,"xxx"
17423 !! wikitext
17424 start
17425 ==a==
17426 ===aa===
17427 ====aaa====
17428 ==b==
17429 ===ba===
17430 ===bb===
17431 ====bba====
17432 ===bc===
17433 ==c==
17434 ===ca===
17435 !! html/php
17436 start
17437 ==a==
17438 xxx
17439
17440 ==b==
17441 ===ba===
17442 ===bb===
17443 ====bba====
17444 ===bc===
17445 ==c==
17446 ===ca===
17447 !! end
17448
17449 !! test
17450 Section replacement test (section 3)
17451 !! options
17452 replace=3,"xxx"
17453 !! wikitext
17454 start
17455 ==a==
17456 ===aa===
17457 ====aaa====
17458 ==b==
17459 ===ba===
17460 ===bb===
17461 ====bba====
17462 ===bc===
17463 ==c==
17464 ===ca===
17465 !! html/php
17466 start
17467 ==a==
17468 ===aa===
17469 xxx
17470
17471 ==b==
17472 ===ba===
17473 ===bb===
17474 ====bba====
17475 ===bc===
17476 ==c==
17477 ===ca===
17478 !! end
17479
17480 !! test
17481 Section replacement test (section 4)
17482 !! options
17483 replace=4,"xxx"
17484 !! wikitext
17485 start
17486 ==a==
17487 ===aa===
17488 ====aaa====
17489 ==b==
17490 ===ba===
17491 ===bb===
17492 ====bba====
17493 ===bc===
17494 ==c==
17495 ===ca===
17496 !! html/php
17497 start
17498 ==a==
17499 ===aa===
17500 ====aaa====
17501 xxx
17502
17503 ==c==
17504 ===ca===
17505 !! end
17506
17507 !! test
17508 Section replacement test (section 5)
17509 !! options
17510 replace=5,"xxx"
17511 !! wikitext
17512 start
17513 ==a==
17514 ===aa===
17515 ====aaa====
17516 ==b==
17517 ===ba===
17518 ===bb===
17519 ====bba====
17520 ===bc===
17521 ==c==
17522 ===ca===
17523 !! html/php
17524 start
17525 ==a==
17526 ===aa===
17527 ====aaa====
17528 ==b==
17529 xxx
17530
17531 ===bb===
17532 ====bba====
17533 ===bc===
17534 ==c==
17535 ===ca===
17536 !! end
17537
17538 !! test
17539 Section replacement test (section 6)
17540 !! options
17541 replace=6,"xxx"
17542 !! wikitext
17543 start
17544 ==a==
17545 ===aa===
17546 ====aaa====
17547 ==b==
17548 ===ba===
17549 ===bb===
17550 ====bba====
17551 ===bc===
17552 ==c==
17553 ===ca===
17554 !! html/php
17555 start
17556 ==a==
17557 ===aa===
17558 ====aaa====
17559 ==b==
17560 ===ba===
17561 xxx
17562
17563 ===bc===
17564 ==c==
17565 ===ca===
17566 !! end
17567
17568 !! test
17569 Section replacement test (section 7)
17570 !! options
17571 replace=7,"xxx"
17572 !! wikitext
17573 start
17574 ==a==
17575 ===aa===
17576 ====aaa====
17577 ==b==
17578 ===ba===
17579 ===bb===
17580 ====bba====
17581 ===bc===
17582 ==c==
17583 ===ca===
17584 !! html/php
17585 start
17586 ==a==
17587 ===aa===
17588 ====aaa====
17589 ==b==
17590 ===ba===
17591 ===bb===
17592 xxx
17593
17594 ===bc===
17595 ==c==
17596 ===ca===
17597 !! end
17598
17599 !! test
17600 Section replacement test (section 8)
17601 !! options
17602 replace=8,"xxx"
17603 !! wikitext
17604 start
17605 ==a==
17606 ===aa===
17607 ====aaa====
17608 ==b==
17609 ===ba===
17610 ===bb===
17611 ====bba====
17612 ===bc===
17613 ==c==
17614 ===ca===
17615 !! html/php
17616 start
17617 ==a==
17618 ===aa===
17619 ====aaa====
17620 ==b==
17621 ===ba===
17622 ===bb===
17623 ====bba====
17624 xxx
17625
17626 ==c==
17627 ===ca===
17628 !!end
17629
17630 !! test
17631 Section replacement test (section 9)
17632 !! options
17633 replace=9,"xxx"
17634 !! wikitext
17635 start
17636 ==a==
17637 ===aa===
17638 ====aaa====
17639 ==b==
17640 ===ba===
17641 ===bb===
17642 ====bba====
17643 ===bc===
17644 ==c==
17645 ===ca===
17646 !! html/php
17647 start
17648 ==a==
17649 ===aa===
17650 ====aaa====
17651 ==b==
17652 ===ba===
17653 ===bb===
17654 ====bba====
17655 ===bc===
17656 xxx
17657 !! end
17658
17659 !! test
17660 Section replacement test (section 10)
17661 !! options
17662 replace=10,"xxx"
17663 !! wikitext
17664 start
17665 ==a==
17666 ===aa===
17667 ====aaa====
17668 ==b==
17669 ===ba===
17670 ===bb===
17671 ====bba====
17672 ===bc===
17673 ==c==
17674 ===ca===
17675 !! html/php
17676 start
17677 ==a==
17678 ===aa===
17679 ====aaa====
17680 ==b==
17681 ===ba===
17682 ===bb===
17683 ====bba====
17684 ===bc===
17685 ==c==
17686 xxx
17687 !! end
17688
17689 !! test
17690 Section replacement test with initial whitespace (bug 13728)
17691 !! options
17692 replace=2,"xxx"
17693 !! wikitext
17694 Preformatted initial line
17695 ==a==
17696 ===a===
17697 !! html/php
17698 Preformatted initial line
17699 ==a==
17700 xxx
17701 !! end
17702
17703
17704 !! test
17705 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17706 !! options
17707 section=1
17708 !! wikitext
17709 ==a==
17710 a
17711 !! html/php
17712 ==a==
17713 a
17714 !! end
17715
17716 !! test
17717 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17718 !! options
17719 section=1
17720 !! wikitext
17721 ==a==
17722 a
17723 !! html/php
17724 ==a==
17725 a
17726 !! end
17727
17728
17729 !! test
17730 Section extraction, <pre> around bogus header (bug 10309)
17731 !! options
17732 noxml section=2
17733 !! wikitext
17734 == Section One ==
17735 <pre>
17736 =======
17737 </pre>
17738
17739 == Section Two ==
17740 stuff
17741 !! html/php
17742 == Section Two ==
17743 stuff
17744 !! end
17745
17746 !! test
17747 Section replacement, <pre> around bogus header (bug 10309)
17748 !! options
17749 noxml replace=2,"xxx"
17750 !! wikitext
17751 == Section One ==
17752 <pre>
17753 =======
17754 </pre>
17755
17756 == Section Two ==
17757 stuff
17758 !! html/php
17759 == Section One ==
17760 <pre>
17761 =======
17762 </pre>
17763
17764 xxx
17765 !! end
17766
17767
17768 !! test
17769 Handling of &#x0A; in URLs
17770 !! wikitext
17771 ** irc://&#x0A;a
17772 !! html/php
17773 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17774
17775 !! html/parsoid
17776 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17777 a">irc://
17778 a</a></li></ul></li></ul>
17779 !! end
17780
17781 !! test
17782 Handling of %0A in URLs
17783 !! wikitext
17784 ** irc://%0Aa
17785 !! html/php
17786 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17787
17788 !! html/parsoid
17789 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17790 !! end
17791
17792
17793 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17794 !! test
17795 5 quotes, code coverage +1 line
17796 !! options
17797 parsoid=wt2html
17798 !! wikitext
17799 '''''
17800 !! html/php
17801 !! html/parsoid
17802 <p><b><i></i></b></p>
17803 !! end
17804
17805 # same html as previous, but wikitext adjusted to match parsoid html2wt
17806 # note that wt2html and html2html will put the <i> before the <b>
17807 !! test
17808 5 quotes, code coverage +1 line w/ nowiki (1)
17809 !! options
17810 parsoid=wt2wt,html2wt
17811 !! wikitext
17812 '''''<nowiki/>'''''
17813 !! html/php
17814 <p><i></i>
17815 </p>
17816 !! html/parsoid
17817 <p><b><i></i></b></p>
17818 !! end
17819
17820 # same as previous, just swapping the <i> and <b>
17821 !! test
17822 5 quotes, code coverage +1 line w/ nowiki (2)
17823 !! wikitext
17824 '''''<nowiki/>'''''
17825 !! html/php
17826 <p><i></i>
17827 </p>
17828 !! html/parsoid
17829 <p><i><b></b></i></p>
17830 !! end
17831
17832 !! test
17833 Special:Search page linking.
17834 !! wikitext
17835 {{Special:search}}
17836 !! html
17837 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17838 </p>
17839 !! end
17840
17841 !! test
17842 {{!}} is a magic word
17843 !! wikitext
17844 {{!}} is a magic word there and {{!}} is still a magic word here
17845 !! html/php
17846 <p>| is a magic word there and | is still a magic word here
17847 </p>
17848 !! html/parsoid
17849 <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>
17850 !! end
17851
17852 !! test
17853 Say the magic word
17854 !! options
17855 title=[[Parser test]]
17856 !! wikitext
17857 * {{PAGENAME}}
17858 * {{PAGENAMEE}}
17859 * {{FULLPAGENAME}}
17860 * {{FULLPAGENAMEE}}
17861 * {{BASEPAGENAME}}
17862 * {{BASEPAGENAMEE}}
17863 * {{SUBPAGENAME}}
17864 * {{SUBPAGENAMEE}}
17865 * {{ROOTPAGENAME}}
17866 * {{ROOTPAGENAMEE}}
17867 * {{TALKPAGENAME}}
17868 * {{TALKPAGENAMEE}}
17869 * {{SUBJECTPAGENAME}}
17870 * {{SUBJECTPAGENAMEE}}
17871 * {{NAMESPACEE}}
17872 * {{NAMESPACE}}
17873 * {{NAMESPACENUMBER}}
17874 * {{TALKSPACE}}
17875 * {{TALKSPACEE}}
17876 * {{SUBJECTSPACE}}
17877 * {{SUBJECTSPACEE}}
17878 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17879 !! html
17880 <ul><li> Parser test</li>
17881 <li> Parser_test</li>
17882 <li> Parser test</li>
17883 <li> Parser_test</li>
17884 <li> Parser test</li>
17885 <li> Parser_test</li>
17886 <li> Parser test</li>
17887 <li> Parser_test</li>
17888 <li> Parser test</li>
17889 <li> Parser_test</li>
17890 <li> Talk:Parser test</li>
17891 <li> Talk:Parser_test</li>
17892 <li> Parser test</li>
17893 <li> Parser_test</li>
17894 <li> </li>
17895 <li> </li>
17896 <li> 0</li>
17897 <li> Talk</li>
17898 <li> Talk</li>
17899 <li> </li>
17900 <li> </li>
17901 <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>
17902
17903 !! end
17904 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17905
17906 !! test
17907 Gallery
17908 !! wikitext
17909 <gallery>
17910 image1.png |
17911 image2.gif|||||
17912
17913 image3|
17914 image4 |300px| centre
17915 image5.svg| http://///////
17916 [[x|xx]]]]
17917 * image6
17918 </gallery>
17919 !! html
17920 <ul class="gallery mw-gallery-traditional">
17921 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17922 <div class="thumb" style="height: 150px;">Image1.png</div>
17923 <div class="gallerytext">
17924 </div>
17925 </div></li>
17926 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17927 <div class="thumb" style="height: 150px;">Image2.gif</div>
17928 <div class="gallerytext">
17929 <p>||||
17930 </p>
17931 </div>
17932 </div></li>
17933 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17934 <div class="thumb" style="height: 150px;">Image3</div>
17935 <div class="gallerytext">
17936 </div>
17937 </div></li>
17938 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17939 <div class="thumb" style="height: 150px;">Image4</div>
17940 <div class="gallerytext">
17941 <p>300px| centre
17942 </p>
17943 </div>
17944 </div></li>
17945 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17946 <div class="thumb" style="height: 150px;">Image5.svg</div>
17947 <div class="gallerytext">
17948 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17949 </p>
17950 </div>
17951 </div></li>
17952 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17953 <div class="thumb" style="height: 150px;">* image6</div>
17954 <div class="gallerytext">
17955 </div>
17956 </div></li>
17957 </ul>
17958
17959 !! end
17960
17961 !! test
17962 Gallery (with options)
17963 !! wikitext
17964 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17965 File:Nonexistent.jpg|caption
17966 File:Nonexistent.jpg
17967 image:foobar.jpg|some '''caption''' [[Main Page]]
17968 image:foobar.jpg
17969 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17970 </gallery>
17971 !! html
17972 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17973 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17974 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17975 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17976 <div class="gallerytext">
17977 <p>caption
17978 </p>
17979 </div>
17980 </div></li>
17981 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17982 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17983 <div class="gallerytext">
17984 </div>
17985 </div></li>
17986 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17987 <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>
17988 <div class="gallerytext">
17989 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17990 </p>
17991 </div>
17992 </div></li>
17993 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17994 <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>
17995 <div class="gallerytext">
17996 </div>
17997 </div></li>
17998 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17999 <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>
18000 <div class="gallerytext">
18001 <p>Blabla|blabla.
18002 </p>
18003 </div>
18004 </div></li>
18005 </ul>
18006
18007 !! end
18008
18009 !! test
18010 Gallery with link that has fragment
18011 !! wikitext
18012 <gallery>
18013 image:foobar.jpg|link=Main_Page
18014 image:foobar.jpg|link=Main_Page#section
18015 image:foobar.jpg|link=Main Page#section|caption
18016 </gallery>
18017 !! html
18018 <ul class="gallery mw-gallery-traditional">
18019 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18020 <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>
18021 <div class="gallerytext">
18022 </div>
18023 </div></li>
18024 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18025 <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>
18026 <div class="gallerytext">
18027 </div>
18028 </div></li>
18029 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18030 <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>
18031 <div class="gallerytext">
18032 <p>caption
18033 </p>
18034 </div>
18035 </div></li>
18036 </ul>
18037
18038 !! end
18039
18040 !! test
18041 Gallery with wikitext inside caption
18042 !! wikitext
18043 <gallery>
18044 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18045 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18046 </gallery>
18047 !! html
18048 <ul class="gallery mw-gallery-traditional">
18049 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18050 <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>
18051 <div class="gallerytext">
18052 <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>
18053 </p>
18054 </div>
18055 </div></li>
18056 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18057 <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>
18058 <div class="gallerytext">
18059 <p>This is a test template
18060 </p>
18061 </div>
18062 </div></li>
18063 </ul>
18064
18065 !! end
18066
18067 !! test
18068 gallery (with showfilename option)
18069 !! wikitext
18070 <gallery showfilename>
18071 File:Nonexistent.jpg|caption
18072 File:Nonexistent.jpg
18073 image:foobar.jpg|some '''caption''' [[Main Page]]
18074 File:Foobar.jpg
18075 </gallery>
18076 !! html
18077 <ul class="gallery mw-gallery-traditional">
18078 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18079 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18080 <div class="gallerytext">
18081 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18082 caption
18083 </p>
18084 </div>
18085 </div></li>
18086 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18087 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18088 <div class="gallerytext">
18089 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18090 </p>
18091 </div>
18092 </div></li>
18093 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18094 <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>
18095 <div class="gallerytext">
18096 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18097 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18098 </p>
18099 </div>
18100 </div></li>
18101 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18102 <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>
18103 <div class="gallerytext">
18104 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18105 </p>
18106 </div>
18107 </div></li>
18108 </ul>
18109
18110 !! end
18111
18112 !! test
18113 Gallery (with namespace-less filenames)
18114 !! wikitext
18115 <gallery>
18116 File:Nonexistent.jpg
18117 Nonexistent.jpg
18118 image:foobar.jpg
18119 foobar.jpg
18120 </gallery>
18121 !! html
18122 <ul class="gallery mw-gallery-traditional">
18123 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18124 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18125 <div class="gallerytext">
18126 </div>
18127 </div></li>
18128 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18129 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18130 <div class="gallerytext">
18131 </div>
18132 </div></li>
18133 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18134 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18135 <div class="gallerytext">
18136 </div>
18137 </div></li>
18138 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18139 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18140 <div class="gallerytext">
18141 </div>
18142 </div></li>
18143 </ul>
18144
18145 !! end
18146
18147 !! test
18148 HTML Hex character encoding (spells the word "JavaScript")
18149 !! options
18150 parsoid=wt2html,wt2wt,html2html
18151 !! wikitext
18152 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18153 !! html/php
18154 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18155 </p>
18156 !! html/php+tidy
18157 <p>JavaScript</p>
18158 !! html/parsoid
18159 <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>
18160 !! end
18161
18162 !! test
18163 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18164 !! wikitext
18165 &#xsee;&#XSEE;
18166 !! html/php
18167 <p>&amp;#xsee;&amp;#XSEE;
18168 </p>
18169 !! html/parsoid
18170 <p>&amp;#xsee;&amp;#XSEE;</p>
18171 !! end
18172
18173 !! test
18174 HTML Hex character encoding mixed case
18175 !! options
18176 parsoid=wt2html,wt2wt,html2html
18177 !! wikitext
18178 &#xEE;&#Xee;
18179 !! html/php
18180 <p>&#xee;&#xee;
18181 </p>
18182 !! html/php+tidy
18183 <p>îî</p>
18184 !! html/parsoid
18185 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18186 !! end
18187
18188 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18189 # Note that U+000C (form feed) is not a valid XML character, so
18190 # it is banned even though allowed in HTML5.
18191 !! test
18192 Illegal character references (T106578)
18193 !! wikitext
18194 ; Null: &#00;
18195 ; FF: &#xC;
18196 ; CR: &#xD;
18197 ; Control (low): &#8;
18198 ; Control (high): &#x7F; &#x9F;
18199 ; Surrogate: &#xD83D;&#xDCA9;
18200 ; This is an okay astral character: &#x1F4A9;
18201 !! html+tidy
18202 <dl>
18203 <dt>Null</dt>
18204 <dd>&amp;#00;</dd>
18205 <dt>FF</dt>
18206 <dd>&amp;#xC;</dd>
18207 <dt>CR</dt>
18208 <dd>&amp;#xD;</dd>
18209 <dt>Control (low)</dt>
18210 <dd>&amp;#8;</dd>
18211 <dt>Control (high)</dt>
18212 <dd>&amp;#x7F; &amp;#x9F;</dd>
18213 <dt>Surrogate</dt>
18214 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18215 <dt>This is an okay astral character</dt>
18216 <dd>💩</dd>
18217 </dl>
18218 !! end
18219
18220 !! test
18221 __FORCETOC__ override
18222 !! wikitext
18223 __NEWSECTIONLINK__
18224 __FORCETOC__
18225 !! html/php
18226 <p><br />
18227 </p>
18228 !! end
18229
18230 !! test
18231 ISBN code coverage
18232 !! wikitext
18233 ISBN 978-0-1234-56&#x20;789
18234 !! html
18235 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18236 </p>
18237 !! html+tidy
18238 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18239 !! html/parsoid
18240 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18241 !! end
18242
18243 !! test
18244 ISBN followed by 5 spaces
18245 !! wikitext
18246 ISBN
18247 !! html
18248 <p>ISBN
18249 </p>
18250 !! end
18251
18252 !! test
18253 Double ISBN
18254 !! wikitext
18255 ISBN ISBN 1234567890
18256 !! html/php
18257 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18258 </p>
18259 !! html/parsoid
18260 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18261 !! end
18262
18263 # Uppercase X and lowercase x as well
18264 !! test
18265 ISBN with an X
18266 !! wikitext
18267 ISBN 3-462-04561-X
18268 ISBN 3-462-04561-x
18269 ISBN 080442957X
18270 ISBN 080442957x
18271 ISBN 978080442957X
18272 ISBN 978080442957x
18273 !! html/php
18274 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18275 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18276 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18277 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18278 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18279 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18280 </p>
18281 !! html/parsoid
18282 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18283 <a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18284 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18285 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18286 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18287 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18288 !! end
18289
18290 !! test
18291 ISBN with empty prefix (parsoid test)
18292 !! wikitext
18293 ISBN 1234567890
18294 !! html/php
18295 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18296 </p>
18297 !! html/parsoid
18298 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
18299 !! end
18300
18301 !! test
18302 Bug 22905: <abbr> followed by ISBN followed by </a>
18303 !! wikitext
18304 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18305 !! html/php
18306 <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>
18307 </p>
18308 !! html/parsoid
18309 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18310 !! end
18311
18312 !! test
18313 Double RFC
18314 !! wikitext
18315 RFC RFC 1234
18316 !! html
18317 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18318 </p>
18319 !! end
18320
18321 !! test
18322 Double RFC with a wiki link
18323 !! wikitext
18324 RFC [[RFC 1234]]
18325 !! html
18326 <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>
18327 </p>
18328 !! end
18329
18330 !! test
18331 RFC code coverage
18332 !! wikitext
18333 RFC 983&#x20;987
18334 !! html
18335 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18336 </p>
18337 !! html+tidy
18338 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18339 !! end
18340
18341 !! test
18342 Centre-aligned image
18343 !! wikitext
18344 [[Image:foobar.jpg|centre]]
18345 !! html
18346 <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>
18347
18348 !!end
18349
18350 !! test
18351 None-aligned image
18352 !! wikitext
18353 [[Image:foobar.jpg|none]]
18354 !! html
18355 <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>
18356
18357 !!end
18358
18359 !! test
18360 Width + Height sized image (using px) (height is ignored)
18361 !! wikitext
18362 [[Image:foobar.jpg|640x480px]]
18363 !! html
18364 <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>
18365 </p>
18366 !!end
18367
18368 !! test
18369 Width-sized image (using px, no following whitespace)
18370 !! wikitext
18371 [[Image:foobar.jpg|640px]]
18372 !! html
18373 <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>
18374 </p>
18375 !!end
18376
18377 !! test
18378 Width-sized image (using px, with following whitespace - test regression from r39467)
18379 !! wikitext
18380 [[Image:foobar.jpg|640px ]]
18381 !! html
18382 <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>
18383 </p>
18384 !!end
18385
18386 !! test
18387 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18388 !! wikitext
18389 [[Image:foobar.jpg| 640px]]
18390 !! html
18391 <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>
18392 </p>
18393 !!end
18394
18395 !! test
18396 Image with page parameter
18397 !! options
18398 djvu
18399 !! wikitext
18400 [[File:LoremIpsum.djvu|page=2]]
18401 !! html/php
18402 <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>
18403 </p>
18404 !! html/parsoid
18405 <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>
18406 !! end
18407
18408 !! test
18409 Another italics / bold test
18410 !! wikitext
18411 ''' ''x'
18412 !! html
18413 <pre>'<i> </i>x'
18414 </pre>
18415 !!end
18416
18417 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18418 !! test
18419 dt/dd/dl test
18420 !! wikitext
18421 :;;;::
18422 !! html/php
18423 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18424
18425 !! html/parsoid
18426 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18427
18428 !!end
18429
18430
18431 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18432 !! test
18433 Images with the "|" character in the comment
18434 !! wikitext
18435 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18436 !! html/php
18437 <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>
18438
18439 !! html/parsoid
18440 <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>
18441 !! end
18442
18443 !! test
18444 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18445 !! wikitext
18446 <html><script>alert(1);</script></html>
18447 !! html
18448 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18449 </p>
18450 !! end
18451
18452 !! test
18453 HTML with raw HTML ($wgRawHtml==true)
18454 !! options
18455 wgRawHtml=1
18456 !! wikitext
18457 <html><script>alert(1);</script></html>
18458 !! html
18459 <p><script>alert(1);</script>
18460 </p>
18461 !! end
18462
18463 !! test
18464 Parents of subpages, one level up
18465 !! options
18466 subpage title=[[Subpage test/L1/L2/L3]]
18467 !! wikitext
18468 [[../|L2]]
18469 !! html
18470 <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>
18471 </p>
18472 !! end
18473
18474
18475 !! test
18476 Parents of subpages, one level up, not named
18477 !! options
18478 subpage title=[[Subpage test/L1/L2/L3]]
18479 !! wikitext
18480 [[../]]
18481 !! html
18482 <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>
18483 </p>
18484 !! end
18485
18486
18487
18488 !! test
18489 Parents of subpages, two levels up
18490 !! options
18491 subpage title=[[Subpage test/L1/L2/L3]]
18492 !! wikitext
18493 [[../../|L1]]2
18494
18495 [[../../|L1]]l
18496 !! html
18497 <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
18498 </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>
18499 </p>
18500 !! end
18501
18502 !! test
18503 Parents of subpages, two levels up, without trailing slash or name.
18504 !! options
18505 subpage title=[[Subpage test/L1/L2/L3]]
18506 !! wikitext
18507 [[../..]]
18508 !! html
18509 <p>[[../..]]
18510 </p>
18511 !! end
18512
18513 !! test
18514 Parents of subpages, two levels up, with lots of extra trailing slashes.
18515 !! options
18516 subpage title=[[Subpage test/L1/L2/L3]]
18517 !! wikitext
18518 [[../../////]]
18519 !! html
18520 <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>
18521 </p>
18522 !! end
18523
18524 !! article
18525 Subpage test/L1/L2/L3Sibling
18526 !! text
18527 Sibling article
18528 !! endarticle
18529
18530 !! test
18531 Transclusion of a sibling page (one level up)
18532 !! options
18533 subpage title=[[Subpage test/L1/L2/L3]]
18534 !! wikitext
18535 {{../L3Sibling}}
18536 !! html
18537 <p>Sibling article
18538 </p>
18539 !! end
18540
18541 !! test
18542 Transclusion of a child page
18543 !! options
18544 subpage title=[[Subpage test/L1/L2]]
18545 !! wikitext
18546 {{/L3Sibling}}
18547 !! html
18548 <p>Sibling article
18549 </p>
18550 !! end
18551
18552 !! test
18553 Non-transclusion because of too many up levels
18554 !! options
18555 subpage title=[[Subpage test/L1/L2/L3]]
18556 !! wikitext
18557 {{../../../../More than parent}}
18558 !! html
18559 <p>{{../../../../More than parent}}
18560 </p>
18561 !! end
18562
18563 !! test
18564 Definition list code coverage
18565 !! wikitext
18566 ; title : def
18567 ; title : def
18568 ;title: def
18569 !! html/php
18570 <dl><dt> title &#160;</dt>
18571 <dd> def</dd>
18572 <dt> title&#160;</dt>
18573 <dd> def</dd>
18574 <dt>title</dt>
18575 <dd> def</dd></dl>
18576
18577 !! html/parsoid
18578 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18579 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18580 <dt>title</dt><dd> def</dd></dl>
18581 !! end
18582
18583 !! test
18584 Don't fall for the self-closing div
18585 !! wikitext
18586 <div>hello world</div/>
18587 !! html
18588 <div>hello world</div>
18589
18590 !! end
18591
18592 !! test
18593 MSGNW magic word
18594 !! wikitext
18595 {{MSGNW:msg}}
18596 !! html/php
18597 <p>&#91;&#91;:Template:Msg&#93;&#93;
18598 </p>
18599 !! end
18600
18601 !! test
18602 RAW magic word
18603 !! wikitext
18604 {{RAW:QUERTY}}
18605 !! html
18606 <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>
18607 </p>
18608 !! end
18609
18610 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18611 !! test
18612 Always escape literal '>' in output, not just after '<'
18613 !! wikitext
18614 ><>
18615 !! html
18616 <p>&gt;&lt;&gt;
18617 </p>
18618 !! end
18619
18620 !! test
18621 Template caching
18622 !! wikitext
18623 {{Test}}
18624 {{Test}}
18625 !! html
18626 <p>This is a test template
18627 This is a test template
18628 </p>
18629 !! end
18630
18631
18632 !! article
18633 MediaWiki:Fake
18634 !! text
18635 ==header==
18636 !! endarticle
18637
18638 !! test
18639 Inclusion of !userCanEdit() content
18640 !! wikitext
18641 {{MediaWiki:Fake}}
18642 !! html
18643 <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>
18644
18645 !! end
18646
18647
18648 !! test
18649 Out-of-order TOC heading levels
18650 !! wikitext
18651 ==2==
18652 ======6======
18653 ===3===
18654 =1=
18655 =====5=====
18656 ==2==
18657 !! html
18658 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18659 <ul>
18660 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18661 <ul>
18662 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18663 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18664 </ul>
18665 </li>
18666 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18667 <ul>
18668 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18669 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18670 </ul>
18671 </li>
18672 </ul>
18673 </div>
18674
18675 <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>
18676 <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>
18677 <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>
18678 <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>
18679 <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>
18680 <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>
18681
18682 !! end
18683
18684
18685 !! test
18686 ISBN with a dummy number
18687 !! wikitext
18688 ISBN ---
18689 !! html
18690 <p>ISBN ---
18691 </p>
18692 !! end
18693
18694
18695 !! test
18696 ISBN with space-delimited number
18697 !! wikitext
18698 ISBN 92 9017 032 8
18699 !! html
18700 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18701 </p>
18702 !! end
18703
18704
18705 !! test
18706 ISBN with multiple spaces, no number
18707 !! wikitext
18708 ISBN foo
18709 !! html
18710 <p>ISBN foo
18711 </p>
18712 !! end
18713
18714
18715 !! test
18716 ISBN length
18717 !! wikitext
18718 ISBN 123456789
18719
18720 ISBN 1234567890
18721
18722 ISBN 12345678901
18723 !! html
18724 <p>ISBN 123456789
18725 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18726 </p><p>ISBN 12345678901
18727 </p>
18728 !! end
18729
18730
18731 !! test
18732 ISBN with trailing year (bug 8110)
18733 !! wikitext
18734 ISBN 1-234-56789-0 - 2006
18735
18736 ISBN 1 234 56789 0 - 2006
18737 !! html
18738 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18739 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18740 </p>
18741 !! end
18742
18743
18744 !! test
18745 anchorencode
18746 !! wikitext
18747 {{anchorencode:foo bar©#%n}}
18748 !! html
18749 <p>foo_bar.C2.A9.23.25n
18750 </p>
18751 !! end
18752
18753 !! test
18754 anchorencode trims spaces
18755 !! wikitext
18756 {{anchorencode: __pretty__please__}}
18757 !! html
18758 <p>pretty_please
18759 </p>
18760 !! end
18761
18762 !! test
18763 anchorencode deals with links
18764 !! wikitext
18765 {{anchorencode: [[hello|world]] [[hi]]}}
18766 !! html
18767 <p>world_hi
18768 </p>
18769 !! end
18770
18771 !! test
18772 anchorencode deals with templates
18773 !! wikitext
18774 {{anchorencode: {{Foo}} }}
18775 !! html
18776 <p>FOO
18777 </p>
18778 !! end
18779
18780 !! test
18781 anchorencode encodes like the TOC generator: (bug 18431)
18782 !! wikitext
18783 === _ +:.3A%3A&&amp;]] ===
18784 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18785 __NOEDITSECTION__
18786 !! html
18787 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18788 <p>.2B:.3A.253A.26.26.5D.5D
18789 </p>
18790 !! end
18791
18792 !! test
18793 Bug 6200: blockquotes and paragraph formatting
18794 !! wikitext
18795 <blockquote>
18796 foo
18797 </blockquote>
18798
18799 bar
18800
18801 baz
18802 !! html
18803 <blockquote>
18804 <p>foo
18805 </p>
18806 </blockquote>
18807 <p>bar
18808 </p>
18809 <pre>baz
18810 </pre>
18811 !! end
18812
18813 !! test
18814 Bug 8293: Use of center tag ruins paragraph formatting
18815 !! wikitext
18816 <center>
18817 foo
18818 </center>
18819
18820 bar
18821
18822 baz
18823 !! html
18824 <center>
18825 <p>foo
18826 </p>
18827 </center>
18828 <p>bar
18829 </p>
18830 <pre>baz
18831 </pre>
18832 !! end
18833
18834 !!test
18835 Parsing of overlapping (improperly nested) inline html tags
18836 !! wikitext
18837 <span><s>x</span></s>
18838 !! html/php
18839 <p><span><s>x&lt;/span&gt;</s></span>
18840 </p>
18841 !! html/parsoid
18842 <p><span><s>x</s></span>
18843 </p>
18844 !!end
18845
18846 ###
18847 ### Language variants related tests
18848 ###
18849 !! test
18850 Self-link in language variants
18851 !! options
18852 title=[[Dunav]] language=sr
18853 !! wikitext
18854 Both [[Dunav]] and [[Дунав]] are names for this river.
18855 !! html
18856 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18857 </p>
18858 !!end
18859
18860 !! article
18861 Дуна
18862 !! text
18863 content
18864 !! endarticle
18865
18866 !! test
18867 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18868 !! options
18869 title=[[Duna]] language=sr
18870 !! wikitext
18871 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18872 !! html
18873 <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.
18874 </p>
18875 !! end
18876
18877 !! test
18878 Link to a section of a variant of this title shouldn't be parsed as self-link
18879 !! options
18880 title=[[Duna]] language=sr
18881 !! wikitext
18882 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18883 !! html
18884 <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.
18885 </p>
18886 !! end
18887
18888 !! test
18889 Link to pages in language variants
18890 !! options
18891 language=sr
18892 !! wikitext
18893 Main Page can be written as [[Маин Паге]]
18894 !! html
18895 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18896 </p>
18897 !!end
18898
18899
18900 !! test
18901 Multiple links to pages in language variants
18902 !! options
18903 language=sr
18904 !! wikitext
18905 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18906 !! html
18907 <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>.
18908 </p>
18909 !!end
18910
18911
18912 !! test
18913 Simple template in language variants
18914 !! options
18915 language=sr
18916 !! wikitext
18917 {{тест}}
18918 !! html
18919 <p>This is a test template
18920 </p>
18921 !! end
18922
18923
18924 !! test
18925 Template with explicit namespace in language variants
18926 !! options
18927 language=sr
18928 !! wikitext
18929 {{Template:тест}}
18930 !! html
18931 <p>This is a test template
18932 </p>
18933 !! end
18934
18935
18936 !! test
18937 Basic test for template parameter in language variants
18938 !! options
18939 language=sr
18940 !! wikitext
18941 {{парамтест|param=foo}}
18942 !! html
18943 <p>This is a test template with parameter foo
18944 </p>
18945 !! end
18946
18947
18948 !! test
18949 Simple category in language variants
18950 !! options
18951 language=sr cat
18952 !! wikitext
18953 [[Category:МедиаWики Усер'с Гуиде]]
18954 !! html
18955 <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>
18956 !! end
18957
18958
18959 !! article
18960 Category:分类
18961 !! text
18962 blah
18963 !! endarticle
18964
18965 !! article
18966 Category:分類
18967 !! text
18968 blah
18969 !! endarticle
18970
18971 !! test
18972 Don't convert blue categorylinks to another variant (bug 33210)
18973 !! options
18974 language=zh cat
18975 !! wikitext
18976 [[A]][[Category:分类]]
18977 !! html
18978 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18979 !! end
18980
18981
18982 !! test
18983 Stripping -{}- tags (language variants)
18984 !! options
18985 language=sr
18986 !! wikitext
18987 Latin proverb: -{Ne nuntium necare}-
18988 !! html
18989 <p>Latin proverb: Ne nuntium necare
18990 </p>
18991 !! end
18992
18993
18994 !! test
18995 Prevent conversion with -{}- tags (language variants)
18996 !! options
18997 language=sr variant=sr-ec
18998 !! wikitext
18999 Latinski: -{Ne nuntium necare}-
19000 !! html
19001 <p>Латински: Ne nuntium necare
19002 </p>
19003 !! end
19004
19005
19006 !! test
19007 Prevent conversion of text with -{}- tags (language variants)
19008 !! options
19009 language=sr variant=sr-ec
19010 !! wikitext
19011 Latinski: -{Ne nuntium necare}-
19012 !! html
19013 <p>Латински: Ne nuntium necare
19014 </p>
19015 !! end
19016
19017
19018 !! test
19019 Prevent conversion of links with -{}- tags (language variants)
19020 !! options
19021 language=sr variant=sr-ec
19022 !! wikitext
19023 -{[[Main Page]]}-
19024 !! html
19025 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19026 </p>
19027 !! end
19028
19029
19030 !! test
19031 -{}- tags within headlines (within html for parserConvert())
19032 !! options
19033 language=sr variant=sr-ec
19034 !! wikitext
19035 == -{Naslov}- ==
19036 !! html
19037 <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>
19038
19039 !! end
19040
19041
19042 !! test
19043 Explicit definition of language variant alternatives
19044 !! options
19045 language=zh variant=zh-tw
19046 !! wikitext
19047 -{zh:China;zh-tw:Taiwan}-, not China
19048 !! html
19049 <p>Taiwan, not China
19050 </p>
19051 !! end
19052
19053
19054 !! test
19055 Conversion around HTML tags
19056 !! options
19057 language=sr variant=sr-ec
19058 !! wikitext
19059 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19060 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19061 !! html
19062 <p>
19063 <span title="ЛаCтин">ски</span>
19064 </p>
19065 !! end
19066
19067
19068 !! test
19069 Explicit session-wise language variant mapping (A flag and - flag)
19070 !! options
19071 language=zh variant=zh-tw
19072 !! wikitext
19073 Taiwan is not China.
19074 But -{A|zh:China;zh-tw:Taiwan}- is China,
19075 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19076 and -{China}- is China.
19077 !! html
19078 <p>Taiwan is not China.
19079 But Taiwan is Taiwan,
19080 (This should be stripped!)
19081 and China is China.
19082 </p>
19083 !! end
19084
19085 !! test
19086 Explicit session-wise language variant mapping (H flag for hide)
19087 !! options
19088 language=zh variant=zh-tw
19089 !! wikitext
19090 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19091 Taiwan is China.
19092 !! html
19093 <p>(This should be stripped!)
19094 Taiwan is Taiwan.
19095 </p>
19096 !! end
19097
19098 !! test
19099 Adding explicit conversion rule for title (T flag)
19100 !! options
19101 language=zh variant=zh-tw showtitle
19102 !! wikitext
19103 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19104 !! html
19105 Taiwan
19106 <p>Should be stripped!
19107 </p>
19108 !! end
19109
19110 !! test
19111 Testing that changing the language variant here in the tests actually works
19112 !! options
19113 language=zh variant=zh showtitle
19114 !! wikitext
19115 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19116 !! html
19117 China
19118 <p>Should be stripped!
19119 </p>
19120 !! end
19121
19122 !! test
19123 Recursive conversion of alt and title attrs shouldn't clear converter state
19124 !! options
19125 language=zh variant=zh-cn showtitle
19126 !! wikitext
19127 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19128 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19129 !! html
19130 China
19131 <p>
19132 Should be stripped<span title="Exclamation">!</span>
19133 </p>
19134 !! end
19135
19136 !! test
19137 Bug 24072: more test on conversion rule for title
19138 !! options
19139 language=zh variant=zh-tw showtitle
19140 !! wikitext
19141 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19142 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19143 !! html
19144 Taiwan
19145 <p>This should be stripped!
19146 This won't take interferes with the title rule.
19147 </p>
19148 !! end
19149
19150 !! test
19151 Partly disable title conversion if variant == main language code
19152 !! options
19153 language=zh variant=zh title=[[ZH]] showtitle
19154 !! wikitext
19155 -{T|zh-cn:CN;zh-tw:TW}-
19156 !! html
19157 ZH
19158 <p>
19159 </p>
19160 !! end
19161
19162 !! test
19163 Partly disable title conversion if variant == main language code, more
19164 !! options
19165 language=zh variant=zh title=[[ZH]] showtitle
19166 !! wikitext
19167 -{T|TW}-
19168 !! html
19169 ZH
19170 <p>
19171 </p>
19172 !! end
19173
19174 !! test
19175 Raw output of variant escape tags (R flag)
19176 !! options
19177 language=zh variant=zh-tw
19178 !! wikitext
19179 Raw: -{R|zh:China;zh-tw:Taiwan}-
19180 !! html
19181 <p>Raw: zh:China;zh-tw:Taiwan
19182 </p>
19183 !! end
19184
19185 !! test
19186 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19187 !! options
19188 language=zh variant=zh-cn
19189 !! input
19190 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19191 !! result
19192 <p>0
19193 </p>
19194 !! end
19195
19196 !! test
19197 Conversion rules from [numeric-only string] to [something else] (T48634)
19198 !! options
19199 language=zh variant=zh-cn
19200 !! input
19201 -{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
19202 !! result
19203 <p>D12345EE12345
19204 </p>
19205 !! end
19206
19207 !! test
19208 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19209 !! options
19210 language=zh variant=zh-cn
19211 !! input
19212 -{H|zh-cn:foo;zh-tw:;}-foobar
19213 !! result
19214 <p>foobar
19215 </p>
19216 !! end
19217
19218 !! test
19219 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19220 !! options
19221 language=zh variant=zh-cn
19222 !! input
19223 -{H|=>zh-cn:foo;}-foobar
19224 !! result
19225 <p>foobar
19226 </p>
19227 !! end
19228
19229 !! test
19230 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19231 !! options
19232 language=zh variant=zh-cn
19233 !! input
19234 -{H|}-foobar
19235 !! result
19236 <p>foobar
19237 </p>
19238 !! end
19239
19240 !! test
19241 Nested using of manual convert syntax
19242 !! options
19243 language=zh variant=zh-hk
19244 !! wikitext
19245 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19246 !! html
19247 <p>Nested: Hello Hong Kong!
19248 </p>
19249 !! end
19250
19251 !! test
19252 Proper conversion of text in external links
19253 !! options
19254 language=sr variant=sr-ec
19255 !! wikitext
19256 http://www.google.com
19257 gopher://www.google.com
19258 [http://www.google.com http://www.google.com]
19259 [gopher://www.google.com gopher://www.google.com]
19260 [https://www.google.com irc://www.google.com]
19261 [ftp://www.google.com www.google.com/ftp://dir]
19262 [//www.google.com www.google.com]
19263 !! html
19264 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19265 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19266 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19267 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19268 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19269 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19270 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19271 </p>
19272 !! end
19273
19274 !! test
19275 Do not convert roman numbers to language variants
19276 !! options
19277 language=sr variant=sr-ec
19278 !! wikitext
19279 Fridrih IV je car.
19280 !! html
19281 <p>Фридрих IV је цар.
19282 </p>
19283 !! end
19284
19285 !! test
19286 Unclosed language converter markup "-{"
19287 !! options
19288 language=sr
19289 !! wikitext
19290 -{T|hello
19291 !! html
19292 <p>-{T|hello
19293 </p>
19294 !! end
19295
19296 !! test
19297 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19298 !! options
19299 language=sr
19300 !! wikitext
19301 -{R|=&gt;}-
19302 !! html
19303 <p>=&gt;
19304 </p>
19305 !!end
19306
19307 !! test
19308 Don't break link parsing if language converter markup is in the caption.
19309 !! options
19310 language=sr variant=sr-ec
19311 !! wikitext
19312 [[Main Page|-{R|main page}-]]
19313 !! html
19314 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19315 </p>
19316 !! end
19317
19318 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19319 !! test
19320 Don't break image parsing if language converter markup is in the caption.
19321 !! options
19322 language=sr
19323 !! wikitext
19324 [[File:Foobar.jpg|-{R|caption}-]]
19325 !! html/parsoid
19326 <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>
19327 </p>
19328 !! end
19329
19330 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19331 !! test
19332 Don't break list handling if language converter markup is in the item.
19333 !! options
19334 language=zh variant=zh-cn
19335 !! wikitext
19336 ;-{zh-cn:AAA;zh-tw:BBB}-
19337 !! html/php
19338 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19339
19340 !! html/parsoid
19341 <dl><dt>AAA
19342 </dt></dl>
19343 !! end
19344
19345 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19346 !! test
19347 Don't break table handling if language converter markup is in the cell.
19348 !! options
19349 language=sr variant=sr-ec
19350 !! wikitext
19351 {|
19352 |-
19353 | -{R|B}-
19354 |}
19355 !! html/php
19356 <table>
19357
19358 <tr>
19359 <td>Б}-
19360 </td></tr></table>
19361
19362 !! html/parsoid
19363 <table>
19364
19365 <tr>
19366 <td> B
19367 </td></tr></table>
19368
19369 !! end
19370
19371 !! test
19372 Bug 529: Uncovered bullet
19373 !! wikitext
19374 * Foo {{bullet}}
19375 !! html
19376 <ul><li> Foo </li>
19377 <li> Bar</li></ul>
19378
19379 !! end
19380
19381 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19382 # Templates in Wikipedia rely on this behavior, as tidy has always been
19383 # enabled there. These tests are normally run *without* tidy, so specify the
19384 # full output here.
19385 # To test realistic parsing behavior, apply a tidy-like transformation to both
19386 # the expected output and your parser's output.
19387 !! test
19388 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19389 !! wikitext
19390 ******* Foo {{bullet}}
19391 !! html
19392 <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>
19393 <li> Bar</li></ul>
19394
19395 !! end
19396
19397 !! test
19398 Bug 529: Uncovered table already at line-start
19399 !! wikitext
19400 x
19401
19402 {{table}}
19403 y
19404 !! html
19405 <p>x
19406 </p>
19407 <table>
19408 <tr>
19409 <td> 1 </td>
19410 <td> 2
19411 </td></tr>
19412 <tr>
19413 <td> 3 </td>
19414 <td> 4
19415 </td></tr></table>
19416 <p>y
19417 </p>
19418 !! end
19419
19420 !! test
19421 Bug 529: Uncovered bullet in parser function result
19422 !! wikitext
19423 * Foo {{lc:{{bullet}} }}
19424 !! html
19425 <ul><li> Foo </li>
19426 <li> bar</li></ul>
19427
19428 !! end
19429
19430 !! test
19431 Bug 5678: Double-parsed template argument
19432 !! wikitext
19433 {{lc:{{{1}}}|hello}}
19434 !! html
19435 <p>{{{1}}}
19436 </p>
19437 !! end
19438
19439 !! test
19440 Bug 5678: Double-parsed template invocation
19441 !! wikitext
19442 {{lc:{{paramtest {{!}} param = hello }} }}
19443 !! html
19444 <p>{{paramtest | param = hello }}
19445 </p>
19446 !! end
19447
19448 !! test
19449 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19450 !! options
19451 language=cs
19452 title=[[Main Page]]
19453 !! wikitext
19454 {{PRVNÍVELKÉ:ěščř}}
19455 {{prvnívelké:ěščř}}
19456 {{PRVNÍMALÉ:ěščř}}
19457 {{prvnímalé:ěščř}}
19458 {{MALÁ:ěščř}}
19459 {{malá:ěščř}}
19460 {{VELKÁ:ěščř}}
19461 {{velká:ěščř}}
19462 !! html
19463 <p>Ěščř
19464 Ěščř
19465 ěščř
19466 ěščř
19467 ěščř
19468 ěščř
19469 ĚŠČŘ
19470 ĚŠČŘ
19471 </p>
19472 !! end
19473
19474 !! test
19475 Morwen/13: Unclosed link followed by heading
19476 !! wikitext
19477 [[link
19478 ==heading==
19479 !! html
19480 <p>[[link
19481 </p>
19482 <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>
19483
19484 !! end
19485
19486 !! test
19487 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19488 !! wikitext
19489 {{foo|
19490 =heading=
19491 !! html
19492 <p>{{foo|
19493 </p>
19494 <h1><span class="mw-headline" id="heading">heading</span></h1>
19495
19496 !! end
19497
19498 !! test
19499 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19500 !! wikitext
19501 {{foo|
19502 ==heading==
19503 !! html
19504 <p>{{foo|
19505 </p>
19506 <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>
19507
19508 !! end
19509
19510 !! test
19511 Tildes in comments
19512 !! options
19513 pst
19514 !! wikitext
19515 <!-- ~~~~ -->
19516 !! html
19517 <!-- ~~~~ -->
19518 !! end
19519
19520 !! test
19521 Paragraphs inside divs (no extra line breaks)
19522 !! wikitext
19523 <div>Line one
19524
19525 Line two</div>
19526 !! html
19527 <div>Line one
19528 Line two</div>
19529
19530 !! end
19531
19532 !! test
19533 Paragraphs inside divs (extra line break on open)
19534 !! wikitext
19535 <div>
19536 Line one
19537
19538 Line two</div>
19539 !! html
19540 <div>
19541 <p>Line one
19542 </p>
19543 Line two</div>
19544
19545 !! end
19546
19547 !! test
19548 Paragraphs inside divs (extra line break on close)
19549 !! wikitext
19550 <div>Line one
19551
19552 Line two
19553 </div>
19554 !! html
19555 <div>Line one
19556 <p>Line two
19557 </p>
19558 </div>
19559
19560 !! end
19561
19562 !! test
19563 Paragraphs inside divs (extra line break on open and close)
19564 !! wikitext
19565 <div>
19566 Line one
19567
19568 Line two
19569 </div>
19570 !! html
19571 <div>
19572 <p>Line one
19573 </p><p>Line two
19574 </p>
19575 </div>
19576
19577 !! end
19578
19579 !! test
19580 Nesting tags, paragraphs on lines which begin with <div>
19581 !! wikitext
19582 <div></div><strong>A
19583 B</strong>
19584 !! html/php+tidy
19585 <p><strong>A</strong></p>
19586 <p><strong>B</strong></p>
19587 !! html/parsoid
19588 <div></div>
19589 <p><strong>A
19590 B</strong>
19591 </p>
19592 !! end
19593
19594 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19595 !! test
19596 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19597 !! wikitext
19598 <blockquote>Line one
19599
19600 Line two</blockquote>
19601 !! html
19602 <blockquote>Line one
19603 Line two</blockquote>
19604
19605 !! html+tidy
19606 <blockquote>
19607 <p>Line one Line two</p>
19608 </blockquote>
19609 !! end
19610
19611 !! test
19612 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19613 !! wikitext
19614 <blockquote>
19615 Line one
19616
19617 Line two</blockquote>
19618 !! html
19619 <blockquote>
19620 <p>Line one
19621 </p>
19622 Line two</blockquote>
19623
19624 !! html+tidy
19625 <blockquote>
19626 <p>Line one</p>
19627 Line two</blockquote>
19628 !! end
19629
19630 !! test
19631 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19632 !! wikitext
19633 <blockquote>Line one
19634
19635 Line two
19636 </blockquote>
19637 !! html
19638 <blockquote>Line one
19639 <p>Line two
19640 </p>
19641 </blockquote>
19642
19643 !! html+tidy
19644 <blockquote>
19645 <p>Line one</p>
19646 <p>Line two</p>
19647 </blockquote>
19648 !! end
19649
19650 !! test
19651 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19652 !! wikitext
19653 <blockquote>
19654 Line one
19655
19656 Line two
19657 </blockquote>
19658 !! html
19659 <blockquote>
19660 <p>Line one
19661 </p><p>Line two
19662 </p>
19663 </blockquote>
19664
19665 !! html+tidy
19666 <blockquote>
19667 <p>Line one</p>
19668 <p>Line two</p>
19669 </blockquote>
19670 !! end
19671
19672 !! test
19673 Paragraphs inside blockquotes/divs (no extra line breaks)
19674 !! wikitext
19675 <blockquote><div>Line one
19676
19677 Line two</div></blockquote>
19678 !! html
19679 <blockquote><div>Line one
19680 Line two</div></blockquote>
19681
19682 !! end
19683
19684 !! test
19685 Paragraphs inside blockquotes/divs (extra line break on open)
19686 !! wikitext
19687 <blockquote><div>
19688 Line one
19689
19690 Line two</div></blockquote>
19691 !! html
19692 <blockquote><div>
19693 <p>Line one
19694 </p>
19695 Line two</div></blockquote>
19696
19697 !! end
19698
19699 !! test
19700 Paragraphs inside blockquotes/divs (extra line break on close)
19701 !! wikitext
19702 <blockquote><div>Line one
19703
19704 Line two
19705 </div></blockquote>
19706 !! html
19707 <blockquote><div>Line one
19708 <p>Line two
19709 </p>
19710 </div></blockquote>
19711
19712 !! end
19713
19714 !! test
19715 Paragraphs inside blockquotes/divs (extra line break on open and close)
19716 !! wikitext
19717 <blockquote><div>
19718 Line one
19719
19720 Line two
19721 </div></blockquote>
19722 !! html
19723 <blockquote><div>
19724 <p>Line one
19725 </p><p>Line two
19726 </p>
19727 </div></blockquote>
19728
19729 !! end
19730
19731 !! test
19732 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19733 !! options
19734 wgLinkHolderBatchSize=0
19735 !! wikitext
19736 [[meatball:1]]
19737 [[meatball:2]]
19738 [[meatball:3]]
19739 !! html
19740 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19741 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19742 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19743 </p>
19744 !! end
19745
19746 !! test
19747 Free external link invading image caption
19748 !! wikitext
19749 [[Image:Foobar.jpg|thumb|http://x|hello]]
19750 !! html
19751 <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>
19752
19753 !! end
19754
19755 !! test
19756 Bug 15196: localised external link numbers
19757 !! options
19758 language=fa
19759 !! wikitext
19760 [http://en.wikipedia.org/]
19761 !! html/php
19762 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19763 </p>
19764 !! html/parsoid
19765 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19766 !! end
19767
19768 !! test
19769 Multibyte character in padleft
19770 !! wikitext
19771 {{padleft:-Hello|7|Æ}}
19772 !! html
19773 <p>Æ-Hello
19774 </p>
19775 !! end
19776
19777 !! test
19778 Multibyte character in padright
19779 !! wikitext
19780 {{padright:Hello-|7|Æ}}
19781 !! html
19782 <p>Hello-Æ
19783 </p>
19784 !! end
19785
19786 !!test
19787 formatdate parser function
19788 !! wikitext
19789 {{#formatdate:2009-03-24}}
19790 !! html
19791 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19792 </p>
19793 !! end
19794
19795 !!test
19796 formatdate parser function, with default format
19797 !! wikitext
19798 {{#formatdate:2009-03-24|mdy}}
19799 !! html
19800 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19801 </p>
19802 !! end
19803
19804 !! test
19805 Spacing of numbers in formatted dates
19806 !! wikitext
19807 {{#formatdate:January 15}}
19808 !! html
19809 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19810 </p>
19811 !! end
19812
19813 !! test
19814 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
19815 !! options
19816 language=nl title=[[MediaWiki:Common.css]]
19817 !! wikitext
19818 {{#formatdate:2009-03-24|dmy}}
19819 !! html
19820 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19821 </p>
19822 !! end
19823
19824 #
19825 #
19826 #
19827
19828 #
19829 # Edit comments
19830 #
19831
19832 !! test
19833 Edit comment with link
19834 !! options
19835 comment
19836 !! wikitext
19837 I like the [[Main Page]] a lot
19838 !! html
19839 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19840 !!end
19841
19842 !! test
19843 Edit comment with link and link text
19844 !! options
19845 comment
19846 !! wikitext
19847 I like the [[Main Page|best pages]] a lot
19848 !! html
19849 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19850 !!end
19851
19852 !! test
19853 Edit comment with link and link text with suffix
19854 !! options
19855 comment
19856 !! wikitext
19857 I like the [[Main Page|best page]]s a lot
19858 !! html
19859 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19860 !!end
19861
19862 !! test
19863 Edit comment with section link (non-local, eg in history list)
19864 !! options
19865 comment title=[[Main Page]]
19866 !! wikitext
19867 /* External links */ removed bogus entries
19868 !! html
19869 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19870 !!end
19871
19872 !! test
19873 Edit comment with section link and text before it (non-local, eg in history list)
19874 !! options
19875 comment title=[[Main Page]]
19876 !! wikitext
19877 pre-comment text /* External links */ removed bogus entries
19878 !! html
19879 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>
19880 !!end
19881
19882 !! test
19883 Edit comment with section link (local, eg in diff view)
19884 !! options
19885 comment local title=[[Main Page]]
19886 !! wikitext
19887 /* External links */ removed bogus entries
19888 !! html
19889 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19890 !!end
19891
19892 !! test
19893 Edit comment with subpage link (bug 14080)
19894 !! options
19895 comment
19896 subpage
19897 title=[[Subpage test]]
19898 !! wikitext
19899 Poked at a [[/subpage]] here...
19900 !! html
19901 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19902 !!end
19903
19904 !! test
19905 Edit comment with subpage link and link text (bug 14080)
19906 !! options
19907 comment
19908 subpage
19909 title=[[Subpage test]]
19910 !! wikitext
19911 Poked at a [[/subpage|neat little page]] here...
19912 !! html
19913 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19914 !!end
19915
19916 !! test
19917 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19918 !! options
19919 comment
19920 title=[[Subpage test]]
19921 !! wikitext
19922 Poked at a [[/subpage]] here...
19923 !! html
19924 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...
19925 !!end
19926
19927 !! test
19928 Edit comment with bare anchor link (local, as on diff)
19929 !! options
19930 comment
19931 local
19932 title=[[Main Page]]
19933 !! wikitext
19934 [[#section]]
19935 !! html
19936 <a href="#section">#section</a>
19937 !! end
19938
19939 !! test
19940 Edit comment with bare anchor link (non-local, as on history)
19941 !! options
19942 comment
19943 title=[[Main Page]]
19944 !! wikitext
19945 [[#section]]
19946 !! html
19947 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19948 !! end
19949
19950 !! test
19951 Anchor starting with underscore
19952 !! wikitext
19953 [[#_ref|One]]
19954 !! html
19955 <p><a href="#_ref">One</a>
19956 </p>
19957 !! end
19958
19959 !! test
19960 Id starting with underscore
19961 !! wikitext
19962 <div id="_ref"></div>
19963 !! html
19964 <div id="_ref"></div>
19965
19966 !! end
19967
19968 !! test
19969 Space normalisation on autocomment (bug 22784)
19970 !! options
19971 comment
19972 title=[[Main Page]]
19973 !! wikitext
19974 /* __hello__world__ */
19975 !! html
19976 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19977 !! end
19978
19979 !! test
19980 percent-encoding and + signs in comments (Bug 26410)
19981 !! options
19982 comment
19983 !! wikitext
19984 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19985 !! html/php
19986 <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>
19987 !! end
19988
19989 # Parsoid doesn't support this yet: see bug 73581
19990 # but it *should* omit the 'src' attribute if the image is bad.
19991 # PHP side of tests was disabled in
19992 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19993 # because of issues in the PHP parserTests infrastructure
19994 # (but the output below is indeed what the PHP side emits)
19995 !! test
19996 Bad images - basic functionality
19997 !! wikitext
19998 [[File:Bad.jpg]]
19999 !! DISABLED/html/php
20000 !! html/parsoid
20001 <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>
20002 !! end
20003
20004 !! test
20005 Bad images - bug 16039: text after bad image disappears
20006 !! wikitext
20007 Foo bar
20008 [[File:Bad.jpg]]
20009 Bar foo
20010 !! DISABLED/html/php
20011 <p>Foo bar
20012 </p><p>Bar foo
20013 </p>
20014 !! html/parsoid
20015 <p>Foo bar
20016 <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>
20017 Bar foo</p>
20018 !! end
20019
20020 !! test
20021 Verify that displaytitle works (bug #22501) no displaytitle
20022 !! options
20023 showtitle
20024 !! config
20025 wgAllowDisplayTitle=true
20026 wgRestrictDisplayTitle=false
20027 !! wikitext
20028 this is not the the title
20029 !! html/php
20030 Parser test
20031 <p>this is not the the title
20032 </p>
20033 !! end
20034
20035 !! test
20036 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20037 !! options
20038 showtitle
20039 title=[[Screen]]
20040 !! config
20041 wgAllowDisplayTitle=true
20042 wgRestrictDisplayTitle=false
20043 !! wikitext
20044 this is not the the title
20045 {{DISPLAYTITLE:whatever}}
20046 !! html/php
20047 whatever
20048 <p>this is not the the title
20049 </p>
20050 !! end
20051
20052 !! test
20053 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20054 !! options
20055 showtitle
20056 title=[[Screen]]
20057 !! config
20058 wgAllowDisplayTitle=true
20059 wgRestrictDisplayTitle=true
20060 !! wikitext
20061 this is not the the title
20062 {{DISPLAYTITLE:whatever}}
20063 !! html/php
20064 Screen
20065 <p>this is not the the title
20066 </p>
20067 !! end
20068
20069 !! test
20070 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20071 !! options
20072 showtitle
20073 title=[[Screen]]
20074 !! config
20075 wgAllowDisplayTitle=true
20076 wgRestrictDisplayTitle=true
20077 !! wikitext
20078 this is not the the title
20079 {{DISPLAYTITLE:screen}}
20080 !! html/php
20081 screen
20082 <p>this is not the the title
20083 </p>
20084 !! end
20085
20086 !! test
20087 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20088 !! options
20089 showtitle
20090 title=[[Screen]]
20091 !! config
20092 wgAllowDisplayTitle=false
20093 !! wikitext
20094 this is not the the title
20095 {{DISPLAYTITLE:screen}}
20096 !! html/php
20097 Screen
20098 <p>this is not the the title
20099 <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>
20100 </p>
20101 !! end
20102
20103 !! test
20104 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20105 !! options
20106 showtitle
20107 title=[[Screen]]
20108 !! config
20109 wgAllowDisplayTitle=false
20110 !! wikitext
20111 this is not the the title
20112 !! html/php
20113 Screen
20114 <p>this is not the the title
20115 </p>
20116 !! end
20117
20118 !! test
20119 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20120 !! options
20121 showtitle
20122 title=[[Screen]]
20123 !! config
20124 wgAllowDisplayTitle=true
20125 wgRestrictDisplayTitle=true
20126 !! wikitext
20127 this is not the the title
20128 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20129 !! html/php
20130 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20131 <p>this is not the the title
20132 </p>
20133 !! end
20134
20135 !! test
20136 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20137 !! options
20138 showtitle
20139 title=[[Screen]]
20140 !! config
20141 wgAllowDisplayTitle=true
20142 wgRestrictDisplayTitle=true
20143 !! wikitext
20144 this is not the the title
20145 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20146 !! html/php
20147 <span style="color: red;">s</span>creen
20148 <p>this is not the the title
20149 </p>
20150 !! end
20151
20152 !! test
20153 Page status indicators: Empty name is invalid
20154 !! options
20155 showindicators
20156 !! wikitext
20157 <indicator name=" "></indicator>
20158 <indicator></indicator>
20159 !! html
20160 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20161 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20162 </p>
20163 !! end
20164
20165 !! test
20166 Page status indicators: Weird syntaxes that are okay
20167 !! options
20168 showindicators
20169 !! wikitext
20170 <indicator name="empty" />
20171 <indicator name="name"></indicator>
20172 !! html
20173 empty=
20174 name=
20175 <p><br />
20176 </p>
20177 !! end
20178
20179 !! test
20180 Page status indicators: Torture test
20181 !! options
20182 showindicators
20183 !! wikitext
20184 <indicator name="01">hello world</indicator>
20185 <indicator name="02">[[Main Page]]</indicator>
20186 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20187 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20188 <indicator name="05">* foo
20189 * bar</indicator>
20190 <indicator name="06"><nowiki>foo</nowiki></indicator>
20191 <indicator name="07"> Preformatted</indicator>
20192 <indicator name="08"><div>Broken tag</indicator>
20193 <indicator name="09">{| class=wikitable
20194 | cell
20195 |}</indicator>
20196 <indicator name="10">Two
20197
20198 paragraphs</indicator>
20199 !! html
20200 01=hello world
20201 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20202 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" />
20203 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>
20204 05=<ul><li> foo</li>
20205 <li> bar</li></ul>
20206
20207 06=foo
20208 07=<pre>Preformatted
20209 </pre>
20210 08=<div>Broken tag</div>
20211
20212 09=<table class="wikitable">
20213 <tr>
20214 <td> cell
20215 </td></tr></table>
20216
20217 10=<p>Two
20218 </p><p>paragraphs
20219 </p>
20220 <p><br />
20221 </p><p><br />
20222 </p><p><br />
20223 </p><p><br />
20224 </p><p><br />
20225 </p>
20226 !! end
20227
20228 !! test
20229 preload: check <noinclude> and <includeonly>
20230 !! options
20231 preload
20232 !! wikitext
20233 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20234 !! html/php
20235 Hello kind world.
20236 !! end
20237
20238 !! test
20239 preload: check <onlyinclude>
20240 !! options
20241 preload
20242 !! wikitext
20243 Goodbye <onlyinclude>Hello world</onlyinclude>
20244 !! html/php
20245 Hello world
20246 !! end
20247
20248 !! test
20249 preload: can pass tags through if we want to
20250 !! options
20251 preload
20252 !! wikitext
20253 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20254 !! html/php
20255 <includeonly>Hello world</includeonly>
20256 !! end
20257
20258 !! test
20259 preload: check that it doesn't try to do tricks
20260 !! options
20261 preload
20262 !! wikitext
20263 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20264 !! html/php
20265 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20266 !! end
20267
20268 !! test
20269 Play a bit with r67090 and bug 3158
20270 !! wikitext
20271 <div style="width:50% !important">&nbsp;</div>
20272 <div style="width:50%&nbsp;!important">&nbsp;</div>
20273 <div style="width:50%&#160;!important">&nbsp;</div>
20274 <div style="border : solid;">&nbsp;</div>
20275 !! html/php
20276 <div style="width:50% !important">&#160;</div>
20277 <div style="width:50% !important">&#160;</div>
20278 <div style="width:50% !important">&#160;</div>
20279 <div style="border&#160;: solid;">&#160;</div>
20280
20281 !! html/parsoid
20282 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20283 <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>
20284 <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>
20285 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20286
20287 !! end
20288
20289 !! test
20290 HTML5 data attributes
20291 !! wikitext
20292 <span data-foo="bar">Baz</span>
20293 <p data-abc-def_hij="">Quuz</p>
20294 !! html
20295 <p><span data-foo="bar">Baz</span>
20296 </p>
20297 <p data-abc-def_hij="">Quuz</p>
20298
20299 !! end
20300
20301 !! test
20302 percent-encoding and + signs in internal links (Bug 26410)
20303 !! wikitext
20304 [[User:+%]] [[Page+title%]]
20305 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20306 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20307 [[%33%45]] [[%33%45+]]
20308 !! html/php
20309 <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>
20310 <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>
20311 <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>
20312 <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>
20313 </p>
20314 !! html/parsoid
20315 <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>
20316 <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>
20317 <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>
20318 <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>
20319 !! end
20320
20321 !! test
20322 Special characters in embedded file links (bug 27679)
20323 !! wikitext
20324 [[File:Contains & ampersand.jpg]]
20325 [[File:Does not exist.jpg|Title with & ampersand]]
20326 !! html/php
20327 <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>
20328 <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>
20329 </p>
20330 !! html/parsoid
20331 <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>
20332 <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>
20333 !! end
20334
20335 !! test
20336 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20337 !! wikitext
20338 Text&apos;s been normalized?
20339 !! html
20340 <p>Text&#39;s been normalized?
20341 </p>
20342 !! end
20343
20344 !! test
20345 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20346 !! wikitext
20347 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20348 !! html
20349 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20350 </p>
20351 !! end
20352
20353 !! test
20354 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20355 !! wikitext
20356 [http://www.example.org/ ideograms]
20357 !! html
20358 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20359 </p>
20360 !! end
20361
20362 !! test
20363 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20364 !! wikitext
20365 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20366 !! html
20367 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20368 </p>
20369 !! end
20370
20371 !! article
20372 Mediawiki:loop1
20373 !! text
20374 {{Identical|A}}
20375 !! endarticle
20376
20377 !! article
20378 Mediawiki:loop2
20379 !! text
20380 {{Identical|B}}
20381 !! endarticle
20382
20383 !! article
20384 Template:Identical
20385 !! text
20386 {{int:loop1}}
20387 {{int:loop2}}
20388 !! endarticle
20389
20390 !! test
20391 Bug 31098 Template which includes system messages which includes the template
20392 !! wikitext
20393 {{Identical}}
20394 !! html
20395 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20396 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20397 </p>
20398 !! end
20399
20400 !! test
20401 Bug31490 Turkish: ucfirst 'blah'
20402 !! options
20403 language=tr
20404 !! wikitext
20405 {{ucfirst:blah}}
20406 !! html
20407 <p>Blah
20408 </p>
20409 !! end
20410
20411 !! test
20412 Bug31490 Turkish: ucfirst 'ix'
20413 !! options
20414 language=tr
20415 !! wikitext
20416 {{ucfirst:ix}}
20417 !! html
20418 <p>İx
20419 </p>
20420 !! end
20421
20422 !! test
20423 Bug31490 Turkish: lcfirst 'BLAH'
20424 !! options
20425 language=tr
20426 !! wikitext
20427 {{lcfirst:BLAH}}
20428 !! html
20429 <p>bLAH
20430 </p>
20431 !! end
20432
20433 !! test
20434 Bug31490 Turkish: ucfırst (with a dotless i)
20435 !! options
20436 language=tr
20437 !! wikitext
20438 {{ucfırst:blah}}
20439 !! html
20440 <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>
20441 </p>
20442 !! end
20443
20444 !! test
20445 Bug31490 ucfırst (with a dotless i) with English language
20446 !! options
20447 language=en
20448 !! wikitext
20449 {{ucfırst:blah}}
20450 !! html
20451 <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>
20452 </p>
20453 !! end
20454
20455 !! test
20456 Bug 26375: TOC with italics
20457 !! options
20458 title=[[Main Page]]
20459 !! wikitext
20460 __TOC__
20461 == ''Lost'' episodes ==
20462 !! html
20463 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20464 <ul>
20465 <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>
20466 </ul>
20467 </div>
20468
20469 <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>
20470
20471 !! end
20472
20473 !! test
20474 Bug 26375: TOC with bold
20475 !! options
20476 title=[[Main Page]]
20477 !! wikitext
20478 __TOC__
20479 == '''should be bold''' then normal text ==
20480 !! html
20481 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20482 <ul>
20483 <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>
20484 </ul>
20485 </div>
20486
20487 <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>
20488
20489 !! end
20490
20491 !! test
20492 Bug 33845: Headings become cursive in TOC when they contain an image
20493 !! options
20494 title=[[Main Page]]
20495 !! wikitext
20496 __TOC__
20497 == Image [[Image:foobar.jpg]] ==
20498 !! html
20499 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20500 <ul>
20501 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20502 </ul>
20503 </div>
20504
20505 <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>
20506
20507 !! end
20508
20509 !! test
20510 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20511 !! options
20512 title=[[Main Page]]
20513 !! wikitext
20514 __TOC__
20515 == <blockquote>Quote</blockquote> ==
20516 !! html
20517 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20518 <ul>
20519 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20520 </ul>
20521 </div>
20522
20523 <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>
20524
20525 !! html+tidy
20526 <p></p>
20527 <div id="toc" class="toc">
20528 <div id="toctitle">
20529 <h2>Contents</h2>
20530 </div>
20531 <ul>
20532 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20533 </ul>
20534 </div>
20535 <p></p>
20536 <h2><span class="mw-headline" id="Quote"></span></h2>
20537 <blockquote>
20538 <p><span class="mw-headline" id="Quote">Quote</span></p>
20539 </blockquote>
20540 <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>
20541 !! end
20542
20543 !! test
20544 Unclosed tags in TOC
20545 !! options
20546 title=[[Main Page]]
20547 !! wikitext
20548 __TOC__
20549 == Proof: 2 < 3 ==
20550 <small>Hanc marginis exiguitas non caperet.</small>
20551 QED
20552 !! html
20553 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20554 <ul>
20555 <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>
20556 </ul>
20557 </div>
20558
20559 <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>
20560 <p><small>Hanc marginis exiguitas non caperet.</small>
20561 QED
20562 </p>
20563 !! end
20564
20565 !! test
20566 Multiple tags in TOC
20567 !! wikitext
20568 __TOC__
20569 == <i>Foo</i> <b>Bar</b> ==
20570
20571 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20572 !! html
20573 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20574 <ul>
20575 <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>
20576 <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>
20577 </ul>
20578 </div>
20579
20580 <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>
20581 <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>
20582
20583 !! html+tidy
20584 <p></p>
20585 <div id="toc" class="toc">
20586 <div id="toctitle">
20587 <h2>Contents</h2>
20588 </div>
20589 <ul>
20590 <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>
20591 <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>
20592 </ul>
20593 </div>
20594 <p></p>
20595 <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>
20596 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20597 <blockquote>
20598 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20599 </blockquote>
20600 <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>
20601 !! end
20602
20603 !! test
20604 Tags with parameters in TOC
20605 !! wikitext
20606 __TOC__
20607 == <sup class="in-h2">Hello</sup> ==
20608
20609 == <sup class="a > b">Evilbye</sup> ==
20610 !! html
20611 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20612 <ul>
20613 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20614 <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>
20615 </ul>
20616 </div>
20617
20618 <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>
20619 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20620
20621 !! end
20622
20623 !! test
20624 span tags with directionality in TOC
20625 !! wikitext
20626 __TOC__
20627 == <span dir="ltr">C++</span> ==
20628
20629 == <span dir="rtl">זבנג!</span> ==
20630
20631 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20632
20633 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20634
20635 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20636 !! html
20637 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20638 <ul>
20639 <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>
20640 <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>
20641 <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>
20642 <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>
20643 <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>
20644 </ul>
20645 </div>
20646
20647 <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>
20648 <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>
20649 <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>
20650 <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>
20651 <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>
20652
20653 !! end
20654
20655 !! test
20656 Bug 72884: bdi element in ToC
20657 !! wikitext
20658 __TOC__
20659 == <bdi>test</bdi> ==
20660 !! html
20661 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20662 <ul>
20663 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20664 </ul>
20665 </div>
20666
20667 <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>
20668
20669 !! end
20670
20671 # Note that the html output does not have the <p></p>, but the
20672 # html+tidy output *does*. This is because the empty <p></p> is
20673 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20674 !! test
20675 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20676 !! wikitext
20677 __TOC__
20678 == x ==
20679 !! html
20680 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20681 <ul>
20682 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20683 </ul>
20684 </div>
20685
20686 <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>
20687
20688 !! html+tidy
20689 <p></p>
20690 <div id="toc" class="toc">
20691 <div id="toctitle">
20692 <h2>Contents</h2>
20693 </div>
20694 <ul>
20695 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20696 </ul>
20697 </div>
20698 <p></p>
20699 <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>
20700 !! end
20701
20702 !! article
20703 MediaWiki:Bug32057
20704 !! text
20705 == {{int:headline_sample}} ==
20706 !! endarticle
20707
20708 !! test
20709 Bug 32057: Title needed when expanding <h> nodes.
20710 !! options
20711 title=[[Main Page]]
20712 !! wikitext
20713 {{int:Bug32057}}
20714 !! html
20715 <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>
20716
20717 !! end
20718
20719 !! test
20720 Strip marker in urlencode
20721 !! wikitext
20722 {{urlencode:x<nowiki/>y}}
20723 {{urlencode:x<nowiki/>y|wiki}}
20724 {{urlencode:x<nowiki/>y|path}}
20725 {{urlencode:x<pre id="one">two</pre>y}}
20726 !! html
20727 <p>xy
20728 xy
20729 xy
20730 xy
20731 </p>
20732 !! end
20733
20734 !! test
20735 Strip marker in lc
20736 !! wikitext
20737 {{lc:x<nowiki/>y}}
20738 !! html
20739 <p>xy
20740 </p>
20741 !! end
20742
20743 !! test
20744 Strip marker in uc
20745 !! wikitext
20746 {{uc:x<nowiki/>y}}
20747 !! html
20748 <p>XY
20749 </p>
20750 !! end
20751
20752 !! test
20753 Strip marker in formatNum
20754 !! wikitext
20755 {{formatnum:1<nowiki/>2}}
20756 {{formatnum:1<nowiki/>2|R}}
20757 !! html
20758 <p>12
20759 12
20760 </p>
20761 !! end
20762
20763 !! test
20764 Check noCommafy in formatNum
20765 !! options
20766 language=be-tarask
20767 !! wikitext
20768 {{formatnum:123456.78}}
20769 {{formatnum:123456.78|NOSEP}}
20770 !! html
20771 <p>123 456,78
20772 123456.78
20773 </p>
20774 !! end
20775
20776 !! test
20777 Wrong option for formatNum (bug 56199)
20778 !! wikitext
20779 {{formatnum:1,234.56|Random}}
20780 {{formatnum:1,234.56|EVERYTHING}}
20781 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20782 !! html
20783 <p>1,234.56
20784 1,234.56
20785 1,234.56
20786 </p>
20787 !! end
20788
20789 !! test
20790 Strip marker in grammar
20791 !! options
20792 language=fi
20793 !! wikitext
20794 {{grammar:elative|foo<nowiki/>bar}}
20795 !! html
20796 <p>foobarista
20797 </p>
20798 !! end
20799
20800 !! test
20801 Strip marker in padleft
20802 !! wikitext
20803 {{padleft:|2|x<nowiki/>y}}
20804 !! html
20805 <p>xy
20806 </p>
20807 !! end
20808
20809 !! test
20810 Strip marker in padright
20811 !! wikitext
20812 {{padright:|2|x<nowiki/>y}}
20813 !! html
20814 <p>xy
20815 </p>
20816 !! end
20817
20818 !! test
20819 Strip marker in anchorencode
20820 !! wikitext
20821 {{anchorencode:x<nowiki/>y}}
20822 !! html
20823 <p>xy
20824 </p>
20825 !! end
20826
20827 !! test
20828 nowiki inside link inside heading (bug 18295)
20829 !! wikitext
20830 ==[[foo|x<nowiki>y</nowiki>z]]==
20831 !! html
20832 <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>
20833
20834 !! end
20835
20836 !! test
20837 new support for bdi element (bug 31817)
20838 !! wikitext
20839 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20840 !! html
20841 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20842
20843 !!end
20844
20845 !! test
20846 Ignore pipe between table row attributes
20847 !! wikitext
20848 {|
20849 | quux
20850 |- id=foo | style='color: red'
20851 | bar
20852 |}
20853 !! html
20854 <table>
20855 <tr>
20856 <td> quux
20857 </td></tr>
20858 <tr id="foo" style="color: red">
20859 <td> bar
20860 </td></tr></table>
20861
20862 !! end
20863
20864 !!test
20865 Gallery override link with WikiLink (bug 34852)
20866 !! wikitext
20867 <gallery>
20868 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20869 </gallery>
20870 !! html
20871 <ul class="gallery mw-gallery-traditional">
20872 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20873 <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>
20874 <div class="gallerytext">
20875 <p>caption
20876 </p>
20877 </div>
20878 </div></li>
20879 </ul>
20880
20881 !! end
20882
20883 !!test
20884 Gallery override link with absolute external link (bug 34852)
20885 !! wikitext
20886 <gallery>
20887 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20888 </gallery>
20889 !! html
20890 <ul class="gallery mw-gallery-traditional">
20891 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20892 <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>
20893 <div class="gallerytext">
20894 <p>caption
20895 </p>
20896 </div>
20897 </div></li>
20898 </ul>
20899
20900 !! end
20901
20902 !!test
20903 Gallery override link with malicious javascript (bug 34852)
20904 !! wikitext
20905 <gallery>
20906 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20907 </gallery>
20908 !! html
20909 <ul class="gallery mw-gallery-traditional">
20910 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20911 <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>
20912 <div class="gallerytext">
20913 <p>caption
20914 </p>
20915 </div>
20916 </div></li>
20917 </ul>
20918
20919 !! end
20920
20921 !!test
20922 Gallery with invalid title as link (bug 43964)
20923 !! wikitext
20924 <gallery>
20925 File:foobar.jpg|link=<
20926 </gallery>
20927 !! html
20928 <ul class="gallery mw-gallery-traditional">
20929 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20930 <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>
20931 <div class="gallerytext">
20932 </div>
20933 </div></li>
20934 </ul>
20935
20936 !! end
20937
20938 !!test
20939 Language parser function
20940 !! wikitext
20941 {{#language:ar}}
20942 !! html
20943 <p>العربية
20944 </p>
20945 !! end
20946
20947 !!test
20948 Padleft and padright as substr
20949 !! wikitext
20950 {{padleft:|3|abcde}}
20951 {{padright:|3|abcde}}
20952 !! html
20953 <p>abc
20954 abc
20955 </p>
20956 !! end
20957
20958 !!test
20959 Special parser function
20960 !! wikitext
20961 {{#special:RandomPage}}
20962 {{#special:BaDtItLe}}
20963 {{#special:Foobar}}
20964 !! html
20965 <p>Special:Random
20966 Special:Badtitle
20967 Special:Foobar
20968 </p>
20969 !! end
20970
20971 !!test
20972 Bug 34939 - Case insensitive link parsing ([HttP://])
20973 !! wikitext
20974 [HttP://MediaWiki.Org/]
20975 !! html/php
20976 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20977 </p>
20978 !! html/parsoid
20979 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20980 !! end
20981
20982 !!test
20983 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20984 !! wikitext
20985 [HttP://MediaWiki.Org/ MediaWiki]
20986 !! html
20987 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20988 </p>
20989 !! end
20990
20991 !!test
20992 Bug 34939 - Case insensitive link parsing (HttP://)
20993 !! wikitext
20994 HttP://MediaWiki.Org/
20995 !! html/php
20996 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20997 </p>
20998 !! html/parsoid
20999 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21000 !! end
21001
21002 !!test
21003 Disable TOC
21004 !! options
21005 notoc
21006 !! wikitext
21007 Lead
21008 == Section 1 ==
21009 == Section 2 ==
21010 == Section 3 ==
21011 == Section 4 ==
21012 == Section 5 ==
21013 !! html
21014 <p>Lead
21015 </p>
21016
21017 <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>
21018 <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>
21019 <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>
21020 <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>
21021 <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>
21022
21023 !! end
21024
21025
21026 ###
21027 ### Parsoid-specific tests
21028 ### Parsoid-PHP parser incompatibilities
21029 ###
21030 !!test
21031 1. SOL-sensitive wikitext tokens as template-args
21032 !!options
21033 parsoid=wt2html,wt2wt
21034 !! wikitext
21035 {{echo|*a}}
21036 {{echo|#a}}
21037 {{echo|:a}}
21038 !! html
21039 <span about="#mwt1" typeof="mw:Transclusion">
21040 </span><ul about="#mwt1"><li>a</li>
21041 </ul>
21042 <span about="#mwt2" typeof="mw:Transclusion">
21043 </span><ol about="#mwt2"><li>a</li>
21044 </ol>
21045 <span about="#mwt3" typeof="mw:Transclusion">
21046 </span><dl about="#mwt3"><dd>a</dd>
21047 </dl>
21048 !!end
21049
21050 #### -----------------------------------------------------------------
21051 #### Parsoid-specific functionality tests
21052 #### -----------------------------------------------------------------
21053
21054 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21055 # We know wt2wt will fail, but we expect selser to pass.
21056 # Due to the nature of our testing, wt2wt and selser tests will enter the
21057 # blacklist and we'll catch selser regressions based on changes to the
21058 # blacklist entries for selser tests.
21059 !! test
21060 1. Bad treebuilder fixup of formatting elt is cleaned up
21061 !! options
21062 parsoid=wt2html,wt2wt
21063 !! wikitext
21064 {|
21065 |
21066 <small>
21067 [[Image:Foobar.jpg|right|Test]]
21068 </small>
21069 |}
21070 !! html/parsoid
21071 <table>
21072 <tbody><tr><td>
21073 <small>
21074 <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>
21075 </small>
21076 </td></tr>
21077 </tbody></table>
21078 !! end
21079
21080 !! test
21081 2. Bad treebuilder fixup of formatting elt is cleaned up
21082 !! options
21083 parsoid=wt2html,wt2wt
21084 !! wikitext
21085 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21086
21087 <small>[[Image:Foobar.jpg|right|300px]]</small>
21088 !! html/parsoid
21089
21090 <p><b>foo</b></p>
21091 <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>
21092 <p><b>bar</b></p>
21093 <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>
21094 !! end
21095
21096 !! test
21097 3. Bad treebuilder fixup of formatting elt is cleaned up
21098 !! options
21099 parsoid=wt2html,wt2wt
21100 !! wikitext
21101 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21102 !! html/parsoid
21103 <p><small><b>foo</b></small></p>
21104 <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>
21105 <p><small><b>bar</b></small></p>
21106 !! end
21107
21108 !! test
21109 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21110 !! options
21111 parsoid=wt2html,wt2wt
21112 !! wikitext
21113 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21114 !! html/parsoid
21115 <p><b><small></small></b></p>
21116 <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>
21117 <p></p>
21118 !! end
21119
21120 #### ----------------------------------------------------------------
21121 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21122 #### tags. Parsoid's output for these tags differs from that of the
21123 #### PHP parser.
21124 #### ----------------------------------------------------------------
21125
21126 !!test
21127 Ref: 1. ref-location should be replaced with an index span
21128 !!options
21129 parsoid
21130 !! wikitext
21131 A <ref>foo</ref>
21132 B <ref name="x">foo</ref>
21133 C <ref name="y" />
21134 <references />
21135 !! html
21136 <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>
21137 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>
21138 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>
21139 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21140 <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>
21141 <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>
21142 <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>
21143 </ol>
21144 !!end
21145
21146 !!test
21147 Ref: 2. ref-tags with identical names should all get the same index
21148 !!options
21149 parsoid
21150 !! wikitext
21151 A <ref name="x">foo</ref>
21152 B <ref name="x" />
21153 <references />
21154 !! html
21155 <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>
21156 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>
21157 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21158 <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>
21159 </ol>
21160 !!end
21161
21162 !!test
21163 Ref: 3. spaces in ref-names should be ignored
21164 !!options
21165 parsoid
21166 !! wikitext
21167 A <ref name="x">foo</ref>
21168 B <ref name=" x " />
21169 C <ref name= x />
21170 <references />
21171 !! html
21172 <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>
21173 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>
21174 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>
21175 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21176 <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>
21177 </ol>
21178 !!end
21179
21180 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21181 !!test
21182 Ref: 4. 'constructor' should be accepted as a valid ref-name
21183 !!options
21184 parsoid
21185 !! wikitext
21186 A <ref name="constructor">foo</ref>
21187 <references />
21188 !! html
21189 <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>
21190 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21191 <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>
21192 </ol>
21193 !!end
21194
21195 !!test
21196 Ref: 5. body should accept generic wikitext
21197 !!options
21198 parsoid
21199 !! wikitext
21200 A <ref>
21201 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21202 </ref>
21203
21204 <references />
21205 !! html
21206 <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>
21207
21208 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21209 <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>
21210 </span></li>
21211 </ol>
21212 !!end
21213
21214 !!test
21215 Ref: 6. indent-pres should not be output in ref-body
21216 !!options
21217 parsoid
21218 !! wikitext
21219 A <ref>
21220 foo
21221 bar
21222 baz
21223 </ref>
21224
21225 <references />
21226 !! html
21227 <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>
21228
21229 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21230 <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
21231 bar
21232 baz
21233 </span></li>
21234 </ol>
21235 !!end
21236
21237 !!test
21238 Ref: 7. No p-wrapping in ref-body
21239 !!options
21240 parsoid
21241 !! wikitext
21242 A <ref>
21243 foo
21244
21245 bar
21246
21247
21248 baz
21249
21250
21251
21252 booz
21253 </ref>
21254
21255 <references />
21256 !! html
21257 <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>
21258
21259 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21260 <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
21261
21262 bar
21263
21264
21265 baz
21266
21267
21268
21269 booz
21270 </span></li>
21271 </ol>
21272 !!end
21273
21274 !!test
21275 Ref: 8. transclusion wikitext has lower precedence
21276 !!options
21277 parsoid
21278 !! wikitext
21279 A <ref> foo {{echo|</ref> B C}}
21280
21281 <references />
21282 !! html
21283 <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>
21284 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21285 <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>
21286 </ol>
21287 !!end
21288
21289 !!test
21290 Ref: 9. unclosed comments should not leak out of ref-body
21291 !!options
21292 parsoid
21293 !! wikitext
21294 A <ref> foo <!--</ref> B C
21295 <references />
21296 !! html
21297 <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>
21298 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21299 <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>
21300 </ol>
21301 !!end
21302
21303 !!test
21304 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21305 !!options
21306 parsoid
21307 !! wikitext
21308 A <ref> <b> foo </ref> B C
21309
21310 <references />
21311 !! html
21312 <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>
21313
21314
21315 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21316 <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>
21317 </ol>
21318 !!end
21319
21320 !!test
21321 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21322 !!options
21323 parsoid
21324 !! wikitext
21325 A <ref>foo</ref> B
21326 C <ref>bar</ref> D
21327 <references />
21328 !! html
21329 <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
21330 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>
21331 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21332 <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>
21333 <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>
21334 </ol>
21335 !!end
21336
21337 !!test
21338 Ref: 12. ref-tags act as trailing newline migration barrier
21339 !! wikitext
21340 <!--the newline at the end of this line moves out of the p tag-->a
21341
21342 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21343 <ref />
21344
21345 c
21346 <references />
21347 !! html/parsoid
21348 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21349
21350
21351 <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>
21352 <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>
21353
21354 <p>c</p>
21355 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21356 <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>
21357 <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>
21358 !!end
21359
21360 !!test
21361 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21362 !!options
21363 parsoid
21364 !! wikitext
21365 <ref>foo</ref> A
21366 <ref>bar
21367 </ref> B
21368 <references />
21369 !! html
21370 <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
21371 <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>
21372 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21373 <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>
21374 <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
21375 </span></li>
21376 </ol>
21377 !!end
21378
21379 !!test
21380 Ref: 14. A nested ref-tag should be emitted as plain text
21381 !!options
21382 parsoid
21383 !! wikitext
21384 <ref>foo <ref>bar</ref> baz</ref>
21385
21386 <references />
21387 !! html
21388 <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>
21389 </p>
21390 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21391 <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>
21392 </ol>
21393 !!end
21394
21395 !!test
21396 Ref: 15. ref-tags with identical names should get identical indexes
21397 !!options
21398 parsoid
21399 !! wikitext
21400 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21401 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21402
21403 <references />
21404 !! html
21405 <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>
21406 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>
21407
21408 <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>
21409 </ol>
21410 !!end
21411
21412 ## We don't bother wt2wt-ing non-standard whitespace
21413 !!test
21414 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21415 !!options
21416 parsoid=wt2html
21417 !! wikitext
21418 A <ref >foo</ref >
21419
21420 <references />
21421 !! html
21422 <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>
21423 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21424 <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>
21425 !!end
21426
21427 !!test
21428 Ref: 17. Generate valid HTML5 id/about attributes
21429 !!options
21430 parsoid
21431 !!wikitext
21432 <ref name="a b">foo</ref>
21433
21434 <references />
21435 !!html
21436 <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>
21437 </p>
21438
21439 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21440 <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>
21441 </ol>
21442 !!end
21443
21444 !!test
21445 Ref: 18. T58916: Extension attributes should be parsed as plain text
21446 !!options
21447 parsoid
21448 !!wikitext
21449 <ref name="{{echo|a}}">foo</ref>
21450
21451 <references />
21452 !!html
21453 <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>
21454 </p>
21455
21456 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21457 <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>
21458 </ol>
21459 !!end
21460
21461 !!test
21462 Ref: 19. ref-tags with identical name encodings should get identical indexes
21463 !!options
21464 parsoid
21465 !! wikitext
21466 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21467
21468 <references />
21469 !! html
21470 <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>
21471 </p>
21472 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21473 <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>
21474 </ol>
21475 !!end
21476
21477 !!test
21478 Ref: 20. ref-tags with identical names but different content should keep it
21479 !!options
21480 parsoid
21481 !! wikitext
21482 A <ref name="foo">Foo one</ref>
21483 B <ref name="foo">Foo two</ref>
21484 C <ref name="foo" />
21485
21486 <references />
21487 !! html
21488 <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>
21489 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>
21490 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>
21491
21492 <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>
21493 </ol>
21494 !!end
21495
21496 !!test
21497 References: 1. references tag without any refs should be handled properly
21498 !! wikitext
21499 <references />
21500 !! html/parsoid
21501 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21502 !!end
21503
21504 !!test
21505 References: 2. references tag with group only outputs references from that group
21506 !! wikitext
21507 A <ref group="a">foo</ref>
21508 B <ref group="b">bar</ref>
21509 C <ref>baz</ref>
21510
21511 <references group="a" />
21512 <references />
21513 <references group="b" />
21514 !! html/parsoid
21515 <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>
21516 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>
21517 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>
21518
21519 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21520 <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>
21521 </ol>
21522 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21523 <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>
21524 </ol>
21525 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21526 <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>
21527 </ol>
21528 !!end
21529
21530 !!test
21531 References: 3. ref list should be cleared after processing references
21532 !! wikitext
21533 A <ref>foo</ref>
21534
21535 <references />
21536
21537 B <ref>bar</ref>
21538
21539 <references />
21540 !! html/parsoid
21541 <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>
21542
21543 <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>
21544 </ol>
21545
21546 <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>
21547
21548 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21549 <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>
21550 </ol>
21551 !!end
21552
21553 !!test
21554 References: 4. only referenced group should be cleared after processing references
21555 !! wikitext
21556 A <ref group="a">afoo</ref>
21557 B <ref>bfoo</ref>
21558
21559 <references group="a" />
21560
21561 C <ref>cfoo</ref>
21562
21563 <references />
21564 !! html/parsoid
21565 <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>
21566 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>
21567
21568 <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>
21569 </ol>
21570
21571 <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>
21572
21573 <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>
21574 </ol>
21575 !!end
21576
21577 !!test
21578 References: 5. ref tags in references should be processed while ignoring all other content
21579 !! wikitext
21580 A <ref name="a" />
21581 B <ref name="b">bar</ref>
21582
21583 <references>
21584 <ref name="a">foo</ref>
21585 This should just get lost.
21586 </references>
21587 !! html/parsoid
21588 <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>
21589 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>
21590
21591
21592 <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>
21593 </ol>
21594 !!end
21595
21596 !!test
21597 References: 6. <references /> from a transclusion
21598 !! wikitext
21599 <ref>Foo</ref> {{echo|<references />}}
21600 !! html/parsoid
21601 <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>
21602 </ol>
21603 !!end
21604
21605 !! test
21606 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21607 !! wikitext
21608 A <ref>foo bar for a</ref>
21609 B <ref group="X" name="b" />
21610
21611 <references />
21612
21613 <references group="X">
21614 <ref name="b">foo</ref>
21615 </references>
21616 !! html/parsoid
21617 <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>
21618 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>
21619 </p>
21620
21621 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21622 <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>
21623 </ol>
21624
21625 <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"}}'>
21626 <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>
21627 </ol>
21628 !! end
21629
21630 !! test
21631 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21632 !! wikitext
21633 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21634 <references />
21635 !! html/parsoid
21636 <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>
21637 <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>
21638 </ol>
21639 !!end
21640
21641 # This test only works in wt2html now as the <references /> are always generated
21642 # unless selser is active. Once T72722 is fixed, we should add a changes test
21643 # here to ensure that unrelated changes don't add the new <references /> in
21644 # wt2wt.
21645 !! test
21646 References: 9. Generate missing references list at the end
21647 !! wikitext
21648 A <ref>foo</ref>
21649 B <ref group="inexistent">bar</ref>
21650 !! html/parsoid
21651 <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>
21652 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21653 <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>
21654 </ol>
21655 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21656 <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>
21657 </ol>
21658 !! end
21659
21660 !! test
21661 References: 10. New <references/> shouldn't be added for unrelated edits.
21662 !! options
21663 parsoid={
21664 "modes": ["selser"],
21665 "changes": [["#x", "remove"]],
21666 "selser": "noauto"
21667 }
21668 !! wikitext
21669 Unrelated text<span id="x"> that's going to disappear</span>.
21670 A <ref>foo</ref>
21671 !! wikitext/edited
21672 Unrelated text.
21673 A <ref>foo</ref>
21674 !!end
21675
21676 !! test
21677 Entities in ref name
21678 !! wikitext
21679 <ref name="test &amp; me">hi</ref>
21680 <references />
21681 !! html/parsoid
21682 <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>
21683 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21684 <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>
21685 </ol>
21686 !! end
21687
21688 # This test is wt2html only because we're permitting the serializer to produce
21689 # dirty diffs, normalizing the unclosed references to the self-closed version.
21690 !! test
21691 Generate references for unclosed references tag
21692 !! options
21693 parsoid=wt2html
21694 !! wikitext
21695 a<ref>foo</ref>
21696
21697 <references>
21698 !! html/parsoid
21699 <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>
21700 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21701 <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>
21702 !! end
21703
21704 !! test
21705 New reference serializes on its own line
21706 !! options
21707 parsoid=wt2wt,html2wt
21708 !! wikitext
21709 foo
21710 <references />
21711 !! html/parsoid
21712 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21713 !! end
21714
21715 #### ----------------------------------------------------------------
21716 #### Parsoid-only testing of Parsoid's impl of LST
21717 #### Not implemented yet, see
21718 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21719 #### ----------------------------------------------------------------
21720
21721 !!test
21722 LST Sections: 1. Simple section start and end
21723 !! wikitext
21724 <section begin="2011-05-16" />
21725 <section end="2014-04-10 (MW 1.23wmf22)" />
21726 !! html/parsoid
21727 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21728 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21729 !! end
21730
21731 #--------- Test stripping of empty nodes in template content ----------
21732 !!test
21733 Empty LI and TR nodes should be stripped from template content
21734 !!wikitext
21735 {{EmptyLITest}}
21736 {{EmptyTRTest}}
21737 !!html/parsoid
21738 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21739 <li>a</li>
21740 <li>b</li>
21741 </ul>
21742 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21743 <tbody>
21744 <tr>
21745 <td>foo</td>
21746 </tr>
21747 <tr>
21748 <td>bar</td>
21749 </tr>
21750 </tbody>
21751 </table>
21752 !!end
21753
21754 !!test
21755 Empty LI and TR nodes should not be stripped from top-level content
21756 !!wikitext
21757 * a
21758 *
21759 * b
21760 {|
21761 |-
21762 |-
21763 |foo
21764 |}
21765 !!html/parsoid
21766 <ul>
21767 <li> a</li>
21768 <li></li>
21769 <li> b</li>
21770 </ul>
21771 <table>
21772 <tbody>
21773 <tr></tr>
21774 <tr>
21775 <td>foo</td>
21776 </tr>
21777 </tbody>
21778 </table>
21779 !!end
21780
21781 !!test
21782 Empty TR nodes should not be stripped if they have any attributes set
21783 !!wikitext
21784 {{EmptyTRWithHTMLAttrTest}}
21785 !!html/parsoid
21786 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21787 <tr align="center"></tr>
21788 <tr><td>foo</td></tr>
21789 <tr align="center"></tr>
21790 <tr><td>bar</td></tr>
21791 </table>
21792 !!end
21793
21794 #### ----------------------------------------------------------------
21795 #### The following section of tests are primarily to test
21796 #### wikitext escaping capabilities of Parsoid. Given that
21797 #### escaping can be done any number of ways, the wikitext (input)
21798 #### is always adjusted to reflect how Parsoid adds nowiki
21799 #### escape tags.
21800 ####
21801 #### We are marking several tests as parsoid-only since the
21802 #### HTML in the result section is different from what the
21803 #### PHP parser generates for it.
21804 #### ----------------------------------------------------------------
21805
21806
21807 #### --------------- Headings ---------------
21808 #### 0. Unnested
21809 #### 1. Nested inside html <h1>=foo=</h1>
21810 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21811 #### 3. Nested inside html with wikitext split by html tags
21812 #### 4. No escape needed
21813 #### 5. Empty headings <h1></h1>
21814 #### 6. Heading chars in SOL context
21815 #### ----------------------------------------
21816 !! test
21817 Headings: 0. Unnested
21818 !! options
21819 parsoid
21820 !! wikitext
21821 <nowiki>=foo=</nowiki>
21822
21823 <nowiki> =foo= </nowiki>
21824 <!--cmt-->
21825 <nowiki>=foo=</nowiki>
21826
21827 =foo''a''<nowiki>=</nowiki>
21828 !! html
21829 <p><span typeof="mw:Nowiki">=foo=</span></p>
21830
21831 <p><span typeof="mw:Nowiki"> =foo= </span>
21832 <!--cmt-->
21833 <span typeof="mw:Nowiki">=foo=</span></p>
21834
21835 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21836 !!end
21837
21838 # New headings and existing headings are handled differently
21839 !! test
21840 Headings: 1. Nested inside html
21841 !! options
21842 parsoid=html2wt
21843 !! html/parsoid
21844 <h1>=foo=</h1>
21845 <h2>=foo=</h2>
21846 <h3>=foo=</h3>
21847
21848 <h1 data-parsoid=''>=foo=</h1>
21849 <h2 data-parsoid=''>=foo=</h2>
21850 <h3 data-parsoid=''>=foo=</h3>
21851 <h4 data-parsoid=''>=foo=</h4>
21852 <h5 data-parsoid=''>=foo=</h5>
21853 <h6 data-parsoid=''>=foo=</h6>
21854 !! wikitext
21855 = =foo= =
21856
21857 == =foo= ==
21858
21859 === =foo= ===
21860
21861 =<nowiki>=foo=</nowiki>=
21862 ==<nowiki>=foo=</nowiki>==
21863 ===<nowiki>=foo=</nowiki>===
21864 ====<nowiki>=foo=</nowiki>====
21865 =====<nowiki>=foo=</nowiki>=====
21866 ======<nowiki>=foo=</nowiki>======
21867
21868 !!end
21869
21870 !! test
21871 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21872 !! options
21873 parsoid=html2wt
21874 !! html/parsoid
21875 <h1>foo</h1>*bar
21876 <h1>foo</h1>=bar
21877 <h1>foo</h1>=bar=
21878 !! wikitext
21879 = foo =
21880 <nowiki>*</nowiki>bar
21881
21882 = foo =
21883 =bar
21884
21885 = foo =
21886 <nowiki>=bar=</nowiki>
21887 !!end
21888
21889 !! test
21890 Headings: 3. Nested inside html with wikitext split by html tags
21891 !! options
21892 parsoid=html2wt,wt2wt
21893 !! wikitext
21894 = ='''bold'''<nowiki>foo=</nowiki> =
21895 !! html/parsoid
21896 <h1>=<b>bold</b>foo=</h1>
21897 !!end
21898
21899 !! test
21900 Headings: 4a. No escaping needed (testing just h1 and h2)
21901 !! wikitext
21902 = =foo =
21903
21904 = foo= =
21905
21906 = =foo= =
21907
21908 = =foo= bar =
21909
21910 == =foo ==
21911
21912 == foo= ==
21913
21914 = = =
21915
21916 = ''=''foo= =
21917 !! html/parsoid
21918 <h1>=foo</h1>
21919 <h1>foo=</h1>
21920 <h1> =foo= </h1>
21921 <h1>=foo= bar</h1>
21922 <h2>=foo</h2>
21923 <h2>foo=</h2>
21924 <h1>=</h1>
21925 <h1><i>=</i>foo=</h1>
21926 !!end
21927
21928 !! test
21929 Headings: 4b. No escaping needed (inside p-tags)
21930 !! options
21931 parsoid=html2wt
21932 !! html/parsoid
21933 <p>===
21934 =foo= x
21935 =foo= <s></s>
21936 </p>
21937 !! wikitext
21938 ===
21939 =foo= x
21940 =foo= <s></s>
21941 !!end
21942
21943 !! test
21944 Headings: 5. Empty headings
21945 !! wikitext
21946 =<nowiki/>=
21947
21948 ==<nowiki/>==
21949
21950 ===<nowiki/>===
21951
21952 ====<nowiki/>====
21953
21954 =====<nowiki/>=====
21955
21956 ======<nowiki/>======
21957 !! html/parsoid
21958 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21959
21960 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21961
21962 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21963
21964 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21965
21966 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21967
21968 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21969 !!end
21970
21971 !! test
21972 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21973 !! wikitext
21974 <nowiki>=a=</nowiki>
21975
21976 <nowiki>=a=</nowiki>
21977
21978 <nowiki>=a=</nowiki>
21979
21980 <nowiki>=a=</nowiki>
21981 !! html/php
21982 <p>=a=
21983 </p><p>=a=
21984 </p><p>=a=
21985 </p><p>=a=
21986 </p>
21987 !! html/parsoid
21988 <p><span typeof="mw:Nowiki">=a=</span></p>
21989
21990 <p><span typeof="mw:Nowiki">=a=</span></p>
21991
21992 <p><span typeof="mw:Nowiki">=a=</span></p>
21993
21994 <p><span typeof="mw:Nowiki">=a=</span></p>
21995 !!end
21996
21997 !! test
21998 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21999 !! wikitext
22000 <nowiki>=a=
22001 b</nowiki>
22002
22003 <nowiki>=a=
22004 b</nowiki>
22005
22006 <nowiki>=a=
22007 b</nowiki>
22008
22009 <nowiki>=a=
22010 b</nowiki>
22011 !! html/php
22012 <p>=a=
22013 b
22014 </p><p>=a=
22015 b
22016 </p><p>=a=
22017 b
22018 </p><p>=a=
22019 b
22020 </p>
22021 !! html/parsoid
22022 <p><span typeof="mw:Nowiki">=a=
22023 b</span></p>
22024
22025 <p><span typeof="mw:Nowiki">=a=
22026 b</span></p>
22027
22028 <p><span typeof="mw:Nowiki">=a=
22029 b</span></p>
22030
22031 <p><span typeof="mw:Nowiki">=a=
22032 b</span></p>
22033 !!end
22034
22035 !! test
22036 Headings: 6c. Heading chars in SOL context (leading newline break)
22037 !! wikitext
22038 a
22039 <nowiki>=b=</nowiki>
22040 !! html/php
22041 <p>a
22042 =b=
22043 </p>
22044 !! html/parsoid
22045 <p>a
22046 <span typeof="mw:Nowiki">=b=</span>
22047 !!end
22048
22049 !! test
22050 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22051 !! wikitext
22052 <!--c0--><nowiki>=a=</nowiki>
22053
22054 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22055 !! html/php
22056 <p>=a=
22057 </p><p>=a=
22058 </p>
22059 !! html/parsoid
22060 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
22061
22062 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
22063 !!end
22064
22065 !! test
22066 Headings: 6d. Heading chars in SOL context (No escaping needed)
22067 !! options
22068 parsoid=html2wt
22069 !! html/parsoid
22070 =a=<div>b</div>
22071 !! wikitext
22072 =a=<div>b</div>
22073 !!end
22074
22075 !! test
22076 Headings: 7. Insert a newline between new content and headings
22077 !! options
22078 parsoid=html2wt
22079 !! html/parsoid
22080 <h2>NEW</h2>
22081 <p>new</p>
22082 <h2 data-parsoid='{}'>A</h2>
22083 <p data-parsoid='{}'>a</p>
22084 !! wikitext
22085 == NEW ==
22086 new
22087
22088 ==A==
22089 a
22090
22091 !! end
22092
22093 #### --------------- Lists ---------------
22094 #### 0. Outside nests (*foo, etc.)
22095 #### 1. Nested inside html <ul><li>*foo</li></ul>
22096 #### 2. Inside definition lists
22097 #### 3. Only bullets at start should be escaped
22098 #### 4. No escapes needed
22099 #### 5. No unnecessary escapes
22100 #### 6. Escape bullets in SOL position
22101 #### 7. Escape bullets in a multi-line context
22102 #### ----------------------------------------
22103
22104 !! test
22105 Lists: 0. Outside nests
22106 !! wikitext
22107 <nowiki>*</nowiki>foo
22108
22109 <nowiki>#</nowiki>foo
22110
22111 <nowiki>;Foo:</nowiki>bar
22112 !! html/php
22113 <p>*foo
22114 </p><p>#foo
22115 </p><p>;Foo:bar
22116 </p>
22117 !! html/parsoid
22118 <p><span typeof="mw:Nowiki">*</span>foo</p>
22119
22120 <p><span typeof="mw:Nowiki">#</span>foo</p>
22121
22122 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
22123 !!end
22124
22125 !! test
22126 Lists: 1. Nested inside html
22127 !! wikitext
22128 *<nowiki>*foo</nowiki>
22129
22130 *<nowiki>#foo</nowiki>
22131
22132 *<nowiki>:foo</nowiki>
22133
22134 *<nowiki>;foo</nowiki>
22135
22136 #<nowiki>*foo</nowiki>
22137
22138 #<nowiki>#foo</nowiki>
22139
22140 #<nowiki>:foo</nowiki>
22141
22142 #<nowiki>;foo</nowiki>
22143 !! html
22144 <ul><li>*foo</li></ul>
22145 <ul><li>#foo</li></ul>
22146 <ul><li>:foo</li></ul>
22147 <ul><li>;foo</li></ul>
22148 <ol><li>*foo</li></ol>
22149 <ol><li>#foo</li></ol>
22150 <ol><li>:foo</li></ol>
22151 <ol><li>;foo</li></ol>
22152
22153 !!end
22154
22155 !! test
22156 Lists: 2. Inside definition lists
22157 !! wikitext
22158 ;<nowiki>;foo</nowiki>
22159
22160 ;<nowiki>:foo</nowiki>
22161
22162 ;<nowiki>:foo</nowiki>
22163 :bar
22164
22165 :<nowiki>:foo</nowiki>
22166 !! html
22167 <dl><dt>;foo</dt></dl>
22168 <dl><dt>:foo</dt></dl>
22169 <dl><dt>:foo</dt>
22170 <dd>bar</dd></dl>
22171 <dl><dd>:foo</dd></dl>
22172
22173 !!end
22174
22175 !! test
22176 Lists: 3. Only bullets at start of text should be escaped
22177 !! wikitext
22178 *<nowiki>*foo*bar</nowiki>
22179
22180 *<nowiki>*foo</nowiki>''it''*bar
22181 !! html
22182 <ul><li>*foo*bar</li></ul>
22183 <ul><li>*foo<i>it</i>*bar</li></ul>
22184
22185 !!end
22186
22187 !! test
22188 Lists: 4. No escapes needed
22189 !! options
22190 parsoid
22191 !! wikitext
22192 *foo*bar
22193
22194 *''foo''*bar
22195
22196 *[[Foo]]: bar
22197
22198 *[[Foo]]*bar
22199 !! html
22200 <ul>
22201 <li>foo*bar
22202 </li>
22203 </ul>
22204 <ul>
22205 <li><i>foo</i>*bar
22206 </li>
22207 </ul>
22208 <ul>
22209 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22210 </li>
22211 </ul>
22212 <ul>
22213 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22214 </li>
22215 </ul>
22216 !!end
22217
22218 !! test
22219 Lists: 5. No unnecessary escapes
22220 !! wikitext
22221 * bar <span><nowiki>[[foo]]</nowiki></span>
22222
22223 * =bar <span><nowiki>[[foo]]</nowiki></span>
22224
22225 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22226
22227 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22228
22229 * =bar <span>foo]]</span>=
22230
22231 * <s></s>: a
22232
22233 * ''* foo''
22234 !! html
22235 <ul><li> bar <span>[[foo]]</span></li></ul>
22236 <ul><li> =bar <span>[[foo]]</span></li></ul>
22237 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22238 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22239 <ul><li> =bar <span>foo]]</span>=</li></ul>
22240 <ul><li> <s></s>: a</li></ul>
22241 <ul><li> <i>* foo</i></li></ul>
22242
22243 !!end
22244
22245 !! test
22246 Lists: 6. Escape bullets in SOL position
22247 !! options
22248 parsoid=html2wt
22249 !! html/parsoid
22250 <p><!--cmt-->*foo</p>
22251 !! wikitext
22252 <!--cmt--><nowiki>*</nowiki>foo
22253 !!end
22254
22255 !! test
22256 Lists: 7. Escape bullets in a multi-line context
22257 !! wikitext
22258 a
22259 <nowiki>*</nowiki>b
22260 !! html
22261 <p>a
22262 *b
22263 </p>
22264 !!end
22265
22266 !! test
22267 Lists: 8. Escape colons only if not present in tags
22268 !! options
22269 parsoid=html2wt
22270 !! html/parsoid
22271 <dl><dt>a:b<i>c:d</i></dt></dl>
22272 !! wikitext
22273 ; <nowiki>a:b</nowiki>''c:d''
22274 !! end
22275
22276 #### --------------- HRs ---------------
22277 #### 1. Single line
22278 #### -----------------------------------
22279
22280 !! test
22281 HRs: 1. Single line
22282 !! wikitext
22283 ----<nowiki>----</nowiki>
22284 ----=foo=
22285 ----*foo
22286 !! html+tidy
22287 <hr />
22288 <p>----</p>
22289 <hr />
22290 <p>=foo=</p>
22291 <hr />
22292 <p>*foo</p>
22293 !! end
22294
22295 #### --------------- Tables ---------------
22296 #### 1a. Simple example
22297 #### 1b. No escaping needed (!foo)
22298 #### 1c. No escaping needed (|foo)
22299 #### 1d. No escaping needed (|}foo)
22300 ####
22301 #### 2a. Nested in td (<td>foo|bar</td>)
22302 #### 2b. Nested in td (<td>foo||bar</td>)
22303 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22304 ####
22305 #### 3a. Nested in th (<th>foo!bar</th>)
22306 #### 3b. Nested in th (<th>foo!!bar</th>)
22307 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22308 ####
22309 #### 4a. Escape -
22310 #### 4b. Escape +
22311 #### 4c. No escaping needed
22312 #### --------------------------------------
22313
22314 !! test
22315 Tables: 1a. Simple example
22316 !! wikitext
22317 <nowiki>{|
22318 |}</nowiki>
22319 !! html
22320 <p>{|
22321 |}
22322 </p>
22323 !! end
22324
22325 !! test
22326 Tables: 1b. No escaping needed
22327 !! wikitext
22328 !foo
22329 !! html
22330 <p>!foo
22331 </p>
22332 !! end
22333
22334 !! test
22335 Tables: 1c. No escaping needed
22336 !! wikitext
22337 |foo
22338 !! html
22339 <p>|foo
22340 </p>
22341 !! end
22342
22343 !! test
22344 Tables: 1d. No escaping needed
22345 !! wikitext
22346 |}foo
22347 !! html
22348 <p>|}foo
22349 </p>
22350 !! end
22351
22352 !! test
22353 Tables: 2a. Nested in td
22354 !! options
22355 parsoid=html2wt
22356 !! html/parsoid
22357 <table><tbody><tr>
22358 <td>foo|bar</td></tr>
22359 <tr><td>x<div>a|b</div></td>
22360 </tbody></table>
22361 !! wikitext
22362 {|
22363 |<nowiki>foo|bar</nowiki>
22364 |-
22365 |x<div><nowiki>a|b</nowiki></div>
22366 |}
22367 !! html/php+tidy
22368 <table>
22369 <tr>
22370 <td>foo|bar</td>
22371 </tr>
22372 <tr>
22373 <td>x
22374 <div>a|b</div>
22375 </td>
22376 </tr>
22377 </table>
22378 !! end
22379
22380 !! test
22381 Tables: 2b. Nested in td
22382 !! options
22383 parsoid=html2wt
22384 !! html/parsoid
22385 <table><tbody><tr>
22386 <td>foo||bar</td>
22387 <td>a<i>b||c</i></td>
22388 <td>a<i><div>b||c</div></i></td>
22389 </tr></tbody></table>
22390 !! wikitext
22391 {|
22392 |<nowiki>foo||bar</nowiki>
22393 |a''<nowiki>b||c</nowiki>''
22394 |a''<div><nowiki>b||c</nowiki></div>''
22395 |}
22396 !! html/php
22397 <table>
22398 <tr>
22399 <td>foo||bar
22400 </td>
22401 <td>a<i>b||c</i>
22402 </td>
22403 <td>a<i><div>b||c</div></i>
22404 </td></tr></table>
22405
22406 !! end
22407
22408 !! test
22409 Tables: 2c. Nested in td -- no escaping needed
22410 !! wikitext
22411 {|
22412
22413 |foo!!bar
22414 |}
22415 !! html/*
22416 <table>
22417
22418 <tr>
22419 <td>foo!!bar
22420 </td></tr></table>
22421
22422 !! end
22423
22424 !! test
22425 Tables: 3a. Nested in th
22426 !! wikitext
22427 {|
22428
22429 !foo!bar
22430 |}
22431 !! html/*
22432 <table>
22433
22434 <tr>
22435 <th>foo!bar
22436 </th></tr></table>
22437
22438 !! end
22439
22440 !! test
22441 Tables: 3b. Nested in th
22442 !! options
22443 parsoid=html2wt
22444 !! html/parsoid
22445 <table><tbody>
22446 <tr><th>foo!!bar</th>
22447 <th><i>foo|bar</i></th>
22448 <th><i>foo!!bar</i></th>
22449 <th><i><span>foo!!bar</span></i></th>
22450 </tr></tbody></table>
22451 !! wikitext
22452 {|
22453 !<nowiki>foo!!bar</nowiki>
22454 !''<nowiki>foo|bar</nowiki>''
22455 !''<nowiki>foo!!bar</nowiki>''
22456 !''<span><nowiki>foo!!bar</nowiki></span>''
22457 |}
22458 !! html/php
22459 <table>
22460 <tr>
22461 <th>foo!!bar
22462 </th>
22463 <th><i>foo|bar</i>
22464 </th>
22465 <th><i>foo!!bar</i>
22466 </th>
22467 <th><i><span>foo!!bar</span></i>
22468 </th></tr></table>
22469
22470 !! end
22471
22472 !! test
22473 Tables: 3c. Nested in th
22474 !! options
22475 parsoid=html2wt
22476 !! html/parsoid
22477 <table><tbody>
22478 <tr><th>foo||bar</th>
22479 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22480 </tr></tbody></table>
22481 !! wikitext
22482 {|
22483 !<nowiki>foo||bar</nowiki>
22484 !<nowiki>foo||bar</nowiki>
22485 |}
22486 !! html/php
22487 <table>
22488 <tr>
22489 <th>foo||bar
22490 </th>
22491 <th>foo||bar
22492 </th></tr></table>
22493
22494 !! end
22495
22496 !! test
22497 Tables: 4a. Escape -
22498 !! options
22499 parsoid=html2wt
22500 !! html/*
22501 <table>
22502
22503 <tr>
22504 <th>-bar
22505 </th></tr>
22506 <tr>
22507 <td>-bar
22508 </td></tr></table>
22509
22510 !! wikitext
22511 {|
22512
22513 !-bar
22514
22515 |-
22516 |<nowiki>-bar</nowiki>
22517 |}
22518 !! end
22519
22520 !! test
22521 Tables: 4b. Escape +
22522 !! options
22523 parsoid=html2wt
22524 !! html/*
22525 <table>
22526
22527 <tr>
22528 <th>+bar
22529 </th></tr>
22530 <tr>
22531 <td>+bar
22532 </td></tr></table>
22533
22534 !! wikitext
22535 {|
22536
22537 !+bar
22538
22539 |-
22540 |<nowiki>+bar</nowiki>
22541 |}
22542 !! end
22543
22544 !! test
22545 Tables: 4c. No escaping needed
22546 !! wikitext
22547 {|
22548 |foo-bar
22549 |foo+bar
22550 |-
22551 |''foo''-bar
22552 |''foo''+bar
22553 |-
22554 |foo
22555 bar|baz
22556 +bar
22557 -bar
22558 |-
22559 |x
22560 <div>a|b</div>
22561 |}
22562 !! html/php
22563 <table>
22564 <tr>
22565 <td>foo-bar
22566 </td>
22567 <td>foo+bar
22568 </td></tr>
22569 <tr>
22570 <td><i>foo</i>-bar
22571 </td>
22572 <td><i>foo</i>+bar
22573 </td></tr>
22574 <tr>
22575 <td>foo
22576 <p>bar|baz
22577 +bar
22578 -bar
22579 </p>
22580 </td></tr>
22581 <tr>
22582 <td>x
22583 <div>a|b</div>
22584 </td></tr></table>
22585
22586 !! html/parsoid
22587 <table><tbody>
22588 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22589 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22590 <tr><td>foo
22591 <p>bar|baz
22592 +bar
22593 -bar</p></td></tr>
22594 <tr><td>x
22595 <div>a|b</div></td>
22596 </tbody></table>
22597 !! end
22598
22599 !! test
22600 Tables: 4d. No escaping needed
22601 !! wikitext
22602 {|
22603 |[[Foo]]-bar
22604 ||+1
22605 ||-2
22606 |}
22607 !! html/php
22608 <table>
22609 <tr>
22610 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22611 </td>
22612 <td>+1
22613 </td>
22614 <td>-2
22615 </td></tr></table>
22616
22617 !! html/parsoid
22618 <table>
22619 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22620 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22621 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22622 </tbody></table>
22623 !! end
22624
22625 !! test
22626 Tables: Digest broken attributes on table and tr tag
22627 !! options
22628 parsoid=wt2html
22629 !! wikitext
22630 {| || |} ++
22631 |- || || ++ --
22632 |- > [
22633 |}
22634 !! html
22635 <table>
22636 <tbody>
22637 <tr></tr>
22638 <tr></tr>
22639 </tbody></table>
22640 !! end
22641
22642 !! test
22643 T97430: Don't emit empty nowiki pairs around marker meta tags
22644 !! options
22645 parsoid=html2wt
22646 !! html/parsoid
22647 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22648 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22649 !! wikitext
22650 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22651 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22652 !! end
22653
22654 !! test
22655 Unclosed xmlish element in table line shouldn't eat end delimiters
22656 !! wikitext
22657 {|
22658 | <foo
22659 | bar>
22660 |}
22661 !! html/php
22662 <table>
22663 <tr>
22664 <td> &lt;foo
22665 </td>
22666 <td> bar&gt;
22667 </td></tr></table>
22668
22669 !! html/parsoid
22670 <table>
22671 <tbody><tr><td> &lt;foo</td>
22672 <td> bar></td></tr>
22673 </tbody></table>
22674 !! end
22675
22676 #### --------------- Links ----------------
22677 #### 1. Quote marks in link text
22678 #### 2. Wikilinks: Escapes needed
22679 #### 3. Wikilinks: No escapes needed
22680 #### 4. Extlinks: Escapes needed
22681 #### 5. Extlinks: No escapes needed
22682 #### --------------------------------------
22683 !! test
22684 Links 1. WikiLinks: No escapes needed
22685 !! wikitext
22686 [[Foo|Foo''boo'']]
22687 [[Foo|[Foobar]]]
22688 [[Foo|x [Foobar] x]]
22689 !! html/php
22690 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22691 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22692 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22693 </p>
22694 !! html/parsoid
22695 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22696 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22697 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22698 !! end
22699
22700 !! test
22701 Links 2. WikiLinks: Escapes needed
22702 !! options
22703 parsoid=html2wt
22704 !! html/parsoid
22705 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22706 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22707 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22708 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22709 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22710 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22711 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22712 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22713 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22714 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22715 !! wikitext
22716 [[Foo|<nowiki>Foobar]</nowiki>]]
22717 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22718 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22719 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22720 [[Foo|<nowiki>|Bar</nowiki>]]
22721 [[Foo|<nowiki>]]bar</nowiki>]]
22722 [[Foo|<nowiki>[[bar</nowiki>]]
22723 [[Foo|<nowiki>x [[ y</nowiki>]]
22724 [[Foo|<nowiki>x ]] y</nowiki>]]
22725 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22726 !! html/php
22727 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22728 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22729 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22730 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22731 <a href="/wiki/Foo" title="Foo">|Bar</a>
22732 <a href="/wiki/Foo" title="Foo">]]bar</a>
22733 <a href="/wiki/Foo" title="Foo">[[bar</a>
22734 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22735 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22736 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22737 </p>
22738 !! end
22739
22740 !! test
22741 Links 3. WikiLinks: No escapes needed
22742 !! wikitext
22743 [[Foo|[Foobar]]
22744 [[Foo|foo|bar]]
22745 !! html/php
22746 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22747 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22748 </p>
22749 !! html/parsoid
22750 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22751 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22752 !! end
22753
22754 !! test
22755 Links 4. ExtLinks: Escapes needed
22756 !! options
22757 parsoid=html2wt
22758 !! html/parsoid
22759 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22760 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22761 <p>[http://google.com]</p>
22762 <p>[http://google.com google]</p>
22763 !! wikitext
22764 [http://google.com <nowiki>[google]</nowiki>]
22765 [http://google.com <nowiki>google]</nowiki>]
22766
22767 <nowiki>[http://google.com]</nowiki>
22768
22769 <nowiki>[http://google.com google]</nowiki>
22770
22771 !! html/php
22772 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22773 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22774 </p><p>[http://google.com]
22775 </p><p>[http://google.com google]
22776 </p>
22777 !! end
22778
22779 !! test
22780 Links 5. ExtLinks: No escapes needed
22781 !! wikitext
22782 [http://google.com [google]
22783 !! html/php
22784 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22785 </p>
22786 !! html/parsoid
22787 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22788 !! end
22789
22790 !! test
22791 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22792 !! html/parsoid
22793 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22794 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22795 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22796 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22797 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22798 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22799 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22800 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22801 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22802 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22803 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22804 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22805 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22806 </p>
22807 !! wikitext
22808 x<nowiki/>http://example.com<nowiki/>y
22809 http://example.com<nowiki/>?x
22810 http://example.com<nowiki/>&x
22811 http://example.com<nowiki/>'x
22812 http://example.com<nowiki/>,x
22813 http://example.com<nowiki/>.x
22814 http://example.com<nowiki/>;x
22815 http://example.com<nowiki/>:x
22816 http://example.com<nowiki/>;x
22817 http://example.com<nowiki/>!x
22818 http://example.com<nowiki/>=x
22819 http://example.com<nowiki/>(x)
22820 http://example.com(x<nowiki/>)
22821 !! end
22822
22823 !! test
22824 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22825 !! html/parsoid
22826 <p>x
22827 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22828 y
22829 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22830 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22831 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22832 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22833 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22834 </p>
22835 !! wikitext
22836 x
22837 http://example.com
22838 y
22839 "http://example.com"
22840 (http://example.com)
22841 (http://example.com) foo
22842 http://example.com,
22843 http://example.com, foo
22844 !! html/php
22845 <p>x
22846 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22847 y
22848 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22849 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22850 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22851 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22852 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22853 </p>
22854 !! end
22855
22856 !! test
22857 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22858 !! html/parsoid
22859 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22860 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22861 !! wikitext
22862 http://example.com.,;:!?\
22863 -http://example.com:
22864 !! html/php
22865 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22866 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22867 </p>
22868 !! end
22869
22870 !! test
22871 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22872 !! html/parsoid
22873 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22874 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22875 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22876 !! wikitext
22877 RFC 123<nowiki/>4
22878 RFC 123<nowiki/>y
22879 X<nowiki/>RFC 123<nowiki/>y
22880 !! end
22881
22882 !! test
22883 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22884 !! html/parsoid
22885 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22886 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22887 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22888 </p>
22889 !! wikitext
22890 RFC 123?foo
22891 RFC 123&foo
22892 -RFC 123-
22893 !! html/php
22894 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22895 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22896 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22897 </p>
22898 !! end
22899
22900 !! test
22901 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22902 !! html/parsoid
22903 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22904 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22905 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22906 !! wikitext
22907 PMID 123<nowiki/>4
22908 PMID 123<nowiki/>y
22909 X<nowiki/>PMID 123<nowiki/>y
22910 !! end
22911
22912 !! test
22913 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22914 !! html/parsoid
22915 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22916 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22917 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22918 </p>
22919 !! wikitext
22920 PMID 123?foo
22921 PMID 123&foo
22922 -PMID 123-
22923 !! html/php
22924 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22925 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22926 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22927 </p>
22928 !! end
22929
22930 !! test
22931 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22932 !! html/parsoid
22933 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22934 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22935 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22936 </p>
22937 !! wikitext
22938 ISBN 1234567890<nowiki/>1
22939 ISBN 1234567890<nowiki/>x
22940 a<nowiki/>ISBN 1234567890<nowiki/>b
22941 !! end
22942
22943 !! test
22944 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22945 !! html/parsoid
22946 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22947 !! wikitext
22948 -ISBN 1234567890's
22949 !! html/php
22950 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22951 </p>
22952 !! end
22953
22954 !! test
22955 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22956 !! options
22957 parsoid=html2wt
22958 !! html/*
22959 <p>this is not a link: http://example.com
22960 </p>
22961 !! wikitext
22962 <nowiki>this is not a link: http://example.com</nowiki>
22963 !! end
22964
22965 !! test
22966 Links 15. Link trails can't become link prefixes.
22967 !! options
22968 language=is
22969 !! wikitext
22970 [[Söfnuður]]-[[00]]
22971 !! html/php
22972 <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>
22973 </p>
22974 !! html/parsoid
22975 <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>
22976 !! end
22977
22978 #### --------------- Quotes ---------------
22979 #### 1. Quotes inside <b> and <i>
22980 #### 2. Link fragments separated by <i> and <b> tags
22981 #### 3. Link fragments inside <i> and <b>
22982 #### 4. No escaping needed
22983 #### --------------------------------------
22984 !! test
22985 1a. Quotes inside <b> and <i>
22986 !! options
22987 parsoid=html2wt,wt2wt
22988 !! wikitext
22989 ''<nowiki/>'foo'''
22990 ''<nowiki>''foo''</nowiki>''
22991 ''<nowiki>'''foo'''</nowiki>''
22992 ''foo''<nowiki/>'s
22993 '''<nowiki/>'foo''''
22994 '''<nowiki>''foo''</nowiki>'''
22995 '''<nowiki>'''foo'''</nowiki>'''
22996 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22997 '''foo'''<nowiki/>'s
22998 '''foo''
22999 ''foo''<nowiki/>'
23000 ''foo'''<nowiki/>'
23001 '''foo''<nowiki/>'
23002 ''''foo'''
23003 '''foo'''<nowiki/>'
23004 ''''foo'''<nowiki/>'
23005 ''fools'<span> errand</span>''
23006 ''<span>fool</span>'s errand''
23007 '<nowiki/>''foo'' bar '''baz''
23008 a|!*#-:;+-~[]{}b'''x''
23009 !! html/*
23010 <p><i>'foo'</i>
23011 <i>''foo''</i>
23012 <i>'''foo'''</i>
23013 <i>foo</i>'s
23014 <b>'foo'</b>
23015 <b>''foo''</b>
23016 <b>'''foo'''</b>
23017 <b>foo'<i>bar'</i>baz</b>
23018 <b>foo</b>'s
23019 '<i>foo</i>
23020 <i>foo</i>'
23021 <i>foo'</i>'
23022 '<i>foo</i>'
23023 '<b>foo</b>
23024 <b>foo</b>'
23025 '<b>foo</b>'
23026 <i>fools'<span> errand</span></i>
23027 <i><span>fool</span>'s errand</i>
23028 '<i>foo</i> bar '<i>baz</i>
23029 a|!*#-:;+-~[]{}b'<i>x</i>
23030 </p>
23031 !! end
23032
23033 !! test
23034 1b. Quotes inside <b> and <i> with other tags on same line
23035 !! options
23036 parsoid=html2wt,wt2wt
23037 !! wikitext
23038 '''a'' foo ''[[bar]]''
23039 ''a''' foo ''[[bar]]''
23040 ''a''' foo '''{{echo|[[bar]]}}'''
23041 [[foo]] x'''[[bar]]''
23042 '''foo'' <ref>test</ref>
23043 '''foo'' <div title="name">test</div>
23044 '''foo'' and <br> bar
23045 <references />
23046 !! html
23047 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23048 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23049 <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>
23050 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23051 '<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>
23052 '<i>foo</i> <div title="name">test</div>
23053 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23054 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23055 <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>
23056 </ol>
23057 !! end
23058
23059 !! test
23060 2. Link fragments separated by <i> and <b> tags
23061 !! wikitext
23062 [[''foo''<nowiki>hello]]</nowiki>
23063
23064 [['''foo'''<nowiki>hello]]</nowiki>
23065 !! html
23066 <p>[[<i>foo</i>hello]]
23067 </p><p>[[<b>foo</b>hello]]
23068 </p>
23069 !! end
23070
23071 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23072 # this is one of the shortcomings of this format
23073 !! test
23074 3. Link fragments inside <i> and <b>
23075 !! wikitext
23076 ''[[foo''<nowiki>]]</nowiki>
23077
23078 '''[[foo'''<nowiki>]]</nowiki>
23079 !! html
23080 <p><i>[[foo</i>]]
23081 </p><p><b>[[foo</b>]]
23082 </p>
23083 !! end
23084
23085 !! test
23086 4. No escaping needed
23087 !! wikitext
23088 '<span>''bar''</span>'
23089 '<span>'''bar'''</span>'
23090 'a:b'foo
23091 !! html
23092 <p>'<span><i>bar</i></span>'
23093 '<span><b>bar</b></span>'
23094 'a:b'foo
23095 </p>
23096 !! end
23097
23098 #### ----------- Paragraphs ---------------
23099 #### 1. No unnecessary escapes
23100 #### --------------------------------------
23101
23102 !! test
23103 1. No unnecessary escapes
23104 !! wikitext
23105 bar <span><nowiki>[[foo]]</nowiki></span>
23106
23107 =bar <span><nowiki>[[foo]]</nowiki></span>
23108
23109 [[bar <span><nowiki>[[foo]]</nowiki></span>
23110
23111 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23112
23113 =bar <span>foo]]</span><nowiki>=</nowiki>
23114 !! html
23115 <p>bar <span>[[foo]]</span>
23116 </p><p>=bar <span>[[foo]]</span>
23117 </p><p>[[bar <span>[[foo]]</span>
23118 </p><p>]]bar <span>[[foo]]</span>
23119 </p><p>=bar <span>foo]]</span>=
23120 </p>
23121 !!end
23122
23123 #### ----------------------- PRE --------------------------
23124 #### 1. Leading whitespace in SOL context should be escaped
23125 #### ------------------------------------------------------
23126 !! test
23127 1. Leading whitespace in SOL context should be escaped
23128 !! options
23129 parsoid
23130 !! wikitext
23131 <nowiki> </nowiki>a
23132
23133 <nowiki> </nowiki> a
23134
23135 <nowiki> </nowiki>a(tab)
23136
23137 <nowiki> </nowiki> a
23138 <!--cmt-->
23139 <nowiki> </nowiki> a
23140
23141 a
23142 <nowiki> </nowiki>b
23143
23144 a
23145 <nowiki> </nowiki>b
23146
23147 a
23148 <nowiki> </nowiki> b
23149 !! html
23150 <p> a</p>
23151 <p> a</p>
23152 <p> a(tab)</p>
23153 <p> a</p>
23154 <p><!--cmt--> a</p>
23155 <p>a
23156 b</p>
23157 <p>a
23158 b</p>
23159 <p>a
23160 b</p>
23161 !! end
23162
23163 !! test
23164 2. Leading whitespace in non-indent-pre contexts should not be escaped
23165 !! options
23166 parsoid
23167 !! wikitext
23168 foo <ref>''a''
23169 b</ref>
23170 <references />
23171 !! html
23172 <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>
23173 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23174 <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>
23175 b</span></li>
23176 </ol>
23177 !! end
23178
23179 !! test
23180 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23181 !! options
23182 parsoid
23183 !! wikitext
23184 <blockquote>
23185 a
23186 <span>b</span>
23187 c
23188 </blockquote>
23189 !! html
23190 <blockquote>
23191 <p>
23192 a
23193 <span>b</span>
23194 c</p>
23195 </blockquote>
23196 !! end
23197
23198 !! test
23199 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23200 !! options
23201 parsoid
23202 !! wikitext
23203 [[File:Foobar.jpg|thumb|caption]]
23204 !! html/parsoid
23205 <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>
23206 !! end
23207
23208 !! test
23209 5. Nowiki escaping should account for indent-pres
23210 !! options
23211 parsoid=html2wt
23212 !! html/parsoid
23213 <pre>==foo==</pre>
23214 !! wikitext
23215 ==foo==
23216 !! end
23217
23218 !!test
23219 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23220 !! options
23221 parsoid
23222 !! wikitext
23223 * foo
23224 * bar
23225 !! html
23226 <pre>
23227 * foo
23228 * bar
23229 </pre>
23230 !! end
23231
23232 #### --------------- Behavior Switches --------------------
23233
23234 !! test
23235 1. Valid behavior switches should be escaped
23236 !! options
23237 parsoid=html2wt
23238 !! html/parsoid
23239 __TOC__
23240 <i>__TOC__</i>
23241 !! wikitext
23242 <nowiki>__TOC__</nowiki>
23243 ''<nowiki>__TOC__</nowiki>''
23244 !! end
23245
23246 !! test
23247 2. Invalid behavior switches should not be escaped
23248 !! options
23249 parsoid=html2wt
23250 !! html/parsoid
23251 __TOO__
23252 __|__
23253 !! wikitext
23254 __TOO__
23255 __|__
23256 !! end
23257
23258 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23259 !! test
23260 Behavior switches should be SOL-transparent
23261 !! wikitext
23262 __TOC__
23263
23264 <!-- this one's bogus -->
23265 __TOO__
23266
23267 __TOC__ foo
23268
23269 __TOC__ bar
23270 !! html/parsoid
23271 <meta property="mw:PageProp/toc" />
23272
23273 <!-- this one's bogus -->
23274 <pre>__TOO__</pre>
23275
23276 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23277
23278 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23279 !! end
23280
23281 #### --------------- HTML tags ---------------
23282 #### 1. a tags
23283 #### 2. other tags
23284 #### 3. multi-line html tag
23285 #### 4. extension tags
23286 #### -----------------------------------------
23287 !! test
23288 1. a tags
23289 !! options
23290 parsoid
23291 !! wikitext
23292 <a href="http://google.com">google</a>
23293 !! html
23294 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23295 !! end
23296
23297 !! test
23298 2. other tags
23299 !! wikitext
23300 * <nowiki><div>foo</div></nowiki>
23301 * <nowiki><div style="color:red">foo</div></nowiki>
23302 * <nowiki><td></nowiki>
23303 !! html
23304 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23305 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23306 <li> &lt;td&gt;</li></ul>
23307
23308 !! end
23309
23310 !! test
23311 3. multi-line html tag
23312 !! wikitext
23313 <nowiki><div
23314 >foo</div
23315 ></nowiki>
23316 !! html
23317 <p>&lt;div
23318 &gt;foo&lt;/div
23319 &gt;
23320 </p>
23321 !! end
23322
23323 !! test
23324 4. extension tags
23325 !! wikitext
23326 <nowiki><ref>foo</ref></nowiki>
23327
23328 <nowiki><ref>bar</nowiki>
23329
23330 baz<nowiki></ref></nowiki>
23331 !! html
23332 <p>&lt;ref&gt;foo&lt;/ref&gt;
23333 </p><p>&lt;ref&gt;bar
23334 </p><p>baz&lt;/ref&gt;
23335 </p>
23336 !! end
23337
23338 #### --------------- Others ---------------
23339 !! test
23340 Escaping nowikis
23341 !! wikitext
23342 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23343 !! html
23344 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23345 </p>
23346 !! end
23347
23348 ## The quote-char in the input is necessary for triggering the bug
23349 !! test
23350 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23351 !! options
23352 parsoid=wt2wt,html2wt
23353 !! wikitext
23354 foo's bar :
23355 !! html
23356 <p>foo's bar :</p>
23357 !! end
23358
23359 !! test
23360
23361 Tag-like HTML structures are passed through as text
23362 !! wikitext
23363 <x y>
23364
23365 <x.y>
23366
23367 <x-y>
23368
23369 1>2
23370
23371 x<y
23372
23373 a>b
23374
23375 1<d e>f
23376 !! html
23377 <p>&lt;x y&gt;
23378 </p><p>&lt;x.y&gt;
23379 </p><p>&lt;x-y&gt;
23380 </p><p>1&gt;2
23381 </p><p>x&lt;y
23382 </p><p>a&gt;b
23383 </p><p>1&lt;d e&gt;f
23384 </p>
23385 !! end
23386
23387 !! test
23388 HTML tag with necessary entities in attributes
23389 !! wikitext
23390 <span title="&amp;amp;">foo</span>
23391 !! html
23392 <p><span title="&amp;amp;">foo</span>
23393 </p>
23394 !! end
23395
23396 !! test
23397 HTML tag with 'unnecessary' entity encoding in attributes
23398 !! wikitext
23399 <span title="&amp;">foo</span>
23400 !! html
23401 <p><span title="&amp;">foo</span>
23402 </p>
23403 !! end
23404
23405 !! test
23406 HTML tag with broken attribute value quoting
23407 !! wikitext
23408 <span title="Hello world>Foo</span>
23409 !! html/php
23410 <p><span>Foo</span>
23411 </p>
23412 !! html/parsoid
23413 <p><span title="Hello world">Foo</span>
23414 </p>
23415 !! end
23416
23417 !! test
23418 Parsoid-only: HTML tag with broken attribute value quoting
23419 !! options
23420 parsoid
23421 !! wikitext
23422 <span title="Hello world>Foo</span>
23423 !! html
23424 <p><span title="Hello world">Foo</span>
23425 </p>
23426 !! end
23427
23428 !! test
23429 Table with broken attribute value quoting
23430 !! wikitext
23431 {|
23432 | title="Hello world|Foo
23433 |}
23434 !! html/php
23435 <table>
23436 <tr>
23437 <td>Foo
23438 </td></tr></table>
23439
23440 !! html/parsoid
23441 <table>
23442 <tr>
23443 <td title="Hello world">Foo
23444 </td></tr></table>
23445
23446 !! end
23447
23448 !! test
23449 Table with broken attribute value quoting on consecutive lines
23450 !! wikitext
23451 {|
23452 | title="Hello world|Foo
23453 | style="color:red|Bar
23454 |}
23455 !! html/php
23456 <table>
23457 <tr>
23458 <td>Foo
23459 </td>
23460 <td>Bar
23461 </td></tr></table>
23462
23463 !! html/parsoid
23464 <table><tbody>
23465 <tr>
23466 <td title="Hello world">Foo
23467 </td><td style="color: red">Bar
23468 </td></tr></tbody></table>
23469
23470 !! end
23471
23472 !! test
23473 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23474 !! options
23475 parsoid
23476 !! wikitext
23477 {{}}
23478 !! html
23479 {{}}
23480 !! end
23481
23482 !! test
23483 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23484 !! options
23485 parsoid
23486 !! wikitext
23487 }}{{
23488 !! html
23489 }}{{
23490 !! end
23491
23492 !!test
23493 Accept empty td cell attribute
23494 !! wikitext
23495 {|
23496 | align="center" | foo || |
23497 |}
23498 !! html
23499 <table>
23500 <tr>
23501 <td align="center"> foo </td>
23502 <td>
23503 </td></tr></table>
23504
23505 !!end
23506
23507 !!test
23508 Non-empty attributes in th-cells
23509 !! wikitext
23510 {|
23511 ! Foo !! style="color: red" | Bar
23512 |}
23513 !! html
23514 <table>
23515 <tr>
23516 <th> Foo </th>
23517 <th style="color: red"> Bar
23518 </th></tr></table>
23519
23520 !!end
23521
23522 !!test
23523 Accept empty attributes in th-cells
23524 !! wikitext
23525 {|
23526 !| foo !!| bar
23527 |}
23528 !! html
23529 <table>
23530 <tr>
23531 <th> foo </th>
23532 <th> bar
23533 </th></tr></table>
23534
23535 !!end
23536
23537 !!test
23538 Empty table rows go away
23539 !! wikitext
23540 {|
23541 | Hello
23542 | there
23543 |- class="foo"
23544 |-
23545 |}
23546 !! html
23547 <table>
23548 <tr>
23549 <td> Hello
23550 </td>
23551 <td> there
23552 </td></tr>
23553
23554 </table>
23555
23556 !! end
23557
23558 ###
23559 ### Parsoid-centric tests for testing RTing of inter-element separators
23560 ### Edge cases not tested by existing parser tests and specific to
23561 ### Parsoid-specific serialization strategies.
23562 ###
23563
23564 !!test
23565 RT-ed inter-element separators should be valid separators
23566 !! wikitext
23567 {|
23568 |- [[foo]]
23569 |}
23570 !! html
23571 <table>
23572
23573 </table>
23574
23575 !!end
23576
23577 # Parsoid-only since PHP parser relies on Tidy for correct output
23578 !!test
23579 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23580 !!options
23581 parsoid
23582 !! wikitext
23583 {|
23584 |<small>foo
23585 bar
23586 |}
23587
23588 {|
23589 |<small>foo<small>
23590 |}
23591 !! html
23592 <table>
23593 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23594 <p>bar</p></small></td></tr>
23595 </tbody></table>
23596
23597 <table>
23598 <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>
23599 </tbody></table>
23600 !!end
23601
23602 # Note that the "style" attribute is really a template parameter here.
23603 # The = would have to be {{=}} if you wanted the literal.
23604 !!test
23605 Empty TD followed by TD with tpl-generated attribute
23606 !! wikitext
23607 {|
23608 |-
23609 |
23610 |{{echo|style='color:red'}}|foo
23611 |}
23612 !! html
23613 <table>
23614
23615 <tr>
23616 <td>
23617 </td>
23618 <td>foo
23619 </td></tr></table>
23620
23621 !!end
23622
23623 !!test
23624 Indented table with an empty td
23625 !! wikitext
23626 {|
23627 |-
23628 |
23629 |foo
23630 |}
23631 !! html
23632 <table>
23633
23634 <tr>
23635 <td>
23636 </td>
23637 <td>foo
23638 </td></tr></table>
23639
23640 !!end
23641
23642 ## We have some newline diffs RT-ing this edge case
23643 ## and it is not important enough -- we seem to be emitting
23644 ## at most 2 newlines after a </tr> and this is unrelated to
23645 ## the issue from T85627 that this is testing.
23646 !!test
23647 Indented table with blank lines in between (T85627)
23648 !! options
23649 parsoid=wt2html
23650 !! wikitext
23651 {|
23652 |foo
23653
23654
23655 |}
23656 !! html
23657 <table>
23658
23659 <tr>
23660 <td>foo
23661 </td></tr></table>
23662
23663 !!end
23664
23665 !!test
23666 Indented block & table
23667 !! wikitext
23668 <div>foo</div>
23669 {|
23670 |foo
23671 |}
23672 !! html/php
23673 <div>foo</div>
23674 <table>
23675 <tr>
23676 <td>foo
23677 </td></tr></table>
23678
23679 !! html/parsoid
23680 <div data-parsoid='{"stx":"html"}'>foo</div>
23681 <table><tbody>
23682 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23683 </tbody></table>
23684 !!end
23685
23686 !! test
23687 Indent and comment before table row
23688 !! wikitext
23689 {|
23690 <!--hi-->|-
23691 | there
23692 |}
23693 !! html/php
23694 <table>
23695
23696 <tr>
23697 <td> there
23698 </td></tr></table>
23699
23700 !! html/parsoid
23701 <table>
23702 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23703 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23704 </tbody></table>
23705 !! end
23706
23707 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23708 !!test
23709 Empty TR followed by a template-generated TR
23710 !!options
23711 parsoid
23712 !! wikitext
23713 {|
23714 |-
23715 {{echo|<tr><td>foo</td></tr>}}
23716 |}
23717 !! html
23718 <table>
23719 <tbody>
23720 <tr></tr>
23721 <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}}]}'>
23722 <td>foo</td></tr>
23723 </tbody></table>
23724 !!end
23725
23726 ## PHP and parsoid output differ for this, and since this is primarily
23727 ## for testing Parsoid's serializer, marking this Parsoid only
23728 !!test
23729 Empty TR followed by mixed-ws-comment line should RT correctly
23730 !!options
23731 parsoid
23732 !! wikitext
23733 {|
23734 |-
23735 <!--c-->
23736 |-
23737 <!--c--> <!--d-->
23738 |}
23739 !! html
23740 <table>
23741 <tbody>
23742 <tr></tr>
23743 <!--c-->
23744 <tr>
23745 <!--c--> </tr><!--d-->
23746 </tbody></table>
23747
23748 !!end
23749
23750 !!test
23751 Multi-line image caption generated by templates with/without trailing newlines
23752 !! wikitext
23753 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23754 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23755 !! html/parsoid
23756 <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>
23757 <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>
23758 !!end
23759
23760 !! test
23761 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23762 !! options
23763 parsoid=html2wt
23764 !! html/parsoid
23765 <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>
23766
23767 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23768 !! wikitext
23769 <includeonly>foo</includeonly>
23770 new para
23771
23772 [[Category:Foo]]
23773
23774 = new heading =
23775 !! end
23776
23777 ## PHP emits broken html for this, and since this is primarily
23778 ## a Parsoid serializer test, marking this Parsoid only
23779 !!test
23780 Improperly nested inline or quotes tags with whitespace in between
23781 !! wikitext
23782 <span> <s>x</span> </s>
23783 ''' ''x''' ''
23784 !! html/parsoid
23785 <p><span> <s>x</s></span><s> </s>
23786 <b> <i>x</i></b><i> </i>
23787 </p>
23788 !!end
23789
23790 !!test
23791 Encapsulate protected attributes from wt
23792 !! wikitext
23793 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23794 !! html/parsoid
23795 <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>
23796 </body>
23797 !!end
23798
23799 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23800 ## Having nested or stray pre tags results in the attempt to add duplicates,
23801 ## causing an assertion fail. This test tries to prevent that situation.
23802 !!test
23803 Ensure ParagraphWrapper can deal with stray closing pre tags
23804 !!options
23805 parsoid=wt2html
23806 !! wikitext
23807 plain text</pre>
23808 !! html/parsoid
23809 plain text
23810 !!end
23811
23812 !!test
23813 1. Ensure fostered text content is wrapped in element nodes
23814 !!options
23815 parsoid=wt2html
23816 !! wikitext
23817 <table>hi</table><table>ho</table>
23818 !! html/parsoid
23819 <p>hi</p>
23820 <table></table>
23821 <p>ho</p>
23822 <table></table>
23823 !!end
23824
23825 !!test
23826 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23827 !!options
23828 parsoid=wt2html,wt2wt
23829 !! wikitext
23830 <table>
23831 <tr> || ||
23832 <td> a
23833 </table>
23834 !! html/parsoid
23835 <p> || ||
23836 </p><table>
23837 <tbody><tr><td> a</td></tr>
23838 </tbody></table>
23839 !!end
23840
23841 !!test
23842 Encapsulation properly handles null DSR information from foster box
23843 !!options
23844 parsoid=wt2html,wt2wt
23845 !! wikitext
23846 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23847 !! html/parsoid
23848 <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>
23849 !!end
23850
23851 !!test
23852 1. Encapsulate foster-parented transclusion content
23853 !!options
23854 parsoid=wt2wt,wt2html
23855 !! wikitext
23856 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23857 !! html/parsoid
23858 <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>
23859 <tbody>
23860 <tr>
23861 <td>bar</td>
23862 </tr>
23863 </tbody>
23864 </table>
23865 !!end
23866
23867 !!test
23868 2. Encapsulate foster-parented transclusion content
23869 !!options
23870 parsoid=wt2wt,wt2html
23871 !! wikitext
23872 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23873 !! html/parsoid
23874 <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>
23875 <table>
23876 <tbody>
23877 <tr>
23878 <td>bar</td>
23879 </tr>
23880 </tbody>
23881 </table>
23882 !!end
23883
23884 !!test
23885 3. Encapsulate foster-parented transclusion content
23886 !!options
23887 parsoid=wt2wt,wt2html
23888 !! wikitext
23889 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23890 !! html/parsoid
23891 <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;]}">
23892 <p>foo</p>
23893 </div>
23894 <table>
23895 <tbody>
23896 <tr>
23897 <td>bar</td>
23898 </tr>
23899 </tbody>
23900 </table>
23901 !!end
23902
23903 !!test
23904 4. Encapsulate foster-parented transclusion content
23905 !!options
23906 parsoid=wt2wt,wt2html
23907 !! wikitext
23908 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23909 !! html/parsoid
23910 <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;]}">
23911 <p>foo</p>
23912 </div>
23913 <table>
23914 <tbody>
23915 <tr>
23916 <td>bar</td>
23917 </tr>
23918 </tbody>
23919 </table>
23920 !!end
23921
23922 !!test
23923 5. Encapsulate foster-parented transclusion content
23924 !!options
23925 parsoid=wt2wt,wt2html
23926 !! wikitext
23927 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23928 !! html/parsoid
23929 <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>
23930 <table>
23931 <tbody>
23932 <tr>
23933 <td>
23934 <div>
23935 <p>foo</p>
23936 </div>
23937 </td>
23938 </tr>
23939 </tbody>
23940 </table>
23941 !!end
23942
23943 !!test
23944 6. Encapsulate foster-parented transclusion content
23945 !!options
23946 parsoid=wt2wt,wt2html
23947 !! wikitext
23948 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23949 !! html/parsoid
23950 <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>
23951 <table>
23952 <tbody>
23953 <tr>
23954 <td>
23955 <div>
23956 <p>foo</p>
23957 </div>
23958 </td>
23959 </tr>
23960 </tbody>
23961 </table>
23962 <p>ok</p>
23963 !!end
23964
23965 !!test
23966 7. Encapsulate foster-parented transclusion content
23967 !!options
23968 parsoid=wt2wt,wt2html
23969 !! wikitext
23970 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23971 !! html/parsoid
23972 <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>
23973 <table>
23974 <tbody>
23975 <tr>
23976 <td>bar</td>
23977 </tr>
23978 </tbody>
23979 </table>
23980 !!end
23981
23982 # Note that the wt is broken on purpose: the = should be {{=}} if you
23983 # don't want it to be a template parameter key.
23984 !!test
23985 8. Encapsulate foster-parented transclusion content
23986 !!options
23987 parsoid=wt2wt,wt2html
23988 !! wikitext
23989 {{echo|a
23990 }}{|{{echo|style='color:red'}}
23991 |-
23992 |b
23993 |}
23994 !! html/parsoid
23995 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23996 <span> </span>
23997 <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>
23998 <table>
23999 <tbody>
24000 <tr>
24001 <td>b</td>
24002 </tr>
24003 </tbody>
24004 </table>
24005 !!end
24006
24007 !!test
24008 9. Encapsulate foster-parented transclusion content
24009 !!options
24010 parsoid=wt2wt,wt2html
24011 !! wikitext
24012 <table>{{echo|hi</table>hello}}
24013 !! html/parsoid
24014 <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>
24015 !!end
24016
24017 !!test
24018 Table in fosterable position
24019 !!options
24020 parsoid=wt2html,wt2wt
24021 !! wikitext
24022 {{OpenTable}}
24023 <div>
24024 {|
24025 |}
24026 </div>
24027 |}
24028 !! html/parsoid
24029 <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">
24030 </span>
24031 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24032
24033 <table>
24034 </table>
24035 !!end
24036
24037 # Parsoid only for bug 64747
24038 !! test
24039 Properly encapsulate empty-content transclusions in fosterable positions
24040 !! wikitext
24041 <table>
24042 {{#if:|
24043 <td>foo</td>
24044 }}
24045 </table>
24046 !! html/parsoid
24047 <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":["","","",""]}]]}'>
24048
24049 </table>
24050 !! end
24051
24052 !!test
24053 Support <object> element with .data attribute
24054 !!options
24055 parsoid=html2wt
24056 !! html/parsoid
24057 <object data="test.swf"></object>
24058 !! wikitext
24059 <object data="test.swf"></object>
24060 !!end
24061
24062 !! test
24063 Don't block XML namespace declaration
24064 !! wikitext
24065 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24066 !! html/php
24067 <p><span>MediaWiki</span>
24068 </p>
24069 !! html/parsoid
24070 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24071 !! end
24072
24073 # -----------------------------------------------------------------
24074 # The following section of tests are primarily to spec requirements
24075 # around serialization of new/edited content.
24076 #
24077 # All these tests are marked Parsoid html2wt and html2html only
24078 # ----------------------------------------------------------------
24079
24080 # 'mi' is a localinterwiki prefix as well as a language
24081 !! test
24082 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24083 !! options
24084 parsoid=html2wt
24085 !! html/parsoid
24086 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24087 !! wikitext
24088 [[Foo]]
24089 !! end
24090
24091 # See T93839
24092 !! test
24093 New wikilinks should be serialized properly
24094 !! options
24095 parsoid=html2wt
24096 !! html/parsoid
24097 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24098 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24099 !! wikitext
24100 [[Foo]]
24101 [[Foo]]
24102 !! end
24103
24104 !! test
24105 New wiki links (href variations)
24106 !! options
24107 parsoid=html2wt
24108 !! html/parsoid
24109 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24110 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24111 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24112 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24113 !! wikitext
24114 [[Foo_bar]]
24115 [[Foo_bar]]
24116 [[Foo_bar]]
24117 [[Toxine bactérienne]]
24118 !! end
24119
24120 !! test
24121 New wiki links (content string variations)
24122 !! options
24123 parsoid=html2wt
24124 !! html/parsoid
24125 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24126 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24127 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24128 !! wikitext
24129 [[Foo_bar]]
24130 [[Foo bar]]
24131 [[Foo_bar|./Foo_bar]]
24132 !! end
24133
24134 !! test
24135 New category links (href variations)
24136 !! options
24137 parsoid=html2wt
24138 !! html/parsoid
24139 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24140 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24141 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24142 !! wikitext
24143 [[Category:Toxine bactérienne]]
24144 [[Category:Toxine bactérienne]]
24145 [[Category:Toxine bactérienne]]
24146 !! end
24147
24148 !! test
24149 New sol transparent links don't need indent-pre nowiki protection
24150 !! options
24151 parsoid=html2wt
24152 language=de
24153 !! html/parsoid
24154 <link rel="mw:PageProp/redirect" href="./Main_Page">
24155 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24156 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24157 !! wikitext
24158 #WEITERLEITUNG [[Main Page]]
24159 <!-- this is good --> [[Category:Good]]
24160 <!-- this is great --> [[Kategorie:Great]]
24161 !! end
24162
24163 !! test
24164 New interlanguage links (href variations)
24165 !! options
24166 parsoid=html2wt
24167 !! html/parsoid
24168 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24169 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24170 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24171 !! wikitext
24172 [[es:Toxine bactérienne]]
24173 [[es:Toxine_bactérienne]]
24174 [[es:Toxine_bactérienne]]
24175 !! end
24176
24177 !! test
24178 Image: Modifying size of an image (1)
24179 !! options
24180 parsoid={
24181 "modes": ["wt2wt"],
24182 "changes": [
24183 ["img[height]", "attr", "height", "22"],
24184 ["img[width]", "attr", "width", "200"]
24185 ]
24186 }
24187 !! wikitext
24188 [[Image:Foobar.jpg|230x230px]]
24189 !! wikitext/edited
24190 [[Image:Foobar.jpg|200x200px]]
24191 !!end
24192
24193 !! test
24194 Image: Modifying size of an image (2)
24195 !! options
24196 parsoid={
24197 "modes": ["wt2wt"],
24198 "changes": [
24199 ["img[height]", "attr", "height", "100"],
24200 ["img[width]", "attr", "width", "500"]
24201 ]
24202 }
24203 !! wikitext
24204 [[Image:Foobar.jpg|230x230px]]
24205 !! wikitext/edited
24206 [[Image:Foobar.jpg|500x500px]]
24207 !!end
24208
24209 # Change in size is ignored so long as class='mw-default-size'
24210 !! test
24211 Image: Modifying size of an image (3)
24212 !! options
24213 parsoid={
24214 "modes": ["wt2wt"],
24215 "changes": [
24216 ["figure[class]", "removeClass", "mw-default-size"],
24217 ["figure img", "attr", "height", "19"],
24218 ["figure img", "attr", "width", "170"]
24219 ]
24220 }
24221 !! wikitext
24222 [[Image:Foobar.jpg|thumb]]
24223 !! wikitext/edited
24224 [[Image:Foobar.jpg|thumb|170x170px]]
24225 !!end
24226
24227 !! test
24228 Image: Modifying alignment of an image (bug 48665)
24229 !! options
24230 parsoid={
24231 "modes": ["wt2wt"],
24232 "changes": [
24233 ["figure[class]", "removeClass", "mw-halign-right"],
24234 ["figure[class]", "addClass", "mw-halign-left"]
24235 ]
24236 }
24237 !! wikitext
24238 [[Image:Foobar.jpg|thumb|caption|right]]
24239 !! wikitext/edited
24240 [[Image:Foobar.jpg|thumb|caption|left]]
24241 !! end
24242
24243 !! test
24244 Image: Modifying mw-default-size of an frameless image (bug 62805)
24245 !! options
24246 parsoid={
24247 "modes": ["wt2wt"],
24248 "changes": [
24249 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24250 ]
24251 }
24252 !! wikitext
24253 [[Image:Foobar.jpg|frameless|right]]
24254 !! wikitext/edited
24255 [[Image:Foobar.jpg|frameless|right|220x220px]]
24256 !! end
24257
24258 !! test
24259 Image: Modifying valign of an image (bug 49221)
24260 !! options
24261 parsoid={
24262 "modes": ["wt2wt"],
24263 "changes": [
24264 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24265 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24266 ]
24267 }
24268 !! wikitext
24269 [[File:Foobar.jpg|20px|middle]]
24270 !! wikitext/edited
24271 [[File:Foobar.jpg|20px|text-top]]
24272 !! end
24273
24274 !! test
24275 Image: Modifying alt attribute of an image (bug 56400)
24276 !! options
24277 parsoid={
24278 "modes": ["wt2wt"],
24279 "changes": [
24280 ["img[alt]", "attr", "alt", "some alternate edited text"]
24281 ]
24282 }
24283 !! wikitext
24284 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24285 !! wikitext/edited
24286 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24287 !!end
24288
24289 !! test
24290 Image: Modifying caption of an image
24291 !! options
24292 parsoid={
24293 "modes": ["wt2wt"],
24294 "changes": [
24295 ["figcaption", "text", "new caption"]
24296 ]
24297 }
24298 !! wikitext
24299 [[Image:Foobar.jpg|thumb|original caption]]
24300 !! wikitext/edited
24301 [[Image:Foobar.jpg|thumb|new caption]]
24302 !!end
24303
24304 !! test
24305 Image: empty alt attribute (bug 48924)
24306 !! options
24307 parsoid
24308 !! wikitext
24309 [[File:Foobar.jpg|thumb|alt=|bar]]
24310 !! html
24311 <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>
24312 !! end
24313
24314 !! test
24315 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24316 !! options
24317 parsoid=html2wt
24318 language=ar
24319 disabled
24320 !! html/parsoid
24321 <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>
24322 !! wikitext
24323 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24324 !! end
24325
24326 !! test
24327 Image: Block level image should have \n before and after
24328 !! wikitext
24329 123
24330 [[File:Foobar.jpg|right|thumb|150x150px]]
24331 456
24332 !! html/parsoid
24333 <p>123</p>
24334 <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>
24335 <p>456</p>
24336 !!end
24337
24338 !! test
24339 Image: New block level image should have \n before and after (existing content)
24340 !! wikitext
24341 123
24342 [[File:Foobar.jpg|right|thumb|150x150px]]
24343 456
24344 !! html/parsoid
24345 <p>123</p>
24346 <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>
24347 <p>456</p>
24348 !!end
24349
24350 !! test
24351 Image: upright option (parsoid)
24352 !! wikitext
24353 [[File:Foobar.jpg|thumb|upright|caption]]
24354 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24355 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24356 !! html/parsoid
24357 <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>
24358 <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>
24359 <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>
24360 !!end
24361
24362 !! test
24363 Image: upright option is ignored on inline and frame images (parsoid)
24364 !! wikitext
24365 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24366 !! html/parsoid
24367 <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>
24368 !!end
24369
24370 !! test
24371 Image: from basic HTML (1)
24372 !! options
24373 parsoid=html2wt
24374 !! html/parsoid
24375 <span typeof="mw:Image">
24376 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24377 </span>
24378 !! wikitext
24379 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24380 !! end
24381
24382 !! test
24383 Image: from basic HTML (2)
24384 !! options
24385 parsoid=html2wt
24386 !! html/parsoid
24387 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24388 !! wikitext
24389 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24390 !! end
24391
24392 !! test
24393 Image: from basic HTML (3)
24394 !! options
24395 parsoid=html2wt
24396 !! html/parsoid
24397 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24398 !! wikitext
24399 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24400 !! end
24401
24402 !! test
24403 Image: from basic HTML (4)
24404 !! options
24405 parsoid=html2wt
24406 !! html/parsoid
24407 <img src="./File:Foobar.jpg">
24408 !! wikitext
24409 [[File:Foobar.jpg|link=]]
24410 !! end
24411
24412 !! test
24413 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24414 !! options
24415 parsoid=html2wt
24416 !! html/parsoid
24417 <ul>
24418 <li><p>foo</p></li>
24419 </ul>
24420 !! wikitext
24421 * foo
24422 !! end
24423
24424 !! test
24425 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24426 !! options
24427 parsoid=html2wt
24428 !! html/parsoid
24429 <ul> <li>foo</li></ul>
24430 !! wikitext
24431 * foo
24432 !! end
24433
24434 !! test
24435 Don't strip leading whitespace when handling indent-pre suppressing tags
24436 !! options
24437 parsoid=html2wt
24438 !! html/parsoid
24439 <table>
24440 <tr><td> indented row</td></tr>
24441 </table>
24442 <blockquote><p>
24443 <b>This is very bold of you!</b>
24444 </p>
24445 <table><tr><td>
24446 indented cell (no pre-wrapping!)
24447 </td></tr></table>
24448 </blockquote>
24449 <p>foo</p>
24450 <div>bar</div>
24451 !! wikitext
24452 {|
24453 | indented row
24454 |}
24455 <blockquote>
24456 '''This is very bold of you!'''
24457
24458 {|
24459 |
24460 indented cell (no pre-wrapping!)
24461 |}
24462 </blockquote>
24463 foo
24464 <div>bar</div>
24465 !! end
24466
24467 !! test
24468 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24469 !! options
24470 parsoid=html2wt
24471 !! html/parsoid
24472 <p>foo</p>
24473 <span>bar</span>
24474
24475 <span>foo2
24476 </span>bar2
24477
24478 <div>foo</div>
24479 <span>bar</span>
24480
24481 <div>
24482 <span>foo</span>
24483 </div>
24484 !! wikitext
24485 foo
24486 <nowiki> </nowiki><span>bar</span>
24487
24488 <span>foo2
24489 <nowiki> </nowiki></span>bar2
24490
24491 <div>foo</div>
24492 <nowiki> </nowiki><span>bar</span>
24493
24494 <div>
24495 <nowiki> </nowiki><span>foo</span>
24496 </div>
24497 !! end
24498
24499 !! test
24500 Lists: Dont insert newlines in a serialized list item.
24501 !! options
24502 parsoid=html2wt
24503 !! html/parsoid
24504 <ul><li>a<br>b</li><li>c</li></ul>
24505 !! wikitext
24506 * a<br>b
24507 * c
24508 !! end
24509
24510 !! test
24511 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24512 !! options
24513 parsoid={
24514 "modes": ["html2wt"],
24515 "scrubWikitext": false
24516 }
24517 !! html/parsoid
24518 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24519 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24520
24521 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24522 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24523
24524 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24525
24526 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24527 !! wikitext
24528 == hello there [[Category:A1]] ==
24529
24530 == [[Category:A2]] hi pal ==
24531
24532 == <!--foo--> [[Category:A3]] how goes it ==
24533
24534 == it goes well [[Category:A4]] <!--bar--> ==
24535
24536 ==howdy [[Category:A5]] ==
24537
24538 == __TOC__ ok ==
24539 !! end
24540
24541 !! test
24542 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24543 !! options
24544 parsoid={
24545 "modes": ["html2wt"],
24546 "scrubWikitext": true
24547 }
24548 !! html/parsoid
24549 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24550 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24551
24552 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24553 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24554
24555 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24556 !! wikitext
24557 == hello there ==
24558 [[Category:A1]]
24559 [[Category:A2]]
24560
24561 == hi pal ==
24562
24563 <!--foo--> [[Category:A3]]
24564
24565 == how goes it ==
24566
24567 == it goes well ==
24568 [[Category:A4]] <!--bar-->
24569
24570 __TOC__
24571
24572 == ok ==
24573 !! end
24574
24575 !! test
24576 Headings: Don't hoist metas that come from templates
24577 !! options
24578 parsoid={
24579 "modes": ["html2wt"],
24580 "scrubWikitext": true
24581 }
24582 !! html/parsoid
24583 <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>
24584 !! wikitext
24585 == {{echo|foo [[Category:Foo]]}} ==
24586 !! end
24587
24588 !! test
24589 Headings: Category in ref isn't hoisted
24590 !! options
24591 parsoid={
24592 "modes": ["html2wt"],
24593 "scrubWikitext": true
24594 }
24595 !! html/parsoid
24596 <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>
24597
24598 <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>
24599 !! wikitext
24600 == foo <ref>bar
24601 [[Category:Baz]] </ref> ==
24602
24603 <references />
24604 !! end
24605
24606 !! test
24607 Parsoid: Serialize positional parameters with = in them as named parameter
24608 !! options
24609 parsoid=html2wt
24610 !! html/parsoid
24611 <p about="#mwt1" typeof="mw:Transclusion"
24612 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24613
24614 <p about="#mwt1" typeof="mw:Transclusion"
24615 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24616
24617 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24618 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24619 <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>
24620 !! wikitext
24621 {{echo|1 = f=oo}}
24622
24623 {{echo|1 = f=oo|2 = bar}}
24624
24625 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24626 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24627 {{echo|<nowiki>f=oo</nowiki>|bar}}
24628 !! end
24629
24630 !! test
24631 Parsoid: Serialize positional parameters with = in extlink as named parameter
24632 !! options
24633 parsoid=html2wt
24634 !! html/parsoid
24635 <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>
24636 !! wikitext
24637 {{echo|1 = http://stuff?is=ok}}
24638 !! end
24639
24640 !! test
24641 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24642 !! options
24643 parsoid=html2wt
24644 !! html/parsoid
24645 <div>a<p>b</p></div>
24646 <div>a
24647 <p>b</p></div>
24648 <div>
24649 a
24650 <p>b</p></div>
24651 !! wikitext
24652 <div>a
24653 b
24654 </div>
24655 <div>a
24656 b
24657 </div>
24658 <div>
24659 a
24660
24661 b
24662 </div>
24663 !! end
24664
24665 !! test
24666 Substrings resembling wikitext in hrefs should not get nowiki escapes
24667 !! options
24668 parsoid=html2wt
24669 !! html/parsoid
24670 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24671 !! wikitext
24672 [[Foo''bar''baz]]
24673 !! end
24674
24675 !! test
24676 Enforce single-line context in the serializer
24677 !! options
24678 parsoid=html2wt
24679 !! html/parsoid
24680 <h2>testing
24681 123</h2>
24682
24683 <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">
24684 </span><span about="#mwt1">you</span> </h2>
24685
24686 <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>
24687
24688 <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
24689 there</span></li></ol>
24690
24691 <ul><li>asd
24692 sdf</li></ul>
24693
24694 <ul><li>foo
24695 bar
24696 baz</li>
24697 <li>foo <b>bar</b>
24698 baz</li></ul>
24699
24700 <dl><dt>hi
24701 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24702 ho</dd></dl>
24703
24704 <dl><dd> <table>
24705 <tbody><tr><td> ha
24706 ha
24707 ha</td></tr>
24708 </tbody></table></dd></dl>
24709 !! wikitext
24710 == testing 123 ==
24711
24712 == hi {{bogus|there
24713 you}} ==
24714
24715 == foo <ref>hello
24716 there</ref> ==
24717
24718 <references />
24719
24720 * asd sdf
24721
24722 * foo bar baz
24723 * foo '''bar''' baz
24724
24725 ; hi ho : hi ho
24726
24727 : {|
24728 | ha
24729 ha
24730 ha
24731 |}
24732 !! end
24733
24734 !! test
24735 Serialize new placeholder space without spans
24736 !! options
24737 parsoid=html2wt
24738 !! html/parsoid
24739 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24740
24741 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24742
24743 <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>
24744 !! wikitext
24745 foo : bar
24746
24747 foo : bar
24748
24749 <ref>foo : bar</ref>ok
24750 !! end
24751
24752
24753 #-----------------------
24754 # Tag minimization tests
24755 #-----------------------
24756
24757 !! test
24758 1. I/B quote minimization: wikitext-only tags should be combined
24759 !! options
24760 parsoid=html2wt
24761 !! html/parsoid
24762 <p><i>A</i><i>B</i></p>
24763 <p><b>A</b><b>B</b></p>
24764 <p><i>A</i><b><i>B</i></b></p>
24765 <p><b>A</b><i><b>B</b></i></p>
24766 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24767 <p><i><b>A</b></i><i><b>B</b></i></p>
24768 <p><i><b>A</b></i><b><i>B</i></b></p>
24769 <p><b><i>A</i></b><i><b>B</b></i></p>
24770 !! wikitext
24771 ''AB''
24772
24773 '''AB'''
24774
24775 ''A'''B'''''
24776
24777 '''A''B'''''
24778
24779 '''A''BC''D'''
24780
24781 '''''AB'''''
24782
24783 '''''AB'''''
24784
24785 '''''AB'''''
24786 !! end
24787
24788 !! test
24789 2. I/B quote minimization: wikitext and html tags should not be combined
24790 !! options
24791 parsoid=html2wt
24792 !! html/parsoid
24793 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24794 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24795 !! wikitext
24796 ''A''<i>B</i>
24797
24798 ''A''<nowiki/>'''<i>B</i>'''
24799 !! end
24800
24801 !! test
24802 3. I/B quote minimization: templated content stops minimization
24803 !! options
24804 parsoid=html2wt
24805 !! html/parsoid
24806 <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>
24807 <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>
24808 !! wikitext
24809 ''A''{{echo|''B''}}
24810
24811 ''A''{{echo|'''''B'''''}}
24812 !! end
24813
24814 !! test
24815 4. I/B quote minimization: new content should be mimimized with adjacent old content
24816 !! options
24817 parsoid=html2wt
24818 !! html/parsoid
24819 <p><i>A</i><i>B</i></p>
24820 <p><b>A</b><b>B</b></p>
24821 <p><i>A</i><b><i>B</i></b></p>
24822 !! wikitext
24823 ''AB''
24824
24825 '''AB'''
24826
24827 ''A'''B'''''
24828 !! end
24829
24830 !! test
24831 5a. Merge adjacent quote nodes if they've been edited
24832 !! options
24833 parsoid={
24834 "modes": ["wt2wt", "selser"],
24835 "changes": [
24836 ["p", "contents", "remove", ":contains('b')"]
24837 ]
24838 }
24839 !! wikitext
24840 ''a''b''c''
24841 !! wikitext/edited
24842 ''ac''
24843 !! end
24844
24845 !! test
24846 5b. Merge adjacent quote nodes if they've been edited
24847 !! options
24848 parsoid={
24849 "modes": ["wt2wt", "selser"],
24850 "changes": [
24851 ["#x", "remove"]
24852 ]
24853 }
24854 !! wikitext
24855 ''a''<span id="x">b</span>''c''
24856 !! wikitext/edited
24857 ''ac''
24858 !! end
24859
24860 !! test
24861 1. Merge adjacent link nodes as long as at least one element is new
24862 !! options
24863 parsoid={
24864 "modes": ["html2wt"],
24865 "scrubWikitext": true
24866 }
24867 !! html/parsoid
24868 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24869 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24870 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24871 !! wikitext
24872 [[Football]]
24873 [[Football]]
24874 [[Football|Foot]][[Football|ball]]
24875 !! end
24876
24877 !! test
24878 2. Merge adjacent link nodes and enable additional normalizations
24879 !! options
24880 parsoid={
24881 "modes": ["html2wt"],
24882 "scrubWikitext": true
24883 }
24884 !! html/parsoid
24885 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24886 !! wikitext
24887 [[Football|''Football'']]
24888 !! end
24889
24890 !! test
24891 3. Don't merge adjacent link nodes if scrubWikitext is false
24892 !! options
24893 parsoid={
24894 "modes": ["html2wt"],
24895 "scrubWikitext": false
24896 }
24897 !! html/parsoid
24898 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24899 !! wikitext
24900 [[Football|Foot]][[Football|ball]]
24901 !! end
24902
24903 #------------------------------
24904 # End of tag minimization tests
24905 #------------------------------
24906
24907 !!test
24908 Bug 54262: New entities
24909 !! options
24910 parsoid=html2wt
24911 !! html/parsoid
24912 <span typeof="mw:Entity">&nbsp;</span>
24913 !! wikitext
24914 &nbsp;
24915 !! end
24916
24917 ## Note that there is no wikitext output for 'unknownproperty' ##
24918 ## Unknown magic words are silently dropped ##
24919
24920 !! test
24921 Magic words
24922 !! options
24923 parsoid=html2wt
24924 !! html/parsoid
24925 <meta property='mw:PageProp/toc' />
24926 <meta property='mw:PageProp/notoc' />
24927 <meta property='mw:PageProp/forcetoc' />
24928 <meta property='mw:PageProp/index' />
24929 <meta property='mw:PageProp/noindex' />
24930 <meta property='mw:PageProp/nogallery' />
24931 <meta property='mw:PageProp/noeditsection' />
24932 <meta property='mw:PageProp/notitleconvert' />
24933 <meta property='mw:PageProp/nocontentconvert' />
24934 <meta property='mw:PageProp/unknownproperty' />
24935 !! wikitext
24936 __TOC__
24937 __NOTOC__
24938 __FORCETOC__
24939 __INDEX__
24940 __NOINDEX__
24941 __NOGALLERY__
24942 __NOEDITSECTION__
24943 __NOTITLECONVERT__
24944 __NOCONTENTCONVERT__
24945 !! end
24946
24947 !! test
24948 Consecutive <pre>s should not get merged
24949 !! options
24950 parsoid=html2wt,html2html
24951 !! html/parsoid
24952 <pre>a</pre><pre>b</pre>
24953
24954 <pre>c
24955 </pre><pre>
24956 d</pre>
24957
24958 <pre>e
24959
24960 </pre><pre>
24961
24962 f</pre>
24963 !! wikitext
24964 a
24965
24966 b
24967
24968 c
24969
24970 d
24971
24972 e
24973
24974
24975
24976 f
24977 !! end
24978
24979 !! test
24980 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24981 !! options
24982 parsoid=html2wt
24983 !! html/parsoid
24984 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24985 !! wikitext
24986 [[Special:BookSources/1234567890|ISBN 1234567895]]
24987 !! end
24988
24989 !! test
24990 Edited RFC links not serializable as RFC links should serialize as extlinks
24991 !! options
24992 parsoid=html2wt
24993 !! html/parsoid
24994 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24995 !! wikitext
24996 [//tools.ietf.org/html/rfc123 New RFC]
24997 !! end
24998
24999 !! test
25000 Edited PMID links not serializable as PMID links should serialize as extlinks
25001 !! options
25002 parsoid=html2wt
25003 !! html/parsoid
25004 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25005 !! wikitext
25006 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25007 !! end
25008
25009 !! test
25010 WTS of autolinks with trailing/surrounding context
25011 !! options
25012 parsoid=html2wt
25013 !! html/parsoid
25014 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25015 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25016 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25017 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25018 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25019 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25020 !! wikitext
25021 http://cscott.net<nowiki/>'''foo'''
25022
25023 http://cscott.net<b>foo</b>
25024
25025 '''http://cscott.net<nowiki/>'''
25026
25027 '''http://cscott.net '''
25028
25029 '''http://cscott.net<nowiki/>x'''
25030
25031 http://cscott.net<nowiki/>x
25032 !! end
25033
25034 !! test
25035 WTS of autolinks with nowikis (round-trip)
25036 !! wikitext
25037 x<nowiki/>http://cscott.net<nowiki/>x
25038 !! html/parsoid
25039 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25040 !! end
25041
25042 # this is the "easy" test because it leaves in place all the
25043 # data-parsoid information indicating this is an autolink
25044 !! test
25045 WTS of autolinks with escapes (editing)
25046 !! options
25047 parsoid={
25048 "modes": ["wt2wt"],
25049 "changes": [
25050 [ "meta", "remove" ]
25051 ]
25052 }
25053 !! wikitext
25054 x<nowiki/>http://cscott.net<nowiki/>x
25055 !! wikitext/edited
25056 x<nowiki/>http://cscott.net<nowiki/>x
25057 !! end
25058
25059 !! test
25060 WTS of edited autolink-like text (T103364)
25061 !! options
25062 parsoid={
25063 "modes": ["wt2wt"],
25064 "changes": [
25065 [ "span[typeof]", "removeAttr", "typeof" ]
25066 ]
25067 }
25068 !! wikitext
25069 Not a link: <nowiki>http://example.com</nowiki>.
25070 !! wikitext/edited
25071 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25072 !! end
25073
25074 !! test
25075 WTS of newly-authored autolink-like text (T103364)
25076 !! options
25077 parsoid=html2wt
25078 !! html/parsoid
25079 <p>http://example.com is not a link.</p>
25080 !! wikitext
25081 <nowiki>http://example.com is not a link.</nowiki>
25082 !! end
25083
25084 !! test
25085 WTS of autolink-like text after an autolink (T108563)
25086 !! options
25087 parsoid=html2wt
25088 !! html/parsoid
25089 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25090 !! wikitext
25091 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25092 !! end
25093
25094 !! test
25095 Edited Redirect link should emit a non-piped wikitext link
25096 !! options
25097 parsoid=html2wt
25098 !! html/parsoid
25099 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25100 !! wikitext
25101 #REDIRECT [[Bar]]
25102 !! end
25103
25104 !! test
25105 T75121: Infer extension name from typeOf if data-mw is not present
25106 !! options
25107 parsoid=html2wt
25108 !! html/parsoid
25109 <div typeOf="mw:Extension/foo"></div>
25110 !! wikitext
25111 <foo />
25112 !! end
25113
25114 # Note that the <p> wrapping isn't present in PHP parser output
25115 # The important thing for this test is that P-wrapping doesn't
25116 # interfere with the <nowiki> protection for leading - in <td>
25117 # (which isn't necessary for <th>).
25118 !! test
25119 T88318: p-wrapped dash in table.
25120 !! options
25121 parsoid=html2wt,wt2wt
25122 !! html/parsoid
25123 <table><tbody>
25124 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25125 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25126 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25127 </tbody></table>
25128 !! wikitext
25129 {|
25130 !-
25131 !-
25132 |-
25133 |<nowiki>-</nowiki>
25134 |<nowiki>- </nowiki>
25135 |-
25136 |<small>-</small>
25137 |<br>
25138 -
25139 |<br>
25140 -
25141 |}
25142 !! html/php+tidy
25143 <table>
25144 <tr>
25145 <th>-</th>
25146 <th>-</th>
25147 </tr>
25148 <tr>
25149 <td>-</td>
25150 <td>-</td>
25151 </tr>
25152 <tr>
25153 <td><small>-</small></td>
25154 <td><br />
25155 <p>-</p>
25156 </td>
25157 <td><br />
25158 <p>-</p>
25159 </td>
25160 </tr>
25161 </table>
25162 !! end
25163
25164 !! test
25165 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25166 !! options
25167 parsoid=html2wt
25168 !! html/parsoid
25169 <table id='mwAb'>
25170 <td id='mwAc'>foo</td>
25171 <td id='serialize-this'>bar</td>
25172 </table>
25173 !! wikitext
25174 {|
25175 |foo
25176 | id="serialize-this" |bar
25177 |}
25178 !! end
25179
25180 !! test
25181 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25182 !! options
25183 parsoid=html2wt
25184 !! html/parsoid
25185 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25186 !! wikitext
25187 <div id="hello">ok</div>
25188 !! end
25189
25190 !! test
25191 WTS change modes
25192 !! options
25193 parsoid={
25194 "modes": ["wt2wt"],
25195 "changes": [
25196 [ "#xyz", "before", "<b>before</b> stuff " ],
25197 [ "#xyz", "after", " stuff <i>after</i>" ],
25198 [ "#xyz", "html", "x <b>y</b> z" ]
25199 ]
25200 }
25201 !! wikitext
25202 <span id="xyz">hello</span>
25203 !! wikitext/edited
25204 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25205 !! end
25206
25207 !! test
25208 Never serialize a-tag as html, regardless of what data-parsoid has to say
25209 !! options
25210 parsoid=html2wt
25211 !! html/parsoid
25212 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25213 !! wikitext
25214 [[Foo]]
25215 !! end
25216
25217 ## SSS FIXME: This is broken output nevertheless.
25218 ## What might be a reasonable non-broken output for this?
25219 ## This is an edge case unlikely to be seen in production
25220 ## that I am not wasting more time on this right now.
25221 !! test
25222 Never serialize a-tag as html, no matter what attributes it has
25223 !! options
25224 parsoid=html2wt
25225 !! html/parsoid
25226 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25227 !! wikitext
25228 [http://boo.org http://boohoo.org]
25229 !! end
25230
25231 # Misnested is an indication that selser can reuse the source but these have
25232 # shown to sneak through on occasion. See T101768.
25233 # The original wikitext here is: [http://test.com [[one]] two three]
25234 !! test
25235 Strip span tags added to mark as misnested
25236 !! options
25237 parsoid=html2wt
25238 !! html/parsoid
25239 <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>
25240 !! wikitext
25241 [http://test.com][[one]] two three
25242 !! end
25243
25244 # --------------------------------------------
25245 # Tests spec'ing wikitext serialization norms |
25246 # --------------------------------------------
25247
25248 !! test
25249 Lists: Add space after bullets
25250 !! options
25251 parsoid=html2wt
25252 !! html/parsoid
25253 <ul>
25254 <li>foo</li>
25255 <li> bar</li>
25256 <li><span> baz</span></li>
25257 </ul>
25258 !! wikitext
25259 * foo
25260 * bar
25261 * <span> baz</span>
25262 !! end
25263
25264 !! test
25265 1. Headings: Add space before/after == (T53744)
25266 !! options
25267 parsoid=html2wt
25268 !! html/parsoid
25269 <h2>foo</h2>
25270 <h2> bar</h2>
25271 <h2>baz </h2>
25272 <h2><span> baz</span></h2>
25273 !! wikitext
25274 == foo ==
25275
25276 == bar ==
25277
25278 == baz ==
25279
25280 == <span> baz</span> ==
25281 !! end
25282
25283 !! test
25284 2. Headings: Add space before/after == even after hoisted content
25285 !! options
25286 parsoid={
25287 "modes": ["html2wt"],
25288 "scrubWikitext": true
25289 }
25290 !! html/parsoid
25291 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25292 !! wikitext
25293 [[Category:A2]]
25294
25295 == ok ==
25296 !! end
25297
25298 !! test
25299 1. Headings: suppress newly created empty headings
25300 !! options
25301 parsoid={
25302 "modes": ["html2wt"],
25303 "scrubWikitext": true
25304 }
25305 !! html/parsoid
25306 <h2></h2>
25307 !! wikitext
25308 !! end
25309
25310 !! test
25311 2. Headings: don't suppress empty headings if scrubWikitext is false
25312 !! options
25313 parsoid=html2wt
25314 !! html/parsoid
25315 <h2></h2>
25316 !! wikitext
25317 ==<nowiki/>==
25318 !! end
25319
25320 !! test
25321 3. Headings: suppress empty headings on edits
25322 !! options
25323 parsoid={
25324 "modes": ["selser"],
25325 "scrubWikitext": true,
25326 "changes": [
25327 [ "#x", "remove"]
25328 ]
25329 }
25330 !! wikitext
25331 ==<span id="x">foo</span>==
25332 !! wikitext/edited
25333 !! end
25334
25335 !! test
25336 1. WT Quote Tags: suppress newly created empty style tags
25337 !! options
25338 parsoid={
25339 "modes": ["html2wt"],
25340 "scrubWikitext": true
25341 }
25342 !! html/parsoid
25343 <i></i><b></b>
25344 !! wikitext
25345 !! end
25346
25347 !! test
25348 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25349 !! options
25350 parsoid=html2wt
25351 !! html/parsoid
25352 <i></i><b></b>
25353 !! wikitext
25354 ''<nowiki/>'''''<nowiki/>'''
25355 !! end
25356
25357 !! test
25358 3. WT Quote Tags: suppress empty style tags on edits
25359 !! options
25360 parsoid={
25361 "modes": ["selser"],
25362 "scrubWikitext": true,
25363 "changes": [
25364 [ "#x", "remove"]
25365 ]
25366 }
25367 !! wikitext
25368 '''<span id="x">foo</span>'''
25369 !! wikitext/edited
25370 !! end
25371
25372 !! test
25373 1. Anchors: suppress newly created empty anchors
25374 !! options
25375 parsoid={
25376 "modes": ["html2wt"],
25377 "scrubWikitext": true
25378 }
25379 !! html/parsoid
25380 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25381 !! wikitext
25382 !! end
25383
25384 !! test
25385 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25386 !! options
25387 parsoid={
25388 "modes": ["html2wt"],
25389 "scrubWikitext": false
25390 }
25391 !! html/parsoid
25392 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25393 !! wikitext
25394 [[Test|<nowiki/>]]
25395 !! end
25396
25397 !! test
25398 3. Anchors: suppress empty anchors on edits
25399 !! options
25400 parsoid={
25401 "modes": ["selser"],
25402 "scrubWikitext": true,
25403 "changes": [
25404 [ "#x", "remove"]
25405 ]
25406 }
25407 !! wikitext
25408 [[Test|<span id="x">foo</span>]]
25409 !! wikitext/edited
25410 !! end
25411
25412 !! test
25413 3a. Anchors: do not suppress numbered extlinks
25414 !! options
25415 parsoid={
25416 "modes": ["wt2wt"],
25417 "scrubWikitext": true
25418 }
25419 !! wikitext
25420 [http://foo.com]
25421 !! html/parsoid
25422 <a rel="mw:ExtLink" href="http://foo.com"></a>
25423 !! end
25424
25425 !! test
25426 3b. Anchors: do not suppress numbered extlinks
25427 !! options
25428 parsoid={
25429 "modes": ["wt2wt"],
25430 "scrubWikitext": true,
25431 "changes": [
25432 [ "#x", "remove"]
25433 ]
25434 }
25435 !! wikitext
25436 [http://foo.com <span id="x">foo</span>]
25437 !! wikitext/edited
25438 [http://foo.com]
25439 !! end
25440
25441 !!test
25442 Normalizations should be restricted to edited content
25443 !!options
25444 parsoid={
25445 "modes": ["selser"],
25446 "scrubWikitext": true,
25447 "changes": [
25448 [ "h1", "before", "<i></i>"]
25449 ]
25450 }
25451 !!wikitext
25452 a
25453 = =
25454 b
25455 !!wikitext/edited
25456 a
25457 = =
25458 b
25459 !!end
25460
25461 !! test
25462 1. Multiple normalizations (html2wt)
25463 !! options
25464 parsoid={
25465 "modes": ["html2wt"],
25466 "scrubWikitext": true
25467 }
25468 !! html
25469 <h2><i></i></h2>
25470 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25471 </a><b><i></i></b>x</p>
25472 !! wikitext
25473
25474 [[foo]]
25475 x
25476
25477 !! end
25478
25479 !! test
25480 2. Multiple normalizations (selser)
25481 !! options
25482 parsoid={
25483 "modes": ["selser"],
25484 "scrubWikitext": true,
25485 "changes": [
25486 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25487 ]
25488 }
25489 !! wikitext
25490 <span id="x">foo</span>
25491 !! wikitext/edited
25492 <span id="x">foo</span>
25493
25494 x
25495 !! end
25496
25497 !! test
25498 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25499 !! options
25500 parsoid={
25501 "modes": ["html2wt"],
25502 "scrubWikitext": true
25503 }
25504 !! html/parsoid
25505 <p> hi</p>
25506 <p> hello</p>
25507 !! wikitext
25508 hi
25509
25510 hello
25511 !! end
25512
25513 !! test
25514 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25515 !! options
25516 parsoid=html2wt
25517 !! html/parsoid
25518 <p> hi</p>
25519 <p> hello</p>
25520 !! wikitext
25521 <nowiki> </nowiki>hi
25522
25523 <nowiki> </nowiki> hello
25524 !! end
25525
25526 !! test
25527 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25528 !! options
25529 parsoid={
25530 "modes": ["html2wt"],
25531 "scrubWikitext": true
25532 }
25533 !! html/parsoid
25534 <p>Foo
25535 bar
25536 baz</p>
25537
25538 <table><tr><td>Foo
25539 bar
25540 baz bang</td></tr></table>
25541
25542 <p><!--boo--> foo
25543 bar</p>
25544
25545 <p> foo
25546 bar<span>boo</span></p>
25547 !! wikitext
25548 Foo
25549 bar
25550 baz
25551
25552 {|
25553 |Foo
25554 bar
25555 baz bang
25556 |}
25557
25558 <!--boo-->foo
25559 bar
25560
25561 foo
25562 bar<span>boo</span>
25563 !! end
25564
25565 !! test
25566 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25567 !! options
25568 parsoid={
25569 "modes": ["selser"],
25570 "scrubWikitext": true,
25571 "changes": [
25572 [ "p", "html", " a\n b" ]
25573 ]
25574 }
25575 !! wikitext
25576 xyz
25577 !! wikitext/edited
25578 a
25579 b
25580 !! end
25581
25582 !! test
25583 1. New links that end in spaces
25584 !! options
25585 parsoid={
25586 "modes": ["html2wt"],
25587 "scrubWikitext": false
25588 }
25589 !! html/parsoid
25590 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25591 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25592 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25593 !! wikitext
25594 [[Berlin ]]<nowiki/>is the capital of Germany.
25595
25596 [[Foo ]]'''bar'''
25597
25598 [[Boston ]] is a city.
25599 !! end
25600
25601 !! test
25602 2. New links that end in spaces
25603 !! options
25604 parsoid={
25605 "modes": ["html2wt"],
25606 "scrubWikitext": true
25607 }
25608 !! html/parsoid
25609 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25610 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25611 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25612 !! wikitext
25613 [[Berlin]] is the capital of Germany.
25614
25615 [[Foo]] '''bar'''
25616
25617 [[Boston]] is a city.
25618 !! end
25619
25620 !! test
25621 1. Table cells with escapable prefixes
25622 !! options
25623 parsoid={
25624 "modes": ["html2wt"],
25625 "scrubWikitext": false
25626 }
25627 !! html
25628 <table>
25629 <tr><td>a</td></tr>
25630 <tr><td>-</td></tr>
25631 <tr><td>+</td></tr>
25632 </table>
25633 !! wikitext
25634 {|
25635 |a
25636 |-
25637 |<nowiki>-</nowiki>
25638 |-
25639 |<nowiki>+</nowiki>
25640 |}
25641 !! end
25642
25643 !! test
25644 2. Table cells with escapable prefixes
25645 !! options
25646 parsoid={
25647 "modes": ["html2wt"],
25648 "scrubWikitext": true
25649 }
25650 !! html
25651 <table>
25652 <tr><td>a</td></tr>
25653 <tr><td>-</td></tr>
25654 <tr><td>+</td></tr>
25655 </table>
25656 !! wikitext
25657 {|
25658 |a
25659 |-
25660 | -
25661 |-
25662 | +
25663 |}
25664 !! end
25665
25666 !! test
25667 3a. Table cells with escapable prefixes after edits
25668 !! options
25669 parsoid={
25670 "modes": ["selser"],
25671 "scrubWikitext": true,
25672 "changes": [
25673 [ "table tbody tr:first-child td:first-child", "remove"]
25674 ]
25675 }
25676 !! wikitext
25677 {|
25678 |a||-
25679 |}
25680 !! wikitext/edited
25681 {|
25682 | -
25683 |}
25684 !! end
25685
25686 !! test
25687 3b. Table cells with escapable prefixes after edits
25688 !! options
25689 parsoid={
25690 "modes": ["selser"],
25691 "scrubWikitext": true,
25692 "changes": [
25693 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25694 [ "#x", "remove" ]
25695 ]
25696 }
25697 !! wikitext
25698 {|
25699 |pqr
25700 |<span id="x">foo</span>+
25701 |}
25702 !! wikitext/edited
25703 {|
25704 | -
25705 | +
25706 |}
25707 !! end
25708
25709 # FIXME: This test will fail because
25710 # normalization doesn't realize that the id attribute
25711 # will eliminate the escapable scenario
25712 !! test
25713 4a. Table cells without escapable prefixes after edits
25714 !! options
25715 parsoid={
25716 "modes": ["selser"],
25717 "scrubWikitext": true,
25718 "changes": [
25719 [ "#x", "html", "-" ]
25720 ]
25721 }
25722 !! wikitext
25723 {|
25724 | id="x" |abcd
25725 |}
25726 !! wikitext/edited
25727 {|
25728 | id="x" |-
25729 |}
25730 !! end
25731
25732 ## This tests normalizer's ability to discriminate between
25733 ## cells having identical content.
25734 !! test
25735 4b. Table cells without escapable prefixes after edits
25736 !! options
25737 parsoid={
25738 "modes": ["selser"],
25739 "scrubWikitext": true,
25740 "changes": [
25741 [ "td", "html", "-" ]
25742 ]
25743 }
25744 !! wikitext
25745 {|
25746 |a||b
25747 |}
25748 !! wikitext/edited
25749 {|
25750 | -||-
25751 |}
25752 !! end
25753
25754 ## This tests normalizer's ability to not be tripped by
25755 ## comments (and whitespace)
25756 !! test
25757 4c. Table cells without escapable prefixes after edits
25758 !! options
25759 parsoid={
25760 "modes": ["selser"],
25761 "scrubWikitext": true,
25762 "changes": [
25763 [ "table tbody tr td:first-child", "remove" ]
25764 ]
25765 }
25766 !! wikitext
25767 {|
25768 |-
25769 <!--foo--> |a||-
25770 |}
25771 !! wikitext/edited
25772 {|
25773 |-
25774 <!--foo--> | -
25775 |}
25776 !! end
25777
25778 ## This tests normalizer's ability to handle HTML cells
25779 !! test
25780 4d. Table cells without escapable prefixes after edits
25781 !! options
25782 parsoid={
25783 "modes": ["selser"],
25784 "scrubWikitext": true,
25785 "changes": [
25786 [ "td", "html", "-" ]
25787 ]
25788 }
25789 !! wikitext
25790 <table>
25791 <tr><td>a</td></tr>
25792 </table>
25793 !! wikitext/edited
25794 <table>
25795 <tr><td>-</td></tr>
25796 </table>
25797 !! end
25798
25799 # ---------------------------------------------------
25800 # End of tests spec'ing wikitext serialization norms |
25801 # ---------------------------------------------------
25802
25803 # -----------------------------------------------------------------
25804 # End of section for Parsoid-only html2wt tests for serialization
25805 # of new content
25806 # -----------------------------------------------------------------
25807
25808 # -----------------------------------------------------------------
25809 # The following section of tests are primarily to spec behavior of
25810 # the selective serializer. All these tests have manual selser
25811 # changes. The automated selser changes for all tests handle the
25812 # wide variation of changes, but these tests here capture specs
25813 # deterministically.
25814 # ----------------------------------------------------------------
25815
25816 ## T90517
25817 !! test
25818 Selser: New comments should not be lost
25819 !! options
25820 parsoid={
25821 "modes": ["selser"],
25822 "changes": [
25823 [ "#a", "after", "<!--c1-->" ],
25824 [ "#b", "before", "<!--c2-->" ]
25825 ]
25826 }
25827 !! wikitext
25828 <span id="a">a</span>
25829
25830 <span id="b">b</span>
25831 !! wikitext/edited
25832 <span id="a">a</span><!--c1-->
25833
25834 <!--c2--><span id="b">b</span>
25835 !! end
25836
25837 ## T89383
25838 !! test
25839 Selser: Check for validity of DSR before using it
25840 !! options
25841 parsoid={
25842 "modes": ["selser"],
25843 "changes": [
25844 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
25845 ]
25846 }
25847 !! wikitext
25848 <span id="a">a</span>
25849 !! wikitext/edited
25850 {{DISPLAYTITLE:foo}}
25851 <span id="a">a</span>
25852 !! end
25853
25854 !! test
25855 1. DOMDiff: Changes to <ref> content should be looked up using id
25856 !! options
25857 parsoid={
25858 "modes": ["selser"],
25859 "changes": [
25860 ["#X", "after", "bar"],
25861 ["#Y", "after", "baz"]
25862 ]
25863 }
25864 !! wikitext
25865 X <ref><span id="X">foo</span></ref>
25866 Y <ref name="a" />
25867 <references>
25868 <ref name="a"><span id="Y">foo</span></ref>
25869 </references>
25870 !! wikitext/edited
25871 X <ref><span id="X">foo</span>bar</ref>
25872 Y <ref name="a" />
25873 <references>
25874 <ref name="a"><span id="Y">foo</span>baz</ref>
25875 </references>
25876 !! end
25877
25878 !! test
25879 2. DOMDiff: Changes to <ref> content should be looked up using id
25880 !! options
25881 parsoid={
25882 "modes": ["selser"],
25883 "changes": [
25884 ["#Z", "after", "bar"]
25885 ]
25886 }
25887 !! wikitext
25888 A <ref>foo bar for a</ref>
25889 B <ref group="X" name="b" />
25890
25891 <references />
25892
25893 <references group="X">
25894 <ref name="b"><span id="Z">foo</span></ref>
25895 </references>
25896 !! wikitext/edited
25897 A <ref>foo bar for a</ref>
25898 B <ref group="X" name="b" />
25899
25900 <references />
25901
25902 <references group="X">
25903 <ref name="b"><span id="Z">foo</span>bar</ref>
25904 </references>
25905 !! end